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

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