Code Duplication    Length = 7-7 lines in 4 locations

src/Generator/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/Generator/QueryBuilderGenerator.php 2 locations

@@ 113-119 (lines=7) @@
110
    private function appendChildrenToArrayNode(Expr $queryBuilder, Expr $expr, array $data)
111
    {
112
        foreach ($data as $value) {
113
            if ($value instanceof \stdClass) {
114
                $argument = $this->createObjectNode($queryBuilder);
115
            } elseif (is_array($value)) {
116
                $argument = $this->createArrayNode($queryBuilder);
117
            } else {
118
                $argument = $this->createScalarNode($queryBuilder, $value);
119
            }
120
121
            $expr = new MethodCall($expr, 'addToArrayNode', [new Arg($argument)]);
122
@@ 142-148 (lines=7) @@
139
    private function appendChildrenToObjectNode(Expr $queryBuilder, Expr $expr, \stdClass $data)
140
    {
141
        foreach ($data as $key => $value) {
142
            if ($value instanceof \stdClass) {
143
                $argument = $this->createObjectNode($queryBuilder);
144
            } elseif (is_array($value)) {
145
                $argument = $this->createArrayNode($queryBuilder);
146
            } else {
147
                $argument = $this->createScalarNode($queryBuilder, $value);
148
            }
149
150
            $expr = new MethodCall($expr, 'addToObjectNode', [new Arg(new String_($key)), new Arg($argument)]);
151