1 | <?php |
||
9 | class Bundle |
||
10 | { |
||
11 | /** |
||
12 | * Bundle id provided by client. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $id; |
||
17 | |||
18 | /** |
||
19 | * BundleMap instance. |
||
20 | * |
||
21 | * @var BundleMap |
||
22 | */ |
||
23 | protected $bundleMap; |
||
24 | |||
25 | /** |
||
26 | * Array of path keys. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $pathKeys = []; |
||
31 | |||
32 | /** |
||
33 | * Path resolved from id. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $path = ''; |
||
38 | |||
39 | /** |
||
40 | * Path namespace. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $namespace = ''; |
||
45 | |||
46 | /** |
||
47 | * Collection of lang values. |
||
48 | * |
||
49 | * @var Collection |
||
50 | */ |
||
51 | protected $values; |
||
52 | |||
53 | /** |
||
54 | * Construct. |
||
55 | * |
||
56 | * @param string $id |
||
57 | */ |
||
58 | public function __construct($id, BundleMap $bundleMap) |
||
67 | |||
68 | /** |
||
69 | * Get bundle namespace. |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getNamespace() |
||
77 | |||
78 | /** |
||
79 | * Get pathKeys array. |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | public function getPathKeys() |
||
87 | |||
88 | /** |
||
89 | * Get path values collection. |
||
90 | * |
||
91 | * @return Collection |
||
92 | */ |
||
93 | public function getValues() |
||
97 | |||
98 | /** |
||
99 | * Return array of values. |
||
100 | * |
||
101 | * @return array |
||
102 | */ |
||
103 | public function getValuesArray() |
||
107 | |||
108 | /** |
||
109 | * Return true if bundle contains no trans values. |
||
110 | * |
||
111 | * @return bool |
||
112 | */ |
||
113 | public function hasNoValues() |
||
117 | |||
118 | /** |
||
119 | * Return true if namespace is valid bundle namespace. |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function hasValidNamespace() |
||
127 | |||
128 | /** |
||
129 | * Set the namespace on the object. |
||
130 | * |
||
131 | * @param string $namespace |
||
132 | */ |
||
133 | protected function setNamespace($namespace) |
||
137 | |||
138 | /** |
||
139 | * Set pathKeys on object. |
||
140 | * |
||
141 | * @param array $pathKeys |
||
142 | */ |
||
143 | protected function setPathKeys(array $pathKeys) |
||
147 | |||
148 | /** |
||
149 | * Set values collection on object. |
||
150 | * |
||
151 | * @param Collection $values |
||
152 | * |
||
153 | * @return Collection |
||
154 | */ |
||
155 | protected function setValues(Collection $values) |
||
165 | |||
166 | /** |
||
167 | * Get bundle values from bundle map. |
||
168 | * |
||
169 | * @return Collection |
||
170 | */ |
||
171 | protected function getValuesFromMap() |
||
187 | |||
188 | /** |
||
189 | * Build pathKeys array and set namespace. |
||
190 | */ |
||
191 | protected function buildKeys() |
||
199 | |||
200 | /** |
||
201 | * Get keys from id. |
||
202 | * |
||
203 | * @return array |
||
204 | */ |
||
205 | protected function getKeysFromId() |
||
222 | } |
||
223 |