Completed
Push — master ( added7...ff6ff5 )
by Asmir
10:59
created

Psr4PathGenerator   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 90.91%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 22
ccs 10
cts 11
cp 0.9091
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 16 5
1
<?php
2
namespace Goetas\Xsd\XsdToPhp\PathGenerator;
3
4
abstract class Psr4PathGenerator implements PathGenerator
5
{
6
7
    protected $namespaces = array();
8
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
}
26
27