LeagueTeamMoviesTableSeeder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 31
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B run() 0 27 3
1
<?php
2
3
class LeagueTeamMoviesTableSeeder extends Seeder {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
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
}