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

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