MakeFactoryCommand::getDefaultNamespace()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace R\Hive\Commands;
4
5
use Symfony\Component\Console\Input\InputOption;
6
7 View Code Duplication
class MakeFactoryCommand extends HiveGeneratorCommand
0 ignored issues
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...
8
{
9
    /**
10
     * The console command name.
11
     *
12
     * @var string
13
     */
14
    protected $name = 'hive:factory';
15
16
    /**
17
     * The console command description.
18
     *
19
     * @var string
20
     */
21
    protected $description = 'Create a new Hive factory class.';
22
23
    /**
24
     * The type of class being generated.
25
     *
26
     * @var string
27
     */
28
    protected $type = 'Factory';
29
30
    /**
31
     * The compound command to fire after the parent succeeds.
32
     *
33
     * @var string
34
     */
35
    protected $compound = 'validator';
36
37
    /**
38
     * Get the stub file for the generator.
39
     *
40
     * @return string
41
     */
42
    protected function getStub()
43
    {
44
        if ($this->option('validator')) {
45
            return __DIR__.'/stubs/factory-validator.stub';
46
        } else {
47
            return __DIR__.'/stubs/factory-no-validator.stub';
48
        }
49
    }
50
51
    /**
52
     * Get the default namespace for the class.
53
     *
54
     * @param string $rootNamespace
55
     *
56
     * @return string
57
     */
58
    protected function getDefaultNamespace($rootNamespace)
59
    {
60
        return $rootNamespace.'\Lib\Factories';
61
    }
62
63
    /**
64
     * Get the console command options.
65
     *
66
     * @return array
67
     */
68
    protected function getOptions()
69
    {
70
        return [
71
            ['validator', 'i', InputOption::VALUE_NONE, 'Create a new associated validator.'],
72
        ];
73
    }
74
}
75