| Conditions | 2 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | protected static function bootLogsActivity() |
||
| 15 | { |
||
| 16 | collect(static::eventsToBeRecorded())->each(function ($eventName) { |
||
| 17 | |||
| 18 | return static::$eventName(function (Model $model) use ($eventName) { |
||
| 19 | |||
| 20 | $description = $model->getDescriptionForEvent($eventName); |
||
| 21 | |||
| 22 | if ($description == '') { |
||
| 23 | return; |
||
| 24 | } |
||
| 25 | |||
| 26 | app(ActivityLogger::class) |
||
| 27 | ->performedOn($model) |
||
| 28 | ->withProperties($model->getPropertiesToBeLogged()) |
||
| 29 | ->log($description); |
||
| 30 | }); |
||
| 31 | |||
| 32 | }); |
||
| 33 | } |
||
| 34 | |||
| 61 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.