Completed
Push — master ( 9271e2...253fe0 )
by Maxim
04:13
created

Seed   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 1
cbo 2
dl 0
loc 49
ccs 14
cts 14
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A prompt() 0 4 1
A prepare() 0 4 1
A preview() 0 6 1
A finish() 0 7 1
1
<?php namespace Lanin\Laravel\SetupWizard\Commands\Steps;
2
3
class Seed extends AbstractStep
4
{
5
    /**
6
     * Return command prompt text.
7
     *
8
     * @return string
9
     */
10 3
    public function prompt()
11
    {
12 3
        return 'Run database seeding?';
13
    }
14
15
    /**
16
     * Prepare step data.
17
     *
18
     * @return mixed
19
     */
20 3
    public function prepare()
21
    {
22 3
        return $this->command->ask('Seed to run', config('setup.seed.class'));
23
    }
24
25
    /**
26
     * Preview results.
27
     *
28
     * @param  mixed $results
29
     * @return void
30
     */
31 3
    public function preview($results)
32
    {
33 3
        $this->command->info(
34 3
            'This command will be executed: <comment>php artisan db:seed --class=' . $results . ' --force --no-interaction</comment>'
35 3
        );
36 3
    }
37
38
    /**
39
     * Finish step.
40
     *
41
     * @param  mixed $results
42
     * @return bool
43
     */
44 3
    public function finish($results)
45
    {
46 3
        return ! (bool) \Artisan::call(
47 3
            'db:seed',
48 3
            ['--class' => $results, '--force' => true, '--no-interaction' => true]
49 3
        );
50
    }
51
}