src/ComposerPlugin.php
public static function dump(Event $event)
    {
        $composer            = $event->getComposer();
        $installationManager = $composer->getInstallationManager();
        $repoManager         = $composer->getRepositoryManager();
        $localRepo           = $repoManager->getLocalRepository();
        $package             = $composer->getPackage();
        $config              = $composer->getConfig();

        // To enable class-based filtering, we force `--optimize` flag for our
        // custom autoloaders, so that all PSR-0 and PSR-4 namespaces are
        // iterated and translated to arrays of classes.
        $optimize = true;

        $vendorDir       = $config->get('vendor-dir', Config::RELATIVE_PATHS);
        $defaultLocation = "{$vendorDir}/wp-cli/wp-cli/php/WP_CLI/AutoloadSplitter.php";
        $suffix          = $config->get('autoloader-suffix');

        self::$extra = $event->getComposer()
            ->getPackage()
            ->getExtra();

        $splitterLogic    = self::getExtraKey(self::LOGIC_CLASS_KEY, 'WP_CLI\AutoloadSplitter');
        $splitterLocation = self::getExtraKey(self::LOGIC_CLASS_LOCATION_KEY, $defaultLocation);
        $filePrefixTrue   = self::getExtraKey(self::SPLIT_TARGET_PREFIX_TRUE_KEY, 'autoload_commands');
        $filePrefixFalse  = self::getExtraKey(self::SPLIT_TARGET_PREFIX_FALSE_KEY, 'autoload_framework');

        if (!class_exists($splitterLogic)) {
            $splitterClassPath = sprintf('%s/%s', getcwd(), $splitterLocation);

            // Avoid proceeding if the splitter class file does not exist.
            if (!is_readable( $splitterClassPath)) {
                return;
            }

            include_once $splitterClassPath;
        }

        $generator = new AutoloadGenerator(
            $composer->getEventDispatcher(),
            $event->getIO(),
            $splitterLogic,
            $filePrefixTrue,
            $filePrefixFalse
        );

        $generator->dump(
            $config,
            $localRepo,
            $package,
            $installationManager,
            'composer',
            $optimize,
            $suffix
        );
    }
public static function dump(Event $event)
    {
        $composer            = $event->getComposer();
        $installationManager = $composer->getInstallationManager();
        $repoManager         = $composer->getRepositoryManager();
        $localRepo           = $repoManager->getLocalRepository();
        $package             = $composer->getPackage();
        $config              = $composer->getConfig();

        // To enable class-based filtering, we force `--optimize` flag for our
        // custom autoloaders, so that all PSR-0 and PSR-4 namespaces are
        // iterated and translated to arrays of classes.
        $optimize = true;

        $vendorDir       = $config->get('vendor-dir', Config::RELATIVE_PATHS);
        $defaultLocation = "{$vendorDir}/wp-cli/wp-cli/php/WP_CLI/AutoloadSplitter.php";
        $suffix          = $config->get('autoloader-suffix');

        self::$extra = $event->getComposer()
            ->getPackage()
            ->getExtra();

        $splitterLogic    = self::getExtraKey(self::LOGIC_CLASS_KEY, 'WP_CLI\AutoloadSplitter');
        $splitterLocation = self::getExtraKey(self::LOGIC_CLASS_LOCATION_KEY, $defaultLocation);
        $filePrefixTrue   = self::getExtraKey(self::SPLIT_TARGET_PREFIX_TRUE_KEY, 'autoload_commands');
        $filePrefixFalse  = self::getExtraKey(self::SPLIT_TARGET_PREFIX_FALSE_KEY, 'autoload_framework');

        if (!class_exists($splitterLogic)) {
            $splitterClassPath = sprintf('%s/%s', getcwd(), $splitterLocation);

            // Avoid proceeding if the splitter class file does not exist.
            if (!is_readable( $splitterClassPath)) {
                return;
            }

            include_once $splitterClassPath;
        }

        $generator = new AutoloadGenerator(
            $composer->getEventDispatcher(),
            $event->getIO(),
            $splitterLogic,
            $filePrefixTrue,
            $filePrefixFalse
        );

        $generator->dump(
            $config,
            $localRepo,
            $package,
            $installationManager,
            'composer',
            $optimize,
            $suffix
        );
    }
Dump the event for discovery purposes.

@param Event $event Event that was triggered.