src/Installer/PluginInstaller.php
public static function writePluginConfig($pluginConfig, array $plugins, array $pluginClassNames)
    {
        $data = array();
        foreach ($plugins as $pluginName => $installerName) {
            // see https://github.com/composer/composer/blob/1.0.0/src/Composer/Command/InitCommand.php#L206-L210
            if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $pluginName)) {
                throw new \InvalidArgumentException(
                    "The package name '" . $pluginName . "' is invalid, it must be lowercase and have a vendor name, "
                    . "a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+"
                );
            }
            $data[] = sprintf("    '%s' => array(", $pluginName);

            if (!preg_match('{^[a-zA-Z0-9_.-]+$}', $installerName)) {
                throw new \InvalidArgumentException(
                    "The installer name '" . $installerName . "' is invalid, "
                    . "it must be alphanumeric, matching: [a-zA-Z0-9_.-]+"
                );
            }
            $data[] = sprintf("        'installerName' => '%s',", $installerName);

            if (isset($pluginClassNames[$pluginName])) {
                $data[] = sprintf("        'classNames' => array(");

                foreach ($pluginClassNames[$pluginName] as $className) {
                    // see https://secure.php.net/manual/en/language.oop5.basic.php
                    if (!preg_match('{^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$}', $className)) {
                        throw new \InvalidArgumentException(
                            "The plugin class name '" . $className . "' is no valid PHP class name"
                        );
                    }
                    $data[] = sprintf("            '%s',", $className);
                }

                $data[] = "        ),";
            }

            $data[] = "    ),";
        }

        $contents = <<<'PHP'
<?php

// %s @generated by %s

return array(
%s
);

PHP;

        $contents = sprintf(
            $contents,
            basename($pluginConfig),
            static::PACKAGE_NAME,
            implode("\n", $data)
        );

        file_put_contents($pluginConfig, $contents);
    }
public static function writePluginConfig($pluginConfig, array $plugins, array $pluginClassNames)
    {
        $data = array();
        foreach ($plugins as $pluginName => $installerName) {
            // see https://github.com/composer/composer/blob/1.0.0/src/Composer/Command/InitCommand.php#L206-L210
            if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $pluginName)) {
                throw new \InvalidArgumentException(
                    "The package name '" . $pluginName . "' is invalid, it must be lowercase and have a vendor name, "
                    . "a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+"
                );
            }
            $data[] = sprintf("    '%s' => array(", $pluginName);

            if (!preg_match('{^[a-zA-Z0-9_.-]+$}', $installerName)) {
                throw new \InvalidArgumentException(
                    "The installer name '" . $installerName . "' is invalid, "
                    . "it must be alphanumeric, matching: [a-zA-Z0-9_.-]+"
                );
            }
            $data[] = sprintf("        'installerName' => '%s',", $installerName);

            if (isset($pluginClassNames[$pluginName])) {
                $data[] = sprintf("        'classNames' => array(");

                foreach ($pluginClassNames[$pluginName] as $className) {
                    // see https://secure.php.net/manual/en/language.oop5.basic.php
                    if (!preg_match('{^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$}', $className)) {
                        throw new \InvalidArgumentException(
                            "The plugin class name '" . $className . "' is no valid PHP class name"
                        );
                    }
                    $data[] = sprintf("            '%s',", $className);
                }

                $data[] = "        ),";
            }

            $data[] = "    ),";
        }

        $contents = <<<'PHP'
<?php

// %s @generated by %s

return array(
%s
);

PHP;

        $contents = sprintf(
            $contents,
            basename($pluginConfig),
            static::PACKAGE_NAME,
            implode("\n", $data)
        );

        file_put_contents($pluginConfig, $contents);
    }
Rewrites the pico-plugin.php in Composer's vendor dir

@param  string $pluginConfig
@param  array  $plugins
@param  array  $pluginClassNames
@return void