Completed
Push — dev ( 6d8737...fe3822 )
by Zach
02:19
created

DBSeed   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 28
rs 10
c 1
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 12 1
A handle() 0 6 1
1
<?php
2
3
namespace Yarak\Commands;
4
5
use Yarak\DB\Seeders\SeedRunner;
6
use Symfony\Component\Console\Input\InputArgument;
7
8
class DBSeed extends YarakCommand
9
{
10
    /**
11
     * Configure the command.
12
     */
13
    protected function configure()
14
    {
15
        $this->setName('db:seed')
16
            ->setDescription('Seed the database.')
17
            ->setHelp('This command will run the given seeder class.')
18
            ->addArgument(
19
                'class',
20
                InputArgument::OPTIONAL,
21
                'The name of the seeder class to run.',
22
                'DatabaseSeeder'
23
            );
24
    }
25
26
    /**
27
     * Handle the command.
28
     */
29
    protected function handle()
30
    {
31
        $seedRunner = new SeedRunner($this->getOutput());
32
33
        $seedRunner->run($this->argument('class'));
1 ignored issue
show
Bug introduced by
It seems like $this->argument('class') targeting Yarak\Console\Command::argument() can also be of type array; however, Yarak\DB\Seeders\SeedRunner::run() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
34
    }
35
}
36