Completed
Push — dev ( 9f49ce...7f87b9 )
by Zach
02:14
created

MakeSeeder::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 10
rs 9.4285
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\InputOption;
8
use Symfony\Component\Console\Input\InputArgument;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class MakeSeeder extends YarakCommand
13
{
14
    /**
15
     * Configure the command.
16
     */
17
    protected function configure()
18
    {
19
        $this->setName('make:seeder')
20
            ->setDescription('Create a new seeder file.')
21
            ->setHelp('This command will generate a new seeder file.')
22
            ->addArgument(
23
                'name',
24
                InputArgument::REQUIRED,
25
                'The name of your seeder file.');
26
    }
27
28
    /**
29
     * Execute the command.
30
     *
31
     * @param InputInterface  $input
32
     * @param OutputInterface $output
33
     */
34 View Code Duplication
    protected function execute(InputInterface $input, OutputInterface $output)
1 ignored issue
show
Duplication introduced by
This method 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...
35
    {
36
        $name = $input->getArgument('name');
37
38
        $config = Config::getInstance($this->configArray);
39
40
        $creator = new SeederCreator($config);
41
42
        $creator->create($name);
43
44
        $output->writeln("<info>Successfully created seeder {$name}.</info>");
45
    }
46
}
47