Code Duplication    Length = 7-7 lines in 4 locations

src/NodeGenerator.php 2 locations

@@ 147-153 (lines=7) @@
144
        $expr = $this->createArrayNode();
145
146
        foreach ($data as $key => $value) {
147
            if ($value instanceof \stdClass) {
148
                $nodeExpr = $this->createObjectNode();
149
            } elseif (is_array($value)) {
150
                $nodeExpr = $this->createArrayNode();
151
            } else {
152
                $nodeExpr = $this->createScalarNode($value);
153
            }
154
155
            if ($value instanceof \stdClass) {
156
                $nodeExpr = $this->appendChildrenToObjectNode($value);
@@ 176-182 (lines=7) @@
173
        $expr = $this->createObjectNode();
174
175
        foreach ($data as $key => $value) {
176
            if ($value instanceof \stdClass) {
177
                $nodeExpr = $this->createObjectNode();
178
            } elseif (is_array($value)) {
179
                $nodeExpr = $this->createArrayNode();
180
            } else {
181
                $nodeExpr = $this->createScalarNode($value);
182
            }
183
184
            if ($value instanceof \stdClass) {
185
                $nodeExpr = $this->appendChildrenToObjectNode($value);

src/QueryBuilderGenerator.php 2 locations

@@ 149-155 (lines=7) @@
146
    private function appendChildrenToArrayNode(Expr $queryBuilder, Expr $expr, array $data)
147
    {
148
        foreach ($data as $value) {
149
            if ($value instanceof \stdClass) {
150
                $argument = $this->createObjectNode($queryBuilder);
151
            } elseif (is_array($value)) {
152
                $argument = $this->createArrayNode($queryBuilder);
153
            } else {
154
                $argument = $this->createScalarNode($queryBuilder, $value);
155
            }
156
157
            $expr = new MethodCall($expr, 'addToArrayNode', [new Arg($argument)]);
158
@@ 178-184 (lines=7) @@
175
    private function appendChildrenToObjectNode(Expr $queryBuilder, Expr $expr, \stdClass $data)
176
    {
177
        foreach ($data as $key => $value) {
178
            if ($value instanceof \stdClass) {
179
                $argument = $this->createObjectNode($queryBuilder);
180
            } elseif (is_array($value)) {
181
                $argument = $this->createArrayNode($queryBuilder);
182
            } else {
183
                $argument = $this->createScalarNode($queryBuilder, $value);
184
            }
185
186
            $expr = new MethodCall($expr, 'addToObjectNode', [new Arg(new String_($key)), new Arg($argument)]);
187