Code Duplication    Length = 10-10 lines in 2 locations

lib/Doctrine/ODM/MongoDB/UnitOfWork.php 2 locations

@@ 1535-1544 (lines=10) @@
1532
     * @return object
1533
     * @throws InvalidArgumentException if the class does not have an identifier
1534
     */
1535
    public function getById($id, ClassMetadata $class)
1536
    {
1537
        if ( ! $class->identifier) {
1538
            throw new \InvalidArgumentException(sprintf('Class "%s" does not have an identifier', $class->name));
1539
        }
1540
1541
        $serializedId = serialize($class->getDatabaseIdentifierValue($id));
1542
1543
        return $this->identityMap[$class->name][$serializedId];
1544
    }
1545
1546
    /**
1547
     * INTERNAL:
@@ 1557-1566 (lines=10) @@
1554
     * @return mixed The found document or FALSE.
1555
     * @throws InvalidArgumentException if the class does not have an identifier
1556
     */
1557
    public function tryGetById($id, ClassMetadata $class)
1558
    {
1559
        if ( ! $class->identifier) {
1560
            throw new \InvalidArgumentException(sprintf('Class "%s" does not have an identifier', $class->name));
1561
        }
1562
1563
        $serializedId = serialize($class->getDatabaseIdentifierValue($id));
1564
1565
        return $this->identityMap[$class->name][$serializedId] ?? false;
1566
    }
1567
1568
    /**
1569
     * Schedules a document for dirty-checking at commit-time.