Code Duplication    Length = 18-18 lines in 2 locations

lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php 1 location

@@ 793-810 (lines=18) @@
790
     *
791
     * @return array
792
     */
793
    private function cacheToArray(SimpleXMLElement $cacheMapping)
794
    {
795
        $region = isset($cacheMapping['region']) ? (string) $cacheMapping['region'] : null;
796
        $usage  = isset($cacheMapping['usage']) ? strtoupper($cacheMapping['usage']) : null;
797
798
        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage)) {
799
            throw new \InvalidArgumentException(sprintf('Invalid cache usage "%s"', $usage));
800
        }
801
802
        if ($usage) {
803
            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
804
        }
805
806
        return [
807
            'usage'  => $usage,
808
            'region' => $region,
809
        ];
810
    }
811
812
    /**
813
     * Gathers a list of cascade options found in the given cascade element.

lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php 1 location

@@ 785-802 (lines=18) @@
782
     *
783
     * @return array
784
     */
785
    private function cacheToArray($cacheMapping)
786
    {
787
        $region = isset($cacheMapping['region']) ? (string) $cacheMapping['region'] : null;
788
        $usage  = isset($cacheMapping['usage']) ? strtoupper($cacheMapping['usage']) : null;
789
790
        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage)) {
791
            throw new \InvalidArgumentException(sprintf('Invalid cache usage "%s"', $usage));
792
        }
793
794
        if ($usage) {
795
            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
796
        }
797
798
        return [
799
            'usage'  => $usage,
800
            'region' => $region,
801
        ];
802
    }
803
804
    /**
805
     * {@inheritDoc}