Module   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 11
lcom 2
cbo 0
dl 0
loc 96
ccs 0
cts 29
cp 0
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getId() 0 4 1
A getFilename() 0 4 1
A getDirname() 0 4 1
A isLoaded() 0 4 1
A getParent() 0 4 1
A getChildren() 0 4 1
A getExports() 0 4 1
A setLoaded() 0 4 1
A setExports() 0 4 1
A addChild() 0 4 1
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of the pinepain/js-sandbox PHP library.
5
 *
6
 * Copyright (c) 2016-2017 Bogdan Padalko <[email protected]>
7
 *
8
 * Licensed under the MIT license: http://opensource.org/licenses/MIT
9
 *
10
 * For the full copyright and license information, please view the
11
 * LICENSE file that was distributed with this source or visit
12
 * http://opensource.org/licenses/MIT
13
 */
14
15
16
namespace Pinepain\JsSandbox\Modules;
17
18
19
class Module implements ModuleInterface
20
{
21
    /**
22
     * @var string
23
     */
24
    protected $id;
25
26
    /**
27
     * @var string
28
     */
29
    protected $filename;
30
31
    /**
32
     * @var string
33
     */
34
    private $dirname;
35
36
    /**
37
     * @var bool
38
     */
39
    protected $loaded = false;
40
41
    /**
42
     * @var null|ModuleInterface
43
     */
44
    protected $parent;
45
46
    /**
47
     * @var ModuleInterface[]
48
     */
49
    protected $children = [];
50
51
    /**
52
     * @var mixed
53
     */
54
    protected $exports;
55
56
57
    public function __construct(string $id, string $filename, string $dirname, ?ModuleInterface $parent)
58
    {
59
        $this->id       = $id;
60
        $this->filename = $filename;
61
        $this->dirname  = $dirname;
62
        $this->parent   = $parent;
63
    }
64
65
    public function getId(): string
66
    {
67
        return $this->id;
68
    }
69
70
    public function getFilename(): string
71
    {
72
        return $this->filename;
73
    }
74
75
    public function getDirname(): string
76
    {
77
        return $this->dirname;
78
    }
79
80
    public function isLoaded(): bool
81
    {
82
        return $this->loaded;
83
    }
84
85
    public function getParent(): ?ModuleInterface
86
    {
87
        return $this->parent;
88
    }
89
90
    public function getChildren(): array
91
    {
92
        return $this->children;
93
    }
94
95
    public function getExports()
96
    {
97
        return $this->exports;
98
    }
99
100
    public function setLoaded()
101
    {
102
        $this->loaded = true;
103
    }
104
105
    public function setExports($exports)
106
    {
107
        $this->exports = $exports;
108
    }
109
110
    public function addChild(ModuleInterface $module)
111
    {
112
        $this->children[] = $module;
113
    }
114
}
115
//module.id
116
//module.filename
117
//module.loaded
118
119
//module.parent
120
//module.children
121
//module.exports
122