| Conditions | 5 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function updating(Match $model) |
||
| 20 | { |
||
| 21 | $dirtyStatus = array_get($model->getDirty(), 'status'); |
||
| 22 | |||
| 23 | // original score values |
||
| 24 | $originalHomeScore = $model->getOriginal('homeScore'); |
||
| 25 | $originalAwayScore = $model->getOriginal('awayScore'); |
||
| 26 | |||
| 27 | // dirty score values |
||
| 28 | $dirtyHomeScore = array_get($model->getDirty(), 'homeScore'); |
||
| 29 | $dirtyAwayScore = array_get($model->getDirty(), 'awayScore'); |
||
| 30 | |||
| 31 | $isMatchFinished = Match::RESULT_TYPE_UNKNOWN === $model->getOriginal('resultType') |
||
| 32 | && Match::STATUS_FINISHED === $dirtyStatus; |
||
| 33 | |||
| 34 | if ($isMatchFinished |
||
| 35 | || ($originalHomeScore !== $dirtyHomeScore || $originalAwayScore !== $dirtyAwayScore) |
||
| 36 | ) { |
||
| 37 | event(new MatchWasFinished($model)); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 66 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.