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

@@ 629-650 (lines=22) @@
626
        }
627
628
        // Append new object to mixed result sets
629
        if (isset($rowData['newObjects'])) {
630
            if ( ! isset($resultKey) ) {
631
                $resultKey = $this->resultCounter - 1;
632
            }
633
634
635
            $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0);
636
637
            foreach ($rowData['newObjects'] as $objIndex => $newObject) {
638
                $class  = $newObject['class'];
639
                $args   = $newObject['args'];
640
                $obj    = $class->newInstanceArgs($args);
641
642
                if ($scalarCount == 0 && count($rowData['newObjects']) == 1 ) {
643
                    $result[$resultKey] = $obj;
644
645
                    continue;
646
                }
647
648
                $result[$resultKey][$objIndex] = $obj;
649
            }
650
        }
651
    }
652
653
    /**