Total Complexity | 8 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
16 | class Project |
||
17 | { |
||
18 | /** |
||
19 | * @var string path to the project directory on user/host system |
||
20 | */ |
||
21 | private $path; |
||
22 | |||
23 | /** |
||
24 | * @var string prefix ('pipelines' by default) |
||
25 | */ |
||
26 | private $prefix; |
||
27 | |||
28 | /** |
||
29 | * Project constructor. |
||
30 | * |
||
31 | * @param string $path |
||
32 | */ |
||
33 | 5 | public function __construct($path) |
|
34 | { |
||
35 | 5 | $buffer = LibFsPath::normalize($path); |
|
36 | 5 | if (!basename($buffer)) { |
|
37 | 1 | throw new InvalidArgumentException(sprintf('Invalid project directory: "%s"', $path)); |
|
38 | } |
||
39 | 4 | $this->path = $buffer; |
|
40 | 4 | } |
|
41 | |||
42 | /** |
||
43 | * |
||
44 | */ |
||
45 | 1 | public function __toString() |
|
48 | } |
||
49 | |||
50 | 2 | public function getName() |
|
51 | { |
||
52 | 2 | return basename($this->path); |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | 1 | public function getPath() |
|
59 | { |
||
60 | 1 | return $this->path; |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return string |
||
65 | */ |
||
66 | 1 | public function getPrefix() |
|
67 | { |
||
68 | 1 | return $this->prefix; |
|
69 | } |
||
70 | |||
71 | /** |
||
72 | * @param string $prefix |
||
73 | * |
||
74 | * @throws InvalidArgumentException |
||
75 | */ |
||
76 | 1 | public function setPrefix($prefix) |
|
83 | 1 | } |
|
84 | } |
||
85 |