1 | <?php |
||
21 | class SharedPackageInstallerConfig |
||
22 | { |
||
23 | const ENV_PARAMETER_VENDOR_DIR = 'COMPOSER_SPP_VENDOR_DIR'; |
||
24 | const ENV_PARAMETER_SYMLINK_BASE_PATH = 'COMPOSER_SPP_SYMLINK_BASE_PATH'; |
||
25 | |||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $originalVendorDir; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $symlinkDir; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $vendorDir; |
||
41 | |||
42 | /** |
||
43 | * @var string|null |
||
44 | */ |
||
45 | protected $symlinkBasePath; |
||
46 | |||
47 | /** |
||
48 | * @var bool |
||
49 | */ |
||
50 | protected $isSymlinkEnabled = true; |
||
51 | |||
52 | /** |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $packageList = array(); |
||
56 | |||
57 | |||
58 | /** |
||
59 | * @param string $originalRelativeVendorDir |
||
60 | * @param string $originalAbsoluteVendorDir |
||
61 | * @param array|null $extraConfigs |
||
62 | */ |
||
63 | public function __construct($originalRelativeVendorDir, $originalAbsoluteVendorDir, $extraConfigs) |
||
82 | |||
83 | /** |
||
84 | * @param string $baseDir |
||
85 | * @param array $extraConfigs |
||
86 | */ |
||
87 | protected function setSymlinkDirectory($baseDir, array $extraConfigs) |
||
99 | |||
100 | /** |
||
101 | * @param string $baseDir |
||
102 | * @param array $extraConfigs |
||
103 | * |
||
104 | * @throws \InvalidArgumentException |
||
105 | */ |
||
106 | protected function setVendorDir($baseDir, array $extraConfigs) |
||
118 | |||
119 | /** |
||
120 | * Allow to override symlinks base path. |
||
121 | * This is useful for a Virtual Machine environment, where directories can be different |
||
122 | * on the host machine and the guest machine. |
||
123 | * |
||
124 | * @param array $extraConfigs |
||
125 | */ |
||
126 | protected function setSymlinkBasePath(array $extraConfigs) |
||
148 | |||
149 | /** |
||
150 | * The symlink directory creation process can be disabled. |
||
151 | * This may mean that you work directly with the sources directory so the symlink directory is useless. |
||
152 | * |
||
153 | * @param array $extraConfigs |
||
154 | */ |
||
155 | protected function setIsSymlinkEnabled(array $extraConfigs) |
||
165 | |||
166 | /** |
||
167 | * @return array |
||
168 | */ |
||
169 | public function getPackageList() |
||
173 | |||
174 | /** |
||
175 | * @param array $extraConfigs |
||
176 | */ |
||
177 | public function setPackageList(array $extraConfigs) |
||
189 | |||
190 | /** |
||
191 | * @return bool |
||
192 | */ |
||
193 | public function isSymlinkEnabled() |
||
197 | |||
198 | /** |
||
199 | * @return string |
||
200 | */ |
||
201 | public function getVendorDir() |
||
205 | |||
206 | /** |
||
207 | * @return string |
||
208 | */ |
||
209 | public function getSymlinkDir() |
||
213 | |||
214 | /** |
||
215 | * @param bool $endingSlash |
||
216 | * |
||
217 | * @return string |
||
218 | */ |
||
219 | public function getOriginalVendorDir($endingSlash = false) |
||
227 | |||
228 | /** |
||
229 | * @return string|null |
||
230 | */ |
||
231 | public function getSymlinkBasePath() |
||
235 | } |
||
236 |