@@ 857-878 (lines=22) @@ | ||
854 | * |
|
855 | * @return bool |
|
856 | */ |
|
857 | protected function hasProperty($property, ClassMetadataInfo $metadata) |
|
858 | { |
|
859 | if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
860 | // don't generate property if its already on the base class. |
|
861 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
|
862 | if ($reflClass->hasProperty($property)) { |
|
863 | return true; |
|
864 | } |
|
865 | } |
|
866 | ||
867 | // check traits for existing property |
|
868 | foreach ($this->getTraits($metadata) as $trait) { |
|
869 | if ($trait->hasProperty($property)) { |
|
870 | return true; |
|
871 | } |
|
872 | } |
|
873 | ||
874 | return ( |
|
875 | isset($this->staticReflection[$metadata->name]) && |
|
876 | in_array($property, $this->staticReflection[$metadata->name]['properties'], true) |
|
877 | ); |
|
878 | } |
|
879 | ||
880 | /** |
|
881 | * @param string $method |
|
@@ 886-908 (lines=23) @@ | ||
883 | * |
|
884 | * @return bool |
|
885 | */ |
|
886 | protected function hasMethod($method, ClassMetadataInfo $metadata) |
|
887 | { |
|
888 | if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
889 | // don't generate method if its already on the base class. |
|
890 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
|
891 | ||
892 | if ($reflClass->hasMethod($method)) { |
|
893 | return true; |
|
894 | } |
|
895 | } |
|
896 | ||
897 | // check traits for existing method |
|
898 | foreach ($this->getTraits($metadata) as $trait) { |
|
899 | if ($trait->hasMethod($method)) { |
|
900 | return true; |
|
901 | } |
|
902 | } |
|
903 | ||
904 | return ( |
|
905 | isset($this->staticReflection[$metadata->name]) && |
|
906 | in_array(strtolower($method), $this->staticReflection[$metadata->name]['methods'], true) |
|
907 | ); |
|
908 | } |
|
909 | ||
910 | /** |
|
911 | * @param ClassMetadataInfo $metadata |