This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Scans the Composer namespace mappings to obtain the correct | |
* paths of packages that use psr-0 with target-dir. | |
* | |
* @see https://getcomposer.org/doc/04-schema.md#target-dir | |
* { | |
* "autoload": { | |
* "psr-0": { "Symfony\\Component\\Finder\\": "" } | |
* }, | |
* "target-dir": "Symfony/Component/Finder" | |
* } | |
* | |
* Usage: | |
* php ede-php-autoload-list-namespaces.php vendor/composer/autoload_namespaces.php | |
*/ | |
$autoloadInformation = require $_SERVER['argv'][1]; | |
echo array_reduce(array_map(function ($prefix, $directories) { | |
return [$prefix, $directories]; | |
}, array_keys($autoloadInformation), $autoloadInformation), function ($list, $package) { | |
list($prefix, $directories) = $package; | |
$prefix = addslashes($prefix); | |
$directory = array_pop($directories); | |
return $list . "(\"{$prefix}\" . \"{$directory}\") "; | |
}, "(") . ")"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment