| Conditions | 3 |
| Paths | 3 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | 9 | public function run() { |
|
| 6 | |||
| 7 | 9 | $teams = LeagueTeam::all(); |
|
| 8 | $owns = [ |
||
| 9 | 9 | 1 => [1, 3, 18, 20, 30], |
|
| 10 | 9 | 2 => [6, 7, 13, 25], |
|
| 11 | 9 | 3 => [10, 14, 17, 24, 28], |
|
| 12 | 9 | 4 => [8, 12, 16, 21, 26], |
|
| 13 | 9 | 5 => [2, 5, 19, 23], |
|
| 14 | 9 | 6 => [4, 9, 11, 15, 22, 27, 29], |
|
| 15 | 9 | ]; |
|
| 16 | |||
| 17 | 9 | foreach($owns as $team_id => $movies) { |
|
| 18 | /** @type LeagueTeam $team */ |
||
| 19 | 9 | $team = $teams->find($team_id); |
|
| 20 | |||
| 21 | 9 | foreach($movies as $movie_id) { |
|
| 22 | 9 | $team->movies()->attach($movie_id); |
|
| 23 | 9 | } |
|
| 24 | 9 | } |
|
| 25 | |||
| 26 | // Mark as active |
||
| 27 | 9 | $league = League::first(); |
|
| 28 | 9 | $league->active = 1; |
|
| 29 | 9 | $league->save(); |
|
| 30 | |||
| 31 | 9 | } |
|
| 32 | |||
| 33 | } |
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.