| Total Complexity | 5 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | trait ModelEvents |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var AbstractEvent Model Tracking Event to fire |
||
| 15 | */ |
||
| 16 | protected $trackingEvent; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var AbstractModel|Model |
||
| 20 | */ |
||
| 21 | private $trackingEventModel; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var bool Determine if the TrackingEvent was fired |
||
| 25 | */ |
||
| 26 | private $trackingEventWasFired; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Fire the trackingEvent |
||
| 30 | * |
||
| 31 | * @return void |
||
| 32 | */ |
||
| 33 | protected function fireEvent() |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Retrieve the Model to be used in the fireEvent() method |
||
| 43 | * |
||
| 44 | * - optionally set a the $trackingEventModel property |
||
| 45 | * - useful for using a different model in the trackingEvent than the resolved/saved model |
||
| 46 | * |
||
| 47 | * @param Model|null $model |
||
| 48 | * @return AbstractModel|Model |
||
| 49 | */ |
||
| 50 | protected function trackingEventModel(Model $model = null): Model |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Determine if the TrackingEvent was fired |
||
| 61 | * |
||
| 62 | * @return bool |
||
| 63 | */ |
||
| 64 | protected function wasTrackingEventFired(): bool |
||
| 69 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.