1 | <?php |
||
20 | class PluginState |
||
21 | { |
||
22 | /** |
||
23 | * @var Composer $composer |
||
24 | */ |
||
25 | protected $composer; |
||
26 | |||
27 | /** |
||
28 | * @var array $includes |
||
29 | */ |
||
30 | protected $includes = array(); |
||
31 | |||
32 | /** |
||
33 | * @var array $requires |
||
34 | */ |
||
35 | protected $requires = array(); |
||
36 | |||
37 | /** |
||
38 | * @var array $duplicateLinks |
||
39 | */ |
||
40 | protected $duplicateLinks = array(); |
||
41 | |||
42 | /** |
||
43 | * @var bool $devMode |
||
44 | */ |
||
45 | protected $devMode = false; |
||
46 | |||
47 | /** |
||
48 | * @var bool $recurse |
||
49 | */ |
||
50 | protected $recurse = true; |
||
51 | |||
52 | /** |
||
53 | * @var bool $replace |
||
54 | */ |
||
55 | protected $replace = false; |
||
56 | |||
57 | /** |
||
58 | * @var bool $ignore |
||
59 | */ |
||
60 | protected $ignore = false; |
||
61 | |||
62 | /** |
||
63 | * Whether to merge the -dev sections. |
||
64 | * @var bool $mergeDev |
||
65 | */ |
||
66 | protected $mergeDev = true; |
||
67 | |||
68 | /** |
||
69 | * Whether to merge the extra section. |
||
70 | * |
||
71 | * By default, the extra section is not merged and there will be many |
||
72 | * cases where the merge of the extra section is performed too late |
||
73 | * to be of use to other plugins. When enabled, merging uses one of |
||
74 | * two strategies - either 'first wins' or 'last wins'. When enabled, |
||
75 | * 'first wins' is the default behaviour. If Replace mode is activated |
||
76 | * then 'last wins' is used. |
||
77 | * |
||
78 | * @var bool $mergeExtra |
||
79 | */ |
||
80 | protected $mergeExtra = false; |
||
81 | |||
82 | /** |
||
83 | * Whether to merge the extra section in a deep / recursive way. |
||
84 | * |
||
85 | * By default the extra section is merged with array_merge() and duplicate |
||
86 | * keys are ignored. When enabled this allows to merge the arrays recursively |
||
87 | * using the following rule: Integer keys are merged, while array values are |
||
88 | * replaced where the later values overwrite the former. |
||
89 | * |
||
90 | * This is useful especially for the extra section when plugins use larger |
||
91 | * structures like a 'patches' key with the packages as sub-keys and the |
||
92 | * patches as values. |
||
93 | * |
||
94 | * When 'replace' mode is activated the order of array merges is exchanged. |
||
95 | * |
||
96 | * @var bool $mergeExtraDeep |
||
97 | */ |
||
98 | protected $mergeExtraDeep = false; |
||
99 | |||
100 | /** |
||
101 | * Whether to merge the scripts section. |
||
102 | * |
||
103 | * @var bool $mergeScripts |
||
104 | */ |
||
105 | protected $mergeScripts = false; |
||
106 | |||
107 | /** |
||
108 | * Whether to merge the scripts section in a deep / recursive way. |
||
109 | * |
||
110 | * By default the scripts section is merged with array_merge() and duplicate |
||
111 | * keys are ignored. When enabled this allows to merge the arrays recursively |
||
112 | * using the following rule: Integer keys are merged, while array values are |
||
113 | * replaced where the later values overwrite the former. |
||
114 | * |
||
115 | * When 'replace' mode is activated the order of array merges is exchanged. |
||
116 | * |
||
117 | * @var bool $mergeScriptsDeep |
||
118 | */ |
||
119 | protected $mergeScriptsDeep; |
||
120 | |||
121 | /** |
||
122 | * @var bool $firstInstall |
||
123 | */ |
||
124 | protected $firstInstall = false; |
||
125 | |||
126 | /** |
||
127 | * @var bool $locked |
||
128 | */ |
||
129 | protected $locked = false; |
||
130 | 210 | ||
131 | /** |
||
132 | 210 | * @var bool $dumpAutoloader |
|
133 | 210 | */ |
|
134 | protected $dumpAutoloader = false; |
||
135 | |||
136 | /** |
||
137 | * @var bool $optimizeAutoloader |
||
138 | 175 | */ |
|
139 | protected $optimizeAutoloader = false; |
||
140 | 175 | ||
141 | 175 | /** |
|
142 | * @param Composer $composer |
||
143 | 175 | */ |
|
144 | 175 | public function __construct(Composer $composer) |
|
148 | 175 | ||
149 | 175 | /** |
|
150 | 175 | * Load plugin settings |
|
151 | 175 | */ |
|
152 | 175 | public function loadSettings() |
|
184 | 175 | ||
185 | /** |
||
186 | 175 | * Get list of filenames and/or glob patterns to include |
|
187 | * |
||
188 | * @return array |
||
189 | */ |
||
190 | public function getIncludes() |
||
194 | 10 | ||
195 | /** |
||
196 | 10 | * Get list of filenames and/or glob patterns to require |
|
197 | 10 | * |
|
198 | * @return array |
||
199 | */ |
||
200 | public function getRequires() |
||
204 | 185 | ||
205 | /** |
||
206 | 185 | * Set the first install flag |
|
207 | * |
||
208 | * @param bool $flag |
||
209 | */ |
||
210 | public function setFirstInstall($flag) |
||
214 | 15 | ||
215 | /** |
||
216 | 15 | * Is this the first time that the plugin has been installed? |
|
217 | 15 | * |
|
218 | * @return bool |
||
219 | */ |
||
220 | public function isFirstInstall() |
||
224 | 20 | ||
225 | /** |
||
226 | 20 | * Set the locked flag |
|
227 | * |
||
228 | * @param bool $flag |
||
229 | */ |
||
230 | public function setLocked($flag) |
||
234 | 5 | ||
235 | /** |
||
236 | 5 | * Was a lockfile present when the plugin was installed? |
|
237 | * |
||
238 | * @return bool |
||
239 | */ |
||
240 | public function isLocked() |
||
244 | 175 | ||
245 | /** |
||
246 | 175 | * Should an update be forced? |
|
247 | 175 | * |
|
248 | * @return true If packages are not locked |
||
249 | */ |
||
250 | public function forceUpdate() |
||
254 | 170 | ||
255 | /** |
||
256 | 170 | * Set the devMode flag |
|
257 | * |
||
258 | * @param bool $flag |
||
259 | */ |
||
260 | public function setDevMode($flag) |
||
264 | 170 | ||
265 | /** |
||
266 | 170 | * Should devMode settings be processed? |
|
267 | * |
||
268 | * @return bool |
||
269 | */ |
||
270 | public function isDevMode() |
||
274 | 175 | ||
275 | /** |
||
276 | 175 | * Should devMode settings be merged? |
|
277 | 175 | * |
|
278 | * @return bool |
||
279 | */ |
||
280 | public function shouldMergeDev() |
||
284 | 5 | ||
285 | /** |
||
286 | 5 | * Set the dumpAutoloader flag |
|
287 | * |
||
288 | * @param bool $flag |
||
289 | */ |
||
290 | public function setDumpAutoloader($flag) |
||
294 | 175 | ||
295 | /** |
||
296 | 175 | * Is the autoloader file supposed to be written out? |
|
297 | 175 | * |
|
298 | * @return bool |
||
299 | */ |
||
300 | public function shouldDumpAutoloader() |
||
304 | 5 | ||
305 | /** |
||
306 | 5 | * Set the optimizeAutoloader flag |
|
307 | * |
||
308 | * @param bool $flag |
||
309 | */ |
||
310 | public function setOptimizeAutoloader($flag) |
||
314 | |||
315 | 95 | /** |
|
316 | * Should the autoloader be optimized? |
||
317 | 95 | * |
|
318 | 95 | * @return bool |
|
319 | 95 | */ |
|
320 | 95 | public function shouldOptimizeAutoloader() |
|
324 | |||
325 | /** |
||
326 | * Add duplicate packages |
||
327 | * |
||
328 | * @param string $type Package type |
||
329 | * @param array $packages |
||
330 | 170 | */ |
|
331 | public function addDuplicateLinks($type, array $packages) |
||
339 | |||
340 | /** |
||
341 | 170 | * Get duplicate packages |
|
342 | * |
||
343 | 170 | * @param string $type Package type |
|
344 | * @return array |
||
345 | */ |
||
346 | public function getDuplicateLinks($type) |
||
351 | 95 | ||
352 | /** |
||
353 | 95 | * Should includes be recursively processed? |
|
354 | * |
||
355 | * @return bool |
||
356 | */ |
||
357 | public function recurseIncludes() |
||
361 | 95 | ||
362 | /** |
||
363 | 95 | * Should duplicate links be replaced in a 'last definition wins' order? |
|
364 | * |
||
365 | * @return bool |
||
366 | */ |
||
367 | public function replaceDuplicateLinks() |
||
371 | |||
372 | /** |
||
373 | * Should duplicate links be ignored? |
||
374 | * |
||
375 | * @return bool |
||
376 | */ |
||
377 | public function ignoreDuplicateLinks() |
||
381 | |||
382 | /** |
||
383 | * Should the extra section be merged? |
||
384 | * |
||
385 | * By default, the extra section is not merged and there will be many |
||
386 | * cases where the merge of the extra section is performed too late |
||
387 | * to be of use to other plugins. When enabled, merging uses one of |
||
388 | * two strategies - either 'first wins' or 'last wins'. When enabled, |
||
389 | * 'first wins' is the default behaviour. If Replace mode is activated |
||
390 | * then 'last wins' is used. |
||
391 | * |
||
392 | * @return bool |
||
393 | */ |
||
394 | public function shouldMergeExtra() |
||
398 | |||
399 | 30 | /** |
|
400 | * Should the extra section be merged deep / recursively? |
||
401 | 30 | * |
|
402 | * By default the extra section is merged with array_merge() and duplicate |
||
403 | * keys are ignored. When enabled this allows to merge the arrays recursively |
||
404 | * using the following rule: Integer keys are merged, while array values are |
||
405 | * replaced where the later values overwrite the former. |
||
406 | * |
||
407 | * This is useful especially for the extra section when plugins use larger |
||
408 | * structures like a 'patches' key with the packages as sub-keys and the |
||
409 | * patches as values. |
||
410 | * |
||
411 | * When 'replace' mode is activated the order of array merges is exchanged. |
||
412 | 170 | * |
|
413 | * @return bool |
||
414 | 170 | */ |
|
415 | public function shouldMergeExtraDeep() |
||
419 | |||
420 | |||
421 | /** |
||
422 | * Should the scripts section be merged? |
||
423 | * |
||
424 | * By default, the scripts section is not merged. |
||
425 | * |
||
426 | * @return bool |
||
427 | */ |
||
428 | public function shouldMergeScripts() |
||
432 | |||
433 | /** |
||
434 | * Should the scripts section be merged deep / recursively? |
||
435 | * |
||
436 | * By default the scripts section is merged with array_merge() and duplicate |
||
437 | * keys are ignored. When enabled this allows to merge the arrays recursively |
||
438 | * using the following rule: Integer keys are merged, while array values are |
||
439 | * replaced where the later values overwrite the former. |
||
440 | * |
||
441 | * When 'replace' mode is activated the order of array merges is exchanged. |
||
442 | * |
||
443 | * @return bool |
||
444 | */ |
||
445 | public function shouldMergeScriptsDeep() |
||
449 | } |
||
450 | // vim:sw=4:ts=4:sts=4:et: |
||
451 |