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

@@ 553-574 (lines=22) @@
550
        }
551
552
        // Append new object to mixed result sets
553
        if (isset($rowData['newObjects'])) {
554
            if ( ! isset($resultKey) ) {
555
                $resultKey = $this->resultCounter - 1;
556
            }
557
558
559
            $scalarCount = (isset($rowData['scalars'])? count($rowData['scalars']): 0);
560
561
            foreach ($rowData['newObjects'] as $objIndex => $newObject) {
562
                $class  = $newObject['class'];
563
                $args   = $newObject['args'];
564
                $obj    = $class->newInstanceArgs($args);
565
566
                if ($scalarCount == 0 && count($rowData['newObjects']) == 1 ) {
567
                    $result[$resultKey] = $obj;
568
569
                    continue;
570
                }
571
572
                $result[$resultKey][$objIndex] = $obj;
573
            }
574
        }
575
    }
576
577
    /**