GeneratorCommand::getDefaultNamespace()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
4
namespace Zebrainsteam\LaravelRepos\Console;
5
6
use Illuminate\Console\GeneratorCommand as Generator;
7
8
abstract class GeneratorCommand extends Generator
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $defaultNamespacePrefix = '';
14
15
    /**
16
     * Determine if the class already exists.
17
     *
18
     * @param  string  $rawName
19
     * @return bool
20
     */
21
    protected function alreadyExists($rawName)
22
    {
23
        return class_exists($rawName) ||
24
            $this->files->exists($this->getPath($this->qualifyClass($rawName)));
25
    }
26
27
    /**
28
     * Get the default namespace for the class.
29
     *
30
     * @param string $rootNamespace
31
     * @return string
32
     */
33
    protected function getDefaultNamespace($rootNamespace)
34
    {
35
        $defaultNamespace = $rootNamespace;
36
        if ($this->getNameInput()[0] != '/' && !empty($this->defaultNamespacePrefix)) {
37
            $defaultNamespace .= '\\' . $this->defaultNamespacePrefix;
38
        }
39
40
        return $defaultNamespace;
41
    }
42
}
43