Conditions | 5 |
Paths | 7 |
Total Lines | 28 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
38 | public function handle(Migrator $migrator) |
||
39 | { |
||
40 | if (!$this->confirmToProceed()) { |
||
41 | return; |
||
42 | } |
||
43 | |||
44 | $seed = $this->argument('name') ?: $migrator->defaultSeed(); |
||
45 | |||
46 | if (!$seed) { |
||
47 | $this->error('Default seed is not defined.'); |
||
48 | |||
49 | return; |
||
50 | } |
||
51 | |||
52 | $class = $migrator->seedClass($seed); |
||
53 | |||
54 | if (!$class) { |
||
55 | $this->error("Seed '$seed' is not defined."); |
||
56 | |||
57 | return; |
||
58 | } |
||
59 | |||
60 | $this->infoSeedRun($seed, $class); |
||
61 | |||
62 | $seeder = new $class(); |
||
63 | |||
64 | $seeder->setCommand($this)->run(); |
||
65 | } |
||
66 | } |
||
67 |