| Conditions | 5 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function fire(Job $job, $data) { |
||
| 15 | |||
| 16 | /** @type LeagueMovie $leagueMovie */ |
||
| 17 | $leagueMovie = LeagueMovie::findOrFail($data['league_movie_id']); |
||
| 18 | /** @type MovieEarning $earnings */ |
||
| 19 | $earnings = MovieEarning::findOrFail($data['earnings_id']); |
||
| 20 | |||
| 21 | if ( // Sanity checks |
||
| 22 | $leagueMovie->movie_id == $earnings->movie_id |
||
| 23 | && $leagueMovie->league->end_date > $earnings->date |
||
| 24 | && (! $leagueMovie->latestEarnings || $leagueMovie->latestEarnings->date < $earnings->date) |
||
| 25 | ) { |
||
| 26 | $leagueMovie->latest_earnings_id = $earnings->id; |
||
| 27 | $leagueMovie->save(); |
||
| 28 | |||
| 29 | // Possibly TODO: Update team's total earnings if that gets cached |
||
| 30 | } |
||
| 31 | |||
| 32 | $job->delete(); |
||
| 33 | |||
| 34 | } |
||
| 35 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.