Module   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 42
c 0
b 0
f 0
wmc 6
lcom 0
cbo 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A getName() 0 4 1
A getNamespace() 0 4 1
A getPath() 0 4 1
A getPattern() 0 4 1
1
<?php
2
/**
3
 * @copyright 2018 Aleksander Stelmaczonek <[email protected]>
4
 * @license   MIT License, see license file distributed with this source code
5
 */
6
7
namespace Koriit\PHPDeps\Modules;
8
9
class Module
10
{
11
    /** @var string */
12
    private $name;
13
14
    /** @var string */
15
    private $namespace;
16
17
    /** @var string */
18
    private $path;
19
20
    /** @var string */
21
    private $pattern;
22
23
    public function __construct($name, $namespace, $path)
24
    {
25
        $this->name = $name;
26
        $this->namespace = $namespace;
27
        $this->path = $path;
28
        $this->pattern = '/^' . \str_replace('\\', '\\\\', $namespace) . (\is_dir($path) ? '(\\\\.+)?' : '') . '$/';
29
    }
30
31
    public function getName()
32
    {
33
        return $this->name;
34
    }
35
36
    public function getNamespace()
37
    {
38
        return $this->namespace;
39
    }
40
41
    public function getPath()
42
    {
43
        return $this->path;
44
    }
45
46
    public function getPattern()
47
    {
48
        return $this->pattern;
49
    }
50
}
51