Conditions | 10 |
Paths | 7 |
Total Lines | 43 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
81 | public function hasInjector(string $class): bool |
||
82 | { |
||
83 | try { |
||
84 | $reflection = new \ReflectionClass($class); |
||
85 | } catch (\ReflectionException $e) { |
||
86 | throw new ContainerException($e->getMessage(), $e->getCode(), $e); |
||
87 | } |
||
88 | |||
89 | if (\array_key_exists($class, $this->state->injectors)) { |
||
90 | return $this->state->injectors[$class] !== null; |
||
91 | } |
||
92 | |||
93 | if ( |
||
94 | $reflection->implementsInterface(InjectableInterface::class) |
||
95 | && $reflection->hasConstant('INJECTOR') |
||
96 | ) { |
||
97 | $this->state->injectors[$class] = $reflection->getConstant('INJECTOR'); |
||
98 | |||
99 | return true; |
||
100 | } |
||
101 | |||
102 | // check interfaces |
||
103 | foreach ($this->state->injectors as $target => $injector) { |
||
104 | if ( |
||
105 | \class_exists($target, true) |
||
106 | && $reflection->isSubclassOf($target) |
||
107 | ) { |
||
108 | $this->state->injectors[$class] = $injector; |
||
109 | |||
110 | return true; |
||
111 | } |
||
112 | |||
113 | if ( |
||
114 | \interface_exists($target, true) |
||
115 | && $reflection->implementsInterface($target) |
||
116 | ) { |
||
117 | $this->state->injectors[$class] = $injector; |
||
118 | |||
119 | return true; |
||
120 | } |
||
121 | } |
||
122 | |||
123 | return false; |
||
124 | } |
||
126 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths