Code Duplication    Length = 21-22 lines in 2 locations

lib/Doctrine/ORM/Internal/Hydration/ArrayHydrator.php 1 location

@@ 244-264 (lines=21) @@
241
        }
242
243
        // Append new object to mixed result sets
244
        if (isset($rowData['newObjects'])) {
245
            if ( ! isset($resultKey)) {
246
                $resultKey = $this->_resultCounter - 1;
247
            }
248
249
            $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0);
250
251
            foreach ($rowData['newObjects'] as $objIndex => $newObject) {
252
                $class  = $newObject['class'];
253
                $args   = $newObject['args'];
254
                $obj    = $class->newInstanceArgs($args);
255
256
                if (count($args) == $scalarCount || ($scalarCount == 0 && count($rowData['newObjects']) == 1)) {
257
                    $result[$resultKey] = $obj;
258
259
                    continue;
260
                }
261
262
                $result[$resultKey][$objIndex] = $obj;
263
            }
264
        }
265
    }
266
267
    /**

lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php 1 location

@@ 611-632 (lines=22) @@
608
        }
609
610
        // Append new object to mixed result sets
611
        if (isset($rowData['newObjects'])) {
612
            if ( ! isset($resultKey) ) {
613
                $resultKey = $this->resultCounter - 1;
614
            }
615
616
617
            $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0);
618
619
            foreach ($rowData['newObjects'] as $objIndex => $newObject) {
620
                $class  = $newObject['class'];
621
                $args   = $newObject['args'];
622
                $obj    = $class->newInstanceArgs($args);
623
624
                if ($scalarCount == 0 && count($rowData['newObjects']) == 1 ) {
625
                    $result[$resultKey] = $obj;
626
627
                    continue;
628
                }
629
630
                $result[$resultKey][$objIndex] = $obj;
631
            }
632
        }
633
    }
634
635
    /**