Conditions | 5 |
Paths | 5 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5.0187 |
Changes | 0 |
1 | <?php |
||
9 | 10 | public function __construct(array $namespaces) |
|
10 | { |
||
11 | 10 | $this->namespaces = $namespaces; |
|
12 | |||
13 | 10 | foreach ($this->namespaces as $namespace => $dir) { |
|
14 | 10 | if ($namespace[strlen($namespace) - 1] !== "\\") { |
|
15 | 2 | throw new PathGeneratorException("A non-empty PSR-4 prefix must end with a namespace separator, you entered '$namespace'."); |
|
16 | } |
||
17 | 8 | if (!is_dir($dir)) { |
|
18 | 2 | throw new PathGeneratorException("The folder '$dir' does not exist."); |
|
19 | } |
||
20 | 6 | if (!is_writable($dir)) { |
|
21 | throw new PathGeneratorException("The folder '$dir' is not writable."); |
||
22 | } |
||
23 | 6 | } |
|
24 | 6 | } |
|
25 | } |
||
27 |