1 | <?php |
||
14 | class ClassAnalyzer |
||
15 | { |
||
16 | /** |
||
17 | * Returns all parents of a class (parent, parent of parent, parent of parent's parent and so on). |
||
18 | * |
||
19 | * @param ReflectionClass|string $class A ReflectionClass object or a class name |
||
20 | * |
||
21 | * @return array |
||
22 | */ |
||
23 | public static function getAncestors($class) |
||
34 | |||
35 | /** |
||
36 | * getTraits. |
||
37 | * |
||
38 | * This static method returns back all traits used by a given class |
||
39 | * recursively |
||
40 | * |
||
41 | * @param ReflectionClass|string $class A ReflectionClass object or a class name |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | public static function getTraits($class) |
||
49 | |||
50 | /** |
||
51 | * getInterfaces. |
||
52 | * |
||
53 | * @param ReflectionClass|string $class A ReflectionClass object or a class name |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | public static function getInterfaces($class) |
||
63 | |||
64 | /** |
||
65 | * hasTraits. |
||
66 | * |
||
67 | * This static method returns back all traits used by a given class |
||
68 | * recursively |
||
69 | * |
||
70 | * @param ReflectionClass|string $class A ReflectionClass object or a class name |
||
71 | * @param string $traitName A string representing an existing trait |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | public static function hasTrait($class, $traitName) |
||
79 | |||
80 | /** |
||
81 | * hasProperty. |
||
82 | * |
||
83 | * This static method says if a class has a property |
||
84 | * |
||
85 | * @param ReflectionClass|string $class A ReflectionClass object or a class name |
||
86 | * @param string $propertyName A string representing an existing property |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | public static function hasProperty($class, $propertyName) |
||
106 | |||
107 | /** |
||
108 | * hasMethod. |
||
109 | * |
||
110 | * This static method says if a class has a method |
||
111 | * |
||
112 | * @param ReflectionClass|string $class A ReflectionClass object or a class name |
||
113 | * @param string $methodName a method name |
||
114 | * |
||
115 | * @return bool |
||
116 | */ |
||
117 | public static function hasMethod($class, $methodName) |
||
123 | |||
124 | /** |
||
125 | * @param ReflectionClass|string $class A ReflectionClass object or a class name |
||
126 | * @param array $traits An array of traits (strings) |
||
127 | * |
||
128 | * @return array |
||
129 | */ |
||
130 | private static function _getTraits($class, array $traits = null) |
||
152 | } |
||
153 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.