Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

88893 lines
1.8 MiB

<
#!/usr/bin/env php
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view
* the license that is located at the bottom of this file.
*/
// Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
ini_set('apc.cache_by_default', 0);
} else {
fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
}
}
Phar::mapPhar('composer.phar');
require 'phar://composer.phar/bin/composer';
__HALT_COMPILER(); ?>
?”ó composer.phar+src/Composer/Autoload/AutoloadGenerator.phppeÈ�u[pe¬ËÕi¶+src/Composer/Autoload/ClassMapGenerator.php‹È�u[‹Mè�Ķsrc/Composer/Cache.php’È�u[’­bš0¶%src/Composer/Command/AboutCommand.phpÍÈ�u[ͳ¢Ay¶'src/Composer/Command/ArchiveCommand.phpcÈ�u[c¥{ï¶$src/Composer/Command/BaseCommand.phpÜ È�u[Ü gô1¶.src/Composer/Command/BaseDependencyCommand.phpñÈ�u[ñXgFð¶1src/Composer/Command/CheckPlatformReqsCommand.php� È�u[� ŸL’ž¶*src/Composer/Command/ClearCacheCommand.php^È�u[^¨ãj¶&src/Composer/Command/ConfigCommand.php‰IÈ�u[‰Iä³ï€¶-src/Composer/Command/CreateProjectCommand.php%5È�u[%5èP-¶'src/Composer/Command/DependsCommand.php¸È�u[¸K°¶(src/Composer/Command/DiagnoseCommand.phpmIÈ�u[mI]úE!¶,src/Composer/Command/DumpAutoloadCommand.php
�u[
ݸ:¶$src/Composer/Command/ExecCommand.phpkÈ�u[k¼“À[¶&src/Composer/Command/GlobalCommand.php@ È�u[@ ·©ð¶$src/Composer/Command/HomeCommand.phpÄÈ�u[ÄÇH¶$src/Composer/Command/InitCommand.php•KÈ�u[•K„yŸ¶'src/Composer/Command/InstallCommand.phpÈ�u[[ š¶(src/Composer/Command/LicensesCommand.php;È�u[;™�U¶(src/Composer/Command/OutdatedCommand.php±
È�u[±
¼LÓ¶)src/Composer/Command/ProhibitsCommand.phpÌÈ�u[̨[®¶&src/Composer/Command/RemoveCommand.phpœÈ�u[œQ¶�¯¶'src/Composer/Command/RequireCommand.php× È�u[× ³ª¨ß¶)src/Composer/Command/RunScriptCommand.phpãÈ�u[ã˜Ô¶+src/Composer/Command/ScriptAliasCommand.phppÈ�u[pg †(¶&src/Composer/Command/SearchCommand.php È�u[ Ò=Á‹¶*src/Composer/Command/SelfUpdateCommand.phpÌ2È�u[Ì2Ú6 ¶$src/Composer/Command/ShowCommand.php_mÈ�u[_m‚¤:a¶&src/Composer/Command/StatusCommand.php\È�u[\«In¶(src/Composer/Command/SuggestsCommand.php© È�u[© <Qþ¶&src/Composer/Command/UpdateCommand.phpµ#È�u[µ#@Š4-¶(src/Composer/Command/ValidateCommand.phpPÈ�u[P|ugü¶src/Composer/Composer.phpù È�u[ù Ù÷ƒÀ¶src/Composer/Config.phpÎ"È�u[Î")Î\¶-src/Composer/Config/ConfigSourceInterface.phpÈ�u[³ [/¶(src/Composer/Config/JsonConfigSource.phpuÈ�u[u=¤ƒ¶$src/Composer/Console/Application.phpÚ3È�u[Ú3 ý%D¶,src/Composer/Console/HtmlOutputFormatter.php3È�u[3Ú�Eu¶-src/Composer/DependencyResolver/Decisions.phpQÈ�u[Q?˜¬$¶1src/Composer/DependencyResolver/DefaultPolicy.phpÈ�u[õÝv¶/src/Composer/DependencyResolver/GenericRule.phpµÈ�u[µ᫤¶>src/Composer/DependencyResolver/Operation/InstallOperation.phpCÈ�u[C´\õ*¶Isrc/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷È�u[÷ïÎà÷¶Ksrc/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpýÈ�u[ý3#†¶@src/Composer/DependencyResolver/Operation/OperationInterface.phpÓÈ�u[ÓÙâ&ä¶=src/Composer/DependencyResolver/Operation/SolverOperation.php¹È�u[¹&¢e
¶@src/Composer/DependencyResolver/Operation/UninstallOperation.phpIÈ�u[IFûÂɶ=src/Composer/DependencyResolver/Operation/UpdateOperation.phphÈ�u[höSÕ]¶3src/Composer/DependencyResolver/PolicyInterface.php­È�u[­Ÿ‹R¶(src/Composer/DependencyResolver/Pool.php°"È�u[°" Ž%¶+src/Composer/DependencyResolver/Problem.php¤È�u[¤Þ¶+src/Composer/DependencyResolver/Request.phpƒÈ�u[ƒåVP„¶(src/Composer/DependencyResolver/Rule.php«È�u[«ôÓç´¶1src/Composer/DependencyResolver/Rule2Literals.phpÈ�u[tZÅɶ+src/Composer/DependencyResolver/RuleSet.phpª
È�u[ª
_΂¶4src/Composer/DependencyResolver/RuleSetGenerator.phpFÈ�u[F/Iж3src/Composer/DependencyResolver/RuleSetIterator.phpÈ�u[›Cü$¶2src/Composer/DependencyResolver/RuleWatchChain.phpiÈ�u[ihïš,¶2src/Composer/DependencyResolver/RuleWatchGraph.phpáÈ�u[á‰rôv¶1src/Composer/DependencyResolver/RuleWatchNode.phpÈ�u[�Gd7¶*src/Composer/DependencyResolver/Solver.php,:È�u[,:²ã~œ¶6src/Composer/DependencyResolver/SolverBugException.php™È�u[™Xg6¶;src/Composer/DependencyResolver/SolverProblemsException.phpôÈ�u[ô×|Ŧ¶/src/Composer/DependencyResolver/Transaction.php×È�u[×Vm쟶-src/Composer/Downloader/ArchiveDownloader.phpÆ È�u[Æ G s0¶1src/Composer/Downloader/ChangeReportInterface.phpÌÈ�u[̯ਿ¶+src/Composer/Downloader/DownloadManager.php`È�u[`#ÏX¶/src/Composer/Downloader/DownloaderInterface.phpÊÈ�u[Êgs!l¶3src/Composer/Downloader/DvcsDownloaderInterface.phpÑÈ�u[Ñ&Áœ¿¶*src/Composer/Downloader/FileDownloader.php?È�u[?"Aý¶/src/Composer/Downloader/FilesystemException.php
�u[
.-‹¶,src/Composer/Downloader/FossilDownloader.php‚ È�u[‚ Ü�Ii¶)src/Composer/Downloader/GitDownloader.phpq4È�u[q4ZÎÇ׶*src/Composer/Downloader/GzipDownloader.phpóÈ�u[ó}Úo¶(src/Composer/Downloader/HgDownloader.php”È�u[”ßis̶*src/Composer/Downloader/PathDownloader.phpQÈ�u[QCn¤¶0src/Composer/Downloader/PearPackageExtractor.phpuÈ�u[uz„‡¶.src/Composer/Downloader/PerforceDownloader.php§È�u[§âƒ¨¶*src/Composer/Downloader/PharDownloader.phpåÈ�u[åÞÉç¶)src/Composer/Downloader/RarDownloader.phpžÈ�u[ž6 3U¶)src/Composer/Downloader/SvnDownloader.phpGÈ�u[GM#j¶)src/Composer/Downloader/TarDownloader.phpãÈ�u[ãÍ’X?¶.src/Composer/Downloader/TransportException.php=È�u[=ZÎÈÞ¶9src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔÈ�u[Ô`§ôö¶)src/Composer/Downloader/VcsDownloader.php¡È�u[¡( à>¶(src/Composer/Downloader/XzDownloader.php§È�u[§W$;á¶)src/Composer/Downloader/ZipDownloader.phpèÈ�u[èÓ9ˆÿ¶&src/Composer/EventDispatcher/Event.php È�u[ ±™jï¶0src/Composer/EventDispatcher/EventDispatcher.php 2È�u[ 2anÕ3¶9src/Composer/EventDispatcher/EventSubscriberInterface.php©È�u[©h·0¶9src/Composer/EventDispatcher/ScriptExecutionException.phpvÈ�u[vwZ8S¶)src/Composer/Exception/NoSslException.phpfÈ�u[fËíM�¶src/Composer/Factory.phpR=È�u[R=d®¤¶src/Composer/IO/BaseIO.phpŒÈ�u[Œ(‚l‘¶src/Composer/IO/BufferIO.php*È�u[*¢®hT¶src/Composer/IO/ConsoleIO.php6È�u[6ö#$¶src/Composer/IO/IOInterface.phpìÈ�u[ìÕ�¶src/Composer/IO/NullIO.phpÀÈ�u[ÀF`sʶsrc/Composer/Installer.php�È�u[�¡q4Ŷ*src/Composer/Installer/BinaryInstaller.php×È�u[×£æq¶2src/Composer/Installer/BinaryPresenceInterface.phpËÈ�u[ËÀ5š¨¶.src/Composer/Installer/InstallationManager.php-È�u[-¾}Œ7¶)src/Composer/Installer/InstallerEvent.phpÈ�u[lÔzi¶*src/Composer/Installer/InstallerEvents.phpÞÈ�u[ÞìŸ@G¶-src/Composer/Installer/InstallerInterface.phpãÈ�u[ã^ƒ“ʶ+src/Composer/Installer/LibraryInstaller.php%È�u[% »�̶/src/Composer/Installer/MetapackageInstaller.phpœÈ�u[œÆÅ!¶(src/Composer/Installer/NoopInstaller.php+È�u[+À·M}¶'src/Composer/Installer/PackageEvent.phpeÈ�u[e;° ¶(src/Composer/Installer/PackageEvents.php¸È�u[¸dbØs¶.src/Composer/Installer/PearBinaryInstaller.phpø È�u[ø *ë•k¶(src/Composer/Installer/PearInstaller.php¢È�u[¢È‚¶Ñ¶*src/Composer/Installer/PluginInstaller.php‹È�u[‹ÒX8¶+src/Composer/Installer/ProjectInstaller.phpÈ�u[*0@P¶4src/Composer/Installer/SuggestedPackagesReporter.php:È�u[:‚´UV¶src/Composer/Json/JsonFile.phpîÈ�u[îb-~¶#src/Composer/Json/JsonFormatter.phpbÈ�u[bÝNš¶%src/Composer/Json/JsonManipulator.php’3È�u[’3é7¶-src/Composer/Json/JsonValidationException.php\È�u[\.Xóܶ%src/Composer/Package/AliasPackage.phpÈ�u[¹—~š¶7src/Composer/Package/Archiver/ArchivableFilesFilter.php È�u[ yY+¦¶7src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞÈ�u[Þ ²²¹¶0src/Composer/Package/Archiver/ArchiveManager.php† È�u[† ß5°¶3src/Composer/Package/Archiver/ArchiverInterface.phpÈ�u[ñ´> ¶3src/Composer/Package/Archiver/BaseExcludeFilter.php–È�u[–y¶=ƶ7src/Composer/Package/Archiver/ComposerExcludeFilter.phpÈ�u[‹SZ0¶2src/Composer/Package/Archiver/GitExcludeFilter.phprÈ�u[r3‘Mh¶1src/Composer/Package/Archiver/HgExcludeFilter.php È�u[  •¦S¶.src/Composer/Package/Archiver/PharArchiver.php?È�u[?®— u¶-src/Composer/Package/Archiver/ZipArchiver.php½È�u[½VÀ‚¨¶$src/Composer/Package/BasePackage.php& È�u[& 'ݶ*src/Composer/Package/Comparer/Comparer.php8È�u[8O 2¨¶(src/Composer/Package/CompletePackage.phpüÈ�u[üþM˶¶1src/Composer/Package/CompletePackageInterface.phpõÈ�u[õ¦Ê�ò¶+src/Composer/Package/Dumper/ArrayDumper.php= È�u[= T\‹7¶src/Composer/Package/Link.phpˆÈ�u[ˆå¶Y«¶7src/Composer/Package/LinkConstraint/EmptyConstraint.php‚È�u[‚é~‹¶?src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpdÈ�u[d¤ôLn¶7src/Composer/Package/LinkConstraint/MultiConstraint.php‚È�u[‚ób`ý¶:src/Composer/Package/LinkConstraint/SpecificConstraint.phpiÈ�u[iÞ”š%¶9src/Composer/Package/LinkConstraint/VersionConstraint.phpXÈ�u[X}`y¶+src/Composer/Package/Loader/ArrayLoader.phpÈ�u[n~œ›¶7src/Composer/Package/Loader/InvalidPackageException.phpEÈ�u[Exb¾¶*src/Composer/Package/Loader/JsonLoader.phpùÈ�u[ù!~ˆ{¶/src/Composer/Package/Loader/LoaderInterface.php²È�u[²¦}úζ1src/Composer/Package/Loader/RootPackageLoader.phpÈ�u[-‚£{¶5src/Composer/Package/Loader/ValidatingArrayLoader.php­6È�u[­6\æ0¶src/Composer/Package/Locker.php¥!È�u[¥!/=xö¶ src/Composer/Package/Package.phpÉÈ�u[ÉcÃ�h¶)src/Composer/Package/PackageInterface.php È�u[ ûÇ^ƶ)src/Composer/Package/RootAliasPackage.php È�u[ _€ø¶$src/Composer/Package/RootPackage.phpÈ�u[ŽÎ_¶-src/Composer/Package/RootPackageInterface.php¹È�u[¹"maV¶/src/Composer/Package/Version/VersionGuesser.phpÏÈ�u[ÏÌÂ߶.src/Composer/Package/Version/VersionParser.php¥È�u[¥ô´à¶0src/Composer/Package/Version/VersionSelector.phpK È�u[K ²<ȶ-src/Composer/Plugin/Capability/Capability.phpWÈ�u[Wæ_¨1¶2src/Composer/Plugin/Capability/CommandProvider.php—È�u[—ûOâ>¶src/Composer/Plugin/Capable.phpÈ�u[Æq+¶$src/Composer/Plugin/CommandEvent.phpâÈ�u[â³ÆÇW¶$src/Composer/Plugin/PluginEvents.phpöÈ�u[öá1=z¶'src/Composer/Plugin/PluginInterface.phpôÈ�u[ô)'*ض%src/Composer/Plugin/PluginManager.php$È�u[$‹K©¶*src/Composer/Plugin/PreCommandRunEvent.phpõÈ�u[õ:ðd¶,src/Composer/Plugin/PreFileDownloadEvent.php`È�u[`9-ζ4src/Composer/Question/StrictConfirmationQuestion.phpÈ�u['.³è¶+src/Composer/Repository/ArrayRepository.phpÈ�u[éÌt¶.src/Composer/Repository/ArtifactRepository.phpê È�u[ê a¦ˆ¶*src/Composer/Repository/BaseRepository.phpv È�u[v „ÜL¶.src/Composer/Repository/ComposerRepository.phpÐUÈ�u[ÐUü­l�¶/src/Composer/Repository/CompositeRepository.php;È�u[;¤¯S¶;src/Composer/Repository/ConfigurableRepositoryInterface.php…È�u[…±Ÿ_¶0src/Composer/Repository/FilesystemRepository.php$È�u[$¾Ãá…¶4src/Composer/Repository/InstalledArrayRepository.php£È�u[£/ö~>¶9src/Composer/Repository/InstalledFilesystemRepository.php£È�u[£V
•_¶8src/Composer/Repository/InstalledRepositoryInterface.php‡È�u[‡£9p¶6src/Composer/Repository/InvalidRepositoryException.phpnÈ�u[nà“똶-src/Composer/Repository/PackageRepository.phpjÈ�u[j¥ôò̶*src/Composer/Repository/PathRepository.php– È�u[– WÛ¶2src/Composer/Repository/Pear/BaseChannelReader.phpIÈ�u[Ic6³¶,src/Composer/Repository/Pear/ChannelInfo.phpÄÈ�u[Ä:T*ɶ.src/Composer/Repository/Pear/ChannelReader.phpíÈ�u[í?ÈYT¶4src/Composer/Repository/Pear/ChannelRest10Reader.php® È�u[® ™ÖÛú¶4src/Composer/Repository/Pear/ChannelRest11Reader.php& È�u[& òUb¶5src/Composer/Repository/Pear/DependencyConstraint.phpqÈ�u[q9=¶/src/Composer/Repository/Pear/DependencyInfo.phpqÈ�u[qfºTò¶8src/Composer/Repository/Pear/PackageDependencyParser.php…È�u[…÷$Li¶,src/Composer/Repository/Pear/PackageInfo.php°È�u[°Ÿ ¸ ¶,src/Composer/Repository/Pear/ReleaseInfo.php’È�u[’o“ŠÃ¶*src/Composer/Repository/PearRepository.phpªÈ�u[ª)Ÿƒ}¶.src/Composer/Repository/PlatformRepository.phpÈ�u[4&~û¶-src/Composer/Repository/RepositoryFactory.php2È�u[2t>¶/src/Composer/Repository/RepositoryInterface.phpÛÈ�u[Û’âÁ¶-src/Composer/Repository/RepositoryManager.php2
�u[2
á…5#¶7src/Composer/Repository/RepositorySecurityException.phpoÈ�u[opÕ«ª¶/src/Composer/Repository/Vcs/BitbucketDriver.phpôÈ�u[ôx¤ü¶,src/Composer/Repository/Vcs/FossilDriver.php¦È�u[¦ébîd¶2src/Composer/Repository/Vcs/GitBitbucketDriver.phpêÈ�u[êÃŽ»¶)src/Composer/Repository/Vcs/GitDriver.php¼È�u[¼Š©Ðê¶,src/Composer/Repository/Vcs/GitHubDriver.php\)È�u[\)'›•#¶,src/Composer/Repository/Vcs/GitLabDriver.phpÍ#È�u[Í#ßNìʶ1src/Composer/Repository/Vcs/HgBitbucketDriver.phpäÈ�u[äi›üà¶(src/Composer/Repository/Vcs/HgDriver.phpVÈ�u[VIÁFò¶.src/Composer/Repository/Vcs/PerforceDriver.php' È�u[' ÙóH¶)src/Composer/Repository/Vcs/SvnDriver.php‰È�u[‰ÍßǬ¶)src/Composer/Repository/Vcs/VcsDriver.phpæ
È�u[æ
eׯ-¶2src/Composer/Repository/Vcs/VcsDriverInterface.php÷È�u[÷ÇX[‰¶)src/Composer/Repository/VcsRepository.php !È�u[ !cÕK¶3src/Composer/Repository/WritableArrayRepository.phpÈ�u[¾G*¶7src/Composer/Repository/WritableRepositoryInterface.php‰È�u[‰‘/sï¶$src/Composer/Script/CommandEvent.phpWÈ�u[W£VZt¶src/Composer/Script/Event.phpµÈ�u[µlt¦M¶$src/Composer/Script/PackageEvent.phpœÈ�u[œ§ÿÉ ¶$src/Composer/Script/ScriptEvents.phpPÈ�u[P‡�¶¶ src/Composer/SelfUpdate/Keys.php�È�u[� îÊN¶$src/Composer/SelfUpdate/Versions.phpìÈ�u[ì͵‘ƒ¶ src/Composer/Util/AuthHelper.phpËÈ�u[Ë>zx–¶src/Composer/Util/Bitbucket.php%È�u[%n=gÓ¶$src/Composer/Util/ComposerMirror.php±È�u[±­½øض%src/Composer/Util/ConfigValidator.php÷È�u[÷v•Í¶"src/Composer/Util/ErrorHandler.php‡È�u[‡He"¶ src/Composer/Util/Filesystem.phpg/È�u[g/|Îq÷¶src/Composer/Util/Git.phpg&È�u[g&]ó²´¶src/Composer/Util/GitHub.phpw È�u[w -SE¶src/Composer/Util/GitLab.php™ È�u[™ BLF¶src/Composer/Util/Hg.php¾È�u[¾LÓ �¶src/Composer/Util/IniHelper.phphÈ�u[h;FP¶$src/Composer/Util/NoProxyPattern.php¾È�u[¾Z+°m¶src/Composer/Util/Perforce.php‚1È�u[‚1,œbx¶src/Composer/Util/Platform.phpüÈ�u[üs­fç¶%src/Composer/Util/ProcessExecutor.phpÚ È�u[Ú £ÒÙ¶&src/Composer/Util/RemoteFilesystem.php
j�u[
j�Å ´¶src/Composer/Util/Silencer.phpéÈ�u[é“Vjf¶!src/Composer/Util/SpdxLicense.phpÈ�u[¾7
ñ¶*src/Composer/Util/StreamContextFactory.phpÈ�u[ŸÁI¶src/Composer/Util/Svn.php'È�u['|×x‰¶src/Composer/Util/TlsHelper.phpn
�u[n
S¯Í:¶src/Composer/Util/Url.php£È�u[£3œÉܶsrc/Composer/XdebugHandler.phpðÈ�u[ðzÓf~¶src/bootstrap.php¹È�u[¹I}œ¶%src/Composer/Autoload/ClassLoader.phpn4È�u[n4êíÌ;¶#res/composer-repository-schema.jsonðÈ�u[ð�GÐà¶res/composer-schema.jsonÏ•È�u[Ï•&�R¶6vendor/composer/spdx-licenses/res/spdx-exceptions.json È�u[ º¯¶4vendor/composer/spdx-licenses/res/spdx-licenses.jsonŸ�È�u[Ÿ�J*B¶4vendor/symfony/console/Resources/bin/hiddeninput.exe$È�u[$•�¥v¶&vendor/symfony/console/Application.php‚WÈ�u[‚WâPáz¶*vendor/symfony/console/Command/Command.phpñ"È�u[ñ"Øô¶.vendor/symfony/console/Command/HelpCommand.phpØÈ�u[Ø$Y«¶.vendor/symfony/console/Command/ListCommand.phpZÈ�u[ZÉ£ ¶(vendor/symfony/console/ConsoleEvents.phpéÈ�u[éRÛÔe¶<vendor/symfony/console/Descriptor/ApplicationDescription.phpÐÈ�u[ЙŽ5°¶0vendor/symfony/console/Descriptor/Descriptor.phpŽÈ�u[Žéð8Ÿ¶9vendor/symfony/console/Descriptor/DescriptorInterface.phpüÈ�u[ü±Qµ¶4vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ È�u[Ü *û�ɶ8vendor/symfony/console/Descriptor/MarkdownDescriptor.php´È�u[´�!³g¶4vendor/symfony/console/Descriptor/TextDescriptor.php²È�u[²�­ùâ¶3vendor/symfony/console/Descriptor/XmlDescriptor.phpýÈ�u[ý
G1¿¶4vendor/symfony/console/Event/ConsoleCommandEvent.php°È�u[°!ȶ-vendor/symfony/console/Event/ConsoleEvent.phpÅÈ�u[ÅÒxÛ\¶6vendor/symfony/console/Event/ConsoleExceptionEvent.phpÈ�u[á2é¶6vendor/symfony/console/Event/ConsoleTerminateEvent.phpzÈ�u[z³,îL¶=vendor/symfony/console/Exception/CommandNotFoundException.phpÔÈ�u[ÔÈ÷ L¶7vendor/symfony/console/Exception/ExceptionInterface.phpfÈ�u[f¡ABª¶=vendor/symfony/console/Exception/InvalidArgumentException.php¦È�u[¦Ö̽Z¶;vendor/symfony/console/Exception/InvalidOptionException.php¦È�u[¦Ë×H¶3vendor/symfony/console/Exception/LogicException.php’È�u[’ÍO\e¶5vendor/symfony/console/Exception/RuntimeException.php–È�u[–Ùí,6¶4vendor/symfony/console/Formatter/OutputFormatter.php2È�u[2RÌYh¶=vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒÈ�u[ŒòññÀ¶9vendor/symfony/console/Formatter/OutputFormatterStyle.phpJÈ�u[JÏDSȶBvendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„È�u[„÷½G¶>vendor/symfony/console/Formatter/OutputFormatterStyleStack.php>È�u[>[†¿–¶6vendor/symfony/console/Helper/DebugFormatterHelper.phpxÈ�u[xN©Ø¼¶2vendor/symfony/console/Helper/DescriptorHelper.phpwÈ�u[wÅHð.¶.vendor/symfony/console/Helper/DialogHelper.phpúÈ�u[ú "8m¶1vendor/symfony/console/Helper/FormatterHelper.phpcÈ�u[c“ý«N¶(vendor/symfony/console/Helper/Helper.php¨È�u[¨œoû3¶1vendor/symfony/console/Helper/HelperInterface.phpåÈ�u[加¶+vendor/symfony/console/Helper/HelperSet.phpÉÈ�u[É?ã 2¶2vendor/symfony/console/Helper/InputAwareHelper.phpcÈ�u[cñø�|¶/vendor/symfony/console/Helper/ProcessHelper.phpÑ È�u[Ñ @±ã�¶-vendor/symfony/console/Helper/ProgressBar.phpk%È�u[k%H]„ȶ0vendor/symfony/console/Helper/ProgressHelper.php\È�u[\èK+¶3vendor/symfony/console/Helper/ProgressIndicator.phpKÈ�u[KíÍ°¶0vendor/symfony/console/Helper/QuestionHelper.phpmÈ�u[mùÓ/¶7vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl
�u[l
÷ÞL¶'vendor/symfony/console/Helper/Table.phpª*È�u[ª*í8ïM¶+vendor/symfony/console/Helper/TableCell.php€È�u[€Ìî*Û¶-vendor/symfony/console/Helper/TableHelper.php È�u[ ƒu®¹¶0vendor/symfony/console/Helper/TableSeparator.phpÊÈ�u[Êaz¶,vendor/symfony/console/Helper/TableStyle.php
�u[
PÞµ¦¶*vendor/symfony/console/Input/ArgvInput.php™È�u[™,»Bô¶+vendor/symfony/console/Input/ArrayInput.php" È�u[" uô™X¶&vendor/symfony/console/Input/Input.php¢ È�u[¢ ”‡B"¶.vendor/symfony/console/Input/InputArgument.phpÈ�u[&<¦¯¶4vendor/symfony/console/Input/InputAwareInterface.phpšÈ�u[š‡jTŸ¶0vendor/symfony/console/Input/InputDefinition.phpŠÈ�u[Šœäf²¶/vendor/symfony/console/Input/InputInterface.php¡È�u[¡,t^>¶,vendor/symfony/console/Input/InputOption.php È�u[ ¸¬�_¶,vendor/symfony/console/Input/StringInput.php–È�u[–cì\(¶vendor/symfony/console/LICENSE)È�u[)NUN½¶/vendor/symfony/console/Logger/ConsoleLogger.php. È�u[. ¤Œ…ζ0vendor/symfony/console/Output/BufferedOutput.php_È�u[_‹ >P¶/vendor/symfony/console/Output/ConsoleOutput.php°È�u[°]k~o¶8vendor/symfony/console/Output/ConsoleOutputInterface.phpàÈ�u[à‡†Æʶ,vendor/symfony/console/Output/NullOutput.phpÏÈ�u[Ï®˜‹Z¶(vendor/symfony/console/Output/Output.php˜ È�u[˜ pf\¶1vendor/symfony/console/Output/OutputInterface.phpÈ�u[ì&¶.vendor/symfony/console/Output/StreamOutput.php­È�u[­Îs6­¶2vendor/symfony/console/Question/ChoiceQuestion.phpw
�u[w
2t¶8vendor/symfony/console/Question/ConfirmationQuestion.phpçÈ�u[ç ­òf¶,vendor/symfony/console/Question/Question.phpË È�u[Ë ÒqµR¶ vendor/symfony/console/Shell.phpåÈ�u[å•šxS¶,vendor/symfony/console/Style/OutputStyle.php\È�u[\wפ¶/vendor/symfony/console/Style/StyleInterface.phpÏÈ�u[Ï&nÅѶ-vendor/symfony/console/Style/SymfonyStyle.phpÜÈ�u[Üj®|R¶3vendor/symfony/console/Tester/ApplicationTester.phpÏÈ�u[Ïsž9i¶/vendor/symfony/console/Tester/CommandTester.phpªÈ�u[ªµ.âr¶(vendor/symfony/debug/BufferingLogger.phptÈ�u[t=hܶvendor/symfony/debug/Debug.phpÈ�u[˜'Ķ)vendor/symfony/debug/DebugClassLoader.php¡È�u[¡tÅÍT¶%vendor/symfony/debug/ErrorHandler.phpHÈ�u[H‚vÌJ¶9vendor/symfony/debug/Exception/ClassNotFoundException.php–È�u[–i‰æô¶8vendor/symfony/debug/Exception/ContextErrorException.php˜È�u[˜-
d2¶1vendor/symfony/debug/Exception/DummyException.phpÈ�u[®+Ãê¶6vendor/symfony/debug/Exception/FatalErrorException.php È�u[ ˆ93?¶6vendor/symfony/debug/Exception/FatalThrowableError.phpWÈ�u[W?àèK¶3vendor/symfony/debug/Exception/FlattenException.php²È�u[²HòѶ7vendor/symfony/debug/Exception/OutOfMemoryException.php~È�u[~ë¨oâ¶=vendor/symfony/debug/Exception/UndefinedFunctionException.phpšÈ�u[š�ñJÀ¶;vendor/symfony/debug/Exception/UndefinedMethodException.php˜È�u[˜nöêض)vendor/symfony/debug/ExceptionHandler.php!3È�u[!3 Ïq ¶Ivendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php7È�u[7Ñj/=¶Evendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.phpÈ�u[ĹBV¶Mvendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpuÈ�u[uéj¶Kvendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpNÈ�u[NÇo-ç¶vendor/symfony/debug/LICENSE)È�u[)NUN½¶:vendor/symfony/filesystem/Exception/ExceptionInterface.phpiÈ�u[i$ ÿ›¶=vendor/symfony/filesystem/Exception/FileNotFoundException.php¼È�u[¼pí\¶¶3vendor/symfony/filesystem/Exception/IOException.php‡È�u[‡€ü#Ѷ<vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦È�u[¦jÙwM¶(vendor/symfony/filesystem/Filesystem.phpK4È�u[K4½oC·¶!vendor/symfony/filesystem/LICENSE)È�u[)NUN½¶)vendor/symfony/filesystem/LockHandler.phpöÈ�u[öŸZµ1¶1vendor/symfony/finder/Adapter/AbstractAdapter.php\ È�u[\ hˆB¶5vendor/symfony/finder/Adapter/AbstractFindAdapter.php‹È�u[‹…Ôж2vendor/symfony/finder/Adapter/AdapterInterface.php›È�u[›Mþ¶0vendor/symfony/finder/Adapter/BsdFindAdapter.php2È�u[2+Eì¶0vendor/symfony/finder/Adapter/GnuFindAdapter.phpÈ�u[è„JL¶,vendor/symfony/finder/Adapter/PhpAdapter.phpôÈ�u[ôÞdè;¶/vendor/symfony/finder/Comparator/Comparator.phpŒÈ�u[ŒwþT¶3vendor/symfony/finder/Comparator/DateComparator.php#È�u[#°ζ5vendor/symfony/finder/Comparator/NumberComparator.php|È�u[|ITÇͶ9vendor/symfony/finder/Exception/AccessDeniedException.php„È�u[„½¾sœ¶;vendor/symfony/finder/Exception/AdapterFailureException.php¬È�u[¬wR¶6vendor/symfony/finder/Exception/ExceptionInterface.php„È�u[„Gz-¶Avendor/symfony/finder/Exception/OperationNotPermitedException.php)È�u[)x§e¶@vendor/symfony/finder/Exception/ShellCommandFailureException.phpºÈ�u[º˜þ˜¶/vendor/symfony/finder/Expression/Expression.phpÈ�u[i¥:Ŷ)vendor/symfony/finder/Expression/Glob.phpfÈ�u[fDÞcj¶*vendor/symfony/finder/Expression/Regex.phpÈ�u[ü(Ã϶3vendor/symfony/finder/Expression/ValueInterface.phpÍÈ�u[Í\p4†¶ vendor/symfony/finder/Finder.php].È�u[].dìÇ¿¶vendor/symfony/finder/Glob.phpKÈ�u[Kjá±n¶7vendor/symfony/finder/Iterator/CustomFilterIterator.php[È�u[[­åW¶:vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpxÈ�u[xôP¶;vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpîÈ�u[îüÍ�q¶Avendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpíÈ�u[ínõH¶4vendor/symfony/finder/Iterator/FilePathsIterator.php È�u[ ^ÁkF¶9vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZÈ�u[Z(&ø¶<vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5È�u[5ší¶9vendor/symfony/finder/Iterator/FilenameFilterIterator.phprÈ�u[rtu¶1vendor/symfony/finder/Iterator/FilterIterator.phpÃÈ�u[Ú+µÞ¶=vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-È�u[-ºÎÒ_¶5vendor/symfony/finder/Iterator/PathFilterIterator.phpÏÈ�u[ϺªÇ¶=vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php È�u[ ÿ¶:vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpeÈ�u[eŸ’áé¶3vendor/symfony/finder/Iterator/SortableIterator.php*È�u[*€õ´^¶vendor/symfony/finder/LICENSE)È�u[)NUN½¶'vendor/symfony/finder/Shell/Command.php< È�u[< „RŸ¶%vendor/symfony/finder/Shell/Shell.phppÈ�u[pQT�¶%vendor/symfony/finder/SplFileInfo.phpÈ�u[þíù¶'vendor/symfony/polyfill-ctype/Ctype.phpH È�u[H ³�Õݶ%vendor/symfony/polyfill-ctype/LICENSE$È�u[$?‡s:¶+vendor/symfony/polyfill-ctype/bootstrap.phpIÈ�u[I�D!e¶(vendor/symfony/polyfill-mbstring/LICENSE)È�u[)±íж-vendor/symfony/polyfill-mbstring/Mbstring.phpCÈ�u[Cæø¶@vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2AÈ�u[2A½=¨¶@vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡AÈ�u[¡AÚ Í¶.vendor/symfony/polyfill-mbstring/bootstrap.phpËÈ�u[Ëó<Ë¢¶7vendor/symfony/process/Exception/ExceptionInterface.phpfÈ�u[f]ö>T¶=vendor/symfony/process/Exception/InvalidArgumentException.php¨È�u[¨ÐÀ+_¶3vendor/symfony/process/Exception/LogicException.php”È�u[” ³ãñ¶;vendor/symfony/process/Exception/ProcessFailedException.phpxÈ�u[x¨Ìzy¶=vendor/symfony/process/Exception/ProcessTimedOutException.phpÈ�u[﫶5vendor/symfony/process/Exception/RuntimeException.php˜È�u[˜¢Ø:¶+vendor/symfony/process/ExecutableFinder.phpšÈ�u[šT’³É¶vendor/symfony/process/LICENSE)È�u[)NUN½¶.vendor/symfony/process/PhpExecutableFinder.phpÈÈ�u[Èš(À®¶%vendor/symfony/process/PhpProcess.phpúÈ�u[ú¯“Õ�¶.vendor/symfony/process/Pipes/AbstractPipes.php»È�u[» Vw¶/vendor/symfony/process/Pipes/PipesInterface.phpDÈ�u[DvØ*vendor/symfony/process/Pipes/UnixPipes.php>È�u[>ª•ir¶-vendor/symfony/process/Pipes/WindowsPipes.php‰ È�u[‰ À"¢¶"vendor/symfony/process/Process.php£RÈ�u[£RÁÜÕ(¶)vendor/symfony/process/ProcessBuilder.phpß
È�u[ß
^ƒ8¶'vendor/symfony/process/ProcessUtils.phpKÈ�u[K2ÁÞg¶vendor/seld/jsonlint/LICENSE"È�u["aƒsy¶@vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*È�u[*•pñ¶5vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2È�u[/2­ß˜ö¶0vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.phpÈ�u[%ÿ3N¶;vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.phpÈ�u[‰²ñ¶4vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>È�u[>ÿqŸŸ¶(vendor/justinrainbow/json-schema/LICENSE È�u[ ºç©¶.vendor/justinrainbow/json-schema/demo/demo.phpñÈ�u[ñfC¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ È�u[¡ †wÌl¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php) È�u[) #©¶Jvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ È�u[§ ›VضSvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼È�u[¼ÿ Qœ¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]È�u[]VŽU<¶Gvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã È�u[ã á0;¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…È�u[…“TœÚ¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
È�u[š
z&¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃÈ�u[éżx¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 È�u[0 ×j´˜¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.phpÈ�u[¥wš‡¶Xvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpaÈ�u[a qöYvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phppÈ�u[prë¶\vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰È�u[‰“µ+j¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&È�u[&4˜©T¶Svendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.php,"È�u[,"ulÙ·¶Fvendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpèÈ�u[è{N–¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpIÈ�u[I%|°¶Vvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•È�u[•‹àG¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phplÈ�u[lA!L׶Tvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phplÈ�u[lè2÷þ¶]vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpuÈ�u[u=hç¶Wvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpwÈ�u[wN-ò[¶Svendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞÈ�u[Þ\¸
¶Wvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpoÈ�u[opíÛù¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…È�u[…%…—¶^vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€È�u[€u-#1¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpjÈ�u[jå>�¶Qvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpfÈ�u[f¬¤„þ¶Kvendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþÈ�u[þM�„õ¶;vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php È�u[ f4÷³¶Avendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ È�u[œ åfO¶Jvendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.phpÈ�u[oŠ+}¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpáÈ�u[á[þA�¶Gvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥È�u[¥Ô§Lb¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%È�u[%5" ¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,È�u[,1•5þ¶Xvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®È�u[®ÿ‹Áå¶Cvendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php È�u[ £Ÿ)à¶Dvendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php&È�u[&¼î‚¢¶Hvendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒÈ�u[ƒJ€¶Ivendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…È�u[…íæe¶=vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpxÈ�u[xeÃþ¶%vendor/composer/spdx-licenses/LICENSEÈ�u[Bhí¶2vendor/composer/spdx-licenses/src/SpdxLicenses.phpHÈ�u[H͉T¶vendor/composer/semver/LICENSEÈ�u[Bhí¶)vendor/composer/semver/src/Comparator.phpÈ�u[wlƒï¶<vendor/composer/semver/src/Constraint/AbstractConstraint.php×È�u[×õî>Ž¶4vendor/composer/semver/src/Constraint/Constraint.phpª È�u[ª ÇO7²¶=vendor/composer/semver/src/Constraint/ConstraintInterface.phpßÈ�u[ß0C,‡¶9vendor/composer/semver/src/Constraint/EmptyConstraint.phpéÈ�u[é!-Ø™¶9vendor/composer/semver/src/Constraint/MultiConstraint.php1È�u[1í xU¶%vendor/composer/semver/src/Semver.phpvÈ�u[v‹×È›¶,vendor/composer/semver/src/VersionParser.php¿*È�u[¿*)mƶ!vendor/composer/ca-bundle/LICENSEÈ�u[*!^`¶*vendor/composer/ca-bundle/src/CaBundle.phpÈ�u[Ê ~Ķ&vendor/composer/xdebug-handler/LICENSE)È�u[)#Ô;^¶0vendor/composer/xdebug-handler/src/PhpConfig.php´È�u[´*D’¶.vendor/composer/xdebug-handler/src/Process.phptÈ�u[tÛŒú&¶-vendor/composer/xdebug-handler/src/Status.phpì È�u[ì je¿û¶4vendor/composer/xdebug-handler/src/XdebugHandler.phpšÈ�u[šÞéE?¶vendor/psr/log/LICENSE=È�u[=p±ŽO¶)vendor/psr/log/Psr/Log/AbstractLogger.php;È�u[;ñ>3[¶3vendor/psr/log/Psr/Log/InvalidArgumentException.php`È�u[` ˆX1¶#vendor/psr/log/Psr/Log/LogLevel.phpûÈ�u[ûjðñ8¶/vendor/psr/log/Psr/Log/LoggerAwareInterface.php|È�u[|$£ˆ¶+vendor/psr/log/Psr/Log/LoggerAwareTrait.php§È�u[§T½úB¶*vendor/psr/log/Psr/Log/LoggerInterface.phpÆÈ�u[Æ»sg¶&vendor/psr/log/Psr/Log/LoggerTrait.phpiÈ�u[i35§Þ¶%vendor/psr/log/Psr/Log/NullLogger.phpžÈ�u[žÇö3vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü È�u[ü iq0ضvendor/autoload.php‚È�u[‚Z”Ÿ¶'vendor/composer/autoload_namespaces.phpdÈ�u[dZ¡¦H¶!vendor/composer/autoload_psr4.php÷È�u[÷Å*š¶%vendor/composer/autoload_classmap.phpdÈ�u[dZ¡¦H¶"vendor/composer/autoload_files.phpÈ�u[¥ ®¶!vendor/composer/autoload_real.phpIÈ�u[If]ÿ¶#vendor/composer/autoload_static.php§
È�u[§
ë Î¶vendor/composer/ClassLoader.phpƒÈ�u[ƒ«Ñëæ¶(vendor/composer/ca-bundle/res/cacert.pem»CÈ�u[»Cf.À¬¶ bin/composeróÈ�u[ó]UÌ€¶LICENSE.È�u[. Õ¶<?php
namespace Composer\Autoload;
use Composer\Config;
use Composer\EventDispatcher\EventDispatcher;
use Composer\Installer\InstallationManager;
use Composer\IO\IOInterface;
use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Util\Filesystem;
use Composer\Script\ScriptEvents;
class AutoloadGenerator
{
private $eventDispatcher;
private $io;
private $devMode = false;
private $classMapAuthoritative = false;
private $apcu = false;
private $runScripts = false;
public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
{
$this->eventDispatcher = $eventDispatcher;
$this->io = $io;
}
public function setDevMode($devMode = true)
{
$this->devMode = (bool) $devMode;
}
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = (bool) $classMapAuthoritative;
}
public function setApcu($apcu)
{
$this->apcu = (bool) $apcu;
}
public function setRunScripts($runScripts = true)
{
$this->runScripts = (bool) $runScripts;
}
public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
{
if ($this->classMapAuthoritative) {
$scanPsr0Packages = true;
}
if ($this->runScripts) {
$this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
'optimize' => (bool) $scanPsr0Packages,
));
}
$filesystem = new Filesystem();
$filesystem->ensureDirectoryExists($config->get('vendor-dir'));
$basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
$vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
$useGlobalIncludePath = (bool) $config->get('use-include-path');
$prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
$targetDir = $vendorPath.'/'.$targetDir;
$filesystem->ensureDirectoryExists($targetDir);
$vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
$vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
$vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
$appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
$appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
$namespacesFile = <<<EOF
<?php
// autoload_namespaces.php @generated by Composer
\$vendorDir = $vendorPathCode52;
\$baseDir = $appBaseDirCode;
return array(
EOF;
$psr4File = <<<EOF
<?php
// autoload_psr4.php @generated by Composer
\$vendorDir = $vendorPathCode52;
\$baseDir = $appBaseDirCode;
return array(
EOF;
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
$autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
foreach ($autoloads['psr-0'] as $namespace => $paths) {
$exportedPaths = array();
foreach ($paths as $path) {
$exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
}
$exportedPrefix = var_export($namespace, true);
$namespacesFile .= " $exportedPrefix => ";
$namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
}
$namespacesFile .= ");\n";
foreach ($autoloads['psr-4'] as $namespace => $paths) {
$exportedPaths = array();
foreach ($paths as $path) {
$exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
}
$exportedPrefix = var_export($namespace, true);
$psr4File .= " $exportedPrefix => ";
$psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
}
$psr4File .= ");\n";
$classmapFile = <<<EOF
<?php
// autoload_classmap.php @generated by Composer
\$vendorDir = $vendorPathCode52;
\$baseDir = $appBaseDirCode;
return array(
EOF;
$targetDirLoader = null;
$mainAutoload = $mainPackage->getAutoload();
if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
$levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
$prefixes = implode(', ', array_map(function ($prefix) {
return var_export($prefix, true);
}, array_keys($mainAutoload['psr-0'])));
$baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
$targetDirLoader = <<<EOF
public static function autoload(\$class)
{
\$dir = $baseDirFromTargetDirCode . '/';
\$prefixes = array($prefixes);
foreach (\$prefixes as \$prefix) {
if (0 !== strpos(\$class, \$prefix)) {
continue;
}
\$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
if (!\$path = stream_resolve_include_path(\$path)) {
return false;
}
require \$path;
return true;
}
}
EOF;
}
$blacklist = null;
if (!empty($autoloads['exclude-from-classmap'])) {
$blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
}
$classMap = array();
if ($scanPsr0Packages) {
$namespacesToScan = array();
foreach (array('psr-0', 'psr-4') as $psrType) {
foreach ($autoloads[$psrType] as $namespace => $paths) {
$namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
}
}
krsort($namespacesToScan);
foreach ($namespacesToScan as $namespace => $groups) {
foreach ($groups as $group) {
foreach ($group['paths'] as $dir) {
$dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
if (!is_dir($dir)) {
continue;
}
$namespaceFilter = $namespace === '' ? null : $namespace;
$classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
}
}
}
}
foreach ($autoloads['classmap'] as $dir) {
$classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
}
ksort($classMap);
foreach ($classMap as $class => $code) {
$classmapFile .= ' '.var_export($class, true).' => '.$code;
}
$classmapFile .= ");\n";
if (!$suffix) {
if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
$content = file_get_contents($vendorPath.'/autoload.php');
if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
$suffix = $match[1];
}
}
if (!$suffix) {
$suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
}
}
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
$includePathFilePath = $targetDir.'/include_paths.php';
if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
file_put_contents($includePathFilePath, $includePathFileContents);
} elseif (file_exists($includePathFilePath)) {
unlink($includePathFilePath);
}
$includeFilesFilePath = $targetDir.'/autoload_files.php';
if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
file_put_contents($includeFilesFilePath, $includeFilesFileContents);
} elseif (file_exists($includeFilesFilePath)) {
unlink($includeFilesFilePath);
}
file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
$this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
$this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
if ($this->runScripts) {
$this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
'optimize' => (bool) $scanPsr0Packages,
));
}
}
private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
{
foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
$pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
if (!isset($classMap[$class])) {
$classMap[$class] = $pathCode;
} elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
$this->io->writeError(
'<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
);
}
}
return $classMap;
}
private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
{
return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
}
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
{
$packageMap = array(array($mainPackage, ''));
foreach ($packages as $package) {
if ($package instanceof AliasPackage) {
continue;
}
$this->validatePackage($package);
$packageMap[] = array(
$package,
$installationManager->getInstallPath($package),
);
}
return $packageMap;
}
protected function validatePackage(PackageInterface $package)
{
$autoload = $package->getAutoload();
if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
$name = $package->getName();
$package->getTargetDir();
throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
}
if (!empty($autoload['psr-4'])) {
foreach ($autoload['psr-4'] as $namespace => $dirs) {
if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
}
}
}
}
public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
{
$mainPackageMap = array_shift($packageMap);
if ($filterOutRequireDevPackages) {
$packageMap = $this->filterPackageMap($packageMap, $mainPackage);
}
$sortedPackageMap = $this->sortPackageMap($packageMap);
$sortedPackageMap[] = $mainPackageMap;
array_unshift($packageMap, $mainPackageMap);
$psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
$psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
$classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
$files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
$exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
krsort($psr0);
krsort($psr4);
return array(
'psr-0' => $psr0,
'psr-4' => $psr4,
'classmap' => $classmap,
'files' => $files,
'exclude-from-classmap' => $exclude,
);
}
public function createLoader(array $autoloads)
{
$loader = new ClassLoader();
if (isset($autoloads['psr-0'])) {
foreach ($autoloads['psr-0'] as $namespace => $path) {
$loader->add($namespace, $path);
}
}
if (isset($autoloads['psr-4'])) {
foreach ($autoloads['psr-4'] as $namespace => $path) {
$loader->addPsr4($namespace, $path);
}
}
if (isset($autoloads['classmap'])) {
$blacklist = null;
if (!empty($autoloads['exclude-from-classmap'])) {
$blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
}
foreach ($autoloads['classmap'] as $dir) {
try {
$loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
} catch (\RuntimeException $e) {
$this->io->writeError('<warning>'.$e->getMessage().'</warning>');
}
}
}
return $loader;
}
protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
{
$includePaths = array();
foreach ($packageMap as $item) {
list($package, $installPath) = $item;
if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
$installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
}
foreach ($package->getIncludePaths() as $includePath) {
$includePath = trim($includePath, '/');
$includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
}
}
if (!$includePaths) {
return;
}
$includePathsCode = '';
foreach ($includePaths as $path) {
$includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
}
return <<<EOF
<?php
// include_paths.php @generated by Composer
\$vendorDir = $vendorPathCode;
\$baseDir = $appBaseDirCode;
return array(
$includePathsCode);
EOF;
}
protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
{
$filesCode = '';
foreach ($files as $fileIdentifier => $functionFile) {
$filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
. $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
}
if (!$filesCode) {
return false;
}
return <<<EOF
<?php
// autoload_files.php @generated by Composer
\$vendorDir = $vendorPathCode;
\$baseDir = $appBaseDirCode;
return array(
$filesCode);
EOF;
}
protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
{
if (!$filesystem->isAbsolutePath($path)) {
$path = $basePath . '/' . $path;
}
$path = $filesystem->normalizePath($path);
$baseDir = '';
if (strpos($path.'/', $vendorPath.'/') === 0) {
$path = substr($path, strlen($vendorPath));
$baseDir = '$vendorDir';
if ($path !== false) {
$baseDir .= " . ";
}
} else {
$path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
if (!$filesystem->isAbsolutePath($path)) {
$baseDir = '$baseDir . ';
$path = '/' . $path;
}
}
if (preg_match('/\.phar.+$/', $path)) {
$baseDir = "'phar://' . " . $baseDir;
}
return $baseDir . (($path !== false) ? var_export($path, true) : "");
}
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
{
$lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
if ("'" === $lastChar || '"' === $lastChar) {
$vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
} else {
$vendorPathToTargetDirCode .= " . '/autoload_real.php'";
}
return <<<AUTOLOAD
<?php
// autoload.php @generated by Composer
require_once $vendorPathToTargetDirCode;
return ComposerAutoloaderInit$suffix::getLoader();
AUTOLOAD;
}
protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
{
$file = <<<HEADER
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit$suffix
{
private static \$loader;
public static function loadClassLoader(\$class)
{
if ('Composer\\Autoload\\ClassLoader' === \$class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::\$loader) {
return self::\$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
HEADER;
if ($useIncludePath) {
$file .= <<<'INCLUDE_PATH'
$includePaths = require __DIR__ . '/include_paths.php';
$includePaths[] = get_include_path();
set_include_path(implode(PATH_SEPARATOR, $includePaths));
INCLUDE_PATH;
}
$file .= <<<STATIC_INIT
\$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if (\$useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
} else {
STATIC_INIT;
if (!$this->classMapAuthoritative) {
$file .= <<<'PSR04'
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
PSR04;
}
if ($useClassMap) {
$file .= <<<'CLASSMAP'
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
CLASSMAP;
}
$file .= " }\n\n";
if ($this->classMapAuthoritative) {
$file .= <<<'CLASSMAPAUTHORITATIVE'
$loader->setClassMapAuthoritative(true);
CLASSMAPAUTHORITATIVE;
}
if ($this->apcu) {
$apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
$file .= <<<APCU
\$loader->setApcuPrefix('$apcuPrefix');
APCU;
}
if ($useGlobalIncludePath) {
$file .= <<<'INCLUDEPATH'
$loader->setUseIncludePath(true);
INCLUDEPATH;
}
if ($targetDirLoader) {
$file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
REGISTER_TARGET_DIR_AUTOLOAD;
}
$file .= <<<REGISTER_LOADER
\$loader->register($prependAutoloader);
REGISTER_LOADER;
if ($useIncludeFiles) {
$file .= <<<INCLUDE_FILES
if (\$useStaticLoader) {
\$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
} else {
\$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach (\$includeFiles as \$fileIdentifier => \$file) {
composerRequire$suffix(\$fileIdentifier, \$file);
}
INCLUDE_FILES;
}
$file .= <<<METHOD_FOOTER
return \$loader;
}
METHOD_FOOTER;
$file .= $targetDirLoader;
if ($useIncludeFiles) {
return $file . <<<FOOTER
}
function composerRequire$suffix(\$fileIdentifier, \$file)
{
if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
require \$file;
\$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
}
}
FOOTER;
}
return $file . <<<FOOTER
}
FOOTER;
}
protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
{
$staticPhpVersion = 50600;
$file = <<<HEADER
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInit$suffix
{
HEADER;
$loader = new ClassLoader();
$map = require $targetDir . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require $targetDir . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require $targetDir . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$filesystem = new Filesystem();
$vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
$appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
$absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
$absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
$initializer = '';
$prefix = "\0Composer\Autoload\ClassLoader\0";
$prefixLen = strlen($prefix);
if (file_exists($targetDir . '/autoload_files.php')) {
$maps = array('files' => require $targetDir . '/autoload_files.php');
} else {
$maps = array();
}
foreach ((array) $loader as $prop => $value) {
if ($value && 0 === strpos($prop, $prefix)) {
$maps[substr($prop, $prefixLen)] = $value;
}
}
foreach ($maps as $prop => $value) {
if (count($value) > 32767) {
$staticPhpVersion = 70000;
}
$value = var_export($value, true);
$value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
$value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
$value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
$file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
if ('files' !== $prop) {
$initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
}
}
return $file . <<<INITIALIZER
public static function getInitializer(ClassLoader \$loader)
{
return \Closure::bind(function () use (\$loader) {
$initializer
}, null, ClassLoader::class);
}
}
INITIALIZER;
}
protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
{
$autoloads = array();
foreach ($packageMap as $item) {
list($package, $installPath) = $item;
$autoload = $package->getAutoload();
if ($this->devMode && $package === $mainPackage) {
$autoload = array_merge_recursive($autoload, $package->getDevAutoload());
}
if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
continue;
}
if (null !== $package->getTargetDir() && $package !== $mainPackage) {
$installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
}
foreach ($autoload[$type] as $namespace => $paths) {
foreach ((array) $paths as $path) {
if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
if ($package === $mainPackage) {
$targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
$path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
} else {
$path = $package->getTargetDir() . '/' . $path;
}
}
if ($type === 'exclude-from-classmap') {
$path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
$path = str_replace('\\*\\*', '.+?', $path);
$path = str_replace('\\*', '[^/]+?', $path);
$updir = null;
$path = preg_replace_callback(
'{^((?:(?:\\\\\\.){1,2}+/)+)}',
function ($matches) use (&$updir) {
if (isset($matches[1])) {
$updir = str_replace('\\.', '.', $matches[1]);
}
return '';
},
$path
);
if (empty($installPath)) {
$installPath = strtr(getcwd(), '\\', '/');
}
$resolvedPath = realpath($installPath . '/' . $updir);
$autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
continue;
}
$relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
if ($type === 'files') {
$autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
continue;
} elseif ($type === 'classmap') {
$autoloads[] = $relativePath;
continue;
}
$autoloads[$namespace][] = $relativePath;
}
}
}
return $autoloads;
}
protected function getFileIdentifier(PackageInterface $package, $path)
{
return md5($package->getName() . ':' . $path);
}
protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
{
$packages = array();
$include = array();
foreach ($packageMap as $item) {
$package = $item[0];
$name = $package->getName();
$packages[$name] = $package;
}
$add = function (PackageInterface $package) use (&$add, $packages, &$include) {
foreach ($package->getRequires() as $link) {
$target = $link->getTarget();
if (!isset($include[$target])) {
$include[$target] = true;
if (isset($packages[$target])) {
$add($packages[$target]);
}
}
}
};
$add($mainPackage);
return array_filter(
$packageMap,
function ($item) use ($include) {
$package = $item[0];
$name = $package->getName();
return isset($include[$name]);
}
);
}
protected function sortPackageMap(array $packageMap)
{
$packages = array();
$paths = array();
$usageList = array();
foreach ($packageMap as $item) {
list($package, $path) = $item;
$name = $package->getName();
$packages[$name] = $package;
$paths[$name] = $path;
foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
$target = $link->getTarget();
$usageList[$target][] = $name;
}
}
$computing = array();
$computed = array();
$computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
if (isset($computed[$name])) {
return $computed[$name];
}
if (isset($computing[$name])) {
return 0;
}
$computing[$name] = true;
$weight = 0;
if (isset($usageList[$name])) {
foreach ($usageList[$name] as $user) {
$weight -= 1 - $computeImportance($user);
}
}
unset($computing[$name]);
$computed[$name] = $weight;
return $weight;
};
$weightList = array();
foreach ($packages as $name => $package) {
$weight = $computeImportance($name);
$weightList[$name] = $weight;
}
$stable_sort = function (&$array) {
static $transform, $restore;
$i = 0;
if (!$transform) {
$transform = function (&$v, $k) use (&$i) {
$v = array($v, ++$i, $k, $v);
};
$restore = function (&$v, $k) {
$v = $v[3];
};
}
array_walk($array, $transform);
asort($array);
array_walk($array, $restore);
};
$stable_sort($weightList);
$sortedPackageMap = array();
foreach (array_keys($weightList) as $name) {
$sortedPackageMap[] = array($packages[$name], $paths[$name]);
}
return $sortedPackageMap;
}
protected function safeCopy($source, $target)
{
$source = fopen($source, 'r');
$target = fopen($target, 'w+');
stream_copy_to_stream($source, $target);
fclose($source);
fclose($target);
}
}
<?php
namespace Composer\Autoload;
use Symfony\Component\Finder\Finder;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
class ClassMapGenerator
{
public static function dump($dirs, $file)
{
$maps = array();
foreach ($dirs as $dir) {
$maps = array_merge($maps, static::createMap($dir));
}
file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
}
public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
{
if (is_string($path)) {
if (is_file($path)) {
$path = array(new \SplFileInfo($path));
} elseif (is_dir($path)) {
$path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
} else {
throw new \RuntimeException(
'Could not scan for classes inside "'.$path.
'" which does not appear to be a file nor a folder'
);
}
}
$map = array();
$filesystem = new Filesystem();
$cwd = realpath(getcwd());
foreach ($path as $file) {
$filePath = $file->getPathname();
if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
continue;
}
if (!$filesystem->isAbsolutePath($filePath)) {
$filePath = $cwd . '/' . $filePath;
$filePath = $filesystem->normalizePath($filePath);
} else {
$filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
}
if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
continue;
}
if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
continue;
}
$classes = self::findClasses($filePath);
foreach ($classes as $class) {
if (null !== $namespace && 0 !== strpos($class, $namespace)) {
continue;
}
if (!isset($map[$class])) {
$map[$class] = $filePath;
} elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
$io->writeError(
'<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
);
}
}
}
return $map;
}
private static function findClasses($path)
{
$extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
$extraTypes .= '|enum';
}
$contents = @php_strip_whitespace($path);
if (!$contents) {
if (!file_exists($path)) {
$message = 'File at "%s" does not exist, check your classmap definitions';
} elseif (!is_readable($path)) {
$message = 'File at "%s" is not readable, check its permissions';
} elseif ('' === trim(file_get_contents($path))) {
return array();
} else {
$message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
}
$error = error_get_last();
if (isset($error['message'])) {
$message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
}
throw new \RuntimeException(sprintf($message, $path));
}
if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
return array();
}
$contents = preg_replace('{<<<\s*(\'?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\2(?=\r\n|\n|\r|;)}s', 'null', $contents);
$contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
if (substr($contents, 0, 2) !== '<?') {
$contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
if ($replacements === 0) {
return array();
}
}
$contents = preg_replace('{\?>.+<\?}s', '?><?', $contents);
$pos = strrpos($contents, '?>');
if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
$contents = substr($contents, 0, $pos);
}
if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
$contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
}
preg_match_all('{
(?:
\b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
| \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
)
}ix', $contents, $matches);
$classes = array();
$namespace = '';
for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
if (!empty($matches['ns'][$i])) {
$namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
} else {
$name = $matches['name'][$i];
if ($name === 'extends' || $name === 'implements') {
continue;
}
if ($name[0] === ':') {
$name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
} elseif ($matches['type'][$i] === 'enum') {
$name = rtrim($name, ':');
}
$classes[] = ltrim($namespace . $name, '\\');
}
}
return $classes;
}
}
<?php
namespace Composer;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
use Composer\Util\Silencer;
use Symfony\Component\Finder\Finder;
class Cache
{
private static $cacheCollected = false;
private $io;
private $root;
private $enabled = true;
private $whitelist;
private $filesystem;
public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
{
$this->io = $io;
$this->root = rtrim($cacheDir, '/\\') . '/';
$this->whitelist = $whitelist;
$this->filesystem = $filesystem ?: new Filesystem();
if (preg_match('{(^|[\\\\/])(\$null|NUL|/dev/null)([\\\\/]|$)}', $cacheDir)) {
$this->enabled = false;
return;
}
if (
(!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
|| !is_writable($this->root)
) {
$this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
$this->enabled = false;
}
}
public function isEnabled()
{
return $this->enabled;
}
public function getRoot()
{
return $this->root;
}
public function read($file)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if (file_exists($this->root . $file)) {
$this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
return file_get_contents($this->root . $file);
}
}
return false;
}
public function write($file, $contents)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
$this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
try {
return file_put_contents($this->root . $file, $contents);
} catch (\ErrorException $e) {
$this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
unlink($this->root . $file);
$message = sprintf(
'<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
$this->root . $file,
$m[1],
$m[2],
@disk_free_space($this->root . dirname($file))
);
$this->io->writeError($message);
return false;
}
throw $e;
}
}
return false;
}
public function copyFrom($file, $source)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
$this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
if (!file_exists($source)) {
$this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
} elseif ($this->io->isDebug()) {
$this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
}
return copy($source, $this->root . $file);
}
return false;
}
public function copyTo($file, $target)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if (file_exists($this->root . $file)) {
try {
touch($this->root . $file, filemtime($this->root . $file), time());
} catch (\ErrorException $e) {
Silencer::call('touch', $this->root . $file);
}
$this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
return copy($this->root . $file, $target);
}
}
return false;
}
public function gcIsNecessary()
{
return (!self::$cacheCollected && !mt_rand(0, 50));
}
public function remove($file)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if (file_exists($this->root . $file)) {
return $this->filesystem->unlink($this->root . $file);
}
}
return false;
}
public function clear()
{
if ($this->enabled) {
return $this->filesystem->removeDirectory($this->root);
}
return false;
}
public function gc($ttl, $maxSize)
{
if ($this->enabled) {
$expire = new \DateTime();
$expire->modify('-'.$ttl.' seconds');
$finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
foreach ($finder as $file) {
$this->filesystem->unlink($file->getPathname());
}
$totalSize = $this->filesystem->size($this->root);
if ($totalSize > $maxSize) {
$iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
while ($totalSize > $maxSize && $iterator->valid()) {
$filepath = $iterator->current()->getPathname();
$totalSize -= $this->filesystem->size($filepath);
$this->filesystem->unlink($filepath);
$iterator->next();
}
}
self::$cacheCollected = true;
return true;
}
return false;
}
public function sha1($file)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if (file_exists($this->root . $file)) {
return sha1_file($this->root . $file);
}
}
return false;
}
public function sha256($file)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if (file_exists($this->root . $file)) {
return hash_file('sha256', $this->root . $file);
}
}
return false;
}
protected function getFinder()
{
return Finder::create()->in($this->root)->files();
}
}
<?php
namespace Composer\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class AboutCommand extends BaseCommand
{
protected function configure()
{
$this
->setName('about')
->setDescription('Shows the short information about Composer.')
->setHelp(
<<<EOT
<info>php composer.phar about</info>
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->getIO()->write(
<<<EOT
<info>Composer - Package Management for PHP</info>
<comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
See https://getcomposer.org/ for more information.</comment>
EOT
);
}
}
<?php
namespace Composer\Command;
use Composer\Factory;
use Composer\IO\IOInterface;
use Composer\Config;
use Composer\Composer;
use Composer\Repository\CompositeRepository;
use Composer\Repository\RepositoryFactory;
use Composer\Script\ScriptEvents;
use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents;
use Composer\Util\Filesystem;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ArchiveCommand extends BaseCommand
{
protected function configure()
{
$this
->setName('archive')
->setDescription('Creates an archive of this composer package.')
->setDefinition(array(
new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
.' Note that the format will be appended.'),
new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
))
->setHelp(
<<<EOT
The <info>archive</info> command creates an archive of the specified format
containing the files and directories of the Composer project or the specified
package in the specified version and writes it to the specified directory.
<info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$config = Factory::createConfig();
$composer = $this->getComposer(false);
if ($composer) {
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
$eventDispatcher = $composer->getEventDispatcher();
$eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
$eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
}
if (null === $input->getOption('format')) {
$input->setOption('format', $config->get('archive-format'));
}
if (null === $input->getOption('dir')) {
$input->setOption('dir', $config->get('archive-dir'));
}
$returnCode = $this->archive(
$this->getIO(),
$config,
$input->getArgument('package'),
$input->getArgument('version'),
$input->getOption('format'),
$input->getOption('dir'),
$input->getOption('file'),
$input->getOption('ignore-filters'),
$composer
);
if (0 === $returnCode && $composer) {
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
}
return $returnCode;
}
protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
{
if ($composer) {
$archiveManager = $composer->getArchiveManager();
} else {
$factory = new Factory;
$downloadManager = $factory->createDownloadManager($io, $config);
$archiveManager = $factory->createArchiveManager($config, $downloadManager);
}
if ($packageName) {
$package = $this->selectPackage($io, $packageName, $version);
if (!$package) {
return 1;
}
} else {
$package = $this->getComposer()->getPackage();
}
$io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
$packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
$fs = new Filesystem;
$shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
$io->writeError('Created: ', false);
$io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
return 0;
}
protected function selectPackage(IOInterface $io, $packageName, $version = null)
{
$io->writeError('<info>Searching for the specified package.</info>');
if ($composer = $this->getComposer(false)) {
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
} else {
$defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
$io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
$repo = new CompositeRepository($defaultRepos);
}
$packages = $repo->findPackages($packageName, $version);
if (count($packages) > 1) {
$package = reset($packages);
$io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
$io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
return $p->getPrettyString();
}, $packages)).'.');
$io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
} elseif ($packages) {
$package = reset($packages);
$io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
} else {
$io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
return false;
}
return $package;
}
}
<?php
namespace Composer\Command;
use Composer\Composer;
use Composer\Config;
use Composer\Console\Application;
use Composer\Factory;
use Composer\IO\IOInterface;
use Composer\IO\NullIO;
use Composer\Plugin\PreCommandRunEvent;
use Composer\Plugin\PluginEvents;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
abstract class BaseCommand extends Command
{
private $composer;
private $io;
public function getComposer($required = true, $disablePlugins = null)
{
if (null === $this->composer) {
$application = $this->getApplication();
if ($application instanceof Application) {
$this->composer = $application->getComposer($required, $disablePlugins);
} elseif ($required) {
throw new \RuntimeException(
'Could not create a Composer\Composer instance, you must inject '.
'one if this command is not used with a Composer\Console\Application instance'
);
}
}
return $this->composer;
}
public function setComposer(Composer $composer)
{
$this->composer = $composer;
}
public function resetComposer()
{
$this->composer = null;
$this->getApplication()->resetComposer();
}
public function isProxyCommand()
{
return false;
}
public function getIO()
{
if (null === $this->io) {
$application = $this->getApplication();
if ($application instanceof Application) {
$this->io = $application->getIO();
} else {
$this->io = new NullIO();
}
}
return $this->io;
}
public function setIO(IOInterface $io)
{
$this->io = $io;
}
protected function initialize(InputInterface $input, OutputInterface $output)
{
$disablePlugins = $input->hasParameterOption('--no-plugins');
$composer = $this->getComposer(false, $disablePlugins);
if (null === $composer) {
$composer = Factory::createGlobal($this->getIO(), $disablePlugins);
}
if ($composer) {
$preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
$composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
}
if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
$input->setOption('no-progress', true);
}
parent::initialize($input, $output);
}
protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
{
$preferSource = false;
$preferDist = false;
switch ($config->get('preferred-install')) {
case 'source':
$preferSource = true;
break;
case 'dist':
$preferDist = true;
break;
case 'auto':
default:
break;
}
if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
$preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
$preferDist = $input->getOption('prefer-dist');
}
return array($preferSource, $preferDist);
}
}
<?php
namespace Composer\Command;
use Composer\DependencyResolver\Pool;
use Composer\Package\Link;
use Composer\Package\PackageInterface;
use Composer\Repository\ArrayRepository;
use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryFactory;
use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Composer\Package\Version\VersionParser;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class BaseDependencyCommand extends BaseCommand
{
const ARGUMENT_PACKAGE = 'package';
const ARGUMENT_CONSTRAINT = 'constraint';
const OPTION_RECURSIVE = 'recursive';
const OPTION_TREE = 'tree';
protected $colors;
protected function configure()
{
$this->setDefinition(array(
new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
));
}
protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
{
$composer = $this->getComposer();
$commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
$platformOverrides = $composer->getConfig()->get('platform') ?: array();
$repository = new CompositeRepository(array(
new ArrayRepository(array($composer->getPackage())),
$composer->getRepositoryManager()->getLocalRepository(),
new PlatformRepository(array(), $platformOverrides),
));
$pool = new Pool();
$pool->addRepository($repository);
list($needle, $textConstraint) = array_pad(
explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
2,
$input->getArgument(self::ARGUMENT_CONSTRAINT)
);
$packages = $pool->whatProvides(strtolower($needle));
if (empty($packages)) {
throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
}
if (!$repository->findPackage($needle, $textConstraint)) {
$defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
$repository->addRepository(new ArrayRepository(array(clone $match)));
}
}
$needles = array($needle);
if ($inverted) {
foreach ($packages as $package) {
$needles = array_merge($needles, array_map(function (Link $link) {
return $link->getTarget();
}, $package->getReplaces()));
}
}
if ('*' !== $textConstraint) {
$versionParser = new VersionParser();
$constraint = $versionParser->parseConstraints($textConstraint);
} else {
$constraint = null;
}
$renderTree = $input->getOption(self::OPTION_TREE);
$recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
$results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
if (empty($results)) {
$extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
$this->getIO()->writeError(sprintf(
'<info>There is no installed package depending on "%s"%s</info>',
$needle,
$extra
));
} elseif ($renderTree) {
$this->initStyles($output);
$root = $packages[0];
$this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
$this->printTree($results);
} else {
$this->printTable($output, $results);
}
return 0;
}
protected function printTable(OutputInterface $output, $results)
{
$table = array();
$doubles = array();
do {
$queue = array();
$rows = array();
foreach ($results as $result) {
list($package, $link, $children) = $result;
$unique = (string) $link;
if (isset($doubles[$unique])) {
continue;
}
$doubles[$unique] = true;
$version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
$rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
if ($children) {
$queue = array_merge($queue, $children);
}
}
$results = $queue;
$table = array_merge($rows, $table);
} while (!empty($results));
$renderer = new Table($output);
$renderer->setStyle('compact');
$rendererStyle = $renderer->getStyle();
$rendererStyle->setVerticalBorderChar('');
$rendererStyle->setCellRowContentFormat('%s ');
$renderer->setRows($table)->render();
}
protected function initStyles(OutputInterface $output)
{
$this->colors = array(
'green',
'yellow',
'cyan',
'magenta',
'blue',
);
foreach ($this->colors as $color) {
$style = new OutputFormatterStyle($color);
$output->getFormatter()->setStyle($color, $style);
}
}
protected function printTree($results, $prefix = '', $level = 1)
{
$count = count($results);
$idx = 0;
foreach ($results as $result) {
list($package, $link, $children) = $result;
$color = $this->colors[$level % count($this->colors)];
$prevColor = $this->colors[($level - 1) % count($this->colors)];
$isLast = (++$idx == $count);
$versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
$packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
$linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
$circularWarn = $children === false ? '(circular dependency aborted here)' : '';
$this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
if ($children) {
$this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
}
}
}
private function writeTreeLine($line)
{
$io = $this->getIO();
if (!$io->isDecorated()) {
$line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
}
$io->write($line);
}
}
<?php
namespace Composer\Command;
use Composer\Package\Link;
use Composer\Package\PackageInterface;
use Composer\Semver\Constraint\Constraint;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Composer\Repository\PlatformRepository;
class CheckPlatformReqsCommand extends BaseCommand
{
protected function configure()
{
$this->setName('check-platform-reqs')
->setDescription('Check that platform requirements are satisfied.')
->setHelp(
<<<EOT
Checks that your PHP and extensions versions match the platform requirements of the installed packages.
<info>php composer.phar check-platform-reqs</info>
EOT
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer();
$repos = $composer->getRepositoryManager()->getLocalRepository();
$allPackages = array_merge(array($composer->getPackage()), $repos->getPackages());
$requires = $composer->getPackage()->getDevRequires();
foreach ($requires as $require => $link) {
$requires[$require] = array($link);
}
foreach ($allPackages as $package) {
foreach ($package->getRequires() as $require => $link) {
$requires[$require][] = $link;
}
}
ksort($requires);
$platformRepo = new PlatformRepository(array(), array());
$currentPlatformPackages = $platformRepo->getPackages();
$currentPlatformPackageMap = array();
foreach ($currentPlatformPackages as $currentPlatformPackage) {
$currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
}
$results = array();
$exitCode = 0;
foreach ($requires as $require => $links) {
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
if (isset($currentPlatformPackageMap[$require])) {
$pass = true;
$version = $currentPlatformPackageMap[$require]->getVersion();
foreach ($links as $link) {
if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
$results[] = array(
$currentPlatformPackageMap[$require]->getPrettyName(),
$currentPlatformPackageMap[$require]->getPrettyVersion(),
$link,
'<error>failed</error>',
);
$pass = false;
$exitCode = max($exitCode, 1);
}
}
if ($pass) {
$results[] = array(
$currentPlatformPackageMap[$require]->getPrettyName(),
$currentPlatformPackageMap[$require]->getPrettyVersion(),
null,
'<info>success</info>',
);
}
} else {
$results[] = array(
$require,
'n/a',
$links[0],
'<error>missing</error>',
);
$exitCode = max($exitCode, 2);
}
}
}
$this->printTable($output, $results);
return $exitCode;
}
protected function printTable(OutputInterface $output, $results)
{
$table = array();
$rows = array();
foreach ($results as $result) {
list($platformPackage, $version, $link, $status) = $result;
$rows[] = array(
$platformPackage,
$version,
$link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
$status,
);
}
$table = array_merge($rows, $table);
$renderer = new Table($output);
$renderer->setStyle('compact');
$rendererStyle = $renderer->getStyle();
$rendererStyle->setVerticalBorderChar('');
$rendererStyle->setCellRowContentFormat('%s ');
$renderer->setRows($table)->render();
}
}
<?php
namespace Composer\Command;
use Composer\Cache;
use Composer\Factory;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ClearCacheCommand extends BaseCommand
{
protected function configure()
{
$this
->setName('clear-cache')
->setAliases(array('clearcache'))
->setDescription('Clears composer\'s internal package cache.')
->setHelp(
<<<EOT
The <info>clear-cache</info> deletes all cached packages from composer's
cache directory.
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$config = Factory::createConfig();
$io = $this->getIO();
$cachePaths = array(
'cache-vcs-dir' => $config->get('cache-vcs-dir'),
'cache-repo-dir' => $config->get('cache-repo-dir'),
'cache-files-dir' => $config->get('cache-files-dir'),
'cache-dir' => $config->get('cache-dir'),
);
foreach ($cachePaths as $key => $cachePath) {
$cachePath = realpath($cachePath);
if (!$cachePath) {
$io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
continue;
}
$cache = new Cache($io, $cachePath);
if (!$cache->isEnabled()) {
$io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
continue;
}
$io->writeError("<info>Clearing cache ($key): $cachePath</info>");
$cache->clear();
}
$io->writeError('<info>All caches cleared.</info>');
}
}
<?php
namespace Composer\Command;
use Composer\Util\Platform;
use Composer\Util\Silencer;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Composer\Config;
use Composer\Config\JsonConfigSource;
use Composer\Factory;
use Composer\Json\JsonFile;
use Composer\Semver\VersionParser;
use Composer\Package\BasePackage;
class ConfigCommand extends BaseCommand
{
protected $config;
protected $configFile;
protected $configSource;
protected $authConfigFile;
protected $authConfigSource;
protected function configure()
{
$this
->setName('config')
->setDescription('Sets config options.')
->setDefinition(array(
new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
new InputArgument('setting-key', null, 'Setting key'),
new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
))
->setHelp(
<<<EOT
This command allows you to edit composer config settings and repositories
in either the local composer.json file or the global config.json file.
Additionally it lets you edit most properties in the local composer.json.
To set a config setting:
<comment>%command.full_name% bin-dir bin/</comment>
To read a config setting:
<comment>%command.full_name% bin-dir</comment>
Outputs: <info>bin</info>
To edit the global config.json file:
<comment>%command.full_name% --global</comment>
To add a repository:
<comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
To remove a repository (repo is a short alias for repositories):
<comment>%command.full_name% --unset repo.foo</comment>
To disable packagist:
<comment>%command.full_name% repo.packagist false</comment>
You can alter repositories in the global config.json file by passing in the
<info>--global</info> option.
To edit the file in an external editor:
<comment>%command.full_name% --editor</comment>
To choose your editor you can set the "EDITOR" env variable.
To get a list of configuration values in the file:
<comment>%command.full_name% --list</comment>
You can always pass more than one option. As an example, if you want to edit the
global config.json file.
<comment>%command.full_name% --editor --global</comment>
EOT
)
;
}
protected function initialize(InputInterface $input, OutputInterface $output)
{
parent::initialize($input, $output);
if ($input->getOption('global') && null !== $input->getOption('file')) {
throw new \RuntimeException('--file and --global can not be combined');
}
$io = $this->getIO();
$this->config = Factory::createConfig($io);
$configFile = $input->getOption('global')
? ($this->config->get('home') . '/config.json')
: ($input->getOption('file') ?: Factory::getComposerFile());
if (
($configFile === 'composer.json' || $configFile === './composer.json')
&& !file_exists($configFile)
&& realpath(getcwd()) === realpath($this->config->get('home'))
) {
file_put_contents($configFile, "{\n}\n");
}
$this->configFile = new JsonFile($configFile, null, $io);
$this->configSource = new JsonConfigSource($this->configFile);
$authConfigFile = $input->getOption('global')
? ($this->config->get('home') . '/auth.json')
: dirname(realpath($configFile)) . '/auth.json';
$this->authConfigFile = new JsonFile($authConfigFile, null, $io);
$this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
if ($input->getOption('global') && !$this->configFile->exists()) {
touch($this->configFile->getPath());
$this->configFile->write(array('config' => new \ArrayObject));
Silencer::call('chmod', $this->configFile->getPath(), 0600);
}
if ($input->getOption('global') && !$this->authConfigFile->exists()) {
touch($this->authConfigFile->getPath());
$this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
}
if (!$this->configFile->exists()) {
throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
}
}
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('editor')) {
$editor = escapeshellcmd(getenv('EDITOR'));
if (!$editor) {
if (Platform::isWindows()) {
$editor = 'notepad';
} else {
foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
if (exec('which '.$candidate)) {
$editor = $candidate;
break;
}
}
}
}
$file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
return 0;
}
if (!$input->getOption('global')) {
$this->config->merge($this->configFile->read());
$this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
}
if ($input->getOption('list')) {
$this->listConfiguration($this->config->all(), $this->config->raw(), $output);
return 0;
}
$settingKey = $input->getArgument('setting-key');
if (!$settingKey) {
return 0;
}
if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
throw new \RuntimeException('You can not combine a setting value with --unset');
}
if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
$properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
$rawData = $this->configFile->read();
$data = $this->config->all();
if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
if (!isset($matches[1]) || $matches[1] === '') {
$value = isset($data['repositories']) ? $data['repositories'] : array();
} else {
if (!isset($data['repositories'][$matches[1]])) {
throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
}
$value = $data['repositories'][$matches[1]];
}
} elseif (strpos($settingKey, '.')) {
$bits = explode('.', $settingKey);
if ($bits[0] === 'extra') {
$data = $rawData;
} else {
$data = $data['config'];
}
$match = false;
foreach ($bits as $bit) {
$key = isset($key) ? $key.'.'.$bit : $bit;
$match = false;
if (isset($data[$key])) {
$match = true;
$data = $data[$key];
unset($key);
}
}
if (!$match) {
throw new \RuntimeException($settingKey.' is not defined.');
}
$value = $data;
} elseif (isset($data['config'][$settingKey])) {
$value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
} elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
$value = $rawData[$settingKey];
} else {
throw new \RuntimeException($settingKey.' is not defined');
}
if (is_array($value)) {
$value = json_encode($value);
}
$this->getIO()->write($value);
return 0;
}
$values = $input->getArgument('setting-value');
$booleanValidator = function ($val) {
return in_array($val, array('true', 'false', '1', '0'), true);
};
$booleanNormalizer = function ($val) {
return $val !== 'false' && (bool) $val;
};
$uniqueConfigValues = array(
'process-timeout' => array('is_numeric', 'intval'),
'use-include-path' => array($booleanValidator, $booleanNormalizer),
'preferred-install' => array(
function ($val) {
return in_array($val, array('auto', 'source', 'dist'), true);
},
function ($val) {
return $val;
},
),
'store-auths' => array(
function ($val) {
return in_array($val, array('true', 'false', 'prompt'), true);
},
function ($val) {
if ('prompt' === $val) {
return 'prompt';
}
return $val !== 'false' && (bool) $val;
},
),
'notify-on-install' => array($booleanValidator, $booleanNormalizer),
'vendor-dir' => array('is_string', function ($val) {
return $val;
}),
'bin-dir' => array('is_string', function ($val) {
return $val;
}),
'archive-dir' => array('is_string', function ($val) {
return $val;
}),
'archive-format' => array('is_string', function ($val) {
return $val;
}),
'data-dir' => array('is_string', function ($val) {
return $val;
}),
'cache-dir' => array('is_string', function ($val) {
return $val;
}),
'cache-files-dir' => array('is_string', function ($val) {
return $val;
}),
'cache-repo-dir' => array('is_string', function ($val) {
return $val;
}),
'cache-vcs-dir' => array('is_string', function ($val) {
return $val;
}),
'cache-ttl' => array('is_numeric', 'intval'),
'cache-files-ttl' => array('is_numeric', 'intval'),
'cache-files-maxsize' => array(
function ($val) {
return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
},
function ($val) {
return $val;
},
),
'bin-compat' => array(
function ($val) {
return in_array($val, array('auto', 'full'));
},
function ($val) {
return $val;
},
),
'discard-changes' => array(
function ($val) {
return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
},
function ($val) {
if ('stash' === $val) {
return 'stash';
}
return $val !== 'false' && (bool) $val;
},
),
'autoloader-suffix' => array('is_string', function ($val) {
return $val === 'null' ? null : $val;
}),
'sort-packages' => array($booleanValidator, $booleanNormalizer),
'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
'disable-tls' => array($booleanValidator, $booleanNormalizer),
'secure-http' => array($booleanValidator, $booleanNormalizer),
'cafile' => array(
function ($val) {
return file_exists($val) && is_readable($val);
},
function ($val) {
return $val === 'null' ? null : $val;
},
),
'capath' => array(
function ($val) {
return is_dir($val) && is_readable($val);
},
function ($val) {
return $val === 'null' ? null : $val;
},
),
'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
);
$multiConfigValues = array(
'github-protocols' => array(
function ($vals) {
if (!is_array($vals)) {
return 'array expected';
}
foreach ($vals as $val) {
if (!in_array($val, array('git', 'https', 'ssh'))) {
return 'valid protocols include: git, https, ssh';
}
}
return true;
},
function ($vals) {
return $vals;
},
),
'github-domains' => array(
function ($vals) {
if (!is_array($vals)) {
return 'array expected';
}
return true;
},
function ($vals) {
return $vals;
},
),
'gitlab-domains' => array(
function ($vals) {
if (!is_array($vals)) {
return 'array expected';
}
return true;
},
function ($vals) {
return $vals;
},
),
);
if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
return $this->configSource->removeConfigSetting($settingKey);
}
if (isset($uniqueConfigValues[$settingKey])) {
return $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
}
if (isset($multiConfigValues[$settingKey])) {
return $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
}
$uniqueProps = array(
'name' => array('is_string', function ($val) {
return $val;
}),
'type' => array('is_string', function ($val) {
return $val;
}),
'description' => array('is_string', function ($val) {
return $val;
}),
'homepage' => array('is_string', function ($val) {
return $val;
}),
'version' => array('is_string', function ($val) {
return $val;
}),
'minimum-stability' => array(
function ($val) {
return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
},
function ($val) {
return VersionParser::normalizeStability($val);
},
),
'prefer-stable' => array($booleanValidator, $booleanNormalizer),
);
$multiProps = array(
'keywords' => array(
function ($vals) {
if (!is_array($vals)) {
return 'array expected';
}
return true;
},
function ($vals) {
return $vals;
},
),
'license' => array(
function ($vals) {
if (!is_array($vals)) {
return 'array expected';
}
return true;
},
function ($vals) {
return $vals;
},
),
);
if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
}
if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
return $this->configSource->removeProperty($settingKey);
}
if (isset($uniqueProps[$settingKey])) {
return $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
}
if (isset($multiProps[$settingKey])) {
return $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
}
if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
if ($input->getOption('unset')) {
return $this->configSource->removeRepository($matches[1]);
}
if (2 === count($values)) {
return $this->configSource->addRepository($matches[1], array(
'type' => $values[0],
'url' => $values[1],
));
}
if (1 === count($values)) {
$value = strtolower($values[0]);
if (true === $booleanValidator($value)) {
if (false === $booleanNormalizer($value)) {
return $this->configSource->addRepository($matches[1], false);
}
} else {
$value = JsonFile::parseJson($values[0]);
return $this->configSource->addRepository($matches[1], $value);
}
}
throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
}
if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
if ($input->getOption('unset')) {
return $this->configSource->removeProperty($settingKey);
}
return $this->configSource->addProperty($settingKey, $values[0]);
}
if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
if ($input->getOption('unset')) {
return $this->configSource->removeConfigSetting($settingKey);
}
return $this->configSource->addConfigSetting($settingKey, $values[0]);
}
if ($settingKey === 'platform' && $input->getOption('unset')) {
return $this->configSource->removeConfigSetting($settingKey);
}
if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
if ($input->getOption('unset')) {
$this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
$this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
return;
}
if ($matches[1] === 'bitbucket-oauth') {
if (2 !== count($values)) {
throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
}
$this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
$this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
} elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
if (1 !== count($values)) {
throw new \RuntimeException('Too many arguments, expected only one token');
}
$this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
$this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
} elseif ($matches[1] === 'http-basic') {
if (2 !== count($values)) {
throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
}
$this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
$this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
}
return;
}
if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
if ($input->getOption('unset')) {
return $this->configSource->removeProperty($settingKey);
}
return $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
}
throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
}
protected function handleSingleValue($key, array $callbacks, array $values, $method)
{
list($validator, $normalizer) = $callbacks;
if (1 !== count($values)) {
throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
}
if (true !== $validation = $validator($values[0])) {
throw new \RuntimeException(sprintf(
'"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
$values[0]
));
}
return call_user_func(array($this->configSource, $method), $key, $normalizer($values[0]));
}
protected function handleMultiValue($key, array $callbacks, array $values, $method)
{
list($validator, $normalizer) = $callbacks;
if (true !== $validation = $validator($values)) {
throw new \RuntimeException(sprintf(
'%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
json_encode($values)
));
}
return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
}
protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
{
$origK = $k;
$io = $this->getIO();
foreach ($contents as $key => $value) {
if ($k === null && !in_array($key, array('config', 'repositories'))) {
continue;
}
$rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
$k .= preg_replace('{^config\.}', '', $key . '.');
$this->listConfiguration($value, $rawVal, $output, $k);
$k = $origK;
continue;
}
if (is_array($value)) {
$value = array_map(function ($val) {
return is_array($val) ? json_encode($val) : $val;
}, $value);
$value = '['.implode(', ', $value).']';
}
if (is_bool($value)) {
$value = var_export($value, true);
}
if (is_string($rawVal) && $rawVal != $value) {
$io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
} else {
$io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
}
}
}
}
<?php
namespace Composer\Command;
use Composer\Config;
use Composer\Factory;
use Composer\Installer;
use Composer\Installer\ProjectInstaller;
use Composer\Installer\InstallationManager;
use Composer\Installer\SuggestedPackagesReporter;
use Composer\IO\IOInterface;
use Composer\Package\BasePackage;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\Package\Version\VersionSelector;
use Composer\Package\AliasPackage;
use Composer\Repository\RepositoryFactory;
use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\InstalledFilesystemRepository;
use Composer\Script\ScriptEvents;
use Composer\Util\Silencer;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
use Composer\Json\JsonFile;
use Composer\Config\JsonConfigSource;
use Composer\Util\Filesystem;
use Composer\Package\Version\VersionParser;
class CreateProjectCommand extends BaseCommand
{
protected $suggestedPackagesReporter;
protected function configure()
{
$this
->setName('create-project')
->setDescription('Creates new project from a package into given directory.')
->setDefinition(array(
new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
))
->setHelp(
<<<EOT
The <info>create-project</info> command creates a new project from a given
package into a new directory. If executed without params and in a directory
with a composer.json file it installs the packages for the current project.
You can use this command to bootstrap new projects or setup a clean
version-controlled installation for developers of your project.
<info>php composer.phar create-project vendor/project target-directory [version]</info>
You can also specify the version with the package name using = or : as separator.
<info>php composer.phar create-project vendor/project:version target-directory</info>
To install unstable packages, either specify the version you want, or use the
--stability=dev (where dev can be one of RC, beta, alpha or dev).
To setup a developer workable version you should create the project using the source
controlled code by appending the <info>'--prefer-source'</info> flag.
To install a package from another repository than the default one you
can pass the <info>'--repository=https://myrepository.org'</info> flag.
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$config = Factory::createConfig();
$io = $this->getIO();
list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
if ($input->getOption('dev')) {
$io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
}
if ($input->getOption('no-custom-installers')) {
$io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
$input->setOption('no-plugins', true);
}
return $this->installProject(
$io,
$config,
$input,
$input->getArgument('package'),
$input->getArgument('directory'),
$input->getArgument('version'),
$input->getOption('stability'),
$preferSource,
$preferDist,
!$input->getOption('no-dev'),
$input->getOption('repository') ?: $input->getOption('repository-url'),
$input->getOption('no-plugins'),
$input->getOption('no-scripts'),
$input->getOption('no-progress'),
$input->getOption('no-install'),
$input->getOption('ignore-platform-reqs'),
!$input->getOption('no-secure-http')
);
}
public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true)
{
$oldCwd = getcwd();
$io->loadConfiguration($config);
$this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
if ($packageName !== null) {
$installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
} else {
$installedFromVcs = false;
}
$composer = Factory::create($io, null, $disablePlugins);
$composer->getDownloadManager()->setOutputProgress(!$noProgress);
$fs = new Filesystem();
if ($noScripts === false) {
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
}
$config = $composer->getConfig();
list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
if ($noInstall === false) {
$installer = Installer::create($io, $composer);
$installer->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setDevMode($installDevPackages)
->setRunScripts(!$noScripts)
->setIgnorePlatformRequirements($ignorePlatformReqs)
->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
->setOptimizeAutoloader($config->get('optimize-autoloader'));
if ($disablePlugins) {
$installer->disablePlugins();
}
$status = $installer->run();
if (0 !== $status) {
return $status;
}
}
$hasVcs = $installedFromVcs;
if (
!$input->getOption('keep-vcs')
&& $installedFromVcs
&& (
$input->getOption('remove-vcs')
|| !$io->isInteractive()
|| $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
)
) {
$finder = new Finder();
$finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
$finder->name($vcsName);
}
try {
$dirs = iterator_to_array($finder);
unset($finder);
foreach ($dirs as $dir) {
if (!$fs->removeDirectory($dir)) {
throw new \RuntimeException('Could not remove '.$dir);
}
}
} catch (\Exception $e) {
$io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
}
$hasVcs = false;
}
if (!$hasVcs) {
$package = $composer->getPackage();
$configSource = new JsonConfigSource(new JsonFile('composer.json'));
foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
foreach ($package->{'get'.$meta['method']}() as $link) {
if ($link->getPrettyConstraint() === 'self.version') {
$configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
}
}
}
}
if ($noScripts === false) {
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
}
chdir($oldCwd);
$vendorComposerDir = $config->get('vendor-dir').'/composer';
if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
Silencer::call('rmdir', $vendorComposerDir);
$vendorDir = $config->get('vendor-dir');
if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
Silencer::call('rmdir', $vendorDir);
}
}
return 0;
}
protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
{
if (!$secureHttp) {
$config->merge(array('config' => array('secure-http' => false)));
}
if (null === $repository) {
$sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
} else {
$sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
}
$parser = new VersionParser();
$requirements = $parser->parseNameVersionPairs(array($packageName));
$name = strtolower($requirements[0]['name']);
if (!$packageVersion && isset($requirements[0]['version'])) {
$packageVersion = $requirements[0]['version'];
}
if (null === $stability) {
if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
$stability = $match[1];
} else {
$stability = VersionParser::parseStability($packageVersion);
}
}
$stability = VersionParser::normalizeStability($stability);
if (!isset(BasePackage::$stabilities[$stability])) {
throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
}
$pool = new Pool($stability);
$pool->addRepository($sourceRepo);
$phpVersion = null;
$prettyPhpVersion = null;
if (!$ignorePlatformReqs) {
$platformOverrides = $config->get('platform') ?: array();
$platform = new PlatformRepository(array(), $platformOverrides);
$phpPackage = $platform->findPackage('php', '*');
$phpVersion = $phpPackage->getVersion();
$prettyPhpVersion = $phpPackage->getPrettyVersion();
}
$versionSelector = new VersionSelector($pool);
$package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
if (!$package) {
$errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
}
throw new \InvalidArgumentException($errorMessage .'.');
}
if (null === $directory) {
$parts = explode("/", $name, 2);
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
}
if (function_exists('pcntl_async_signals')) {
@mkdir($directory, 0777, true);
if ($realDir = realpath($directory)) {
pcntl_async_signals(true);
pcntl_signal(SIGINT, function () use ($realDir) {
$fs = new Filesystem();
$fs->removeDirectory($realDir);
exit(130);
});
}
}
$io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
if ($disablePlugins) {
$io->writeError('<info>Plugins have been disabled.</info>');
}
if ($package instanceof AliasPackage) {
$package = $package->getAliasOf();
}
$dm = $this->createDownloadManager($io, $config);
$dm->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setOutputProgress(!$noProgress);
$projectInstaller = new ProjectInstaller($directory, $dm);
$im = $this->createInstallationManager();
$im->addInstaller($projectInstaller);
$im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
$im->notifyInstalls($io);
$this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
$installedFromVcs = 'source' === $package->getInstallationSource();
$io->writeError('<info>Created project in ' . $directory . '</info>');
chdir($directory);
$_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
return $installedFromVcs;
}
protected function createDownloadManager(IOInterface $io, Config $config)
{
$factory = new Factory();
return $factory->createDownloadManager($io, $config);
}
protected function createInstallationManager()
{
return new InstallationManager();
}
}
<?php
namespace Composer\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class DependsCommand extends BaseDependencyCommand
{
protected function configure()
{
parent::configure();
$this
->setName('depends')
->setAliases(array('why'))
->setDescription('Shows which packages cause the given package to be installed.')
->setHelp(
<<<EOT
Displays detailed information about where a package is referenced.
<info>php composer.phar depends composer/composer</info>
EOT
)
;
}