HiveGeneratorCommand::fire()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 13
rs 9.2
cc 4
eloc 8
nc 4
nop 0
1
<?php
2
3
namespace R\Hive\Commands;
4
5
use Illuminate\Console\GeneratorCommand;
6
use Symfony\Component\Console\Input\InputArgument;
7
8
class HiveGeneratorCommand extends GeneratorCommand
9
{
10
    protected $compound = null;
11
12
    protected function getPath($name)
13
    {
14
        $name = str_replace($this->laravel->getNamespace(), '', $name);
0 ignored issues
show
Bug introduced by
The method getNamespace() does not seem to exist on object<Illuminate\Contra...Foundation\Application>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
15
16
        // Add the class type to the file name.
17
        return $this->laravel['path'].'/'.str_replace('\\', '/', $name).$this->type.'.php';
18
    }
19
20
    protected function getStub()
21
    {
22
        return;
23
    }
24
25
    public function fire()
26
    {
27
        if ($this->compound !== null) {
28
            if (parent::fire() !== false) {
29
                if ($this->option($this->compound)) {
30
                    $name = $this->argument('name');
31
                    $this->call("hive:{$this->compound}", ['name' => $name]);
32
                }
33
            }
34
        } else {
35
            parent::fire();
36
        }
37
    }
38
39
    protected function getArguments()
40
    {
41
        return [
42
            ['name', InputArgument::REQUIRED, 'The name of the instance type being referenced, eg: Book.'],
43
        ];
44
    }
45
}
46