GeneratorPath   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 15
c 1
b 0
f 0
dl 0
loc 42
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getNamespace() 0 3 1
A getPath() 0 3 1
A generate() 0 3 1
A __construct() 0 13 2
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