SeederCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 3
c 2
b 1
f 1
dl 0
loc 36
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 3
1
<?php
2
3
namespace agoalofalife\postman\Console;
4
5
use Illuminate\Console\Command;
6
use ModePostEmailSeeder;
7
use StatusesSeeder;
8
9
class SeederCommand extends Command
10
{
11
    protected $seeds = [
12
        ModePostEmailSeeder::class,
13
        StatusesSeeder::class
14
    ];
15
16
    protected $seedersPath = __DIR__.'/../../database/seeds/';
17
18
    /**
19
     * The name and signature of the console command.
20
     *
21
     * @var string
22
     */
23
    protected $signature = 'postman:seed';
24
    /**
25
     * The console command description.
26
     *
27
     * @var string
28
     */
29
    protected $description = 'Fill tables';
30
31
    /**
32
     * Execute the console command.
33
     *
34
     * @return void
35
     */
36 6
    public function handle() : void
37
    {
38 6
        $this->info('Seeding data into the database');
39
40 6
        foreach ($this->seeds as $seed) {
41 6
            if (!class_exists($seed)) {
42 2
                require_once $this->seedersPath . $seed .'.php';
43
            }
44 6
            (new $seed())->run();
45
        }
46 6
    }
47
}
48