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

MakeSeeder::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Yarak\Commands;
4
5
use Yarak\Config\Config;
6
use Yarak\DB\Seeders\SeederCreator;
7
use Symfony\Component\Console\Input\InputArgument;
8
9 View Code Duplication
class MakeSeeder extends YarakCommand
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    /**
12
     * Configure the command.
13
     */
14
    protected function configure()
15
    {
16
        $this->setName('make:seeder')
17
            ->setDescription('Create a new seeder file.')
18
            ->setHelp('This command will generate a new seeder file.')
19
            ->addArgument(
20
                'name',
21
                InputArgument::REQUIRED,
22
                'The name of your seeder file.');
23
    }
24
25
    /**
26
     * Handle the command.
27
     */
28
    protected function handle()
29
    {
30
        $creator = new SeederCreator(
31
            Config::getInstance($this->configArray),
32
            $this->getOutput()
33
        );
34
35
        $creator->create($this->argument('name'));
1 ignored issue
show
Bug introduced by
It seems like $this->argument('name') targeting Yarak\Console\Command::argument() can also be of type array; however, Yarak\DB\Seeders\SeederCreator::create() 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...
36
    }
37
}
38