[BUGFIX] Fix broken link to anchor
[Packages/TYPO3.CMS.git] / typo3 / contrib / vendor / helhum / class-alias-loader / Classes / Composer / Plugin.php
1 <?php
2 namespace Helhum\ClassAliasLoader\Composer;
3
4 /*
5 * This file is part of the class alias loader package.
6 *
7 * (c) Helmut Hummel <info@helhum.io>
8 *
9 * For the full copyright and license information, please view the LICENSE
10 * file that was distributed with this source code.
11 */
12
13 use Composer\Composer;
14 use Composer\IO\IOInterface;
15 use Composer\Plugin\PluginInterface;
16 use Composer\EventDispatcher\EventSubscriberInterface;
17
18 /**
19 * Class Plugin
20 */
21 class Plugin implements PluginInterface, EventSubscriberInterface {
22
23 /**
24 * @var Composer
25 */
26 protected $composer;
27
28 /**
29 * @var IOInterface
30 */
31 protected $io;
32
33 /**
34 * Apply plugin modifications to composer
35 *
36 * @param Composer $composer
37 * @param IOInterface $io
38 */
39 public function activate(Composer $composer, IOInterface $io) {
40 $this->composer = $composer;
41 $this->io = $io;
42 }
43
44 /**
45 * Returns an array of event names this subscriber wants to listen to.
46 *
47 * The array keys are event names and the value can be:
48 *
49 * * The method name to call (priority defaults to 0)
50 * * An array composed of the method name to call and the priority
51 * * An array of arrays composed of the method names to call and respective
52 * priorities, or 0 if unset
53 *
54 * For instance:
55 *
56 * * array('eventName' => 'methodName')
57 * * array('eventName' => array('methodName', $priority))
58 * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
59 *
60 * @return array The event names to listen to
61 */
62 public static function getSubscribedEvents() {
63 return array(
64 'post-autoload-dump' => array('onPostAutoloadDump')
65 );
66 }
67
68 /**
69 * Plugin callback for this script event, which calls the previously implemented static method
70 *
71 * @param \Composer\Script\Event $event
72 * @return bool
73 */
74 public function onPostAutoloadDump(\Composer\Script\Event $event) {
75 return ClassAliasGenerator::generateAliasMap($event, true);
76 }
77
78 }