Completed
Pull Request — master (#93)
by Jan Philipp
02:53 queued 01:09
created

ScriptsPath   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 64
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getNamespace() 0 4 1
A getPath() 0 4 1
A isHidden() 0 4 1
A isValid() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Psh\Config;
4
5
class ScriptsPath
6
{
7
    /**
8
     * @var string
9
     */
10
    private $namespace;
11
12
    /**
13
     * @var bool
14
     */
15
    private $hidden;
16
17
    /**
18
     * @var string
19
     */
20
    private $path;
21
22
    /**
23
     * @param string $path
24
     * @param bool $hidden
25
     * @param string $namespace
26
     */
27
    public function __construct(
28
        string $path,
29
        bool $hidden,
30
        string $namespace = null
31
    ) {
32
        $this->namespace = $namespace;
33
        $this->hidden = $hidden;
34
        $this->path = $path;
35
    }
36
37
    /**
38
     * @return string|null
39
     */
40
    public function getNamespace()
41
    {
42
        return $this->namespace;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getPath(): string
49
    {
50
        return $this->path;
51
    }
52
53
    /**
54
     * @return bool
55
     */
56
    public function isHidden(): bool
57
    {
58
        return $this->hidden;
59
    }
60
61
    /**
62
     * @return bool
63
     */
64
    public function isValid(): bool
65
    {
66
        return is_dir($this->path);
67
    }
68
}
69