Completed
Pull Request — master (#111)
by Jan Philipp
02:46 queued 41s
created

ScriptsPath::getWorkingDirectory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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