This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Benoth\StaticReflection\Reflection; |
||
4 | |||
5 | class ReflectionClass extends ReflectionClassLike |
||
6 | { |
||
7 | use Parts\AbstractTrait; |
||
8 | use Parts\FinalTrait; |
||
9 | use Parts\InterfaceTrait; |
||
10 | use Parts\ConstantTrait; |
||
11 | use Parts\PropertyTrait; |
||
12 | use Parts\TraitUseTrait; |
||
13 | |||
14 | protected $parent; |
||
15 | |||
16 | 648 | public function getParent() |
|
17 | { |
||
18 | 648 | return $this->parent; |
|
19 | } |
||
20 | |||
21 | 630 | public function getParentClass() |
|
22 | { |
||
23 | 630 | if (!$this->getParent()) { |
|
24 | 591 | return; |
|
25 | } |
||
26 | |||
27 | // Return internal objects Reflection |
||
28 | 240 | if (class_exists($this->getParent(), false)) { |
|
29 | 36 | $reflection = new \ReflectionClass($this->getParent()); |
|
30 | 36 | if ($reflection->isInternal()) { |
|
31 | 36 | return $reflection; |
|
32 | } |
||
33 | } |
||
34 | |||
35 | 204 | return $this->index->getClass($this->getParent()); |
|
36 | } |
||
37 | |||
38 | 312 | public function setParent($parent) |
|
39 | { |
||
40 | 312 | $this->parent = $parent; |
|
41 | |||
42 | 312 | return $this; |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | public function isSubclassOf($className) |
||
49 | { |
||
50 | if (!is_string($className)) { |
||
51 | return false; |
||
52 | } |
||
53 | |||
54 | $className = ltrim($className, '\\'); |
||
55 | if ($this->hasInterface($className)) { |
||
56 | return true; |
||
57 | } |
||
58 | |||
59 | $parent = $this->getParentClass(); |
||
60 | while ($parent instanceof self) { |
||
61 | if ($className === $parent->getName()) { |
||
62 | return true; |
||
63 | } |
||
64 | |||
65 | $parent = $parent->getParentClass(); |
||
66 | } |
||
67 | |||
68 | return false; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Returns if the class is cloneable. |
||
73 | * |
||
74 | * @return bool |
||
75 | */ |
||
76 | 15 | public function isCloneable() |
|
77 | { |
||
78 | 15 | if ($this->hasMethod('__clone')) { |
|
79 | 3 | return $this->getMethod('__clone')->isPublic(); |
|
80 | } |
||
81 | |||
82 | 12 | return true; |
|
83 | } |
||
84 | |||
85 | /** |
||
86 | * Checks if the class is instantiable. |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | 15 | public function isInstantiable() |
|
91 | { |
||
92 | 15 | if ($this->hasMethod('__construct')) { |
|
93 | 12 | return $this->getMethod('__construct')->isPublic(); |
|
94 | } |
||
95 | |||
96 | 3 | return true; |
|
97 | } |
||
98 | |||
99 | /** |
||
100 | * Checks if an object is an instance of the class. |
||
101 | * |
||
102 | * @param object $object |
||
103 | * |
||
104 | * @return bool |
||
105 | */ |
||
106 | 3 | public function isInstance($object) |
|
107 | { |
||
108 | 3 | return get_class($object) === $this->getName(); |
|
109 | } |
||
110 | |||
111 | /** |
||
112 | * Checks if the class is iterateable. |
||
113 | * |
||
114 | * @return bool |
||
115 | */ |
||
116 | 15 | public function isIterateable() |
|
117 | { |
||
118 | 15 | foreach ($this->getInterfaceNames() as $interfaceName) { |
|
119 | 9 | if (trim($interfaceName, '\\') === 'Iterator') { |
|
120 | 6 | return true; |
|
121 | } |
||
122 | 9 | } |
|
123 | |||
124 | 9 | return false; |
|
125 | } |
||
126 | |||
127 | /** |
||
128 | * Creates a new class instance from given arguments. |
||
129 | * |
||
130 | * @throws \ReflectionException Always... Can't be implemented. |
||
131 | * |
||
132 | * @return object |
||
133 | */ |
||
134 | 15 | public function newInstance() |
|
135 | { |
||
136 | 15 | throw new \ReflectionException('StaticReflection can\'t create instances'); |
|
137 | } |
||
138 | |||
139 | /** |
||
140 | * Creates a new instance of the class, the given arguments are passed to the class constructor. |
||
141 | * |
||
142 | * |
||
143 | * @param array $args The parameters to be passed to the class constructor as an array. |
||
144 | * |
||
145 | * @throws \ReflectionException Always... Can't be implemented. |
||
146 | * |
||
147 | * @return object |
||
148 | */ |
||
149 | 15 | public function newInstanceArgs(array $args) |
|
0 ignored issues
–
show
|
|||
150 | { |
||
151 | 15 | throw new \ReflectionException('StaticReflection can\'t create instances'); |
|
152 | } |
||
153 | |||
154 | /** |
||
155 | * Creates a new class instance without invoking the constructor. |
||
156 | * |
||
157 | * @throws \ReflectionException Always... Can't be implemented. |
||
158 | * |
||
159 | * @return object |
||
160 | */ |
||
161 | 15 | public function newInstanceWithoutConstructor() |
|
162 | { |
||
163 | 15 | throw new \ReflectionException('StaticReflection can\'t create instances'); |
|
164 | } |
||
165 | } |
||
166 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.