Code Duplication    Length = 22-23 lines in 2 locations

lib/Doctrine/ORM/Tools/EntityGenerator.php 2 locations

@@ 926-947 (lines=22) @@
923
     *
924
     * @return bool
925
     */
926
    protected function hasProperty($property, ClassMetadataInfo $metadata)
927
    {
928
        if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) {
929
            // don't generate property if its already on the base class.
930
            $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name);
931
            if ($reflClass->hasProperty($property)) {
932
                return true;
933
            }
934
        }
935
936
        // check traits for existing property
937
        foreach ($this->getTraits($metadata) as $trait) {
938
            if ($trait->hasProperty($property)) {
939
                return true;
940
            }
941
        }
942
943
        return (
944
            isset($this->staticReflection[$metadata->name]) &&
945
            in_array($property, $this->staticReflection[$metadata->name]['properties'], true)
946
        );
947
    }
948
949
    /**
950
     * @param string            $method
@@ 955-977 (lines=23) @@
952
     *
953
     * @return bool
954
     */
955
    protected function hasMethod($method, ClassMetadataInfo $metadata)
956
    {
957
        if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) {
958
            // don't generate method if its already on the base class.
959
            $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name);
960
961
            if ($reflClass->hasMethod($method)) {
962
                return true;
963
            }
964
        }
965
966
        // check traits for existing method
967
        foreach ($this->getTraits($metadata) as $trait) {
968
            if ($trait->hasMethod($method)) {
969
                return true;
970
            }
971
        }
972
973
        return (
974
            isset($this->staticReflection[$metadata->name]) &&
975
            in_array(strtolower($method), $this->staticReflection[$metadata->name]['methods'], true)
976
        );
977
    }
978
979
    /**
980
     * @param ClassMetadataInfo $metadata