| 1 | <?php |
||
| 5 | class Spec extends AbstractService |
||
| 6 | { |
||
| 7 | protected $entityMapper = 'speckcatalog_spec_mapper'; |
||
| 8 | |||
| 9 | 2 | public function find(array $data, $populate = false, $recursive = false) |
|
| 10 | { |
||
| 11 | 2 | $spec = $this->getEntityMapper()->find($data); |
|
| 12 | 2 | if ($populate) { |
|
| 13 | 1 | $this->populate($spec, $recursive); |
|
|
|
|||
| 14 | 1 | } |
|
| 15 | 2 | return $spec; |
|
| 16 | } |
||
| 17 | |||
| 18 | 1 | public function getByProductId($productId) |
|
| 22 | |||
| 23 | 1 | public function insert($spec) |
|
| 30 | } |
||
| 31 |
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: