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

MakeSeeder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 0
Metric Value
dl 29
loc 29
rs 10
c 0
b 0
f 0
wmc 2
lcom 2
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 10 10 1
A handle() 9 9 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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