Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function register(Container $container) |
||
18 | { |
||
19 | $this->registerRequirements($container); |
||
|
|||
20 | |||
21 | $container['errorHandler.defaultProvider'] = function () use ($container) { |
||
22 | throw new \RuntimeException('Please configure your default provider for error handler!'); |
||
23 | }; |
||
24 | |||
25 | $container['errorHandler.providers'] = function () use ($container) { |
||
26 | return []; |
||
27 | }; |
||
28 | |||
29 | $container['errorHandler'] = function () use ($container) { |
||
30 | return new AdvancedErrorHandler( |
||
31 | $container['errorHandler.contentTypeResolver'], |
||
32 | $container['errorHandler.defaultProvider'], |
||
33 | $container['errorHandler.providers'] |
||
34 | ); |
||
35 | }; |
||
36 | } |
||
37 | |||
52 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: