GeneratorPath::getNamespace()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Rawilk\LaravelModules\Support\Config;
4
5
class GeneratorPath
6
{
7
    /** @var bool */
8
    private $generate;
9
10
    /** @var string */
11
    private $path;
12
13
    /** @var string */
14
    private $namespace;
15
16
    /**
17
     * @param array|string $config
18
     */
19
    public function __construct($config)
20
    {
21
        if (is_array($config)) {
22
            $this->path = $config['path'];
23
            $this->generate = $config['generate'];
24
            $this->namespace = $config['namespace'] ?? $config['path'];
25
26
            return;
27
        }
28
29
        $this->path = $config;
30
        $this->generate = (bool) $config;
31
        $this->namespace = $config;
32
    }
33
34
    public function generate(): bool
35
    {
36
        return $this->generate;
37
    }
38
39
    public function getNamespace(): string
40
    {
41
        return $this->namespace;
42
    }
43
44
    public function getPath(): string
45
    {
46
        return $this->path;
47
    }
48
}
49