Conditions | 5 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | public function has($id) |
||
33 | { |
||
34 | $id = (string)$id; |
||
35 | |||
36 | if (!class_exists($id)) { |
||
37 | return false; |
||
38 | } |
||
39 | |||
40 | $classReflector = new \ReflectionClass($id); |
||
41 | |||
42 | if (!$classReflector->isInstantiable()) { |
||
43 | return false; |
||
44 | } |
||
45 | |||
46 | $constructorReflector = $classReflector->getConstructor(); |
||
47 | |||
48 | if ($constructorReflector && $constructorReflector->getNumberOfRequiredParameters()) { |
||
49 | return false; |
||
50 | } |
||
51 | |||
52 | return true; |
||
53 | } |
||
55 |