| 1 | <?php namespace Arcanedev\LaravelAuth\Models\Pivots; |
||
| 12 | abstract class AbstractPivot extends Pivot |
||
| 13 | { |
||
| 14 | /* ----------------------------------------------------------------- |
||
| 15 | | Constructor |
||
| 16 | | ----------------------------------------------------------------- |
||
| 17 | */ |
||
| 18 | /** |
||
| 19 | * Create a new pivot model instance. |
||
| 20 | * |
||
| 21 | * @param \Illuminate\Database\Eloquent\Model $parent |
||
| 22 | * @param array $attributes |
||
| 23 | * @param string $table |
||
| 24 | * @param bool $exists |
||
| 25 | */ |
||
| 26 | 57 | public function __construct(Model $parent, $attributes, $table, $exists = false) |
|
| 32 | |||
| 33 | /* ----------------------------------------------------------------- |
||
| 34 | | Getters & Setters |
||
| 35 | | ----------------------------------------------------------------- |
||
| 36 | */ |
||
| 37 | /** |
||
| 38 | * Register the observable events. |
||
| 39 | */ |
||
| 40 | 57 | private function registerObserver() |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Get the observer class for the pivot table. |
||
| 47 | * |
||
| 48 | * @return string|null |
||
| 49 | */ |
||
| 50 | protected function getObserverClass() |
||
| 54 | } |
||
| 55 |
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: