1 | <?php |
||
28 | class Plugin implements PluginInterface, EventSubscriberInterface |
||
29 | { |
||
30 | /** |
||
31 | * @var string the filename of a lock file. Defaults to `composer-asset-plugin.lock` |
||
32 | */ |
||
33 | public $lockFile = 'composer-asset-plugin.lock'; |
||
34 | |||
35 | /** |
||
36 | * @var Composer instance |
||
37 | */ |
||
38 | protected $composer; |
||
39 | |||
40 | /** |
||
41 | * @var IOInterface |
||
42 | */ |
||
43 | public $io; |
||
44 | |||
45 | /** |
||
46 | * @var Pool |
||
47 | */ |
||
48 | protected $pool; |
||
49 | |||
50 | /** |
||
51 | * List of the available package managers/ |
||
52 | * Initialized at activate. |
||
53 | * @var array|PackageManager[] |
||
54 | * @see activate |
||
55 | */ |
||
56 | protected $managers = [ |
||
57 | 'bower' => 'hiqdev\composerassetplugin\Bower', |
||
58 | 'npm' => 'hiqdev\composerassetplugin\Npm', |
||
59 | ]; |
||
60 | |||
61 | /** |
||
62 | * @var PackageInterface[] the array of active composer packages |
||
63 | */ |
||
64 | protected $packages; |
||
65 | |||
66 | /** |
||
67 | * @var string absolute path to vendor directory. |
||
68 | */ |
||
69 | protected $vendorDir; |
||
70 | |||
71 | /** |
||
72 | * |
||
73 | */ |
||
74 | protected $requires = []; |
||
75 | |||
76 | /** |
||
77 | * Initializes the plugin object with the passed $composer and $io. |
||
78 | * Also initializes package managers. |
||
79 | * |
||
80 | * @param Composer $composer |
||
81 | * @param IOInterface $io |
||
82 | * @void |
||
83 | */ |
||
84 | 3 | public function activate(Composer $composer, IOInterface $io) |
|
99 | |||
100 | public function getComposer() |
||
104 | |||
105 | public function hasManager($name) |
||
109 | |||
110 | public function getManager($name) |
||
114 | |||
115 | /** |
||
116 | * Returns list of events the plugin is subscribed to. |
||
117 | * |
||
118 | * @return array list of events |
||
119 | */ |
||
120 | 1 | public static function getSubscribedEvents() |
|
131 | |||
132 | public function scanAssetDependencies(PackageInterface $package) |
||
164 | |||
165 | /** |
||
166 | * Perform install. Called by composer after install. |
||
167 | * |
||
168 | * @param Event $event |
||
169 | * @void |
||
170 | */ |
||
171 | 1 | public function onPostInstall(Event $event) |
|
181 | |||
182 | /** |
||
183 | * Perform update. Called by composer after update. |
||
184 | * |
||
185 | * @param Event $event |
||
186 | */ |
||
187 | public function onPostUpdate(Event $event) |
||
192 | |||
193 | /** |
||
194 | * Sets [[packages]]. |
||
195 | * |
||
196 | * @param PackageInterface[] $packages |
||
197 | */ |
||
198 | 3 | public function setPackages(array $packages) |
|
202 | |||
203 | /** |
||
204 | * Gets [[packages]]. |
||
205 | * @return \Composer\Package\PackageInterface[] |
||
206 | */ |
||
207 | 2 | public function getPackages() |
|
216 | |||
217 | /** |
||
218 | * Returns package with given name if exists. |
||
219 | * @param string $name package name |
||
220 | * @return \Composer\Package\PackageInterface|null |
||
221 | */ |
||
222 | public function findPackage($name, $composer = null) |
||
230 | |||
231 | /** |
||
232 | * Scan packages from the composer objects. |
||
233 | * @void |
||
234 | */ |
||
235 | 1 | protected function scanPackages() |
|
260 | |||
261 | /** |
||
262 | * Load packages from given lock file. |
||
263 | * |
||
264 | * @param JsonFile $lockFile |
||
265 | * @void |
||
266 | */ |
||
267 | protected function loadPackages(JsonFile $lockFile) |
||
274 | |||
275 | /** |
||
276 | * Install packages after loading/scanning. |
||
277 | * @param string $action |
||
278 | * @void |
||
279 | */ |
||
280 | 1 | protected function runAction($action) |
|
291 | |||
292 | /** |
||
293 | * Get absolute path to composer vendor dir. |
||
294 | * @return string |
||
295 | */ |
||
296 | 1 | public function getVendorDir() |
|
304 | |||
305 | 1 | public function findVendorDir($composer) |
|
309 | } |
||
310 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.