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.
 
 
 
 
 

85797 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.phpfaùcÂXfa1�é4¶+src/Composer/Autoload/ClassMapGenerator.php•ùcÂX•î$»'¶src/Composer/Cache.phpøùcÂXø.f—ݶ%src/Composer/Command/AboutCommand.phpÁùcÂXÁ¾þò¶'src/Composer/Command/ArchiveCommand.php¸ùcÂX¸ÖN¨ ¶$src/Composer/Command/BaseCommand.phpÉ ùcÂXÉ —P!£¶.src/Composer/Command/BaseDependencyCommand.phpÉùcÂXÉD{²Ð¶*src/Composer/Command/ClearCacheCommand.php^ùcÂX^ƒ÷�¶&src/Composer/Command/ConfigCommand.phpªGùcÂXªGÐ5$4¶-src/Composer/Command/CreateProjectCommand.phpë4ùcÂXë4‡&ªö¶'src/Composer/Command/DependsCommand.php·ùcÂX·o±¹ú¶(src/Composer/Command/DiagnoseCommand.phpÍFùcÂXÍF²E>F¶,src/Composer/Command/DumpAutoloadCommand.php¨ ùcÂX¨ g/”+¶$src/Composer/Command/ExecCommand.phphùcÂXhíB=¶&src/Composer/Command/GlobalCommand.phpüùcÂXüÝH�\¶$src/Composer/Command/HomeCommand.phpùcÂXc¼±¶$src/Composer/Command/InitCommand.phpµ=ùcÂXµ=*µÍ¶'src/Composer/Command/InstallCommand.phpýùcÂXý0ö:‰¶(src/Composer/Command/LicensesCommand.php%ùcÂX%nx
E¶(src/Composer/Command/OutdatedCommand.php°
ùcÂX°
7àzk¶)src/Composer/Command/ProhibitsCommand.phpËùcÂXËg�ð¶&src/Composer/Command/RemoveCommand.phpçùcÂXçº ,¶'src/Composer/Command/RequireCommand.php£ùcÂX£š@p¶)src/Composer/Command/RunScriptCommand.phpŸ ùcÂXŸ ÎÀñ˶+src/Composer/Command/ScriptAliasCommand.phpùcÂX®%þ›¶&src/Composer/Command/SearchCommand.phpáùcÂXሠª¶*src/Composer/Command/SelfUpdateCommand.phpï0ùcÂXï0û­ ¶$src/Composer/Command/ShowCommand.phpcdùcÂXcd‘Òba¶&src/Composer/Command/StatusCommand.php.ùcÂX.&Æ�8¶(src/Composer/Command/SuggestsCommand.php¨ ùcÂX¨ £.¿¶&src/Composer/Command/UpdateCommand.php["ùcÂX["IyYì¶(src/Composer/Command/ValidateCommand.phpùcÂXlpœ/¶src/Composer/Composer.phpÿùcÂXÿÏ…YJ¶src/Composer/Config.php�"ùcÂX�"Þ4Jö¶-src/Composer/Config/ConfigSourceInterface.phpùcÂX³ [/¶(src/Composer/Config/JsonConfigSource.phpÅùcÂXÅÂ4‡¶$src/Composer/Console/Application.php$0ùcÂX$0ífû¶,src/Composer/Console/HtmlOutputFormatter.php3ùcÂX3Ú�Eu¶-src/Composer/DependencyResolver/Decisions.phpQùcÂXQ?˜¬$¶1src/Composer/DependencyResolver/DefaultPolicy.phpùcÂXõÝv¶/src/Composer/DependencyResolver/GenericRule.php·ùcÂX·Ì~¯³¶>src/Composer/DependencyResolver/Operation/InstallOperation.phpCùcÂXC´\õ*¶Isrc/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷ùcÂX÷ïÎà÷¶Ksrc/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpýùcÂXý3#†¶@src/Composer/DependencyResolver/Operation/OperationInterface.phpÓùcÂXÓÙâ&ä¶=src/Composer/DependencyResolver/Operation/SolverOperation.php¹ùcÂX¹&¢e
¶@src/Composer/DependencyResolver/Operation/UninstallOperation.phpIùcÂXIFûÂɶ=src/Composer/DependencyResolver/Operation/UpdateOperation.phphùcÂXhöSÕ]¶3src/Composer/DependencyResolver/PolicyInterface.php­ùcÂX­Ÿ‹R¶(src/Composer/DependencyResolver/Pool.php°"ùcÂX°" Ž%¶+src/Composer/DependencyResolver/Problem.php™ùcÂX™´‡Ä¶+src/Composer/DependencyResolver/Request.phpƒùcÂXƒåVP„¶(src/Composer/DependencyResolver/Rule.phpnùcÂXn—3"u¶1src/Composer/DependencyResolver/Rule2Literals.php§ùcÂX§~Ð'ò¶+src/Composer/DependencyResolver/RuleSet.phpª
ùcÂXª
_΂¶4src/Composer/DependencyResolver/RuleSetGenerator.phpOùcÂXO³Q[â¶3src/Composer/DependencyResolver/RuleSetIterator.phpùcÂX}õÇù¶2src/Composer/DependencyResolver/RuleWatchChain.phpiùcÂXihïš,¶2src/Composer/DependencyResolver/RuleWatchGraph.phpáùcÂXá‰rôv¶1src/Composer/DependencyResolver/RuleWatchNode.phpñùcÂXñë•“¶*src/Composer/DependencyResolver/Solver.phpŸ8ùcÂXŸ8pöb¶6src/Composer/DependencyResolver/SolverBugException.php˜ùcÂX˜"qN¶;src/Composer/DependencyResolver/SolverProblemsException.php¤ùcÂX¤Ä~¶/src/Composer/DependencyResolver/Transaction.phpôùcÂXôcïTܶ-src/Composer/Downloader/ArchiveDownloader.phpåùcÂXåƒdø¶1src/Composer/Downloader/ChangeReportInterface.phpÌùcÂX̯ਿ¶+src/Composer/Downloader/DownloadManager.phpGùcÂXGŠ(í»¶/src/Composer/Downloader/DownloaderInterface.phpÊùcÂXÊgs!l¶3src/Composer/Downloader/DvcsDownloaderInterface.phpÑùcÂXÑ&Áœ¿¶*src/Composer/Downloader/FileDownloader.phpÍùcÂXÍ�Õ�>¶/src/Composer/Downloader/FilesystemException.php
ùcÂX
.-‹¶,src/Composer/Downloader/FossilDownloader.php` ùcÂX` ÿI©u¶)src/Composer/Downloader/GitDownloader.php�3ùcÂX�31mU¥¶*src/Composer/Downloader/GzipDownloader.phpóùcÂXó}Úo¶(src/Composer/Downloader/HgDownloader.php8 ùcÂX8 ëyàn¶*src/Composer/Downloader/PathDownloader.phpSùcÂXSÊfý|¶0src/Composer/Downloader/PearPackageExtractor.phpuùcÂXuz„‡¶.src/Composer/Downloader/PerforceDownloader.phpÃùcÂXÑÈý¶*src/Composer/Downloader/PharDownloader.phpåùcÂXåÞÉç¶)src/Composer/Downloader/RarDownloader.phpžùcÂXž6 3U¶)src/Composer/Downloader/SvnDownloader.phpGùcÂXG†íV–¶)src/Composer/Downloader/TarDownloader.phpãùcÂXãÍ’X?¶.src/Composer/Downloader/TransportException.php=ùcÂX=ZÎÈÞ¶9src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔùcÂXÔ`§ôö¶)src/Composer/Downloader/VcsDownloader.php"ùcÂX"œŸp¶(src/Composer/Downloader/XzDownloader.php§ùcÂX§W$;á¶)src/Composer/Downloader/ZipDownloader.phpù ùcÂXù >Å¡¶&src/Composer/EventDispatcher/Event.php ùcÂX ±™jï¶0src/Composer/EventDispatcher/EventDispatcher.phpÀ/ùcÂXÀ/dw¶9src/Composer/EventDispatcher/EventSubscriberInterface.php©ùcÂX©h·0¶9src/Composer/EventDispatcher/ScriptExecutionException.phpvùcÂXvwZ8S¶)src/Composer/Exception/NoSslException.phpfùcÂXfËíM�¶src/Composer/Factory.php¦<ùcÂX¦<i‡@˶src/Composer/IO/BaseIO.phpŒùcÂXŒ(‚l‘¶src/Composer/IO/BufferIO.php*ùcÂX*¢®hT¶src/Composer/IO/ConsoleIO.php@ùcÂX@¤ñâ¶src/Composer/IO/IOInterface.phpìùcÂXìÕ�¶src/Composer/IO/NullIO.phpÀùcÂXÀF`sʶsrc/Composer/Installer.php —ùcÂX —Ô©ül¶*src/Composer/Installer/BinaryInstaller.phpùcÂX³ *¶2src/Composer/Installer/BinaryPresenceInterface.phpËùcÂXËÀ5š¨¶.src/Composer/Installer/InstallationManager.php-ùcÂX-¾}Œ7¶)src/Composer/Installer/InstallerEvent.phpùcÂXlÔzi¶*src/Composer/Installer/InstallerEvents.phpÞùcÂXÞìŸ@G¶-src/Composer/Installer/InstallerInterface.phpãùcÂXã^ƒ“ʶ+src/Composer/Installer/LibraryInstaller.php^ùcÂX^Ír¶/src/Composer/Installer/MetapackageInstaller.phpœùcÂXœÆÅ!¶(src/Composer/Installer/NoopInstaller.php+ùcÂX+À·M}¶'src/Composer/Installer/PackageEvent.phpeùcÂXe;° ¶(src/Composer/Installer/PackageEvents.php¸ùcÂX¸dbØs¶.src/Composer/Installer/PearBinaryInstaller.phpâ ùcÂXâ ;øiU¶(src/Composer/Installer/PearInstaller.php¢ùcÂX¢È‚¶Ñ¶*src/Composer/Installer/PluginInstaller.phpŸùcÂXŸ<tú,¶+src/Composer/Installer/ProjectInstaller.phpùcÂX*0@P¶4src/Composer/Installer/SuggestedPackagesReporter.phpªùcÂXªàGösrc/Composer/Json/JsonFile.phpùcÂXVVN¶#src/Composer/Json/JsonFormatter.phpùcÂXÐqu¶%src/Composer/Json/JsonManipulator.phpþ0ùcÂXþ0kÌc¶-src/Composer/Json/JsonValidationException.php\ùcÂX\.Xóܶ%src/Composer/Package/AliasPackage.phpùcÂX¹—~š¶7src/Composer/Package/Archiver/ArchivableFilesFilter.php ùcÂX yY+¦¶7src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞùcÂXÞ ²²¹¶0src/Composer/Package/Archiver/ArchiveManager.php° ùcÂX° gþÒ)¶3src/Composer/Package/Archiver/ArchiverInterface.phpùcÂXñ´> ¶3src/Composer/Package/Archiver/BaseExcludeFilter.php–ùcÂX–y¶=ƶ7src/Composer/Package/Archiver/ComposerExcludeFilter.phpùcÂX‹SZ0¶2src/Composer/Package/Archiver/GitExcludeFilter.phpqùcÂXq5¾i&¶1src/Composer/Package/Archiver/HgExcludeFilter.phpùcÂX~”¸¶.src/Composer/Package/Archiver/PharArchiver.php>ùcÂX> 5‰í¶-src/Composer/Package/Archiver/ZipArchiver.php¼ùcÂX¼‘XÝë¶$src/Composer/Package/BasePackage.php& ùcÂX& 'ݶ(src/Composer/Package/CompletePackage.phpüùcÂXüþM˶¶1src/Composer/Package/CompletePackageInterface.phpõùcÂXõ¦Ê�ò¶+src/Composer/Package/Dumper/ArrayDumper.phpë ùcÂXë Ó8WE¶src/Composer/Package/Link.phpˆùcÂXˆå¶Y«¶7src/Composer/Package/LinkConstraint/EmptyConstraint.php‚ùcÂX‚é~‹¶?src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpdùcÂXd¤ôLn¶7src/Composer/Package/LinkConstraint/MultiConstraint.php‚ùcÂX‚ób`ý¶:src/Composer/Package/LinkConstraint/SpecificConstraint.phpiùcÂXiÞ”š%¶9src/Composer/Package/LinkConstraint/VersionConstraint.phpXùcÂXX}`y¶+src/Composer/Package/Loader/ArrayLoader.php¸ùcÂX¸6 ¤¶7src/Composer/Package/Loader/InvalidPackageException.phpEùcÂXExb¾¶*src/Composer/Package/Loader/JsonLoader.phpùùcÂXù!~ˆ{¶/src/Composer/Package/Loader/LoaderInterface.php²ùcÂX²¦}úζ1src/Composer/Package/Loader/RootPackageLoader.php½ùcÂX½I¢�i¶5src/Composer/Package/Loader/ValidatingArrayLoader.php½1ùcÂX½1ÅnÚѶsrc/Composer/Package/Locker.phpª!ùcÂXª!�7e¾¶ src/Composer/Package/Package.phpÉùcÂXÉcÃ�h¶)src/Composer/Package/PackageInterface.php ùcÂX ûÇ^ƶ)src/Composer/Package/RootAliasPackage.php ùcÂX _€ø¶$src/Composer/Package/RootPackage.phpùcÂXŽÎ_¶-src/Composer/Package/RootPackageInterface.php¹ùcÂX¹"maV¶/src/Composer/Package/Version/VersionGuesser.phpµùcÂXµ.â_ ¶.src/Composer/Package/Version/VersionParser.phpøùcÂXø¾3l¶0src/Composer/Package/Version/VersionSelector.phpK ùcÂXK ²<ȶ-src/Composer/Plugin/Capability/Capability.phpWùcÂXWæ_¨1¶2src/Composer/Plugin/Capability/CommandProvider.php—ùcÂX—ûOâ>¶src/Composer/Plugin/Capable.phpùcÂXÆq+¶$src/Composer/Plugin/CommandEvent.phpâùcÂXâ³ÆÇW¶$src/Composer/Plugin/PluginEvents.phpÂùcÂXÂ^Íþ¶'src/Composer/Plugin/PluginInterface.phpôùcÂXô)'*ض%src/Composer/Plugin/PluginManager.php$ùcÂX$ëŽ"»¶,src/Composer/Plugin/PreFileDownloadEvent.php`ùcÂX`9-ζ+src/Composer/Repository/ArrayRepository.phpùcÂXéÌt¶.src/Composer/Repository/ArtifactRepository.php» ùcÂX» ˆÝ÷<¶*src/Composer/Repository/BaseRepository.php_ ùcÂX_ –û߶.src/Composer/Repository/ComposerRepository.phpATùcÂXATu`¶/src/Composer/Repository/CompositeRepository.php;ùcÂX;¤¯S¶;src/Composer/Repository/ConfigurableRepositoryInterface.php…ùcÂX…±Ÿ_¶0src/Composer/Repository/FilesystemRepository.php×ùcÂX×Iœª¶4src/Composer/Repository/InstalledArrayRepository.php£ùcÂX£/ö~>¶9src/Composer/Repository/InstalledFilesystemRepository.php£ùcÂX£V
•_¶8src/Composer/Repository/InstalledRepositoryInterface.php‡ùcÂX‡£9p¶6src/Composer/Repository/InvalidRepositoryException.phpnùcÂXnà“똶-src/Composer/Repository/PackageRepository.phpjùcÂXj¥ôò̶*src/Composer/Repository/PathRepository.phpY ùcÂXY (—¾3¶2src/Composer/Repository/Pear/BaseChannelReader.phpIùcÂXIc6³¶,src/Composer/Repository/Pear/ChannelInfo.phpÄùcÂXÄ:T*ɶ.src/Composer/Repository/Pear/ChannelReader.phpíùcÂXí?ÈYT¶4src/Composer/Repository/Pear/ChannelRest10Reader.phpÁ ùcÂXÁ O€ë¶4src/Composer/Repository/Pear/ChannelRest11Reader.php& ùcÂX& òUb¶5src/Composer/Repository/Pear/DependencyConstraint.phpqùcÂXq9=¶/src/Composer/Repository/Pear/DependencyInfo.phpqùcÂXqfºTò¶8src/Composer/Repository/Pear/PackageDependencyParser.php…ùcÂX…÷$Li¶,src/Composer/Repository/Pear/PackageInfo.php°ùcÂX°Ÿ ¸ ¶,src/Composer/Repository/Pear/ReleaseInfo.php’ùcÂX’o“ŠÃ¶*src/Composer/Repository/PearRepository.phpªùcÂXª)Ÿƒ}¶.src/Composer/Repository/PlatformRepository.phpùcÂX_Mì¶-src/Composer/Repository/RepositoryFactory.phpMùcÂXM^ Æä¶/src/Composer/Repository/RepositoryInterface.phpÛùcÂXÛ’âÁ¶-src/Composer/Repository/RepositoryManager.php,
ùcÂX,
¾…\•¶7src/Composer/Repository/RepositorySecurityException.phpoùcÂXopÕ«ª¶/src/Composer/Repository/Vcs/BitbucketDriver.php ùcÂX ¶tpX¶,src/Composer/Repository/Vcs/FossilDriver.php ùcÂX ]‹ÉQ¶2src/Composer/Repository/Vcs/GitBitbucketDriver.phpêùcÂXêÃŽ»¶)src/Composer/Repository/Vcs/GitDriver.phpØùcÂXØÝ"T̶,src/Composer/Repository/Vcs/GitHubDriver.phpz+ùcÂXz+Úb¶,src/Composer/Repository/Vcs/GitLabDriver.php’ùcÂX’î i¶1src/Composer/Repository/Vcs/HgBitbucketDriver.phpäùcÂXäi›üà¶(src/Composer/Repository/Vcs/HgDriver.php¥ùcÂX¥uߣȶ.src/Composer/Repository/Vcs/PerforceDriver.phpO ùcÂXO @ËóN¶)src/Composer/Repository/Vcs/SvnDriver.phpùcÂXÕzï¶)src/Composer/Repository/Vcs/VcsDriver.phpƒ
ùcÂXƒ
žŸ‡¶2src/Composer/Repository/Vcs/VcsDriverInterface.php÷ùcÂX÷ÇX[‰¶)src/Composer/Repository/VcsRepository.php´ùcÂX´ªÖG¶3src/Composer/Repository/WritableArrayRepository.phpùcÂX¾G*¶7src/Composer/Repository/WritableRepositoryInterface.php‰ùcÂX‰‘/sï¶$src/Composer/Script/CommandEvent.phpWùcÂXW£VZt¶src/Composer/Script/Event.phpµùcÂXµlt¦M¶$src/Composer/Script/PackageEvent.phpœùcÂXœ§ÿÉ ¶$src/Composer/Script/ScriptEvents.phpPùcÂXP‡�¶¶ src/Composer/SelfUpdate/Keys.php�ùcÂX� îÊN¶$src/Composer/SelfUpdate/Versions.phpìùcÂXì͵‘ƒ¶ src/Composer/Util/AuthHelper.phpËùcÂXË>zx–¶src/Composer/Util/Bitbucket.phpõùcÂXõ’q9…¶$src/Composer/Util/ComposerMirror.php±ùcÂX±­½øض%src/Composer/Util/ConfigValidator.php&ùcÂX&î:äü¶"src/Composer/Util/ErrorHandler.php‡ùcÂX‡He"¶ src/Composer/Util/Filesystem.phps.ùcÂXs.›Í®à¶src/Composer/Util/Git.phpT$ùcÂXT$çz¢�¶src/Composer/Util/GitHub.php¯
ùcÂX¯
àÏ ¶src/Composer/Util/GitLab.php ùcÂX Yºƒ*¶src/Composer/Util/IniHelper.php�ùcÂX�Çþ‚{¶$src/Composer/Util/NoProxyPattern.php¾ùcÂX¾Z+°m¶src/Composer/Util/Perforce.php2ùcÂX2­5P¶src/Composer/Util/Platform.phpüùcÂXüs­fç¶%src/Composer/Util/ProcessExecutor.php ùcÂX ˆ)sw¶&src/Composer/Util/RemoteFilesystem.php$bùcÂX$b÷7Mp¶src/Composer/Util/Silencer.phpòùcÂXò.Žܶ!src/Composer/Util/SpdxLicense.phpùcÂX¾7
ñ¶*src/Composer/Util/StreamContextFactory.phpwùcÂXwÓ;Ѷsrc/Composer/Util/Svn.php¾ùcÂX¾Ík“ܶsrc/Composer/Util/TlsHelper.phpp
ùcÂXp
¤eÞæ¶src/Composer/XdebugHandler.phpùcÂX눽¶src/bootstrap.php¹ùcÂX¹I}œ¶%src/Composer/Autoload/ClassLoader.php‹4ùcÂX‹4QŸ”¼¶#res/composer-repository-schema.jsonðùcÂXð�GÐà¶res/composer-schema.json[’ùcÂX[’ák¥¶6vendor/composer/spdx-licenses/res/spdx-exceptions.jsoníùcÂXíÆÅz±¶4vendor/composer/spdx-licenses/res/spdx-licenses.json eùcÂX eùe!‰¶*vendor/seld/cli-prompt/res/hiddeninput.exe$ùcÂX$•�¥v¶&vendor/symfony/console/Application.php.WùcÂX.W´'�ð¶*vendor/symfony/console/Command/Command.php•#ùcÂX•#Ìí+!¶.vendor/symfony/console/Command/HelpCommand.phpÝùcÂXÝ.Ø™u¶.vendor/symfony/console/Command/ListCommand.phpZùcÂXZÉ£ ¶(vendor/symfony/console/ConsoleEvents.phpïùcÂXï ÕH¸¶<vendor/symfony/console/Descriptor/ApplicationDescription.phpßùcÂXßµŒ°7¶0vendor/symfony/console/Descriptor/Descriptor.php�ùcÂX�;~Ķ9vendor/symfony/console/Descriptor/DescriptorInterface.phpüùcÂXü±Qµ¶4vendor/symfony/console/Descriptor/JsonDescriptor.phpš ùcÂXš l¬¶8vendor/symfony/console/Descriptor/MarkdownDescriptor.php¹ùcÂX¹kŸ.a¶4vendor/symfony/console/Descriptor/TextDescriptor.phpiùcÂXi Îòÿ¶3vendor/symfony/console/Descriptor/XmlDescriptor.phpùcÂX‹P$¶4vendor/symfony/console/Event/ConsoleCommandEvent.php²ùcÂX²Zk‰2¶-vendor/symfony/console/Event/ConsoleEvent.phpÅùcÂXÅÒxÛ\¶6vendor/symfony/console/Event/ConsoleExceptionEvent.phpùcÂXá2é¶6vendor/symfony/console/Event/ConsoleTerminateEvent.phpzùcÂXz³,îL¶=vendor/symfony/console/Exception/CommandNotFoundException.phpÔùcÂXÔÈ÷ L¶7vendor/symfony/console/Exception/ExceptionInterface.phpfùcÂXf¡ABª¶=vendor/symfony/console/Exception/InvalidArgumentException.php¦ùcÂX¦Ö̽Z¶;vendor/symfony/console/Exception/InvalidOptionException.php¦ùcÂX¦Ë×H¶3vendor/symfony/console/Exception/LogicException.php’ùcÂX’ÍO\e¶5vendor/symfony/console/Exception/RuntimeException.php–ùcÂX–Ùí,6¶4vendor/symfony/console/Formatter/OutputFormatter.php!ùcÂX!§îwx¶=vendor/symfony/console/Formatter/OutputFormatterInterface.phpŠùcÂXŠ:߶9vendor/symfony/console/Formatter/OutputFormatterStyle.phpLùcÂXLŠ�8<¶Bvendor/symfony/console/Formatter/OutputFormatterStyleInterface.php†ùcÂX†ÝRÚ­¶>vendor/symfony/console/Formatter/OutputFormatterStyleStack.phpLùcÂXL.=b¶6vendor/symfony/console/Helper/DebugFormatterHelper.phpxùcÂXxN©Ø¼¶2vendor/symfony/console/Helper/DescriptorHelper.phpzùcÂXzfÉÚý¶.vendor/symfony/console/Helper/DialogHelper.phpúùcÂXúhX�ö1vendor/symfony/console/Helper/FormatterHelper.phpcùcÂXc“ý«N¶(vendor/symfony/console/Helper/Helper.phpùcÂX‡Â<£¶1vendor/symfony/console/Helper/HelperInterface.phpçùcÂXç Çã¶+vendor/symfony/console/Helper/HelperSet.phpÐùcÂXÐaˆ~ ¶2vendor/symfony/console/Helper/InputAwareHelper.phpcùcÂXcñø�|¶/vendor/symfony/console/Helper/ProcessHelper.phpÑ ùcÂXÑ @±ã�¶-vendor/symfony/console/Helper/ProgressBar.phps%ùcÂXs%鯦�¶0vendor/symfony/console/Helper/ProgressHelper.php\ùcÂX\?‹á¶3vendor/symfony/console/Helper/ProgressIndicator.phpKùcÂXKíÍ°¶0vendor/symfony/console/Helper/QuestionHelper.php�ùcÂX�Ôb£¶7vendor/symfony/console/Helper/SymfonyQuestionHelper.phpl
ùcÂXl
÷ÞL¶'vendor/symfony/console/Helper/Table.php*ùcÂX*¢¸}¶+vendor/symfony/console/Helper/TableCell.php‡ùcÂX‡¨*æ¶-vendor/symfony/console/Helper/TableHelper.php ùcÂX ¦pm‡¶0vendor/symfony/console/Helper/TableSeparator.phpÍùcÂXÍQßa²¶,vendor/symfony/console/Helper/TableStyle.php
ùcÂX
PÞµ¦¶*vendor/symfony/console/Input/ArgvInput.phpùcÂX¯Üœ¶+vendor/symfony/console/Input/ArrayInput.php_
ùcÂX_
[µðɶ&vendor/symfony/console/Input/Input.phpª ùcÂXª ¶¶.vendor/symfony/console/Input/InputArgument.phpùcÂXÁÜ�¶4vendor/symfony/console/Input/InputAwareInterface.phpšùcÂXš‡jTŸ¶0vendor/symfony/console/Input/InputDefinition.php–ùcÂX–0Oly¶/vendor/symfony/console/Input/InputInterface.phpŸùcÂXŸ¥R6Û¶,vendor/symfony/console/Input/InputOption.php ùcÂX ‡¹§¶,vendor/symfony/console/Input/StringInput.php˜ùcÂX˜ Ú¤¶vendor/symfony/console/LICENSE)ùcÂX)·)E`¶/vendor/symfony/console/Logger/ConsoleLogger.php< ùcÂX< :âÇl¶0vendor/symfony/console/Output/BufferedOutput.php_ùcÂX_ûBÍ·¶/vendor/symfony/console/Output/ConsoleOutput.phpµùcÂXµ
¢S\¶8vendor/symfony/console/Output/ConsoleOutputInterface.phpåùcÂXårNô¶,vendor/symfony/console/Output/NullOutput.phpÏùcÂXÏ®˜‹Z¶(vendor/symfony/console/Output/Output.phpš ùcÂXš 01 ý¶1vendor/symfony/console/Output/OutputInterface.phpùcÂXÓÚ>¶.vendor/symfony/console/Output/StreamOutput.phpÄùcÂXÄõ핶2vendor/symfony/console/Question/ChoiceQuestion.php"
ùcÂX"
_౶8vendor/symfony/console/Question/ConfirmationQuestion.phpéùcÂXéƒQ@¶,vendor/symfony/console/Question/Question.php#
ùcÂX#
e¯ ¶ vendor/symfony/console/Shell.phpéùcÂXé½fü‘¶,vendor/symfony/console/Style/OutputStyle.php_ùcÂX_ûµ¶/vendor/symfony/console/Style/StyleInterface.phpÔùcÂXÔ ßÊj¶-vendor/symfony/console/Style/SymfonyStyle.php¼ùcÂX¼öÅPg¶3vendor/symfony/console/Tester/ApplicationTester.phpÔùcÂXÔ¬ì¤d¶/vendor/symfony/console/Tester/CommandTester.php®ùcÂX®EÙš|¶(vendor/symfony/debug/BufferingLogger.phptùcÂXt=hܶvendor/symfony/debug/Debug.phpéùcÂXéÀxa?¶)vendor/symfony/debug/DebugClassLoader.phpåùcÂXå¦ù3\¶%vendor/symfony/debug/ErrorHandler.phpqBùcÂXqBŸ\/r¶9vendor/symfony/debug/Exception/ClassNotFoundException.php„ùcÂX„n�¡…¶8vendor/symfony/debug/Exception/ContextErrorException.php˜ùcÂX˜-
d2¶1vendor/symfony/debug/Exception/DummyException.phpùcÂX-"ûd¶6vendor/symfony/debug/Exception/FatalErrorException.phpïùcÂXïæ fz¶6vendor/symfony/debug/Exception/FatalThrowableError.phpDùcÂXD¡ Âí¶3vendor/symfony/debug/Exception/FlattenException.php²ùcÂX²HòѶ7vendor/symfony/debug/Exception/OutOfMemoryException.php~ùcÂX~ë¨oâ¶=vendor/symfony/debug/Exception/UndefinedFunctionException.phpˆùcÂXˆ¢G‚n¶;vendor/symfony/debug/Exception/UndefinedMethodException.php†ùcÂX†¨LÚ:¶)vendor/symfony/debug/ExceptionHandler.php
3ùcÂX
3¹¨È£¶Ivendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php7ùcÂX7Ñj/=¶Evendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.phpùcÂXĹBV¶Mvendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpuùcÂXuéj¶Kvendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpNùcÂXNÇo-ç¶vendor/symfony/debug/LICENSE)ùcÂX)·)E`¶:vendor/symfony/filesystem/Exception/ExceptionInterface.phpiùcÂXi$ ÿ›¶=vendor/symfony/filesystem/Exception/FileNotFoundException.php¼ùcÂX¼pí\¶¶3vendor/symfony/filesystem/Exception/IOException.php‡ùcÂX‡€ü#Ѷ<vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦ùcÂX¦jÙwM¶(vendor/symfony/filesystem/Filesystem.phpÔ.ùcÂXÔ.ÏL{¶!vendor/symfony/filesystem/LICENSE)ùcÂX)·)E`¶)vendor/symfony/filesystem/LockHandler.phpŽùcÂXŽü Å¶1vendor/symfony/finder/Adapter/AbstractAdapter.php\ ùcÂX\ Æ“É€¶5vendor/symfony/finder/Adapter/AbstractFindAdapter.php‘ùcÂX‘ao¦È¶2vendor/symfony/finder/Adapter/AdapterInterface.php±ùcÂX±ä»Ê&¶0vendor/symfony/finder/Adapter/BsdFindAdapter.php2ùcÂX2Q/ÇC¶0vendor/symfony/finder/Adapter/GnuFindAdapter.phpùcÂX ¡¾¶,vendor/symfony/finder/Adapter/PhpAdapter.phpôùcÂXô:?¶/vendor/symfony/finder/Comparator/Comparator.phpŒùcÂXŒwþT¶3vendor/symfony/finder/Comparator/DateComparator.php%ùcÂX%L¿EǶ5vendor/symfony/finder/Comparator/NumberComparator.php~ùcÂX~”‡ x¶9vendor/symfony/finder/Exception/AccessDeniedException.php„ùcÂX„½¾sœ¶;vendor/symfony/finder/Exception/AdapterFailureException.php¯ùcÂX¯œôÔÁ¶6vendor/symfony/finder/Exception/ExceptionInterface.php„ùcÂX„Gz-¶Avendor/symfony/finder/Exception/OperationNotPermitedException.php)ùcÂX)ìcj=¶@vendor/symfony/finder/Exception/ShellCommandFailureException.phpÂùcÂXÂv‚ȶ/vendor/symfony/finder/Expression/Expression.phpùcÂXµoÔ¶)vendor/symfony/finder/Expression/Glob.phpiùcÂXi@Šº¶*vendor/symfony/finder/Expression/Regex.phpùcÂXp8\¶3vendor/symfony/finder/Expression/ValueInterface.phpÍùcÂXͲ~øb¶ vendor/symfony/finder/Finder.phpÂ-ùcÂXÂ-˜f´¶vendor/symfony/finder/Glob.phpKùcÂXKjá±n¶7vendor/symfony/finder/Iterator/CustomFilterIterator.php]ùcÂX]tà±µ¶:vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpzùcÂXzÂT-¶;vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpðùcÂXðß0™¶Avendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpïùcÂXï¾�Òâ¶4vendor/symfony/finder/Iterator/FilePathsIterator.php ùcÂX fQCe¶9vendor/symfony/finder/Iterator/FileTypeFilterIterator.php\ùcÂX\p‘'˜¶<vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5ùcÂX5ší¶9vendor/symfony/finder/Iterator/FilenameFilterIterator.phprùcÂXrtu¶1vendor/symfony/finder/Iterator/FilterIterator.phpÀùcÂXÀE™½Œ¶=vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php/ùcÂX/»ÇY¶5vendor/symfony/finder/Iterator/PathFilterIterator.phpÏùcÂXϺªÇ¶=vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ùcÂX eÚ¹ü¶:vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpgùcÂXg!Ô—é¶3vendor/symfony/finder/Iterator/SortableIterator.php,ùcÂX,–0õ¶vendor/symfony/finder/LICENSE)ùcÂX)·)E`¶'vendor/symfony/finder/Shell/Command.phpS ùcÂXS cC…™¶%vendor/symfony/finder/Shell/Shell.phppùcÂXpÓ}g¶%vendor/symfony/finder/SplFileInfo.phpÿùcÂXÿË OÀ¶(vendor/symfony/polyfill-mbstring/LICENSE)ùcÂX)î*L¶-vendor/symfony/polyfill-mbstring/Mbstring.phpÁ4ùcÂXÁ4^iS¶@vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php2AùcÂX2A½=¨¶@vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php¡AùcÂX¡AÚ Í¶.vendor/symfony/polyfill-mbstring/bootstrap.php±ùcÂX±|Š©Ò¶7vendor/symfony/process/Exception/ExceptionInterface.phpfùcÂXf]ö>T¶=vendor/symfony/process/Exception/InvalidArgumentException.php¨ùcÂX¨ÐÀ+_¶3vendor/symfony/process/Exception/LogicException.php”ùcÂX” ³ãñ¶;vendor/symfony/process/Exception/ProcessFailedException.phpxùcÂXx¨Ìzy¶=vendor/symfony/process/Exception/ProcessTimedOutException.phpùcÂX. Ãá¶5vendor/symfony/process/Exception/RuntimeException.php˜ùcÂX˜¢Ø:¶+vendor/symfony/process/ExecutableFinder.php›ùcÂX›ý‚m›¶vendor/symfony/process/LICENSE)ùcÂX)·)E`¶.vendor/symfony/process/PhpExecutableFinder.phpgùcÂXg�絶%vendor/symfony/process/PhpProcess.phpüùcÂXü_—9¶.vendor/symfony/process/Pipes/AbstractPipes.php^ùcÂX^%s…ï¶/vendor/symfony/process/Pipes/PipesInterface.phpDùcÂXDvØ*vendor/symfony/process/Pipes/UnixPipes.phpåùcÂXåÈ¥¶-vendor/symfony/process/Pipes/WindowsPipes.php� ùcÂX� …®h¶"vendor/symfony/process/Process.php§RùcÂX§R+Á¥¶)vendor/symfony/process/ProcessBuilder.phpã
ùcÂXã
ʧ°ˆ¶'vendor/symfony/process/ProcessUtils.phpKùcÂXKµ½~ò¶vendor/seld/jsonlint/LICENSE"ùcÂX"aƒsy¶@vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*ùcÂX*•pñ¶5vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php/2ùcÂX/2­ß˜ö¶0vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.phpùcÂX#ÆŽ�¶;vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.phpùcÂX‰²ñ¶4vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>ùcÂX>ÿqŸŸ¶vendor/seld/cli-prompt/LICENSE"ùcÂX"ˆñ?e¶&vendor/seld/cli-prompt/res/example.php'ùcÂX'I£¶(vendor/seld/cli-prompt/src/CliPrompt.php ùcÂX l½`߶(vendor/justinrainbow/json-schema/LICENSE ùcÂX ºç©¶.vendor/justinrainbow/json-schema/demo/demo.phpñùcÂXñfC¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php°ùcÂX°Ãÿ¦'¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php. ùcÂX. [÷3í¶Jvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.phpß ùcÂXß —>/¶Svendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼ùcÂX¼ÿ Qœ¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]ùcÂX]VŽU<¶Gvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php7 ùcÂX7 ³�3%¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.phpŸùcÂXŸx&÷o¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.phpš
ùcÂXš
z&¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpµùcÂXµüø¦É¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.phpùcÂXN_»¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php{ùcÂX{ Ÿ[¶Xvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpaùcÂXa qöYvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.phppùcÂXprë¶\vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰ùcÂX‰“µ+j¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&ùcÂX&4˜©T¶Svendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpùcÂX/4˶Fvendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.php ùcÂX û}fa¶Pvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpIùcÂXI%|°¶Vvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•ùcÂX•‹àG¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phplùcÂXlA!L׶]vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpuùcÂXu=hç¶Wvendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpwùcÂXwN-ò[¶Svendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞùcÂXÞ\¸
¶Wvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpoùcÂXopíÛù¶Nvendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…ùcÂX…%…—¶^vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€ùcÂX€u-#1¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpjùcÂXjå>�¶Qvendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpfùcÂXf¬¤„þ¶Kvendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþùcÂXþM�„õ¶;vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.phpGùcÂXGœ?IǶAvendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpN ùcÂXN ZÈó¬¶Jvendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.phpùcÂXoŠ+}¶Tvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpáùcÂXá[þA�¶Gvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.phpwùcÂXwx¡€¯¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.phpùcÂXäZšD¶Rvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,ùcÂX,1•5þ¶Xvendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®ùcÂX®ÿ‹Áå¶Cvendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php– ùcÂX– =&ßͶDvendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpîùcÂXîÝ¿� ¶Hvendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒùcÂXƒJ€¶Ivendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…ùcÂX…íæe¶=vendor/justinrainbow/json-schema/src/JsonSchema/Validator.php†ùcÂX†yÐSR¶%vendor/composer/spdx-licenses/LICENSEùcÂXBhí¶2vendor/composer/spdx-licenses/src/SpdxLicenses.phpçùcÂXç·–U ¶vendor/composer/semver/LICENSEùcÂXBhí¶)vendor/composer/semver/src/Comparator.phpùcÂXwlƒï¶<vendor/composer/semver/src/Constraint/AbstractConstraint.php×ùcÂX×õî>Ž¶4vendor/composer/semver/src/Constraint/Constraint.phpª ùcÂXª ÇO7²¶=vendor/composer/semver/src/Constraint/ConstraintInterface.phpßùcÂXß0C,‡¶9vendor/composer/semver/src/Constraint/EmptyConstraint.phpéùcÂXé!-Ø™¶9vendor/composer/semver/src/Constraint/MultiConstraint.php1ùcÂX1í xU¶%vendor/composer/semver/src/Semver.phpvùcÂXv‹×È›¶,vendor/composer/semver/src/VersionParser.php¿*ùcÂX¿*)mƶ!vendor/composer/ca-bundle/LICENSEùcÂX*!^`¶*vendor/composer/ca-bundle/src/CaBundle.php½ùcÂX½e¶vendor/psr/log/LICENSE=ùcÂX=p±ŽO¶)vendor/psr/log/Psr/Log/AbstractLogger.php;ùcÂX;ñ>3[¶3vendor/psr/log/Psr/Log/InvalidArgumentException.php`ùcÂX` ˆX1¶#vendor/psr/log/Psr/Log/LogLevel.phpûùcÂXûjðñ8¶/vendor/psr/log/Psr/Log/LoggerAwareInterface.php|ùcÂX|$£ˆ¶+vendor/psr/log/Psr/Log/LoggerAwareTrait.php§ùcÂX§T½úB¶*vendor/psr/log/Psr/Log/LoggerInterface.phpÆùcÂXÆ»sg¶&vendor/psr/log/Psr/Log/LoggerTrait.phpiùcÂXi35§Þ¶%vendor/psr/log/Psr/Log/NullLogger.phpžùcÂXžÇö3vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpü ùcÂXü iq0ضvendor/autoload.php‚ùcÂX‚·Ž¯Ž¶'vendor/composer/autoload_namespaces.phpdùcÂXdZ¡¦H¶!vendor/composer/autoload_psr4.php˜ùcÂX˜ž{¢¶%vendor/composer/autoload_classmap.phpdùcÂXdZ¡¦H¶"vendor/composer/autoload_files.phpÃùcÂXÃÒÂür¶!vendor/composer/autoload_real.phpIùcÂXI)±¸ˆ¶#vendor/composer/autoload_static.php¬ ùcÂX¬ Ú[@.¶vendor/composer/ClassLoader.phpœùcÂXœ¥ÂåN¶(vendor/composer/ca-bundle/res/cacert.pemÿùcÂXÿ-=Jn¶ bin/composer‹ùcÂX‹íeGš¶LICENSE.ùcÂX. Õ¶<?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);
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 = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
$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)
{
$mainPackageMap = array_shift($packageMap);
$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'])) {
foreach ($autoloads['classmap'] as $dir) {
try {
$loader->addClassMap($this->generateClassMap($dir, null, 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';
array_push($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 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 = 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($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);
}
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)
{
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if ($this->enabled && 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)
{
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if ($this->enabled && 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)
{
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if ($this->enabled && file_exists($this->root . $file)) {
return $this->filesystem->unlink($this->root . $file);
}
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)
{
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if ($this->enabled && file_exists($this->root . $file)) {
return sha1_file($this->root . $file);
}
return false;
}
public function sha256($file)
{
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if ($this->enabled && 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('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\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('Create 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);
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
$composer->getEventDispatcher()->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')
);
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)
{
$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\IO\IOInterface;
use Composer\IO\NullIO;
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)
{
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($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');
$renderer->getStyle()->setVerticalBorderChar('');
$renderer->getStyle()->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\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-dir' => $config->get('cache-dir'),
'cache-files-dir' => $config->get('cache-files-dir'),
'cache-repo-dir' => $config->get('cache-repo-dir'),
'cache-vcs-dir' => $config->get('cache-vcs-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->gc(0, 0);
}
$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('Set 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') ?: trim(getenv('COMPOSER')) ?: 'composer.json');
if ($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),
);
$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 (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;
}
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('Create 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 deletion vcs folder.'),
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('keep-vcs'),
$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, $keepVcs = 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, $keepVcs, $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);
}
list($preferSource, $preferDist) = $this->getPreferredInstallOptions($composer->getConfig(), $input);
if ($noInstall === false) {
$installer = Installer::create($io, $composer);
$installer->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setDevMode($installDevPackages)
->setRunScripts(!$noScripts)
->setIgnorePlatformRequirements($ignorePlatformReqs)
->setSuggestedPackagesReporter($this->suggestedPackagesReporter);
if ($disablePlugins) {
$installer->disablePlugins();
}
$status = $installer->run();
if (0 !== $status) {
return $status;
}
}
$hasVcs = $installedFromVcs;
if (!$keepVcs && $installedFromVcs
&& (
!$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 = $composer->getConfig()->get('vendor-dir').'/composer';
if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
Silencer::call('rmdir', $vendorComposerDir);
$vendorDir = $composer->getConfig()->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, $keepVcs = 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_signal')) {
declare(ticks=100);
pcntl_signal(SIGINT, function () use ($directory) {
$fs = new Filesystem();
$fs->removeDirectory($directory);
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();
}
if (0 === strpos($package->getPrettyVersion(), 'dev-') && in_array($package->getSourceType(), array('git', 'hg'))) {
$package->setSourceReference(substr($package->getPrettyVersion(), 4));
}
$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
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
return parent::doExecute($input, $output, false);
}
}
<?php
namespace Composer\Command;
use Composer\Composer;
use Composer\Factory;
use Composer\Config;
use Composer\Downloader\TransportException;
use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents;
use Composer\Util\ConfigValidator;
use Composer\Util\IniHelper;
use Composer\Util\ProcessExecutor;
use Composer\Util\RemoteFilesystem;
use Composer\Util\StreamContextFactory;
use Composer\SelfUpdate\Keys;
use Composer\SelfUpdate\Versions;
use Composer\IO\NullIO;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class DiagnoseCommand extends BaseCommand
{
protected $rfs;
protected $process;
protected $exitCode = 0;
protected function configure()
{
$this
->setName('diagnose')
->setDescription('Diagnoses the system to identify common errors.')
->setHelp(<<<EOT
The <info>diagnose</info> command checks common errors to help debugging problems.
The process exit code will be 1 in case of warnings and 2 for errors.
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer(false);
$io = $this->getIO();
if ($composer) {
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
$io->write('Checking composer.json: ', false);
$this->outputResult($this->checkComposerSchema());
}
if ($composer) {
$config = $composer->getConfig();
} else {
$config = Factory::createConfig();
}
$config->merge(array('config' => array('secure-http' => false)));
$config->prohibitUrlByConfig('http://packagist.org', new NullIO);
$this->rfs = Factory::createRemoteFilesystem($io, $config);
$this->process = new ProcessExecutor($io);
$io->write('Checking platform settings: ', false);
$this->outputResult($this->checkPlatform());
$io->write('Checking git settings: ', false);
$this->outputResult($this->checkGit());
$io->write('Checking http connectivity to packagist: ', false);
$this->outputResult($this->checkHttp('http', $config));
$io->write('Checking https connectivity to packagist: ', false);
$this->outputResult($this->checkHttp('https', $config));
$opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
if (!empty($opts['http']['proxy'])) {
$io->write('Checking HTTP proxy: ', false);
$this->outputResult($this->checkHttpProxy());
$io->write('Checking HTTP proxy support for request_fulluri: ', false);
$this->outputResult($this->checkHttpProxyFullUriRequestParam());
$io->write('Checking HTTPS proxy support for request_fulluri: ', false);
$this->outputResult($this->checkHttpsProxyFullUriRequestParam());
}
if ($oauth = $config->get('github-oauth')) {
foreach ($oauth as $domain => $token) {
$io->write('Checking '.$domain.' oauth access: ', false);
$this->outputResult($this->checkGithubOauth($domain, $token));
}
} else {
$io->write('Checking github.com rate limit: ', false);
try {
$rate = $this->getGithubRateLimit('github.com');
$this->outputResult(true);
if (10 > $rate['remaining']) {
$io->write('<warning>WARNING</warning>');
$io->write(sprintf(
'<comment>Github has a rate limit on their API. '
. 'You currently have <options=bold>%u</options=bold> '
. 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
. 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
. ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
$rate['remaining'],
$rate['limit']
));
}
} catch (\Exception $e) {
if ($e instanceof TransportException && $e->getCode() === 401) {
$this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
} else {
$this->outputResult($e);
}
}
}
$io->write('Checking disk free space: ', false);
$this->outputResult($this->checkDiskSpace($config));
if ('phar:' === substr(__FILE__, 0, 5)) {
$io->write('Checking pubkeys: ', false);
$this->outputResult($this->checkPubKeys($config));
$io->write('Checking composer version: ', false);
$this->outputResult($this->checkVersion($config));
}
return $this->exitCode;
}
private function checkComposerSchema()
{
$validator = new ConfigValidator($this->getIO());
list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
if ($errors || $warnings) {
$messages = array(
'error' => $errors,
'warning' => $warnings,
);
$output = '';
foreach ($messages as $style => $msgs) {
foreach ($msgs as $msg) {
$output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
}
}
return rtrim($output);
}
return true;
}
private function checkGit()
{
$this->process->execute('git config color.ui', $output);
if (strtolower(trim($output)) === 'always') {
return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
}
return true;
}
private function checkHttp($proto, Config $config)
{
$disableTls = false;
$result = array();
if ($proto === 'https' && $config->get('disable-tls') === true) {
$disableTls = true;
$result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
}
if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
$result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
}
try {
$this->rfs->getContents('packagist.org', $proto . '://packagist.org/packages.json', false);
} catch (TransportException $e) {
if (false !== strpos($e->getMessage(), 'cafile')) {
$result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
$result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
$result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
} else {
array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
}
}
if (count($result) > 0) {
return $result;
}
return true;
}
private function checkHttpProxy()
{
$protocol = extension_loaded('openssl') ? 'https' : 'http';
try {
$json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://packagist.org/packages.json', false), true);
$hash = reset($json['provider-includes']);
$hash = $hash['sha256'];
$path = str_replace('%hash%', $hash, key($json['provider-includes']));
$provider = $this->rfs->getContents('packagist.org', $protocol . '://packagist.org/'.$path, false);
if (hash('sha256', $provider) !== $hash) {
return 'It seems that your proxy is modifying http traffic on the fly';
}
} catch (\Exception $e) {
return $e;
}
return true;
}
private function checkHttpProxyFullUriRequestParam()
{
$url = 'http://packagist.org/packages.json';
try {
$this->rfs->getContents('packagist.org', $url, false);
} catch (TransportException $e) {
try {
$this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
} catch (TransportException $e) {
return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
}
return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
}
return true;
}
private function checkHttpsProxyFullUriRequestParam()
{
if (!extension_loaded('openssl')) {
return 'You need the openssl extension installed for this check';
}
$url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
try {
$this->rfs->getContents('github.com', $url, false);
} catch (TransportException $e) {
try {
$this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
} catch (TransportException $e) {
return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
}
return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
}
return true;
}
private function checkGithubOauth($domain, $token)
{
$this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
try {
$url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
return $this->rfs->getContents($domain, $url, false, array(
'retry-auth-failure' => false,
)) ? true : 'Unexpected error';
} catch (\Exception $e) {
if ($e instanceof TransportException && $e->getCode() === 401) {
return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
}
return $e;
}
}
private function getGithubRateLimit($domain, $token = null)
{
if ($token) {
$this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
}
$url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
$json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
$data = json_decode($json, true);
return $data['resources']['core'];
}
private function checkDiskSpace($config)
{
$minSpaceFree = 1024 * 1024;
if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
|| (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
) {
return '<error>The disk hosting '.$dir.' is full</error>';
}
return true;
}
private function checkPubKeys($config)
{
$home = $config->get('home');
$errors = array();
$io = $this->getIO();
if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
$io->write('');
}
if (file_exists($home.'/keys.tags.pub')) {
$io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
} else {
$errors[] = '<error>Missing pubkey for tags verification</error>';
}
if (file_exists($home.'/keys.dev.pub')) {
$io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
} else {
$errors[] = '<error>Missing pubkey for dev verification</error>';
}
if ($errors) {
$errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
}
return $errors ?: true;
}
private function checkVersion($config)
{
$versionsUtil = new Versions($config, $this->rfs);
$latest = $versionsUtil->getLatest();
if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
}
return true;
}
private function outputResult($result)
{
$io = $this->getIO();
if (true === $result) {
$io->write('<info>OK</info>');
return;
}
$hadError = false;
if ($result instanceof \Exception) {
$result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
}
if (!$result) {
$hadError = true;
} else {
if (!is_array($result)) {
$result = array($result);
}
foreach ($result as $message) {
if (false !== strpos($message, '<error>')) {
$hadError = true;
}
}
}
if ($hadError) {
$io->write('<error>FAIL</error>');
$this->exitCode = 2;
} else {
$io->write('<warning>WARNING</warning>');
$this->exitCode = 1;
}
if ($result) {
foreach ($result as $message) {
$io->write($message);
}
}
}
private function checkPlatform()
{
$output = '';
$out = function ($msg, $style) use (&$output) {
$output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
};
$errors = array();
$warnings = array();
$displayIniMessage = false;
$iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
$iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
if (!function_exists('json_decode')) {
$errors['json'] = true;
}
if (!extension_loaded('Phar')) {
$errors['phar'] = true;
}
if (!extension_loaded('filter')) {
$errors['filter'] = true;
}
if (!extension_loaded('hash')) {
$errors['hash'] = true;
}
if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
$errors['iconv_mbstring'] = true;
}
if (!ini_get('allow_url_fopen')) {
$errors['allow_url_fopen'] = true;
}
if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
$errors['ioncube'] = ioncube_loader_version();
}
if (PHP_VERSION_ID < 50302) {
$errors['php'] = PHP_VERSION;
}
if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
$warnings['php'] = PHP_VERSION;
}
if (!extension_loaded('openssl')) {
$errors['openssl'] = true;
}
if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
$warnings['openssl_version'] = true;
}
if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
$warnings['apc_cli'] = true;
}
if (!extension_loaded('zlib')) {
$warnings['zlib'] = true;
}
ob_start();
phpinfo(INFO_GENERAL);
$phpinfo = ob_get_clean();
if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
$configure = $match[1];
if (false !== strpos($configure, '--enable-sigchild')) {
$warnings['sigchild'] = true;
}
if (false !== strpos($configure, '--with-curlwrappers')) {
$warnings['curlwrappers'] = true;
}
}
if (ini_get('xdebug.profiler_enabled')) {
$warnings['xdebug_profile'] = true;
} elseif (extension_loaded('xdebug')) {
$warnings['xdebug_loaded'] = true;
}
if (!empty($errors)) {
foreach ($errors as $error => $current) {
switch ($error) {
case 'json':
$text = PHP_EOL."The json extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-json";
break;
case 'phar':
$text = PHP_EOL."The phar extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-phar";
break;
case 'filter':
$text = PHP_EOL."The filter extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-filter";
break;
case 'hash':
$text = PHP_EOL."The hash extension is missing.".PHP_EOL;
$text .= "Install it or recompile php without --disable-hash";
break;
case 'iconv_mbstring':
$text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
$text .= "Install either of them or recompile php without --disable-iconv";
break;
case 'unicode':
$text = PHP_EOL."The detect