| 1 | <?php |
||
| 11 | class ErrorController extends Abstraction |
||
| 12 | { |
||
| 13 | private $errorController; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @param Error $errorController |
||
| 17 | */ |
||
| 18 | 3 | public function __construct(Error $errorController) |
|
| 22 | |||
| 23 | /** |
||
| 24 | * @param Error $errorController |
||
| 25 | * @return $this |
||
| 26 | */ |
||
| 27 | 3 | public function setErrorController(Error $errorController) |
|
| 32 | |||
| 33 | /** |
||
| 34 | * @return Error |
||
| 35 | * @throws Exception |
||
| 36 | */ |
||
| 37 | 3 | public function getErrorController() |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Always handle error with error controller |
||
| 47 | * @return bool |
||
| 48 | */ |
||
| 49 | 1 | public function canHandle() |
|
| 53 | |||
| 54 | /** |
||
| 55 | * @return $this |
||
| 56 | * @throws \FMUP\Exception |
||
| 57 | */ |
||
| 58 | 1 | public function handle() |
|
| 71 | } |
||
| 72 |
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: