Completed
Push — master ( fff0f0...89663a )
by De Cramer
02:26
created

PluginDescription::setParents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace eXpansion\Framework\Core\Model\Plugin;
4
5
/**
6
 * Store all the metadata for a certain plugin.
7
 *
8
 * @package eXpansion\Framework\Core\Model\Plugin
9
 * @author Oliver de Cramer
10
 */
11
class PluginDescription
12
{
13
    /** @var string */
14
    protected $pluginId;
15
16
    /** @var string[] */
17
    protected $dataProviders = [];
18
19
    /** @var string[] */
20
    protected $parents = [];
21
22
    /** @var PluginDescription[] */
23
    protected $childrens = [];
24
25
    /** @var bool  */
26
    protected $isEnabled = false;
27
28
    /** @var string  */
29
    protected $dataProviderName = null;
30
31
    /**
32
     * PluginDescription constructor.
33
     * @param string $pluginId
34
     */
35 39
    public function __construct($pluginId)
36
    {
37 39
        $this->pluginId = $pluginId;
38 39
    }
39
40
    /**
41
     * @return string
42
     */
43 2
    public function getPluginId()
44
    {
45 2
        return $this->pluginId;
46
    }
47
48
    /**
49
     * @return string[]
50
     */
51 1
    public function getDataProviders()
52
    {
53 1
        return $this->dataProviders;
54
    }
55
56
    /**
57
     * @return string[]
58
     */
59 1
    public function getParents()
60
    {
61 1
        return $this->parents;
62
    }
63
64
    /**
65
     * @param string[] $parents
66
     */
67 38
    public function setParents($parents)
68
    {
69 38
        $this->parents = $parents;
70 38
    }
71
72
    /**
73
     * @param string[] $dataProviders
74
     */
75 38
    public function setDataProviders($dataProviders)
76
    {
77 38
        $this->dataProviders = $dataProviders;
78 38
    }
79
80
    /**
81
     * @return PluginDescription[]
82
     */
83 1
    public function getChildrens()
84
    {
85 1
        return $this->childrens;
86
    }
87
88
    /**
89
     * @param PluginDescription $parent
90
     */
91 1
    public function addChildren(PluginDescription $parent)
92
    {
93 1
        $this->childrens[] = $parent;
94 1
    }
95
96
    /**
97
     * @return boolean
98
     */
99 1
    public function isIsEnabled()
100
    {
101 1
        return $this->isEnabled;
102
    }
103
104
    /**
105
     * @param boolean $isEnabled
106
     */
107 1
    public function setIsEnabled($isEnabled)
108
    {
109 1
        $this->isEnabled = $isEnabled;
110 1
    }
111
112
    /**
113
     * @return string
114
     */
115 1
    public function getDataProviderName()
116
    {
117 1
        return $this->dataProviderName;
118
    }
119
120
    /**
121
     * @param string $dataProviderName
122
     */
123 38
    public function setDataProviderName($dataProviderName)
124
    {
125 38
        $this->dataProviderName = $dataProviderName;
126 38
    }
127
128
129
    /**
130
     * @return bool
131
     */
132
    public function isIsDataProvider()
133
    {
134
        return !is_null($this->dataProviderName);
135
    }
136
137
}
138