Skip to content

Instantly share code, notes, and snippets.

@stepun
Created August 2, 2013 17:58
Show Gist options
  • Save stepun/6141935 to your computer and use it in GitHub Desktop.
Save stepun/6141935 to your computer and use it in GitHub Desktop.
This gist exceeds the recommended number of files (~10). To access all files, please clone this gist.
nbproject
._*
.~lock.*
.buildpath
.DS_Store
.idea
.project
.settings
composer.lock
vendor/bin
[submodule "vendor/ZF2"]
path = vendor/ZF2
url = https://github.com/zendframework/zf2.git
<component name="ProjectDictionaryState">
<dictionary name="lesha" />
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<file url="file://$PROJECT_DIR$/module/Application/view/application/index/index.phtml" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/module/Application/view/layout/layout.phtml" charset="UTF-8" />
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" />
<component name="masterDetails">
<states>
<state key="ScopeChooserConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/sklad.test.iml" filepath="$PROJECT_DIR$/.idea/sklad.test.iml" />
</modules>
</component>
</project>
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="$MODULE_DIR$/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/zendframework/zendframework" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="PHP">
<CLASSES>
<root url="file://$MODULE_DIR$/../ZendFramework-2.2.2/library" />
</CLASSES>
<SOURCES>
<root url="file://$MODULE_DIR$/../ZendFramework-2.2.2/library" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="PHARS">
<CLASSES>
<root url="phar://$MODULE_DIR$/composer.phar" />
</CLASSES>
<SOURCES>
<root url="phar://$MODULE_DIR$/composer.phar" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Composer Vendors">
<CLASSES>
<root url="file://$MODULE_DIR$/vendor/composer" />
<root url="file://$MODULE_DIR$/vendor/zendframework/zendframework" />
</CLASSES>
<SOURCES>
<root url="file://$MODULE_DIR$/vendor/composer" />
<root url="file://$MODULE_DIR$/vendor/zendframework/zendframework" />
</SOURCES>
</library>
</orderEntry>
</component>
</module>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": ">2.2.0rc1"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "4bd58bb27858f72439ce23befb98537a",
"packages": [
{
"name": "zendframework/zendframework",
"version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zf2.git",
"reference": "release-2.2.2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zf2/zipball/release-2.2.2",
"reference": "release-2.2.2",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"replace": {
"zendframework/zend-authentication": "self.version",
"zendframework/zend-barcode": "self.version",
"zendframework/zend-cache": "self.version",
"zendframework/zend-captcha": "self.version",
"zendframework/zend-code": "self.version",
"zendframework/zend-config": "self.version",
"zendframework/zend-console": "self.version",
"zendframework/zend-crypt": "self.version",
"zendframework/zend-db": "self.version",
"zendframework/zend-debug": "self.version",
"zendframework/zend-di": "self.version",
"zendframework/zend-dom": "self.version",
"zendframework/zend-escaper": "self.version",
"zendframework/zend-eventmanager": "self.version",
"zendframework/zend-feed": "self.version",
"zendframework/zend-file": "self.version",
"zendframework/zend-filter": "self.version",
"zendframework/zend-form": "self.version",
"zendframework/zend-http": "self.version",
"zendframework/zend-i18n": "self.version",
"zendframework/zend-inputfilter": "self.version",
"zendframework/zend-json": "self.version",
"zendframework/zend-ldap": "self.version",
"zendframework/zend-loader": "self.version",
"zendframework/zend-log": "self.version",
"zendframework/zend-mail": "self.version",
"zendframework/zend-math": "self.version",
"zendframework/zend-memory": "self.version",
"zendframework/zend-mime": "self.version",
"zendframework/zend-modulemanager": "self.version",
"zendframework/zend-mvc": "self.version",
"zendframework/zend-navigation": "self.version",
"zendframework/zend-paginator": "self.version",
"zendframework/zend-permissions-acl": "self.version",
"zendframework/zend-permissions-rbac": "self.version",
"zendframework/zend-progressbar": "self.version",
"zendframework/zend-resources": "self.version",
"zendframework/zend-serializer": "self.version",
"zendframework/zend-server": "self.version",
"zendframework/zend-servicemanager": "self.version",
"zendframework/zend-session": "self.version",
"zendframework/zend-soap": "self.version",
"zendframework/zend-stdlib": "self.version",
"zendframework/zend-tag": "self.version",
"zendframework/zend-test": "self.version",
"zendframework/zend-text": "self.version",
"zendframework/zend-uri": "self.version",
"zendframework/zend-validator": "self.version",
"zendframework/zend-version": "self.version",
"zendframework/zend-view": "self.version",
"zendframework/zend-xmlrpc": "self.version"
},
"require-dev": {
"doctrine/annotations": ">=1.0",
"ircmaxell/random-lib": "dev-master",
"ircmaxell/security-lib": "dev-master",
"ocramius/proxy-manager": "0.4.*",
"phpunit/phpunit": "3.7.*"
},
"suggest": {
"doctrine/annotations": "Doctrine Annotations >=1.0 for annotation features",
"ext-intl": "ext/intl for i18n features (included in default builds of PHP)",
"ircmaxell/random-lib": "Fallback random byte generator for Zend\\Math\\Rand if OpenSSL/Mcrypt extensions are unavailable",
"ocramius/proxy-manager": "ProxyManager to handle lazy initialization of services",
"zendframework/zendpdf": "ZendPdf for creating PDF representations of barcodes",
"zendframework/zendservice-recaptcha": "ZendService\\ReCaptcha for rendering ReCaptchas in Zend\\Captcha and/or Zend\\Form"
},
"bin": [
"bin/classmap_generator.php",
"bin/pluginmap_generator.php",
"bin/templatemap_generator.php"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2-dev",
"dev-develop": "2.3-dev"
}
},
"autoload": {
"psr-0": {
"Zend\\": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Zend Framework 2",
"homepage": "http://framework.zend.com/",
"keywords": [
"framework",
"zf2"
],
"time": "2013-07-24 14:02:19"
}
],
"packages-dev": [
],
"aliases": [
],
"minimum-stability": "stable",
"stability-flags": {
"zendframework/zendframework": 5
},
"platform": {
"php": ">=5.3.3"
},
"platform-dev": [
]
}
#!/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.
*/
Phar::mapPhar('composer.phar');
define('COMPOSER_DEV_WARNING_TIME', 1367486465);
require 'phar://composer.phar/bin/composer';
__HALT_COMPILER(); ?>
:M� composer.pharsrc/bootstrap.php��ZQ��C�/�src/Composer/IO/ConsoleIO.phpV�ZQV��(��src/Composer/IO/NullIO.php�ZQ�@⋶src/Composer/IO/IOInterface.php]�ZQ]�J���src/Composer/IO/BufferIO.php*�ZQ*o%��'src/Composer/Command/ArchiveCommand.php,�ZQ,�b�� src/Composer/Command/Command.php��ZQ����I�-src/Composer/Command/CreateProjectCommand.php#�ZQ#&�o
�%src/Composer/Command/AboutCommand.php��ZQ��M�*�$src/Composer/Command/ShowCommand.php5,�ZQ5,N�:�&src/Composer/Command/UpdateCommand.php� �ZQ� �"��&src/Composer/Command/ConfigCommand.php�'�ZQ�'��/d�'src/Composer/Command/InstallCommand.php~ �ZQ~ rs:�(src/Composer/Command/ValidateCommand.phpG�ZQG�;r�'src/Composer/Command/DependsCommand.phpo �ZQo T�.r�&src/Composer/Command/SearchCommand.php��ZQ�� ��*src/Composer/Command/SelfUpdateCommand.php��ZQ���/9�'src/Composer/Command/RequireCommand.php��ZQ��f�%�,src/Composer/Command/DumpAutoloadCommand.php��ZQ���a%�,src/Composer/Command/Helper/DialogHelper.php��ZQ����&�&src/Composer/Command/StatusCommand.phpY�ZQY@f�=�$src/Composer/Command/InitCommand.php�0�ZQ�0�e�Ƕ)src/Composer/Downloader/VcsDownloader.php/�ZQ/�fr9�*src/Composer/Downloader/FileDownloader.php��ZQ�~�n9�)src/Composer/Downloader/SvnDownloader.php� �ZQ� ���0src/Composer/Downloader/PearPackageExtractor.php��ZQ�~z]B�+src/Composer/Downloader/DownloadManager.php��ZQ�ֹ�\�/src/Composer/Downloader/DownloaderInterface.php��ZQ�gs!l�.src/Composer/Downloader/TransportException.php��ZQ��8͊�*src/Composer/Downloader/PharDownloader.php��ZQ����)src/Composer/Downloader/TarDownloader.php��ZQ�͒X?�(src/Composer/Downloader/HgDownloader.php��ZQ���J�-src/Composer/Downloader/ArchiveDownloader.phpR �ZQR xaE�)src/Composer/Downloader/ZipDownloader.php
�ZQ
��p��)src/Composer/Downloader/GitDownloader.phpC.�ZQC.� O�6src/Composer/Repository/InvalidRepositoryException.phpn�ZQn��똶+src/Composer/Repository/ArrayRepository.php�
�ZQ�
a=���0src/Composer/Repository/FilesystemRepository.php4�ZQ4����7src/Composer/Repository/WritableRepositoryInterface.php[�ZQ[tMն*src/Composer/Repository/PearRepository.php�ZQb�E��-src/Composer/Repository/RepositoryManager.php��ZQ�Iy� �,src/Composer/Repository/Vcs/GitHubDriver.php+ �ZQ+ �
�X�2src/Composer/Repository/Vcs/GitBitbucketDriver.php= �ZQ= �ǎ��)src/Composer/Repository/Vcs/GitDriver.php{�ZQ{[mm�)src/Composer/Repository/Vcs/SvnDriver.php��ZQ�d���2src/Composer/Repository/Vcs/VcsDriverInterface.phpC�ZQC�F��(src/Composer/Repository/Vcs/HgDriver.php �ZQ n0���)src/Composer/Repository/Vcs/VcsDriver.phpp�ZQpf�j�1src/Composer/Repository/Vcs/HgBitbucketDriver.php� �ZQ� �+�A�4src/Composer/Repository/InstalledArrayRepository.php��ZQ�~�$ض7src/Composer/Repository/RepositorySecurityException.phpn�ZQnB_�9src/Composer/Repository/StreamableRepositoryInterface.php��ZQ�8���)src/Composer/Repository/VcsRepository.php��ZQ�0�D��.src/Composer/Repository/PlatformRepository.php�
�ZQ�
4�O�9src/Composer/Repository/InstalledFilesystemRepository.php��ZQ�V
�_�/src/Composer/Repository/CompositeRepository.php��ZQ�N]��8src/Composer/Repository/InstalledRepositoryInterface.php��ZQ��9p�.src/Composer/Repository/ComposerRepository.php`5�ZQ`5`ܢ̶/src/Composer/Repository/Pear/DependencyInfo.phpq�ZQqf�T�8src/Composer/Repository/Pear/PackageDependencyParser.php!�ZQ!=��F�,src/Composer/Repository/Pear/ChannelInfo.php��ZQ�:T*ɶ.src/Composer/Repository/Pear/ChannelReader.phpm�ZQm��N'�,src/Composer/Repository/Pear/PackageInfo.php��ZQ�� � �5src/Composer/Repository/Pear/DependencyConstraint.phpq�ZQq9=�4src/Composer/Repository/Pear/ChannelRest11Reader.php& �ZQ& �Ub�,src/Composer/Repository/Pear/ReleaseInfo.php��ZQ�o��ö2src/Composer/Repository/Pear/BaseChannelReader.php4�ZQ4D?���4src/Composer/Repository/Pear/ChannelRest10Reader.php� �ZQ� ]1޶/src/Composer/Repository/RepositoryInterface.php��ZQ��ɶ-src/Composer/Repository/PackageRepository.phpG�ZQG�:k�(src/Composer/Package/CompletePackage.php��ZQ�8Gl]�+src/Composer/Package/Dumper/ArrayDumper.phpe
�ZQe
����7src/Composer/Package/Loader/InvalidPackageException.phpE�ZQExb��*src/Composer/Package/Loader/JsonLoader.php��ZQ�!~�{�/src/Composer/Package/Loader/LoaderInterface.php��ZQ��}�ζ+src/Composer/Package/Loader/ArrayLoader.php��ZQ�6B.T�5src/Composer/Package/Loader/ValidatingArrayLoader.php�'�ZQ�'b]C�1src/Composer/Package/Loader/RootPackageLoader.php��ZQ�h!�޶src/Composer/Package/Locker.phpQ�ZQQ��׶)src/Composer/Package/PackageInterface.php��ZQ���Ỷ$src/Composer/Package/BasePackage.php6
�ZQ6
P� �.src/Composer/Package/Version/VersionParser.php%#�ZQ%#H��3�1src/Composer/Package/CompletePackageInterface.php��ZQ���2��-src/Composer/Package/RootPackageInterface.php��ZQ��,Y��$src/Composer/Package/RootPackage.php��ZQ��N3�3src/Composer/Package/Archiver/ArchiverInterface.php�ZQ����7src/Composer/Package/Archiver/ComposerExcludeFilter.php�ZQ�SZ0�.src/Composer/Package/Archiver/PharArchiver.php��ZQ���&c�3src/Composer/Package/Archiver/BaseExcludeFilter.php2�ZQ2�U�2src/Composer/Package/Archiver/GitExcludeFilter.phpw�ZQwLgU��7src/Composer/Package/Archiver/ArchivableFilesFinder.php�ZQ�"�9�0src/Composer/Package/Archiver/ArchiveManager.php� �ZQ� |�_�1src/Composer/Package/Archiver/HgExcludeFilter.php�ZQ@��.� src/Composer/Package/Package.phpt�ZQt �"��%src/Composer/Package/AliasPackage.phpG�ZQG����src/Composer/Package/Link.phpQ�ZQQ��9�7src/Composer/Package/LinkConstraint/MultiConstraint.php\�ZQ\[ }c�9src/Composer/Package/LinkConstraint/VersionConstraint.php��ZQ�)m�ζ:src/Composer/Package/LinkConstraint/SpecificConstraint.phpq�ZQq�S��?src/Composer/Package/LinkConstraint/LinkConstraintInterface.php�ZQ�����src/Composer/Cache.php� �ZQ� }�0�3src/Composer/DependencyResolver/PolicyInterface.php��ZQ�B���+src/Composer/DependencyResolver/RuleSet.php� �ZQ� Jy ��6src/Composer/DependencyResolver/SolverBugException.php��ZQ�"qN�1src/Composer/DependencyResolver/DefaultPolicy.phpW�ZQW��]��-src/Composer/DependencyResolver/Decisions.phpQ�ZQQ?��$�1src/Composer/DependencyResolver/RuleWatchNode.php��ZQ�]$�;src/Composer/DependencyResolver/SolverProblemsException.php"�ZQ"�P4F�/src/Composer/DependencyResolver/Transaction.php�ZQ��އ�@src/Composer/DependencyResolver/Operation/UninstallOperation.phpI�ZQIF��ɶ=src/Composer/DependencyResolver/Operation/UpdateOperation.phph�ZQh�S�]�Isrc/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php��ZQ�xUZa�>src/Composer/DependencyResolver/Operation/InstallOperation.phpC�ZQC�\�*�=src/Composer/DependencyResolver/Operation/SolverOperation.php��ZQ�ħݔ�Ksrc/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.php��ZQ�_iǫ�@src/Composer/DependencyResolver/Operation/OperationInterface.php��ZQ���&�(src/Composer/DependencyResolver/Pool.php�%�ZQ�%MpG�(src/Composer/DependencyResolver/Rule.php �ZQ i-��4src/Composer/DependencyResolver/RuleSetGenerator.phpO�ZQO_<�=�/src/Composer/DependencyResolver/DebugSolver.php��ZQ��ҭ��3src/Composer/DependencyResolver/RuleSetIterator.php�ZQ}���2src/Composer/DependencyResolver/RuleWatchChain.phpi�ZQih�,�*src/Composer/DependencyResolver/Solver.php�5�ZQ�5cA޶+src/Composer/DependencyResolver/Request.php��ZQ�1�I�+src/Composer/DependencyResolver/Problem.phpf�ZQf\}j�2src/Composer/DependencyResolver/RuleWatchGraph.php��ZQ��r�v�-src/Composer/Config/ConfigSourceInterface.php��ZQ�!�p�(src/Composer/Config/JsonConfigSource.php�ZQ����src/Composer/Factory.php�"�ZQ�"�E�� src/Composer/Util/Filesystem.phpI�ZQI��:�src/Composer/Util/GitHub.php� �ZQ� �K�Ŷ%src/Composer/Util/ProcessExecutor.phpq�ZQq��Ǭ�&src/Composer/Util/RemoteFilesystem.php��ZQ�u�t�*src/Composer/Util/StreamContextFactory.php3�ZQ33�<��%src/Composer/Util/ConfigValidator.php�
�ZQ�
r8��"src/Composer/Util/ErrorHandler.php�ZQ�@��+src/Composer/Util/SpdxLicenseIdentifier.php6
�ZQ6
�6�o�src/Composer/Util/Svn.phpY �ZQY ���src/Composer/Composer.php��ZQ�q� �%src/Composer/Json/JsonManipulator.php��ZQ�Z��l�src/Composer/Json/JsonFile.php��ZQ��J�߶-src/Composer/Json/JsonValidationException.php2�ZQ29b�1�src/Composer/Config.phpI�ZQI���+�src/Composer/Script/Event.phpu�ZQu7��$src/Composer/Script/ScriptEvents.php��ZQ��]��$src/Composer/Script/CommandEvent.phpo�ZQo �y�$src/Composer/Script/PackageEvent.php��ZQ�a� �'src/Composer/Script/EventDispatcher.phpO �ZQO �kB(�(src/Composer/Installer/NoopInstaller.php5�ZQ5�8qa�/src/Composer/Installer/MetapackageInstaller.php��ZQ���fζ(src/Composer/Installer/PearInstaller.php�ZQW�u�+src/Composer/Installer/ProjectInstaller.php��ZQ��Q�+src/Composer/Installer/LibraryInstaller.php��ZQ�wyZ�.src/Composer/Installer/InstallationManager.php;�ZQ;�RӶ-src/Composer/Installer/InstallerInterface.php��ZQ�HS���-src/Composer/Installer/InstallerInstaller.php
�ZQ
�m�
�$src/Composer/Console/Application.php��ZQ���n��,src/Composer/Console/HtmlOutputFormatter.php��ZQ��F��+src/Composer/Autoload/AutoloadGenerator.php8�ZQ8��{g�+src/Composer/Autoload/ClassMapGenerator.php�
�ZQ�
4&��src/Composer/Installer.php�W�ZQ�W��ks�%src/Composer/Autoload/ClassLoader.php��ZQ��JRڶres/spdx-identifier.jsoni �ZQi �R�res/composer-schema.json/<�ZQ/<�΄ �src/Composer/IO/hiddeninput.exe$�ZQ$���v�?vendor/symfony/process/Symfony/Component/Process/PhpProcess.php�ZQ8ZԷ�Evendor/symfony/process/Symfony/Component/Process/ExecutableFinder.php��ZQ� J<vendor/symfony/process/Symfony/Component/Process/Process.php�<�ZQ�<�n���Cvendor/symfony/process/Symfony/Component/Process/ProcessBuilder.php��ZQ�=�˟�Qvendor/symfony/process/Symfony/Component/Process/Exception/ExceptionInterface.phpf�ZQf]�>T�Ovendor/symfony/process/Symfony/Component/Process/Exception/RuntimeException.php��ZQ���:�Mvendor/symfony/process/Symfony/Component/Process/Exception/LogicException.php��ZQ� ���Uvendor/symfony/process/Symfony/Component/Process/Exception/ProcessFailedException.php��ZQ�{`���Wvendor/symfony/process/Symfony/Component/Process/Exception/InvalidArgumentException.php��ZQ���+_�Hvendor/symfony/process/Symfony/Component/Process/PhpExecutableFinder.php��ZQ���DE�Hvendor/symfony/console/Symfony/Component/Console/Command/HelpCommand.php �ZQ -�;�Dvendor/symfony/console/Symfony/Component/Console/Command/Command.php �ZQ E�F`�Hvendor/symfony/console/Symfony/Component/Console/Command/ListCommand.php�ZQ���^�Mvendor/symfony/console/Symfony/Component/Console/Tester/ApplicationTester.php��ZQ�6���Ivendor/symfony/console/Symfony/Component/Console/Tester/CommandTester.phpz�ZQzxU��Xvendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php�ZQyI'�Svendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyle.phpU �ZQU z���\vendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php��ZQ����=�Nvendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatter.php� �ZQ� Z�7�Wvendor/symfony/console/Symfony/Component/Console/Formatter/OutputFormatterInterface.php��ZQ�3l~��@vendor/symfony/console/Symfony/Component/Console/Application.php�L�ZQ�L��Z�Hvendor/symfony/console/Symfony/Component/Console/Input/InputArgument.php��ZQ�K]�i�@vendor/symfony/console/Symfony/Component/Console/Input/Input.php� �ZQ� ̽rٶFvendor/symfony/console/Symfony/Component/Console/Input/StringInput.php��ZQ��c���Fvendor/symfony/console/Symfony/Component/Console/Input/InputOption.php �ZQ t� �Dvendor/symfony/console/Symfony/Component/Console/Input/ArgvInput.php�ZQ�Y�Ivendor/symfony/console/Symfony/Component/Console/Input/InputInterface.php �ZQ 9��ǶEvendor/symfony/console/Symfony/Component/Console/Input/ArrayInput.php��ZQ��_�öJvendor/symfony/console/Symfony/Component/Console/Input/InputDefinition.php�%�ZQ�%��ض:vendor/symfony/console/Symfony/Component/Console/Shell.php��ZQ�n��l�Bvendor/symfony/console/Symfony/Component/Console/Output/Output.phpx�ZQx���Fvendor/symfony/console/Symfony/Component/Console/Output/NullOutput.php��ZQ��Ǣ��Rvendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutputInterface.php�ZQ���Hvendor/symfony/console/Symfony/Component/Console/Output/StreamOutput.php��ZQ�.f�Kvendor/symfony/console/Symfony/Component/Console/Output/OutputInterface.php��ZQ�.�<�Ivendor/symfony/console/Symfony/Component/Console/Output/ConsoleOutput.php;�ZQ;PF,�Kvendor/symfony/console/Symfony/Component/Console/Helper/HelperInterface.php��ZQ�=e �Kvendor/symfony/console/Symfony/Component/Console/Helper/FormatterHelper.php�ZQ{.�Evendor/symfony/console/Symfony/Component/Console/Helper/HelperSet.php��ZQ��^9t�Hvendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php[�ZQ[���Bvendor/symfony/console/Symfony/Component/Console/Helper/Helper.php9�ZQ9��Jvendor/symfony/console/Symfony/Component/Console/Helper/ProgressHelper.php|�ZQ| �9�9vendor/symfony/finder/Symfony/Component/Finder/Finder.php=�ZQ=���7vendor/symfony/finder/Symfony/Component/Finder/Glob.php �ZQ z��
�Tvendor/symfony/finder/Symfony/Component/Finder/Iterator/DepthRangeFilterIterator.phpg�ZQg�OT�Lvendor/symfony/finder/Symfony/Component/Finder/Iterator/SortableIterator.php��ZQ� H�:�Uvendor/symfony/finder/Symfony/Component/Finder/Iterator/FilecontentFilterIterator.php#�ZQ#�_VǶSvendor/symfony/finder/Symfony/Component/Finder/Iterator/SizeRangeFilterIterator.php,�ZQ,Q��m�Zvendor/symfony/finder/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php��ZQ��z`.�Jvendor/symfony/finder/Symfony/Component/Finder/Iterator/FilterIterator.php��ZQ�� ��Vvendor/symfony/finder/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php��ZQ���b�Pvendor/symfony/finder/Symfony/Component/Finder/Iterator/CustomFilterIterator.php[�ZQ[��W�Rvendor/symfony/finder/Symfony/Component/Finder/Iterator/FilenameFilterIterator.phpz�ZQzWlH�Svendor/symfony/finder/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php.�ZQ.`�i:�Rvendor/symfony/finder/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php\�ZQ\p�'��Vvendor/symfony/finder/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php7�ZQ7P�7�Lvendor/symfony/finder/Symfony/Component/Finder/Comparator/DateComparator.php&�ZQ&�hd��Nvendor/symfony/finder/Symfony/Component/Finder/Comparator/NumberComparator.phpy�ZQy"`۶Hvendor/symfony/finder/Symfony/Component/Finder/Comparator/Comparator.php��ZQ�>�]X�>vendor/symfony/finder/Symfony/Component/Finder/SplFileInfo.php��ZQ��b$��4vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>�ZQ>�q���5vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php�,�ZQ�,V�\ �0vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��ZQ�� �Y�;vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php�ZQ���Ivendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Undefined.phpx�ZQxh��q�Dvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Type.php��ZQ���+F�Fvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Schema.php��ZQ��:fM�Fvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Number.phpW�ZQW.1��Fvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Object.php��ZQ�c�Z�Svendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php$�ZQ$g��Jvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php
�ZQ
>��Jvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Collection.phpV�ZQV�<���Dvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Enum.php��ZQ�$(m��Fvendor/justinrainbow/json-schema/src/JsonSchema/Constraints/String.php��ZQ����k�=vendor/justinrainbow/json-schema/src/JsonSchema/Validator.php[�ZQ[8���vendor/autoload.php��ZQ���\��'vendor/composer/autoload_namespaces.php��ZQ���ꓶ%vendor/composer/autoload_classmap.phpZ�ZQZ�ᖶ!vendor/composer/autoload_real.php��ZQ��^��vendor/composer/ClassLoader.php�
�ZQ�
��>I� bin/composer��ZQ�ǿ췶LICENSE3�ZQ3 �2 �<?php
function includeIfExists($file)
{
if (file_exists($file)) {
return include $file;
}
}
if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
echo 'You must set up the project dependencies, run the following commands:'.PHP_EOL.
'curl -sS https://getcomposer.org/installer | php'.PHP_EOL.
'php composer.phar install'.PHP_EOL;
exit(1);
}
return $loader;
<?php
namespace Composer\IO;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\HelperSet;
class ConsoleIO implements IOInterface
{
protected $input;
protected $output;
protected $helperSet;
protected $authentications = array();
protected $lastMessage;
private $startTime;
public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
{
$this->input = $input;
$this->output = $output;
$this->helperSet = $helperSet;
}
public function enableDebugging($startTime)
{
$this->startTime = $startTime;
}
public function isInteractive()
{
return $this->input->isInteractive();
}
public function isDecorated()
{
return $this->output->isDecorated();
}
public function isVerbose()
{
return $this->output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE;
}
public function write($messages, $newline = true)
{
if (null !== $this->startTime) {
$messages = (array) $messages;
$messages[0] = sprintf(
'[%.1fMB/%.2fs] %s',
memory_get_usage() / 1024 / 1024,
microtime(true) - $this->startTime,
$messages[0]
);
}
$this->output->write($messages, $newline);
$this->lastMessage = join($newline ? "\n" : '', (array) $messages);
}
public function overwrite($messages, $newline = true, $size = null)
{
$messages = join($newline ? "\n" : '', (array) $messages);
if (!isset($size)) {
$size = strlen(strip_tags($this->lastMessage));
}
$this->write(str_repeat("\x08", $size), false);
$this->write($messages, false);
$fill = $size - strlen(strip_tags($messages));
if ($fill > 0) {
$this->write(str_repeat(' ', $fill), false);
$this->write(str_repeat("\x08", $fill), false);
}
if ($newline) {
$this->write('');
}
$this->lastMessage = $messages;
}
public function ask($question, $default = null)
{
return $this->helperSet->get('dialog')->ask($this->output, $question, $default);
}
public function askConfirmation($question, $default = true)
{
return $this->helperSet->get('dialog')->askConfirmation($this->output, $question, $default);
}
public function askAndValidate($question, $validator, $attempts = false, $default = null)
{
return $this->helperSet->get('dialog')->askAndValidate($this->output, $question, $validator, $attempts, $default);
}
public function askAndHideAnswer($question)
{
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$exe = __DIR__.'\\hiddeninput.exe';
if ('phar:' === substr(__FILE__, 0, 5)) {
$tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
copy($exe, $tmpExe);
$exe = $tmpExe;
}
$this->write($question, false);
$value = rtrim(shell_exec($exe));
$this->write('');
if (isset($tmpExe)) {
unlink($tmpExe);
}
return $value;
}
if (file_exists('/usr/bin/env')) {
$test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
$shell = $sh;
break;
}
}
if (isset($shell)) {
$this->write($question, false);
$readCmd = ($shell === 'csh') ? 'set mypassword = $<' : 'read -r mypassword';
$command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
$value = rtrim(shell_exec($command));
$this->write('');
return $value;
}
}
return $this->ask($question);
}
public function getAuthentications()
{
return $this->authentications;
}
public function hasAuthentication($repositoryName)
{
$auths = $this->getAuthentications();
return isset($auths[$repositoryName]);
}
public function getAuthentication($repositoryName)
{
$auths = $this->getAuthentications();
return isset($auths[$repositoryName]) ? $auths[$repositoryName] : array('username' => null, 'password' => null);
}
public function setAuthentication($repositoryName, $username, $password = null)
{
$this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
}
}
<?php
namespace Composer\IO;
class NullIO implements IOInterface
{
public function isInteractive()
{
return false;
}
public function isVerbose()
{
return false;
}
public function isDecorated()
{
return false;
}
public function write($messages, $newline = true)
{
}
public function overwrite($messages, $newline = true, $size = 80)
{
}
public function ask($question, $default = null)
{
return $default;
}
public function askConfirmation($question, $default = true)
{
return $default;
}
public function askAndValidate($question, $validator, $attempts = false, $default = null)
{
return $default;
}
public function askAndHideAnswer($question)
{
return null;
}
public function getAuthentications()
{
return array();
}
public function hasAuthentication($repositoryName)
{
return false;
}
public function getAuthentication($repositoryName)
{
return array('username' => null, 'password' => null);
}
public function setAuthentication($repositoryName, $username, $password = null)
{
}
}
<?php
namespace Composer\IO;
interface IOInterface
{
public function isInteractive();
public function isVerbose();
public function isDecorated();
public function write($messages, $newline = true);
public function overwrite($messages, $newline = true, $size = 80);
public function ask($question, $default = null);
public function askConfirmation($question, $default = true);
public function askAndValidate($question, $validator, $attempts = false, $default = null);
public function askAndHideAnswer($question);
public function getAuthentications();
public function hasAuthentication($repositoryName);
public function getAuthentication($repositoryName);
public function setAuthentication($repositoryName, $username, $password = null);
}
<?php
namespace Composer\IO;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Helper\HelperSet;
class BufferIO extends ConsoleIO
{
public function __construct($input = '', $verbosity = null, OutputFormatterInterface $formatter = null)
{
$input = new StringInput($input);
$input->setInteractive(false);
$output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity === null ? StreamOutput::VERBOSITY_NORMAL : $verbosity, !empty($formatter), $formatter);
parent::__construct($input, $output, new HelperSet(array()));
}
public function getOutput()
{
fseek($this->output->getStream(), 0);
$output = stream_get_contents($this->output->getStream());
$output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
$pre = strip_tags($matches[1]);
if (strlen($pre) === strlen($matches[2])) {
return '';
}
return rtrim($matches[1])."\n";
}, $output);
return $output;
}
}
<?php
namespace Composer\Command;
use Composer\Factory;
use Composer\IO\IOInterface;
use Composer\DependencyResolver\Pool;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Repository\CompositeRepository;
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 Command
{
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, 'The package version to archive'),
new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip', 'tar'),
new InputOption('dir', false, InputOption::VALUE_REQUIRED, 'Write the archive to this directory', '.'),
))
->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)
{
return $this->archive(
$this->getIO(),
$input->getArgument('package'),
$input->getArgument('version'),
$input->getOption('format'),
$input->getOption('dir')
);
}
protected function archive(IOInterface $io, $packageName = null, $version = null, $format = 'tar', $dest = '.')
{
$config = Factory::createConfig();
$factory = new Factory;
$archiveManager = $factory->createArchiveManager($config);
if ($packageName) {
$package = $this->selectPackage($io, $packageName, $version);
if (!$package) {
return 1;
}
} else {
$package = $this->getComposer()->getPackage();
}
$io->write('<info>Creating the archive.</info>');
$archiveManager->archive($package, $format, $dest);
return 0;
}
protected function selectPackage(IOInterface $io, $packageName, $version = null)
{
$io->write('<info>Searching for the specified package.</info>');
if ($composer = $this->getComposer(false)) {
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$repos = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
} else {
$defaultRepos = Factory::createDefaultRepositories($this->getIO());
$output->writeln('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
$repos = new CompositeRepository($defaultRepos);
}
$pool = new Pool();
$pool->addRepository($repos);
$constraint = ($version) ? new VersionConstraint('>=', $version) : null;
$packages = $pool->whatProvides($packageName, $constraint);
if (count($packages) > 1) {
$package = $packages[0];
$io->write('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
$io->write('Alternatives were '.implode(', ', array_map(function ($p) { return $p->getPrettyString(); }, $packages)).'.');
$io->write('<comment>Please use a more specific constraint to pick a different package.</comment>');
} elseif ($packages) {
$package = $packages[0];
$io->write('<info>Found an exact match '.$package->getPrettyString().'.</info>');
} else {
$io->write('<error>Could not find a package matching '.$packageName.'.</error>');
return false;
}
return $package;
}
}
<?php
namespace Composer\Command;
use Composer\Composer;
use Composer\Console\Application;
use Composer\IO\IOInterface;
use Composer\IO\NullIO;
use Symfony\Component\Console\Command\Command as BaseCommand;
abstract class Command extends BaseCommand
{
private $composer;
private $io;
public function getComposer($required = true)
{
if (null === $this->composer) {
$application = $this->getApplication();
if ($application instanceof Application) {
$this->composer = $application->getComposer($required);
} 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 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;
}
}
<?php
namespace Composer\Command;
use Composer\Config;
use Composer\Factory;
use Composer\Installer;
use Composer\Installer\ProjectInstaller;
use Composer\Installer\InstallationManager;
use Composer\IO\IOInterface;
use Composer\Package\BasePackage;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\Repository\ComposerRepository;
use Composer\Repository\CompositeRepository;
use Composer\Repository\FilesystemRepository;
use Composer\Repository\InstalledFilesystemRepository;
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\Util\Filesystem;
use Composer\Util\RemoteFilesystem;
use Composer\Package\Version\VersionParser;
class CreateProjectCommand extends Command
{
protected function configure()
{
$this
->setName('create-project')
->setDescription('Create new project from a package into given directory.')
->setDefinition(array(
new InputArgument('package', InputArgument::REQUIRED, 'Package name to be installed'),
new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
new InputArgument('version', InputArgument::OPTIONAL, 'Version, will defaults to latest'),
new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).', 'stable'),
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-url', null, InputOption::VALUE_REQUIRED, 'Pick a different repository url to look for the package.'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Whether to install dependencies for development.'),
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Whether to disable custom installers.'),
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('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deletion vcs folder.'),
))
->setHelp(<<<EOT
The <info>create-project</info> command creates a new project from a given
package into a new directory. 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.
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. Also, it is
advisable to install all dependencies required for development by appending the
<info>'--dev'</info> flag.
To install a package from another repository than the default one you
can pass the <info>'--repository-url=http://myrepository.org'</info> flag.
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
return $this->installProject(
$this->getIO(),
$input->getArgument('package'),
$input->getArgument('directory'),
$input->getArgument('version'),
$input->getOption('stability'),
$input->getOption('prefer-source'),
$input->getOption('prefer-dist'),
$input->getOption('dev'),
$input->getOption('repository-url'),
$input->getOption('no-custom-installers'),
$input->getOption('no-scripts'),
$input->getOption('keep-vcs'),
$input->getOption('no-progress')
);
}
public function installProject(IOInterface $io, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositoryUrl = null, $disableCustomInstallers = false, $noScripts = false, $keepVcs = false, $noProgress = false)
{
$config = Factory::createConfig();
$stability = strtolower($stability);
if ($stability === 'rc') {
$stability = 'RC';
}
if (!isset(BasePackage::$stabilities[$stability])) {
throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
}
if (null === $repositoryUrl) {
$sourceRepo = new CompositeRepository(Factory::createDefaultRepositories($io, $config));
} elseif ("json" === pathinfo($repositoryUrl, PATHINFO_EXTENSION)) {
$sourceRepo = new FilesystemRepository(new JsonFile($repositoryUrl, new RemoteFilesystem($io)));
} elseif (0 === strpos($repositoryUrl, 'http')) {
$sourceRepo = new ComposerRepository(array('url' => $repositoryUrl), $io, $config);
} else {
throw new \InvalidArgumentException("Invalid repository url given. Has to be a .json file or an http url.");
}
$parser = new VersionParser();
$candidates = array();
$requirements = $parser->parseNameVersionPairs(array($packageName));
$name = strtolower($requirements[0]['name']);
if (!$packageVersion && isset($requirements[0]['version'])) {
$packageVersion = $requirements[0]['version'];
}
$pool = new Pool($packageVersion ? 'dev' : $stability);
$pool->addRepository($sourceRepo);
$constraint = $packageVersion ? new VersionConstraint('=', $parser->normalize($packageVersion)) : null;
$candidates = $pool->whatProvides($name, $constraint);
foreach ($candidates as $key => $candidate) {
if ($candidate->getName() !== $name) {
unset($candidates[$key]);
}
}
if (!$candidates) {
throw new \InvalidArgumentException("Could not find package $name" . ($packageVersion ? " with version $packageVersion." : " with stability $stability."));
}
if (null === $directory) {
$parts = explode("/", $name, 2);
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
}
$package = $candidates[0];
foreach ($candidates as $candidate) {
if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
$package = $candidate;
}
}
unset($candidates);
$io->write('<info>Installing ' . $package->getName() . ' (' . VersionParser::formatVersion($package, false) . ')</info>');
if ($disableCustomInstallers) {
$io->write('<info>Custom installers have been disabled.</info>');
}
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();
$installedFromVcs = 'source' === $package->getInstallationSource();
$io->write('<info>Created project in ' . $directory . '</info>');
chdir($directory);
putenv('COMPOSER_ROOT_VERSION='.$package->getPrettyVersion());
unset($dm, $im, $config, $projectInstaller, $sourceRepo, $package);
$composer = Factory::create($io);
$installer = Installer::create($io, $composer);
$installer->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setDevMode($installDevPackages)
->setRunScripts( ! $noScripts);
if ($disableCustomInstallers) {
$installer->disableCustomInstallers();
}
if (!$installer->run()) {
return 1;
}
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') as $vcsName) {
$finder->name($vcsName);
}
try {
$fs = new Filesystem();
$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->write('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
}
}
return 0;
}
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 AboutCommand extends Command
{
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)
{
$output->writeln(<<<EOT
<info>Composer - Package Management for PHP</info>
<comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
See http://getcomposer.org/ for more information.</comment>
EOT
);
}
}
<?php
namespace Composer\Command;
use Composer\Composer;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\DefaultPolicy;
use Composer\Factory;
use Composer\Package\CompletePackageInterface;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Version\VersionParser;
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\Repository\ArrayRepository;
use Composer\Repository\CompositeRepository;
use Composer\Repository\ComposerRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface;
class ShowCommand extends Command
{
protected $versionParser;
protected function configure()
{
$this
->setName('show')
->setDescription('Show information about packages')
->setDefinition(array(
new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect'),
new InputArgument('version', InputArgument::OPTIONAL, 'Version to inspect'),
new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only'),
new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
))
->setHelp(<<<EOT
The show command displays detailed information about a package, or
lists all packages available.
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->versionParser = new VersionParser;
$platformRepo = new PlatformRepository;
if ($input->getOption('self')) {
$package = $this->getComposer(false)->getPackage();
$repos = $installedRepo = new ArrayRepository(array($package));
} elseif ($input->getOption('platform')) {
$repos = $installedRepo = $platformRepo;
} elseif ($input->getOption('installed')) {
$repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
} elseif ($input->getOption('available')) {
$installedRepo = $platformRepo;
if ($composer = $this->getComposer(false)) {
$repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
} else {
$defaultRepos = Factory::createDefaultRepositories($this->getIO());
$repos = new CompositeRepository($defaultRepos);
$output->writeln('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
}
} elseif ($composer = $this->getComposer(false)) {
$composer = $this->getComposer();
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
} else {
$defaultRepos = Factory::createDefaultRepositories($this->getIO());
$output->writeln('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
$installedRepo = $platformRepo;
$repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
}
if ($input->getArgument('package') || !empty($package)) {
$versions = array();
if (empty($package)) {
list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
if (!$package) {
throw new \InvalidArgumentException('Package '.$input->getArgument('package').' not found');
}
} else {
$versions = array($package->getPrettyVersion() => $package->getVersion());
}
$this->printMeta($input, $output, $package, $versions, $installedRepo, $repos);
$this->printLinks($input, $output, $package, 'requires');
$this->printLinks($input, $output, $package, 'devRequires', 'requires (dev)');
if ($package->getSuggests()) {
$output->writeln("\n<info>suggests</info>");
foreach ($package->getSuggests() as $suggested => $reason) {
$output->writeln($suggested . ' <comment>' . $reason . '</comment>');
}
}
$this->printLinks($input, $output, $package, 'provides');
$this->printLinks($input, $output, $package, 'conflicts');
$this->printLinks($input, $output, $package, 'replaces');
return;
}
$packages = array();
if ($repos instanceof CompositeRepository) {
$repos = $repos->getRepositories();
} elseif (!is_array($repos)) {
$repos = array($repos);
}
foreach ($repos as $repo) {
if ($repo === $platformRepo) {
$type = '<info>platform</info>:';
} elseif (
$repo === $installedRepo
|| ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
) {
$type = '<info>installed</info>:';
} else {
$type = '<comment>available</comment>:';
}
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
foreach ($repo->getProviderNames() as $name) {
$packages[$type][$name] = $name;
}
} else {
foreach ($repo->getPackages() as $package) {
if (!isset($packages[$type][$package->getName()])
|| !is_object($packages[$type][$package->getName()])
|| version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
) {
$packages[$type][$package->getName()] = $package;
}
}
}
}
$tree = !$input->getOption('platform') && !$input->getOption('installed') && !$input->getOption('available');
$indent = $tree ? ' ' : '';
foreach (array('<info>platform</info>:' => true, '<comment>available</comment>:' => false, '<info>installed</info>:' => true) as $type => $showVersion) {
if (isset($packages[$type])) {
if ($tree) {
$output->writeln($type);
}
ksort($packages[$type]);
$nameLength = $versionLength = 0;
foreach ($packages[$type] as $package) {
if (is_object($package)) {
$nameLength = max($nameLength, strlen($package->getPrettyName()));
$versionLength = max($versionLength, strlen($this->versionParser->formatVersion($package)));
} else {
$nameLength = max($nameLength, $package);
}
}
list($width) = $this->getApplication()->getTerminalDimensions();
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$width--;
}
$writeVersion = !$input->getOption('name-only') && $showVersion && ($nameLength + $versionLength + 3 <= $width);
$writeDescription = !$input->getOption('name-only') && ($nameLength + ($showVersion ? $versionLength : 0) + 24 <= $width);
foreach ($packages[$type] as $package) {
if (is_object($package)) {
$output->write($indent . str_pad($package->getPrettyName(), $nameLength, ' '), false);
if ($writeVersion) {
$output->write(' ' . str_pad($this->versionParser->formatVersion($package), $versionLength, ' '), false);
}
if ($writeDescription) {
$description = strtok($package->getDescription(), "\r\n");
$remaining = $width - $nameLength - $versionLength - 4;
if (strlen($description) > $remaining) {
$description = substr($description, 0, $remaining - 3) . '...';
}
$output->write(' ' . $description);
}
} else {
$output->write($indent . $package);
}
$output->writeln('');
}
if ($tree) {
$output->writeln('');
}
}
}
}
protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
{
$name = strtolower($name);
$constraint = null;
if ($version) {
$version = $this->versionParser->normalize($version);
$constraint = new VersionConstraint('=', $version);
}
$policy = new DefaultPolicy();
$pool = new Pool('dev');
$pool->addRepository($repos);
$matchedPackage = null;
$matches = $pool->whatProvides($name, $constraint);
foreach ($matches as $index => $package) {
if ($package->getName() !== $name) {
unset($matches[$index]);
continue;
}
if (null === $version && $installedRepo->hasPackage($package)) {
$matchedPackage = $package;
}
$matches[$index] = $package->getId();
}
if (!$matchedPackage && $matches && $prefered = $policy->selectPreferedPackages($pool, array(), $matches)) {
$matchedPackage = $pool->literalToPackage($prefered[0]);
}
$versions = array();
foreach ($matches as $package) {
$package = $pool->literalToPackage($package);
$versions[$package->getPrettyVersion()] = $package->getVersion();
}
return array($matchedPackage, $versions);
}
protected function printMeta(InputInterface $input, OutputInterface $output, CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, RepositoryInterface $repos)
{
$output->writeln('<info>name</info> : ' . $package->getPrettyName());
$output->writeln('<info>descrip.</info> : ' . $package->getDescription());
$output->writeln('<info>keywords</info> : ' . join(', ', $package->getKeywords() ?: array()));
$this->printVersions($input, $output, $package, $versions, $installedRepo, $repos);
$output->writeln('<info>type</info> : ' . $package->getType());
$output->writeln('<info>license</info> : ' . implode(', ', $package->getLicense()));
$output->writeln('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
$output->writeln('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
$output->writeln('<info>names</info> : ' . implode(', ', $package->getNames()));
if ($package->getSupport()) {
$output->writeln("\n<info>support</info>");
foreach ($package->getSupport() as $type => $value) {
$output->writeln('<comment>' . $type . '</comment> : '.$value);
}
}
if ($package->getAutoload()) {
$output->writeln("\n<info>autoload</info>");
foreach ($package->getAutoload() as $type => $autoloads) {
$output->writeln('<comment>' . $type . '</comment>');
if ($type === 'psr-0') {
foreach ($autoloads as $name => $path) {
$output->writeln(($name ?: '*') . ' => ' . ($path ?: '.'));
}
} elseif ($type === 'classmap') {
$output->writeln(implode(', ', $autoloads));
}
}
if ($package->getIncludePaths()) {
$output->writeln('<comment>include-path</comment>');
$output->writeln(implode(', ', $package->getIncludePaths()));
}
}
}
protected function printVersions(InputInterface $input, OutputInterface $output, CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, RepositoryInterface $repos)
{
if ($input->getArgument('version')) {
$output->writeln('<info>version</info> : ' . $package->getPrettyVersion());
return;
}
uasort($versions, 'version_compare');
$versions = array_keys(array_reverse($versions));
if ($installedRepo->hasPackage($package)) {
$installedVersion = $package->getPrettyVersion();
$key = array_search($installedVersion, $versions);
if (false !== $key) {
$versions[$key] = '<info>* ' . $installedVersion . '</info>';
}
}
$versions = implode(', ', $versions);
$output->writeln('<info>versions</info> : ' . $versions);
}
protected function printLinks(InputInterface $input, OutputInterface $output, CompletePackageInterface $package, $linkType, $title = null)
{
$title = $title ?: $linkType;
if ($links = $package->{'get'.ucfirst($linkType)}()) {
$output->writeln("\n<info>" . $title . "</info>");
foreach ($links as $link) {
$output->writeln($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
}
}
}
}
<?php
namespace Composer\Command;
use Composer\Installer;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
class UpdateCommand extends Command
{
protected function configure()
{
$this
->setName('update')
->setDescription('Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
->setDefinition(array(
new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
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('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for sanity).'),
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Disables all custom installers.'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump')
))
->setHelp(<<<EOT
The <info>update</info> command reads the composer.json file from the
current directory, processes it, and updates, removes or installs all the
dependencies.
<info>php composer.phar update</info>
To limit the update operation to a few packages, you can list the package(s)
you want to update as such:
<info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer();
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
$io = $this->getIO();
$install = Installer::create($io, $composer);
$preferSource = false;
$preferDist = false;
switch ($composer->getConfig()->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')) {
$preferSource = $input->getOption('prefer-source');
$preferDist = $input->getOption('prefer-dist');
}
$install
->setDryRun($input->getOption('dry-run'))
->setVerbose($input->getOption('verbose'))
->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setDevMode(!$input->getOption('no-dev'))
->setRunScripts(!$input->getOption('no-scripts'))
->setOptimizeAutoloader($input->getOption('optimize-autoloader'))
->setUpdate(true)
->setUpdateWhitelist($input->getArgument('packages'))
;
if ($input->getOption('no-custom-installers')) {
$install->disableCustomInstallers();
}
return $install->run() ? 0 : 1;
}
}
<?php
namespace Composer\Command;
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;
class ConfigCommand extends Command
{
protected $config;
protected $configFile;
protected $configSource;
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('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', 'composer.json'),
new InputArgument('setting-key', null, 'Setting key'),
new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
))
->setHelp(<<<EOT
This command allows you to edit some basic composer settings in either the
local composer.json file or the global config.json file.
To edit the global config.json file:
<comment>%command.full_name% --global</comment>
To add a repository:
<comment>%command.full_name% repositories.foo vcs http://bar.com</comment>
You can add a repository to 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)
{
if ($input->getOption('global') && 'composer.json' !== $input->getOption('file')) {
throw new \RuntimeException('--file and --global can not be combined');
}
$this->config = Factory::createConfig();
$configFile = $input->getOption('global')
? ($this->config->get('home') . '/config.json')
: $input->getOption('file');
$this->configFile = new JsonFile($configFile);
$this->configSource = new JsonConfigSource($this->configFile);
if ($input->getOption('global') && !$this->configFile->exists()) {
touch($this->configFile->getPath());
$this->configFile->write(array('config' => new \ArrayObject));
chmod($this->configFile->getPath(), 0600);
}
if (!$this->configFile->exists()) {
throw new \RuntimeException('No composer.json found in the current directory');
}
}
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('editor')) {
$editor = getenv('EDITOR');
if (!$editor) {
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$editor = 'notepad';
} else {
foreach (array('vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
if (exec('which '.$candidate)) {
$editor = $candidate;
break;
}
}
}
}
system($editor . ' ' . $this->configFile->getPath() . (defined('PHP_WINDOWS_VERSION_BUILD') ? '': ' > `tty`'));
return 0;
}
if (!$input->getOption('global')) {
$this->config->merge($this->configFile->read());
}
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')) {
$data = $this->config->all();
if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
if (empty($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);
$data = $data['config'];
foreach ($bits as $bit) {
if (isset($data[$bit])) {
$data = $data[$bit];
} elseif (isset($data[implode('.', $bits)])) {
$data = $data[implode('.', $bits)];
break;
} else {
throw new \RuntimeException($settingKey.' is not defined');
}
array_shift($bits);
}
$value = $data;
} elseif (isset($data['config'][$settingKey])) {
$value = $data['config'][$settingKey];
} else {
throw new \RuntimeException($settingKey.' is not defined');
}
if (is_array($value)) {
$value = json_encode($value);
}
$output->writeln($value);
return 0;
}
$values = $input->getArgument('setting-value');
if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
if ($input->getOption('unset')) {
return $this->configSource->removeRepository($matches[1]);
}
if (2 !== count($values)) {
throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs http://bar.com');
}
return $this->configSource->addRepository($matches[1], array(
'type' => $values[0],
'url' => $values[1],
));
}
if (preg_match('/^github-oauth\.(.+)/', $settingKey, $matches)) {
if ($input->getOption('unset')) {
return $this->configSource->removeConfigSetting('github-oauth.'.$matches[1]);
}
if (1 !== count($values)) {
throw new \RuntimeException('Too many arguments, expected only one token');
}
return $this->configSource->addConfigSetting('github-oauth.'.$matches[1], $values[0]);
}
$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; }
),
'notify-on-install' => array(
$booleanValidator,
$booleanNormalizer
),
'vendor-dir' => array('is_string', function ($val) { return $val; }),
'bin-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; }
),
'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;
}
),
);
$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', 'http'))) {
return 'valid protocols include: git, https, http';
}
}
return true;
},
function ($vals) {
return $vals;
}
),
);
foreach ($uniqueConfigValues as $name => $callbacks) {
if ($settingKey === $name) {
if ($input->getOption('unset')) {
return $this->configSource->removeConfigSetting($settingKey);
}
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 $this->configSource->addConfigSetting($settingKey, $normalizer($values[0]));
}
}
foreach ($multiConfigValues as $name => $callbacks) {
if ($settingKey === $name) {
if ($input->getOption('unset')) {
return $this->configSource->removeConfigSetting($settingKey);
}
list($validator, $normalizer) = $callbacks;
if (true !== $validation = $validator($values)) {
throw new \RuntimeException(sprintf(
'%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
json_encode($values)
));
}
return $this->configSource->addConfigSetting($settingKey, $normalizer($values));
}
}
throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
}
protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
{
$origK = $k;
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);
if (substr_count($k, '.') > 1) {
$k = str_split($k, strrpos($k, '.', -2));
$k = $k[0] . '.';
} else {
$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) {
$output->writeln('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
} else {
$output->writeln('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
}
}
}
}
<?php
namespace Composer\Command;
use Composer\Installer;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class InstallCommand extends Command
{
protected function configure()
{
$this
->setName('install')
->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
->setDefinition(array(
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('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages.'),
new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages (enabled by default, only present for sanity).'),
new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'Disables all custom installers.'),
new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump')
))
->setHelp(<<<EOT
The <info>install</info> command reads the composer.lock file from
the current directory, processes it, and downloads and installs all the
libraries and dependencies outlined in that file. If the file does not
exist it will look for composer.json and do the same.
<info>php composer.phar install</info>
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer();
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
$io = $this->getIO();
$install = Installer::create($io, $composer);
$preferSource = false;
$preferDist = false;
switch ($composer->getConfig()->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')) {
$preferSource = $input->getOption('prefer-source');
$preferDist = $input->getOption('prefer-dist');
}
$install
->setDryRun($input->getOption('dry-run'))
->setVerbose($input->getOption('verbose'))
->setPreferSource($preferSource)
->setPreferDist($preferDist)
->setDevMode($input->getOption('dev'))
->setRunScripts(!$input->getOption('no-scripts'))
->setOptimizeAutoloader($input->getOption('optimize-autoloader'))
;
if ($input->getOption('no-custom-installers')) {
$install->disableCustomInstallers();
}
return $install->run() ? 0 : 1;
}
}
<?php
namespace Composer\Command;
use Composer\Util\ConfigValidator;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
class ValidateCommand extends Command
{
protected function configure()
{
$this
->setName('validate')
->setDescription('Validates a composer.json')
->setDefinition(array(
new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file', './composer.json')
))
->setHelp(<<<EOT
The validate command validates a given composer.json
EOT
);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$file = $input->getArgument('file');
if (!file_exists($file)) {
$output->writeln('<error>' . $file . ' not found.</error>');
return 1;
}
if (!is_readable($file)) {
$output->writeln('<error>' . $file . ' is not readable.</error>');
return 1;
}
$validator = new ConfigValidator($this->getIO());
list($errors, $publishErrors, $warnings) = $validator->validate($file);
if (!$errors && !$publishErrors && !$warnings) {
$output->writeln('<info>' . $file . ' is valid</info>');
} elseif (!$errors && !$publishErrors) {
$output->writeln('<info>' . $file . ' is valid, but with a few warnings</info>');
$output->writeln('<warning>See http://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
} elseif (!$errors) {
$output->writeln('<info>' . $file . ' is valid for simple usage with composer but has</info>');
$output->writeln('<info>strict errors that make it unable to be published as a package:</info>');
$output->writeln('<warning>See http://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
} else {
$output->writeln('<error>' . $file . ' is invalid, the following errors/warnings were found:</error>');
}
$messages = array(
'error' => array_merge($errors, $publishErrors),
'warning' => $warnings,
);
foreach ($messages as $style => $msgs) {
foreach ($msgs as $msg) {
$output->writeln('<' . $style . '>' . $msg . '</' . $style . '>');
}
}
return $errors || $publishErrors ? 1 : 0;
}
}
<?php
namespace Composer\Command;
use Composer\DependencyResolver\Pool;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class DependsCommand extends Command
{
protected $linkTypes = array(
'require' => array('requires', 'requires'),
'require-dev' => array('devRequires', 'requires (dev)'),
);
protected function configure()
{
$this
->setName('depends')
->setDescription('Shows which packages depend on the given package')
->setDefinition(array(
new InputArgument('package', InputArgument::REQUIRED, 'Package to inspect'),
new InputOption('link-type', '', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Link types to show (require, require-dev)', array_keys($this->linkTypes)),
))
->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)
{
$repo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
$needle = $input->getArgument('package');
$pool = new Pool();
$pool->addRepository($repo);
$packages = $pool->whatProvides($needle);
if (empty($packages)) {
throw new \InvalidArgumentException('Could not find package "'.$needle.'" in your project.');
}
$linkTypes = $this->linkTypes;
$types = array_map(function ($type) use ($linkTypes) {
$type = rtrim($type, 's');
if (!isset($linkTypes[$type])) {
throw new \InvalidArgumentException('Unexpected link type: '.$type.', valid types: '.implode(', ', array_keys($linkTypes)));
}
return $type;
}, $input->getOption('link-type'));
$messages = array();
$outputPackages = array();
foreach ($repo->getPackages() as $package) {
foreach ($types as $type) {
foreach ($package->{'get'.$linkTypes[$type][0]}() as $link) {
if ($link->getTarget() === $needle) {
if (!isset($outputPackages[$package->getName()])) {
$messages[] = '<info>'.$package->getPrettyName() . '</info> ' . $linkTypes[$type][1] . ' ' . $needle .' (<info>' . $link->getPrettyConstraint() . '</info>)';
$outputPackages[$package->getName()] = true;
}
}
}
}
}
if ($messages) {
sort($messages);
$output->writeln($messages);
} else {
$output->writeln('<info>There is no installed package depending on "'.$needle.'".</info>');
}
}
}
<?php
namespace Composer\Command;
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\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface;
use Composer\Package\CompletePackageInterface;
use Composer\Package\AliasPackage;
use Composer\Factory;
class SearchCommand extends Command
{
protected $matches;
protected $lowMatches = array();
protected $tokens;
protected $output;
protected $onlyName;
protected function configure()
{
$this
->setName('search')
->setDescription('Search for packages')
->setDefinition(array(
new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
))
->setHelp(<<<EOT
The search command searches for packages by its name
<info>php composer.phar search symfony composer</info>
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$platformRepo = new PlatformRepository;
if ($composer = $this->getComposer(false)) {
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
$repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
} else {
$defaultRepos = Factory::createDefaultRepositories($this->getIO());
$output->writeln('No composer.json found in the current directory, showing packages from ' . implode(', ', array_keys($defaultRepos)));
$installedRepo = $platformRepo;
$repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
}
$onlyName = $input->getOption('only-name');
$flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
$results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags);
foreach ($results as $result) {
$output->writeln($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
}
}
}
<?php
namespace Composer\Command;
use Composer\Composer;
use Composer\Util\RemoteFilesystem;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SelfUpdateCommand extends Command
{
protected function configure()
{
$this
->setName('self-update')
->setAliases(array('selfupdate'))
->setDescription('Updates composer.phar to the latest version.')
->setHelp(<<<EOT
The <info>self-update</info> command checks getcomposer.org for newer
versions of composer and if found, installs the latest.
<info>php composer.phar self-update</info>
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$protocol = extension_loaded('openssl') ? 'https' : 'http';
$rfs = new RemoteFilesystem($this->getIO());
$latest = trim($rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/version', false));
if (Composer::VERSION !== $latest) {
$output->writeln(sprintf("Updating to version <info>%s</info>.", $latest));
$remoteFilename = $protocol . '://getcomposer.org/composer.phar';
$localFilename = $_SERVER['argv'][0];
$tempFilename = dirname($localFilename) . '/' . basename($localFilename, '.phar').'-temp.phar';
$rfs->copy('getcomposer.org', $remoteFilename, $tempFilename);
if (!file_exists($tempFilename)) {
$output->writeln('<error>The download of the new composer version failed for an unexpected reason');
return 1;
}
try {
chmod($tempFilename, 0777 & ~umask());
$phar = new \Phar($tempFilename);
unset($phar);
rename($tempFilename, $localFilename);
} catch (\Exception $e) {
@unlink($tempFilename);
if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
throw $e;
}
$output->writeln('<error>The download is corrupted ('.$e->getMessage().').</error>');
$output->writeln('<error>Please re-run the self-update command to try again.</error>');
}
} else {
$output->writeln("<info>You are using the latest composer version.</info>");
}
}
}
<?php
namespace Composer\Command;
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\Factory;
use Composer\Installer;
use Composer\Json\JsonFile;
use Composer\Json\JsonManipulator;
class RequireCommand extends InitCommand
{
protected function configure()
{
$this
->setName('require')
->setDescription('Adds required packages to your composer.json and installs them')
->setDefinition(array(
new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Required package with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
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('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
))
->setHelp(<<<EOT
The require command adds required packages to your composer.json and installs them
If you do not want to install the new dependencies immediately you can call it with --no-update
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$file = Factory::getComposerFile();
if (!file_exists($file) && !file_put_contents($file, "{\n}\n")) {
$output->writeln('<error>'.$file.' could not be created.</error>');
return 1;
}
if (!is_readable($file)) {
$output->writeln('<error>'.$file.' is not readable.</error>');
return 1;
}
if (!is_writable($file)) {
$output->writeln('<error>'.$file.' is not writable.</error>');
return 1;
}
$dialog = $this->getHelperSet()->get('dialog');
$json = new JsonFile($file);
$composer = $json->read();
$composerBackup = file_get_contents($json->getPath());
$requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'));
$requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
$baseRequirements = array_key_exists($requireKey, $composer) ? $composer[$requireKey] : array();
$requirements = $this->formatRequirements($requirements);
if (!$this->updateFileCleanly($json, $baseRequirements, $requirements, $requireKey)) {
foreach ($requirements as $package => $version) {
$baseRequirements[$package] = $version;
}
$composer[$requireKey] = $baseRequirements;
$json->write($composer);
}
$output->writeln('<info>'.$file.' has been updated</info>');
if ($input->getOption('no-update')) {
return 0;
}
$composer = $this->getComposer();
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
$io = $this->getIO();
$install = Installer::create($io, $composer);
$install
->setVerbose($input->getOption('verbose'))
->setPreferSource($input->getOption('prefer-source'))
->setPreferDist($input->getOption('prefer-dist'))
->setDevMode(true)
->setUpdate(true)
->setUpdateWhitelist(array_keys($requirements));
;
if (!$install->run()) {
$output->writeln("\n".'<error>Installation failed, reverting '.$file.' to its original content.</error>');
file_put_contents($json->getPath(), $composerBackup);
return 1;
}
return 0;
}
private function updateFileCleanly($json, array $base, array $new, $requireKey)
{
$contents = file_get_contents($json->getPath());
$manipulator = new JsonManipulator($contents);
foreach ($new as $package => $constraint) {
if (!$manipulator->addLink($requireKey, $package, $constraint)) {
return false;
}
}
file_put_contents($json->getPath(), $manipulator->getContents());
return true;
}
protected function interact(InputInterface $input, OutputInterface $output)
{
return;
}
}
<?php
namespace Composer\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Composer\Repository\CompositeRepository;
use Symfony\Component\Console\Output\OutputInterface;
use Composer\Autoload\AutoloadGenerator;
class DumpAutoloadCommand extends Command
{
protected function configure()
{
$this
->setName('dump-autoload')
->setAliases(array('dumpautoload'))
->setDescription('Dumps the autoloader')
->setDefinition(array(
new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 packages to be loaded with classmaps too, good for production.'),
))
->setHelp(<<<EOT
<info>php composer.phar dump-autoload</info>
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>Generating autoload files</info>');
$composer = $this->getComposer();
$installationManager = $composer->getInstallationManager();
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
$package = $composer->getPackage();
$config = $composer->getConfig();
$composer->getAutoloadGenerator()->dump($config, $localRepo, $package, $installationManager, 'composer', $input->getOption('optimize'));
}
}
<?php
namespace Composer\Command\Helper;
use Symfony\Component\Console\Helper\DialogHelper as BaseDialogHelper;
class DialogHelper extends BaseDialogHelper
{
public function getQuestion($question, $default = null, $sep = ':')
{
return $default !== null ?
sprintf('<info>%s</info> [<comment>%s</comment>]%s ', $question, $default, $sep) :
sprintf('<info>%s</info>%s ', $question, $sep);
}
}
<?php
namespace Composer\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Composer\Downloader\VcsDownloader;
class StatusCommand extends Command
{
protected function configure()
{
$this
->setName('status')
->setDescription('Show a list of locally modified packages')
->setDefinition(array(
new InputOption('verbose', 'v', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
))
->setHelp(<<<EOT
The status command displays a list of dependencies that have
been modified locally.
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer();
$installedRepo = $composer->getRepositoryManager()->getLocalRepository();
$dm = $composer->getDownloadManager();
$im = $composer->getInstallationManager();
$errors = array();
foreach ($installedRepo->getPackages() as $package) {
$downloader = $dm->getDownloaderForInstalledPackage($package);
if ($downloader instanceof VcsDownloader) {
$targetDir = $im->getInstallPath($package);
if ($changes = $downloader->getLocalChanges($targetDir)) {
$errors[$targetDir] = $changes;
}
}
}
if (!$errors) {
$output->writeln('<info>No local changes</info>');
} else {
$output->writeln('<error>You have changes in the following dependencies:</error>');
}
foreach ($errors as $path => $changes) {
if ($input->getOption('verbose')) {
$indentedChanges = implode("\n", array_map(function ($line) {
return ' ' . $line;
}, explode("\n", $changes)));
$output->writeln('<info>'.$path.'</info>:');
$output->writeln($indentedChanges);
} else {
$output->writeln($path);
}
}
if ($errors && !$input->getOption('verbose')) {
$output->writeln('Use --verbose (-v) to see modified files');
}
return $errors ? 1 : 0;
}
}
<?php
namespace Composer\Command;
use Composer\Json\JsonFile;
use Composer\Factory;
use Composer\Package\BasePackage;
use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository;
use Composer\Package\Version\VersionParser;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ExecutableFinder;
class InitCommand extends Command
{
private $gitConfig;
private $repos;
public function parseAuthorString($author)
{
if (preg_match('/^(?P<name>[- \.,\w\'’]+) <(?P<email>.+?)>$/u', $author, $match)) {
if (!function_exists('filter_var') || version_compare(PHP_VERSION, '5.3.3', '<') || $match['email'] === filter_var($match['email'], FILTER_VALIDATE_EMAIL)) {
return array(
'name' => trim($match['name']),
'email' => $match['email']
);
}
}
throw new \InvalidArgumentException(
'Invalid author string. Must be in the format: '.
'John Smith <john@example.com>'
);
}
protected function configure()
{
$this
->setName('init')
->setDescription('Creates a basic composer.json file in current directory.')
->setDefinition(array(
new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
))
->setHelp(<<<EOT
The <info>init</info> command creates a basic composer.json file
in the current directory.
<info>php composer.phar init</info>
EOT
)
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$dialog = $this->getHelperSet()->get('dialog');
$whitelist = array('name', 'description', 'author', 'homepage', 'require', 'require-dev', 'stability', 'license');
$options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
if (isset($options['author'])) {
$options['authors'] = $this->formatAuthors($options['author']);
unset($options['author']);
}
if (isset($options['stability'])) {
$options['minimum-stability'] = $options['stability'];
unset($options['stability']);
}
$options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
if (array() === $options['require']) {
$options['require'] = new \stdClass;
}
if (isset($options['require-dev'])) {
$options['require-dev'] = $this->formatRequirements($options['require-dev']) ;
if (array() === $options['require-dev']) {
$options['require-dev'] = new \stdClass;
}
}
$file = new JsonFile('composer.json');
$json = $file->encode($options);
if ($input->isInteractive()) {
$output->writeln(array(
'',
$json,
''
));
if (!$dialog->askConfirmation($output, $dialog->getQuestion('Do you confirm generation', 'yes', '?'), true)) {
$output->writeln('<error>Command aborted</error>');
return 1;
}
}
$file->write($options);
if ($input->isInteractive() && is_dir('.git')) {
$ignoreFile = realpath('.gitignore');
if (false === $ignoreFile) {
$ignoreFile = realpath('.') . '/.gitignore';
}
if (!$this->hasVendorIgnore($ignoreFile)) {
$question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]?';
if ($dialog->askConfirmation($output, $question, true)) {
$this->addVendorIgnore($ignoreFile);
}
}
}
}
protected function interact(InputInterface $input, OutputInterface $output)
{
$git = $this->getGitConfig();
$dialog = $this->getHelperSet()->get('dialog');
$formatter = $this->getHelperSet()->get('formatter');
$output->writeln(array(
'',
$formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
''
));
$output->writeln(array(
'',
'This command will guide you through creating your composer.json config.',
'',
));
$cwd = realpath(".");
if (!$name = $input->getOption('name')) {
$name = basename($cwd);
$name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
$name = strtolower($name);
if (isset($git['github.user'])) {
$name = $git['github.user'] . '/' . $name;
} elseif (!empty($_SERVER['USERNAME'])) {
$name = $_SERVER['USERNAME'] . '/' . $name;
} elseif (get_current_user()) {
$name = get_current_user() . '/' . $name;
} else {
$name = $name . '/' . $name;
}
} else {
if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $name)) {
throw new \InvalidArgumentException(
'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
);
}
}
$name = $dialog->askAndValidate(
$output,
$dialog->getQuestion('Package name (<vendor>/<name>)', $name),
function ($value) use ($name) {
if (null === $value) {
return $name;
}
if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}', $value)) {
throw new \InvalidArgumentException(
'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
);
}
return $value;
}
);
$input->setOption('name', $name);
$description = $input->getOption('description') ?: false;
$description = $dialog->ask(
$output,
$dialog->getQuestion('Description', $description)
);
$input->setOption('description', $description);
if (null === $author = $input->getOption('author')) {
if (isset($git['user.name']) && isset($git['user.email'])) {
$author = sprintf('%s <%s>', $git['user.name'], $git['user.email']);
}
}
$self = $this;
$author = $dialog->askAndValidate(
$output,
$dialog->getQuestion('Author', $author),
function ($value) use ($self, $author) {
if (null === $value) {
return $author;
}
$author = $self->parseAuthorString($value);
return sprintf('%s <%s>', $author['name'], $author['email']);
}
);
$input->setOption('author', $author);
$minimumStability = $input->getOption('stability') ?: '';
$minimumStability = $dialog->askAndValidate(
$output,
$dialog->getQuestion('Minimum Stability', $minimumStability),
function ($value) use ($self, $minimumStability) {
if (null === $value) {
return $minimumStability;
}
if (!isset(BasePackage::$stabilities[$value])) {
throw new \InvalidArgumentException(
'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
implode(', ', array_keys(BasePackage::$stabilities))
);
}
return $value;
}
);
$input->setOption('stability', $minimumStability);
$license = $input->getOption('license') ?: false;
$license = $dialog->ask(
$output,
$dialog->getQuestion('License', $license)
);
$input->setOption('license', $license);
$output->writeln(array(
'',
'Define your dependencies.',
''
));
$requirements = array();
if ($dialog->askConfirmation($output, $dialog->getQuestion('Would you like to define your dependencies (require) interactively', 'yes', '?'), true)) {
$requirements = $this->determineRequirements($input, $output, $input->getOption('require'));
}
$input->setOption('require', $requirements);
$devRequirements = array();
if ($dialog->askConfirmation($output, $dialog->getQuestion('Would you like to define your dev dependencies (require-dev) interactively', 'yes', '?'), true)) {
$devRequirements = $this->determineRequirements($input, $output, $input->getOption('require-dev'));
}
$input->setOption('require-dev', $devRequirements);
}
protected function findPackages($name)
{
$packages = array();
if (!$this->repos) {
$this->repos = new CompositeRepository(array_merge(
array(new PlatformRepository),
Factory::createDefaultRepositories($this->getIO())
));
}
return $this->repos->search($name);
}
protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array())
{
$dialog = $this->getHelperSet()->get('dialog');
$prompt = $dialog->getQuestion('Search for a package', false, ':');
if ($requires) {
$requires = $this->normalizeRequirements($requires);
$result = array();
foreach ($requires as $key => $requirement) {
if (!isset($requirement['version']) && $input->isInteractive()) {
$question = $dialog->getQuestion('Please provide a version constraint for the '.$requirement['name'].' requirement');
if ($constraint = $dialog->ask($output, $question)) {
$requirement['version'] = $constraint;
}
}
if (!isset($requirement['version'])) {
throw new \InvalidArgumentException('The requirement '.$requirement['name'].' must contain a version constraint');
}
$result[] = $requirement['name'] . ' ' . $requirement['version'];
}
return $result;
}
while (null !== $package = $dialog->ask($output, $prompt)) {
$matches = $this->findPackages($package);
if (count($matches)) {
$output->writeln(array(
'',
sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
''
));
$exactMatch = null;
$choices = array();
foreach ($matches as $position => $package) {
$choices[] = sprintf(' <info>%5s</info> %s', "[$position]", $package['name']);
if ($package['name'] === $package) {
$exactMatch = true;
break;
}
}
if (!$exactMatch) {
$output->writeln($choices);
$output->writeln('');
$validator = function ($selection) use ($matches) {
if ('' === $selection) {
return false;
}
if (!is_numeric($selection) && preg_match('{^\s*(\S+)\s+(\S.*)\s*$}', $selection, $matches)) {
return $matches[1].' '.$matches[2];
}
if (!isset($matches[(int) $selection])) {
throw new \Exception('Not a valid selection');
}
$package = $matches[(int) $selection];
return $package['name'];
};
$package = $dialog->askAndValidate($output, $dialog->getQuestion('Enter package # to add, or the complete package name if it is not listed', false, ':'), $validator, 3);
}
if (false !== $package && false === strpos($package, ' ')) {
$validator = function ($input) {
$input = trim($input);
return $input ?: false;
};
$constraint = $dialog->askAndValidate($output, $dialog->getQuestion('Enter the version constraint to require', false, ':'), $validator, 3);
if (false === $constraint) {
continue;
}
$package .= ' '.$constraint;
}
if (false !== $package) {
$requires[] = $package;
}
}
}
return $requires;
}
protected function formatAuthors($author)
{
return array($this->parseAuthorString($author));
}
protected function formatRequirements(array $requirements)
{
$requires = array();
$requirements = $this->normalizeRequirements($requirements);
foreach ($requirements as $requirement) {
$requires[$requirement['name']] = $requirement['version'];
}
return $requires;
}
protected function getGitConfig()
{
if (null !== $this->gitConfig) {
return $this->gitConfig;
}
$finder = new ExecutableFinder();
$gitBin = $finder->find('git');
$cmd = new Process(sprintf('%s config -l', escapeshellarg($gitBin)));
$cmd->run();
if ($cmd->isSuccessful()) {
$this->gitConfig = array();
preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$this->gitConfig[$match[1]] = $match[2];
}
return $this->gitConfig;
}
return $this->gitConfig = array();
}
protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
{
if (!file_exists($ignoreFile)) {
return false;
}
$pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
$lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
foreach ($lines as $line) {
if (preg_match($pattern, $line)) {
return true;
}
}
return false;
}
protected function normalizeRequirements(array $requirements)
{
$parser = new VersionParser();
return $parser->parseNameVersionPairs($requirements);
}
protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
{
$contents = "";
if (file_exists($ignoreFile)) {
$contents = file_get_contents($ignoreFile);
if ("\n" !== substr($contents, 0, -1)) {
$contents .= "\n";
}
}
file_put_contents($ignoreFile, $contents . $vendor. "\n");
}
}
<?php
namespace Composer\Downloader;
use Composer\Config;
use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionParser;
use Composer\Util\ProcessExecutor;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
abstract class VcsDownloader implements DownloaderInterface
{
protected $io;
protected $config;
protected $process;
protected $filesystem;
public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
{
$this->io = $io;
$this->config = $config;
$this->process = $process ?: new ProcessExecutor;
$this->filesystem = $fs ?: new Filesystem;
}
public function getInstallationSource()
{
return 'source';
}
public function download(PackageInterface $package, $path)
{
if (!$package->getSourceReference()) {
throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
}
$this->io->write(" - Installing <info>" . $package->getName() . "</info> (<comment>" . VersionParser::formatVersion($package) . "</comment>)");
$this->filesystem->removeDirectory($path);
$this->doDownload($package, $path);
$this->io->write('');
}
public function update(PackageInterface $initial, PackageInterface $target, $path)
{
if (!$target->getSourceReference()) {
throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
}
$name = $target->getName();
if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
if ($target->getSourceType() === 'svn') {
$from = $initial->getSourceReference();
$to = $target->getSourceReference();
} else {
$from = substr($initial->getSourceReference(), 0, 7);
$to = substr($target->getSourceReference(), 0, 7);
}
$name .= ' '.$initial->getPrettyVersion();
} else {
$from = VersionParser::formatVersion($initial);
$to = VersionParser::formatVersion($target);
}
$this->io->write(" - Updating <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
$this->cleanChanges($path, true);
try {
$this->doUpdate($initial, $target, $path);
} catch (\Exception $e) {
$this->reapplyChanges($path);
throw $e;
}
$this->reapplyChanges($path);
if ($this->io->isVerbose()) {
$message = 'Pulling in changes:';
$logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
if (!trim($logs)) {
$message = 'Rolling back changes:';
$logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
}
if (trim($logs)) {
$logs = implode("\n", array_map(function ($line) {
return ' ' . $line;
}, explode("\n", $logs)));
$this->io->write(' '.$message);
$this->io->write($logs);
}
}
$this->io->write('');
}
public function remove(PackageInterface $package, $path)
{
$this->io->write(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
$this->cleanChanges($path, false);
if (!$this->filesystem->removeDirectory($path)) {
if (!defined('PHP_WINDOWS_VERSION_BUILD') || (usleep(250) && !$this->filesystem->removeDirectory($path))) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}
}
}
public function setOutputProgress($outputProgress)
{
return $this;
}
protected function cleanChanges($path, $update)
{
if (null !== $this->getLocalChanges($path)) {
throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
}
}
protected function reapplyChanges($path)
{
}
abstract protected function doDownload(PackageInterface $package, $path);
abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path);
abstract public function getLocalChanges($path);
abstract protected function getCommitLogs($fromReference, $toReference, $path);
}
<?php
namespace Composer\Downloader;
use Composer\Config;
use Composer\Cache;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionParser;
use Composer\Util\Filesystem;
use Composer\Util\GitHub;
use Composer\Util\RemoteFilesystem;
class FileDownloader implements DownloaderInterface
{
private static $cacheCollected = false;
protected $io;
protected $config;
protected $rfs;
protected $filesystem;
protected $cache;
protected $outputProgress = true;
public function __construct(IOInterface $io, Config $config, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
{
$this->io = $io;
$this->config = $config;
$this->rfs = $rfs ?: new RemoteFilesystem($io);
$this->filesystem = $filesystem ?: new Filesystem();
$this->cache = $cache;
if ($this->cache && !self::$cacheCollected && !mt_rand(0, 50)) {
$this->cache->gc($config->get('cache-ttl'), $config->get('cache-files-maxsize'));
}
self::$cacheCollected = true;
}
public function getInstallationSource()
{
return 'dist';
}
public function download(PackageInterface $package, $path)
{
$url = $package->getDistUrl();
if (!$url) {
throw new \InvalidArgumentException('The given package is missing url information');
}
$this->filesystem->ensureDirectoryExists($path);
$fileName = $this->getFileName($package, $path);
$this->io->write(" - Installing <info>" . $package->getName() . "</info> (<comment>" . VersionParser::formatVersion($package) . "</comment>)");
$processedUrl = $this->processUrl($package, $url);
$hostname = parse_url($processedUrl, PHP_URL_HOST);
if (strpos($hostname, '.github.com') === (strlen($hostname) - 11)) {
$hostname = 'github.com';
}
try {
try {
if (!$this->cache || !$this->cache->copyTo($this->getCacheKey($package), $fileName)) {
$this->rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress);
if (!$this->outputProgress) {
$this->io->write(' Downloading');
}
if ($this->cache) {
$this->cache->copyFrom($this->getCacheKey($package), $fileName);
}
} else {
$this->io->write(' Loading from cache');
}
} catch (TransportException $e) {
if (in_array($e->getCode(), array(404, 403)) && 'github.com' === $hostname && !$this->io->hasAuthentication($hostname)) {
$message = "\n".'Could not fetch '.$processedUrl.', enter your GitHub credentials '.($e->getCode() === 404 ? 'to access private repos' : 'to go over the API rate limit');
$gitHubUtil = new GitHub($this->io, $this->config, null, $this->rfs);
if (!$gitHubUtil->authorizeOAuth($hostname)
&& (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($hostname, $message))
) {
throw $e;
}
$this->rfs->copy($hostname, $processedUrl, $fileName, $this->outputProgress);
} else {
throw $e;
}
}
if (!file_exists($fileName)) {
throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
.' directory is writable and you have internet connectivity');
}
$checksum = $package->getDistSha1Checksum();
if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
}
} catch (\Exception $e) {
$this->filesystem->removeDirectory($path);
$this->clearCache($package, $path);
throw $e;
}
}
public function setOutputProgress($outputProgress)
{
$this->outputProgress = $outputProgress;
return $this;
}
protected function clearCache(PackageInterface $package, $path)
{
if ($this->cache) {
$fileName = $this->getFileName($package, $path);
$this->cache->remove($this->getCacheKey($package));
}
}
public function update(PackageInterface $initial, PackageInterface $target, $path)
{
$this->remove($initial, $path);
$this->download($target, $path);
}
public function remove(PackageInterface $package, $path)
{
$this->io->write(" - Removing <info>" . $package->getName() . "</info> (<comment>" . VersionParser::formatVersion($package) . "</comment>)");
if (!$this->filesystem->removeDirectory($path)) {
if (!defined('PHP_WINDOWS_VERSION_BUILD') || (usleep(250) && !$this->filesystem->removeDirectory($path))) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}
}
}
protected function getFileName(PackageInterface $package, $path)
{
return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
}
protected function processUrl(PackageInterface $package, $url)
{
if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
throw new \RuntimeException('You must enable the openssl extension to download files via https');
}
return $url;
}
private function getCacheKey(PackageInterface $package)
{
if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
return $package->getName().'/'.$package->getDistReference().'.'.$package->getDistType();
}
return $package->getName().'/'.$package->getVersion().'-'.$package->getDistReference().'.'.$package->getDistType();
}
}
<?php
namespace Composer\Downloader;
use Composer\Package\PackageInterface;
use Composer\Util\Svn as SvnUtil;
class SvnDownloader extends VcsDownloader
{
public function doDownload(PackageInterface $package, $path)
{
$url = $package->getSourceUrl();
$ref = $package->getSourceReference();
$this->io->write(" Checking out ".$package->getSourceReference());
$this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
}
public function doUpdate(PackageInterface $initial, PackageInterface $target, $path)
{
$url = $target->getSourceUrl();
$ref = $target->getSourceReference();
$this->io->write(" Checking out " . $ref);
$this->execute($url, "svn switch", sprintf("%s/%s", $url, $ref), $path);
}
public function getLocalChanges($path)
{
if (!is_dir($path.'/.svn')) {
return;
}
$this->process->execute('svn status --ignore-externals', $output, $path);
return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
}
protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
{
$util = new SvnUtil($baseUrl, $this->io);
try {
return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
} catch (\RuntimeException $e) {
throw new \RuntimeException(
'Package could not be downloaded, '.$e->getMessage()
);
}
}
protected function cleanChanges($path, $update)
{
if (!$changes = $this->getLocalChanges($path)) {
return;
}
if (!$this->io->isInteractive()) {
if (true === $this->config->get('discard-changes')) {
return $this->discardChanges($path);
}
return parent::cleanChanges($path, $update);
}
$changes = array_map(function ($elem) {
return ' '.$elem;
}, preg_split('{\s*\r?\n\s*}', $changes));
$this->io->write(' <error>The package has modified files:</error>');
$this->io->write(array_slice($changes, 0, 10));
if (count($changes) > 10) {
$this->io->write(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
}
while (true) {
switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
case 'y':
$this->discardChanges($path);
break 2;
case 'n':
throw new \RuntimeException('Update aborted');
case 'v':
$this->io->write($changes);
break;
case '?':
default:
$this->io->write(array(
' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
' v - view modified files',
' ? - print help',
));
break;
}
}
}
protected function getCommitLogs($fromReference, $toReference, $path)
{
$fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
$toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
$command = sprintf('cd %s && svn log -r%s:%s --incremental', escapeshellarg($path), $fromRevision, $toRevision);
if (0 !== $this->process->execute($command, $output)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
}
return $output;
}
protected function discardChanges($path)
{
if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
}
}
}
<?php
namespace Composer\Downloader;
use Composer\Util\Filesystem;
class PearPackageExtractor
{
private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
private $filesystem;
private $file;
public function __construct($file)
{
if (!is_file($file)) {
throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
}
$this->filesystem = new Filesystem();
$this->file = $file;
}
public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
{
$extractionPath = $target.'/tarball';
try {
$archive = new \PharData($this->file);
$archive->extractTo($extractionPath, null, true);
if (!is_file($this->combine($extractionPath, '/package.xml'))) {
throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
}
$fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
$this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
$this->filesystem->removeDirectory($extractionPath);
} catch (\Exception $exception) {
throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
}
}
private function copyFiles($files, $source, $target, $roles, $vars)
{
foreach ($files as $file) {
$from = $this->combine($source, $file['from']);
$to = $this->combine($target, $roles[$file['role']]);
$to = $this->combine($to, $file['to']);
$tasks = $file['tasks'];
$this->copyFile($from, $to, $tasks, $vars);
}
}
private function copyFile($from, $to, $tasks, $vars)
{
if (!is_file($from)) {
throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
}
$this->filesystem->ensureDirectoryExists(dirname($to));
if (0 == count($tasks)) {
$copied = copy($from, $to);
} else {
$content = file_get_contents($from);
$replacements = array();
foreach ($tasks as $task) {
$pattern = $task['from'];
$varName = $task['to'];
if (isset($vars[$varName])) {
if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
$replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
} else {
$replacements[$pattern] = $vars[$varName];
}
}
}
$content = strtr($content, $replacements);
$copied = file_put_contents($to, $content);
}
if (false === $copied) {
throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
}
}
private function buildCopyActions($source, array $roles, $vars)
{
$package = simplexml_load_file($this->combine($source, 'package.xml'));
if(false === $package)
throw new \RuntimeException('Package definition file is not valid.');
$packageSchemaVersion = $package['version'];
if ('1.0' == $packageSchemaVersion) {
$children = $package->release->filelist->children();
$packageName = (string) $package->name;
$packageVersion = (string) $package->release->version;
$sourceDir = $packageName . '-' . $packageVersion;
$result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
} elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
$children = $package->contents->children();
$packageName = (string) $package->name;
$packageVersion = (string) $package->version->release;
$sourceDir = $packageName . '-' . $packageVersion;
$result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
$namespaces = $package->getNamespaces();
$package->registerXPathNamespace('ns', $namespaces['']);
$releaseNodes = $package->xpath('ns:phprelease');
$this->applyRelease($result, $releaseNodes, $vars);
} else {
throw new \RuntimeException('Unsupported schema version of package definition file.');
}
return $result;
}
private function applyRelease(&$actions, $releaseNodes, $vars)
{
foreach ($releaseNodes as $releaseNode) {
$requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
if ($requiredOs && $vars['os'] != $requiredOs) {
continue;
}
if ($releaseNode->filelist) {
foreach ($releaseNode->filelist->children() as $action) {
if ('install' == $action->getName()) {
$name = (string) $action['name'];
$as = (string) $action['as'];
if (isset($actions[$name])) {
$actions[$name]['to'] = $as;
}
} elseif ('ignore' == $action->getName()) {
$name = (string) $action['name'];
unset($actions[$name]);
} else {
}
}
}
break;
}
}
private function buildSourceList10($children, $targetRoles, $source = '', $target = '', $role = null, $packageName)
{
$result = array();
foreach ($children as $child) {
if ($child->getName() == 'dir') {
$dirSource = $this->combine($source, (string) $child['name']);
$dirTarget = $child['baseinstalldir'] ? : $target;
$dirRole = $child['role'] ? : $role;
$dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
$result = array_merge($result, $dirFiles);
} elseif ($child->getName() == 'file') {
$fileRole = (string) $child['role'] ? : $role;
if (isset($targetRoles[$fileRole])) {
$fileName = (string) ($child['name'] ? : $child[0]);
$fileSource = $this->combine($source, $fileName);
$fileTarget = $this->combine((string) $child['baseinstalldir'] ? : $target, $fileName);
if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
$fileTarget = $packageName . '/' . $fileTarget;
}
$result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
}
}
}
return $result;
}
private function buildSourceList20($children, $targetRoles, $source = '', $target = '', $role = null, $packageName)
{
$result = array();
foreach ($children as $child) {
if ('dir' == $child->getName()) {
$dirSource = $this->combine($source, $child['name']);
$dirTarget = $child['baseinstalldir'] ? : $target;
$dirRole = $child['role'] ? : $role;
$dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
$result = array_merge($result, $dirFiles);
} elseif ('file' == $child->getName()) {
$fileRole = (string) $child['role'] ? : $role;
if (isset($targetRoles[$fileRole])) {
$fileSource = $this->combine($source, (string) $child['name']);
$fileTarget = $this->combine((string) ($child['baseinstalldir'] ? : $target), (string) $child['name']);
$fileTasks = array();
foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
if ('replace' == $taskNode->getName()) {
$fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
}
}
if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
$fileTarget = $packageName . '/' . $fileTarget;
}
$result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
}
}
}
return $result;
}
private function combine($left, $right)
{
return rtrim($left, '/') . '/' . ltrim($right, '/');
}
}
<?php
namespace Composer\Downloader;
use Composer\Package\PackageInterface;
use Composer\Downloader\DownloaderInterface;
use Composer\Util\Filesystem;
class DownloadManager
{
private $preferDist = false;
private $preferSource = false;
private $filesystem;
private $downloaders = array();
public function __construct($preferSource = false, Filesystem $filesystem = null)
{
$this->preferSource = $preferSource;
$this->filesystem = $filesystem ?: new Filesystem();
}
public function setPreferSource($preferSource)
{
$this->preferSource = $preferSource;
return $this;
}
public function setPreferDist($preferDist)
{
$this->preferDist = $preferDist;
return $this;
}
public function setOutputProgress($outputProgress)
{
foreach ($this->downloaders as $downloader) {
$downloader->setOutputProgress($outputProgress);
}
return $this;
}
public function setDownloader($type, DownloaderInterface $downloader)
{
$type = strtolower($type);
$this->downloaders[$type] = $downloader;
return $this;
}
public function getDownloader($type)
{
$type = strtolower($type);
if (!isset($this->downloaders[$type])) {
throw new \InvalidArgumentException('Unknown downloader type: '.$type);
}
return $this->downloaders[$type];
}
public function getDownloaderForInstalledPackage(PackageInterface $package)
{
$installationSource = $package->getInstallationSource();
if ('dist' === $installationSource) {
$downloader = $this->getDownloader($package->getDistType());
} elseif ('source' === $installationSource) {
$downloader = $this->getDownloader($package->getSourceType());
} else {
throw new \InvalidArgumentException(
'Package '.$package.' seems not been installed properly'
);
}
if ($installationSource !== $downloader->getInstallationSource()) {
throw new \LogicException(sprintf(
'Downloader "%s" is a %s type downloader and can not be used to download %s',
get_class($downloader), $downloader->getInstallationSource(), $installationSource
));
}
return $downloader;
}
public function download(PackageInterface $package, $targetDir, $preferSource = null)
{
$preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
$sourceType = $package->getSourceType();
$distType = $package->getDistType();
if ((!$package->isDev() || $this->preferDist || !$sourceType) && !($preferSource && $sourceType) && $distType) {
$package->setInstallationSource('dist');
} elseif ($sourceType) {
$package->setInstallationSource('source');
} else {
throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
}
$this->filesystem->ensureDirectoryExists($targetDir);
$downloader = $this->getDownloaderForInstalledPackage($package);
$downloader->download($package, $targetDir);
}
public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
{
$downloader = $this->getDownloaderForInstalledPackage($initial);
$installationSource = $initial->getInstallationSource();
if ('dist' === $installationSource) {
$initialType = $initial->getDistType();
$targetType = $target->getDistType();
} else {
$initialType = $initial->getSourceType();
$targetType = $target->getSourceType();
}
if ($target->isDev() && 'dist' === $installationSource) {
$downloader->remove($initial, $targetDir);
$this->download($target, $targetDir);
return;
}
if ($initialType === $targetType) {
$target->setInstallationSource($installationSource);
$downloader->update($initial, $target, $targetDir);
} else {
$downloader->remove($initial, $targetDir);
$this->download($target, $targetDir, 'source' === $installationSource);
}
}
public function remove(PackageInterface $package, $targetDir)
{
$downloader = $this->getDownloaderForInstalledPackage($package);
$downloader->remove($package, $targetDir);
}
}
<?php
namespace Composer\Downloader;
use Composer\Package\PackageInterface;
interface DownloaderInterface
{
public function getInstallationSource();
public function download(PackageInterface $package, $path);
public function update(PackageInterface $initial, PackageInterface $target, $path);
public function remove(PackageInterface $package, $path);
public function setOutputProgress($outputProgress);
}
<?php
namespace Composer\Downloader;
class TransportException extends \Exception
{
protected $headers;
public function setHeaders($headers)
{
$this->headers = $headers;
}
public function getHeaders()
{
return $this->headers;
}
}
<?php
namespace Composer\Downloader;
class PharDownloader extends ArchiveDownloader
{
protected function extract($file, $path)
{
$archive = new \Phar($file);
$archive->extractTo($path, null, true);
}
}
<?php
namespace Composer\Downloader;
class TarDownloader extends ArchiveDownloader
{
protected function extract($file, $path)
{
$archive = new \PharData($file);
$archive->extractTo($path, null, true);
}
}
<?php
namespace Composer\Downloader;
use Composer\Package\PackageInterface;
class HgDownloader extends VcsDownloader
{
public function doDownload(PackageInterface $package, $path)
{
$url = escapeshellarg($package->getSourceUrl());
$ref = escapeshellarg($package->getSourceReference());
$path = escapeshellarg($path);
$this->io->write(" Cloning ".$package->getSourceReference());
$command = sprintf('hg clone %s %s && cd %2$s && hg up %s', $url, $path, $ref);
if (0 !== $this->process->execute($command, $ignoredOutput)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
}
}
public function doUpdate(PackageInterface $initial, PackageInterface $target, $path)
{
$url = escapeshellarg($target->getSourceUrl());
$ref = escapeshellarg($target->getSourceReference());
$path = escapeshellarg($path);
$this->io->write(" Updating to ".$target->getSourceReference());
$command = sprintf('cd %s && hg pull %s && hg up %s', $path, $url, $ref);
if (0 !== $this->process->execute($command, $ignoredOutput)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
}
}
public function getLocalChanges($path)
{
if (!is_dir($path.'/.hg')) {
return;
}
$this->process->execute(sprintf('cd %s && hg st', escapeshellarg($path)), $output);
return trim($output) ?: null;
}
protected function getCommitLogs($fromReference, $toReference, $path)
{
$command = sprintf('cd %s && hg log -r %s:%s --style compact', escapeshellarg($path), $fromReference, $toReference);
if (0 !== $this->process->execute($command, $output)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
}
return $output;
}
}
<?php
namespace Composer\Downloader;
use Composer\Package\PackageInterface;
abstract class ArchiveDownloader extends FileDownloader
{
public function download(PackageInterface $package, $path)
{
parent::download($package, $path);
$fileName = $this->getFileName($package, $path);
if ($this->io->isVerbose()) {
$this->io->write(' Extracting archive');
}
$temporaryDir = sys_get_temp_dir().'/cmp'.substr(md5(time().mt_rand()), 0, 5);
try {
$this->filesystem->ensureDirectoryExists($temporaryDir);
try {
$this->extract($fileName, $temporaryDir);
} catch (\Exception $e) {
parent::clearCache($package, $path);
throw $e;
}
unlink($fileName);
$contentDir = $this->listFiles($temporaryDir);
if (1 === count($contentDir) && !is_file($contentDir[0])) {
$contentDir = $this->listFiles($contentDir[0]);
}
foreach ($contentDir as $file) {
$this->filesystem->rename($file, $path . '/' . basename($file));
}
$this->filesystem->removeDirectory($temporaryDir);
} catch (\Exception $e) {
$this->filesystem->removeDirectory($path);
$this->filesystem->removeDirectory($temporaryDir);
throw $e;
}
$this->io->write('');
}
protected function getFileName(PackageInterface $package, $path)
{
return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
}
protected function processUrl(PackageInterface $package, $url)
{
if ($package->getDistReference() && strpos($url, 'github.com')) {
if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
$url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
} elseif ($package->getDistReference() && preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
$url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
} elseif ($package->getDistReference() && preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
$url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $package->getDistReference();
}
}
if (!extension_loaded('openssl') && (0 === strpos($url, 'https:') || 0 === strpos($url, 'http://github.com'))) {
if (preg_match('{^https://api\.github\.com/repos/([^/]+/[^/]+)/(zip|tar)ball/([^/]+)$}i', $url, $match)) {
$url = 'http://nodeload.github.com/'.$match[1].'/'.$match[2].'/'.$match[3];
} elseif (preg_match('{^https://github\.com/([^/]+/[^/]+)/(zip|tar)ball/([^/]+)$}i', $url, $match)) {
$url = 'http://nodeload.github.com/'.$match[1].'/'.$match[2].'/'.$match[3];
} elseif (preg_match('{^https://github\.com/([^/]+/[^/]+)/archive/([^/]+)\.(zip|tar\.gz)$}i', $url, $match)) {
$url = 'http://nodeload.github.com/'.$match[1].'/'.$match[3].'/'.$match[2];
} else {
throw new \RuntimeException('You must enable the openssl extension to download files via https');
}
}
return parent::processUrl($package, $url);
}
abstract protected function extract($file, $path);
private function listFiles($dir)
{
$files = array_merge(glob($dir . '/.*'), glob($dir . '/*'));
return array_values(array_filter($files, function ($el) {
return basename($el) !== '.' && basename($el) !== '..';
}));
}
}
<?php
namespace Composer\Downloader;
use Composer\Config;
use Composer\Cache;
use Composer\Util\ProcessExecutor;
use Composer\IO\IOInterface;
use ZipArchive;
class ZipDownloader extends ArchiveDownloader
{
protected $process;
public function __construct(IOInterface $io, Config $config, Cache $cache = null, ProcessExecutor $process = null)
{
$this->process = $process ?: new ProcessExecutor;
parent::__construct($io, $config, $cache);
}
protected function extract($file, $path)
{
$processError = null;
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$command = 'unzip '.escapeshellarg($file).' -d '.escapeshellarg($path);
if (0 === $this->process->execute($command, $ignoredOutput)) {
return;
}
$processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
}
if (!class_exists('ZipArchive')) {
$iniPath = php_ini_loaded_file();
if ($iniPath) {
$iniMessage = 'The php.ini used by your command-line PHP is: ' . $iniPath;
} else {
$iniMessage = 'A php.ini file does not exist. You will have to create one.';
}
$error = "Could not decompress the archive, enable the PHP zip extension or install unzip.\n"
. $iniMessage . "\n" . $processError;
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$error = "Could not decompress the archive, enable the PHP zip extension.\n" . $iniMessage;
}
throw new \RuntimeException($error);
}
$zipArchive = new ZipArchive();
if (true !== ($retval = $zipArchive->open($file))) {
throw new \UnexpectedValueException($this->getErrorMessage($retval, $file));
}
if (true !== $zipArchive->extractTo($path)) {
throw new \RuntimeException("There was an error extracting the ZIP file. Corrupt file?");
}
$zipArchive->close();
}
protected function getErrorMessage($retval, $file)
{
switch ($retval) {
case ZipArchive::ER_EXISTS:
return sprintf("File '%s' already exists.", $file);
case ZipArchive::ER_INCONS:
return sprintf("Zip archive '%s' is inconsistent.", $file);
case ZipArchive::ER_INVAL:
return sprintf("Invalid argument (%s)", $file);
case ZipArchive::ER_MEMORY:
return sprintf("Malloc failure (%s)", $file);
case ZipArchive::ER_NOENT:
return sprintf("No such zip file: '%s'", $file);
case ZipArchive::ER_NOZIP:
return sprintf("'%s' is not a zip archive.", $file);
case ZipArchive::ER_OPEN:
return sprintf("Can't open zip file: %s", $file);
case ZipArchive::ER_READ:
return sprintf("Zip read error (%s)", $file);
case ZipArchive::ER_SEEK:
return sprintf("Zip seek error (%s)", $file);
default:
return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
}
}
}
<?php
namespace Composer\Downloader;
use Composer\Package\PackageInterface;
use Composer\Util\GitHub;
class GitDownloader extends VcsDownloader
{
private $hasStashedChanges = false;
public function doDownload(PackageInterface $package, $path)
{
$ref = $package->getSourceReference();
$command = 'git clone %s %s && cd %2$s && git remote add composer %1$s && git fetch composer';
$this->io->write(" Cloning ".$ref);
putenv('GIT_ASKPASS=echo');
$commandCallable = function($url) use ($ref, $path, $command) {
return sprintf($command, escapeshellarg($url), escapeshellarg($path), escapeshellarg($ref));
};
$this->runCommand($commandCallable, $package->getSourceUrl(), $path);
$this->setPushUrl($package, $path);
$this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate());
}
public function doUpdate(PackageInterface $initial, PackageInterface $target, $path)
{
$ref = $target->getSourceReference();
$this->io->write(" Checking out ".$ref);
$command = 'cd %s && git remote set-url composer %s && git fetch composer && git fetch --tags composer';
$this->process->execute(sprintf('cd %s && git remote -v', escapeshellarg($path)), $output);
if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match)) {
$this->io->setAuthentication($match[3], urldecode($match[1]), urldecode($match[2]));
}
putenv('GIT_ASKPASS=echo');
$commandCallable = function($url) use ($ref, $path, $command) {
return sprintf($command, escapeshellarg($path), escapeshellarg($url), escapeshellarg($ref));
};
$this->runCommand($commandCallable, $target->getSourceUrl());
$this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate());
}
public function getLocalChanges($path)
{
if (!is_dir($path.'/.git')) {
return;
}
$command = sprintf('cd %s && git status --porcelain --untracked-files=no', escapeshellarg($path));
if (0 !== $this->process->execute($command, $output)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
}
return trim($output) ?: null;
}
protected function cleanChanges($path, $update)
{
if (!$changes = $this->getLocalChanges($path)) {
return;
}
if (!$this->io->isInteractive()) {
$discardChanges = $this->config->get('discard-changes');
if (true === $discardChanges) {
return $this->discardChanges($path);
}
if ('stash' === $discardChanges) {
if (!$update) {
return parent::cleanChanges($path, $update);
}
return $this->stashChanges($path);
}
return parent::cleanChanges($path, $update);
}
$changes = array_map(function ($elem) {
return ' '.$elem;
}, preg_split('{\s*\r?\n\s*}', $changes));
$this->io->write(' <error>The package has modified files:</error>');
$this->io->write(array_slice($changes, 0, 10));
if (count($changes) > 10) {
$this->io->write(' <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
}
while (true) {
switch ($this->io->ask(' <info>Discard changes [y,n,v,'.($update ? 's,' : '').'?]?</info> ', '?')) {
case 'y':
$this->discardChanges($path);
break 2;
case 's':
if (!$update) {
goto help;
}
$this->stashChanges($path);
break 2;
case 'n':
throw new \RuntimeException('Update aborted');
case 'v':
$this->io->write($changes);
break;
case '?':
default:
help:
$this->io->write(array(
' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
' v - view modified files',
));
if ($update) {
$this->io->write(' s - stash changes and try to reapply them after the update');
}
$this->io->write(' ? - print help');
break;
}
}
}
protected function reapplyChanges($path)
{
if ($this->hasStashedChanges) {
$this->hasStashedChanges = false;
$this->io->write(' <info>Re-applying stashed changes');
if (0 !== $this->process->execute('git stash pop', $output, $path)) {
throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
}
}
}
protected function updateToCommit($path, $reference, $branch, $date)
{
$template = 'git checkout %s && git reset --hard %1$s';
$branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
$branches = null;
if (0 === $this->process->execute('git branch -r', $output, $path)) {
$branches = $output;
}
$gitRef = $reference;
if (!preg_match('{^[a-f0-9]{40}$}', $reference)
&& $branches
&& preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $output)
) {
$command = sprintf('git checkout -B %s %s && git reset --hard %2$s', escapeshellarg($branch), escapeshellarg('composer/'.$reference));
if (0 === $this->process->execute($command, $output, $path)) {
return;
}
}
if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
$branch = 'v' . $branch;
}
$command = sprintf('git checkout %s', escapeshellarg($branch));
$fallbackCommand = sprintf('git checkout -B %s %s', escapeshellarg($branch), escapeshellarg('composer/'.$branch));
if (0 === $this->process->execute($command, $output, $path)
|| 0 === $this->process->execute($fallbackCommand, $output, $path)
) {
$command = sprintf('git reset --hard %s', escapeshellarg($reference));
if (0 === $this->process->execute($command, $output, $path)) {
return;
}
}
}
$command = sprintf($template, escapeshellarg($gitRef));
if (0 === $this->process->execute($command, $output, $path)) {
return;
}
if ($date && false !== strpos($this->process->getErrorOutput(), $reference)) {
$date = $date->format('U');
$command = 'git branch -r';
if (0 !== $this->process->execute($command, $output, $path)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
}
$guessTemplate = 'git log --until=%s --date=raw -n1 --pretty=%%H %s';
foreach ($this->process->splitLines($output) as $line) {
if (preg_match('{^composer/'.preg_quote($branch).'(?:\.x)?$}i', trim($line))) {
if (0 === $this->process->execute(sprintf($guessTemplate, $date, escapeshellarg(trim($line))), $output, $path)) {
$newReference = trim($output);
}
break;
}
}
if (empty($newReference)) {
if (0 !== $this->process->execute(sprintf($guessTemplate, $date, '--all'), $output, $path)) {
throw new \RuntimeException('Failed to execute ' . $this->sanitizeUrl($command) . "\n\n" . $this->process->getErrorOutput());
}
$newReference = trim($output);
}
$command = sprintf($template, escapeshellarg($reference));
if (0 === $this->process->execute($command, $output, $path)) {
$this->io->write(' '.$reference.' is gone (history was rewritten?), recovered by checking out '.$newReference);
return;
}
}
throw new \RuntimeException('Failed to execute ' . $this->sanitizeUrl($command) . "\n\n" . $this->process->getErrorOutput());
}
protected function runCommand($commandCallable, $url, $path = null)
{
$handler = array($this, 'outputHandler');
if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
throw new \InvalidArgumentException('The source URL '.$url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
}
if (preg_match('{^(?:https?|git)(://github.com/.*)}', $url, $match)) {
$protocols = $this->config->get('github-protocols');
if (!is_array($protocols)) {
throw new \RuntimeException('Config value "github-protocols" must be an array, got '.gettype($protocols));
}
$messages = array();
foreach ($protocols as $protocol) {
$url = $protocol . $match[1];
if (0 === $this->process->execute(call_user_func($commandCallable, $url), $handler)) {
return;
}
$messages[] = '- ' . $url . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
if (null !== $path) {
$this->filesystem->removeDirectory($path);
}
}
$this->throwException('Failed to clone ' . $this->sanitizeUrl($url) .' via git, https and http protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
}
$command = call_user_func($commandCallable, $url);
if (0 !== $this->process->execute($command, $handler)) {
if (preg_match('{^git@(github.com):(.+?)\.git$}i', $url, $match)) {
if (!$this->io->hasAuthentication($match[1])) {
$gitHubUtil = new GitHub($this->io, $this->config, $this->process);
$message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
$gitHubUtil->authorizeOAuthInteractively($match[1], $message);
}
}
if ($this->io->hasAuthentication($match[1])) {
$auth = $this->io->getAuthentication($match[1]);
$url = 'https://'.urlencode($auth['username']) . ':' . urlencode($auth['password']) . '@'.$match[1].'/'.$match[2].'.git';
$command = call_user_func($commandCallable, $url);
if (0 === $this->process->execute($command, $handler)) {
return;
}
}
} elseif (
$this->io->isInteractive() &&
preg_match('{(https?://)([^/]+)(.*)$}i', $url, $match) &&
strpos($this->process->getErrorOutput(), 'fatal: Authentication failed') !== false
) {
if ($this->io->hasAuthentication($match[2])) {
$auth = $this->io->getAuthentication($match[2]);
} else {
$this->io->write($url.' requires Authentication');
$auth = array(
'username' => $this->io->ask('Username: '),
'password' => $this->io->askAndHideAnswer('Password: '),
);
}
$url = $match[1].urlencode($auth['username']).':'.urlencode($auth['password']).'@'.$match[2].$match[3];
$command = call_user_func($commandCallable, $url);
if (0 === $this->process->execute($command, $handler)) {
$this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
return;
}
}
if (null !== $path) {
$this->filesystem->removeDirectory($path);
}
$this->throwException('Failed to execute ' . $this->sanitizeUrl($command) . "\n\n" . $this->process->getErrorOutput(), $url);
}
}
public function outputHandler($type, $buffer)
{
if ($type !== 'out') {
return;
}
if ($this->io->isVerbose()) {
$this->io->write($buffer, false);
}
}
protected function throwException($message, $url)
{
if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
throw new \RuntimeException('Failed to clone '.$this->sanitizeUrl($url).', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
throw new \RuntimeException($message);
}
protected function sanitizeUrl($message)
{
return preg_replace('{://(.+?):.+?@}', '://$1:***@', $message);
}
protected function setPushUrl(PackageInterface $package, $path)
{
if (preg_match('{^(?:https?|git)://github.com/([^/]+)/([^/]+?)(?:\.git)?$}', $package->getSourceUrl(), $match)) {
$pushUrl = 'git@github.com:'.$match[1].'/'.$match[2].'.git';
$cmd = sprintf('git remote set-url --push origin %s', escapeshellarg($pushUrl));
$this->process->execute($cmd, $ignoredOutput, $path);
}
}
protected function getCommitLogs($fromReference, $toReference, $path)
{
$command = sprintf('cd %s && git log %s..%s --pretty=format:"%%h - %%an: %%s"', escapeshellarg($path), $fromReference, $toReference);
if (0 !== $this->process->execute($command, $output)) {
throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
}
return $output;
}
protected function discardChanges($path)
{
if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
}
}
protected function stashChanges($path)
{
if (0 !== $this->process->execute('git stash', $output, $path)) {
throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
}
$this->hasStashedChanges = true;
}
}
<?php
namespace Composer\Repository;
class InvalidRepositoryException extends \Exception
{
}
<?php
namespace Composer\Repository;
use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionParser;
class ArrayRepository implements RepositoryInterface
{
protected $packages;
public function __construct(array $packages = array())
{
foreach ($packages as $package) {
$this->addPackage($package);
}
}
public function findPackage($name, $version)
{
$versionParser = new VersionParser();
$version = $versionParser->normalize($version);
$name = strtolower($name);
foreach ($this->getPackages() as $package) {
if ($name === $package->getName() && $version === $package->getVersion()) {
return $package;
}
}
}
public function findPackages($name, $version = null)
{
$name = strtolower($name);
if (null !== $version) {
$versionParser = new VersionParser();
$version = $versionParser->normalize($version);
}
$packages = array();
foreach ($this->getPackages() as $package) {
if ($package->getName() === $name && (null === $version || $version === $package->getVersion())) {
$packages[] = $package;
}
}
return $packages;
}
public function search($query, $mode = 0)
{
$regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
$matches = array();
foreach ($this->getPackages() as $package) {
if (preg_match($regex, $package->getName())) {
$matches[] = array(
'name' => $package->getName(),
'description' => $package->getDescription(),
);
}
}
return $matches;
}
public function hasPackage(PackageInterface $package)
{
$packageId = $package->getUniqueName();
foreach ($this->getPackages() as $repoPackage) {
if ($packageId === $repoPackage->getUniqueName()) {
return true;
}
}
return false;
}
public function addPackage(PackageInterface $package)
{
if (null === $this->packages) {
$this->initialize();
}
$package->setRepository($this);
$this->packages[] = $package;
if ($package->getAlias()) {
$alias = $this->createAliasPackage($package);
if (!$this->hasPackage($alias)) {
$this->addPackage($alias);
}
}
}
protected function createAliasPackage(PackageInterface $package, $alias = null, $prettyAlias = null)
{
return new AliasPackage($package, $alias ?: $package->getAlias(), $prettyAlias ?: $package->getPrettyAlias());
}
public function removePackage(PackageInterface $package)
{
$packageId = $package->getUniqueName();
foreach ($this->getPackages() as $key => $repoPackage) {
if ($packageId === $repoPackage->getUniqueName()) {
array_splice($this->packages, $key, 1);
return;
}
}
}
public function getPackages()
{
if (null === $this->packages) {
$this->initialize();
}
return $this->packages;
}
public function count()
{
return count($this->packages);
}
protected function initialize()
{
$this->packages = array();
}
}
<?php
namespace Composer\Repository;
use Composer\Json\JsonFile;
use Composer\Package\AliasPackage;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper;
class FilesystemRepository extends ArrayRepository implements WritableRepositoryInterface
{
private $file;
public function __construct(JsonFile $repositoryFile)
{
$this->file = $repositoryFile;
}
protected function initialize()
{
parent::initialize();
if (!$this->file->exists()) {
return;
}
try {
$packages = $this->file->read();
if (!is_array($packages)) {
throw new \UnexpectedValueException('Could not parse package list from the repository');
}
} catch (\Exception $e) {
throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
}
$loader = new ArrayLoader();
foreach ($packages as $packageData) {
$package = $loader->load($packageData);
$this->addPackage($package);
}
}
public function reload()
{
$this->packages = null;
$this->initialize();
}
public function write()
{
$packages = array();
$dumper = new ArrayDumper();
foreach ($this->getPackages() as $package) {
if (!$package instanceof AliasPackage) {
$data = $dumper->dump($package);
$packages[] = $data;
}
}
$this->file->write($packages);
}
}
<?php
namespace Composer\Repository;
use Composer\Package\PackageInterface;
interface WritableRepositoryInterface extends RepositoryInterface
{
public function write();
public function addPackage(PackageInterface $package);
public function removePackage(PackageInterface $package);
public function reload();
}
<?php
namespace Composer\Repository;
use Composer\IO\IOInterface;
use Composer\Package\Version\VersionParser;
use Composer\Repository\Pear\ChannelReader;
use Composer\Package\CompletePackage;
use Composer\Repository\Pear\ChannelInfo;
use Composer\Package\Link;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Util\RemoteFilesystem;
use Composer\Config;
class PearRepository extends ArrayRepository
{
private $url;
private $io;
private $rfs;
private $versionParser;
private $vendorAlias;
public function __construct(array $repoConfig, IOInterface $io, Config $config, RemoteFilesystem $rfs = null)
{
if (!preg_match('{^https?://}', $repoConfig['url'])) {
$repoConfig['url'] = 'http://'.$repoConfig['url'];
}
$urlBits = parse_url($repoConfig['url']);
if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
}
$this->url = rtrim($repoConfig['url'], '/');
$this->io = $io;
$this->rfs = $rfs ?: new RemoteFilesystem($this->io);
$this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
$this->versionParser = new VersionParser();
}
protected function initialize()
{
parent::initialize();
$this->io->write('Initializing PEAR repository '.$this->url);
$reader = new ChannelReader($this->rfs);
try {
$channelInfo = $reader->read($this->url);
} catch (\Exception $e) {
$this->io->write('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
return;
}
$packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
foreach ($packages as $package) {
$this->addPackage($package);
}
}
private function buildComposerPackages(ChannelInfo $channelInfo, VersionParser $versionParser)
{
$result = array();
foreach ($channelInfo->getPackages() as $packageDefinition) {
foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
try {
$normalizedVersion = $versionParser->normalize($version);
} catch (\UnexpectedValueException $e) {
if ($this->io->isVerbose()) {
$this->io->write('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage());
}
continue;
}
$composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
$urlBits = parse_url($this->url);
$scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
$distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
$requires = array();
$suggests = array();
$conflicts = array();
$replaces = array();
if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
$composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
$aliasConstraint = new VersionConstraint('==', $normalizedVersion);
$replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
}
if (!empty($this->vendorAlias)
&& ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
) {
$composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
$aliasConstraint = new VersionConstraint('==', $normalizedVersion);
$replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
}
foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
$dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
$constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
$link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
switch ($dependencyConstraint->getType()) {
case 'required':
$requires[] = $link;
break;
case 'conflicts':
$conflicts[] = $link;
break;
case 'replaces':
$replaces[] = $link;
break;
}
}
foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
foreach ($dependencyConstraints as $dependencyConstraint) {
$dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
$suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
}
}
$package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
$package->setType('pear-library');
$package->setDescription($packageDefinition->getDescription());
$package->setDistType('file');
$package->setDistUrl($distUrl);
$package->setAutoload(array('classmap' => array('')));
$package->setIncludePaths(array('/'));
$package->setRequires($requires);
$package->setConflicts($conflicts);
$package->setSuggests($suggests);
$package->setReplaces($replaces);
$result[] = $package;
}
}
return $result;
}
private function buildComposerPackageName($channelName, $packageName)
{
if ('php' === $channelName) {
return "php";
}
if ('ext' === $channelName) {
return "ext-{$packageName}";
}
return "pear-{$channelName}/{$packageName}";
}
}
<?php
namespace Composer\Repository;
use Composer\IO\IOInterface;
use Composer\Config;
class RepositoryManager
{
private $localRepository;
private $repositories = array();
private $repositoryClasses = array();
private $io;
private $config;
public function __construct(IOInterface $io, Config $config)
{
$this->io = $io;
$this->config = $config;
}
public function findPackage($name, $version)
{
foreach ($this->repositories as $repository) {
if ($package = $repository->findPackage($name, $version)) {
return $package;
}
}
}
public function findPackages($name, $version)
{
$packages = array();
foreach ($this->repositories as $repository) {
$packages = array_merge($packages, $repository->findPackages($name, $version));
}
return $packages;
}
public function addRepository(RepositoryInterface $repository)
{
$this->repositories[] = $repository;
}
public function createRepository($type, $config)
{
if (!isset($this->repositoryClasses[$type])) {
throw new \InvalidArgumentException('Repository type is not registered: '.$type);
}
$class = $this->repositoryClasses[$type];
return new $class($config, $this->io, $this->config);
}
public function setRepositoryClass($type, $class)
{
$this->repositoryClasses[$type] = $class;
}
public function getRepositories()
{
return $this->repositories;
}
public function setLocalRepository(RepositoryInterface $repository)
{
$this->localRepository = $repository;
}
public function getLocalRepository()
{
return $this->localRepository;
}
public function getLocalRepositories()
{
trigger_error('This method is deprecated, use getLocalRepository instead since the getLocalDevRepository is now gone', E_USER_DEPRECATED);
return array($this->localRepository);
}
}
<?php
namespace Composer\Repository\Vcs;
use Composer\Downloader\TransportException;
use Composer\Json\JsonFile;
use Composer\Cache;
use Composer\IO\IOInterface;
use Composer\Util\RemoteFilesystem;
use Composer\Util\GitHub;
class GitHubDriver extends VcsDriver
{
protected $cache;
protected $owner;
protected $repository;
protected $tags;
protected $branches;
protected $rootIdentifier;
protected $hasIssues;
protected $infoCache = array();
protected $isPrivate = false;
protected $gitDriver;
public function initialize()
{
preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $this->url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
$this->originUrl = 'github.com';
$this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
$this->fetchRootIdentifier();
}
public function getRootIdentifier()
{
if ($this->gitDriver) {
return $this->gitDriver->getRootIdentifier();
}
return $this->rootIdentifier;
}
public function getUrl()
{
if ($this->gitDriver) {
return $this->gitDriver->getUrl();
}
return 'https://github.com/'.$this->owner.'/'.$this->repository.'.git';
}
public function getSource($identifier)
{
if ($this->gitDriver) {
return $this->gitDriver->getSource($identifier);
}
$label = array_search($identifier, $this->getTags()) ?: $identifier;
if ($this->isPrivate) {
$url = $this->generateSshUrl();
} else {
$url = $this->getUrl();
}
return array('type' => 'git', 'url' => $url, 'reference' => $label);
}
public function getDist($identifier)
{
if ($this->gitDriver) {
return $this->gitDriver->getDist($identifier);
}
$label = array_search($identifier, $this->getTags()) ?: $identifier;
$url = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$label;
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
}
public function getComposerInformation($identifier)
{
if ($this->gitDriver) {
return $this->gitDriver->getComposerInformation($identifier);
}
if (preg_match('{[a-f0-9]{40}}i', $identifier) && $res = $this->cache->read($identifier)) {
$this->infoCache[$identifier] = JsonFile::parseJson($res);
}
if (!isset($this->infoCache[$identifier])) {
try {
$resource = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/contents/composer.json?ref='.urlencode($identifier);
$composer = JsonFile::parseJson($this->getContents($resource));
if (empty($composer['content']) || $composer['encoding'] !== 'base64' || !($composer = base64_decode($composer['content']))) {
throw new \RuntimeException('Could not retrieve composer.json from '.$resource);
}
} catch (TransportException $e) {
if (404 !== $e->getCode()) {
throw $e;
}
$composer = false;
}
if ($composer) {
$composer = JsonFile::parseJson($composer, $resource);
if (!isset($composer['time'])) {
$resource = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
$commit = JsonFile::parseJson($this->getContents($resource), $resource);
$composer['time'] = $commit['commit']['committer']['date'];
}
if (!isset($composer['support']['source'])) {
$label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
$composer['support']['source'] = sprintf('https://github.com/%s/%s/tree/%s', $this->owner, $this->repository, $label);
}
if (!isset($composer['support']['issues']) && $this->hasIssues) {
$composer['support']['issues'] = sprintf('https://github.com/%s/%s/issues', $this->owner, $this->repository);
}
}
if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
$this->cache->write($identifier, json_encode($composer));
}
$this->infoCache[$identifier] = $composer;
}
return $this->infoCache[$identifier];
}
public function getTags()
{
if ($this->gitDriver) {
return $this->gitDriver->getTags();
}
if (null === $this->tags) {
$resource = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/tags';
$tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
$this->tags = array();
foreach ($tagsData as $tag) {
$this->tags[$tag['name']] = $tag['commit']['sha'];
}
}
return $this->tags;
}
public function getBranches()
{
if ($this->gitDriver) {
return $this->gitDriver->getBranches();
}
if (null === $this->branches) {
$resource = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads';
$branchData = JsonFile::parseJson($this->getContents($resource), $resource);
$this->branches = array();
foreach ($branchData as $branch) {
$name = substr($branch['ref'], 11);
$this->branches[$name] = $branch['object']['sha'];
}
}
return $this->branches;
}
public static function supports(IOInterface $io, $url, $deep = false)
{
if (!preg_match('#^((?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url)) {
return false;
}
if (!extension_loaded('openssl')) {
if ($io->isVerbose()) {
$io->write('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.');
}
return false;
}
return true;
}
protected function generateSshUrl()
{
return 'git@github.com:'.$this->owner.'/'.$this->repository.'.git';
}
protected function getContents($url, $fetchingRepoData = false)
{
try {
return parent::getContents($url);
} catch (TransportException $e) {
$gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
switch ($e->getCode()) {
case 401:
case 404:
if (!$fetchingRepoData) {
throw $e;
}
if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
return parent::getContents($url);
}
if (!$this->io->isInteractive()) {
return $this->attemptCloneFallback();
}
$gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
return parent::getContents($url);
case 403:
if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
return parent::getContents($url);
}
if (!$this->io->isInteractive() && $fetchingRepoData) {
return $this->attemptCloneFallback();
}
$rateLimited = false;
foreach ($e->getHeaders() as $header) {
if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
$rateLimited = true;
}
}
if (!$this->io->hasAuthentication($this->originUrl)) {
if (!$this->io->isInteractive()) {
$this->io->write('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
throw $e;
}
$gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
return parent::getContents($url);
}
if ($rateLimited) {
$this->io->write('<error>GitHub API limit exhausted. You are already authorized so you will have to wait a while before doing more requests</error>');
}
throw $e;
default:
throw $e;
}
}
}
protected function fetchRootIdentifier()
{
$repoDataUrl = 'https://api.github.com/repos/'.$this->owner.'/'.$this->repository;
$repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
if (null === $repoData && null !== $this->gitDriver) {
return;
}
$this->isPrivate = !empty($repoData['private']);
if (isset($repoData['default_branch'])) {
$this->rootIdentifier = $repoData['default_branch'];
} elseif (isset($repoData['master_branch'])) {
$this->rootIdentifier = $repoData['master_branch'];
} else {
$this->rootIdentifier = 'master';
}
$this->hasIssues = !empty($repoData['has_issues']);
}
protected function attemptCloneFallback()
{
$this->isPrivate = true;
try {
$this->gitDriver = new GitDriver(
array('url' => $this->generateSshUrl()),
$this->io,
$this->config,
$this->process,
$this->remoteFilesystem
);
$this->gitDriver->initialize();
return;
} catch (\RuntimeException $e) {
$this->gitDriver = null;
$this->io->write('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
throw $e;
}
}
}
<?php
namespace Composer\Repository\Vcs;
use Composer\Json\JsonFile;
use Composer\IO\IOInterface;
class GitBitbucketDriver extends VcsDriver implements VcsDriverInterface
{
protected $owner;
protected $repository;
protected $tags;
protected $branches;
protected $rootIdentifier;
protected $infoCache = array();
public function initialize()
{
preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)\.git$#', $this->url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
$this->originUrl = 'bitbucket.org';
}
public function getRootIdentifier()
{
if (null === $this->rootIdentifier) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository;
$repoData = JsonFile::parseJson($this->getContents($resource), $resource);
$this->rootIdentifier = !empty($repoData['main_branch']) ? $repoData['main_branch'] : 'master';
}
return $this->rootIdentifier;
}
public function getUrl()
{
return $this->url;
}
public function getSource($identifier)
{
$label = array_search($identifier, $this->getTags()) ?: $identifier;
return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $label);
}
public function getDist($identifier)
{
$label = array_search($identifier, $this->getTags()) ?: $identifier;
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.zip';
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
}
public function getComposerInformation($identifier)
{
if (!isset($this->infoCache[$identifier])) {
$resource = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/raw/'.$identifier.'/composer.json';
$composer = $this->getContents($resource);
if (!$composer) {
return;
}
$composer = JsonFile::parseJson($composer, $resource);
if (!isset($composer['time'])) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier;
$changeset = JsonFile::parseJson($this->getContents($resource), $resource);
$composer['time'] = $changeset['timestamp'];
}
$this->infoCache[$identifier] = $composer;
}
return $this->infoCache[$identifier];
}
public function getTags()
{
if (null === $this->tags) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
$tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
$this->tags = array();
foreach ($tagsData as $tag => $data) {
$this->tags[$tag] = $data['raw_node'];
}
}
return $this->tags;
}
public function getBranches()
{
if (null === $this->branches) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches';
$branchData = JsonFile::parseJson($this->getContents($resource), $resource);
$this->branches = array();
foreach ($branchData as $branch => $data) {
$this->branches[$branch] = $data['raw_node'];
}
}
return $this->branches;
}
public static function supports(IOInterface $io, $url, $deep = false)
{
if (!preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)\.git$#', $url)) {
return false;
}
if (!extension_loaded('openssl')) {
if ($io->isVerbose()) {
$io->write('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.');
}
return false;
}
return true;
}
}
<?php
namespace Composer\Repository\Vcs;
use Composer\Json\JsonFile;
use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem;
use Composer\IO\IOInterface;
class GitDriver extends VcsDriver
{
protected $tags;
protected $branches;
protected $rootIdentifier;
protected $repoDir;
protected $infoCache = array();
public function initialize()
{
if (static::isLocalUrl($this->url)) {
$this->repoDir = str_replace('file://', '', $this->url);
} else {
$this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
$fs = new Filesystem();
$fs->ensureDirectoryExists(dirname($this->repoDir));
if (!is_writable(dirname($this->repoDir))) {
throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
}
if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
}
if (is_dir($this->repoDir) && 0 === $this->process->execute('git remote', $output, $this->repoDir)) {
if (0 !== $this->process->execute('git remote update --prune origin', $output, $this->repoDir)) {
$this->io->write('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
}
} else {
$fs->removeDirectory($this->repoDir);
putenv('GIT_ASKPASS=echo');
$command = sprintf('git clone --mirror %s %s', escapeshellarg($this->url), escapeshellarg($this->repoDir));
if (0 !== $this->process->execute($command, $output)) {
$output = $this->process->getErrorOutput();
if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
throw new \RuntimeException('Failed to clone '.$this->url.', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
}
}
}
$this->getTags();
$this->getBranches();
}
public function getRootIdentifier()
{
if (null === $this->rootIdentifier) {
$this->rootIdentifier = 'master';
$this->process->execute('git branch --no-color', $output, $this->repoDir);
$branches = $this->process->splitLines($output);
if (!in_array('* master', $branches)) {
foreach ($branches as $branch) {
if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
$this->rootIdentifier = $match[1];
break;
}
}
}
}
return $this->rootIdentifier;
}
public function getUrl()
{
return $this->url;
}
public function getSource($identifier)
{
$label = array_search($identifier, (array) $this->tags) ?: $identifier;
return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $label);
}
public function getDist($identifier)
{
return null;
}
public function getComposerInformation($identifier)
{
if (!isset($this->infoCache[$identifier])) {
$resource = sprintf('%s:composer.json', escapeshellarg($identifier));
$this->process->execute(sprintf('git show %s', $resource), $composer, $this->repoDir);
if (!trim($composer)) {
return;
}
$composer = JsonFile::parseJson($composer, $resource);
if (!isset($composer['time'])) {
$this->process->execute(sprintf('git log -1 --format=%%at %s', escapeshellarg($identifier)), $output, $this->repoDir);
$date = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
$composer['time'] = $date->format('Y-m-d H:i:s');
}
$this->infoCache[$identifier] = $composer;
}
return $this->infoCache[$identifier];
}
public function getTags()
{
if (null === $this->tags) {
$this->process->execute('git tag', $output, $this->repoDir);
$output = $this->process->splitLines($output);
$this->tags = $output ? array_combine($output, $output) : array();
}
return $this->tags;
}
public function getBranches()
{
if (null === $this->branches) {
$branches = array();
$this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
foreach ($this->process->splitLines($output) as $branch) {
if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
$branches[$match[1]] = $match[2];
}
}
}
$this->branches = $branches;
}
return $this->branches;
}
public static function supports(IOInterface $io, $url, $deep = false)
{
if (preg_match('#(^git://|\.git$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
return true;
}
if (static::isLocalUrl($url)) {
if (!is_dir($url)) {
throw new \RuntimeException('Directory does not exist: '.$url);
}
$process = new ProcessExecutor();
$url = str_replace('file://', '', $url);
if ($process->execute('git tag', $output, $url) === 0) {
return true;
}
}
if (!$deep) {
return false;
}
return false;
}
}
<?php
namespace Composer\Repository\Vcs;
use Composer\Cache;
use Composer\Json\JsonFile;
use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem;
use Composer\Util\Svn as SvnUtil;
use Composer\IO\IOInterface;
use Composer\Downloader\TransportException;
class SvnDriver extends VcsDriver
{
protected $cache;
protected $baseUrl;
protected $tags;
protected $branches;
protected $rootIdentifier;
protected $infoCache = array();
protected $trunkPath = 'trunk';
protected $branchesPath = 'branches';
protected $tagsPath = 'tags';
private $util;
public function initialize()
{
$this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
if (isset($this->repoConfig['trunk-path'])) {
$this->trunkPath = $this->repoConfig['trunk-path'];
}
if (isset($this->repoConfig['branches-path'])) {
$this->branchesPath = $this->repoConfig['branches-path'];
}
if (isset($this->repoConfig['tags-path'])) {
$this->tagsPath = $this->repoConfig['tags-path'];
}
if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
$this->baseUrl = substr($this->url, 0, $pos);
}
$this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
$this->getBranches();
$this->getTags();
}
public function getRootIdentifier()
{
return $this->rootIdentifier ?: $this->trunkPath;
}
public function getUrl()
{
return $this->url;
}
public function getSource($identifier)
{
return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
}
public function getDist($identifier)
{
return null;
}
public function getComposerInformation($identifier)
{
$identifier = '/' . trim($identifier, '/') . '/';
if ($res = $this->cache->read($identifier.'.json')) {
$this->infoCache[$identifier] = JsonFile::parseJson($res);
}
if (!isset($this->infoCache[$identifier])) {
preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
if (!empty($match[2])) {
$path = $match[1];
$rev = $match[2];
} else {
$path = $identifier;
$rev = '';
}
try {
$resource = $path.'composer.json';
$output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
if (!trim($output)) {
return;
}
} catch (\RuntimeException $e) {
throw new TransportException($e->getMessage());
}
$composer = JsonFile::parseJson($output, $this->baseUrl . $resource . $rev);
if (!isset($composer['time'])) {
$output = $this->execute('svn info', $this->baseUrl . $path . $rev);
foreach ($this->process->splitLines($output) as $line) {
if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
$date = new \DateTime($match[1], new \DateTimeZone('UTC'));
$composer['time'] = $date->format('Y-m-d H:i:s');
break;
}
}
}
$this->cache->write($identifier.'.json', json_encode($composer));
$this->infoCache[$identifier] = $composer;
}
return $this->infoCache[$identifier];
}
public function getTags()
{
if (null === $this->tags) {
$this->tags = array();
if ($this->tagsPath !== false) {
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
if ($output) {
foreach ($this->process->splitLines($output) as $line) {
$line = trim($line);
if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
$this->tags[rtrim($match[2], '/')] = '/' . $this->tagsPath .
'/' . $match[2] . '@' . $match[1];
}
}
}
}
}
}
return $this->tags;
}
public function getBranches()
{
if (null === $this->branches) {
$this->branches = array();
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/');
if ($output) {
foreach ($this->process->splitLines($output) as $line) {
$line = trim($line);
if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
if (isset($match[1]) && isset($match[2]) && $match[2] === $this->trunkPath . '/') {
$this->branches[$this->trunkPath] = '/' . $this->trunkPath . '/@'.$match[1];
$this->rootIdentifier = $this->branches[$this->trunkPath];
break;
}
}
}
}
unset($output);
if ($this->branchesPath !== false) {
$output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
if ($output) {
foreach ($this->process->splitLines(trim($output)) as $line) {
$line = trim($line);
if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
$this->branches[rtrim($match[2], '/')] = '/' . $this->branchesPath .
'/' . $match[2] . '@' . $match[1];
}
}
}
}
}
}
return $this->branches;
}
public static function supports(IOInterface $io, $url, $deep = false)
{
$url = self::normalizeUrl($url);
if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
return true;
}
if (!$deep && !static::isLocalUrl($url)) {
return false;
}
$processExecutor = new ProcessExecutor();
$exit = $processExecutor->execute(
"svn info --non-interactive {$url}",
$ignoredOutput
);
if ($exit === 0) {
return true;
}
if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
return true;
}
return false;
}
protected static function normalizeUrl($url)
{
$fs = new Filesystem();
if ($fs->isAbsolutePath($url)) {
return 'file://' . strtr($url, '\\', '/');
}
return $url;
}
protected function execute($command, $url)
{
if (null === $this->util) {
$this->util = new SvnUtil($this->baseUrl, $this->io, $this->process);
}
try {
return $this->util->execute($command, $url);
} catch (\RuntimeException $e) {
if (0 !== $this->process->execute('svn --version', $ignoredOutput)) {
throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
throw new \RuntimeException(
'Repository '.$this->url.' could not be processed, '.$e->getMessage()
);
}
}
}
<?php
namespace Composer\Repository\Vcs;
use Composer\IO\IOInterface;
interface VcsDriverInterface
{
public function initialize();
public function getComposerInformation($identifier);
public function getRootIdentifier();
public function getBranches();
public function getTags();
public function getDist($identifier);
public function getSource($identifier);
public function getUrl();
public function hasComposerFile($identifier);
public static function supports(IOInterface $io, $url, $deep = false);
}
<?php
namespace Composer\Repository\Vcs;
use Composer\Json\JsonFile;
use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem;
use Composer\IO\IOInterface;
class HgDriver extends VcsDriver
{
protected $tags;
protected $branches;
protected $rootIdentifier;
protected $repoDir;
protected $infoCache = array();
public function initialize()
{
if (static::isLocalUrl($this->url)) {
$this->repoDir = str_replace('file://', '', $this->url);
} else {
$cacheDir = $this->config->get('cache-vcs-dir');
$this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
$fs = new Filesystem();
$fs->ensureDirectoryExists($cacheDir);
if (!is_writable(dirname($this->repoDir))) {
throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
}
if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
if (0 !== $this->process->execute('hg pull -u', $output, $this->repoDir)) {
$this->io->write('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
}
} else {
$fs->removeDirectory($this->repoDir);
if (0 !== $this->process->execute(sprintf('hg clone %s %s', escapeshellarg($this->url), escapeshellarg($this->repoDir)), $output, $cacheDir)) {
$output = $this->process->getErrorOutput();
if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
throw new \RuntimeException('Failed to clone '.$this->url.', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
}
throw new \RuntimeException('Failed to clone '.$this->url.', could not read packages from it' . "\n\n" .$output);
}
}
}
$this->getTags();
$this->getBranches();
}
public function getRootIdentifier()
{
if (null === $this->rootIdentifier) {
$this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
$output = $this->process->splitLines($output);
$this->rootIdentifier = $output[0];
}
return $this->rootIdentifier;
}
public function getUrl()
{
return $this->url;
}
public function getSource($identifier)
{
$label = array_search($identifier, (array) $this->tags) ? : $identifier;
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $label);
}
public function getDist($identifier)
{
return null;
}
public function getComposerInformation($identifier)
{
if (!isset($this->infoCache[$identifier])) {
$this->process->execute(sprintf('hg cat -r %s composer.json', escapeshellarg($identifier)), $composer, $this->repoDir);
if (!trim($composer)) {
return;
}
$composer = JsonFile::parseJson($composer, $identifier);
if (!isset($composer['time'])) {
$this->process->execute(sprintf('hg log --template "{date|rfc822date}" -r %s', escapeshellarg($identifier)), $output, $this->repoDir);
$date = new \DateTime(trim($output), new \DateTimeZone('UTC'));
$composer['time'] = $date->format('Y-m-d H:i:s');
}
$this->infoCache[$identifier] = $composer;
}
return $this->infoCache[$identifier];
}
public function getTags()
{
if (null === $this->tags) {
$tags = array();
$this->process->execute('hg tags', $output, $this->repoDir);
foreach ($this->process->splitLines($output) as $tag) {
if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
$tags[$match[1]] = $match[2];
}
}
unset($tags['tip']);
$this->tags = $tags;
}
return $this->tags;
}
public function getBranches()
{
if (null === $this->branches) {
$branches = array();
$bookmarks = array();
$this->process->execute('hg branches', $output, $this->repoDir);
foreach ($this->process->splitLines($output) as $branch) {
if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
$branches[$match[1]] = $match[2];
}
}
$this->process->execute('hg bookmarks', $output, $this->repoDir);
foreach ($this->process->splitLines($output) as $branch) {
if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
$bookmarks[$match[1]] = $match[2];
}
}
$this->branches = array_merge($bookmarks, $branches);
}
return $this->branches;
}
public static function supports(IOInterface $io, $url, $deep = false)
{
if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
return true;
}
if (static::isLocalUrl($url)) {
if (!is_dir($url)) {
throw new \RuntimeException('Directory does not exist: '.$url);
}
$process = new ProcessExecutor();
$url = str_replace('file://', '', $url);
if ($process->execute('hg summary', $output, $url) === 0) {
return true;
}
}
if (!$deep) {
return false;
}
$processExecutor = new ProcessExecutor();
$exit = $processExecutor->execute(sprintf('hg identify %s', escapeshellarg($url)), $ignored);
return $exit === 0;
}
}
<?php
namespace Composer\Repository\Vcs;
use Composer\Downloader\TransportException;
use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Util\ProcessExecutor;
use Composer\Util\RemoteFilesystem;
abstract class VcsDriver implements VcsDriverInterface
{
protected $url;
protected $originUrl;
protected $repoConfig;
protected $io;
protected $config;
protected $process;
protected $remoteFilesystem;
final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
{
$this->url = $repoConfig['url'];
$this->originUrl = $repoConfig['url'];
$this->repoConfig = $repoConfig;
$this->io = $io;
$this->config = $config;
$this->process = $process ?: new ProcessExecutor;
$this->remoteFilesystem = $remoteFilesystem ?: new RemoteFilesystem($io);
}
public function hasComposerFile($identifier)
{
try {
return (bool) $this->getComposerInformation($identifier);
} catch (TransportException $e) {
}
return false;
}
protected function getScheme()
{
if (extension_loaded('openssl')) {
return 'https';
}
return 'http';
}
protected function getContents($url)
{
return $this->remoteFilesystem->getContents($this->originUrl, $url, false);
}
protected static function isLocalUrl($url)
{
return (bool) preg_match('{^(file://|/|[a-z]:[\\\\/])}i', $url);
}
}
<?php
namespace Composer\Repository\Vcs;
use Composer\Json\JsonFile;
use Composer\IO\IOInterface;
class HgBitbucketDriver extends VcsDriver
{
protected $owner;
protected $repository;
protected $tags;
protected $branches;
protected $rootIdentifier;
protected $infoCache = array();
public function initialize()
{
preg_match('#^https://bitbucket\.org/([^/]+)/([^/]+)/?$#', $this->url, $match);
$this->owner = $match[1];
$this->repository = $match[2];
$this->originUrl = 'bitbucket.org';
}
public function getRootIdentifier()
{
if (null === $this->rootIdentifier) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
$repoData = JsonFile::parseJson($this->getContents($resource), $resource);
if (array() === $repoData) {
throw new \RuntimeException('This does not appear to be a mercurial repository, use '.$this->url.'.git if this is a git bitbucket repository');
}
$this->rootIdentifier = $repoData['tip']['raw_node'];
}
return $this->rootIdentifier;
}
public function getUrl()
{
return $this->url;
}
public function getSource($identifier)
{
$label = array_search($identifier, $this->getTags()) ?: $identifier;
return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $label);
}
public function getDist($identifier)
{
$label = array_search($identifier, $this->getTags()) ?: $identifier;
$url = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/get/'.$label.'.zip';
return array('type' => 'zip', 'url' => $url, 'reference' => $label, 'shasum' => '');
}
public function getComposerInformation($identifier)
{
if (!isset($this->infoCache[$identifier])) {
$resource = $this->getScheme() . '://bitbucket.org/'.$this->owner.'/'.$this->repository.'/raw/'.$identifier.'/composer.json';
$composer = $this->getContents($resource);
if (!$composer) {
return;
}
$composer = JsonFile::parseJson($composer, $resource);
if (!isset($composer['time'])) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/changesets/'.$identifier;
$changeset = JsonFile::parseJson($this->getContents($resource), $resource);
$composer['time'] = $changeset['timestamp'];
}
$this->infoCache[$identifier] = $composer;
}
return $this->infoCache[$identifier];
}
public function getTags()
{
if (null === $this->tags) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/tags';
$tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
$this->tags = array();
foreach ($tagsData as $tag => $data) {
$this->tags[$tag] = $data['raw_node'];
}
}
return $this->tags;
}
public function getBranches()
{
if (null === $this->branches) {
$resource = $this->getScheme() . '://api.bitbucket.org/1.0/repositories/'.$this->owner.'/'.$this->repository.'/branches';
$branchData = JsonFile::parseJson($this->getContents($resource), $resource);
$this->branches = array();
foreach ($branchData as $branch => $data) {
$this->branches[$branch] = $data['raw_node'];
}
}
return $this->branches;
}
public static function supports(IOInterface $io, $url, $deep = false)
{
if (!preg_match('#^https://bitbucket\.org/([^/]+)/([^/]+)/?$#', $url)) {
return false;
}
if (!extension_loaded('openssl')) {
if ($io->isVerbose()) {
$io->write('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.');
}
return false;
}
return true;
}
}
<?php
namespace Composer\Repository;
class InstalledArrayRepository extends ArrayRepository implements InstalledRepositoryInterface
{
public function write()
{
}
public function reload()
{
}
}
<?php
namespace Composer\Repository;
class RepositorySecurityException extends \Exception
{
}<?php
namespace Composer\Repository;
use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
interface StreamableRepositoryInterface extends RepositoryInterface
{
public function getMinimalPackages();
public function loadPackage(array $data);
public function loadAliasPackage(array $data, PackageInterface $aliasOf);
}
<?php
namespace Composer\Repository;
use Composer\Downloader\TransportException;
use Composer\Repository\Vcs\VcsDriverInterface;
use Composer\Package\Version\VersionParser;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Loader\ValidatingArrayLoader;
use Composer\Package\Loader\InvalidPackageException;
use Composer\Package\Loader\LoaderInterface;
use Composer\IO\IOInterface;
use Composer\Config;
class VcsRepository extends ArrayRepository
{
protected $url;
protected $packageName;
protected $verbose;
protected $io;
protected $config;
protected $versionParser;
protected $type;
protected $loader;
protected $repoConfig;
protected $branchErrorOccurred = false;
public function __construct(array $repoConfig, IOInterface $io, Config $config, array $drivers = null)
{
$this->drivers = $drivers ?: array(
'github' => 'Composer\Repository\Vcs\GitHubDriver',
'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
'git' => 'Composer\Repository\Vcs\GitDriver',
'svn' => 'Composer\Repository\Vcs\SvnDriver',
'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
'hg' => 'Composer\Repository\Vcs\HgDriver',
);
$this->url = $repoConfig['url'];
$this->io = $io;
$this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
$this->verbose = $io->isVerbose();
$this->config = $config;
$this->repoConfig = $repoConfig;
}
public function setLoader(LoaderInterface $loader)
{
$this->loader = $loader;
}
public function getDriver()
{
if (isset($this->drivers[$this->type])) {
$class = $this->drivers[$this->type];
$driver = new $class($this->repoConfig, $this->io, $this->config);
$driver->initialize();
return $driver;
}
foreach ($this->drivers as $driver) {
if ($driver::supports($this->io, $this->url)) {
$driver = new $driver($this->repoConfig, $this->io, $this->config);
$driver->initialize();
return $driver;
}
}
foreach ($this->drivers as $driver) {
if ($driver::supports($this->io, $this->url, true)) {
$driver = new $driver($this->repoConfig, $this->io, $this->config);
$driver->initialize();
return $driver;
}
}
}
public function hadInvalidBranches()
{
return $this->branchErrorOccurred;
}
protected function initialize()
{
parent::initialize();
$verbose = $this->verbose;
$driver = $this->getDriver();
if (!$driver) {
throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
}
$this->versionParser = new VersionParser;
if (!$this->loader) {
$this->loader = new ArrayLoader($this->versionParser);
}
try {
if ($driver->hasComposerFile($driver->getRootIdentifier())) {
$data = $driver->getComposerInformation($driver->getRootIdentifier());
$this->packageName = !empty($data['name']) ? $data['name'] : null;
}
} catch (\Exception $e) {
if ($verbose) {
$this->io->write('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
}
}
foreach ($driver->getTags() as $tag => $identifier) {
$msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
if ($verbose) {
$this->io->write($msg);
} else {
$this->io->overwrite($msg, false);
}
$tag = str_replace('release-', '', $tag);
if (!$parsedTag = $this->validateTag($tag)) {
if ($verbose) {
$this->io->write('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
}
continue;
}
try {
if (!$data = $driver->getComposerInformation($identifier)) {
if ($verbose) {
$this->io->write('<warning>Skipped tag '.$tag.', no composer file</warning>');
}
continue;
}
if (isset($data['version'])) {
$data['version_normalized'] = $this->versionParser->normalize($data['version']);
} else {
$data['version'] = $tag;
$data['version_normalized'] = $parsedTag;
}
$data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
$data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
if ($data['version_normalized'] !== $parsedTag) {
if ($verbose) {
$this->io->write('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
}
continue;
}
if ($verbose) {
$this->io->write('Importing tag '.$tag.' ('.$data['version_normalized'].')');
}
$this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
} catch (\Exception $e) {
if ($verbose) {
$this->io->write('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
}
continue;
}
}
if (!$verbose) {
$this->io->overwrite('', false);
}
foreach ($driver->getBranches() as $branch => $identifier) {
$msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
if ($verbose) {
$this->io->write($msg);
} else {
$this->io->overwrite($msg, false);
}
if (!$parsedBranch = $this->validateBranch($branch)) {
if ($verbose) {
$this->io->write('<warning>Skipped branch '.$branch.', invalid name</warning>');
}
continue;
}
try {
if (!$data = $driver->getComposerInformation($identifier)) {
if ($verbose) {
$this->io->write('<warning>Skipped branch '.$branch.', no composer file</warning>');
}
continue;
}
$data['version'] = $branch;
$data['version_normalized'] = $parsedBranch;
if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
$data['version'] = 'dev-' . $data['version'];
} else {
$data['version'] = preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
}
if ($verbose) {
$this->io->write('Importing branch '.$branch.' ('.$data['version'].')');
}
$packageData = $this->preProcess($driver, $data, $identifier);
$package = $this->loader->load($packageData);
if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
}
$this->addPackage($package);
} catch (TransportException $e) {
if ($verbose) {
$this->io->write('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
}
continue;
} catch (\Exception $e) {
if (!$verbose) {
$this->io->write('');
}
$this->branchErrorOccurred = true;
$this->io->write('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
$this->io->write('');
continue;
}
}
if (!$verbose) {
$this->io->overwrite('', false);
}
if (!$this->getPackages()) {
throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
}
}
private function preProcess(VcsDriverInterface $driver, array $data, $identifier)
{
$data['name'] = $this->packageName ?: $data['name'];
if (!isset($data['dist'])) {
$data['dist'] = $driver->getDist($identifier);
}
if (!isset($data['source'])) {
$data['source'] = $driver->getSource($identifier);
}
return $data;
}
private function validateBranch($branch)
{
try {
return $this->versionParser->normalizeBranch($branch);
} catch (\Exception $e) {
}
return false;
}
private function validateTag($version)
{
try {
return $this->versionParser->normalize($version);
} catch (\Exception $e) {
}
return false;
}
}
<?php
namespace Composer\Repository;
use Composer\Package\CompletePackage;
use Composer\Package\Version\VersionParser;
class PlatformRepository extends ArrayRepository
{
protected function initialize()
{
parent::initialize();
$versionParser = new VersionParser();
try {
$prettyVersion = PHP_VERSION;
$version = $versionParser->normalize($prettyVersion);
} catch (\UnexpectedValueException $e) {
$prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
$version = $versionParser->normalize($prettyVersion);
}
$php = new CompletePackage('php', $version, $prettyVersion);
$php->setDescription('The PHP interpreter');
parent::addPackage($php);
if (PHP_INT_SIZE === 8) {
$php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
$php64->setDescription('The PHP interpreter (64bit)');
parent::addPackage($php64);
}
$loadedExtensions = get_loaded_extensions();
foreach ($loadedExtensions as $name) {
if (in_array($name, array('standard', 'Core'))) {
continue;
}
$reflExt = new \ReflectionExtension($name);
try {
$prettyVersion = $reflExt->getVersion();
$version = $versionParser->normalize($prettyVersion);
} catch (\UnexpectedValueException $e) {
$prettyVersion = '0';
$version = $versionParser->normalize($prettyVersion);
}
$ext = new CompletePackage('ext-'.$name, $version, $prettyVersion);
$ext->setDescription('The '.$name.' PHP extension');
parent::addPackage($ext);
}
foreach ($loadedExtensions as $name) {
$prettyVersion = null;
switch ($name) {
case 'curl':
$curlVersion = curl_version();
$prettyVersion = $curlVersion['version'];
break;
case 'iconv':
$prettyVersion = ICONV_VERSION;
break;
case 'intl':
$name = 'ICU';
if (defined('INTL_ICU_VERSION')) {
$prettyVersion = INTL_ICU_VERSION;
} else {
$reflector = new \ReflectionExtension('intl');
ob_start();
$reflector->info();
$output = ob_get_clean();
preg_match('/^ICU version => (.*)$/m', $output, $matches);
$prettyVersion = $matches[1];
}
break;
case 'libxml':
$prettyVersion = LIBXML_DOTTED_VERSION;
break;
case 'openssl':
$prettyVersion = preg_replace_callback('{^(?:OpenSSL\s*)?([0-9.]+)([a-z]?).*}', function ($match) {
return $match[1] . (empty($match[2]) ? '' : '.'.(ord($match[2]) - 96));
}, OPENSSL_VERSION_TEXT);
break;
case 'pcre':
$prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
break;
case 'uuid':
$prettyVersion = phpversion('uuid');
break;
case 'xsl':
$prettyVersion = LIBXSLT_DOTTED_VERSION;
break;
default:
continue 2;
}
try {
$version = $versionParser->normalize($prettyVersion);
} catch (\UnexpectedValueException $e) {
continue;
}
$lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
$lib->setDescription('The '.$name.' PHP library');
parent::addPackage($lib);
}
}
}
<?php
namespace Composer\Repository;
class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
{
}
<?php
namespace Composer\Repository;
use Composer\Package\PackageInterface;
class CompositeRepository implements RepositoryInterface
{
private $repositories;
public function __construct(array $repositories)
{
$this->repositories = array();
foreach ($repositories as $repo) {
$this->addRepository($repo);
}
}
public function getRepositories()
{
return $this->repositories;
}
public function hasPackage(PackageInterface $package)
{
foreach ($this->repositories as $repository) {
if ($repository->hasPackage($package)) {
return true;
}
}
return false;
}
public function findPackage($name, $version)
{
foreach ($this->repositories as $repository) {
$package = $repository->findPackage($name, $version);
if (null !== $package) {
return $package;
}
}
return null;
}
public function findPackages($name, $version = null)
{
$packages = array();
foreach ($this->repositories as $repository) {
$packages[] = $repository->findPackages($name, $version);
}
return call_user_func_array('array_merge', $packages);
}
public function search($query, $mode = 0)
{
$matches = array();
foreach ($this->repositories as $repository) {
$matches[] = $repository->search($query, $mode);
}
return call_user_func_array('array_merge', $matches);
}
public function filterPackages($callback, $class = 'Composer\Package\Package')
{
foreach ($this->repositories as $repository) {
if (false === $repository->filterPackages($callback, $class)) {
return false;
}
}
return true;
}
public function getPackages()
{
$packages = array();
foreach ($this->repositories as $repository) {
$packages[] = $repository->getPackages();
}
return call_user_func_array('array_merge', $packages);
}
public function removePackage(PackageInterface $package)
{
foreach ($this->repositories as $repository) {
$repository->removePackage($package);
}
}
public function count()
{
$total = 0;
foreach ($this->repositories as $repository) {
$total += $repository->count();
}
return $total;
}
public function addRepository(RepositoryInterface $repository)
{
if ($repository instanceof self) {
foreach ($repository->getRepositories() as $repo) {
$this->addRepository($repo);
}
} else {
$this->repositories[] = $repository;
}
}
}
<?php
namespace Composer\Repository;
interface InstalledRepositoryInterface extends WritableRepositoryInterface
{
}
<?php
namespace Composer\Repository;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\Package\Version\VersionParser;
use Composer\DependencyResolver\Pool;
use Composer\Json\JsonFile;
use Composer\Cache;
use Composer\Config;
use Composer\IO\IOInterface;
use Composer\Util\RemoteFilesystem;
class ComposerRepository extends ArrayRepository implements StreamableRepositoryInterface
{
protected $config;
protected $options;
protected $url;
protected $baseUrl;
protected $io;
protected $rfs;
protected $cache;
protected $notifyUrl;
protected $searchUrl;
protected $hasProviders = false;
protected $providersUrl;
protected $providerListing;
protected $providers = array();
protected $providersByUid = array();
protected $loader;
protected $rootAliases;
protected $allowSslDowngrade = false;
private $rawData;
private $minimalPackages;
private $degradedMode = false;
private $rootData;
public function __construct(array $repoConfig, IOInterface $io, Config $config)
{
if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
$repoConfig['url'] = 'http://'.$repoConfig['url'];
}
$repoConfig['url'] = rtrim($repoConfig['url'], '/');
if ('https?' === substr($repoConfig['url'], 0, 6)) {
$repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
}
$urlBits = parse_url($repoConfig['url']);
if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
}
if (!isset($repoConfig['options'])) {
$repoConfig['options'] = array();
}
if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
$this->allowSslDowngrade = true;
}
$this->config = $config;
$this->options = $repoConfig['options'];
$this->url = $repoConfig['url'];
$this->baseUrl = rtrim(preg_replace('{^(.*)(?:/packages.json)?(?:[?#].*)?$}', '$1', $this->url), '/');
$this->io = $io;
$this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
$this->loader = new ArrayLoader();
$this->rfs = new RemoteFilesystem($this->io, $this->options);
}
public function setRootAliases(array $rootAliases)
{
$this->rootAliases = $rootAliases;
}
public function getPackages()
{
if ($this->hasProviders()) {
throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
}
return parent::getPackages();
}
public function getMinimalPackages()
{
if (isset($this->minimalPackages)) {
return $this->minimalPackages;
}
if (null === $this->rawData) {
$this->rawData = $this->loadDataFromServer();
}
$this->minimalPackages = array();
$versionParser = new VersionParser;
foreach ($this->rawData as $package) {
$version = !empty($package['version_normalized']) ? $package['version_normalized'] : $versionParser->normalize($package['version']);
$data = array(
'name' => strtolower($package['name']),
'repo' => $this,
'version' => $version,
'raw' => $package,
);
if (!empty($package['replace'])) {
$data['replace'] = $package['replace'];
}
if (!empty($package['provide'])) {
$data['provide'] = $package['provide'];
}
if ($aliasNormalized = $this->loader->getBranchAlias($package)) {
$data['alias'] = preg_replace('{(\.9{7})+}', '.x', $aliasNormalized);
$data['alias_normalized'] = $aliasNormalized;
}
$this->minimalPackages[] = $data;
}
return $this->minimalPackages;
}
public function search($query, $mode = 0)
{
$this->loadRootServerFile();
if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
$url = str_replace('%query%', $query, $this->searchUrl);
$json = $this->rfs->getContents($url, $url, false);
$results = JsonFile::parseJson($json, $url);
return $results['results'];
}
if ($this->hasProviders()) {
$results = array();
$regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
foreach ($this->getProviderNames() as $name) {
if (preg_match($regex, $name)) {
$results[] = array('name' => $name);
}
}
return $results;
}
return parent::search($query, $mode);
}
public function getProviderNames()
{
$this->loadRootServerFile();
if (null === $this->providerListing) {
$this->loadProviderListings($this->loadRootServerFile());
}
if ($this->providersUrl) {
return array_keys($this->providerListing);
}
$providers = array();
foreach (array_keys($this->providerListing) as $provider) {
$providers[] = substr($provider, 2, -5);
}
return $providers;
}
public function loadPackage(array $data)
{
$package = $this->createPackage($data['raw'], 'Composer\Package\Package');
$package->setRepository($this);
return $package;
}
public function loadAliasPackage(array $data, PackageInterface $aliasOf)
{
$aliasPackage = $this->createAliasPackage($aliasOf, $data['version'], $data['alias']);
$aliasPackage->setRepository($this);
return $aliasPackage;
}
public function hasProviders()
{
$this->loadRootServerFile();
return $this->hasProviders;
}
public function resetPackageIds()
{
foreach ($this->providersByUid as $package) {
if ($package instanceof AliasPackage) {
$package->getAliasOf()->setId(-1);
}
$package->setId(-1);
}
}
public function whatProvides(Pool $pool, $name)
{
if (isset($this->providers[$name])) {
return $this->providers[$name];
}
if (preg_match('{^(?:php(?:-64bit)?|(?:ext|lib)-[^/]+)$}i', $name) || '__root__' === $name) {
return array();
}
if (null === $this->providerListing) {
$this->loadProviderListings($this->loadRootServerFile());
}
if ($this->providersUrl) {
if (!isset($this->providerListing[$name])) {
return array();
}
$hash = $this->providerListing[$name]['sha256'];
$url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
$cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
} else {
$url = 'p/'.$name.'.json';
if (!isset($this->providerListing[$url])) {
return array();
}
$hash = $this->providerListing[$url]['sha256'];
$cacheKey = null;
}
if ($this->cache->sha256($cacheKey) === $hash) {
$packages = json_decode($this->cache->read($cacheKey), true);
} else {
$packages = $this->fetchFile($url, $cacheKey, $hash);
}
$this->providers[$name] = array();
foreach ($packages['packages'] as $versions) {
foreach ($versions as $version) {
if (isset($this->providersByUid[$version['uid']])) {
if (!isset($this->providers[$name][$version['uid']])) {
if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
$this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
$this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
} else {
$this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
}
if (isset($this->providersByUid[$version['uid'].'-root'])) {
$this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
}
}
} else {
if (!$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
continue;
}
$package = $this->createPackage($version, 'Composer\Package\Package');
$package->setRepository($this);
$this->providers[$name][$version['uid']] = $package;
$this->providersByUid[$version['uid']] = $package;
if ($package->getAlias()) {
$alias = $this->createAliasPackage($package);
$alias->setRepository($this);
$this->providers[$name][$version['uid'].'-alias'] = $alias;
$this->providersByUid[$version['uid']] = $alias;
}
unset($rootAliasData);
if (isset($this->rootAliases[$name][$package->getVersion()])) {
$rootAliasData = $this->rootAliases[$name][$package->getVersion()];
} elseif (($aliasNormalized = $package->getAlias()) && isset($this->rootAliases[$name][$aliasNormalized])) {
$rootAliasData = $this->rootAliases[$name][$aliasNormalized];
}
if (isset($rootAliasData)) {
$alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
$alias->setRepository($this);
$this->providers[$name][$version['uid'].'-root'] = $alias;
$this->providersByUid[$version['uid'].'-root'] = $alias;
}
}
}
}
return $this->providers[$name];
}
protected function initialize()
{
parent::initialize();
$repoData = $this->loadDataFromServer();
foreach ($repoData as $package) {
$this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
}
}
protected function loadRootServerFile()
{
if (null !== $this->rootData) {
return $this->rootData;
}
if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
}
$jsonUrlParts = parse_url($this->url);
if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '/packages.json')) {
$jsonUrl = $this->url;
} else {
$jsonUrl = $this->url . '/packages.json';
}
$data = $this->fetchFile($jsonUrl, 'packages.json');
if (!empty($data['notify-batch'])) {
$this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
} elseif (!empty($data['notify_batch'])) {
$this->notifyUrl = $this->canonicalizeUrl($data['notify_batch']);
} elseif (!empty($data['notify'])) {
$this->notifyUrl = $this->canonicalizeUrl($data['notify']);
}
if (!empty($data['search'])) {
$this->searchUrl = $this->canonicalizeUrl($data['search']);
}
if ($this->allowSslDowngrade) {
$this->url = str_replace('https://', 'http://', $this->url);
}
if (!empty($data['providers-url'])) {
$this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
$this->hasProviders = true;
}
if (!empty($data['providers']) || !empty($data['providers-includes'])) {
$this->hasProviders = true;
}
return $this->rootData = $data;
}
protected function canonicalizeUrl($url)
{
if ('/' === $url[0]) {
return preg_replace('{(https?://[^/]+).*}i', '$1' . $url, $this->url);
}
return $url;
}
protected function loadDataFromServer()
{
$data = $this->loadRootServerFile();
return $this->loadIncludes($data);
}
protected function loadProviderListings($data)
{
if (isset($data['providers'])) {
if (!is_array($this->providerListing)) {
$this->providerListing = array();
}
$this->providerListing = array_merge($this->providerListing, $data['providers']);
}
if ($this->providersUrl && isset($data['provider-includes'])) {
$includes = $data['provider-includes'];
foreach ($includes as $include => $metadata) {
$url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
$cacheKey = str_replace(array('%hash%','$'), '', $include);
if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
$includedData = json_decode($this->cache->read($cacheKey), true);
} else {
$includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
}
$this->loadProviderListings($includedData);
}
} elseif (isset($data['providers-includes'])) {
$includes = $data['providers-includes'];
foreach ($includes as $include => $metadata) {
if ($this->cache->sha256($include) === $metadata['sha256']) {
$includedData = json_decode($this->cache->read($include), true);
} else {
$includedData = $this->fetchFile($include, null, $metadata['sha256']);
}
$this->loadProviderListings($includedData);
}
}
}
protected function loadIncludes($data)
{
$packages = array();
if (!isset($data['packages']) && !isset($data['includes'])) {
foreach ($data as $pkg) {
foreach ($pkg['versions'] as $metadata) {
$packages[] = $metadata;
}
}
return $packages;
}
if (isset($data['packages'])) {
foreach ($data['packages'] as $package => $versions) {
foreach ($versions as $version => $metadata) {
$packages[] = $metadata;
}
}
}
if (isset($data['includes'])) {
foreach ($data['includes'] as $include => $metadata) {
if ($this->cache->sha1($include) === $metadata['sha1']) {
$includedData = json_decode($this->cache->read($include), true);
} else {
$includedData = $this->fetchFile($include);
}
$packages = array_merge($packages, $this->loadIncludes($includedData));
}
}
return $packages;
}
protected function createPackage(array $data, $class)
{
try {
$data['notification-url'] = $this->notifyUrl;
return $this->loader->load($data, 'Composer\Package\CompletePackage');
} catch (\Exception $e) {
throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
}
}
protected function fetchFile($filename, $cacheKey = null, $sha256 = null)
{
if (!$cacheKey) {
$cacheKey = $filename;
$filename = $this->baseUrl.'/'.$filename;
}
$retries = 3;
while ($retries--) {
try {
$json = $this->rfs->getContents($filename, $filename, false);
if ($sha256 && $sha256 !== hash('sha256', $json)) {
if ($retries) {
usleep(100);
continue;
}
throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This should indicate a man-in-the-middle attack. Try running composer again and report this if you think it is a mistake.');
}
$data = JsonFile::parseJson($json, $filename);
$this->cache->write($cacheKey, $json);
break;
} catch (\Exception $e) {
if ($retries) {
usleep(100);
continue;
}
if ($e instanceof RepositorySecurityException) {
throw $e;
}
if ($contents = $this->cache->read($cacheKey)) {
if (!$this->degradedMode) {
$this->io->write('<warning>'.$e->getMessage().'</warning>');
$this->io->write('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
}
$this->degradedMode = true;
$data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
break;
}
throw $e;
}
}
return $data;
}
}
<?php
namespace Composer\Repository\Pear;
class DependencyInfo
{
private $requires;
private $optionals;
public function __construct($requires, $optionals)
{
$this->requires = $requires;
$this->optionals = $optionals;
}
public function getRequires()
{
return $this->requires;
}
public function getOptionals()
{
return $this->optionals;
}
}
<?php
namespace Composer\Repository\Pear;
class PackageDependencyParser
{
public function buildDependencyInfo($depArray)
{
if (!is_array($depArray)) {
return new DependencyInfo(array(), array());
}
if (!$this->isHash($depArray)) {
return new DependencyInfo($this->buildDependency10Info($depArray), array());
}
return $this->buildDependency20Info($depArray);
}
private function buildDependency10Info($depArray)
{
static $dep10toOperatorMap = array('has'=>'==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
$result = array();
foreach ($depArray as $depItem) {
if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
continue;
}
$depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
? 'optional'
: 'required';
$depType = 'not' == $depItem['rel']
? 'conflicts'
: $depType;
$depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
$depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
? '*'
: $dep10toOperatorMap[$depItem['rel']] . $depVersion;
switch ($depItem['type']) {
case 'php':
$depChannelName = 'php';
$depPackageName = '';
break;
case 'pkg':
$depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
$depPackageName = $depItem['name'];
break;
case 'ext':
$depChannelName = 'ext';
$depPackageName = $depItem['name'];
break;
case 'os':
case 'sapi':
$depChannelName = '';
$depPackageName = '';
break;
default:
$depChannelName = '';
$depPackageName = '';
break;
}
if ('' != $depChannelName) {
$result[] = new DependencyConstraint(
$depType,
$depVersionConstraint,
$depChannelName,
$depPackageName
);
}
}
return $result;
}
private function buildDependency20Info($depArray)
{
$result = array();
$optionals = array();
$defaultOptionals = array();
foreach ($depArray as $depType => $depTypeGroup) {
if (!is_array($depTypeGroup)) {
continue;
}
if ('required' == $depType || 'optional' == $depType) {
foreach ($depTypeGroup as $depItemType => $depItem) {
switch ($depItemType) {
case 'php':
$result[] = new DependencyConstraint(
$depType,
$this->parse20VersionConstraint($depItem),
'php',
''
);
break;
case 'package':
$deps = $this->buildDepPackageConstraints($depItem, $depType);
$result = array_merge($result, $deps);
break;
case 'extension':
$deps = $this->buildDepExtensionConstraints($depItem, $depType);
$result = array_merge($result, $deps);
break;
case 'subpackage':
$deps = $this->buildDepPackageConstraints($depItem, 'replaces');
$defaultOptionals += $deps;
break;
case 'os':
case 'pearinstaller':
break;
default:
break;
}
}
} elseif ('group' == $depType) {
if ($this->isHash($depTypeGroup)) {
$depTypeGroup = array($depTypeGroup);
}
foreach ($depTypeGroup as $depItem) {
$groupName = $depItem['attribs']['name'];
if (!isset($optionals[$groupName])) {
$optionals[$groupName] = array();
}
if (isset($depItem['subpackage'])) {
$optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
} else {
$result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
}
}
}
}
if (count($defaultOptionals) > 0) {
$optionals['*'] = $defaultOptionals;
}
return new DependencyInfo($result, $optionals);
}
private function buildDepExtensionConstraints($depItem, $depType)
{
if ($this->isHash($depItem)) {
$depItem = array($depItem);
}
$result = array();
foreach ($depItem as $subDepItem) {
$depChannelName = 'ext';
$depPackageName = $subDepItem['name'];
$depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
$result[] = new DependencyConstraint(
$depType,
$depVersionConstraint,
$depChannelName,
$depPackageName
);
}
return $result;
}
private function buildDepPackageConstraints($depItem, $depType)
{
if ($this->isHash($depItem)) {
$depItem = array($depItem);
}
$result = array();
foreach ($depItem as $subDepItem) {
$depChannelName = $subDepItem['channel'];
$depPackageName = $subDepItem['name'];
$depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
if (isset($subDepItem['conflicts'])) {
$depType = 'conflicts';
}
$result[] = new DependencyConstraint(
$depType,
$depVersionConstraint,
$depChannelName,
$depPackageName
);
}
return $result;
}
private function parse20VersionConstraint(array $data)
{
static $dep20toOperatorMap = array('has'=>'==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
$versions = array();
$values = array_intersect_key($data, $dep20toOperatorMap);
if (0 == count($values)) {
return '*';
}
if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
$versions[] = '>' . $this->parseVersion($values['min']);
} elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
$versions[] = '<' . $this->parseVersion($values['max']);
} else {
foreach ($values as $op => $version) {
if ('exclude' == $op && is_array($version)) {
foreach ($version as $versionPart) {
$versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
}
} else {
$versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
}
}
}
return implode(',', $versions);
}
private function parseVersion($version)
{
if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
$version = $matches[1]
.(!empty($matches[2]) ? $matches[2] : '.0')
.(!empty($matches[3]) ? $matches[3] : '.0')
.(!empty($matches[4]) ? $matches[4] : '.0');
return $version;
}
return null;
}
private function isHash(array $array)
{
return !array_key_exists(1, $array) && !array_key_exists(0, $array);
}
}
<?php
namespace Composer\Repository\Pear;
class ChannelInfo
{
private $name;
private $alias;
private $packages;
public function __construct($name, $alias, array $packages)
{
$this->name = $name;
$this->alias = $alias;
$this->packages = $packages;
}
public function getName()
{
return $this->name;
}
public function getAlias()
{
return $this->alias;
}
public function getPackages()
{
return $this->packages;
}
}
<?php
namespace Composer\Repository\Pear;
use Composer\Util\RemoteFilesystem;
class ChannelReader extends BaseChannelReader
{
private $readerMap;
public function __construct(RemoteFilesystem $rfs)
{
parent::__construct($rfs);
$rest10reader = new ChannelRest10Reader($rfs);
$rest11reader = new ChannelRest11Reader($rfs);
$this->readerMap = array(
'REST1.3' => $rest11reader,
'REST1.2' => $rest11reader,
'REST1.1' => $rest11reader,
'REST1.0' => $rest10reader,
);
}
public function read($url)
{
$xml = $this->requestXml($url, "/channel.xml");
$channelName = (string) $xml->name;
$channelSummary = (string) $xml->summary;
$channelAlias = (string) $xml->suggestedalias;
$supportedVersions = array_keys($this->readerMap);
$selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
if (!$selectedRestVersion) {
throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
}
$reader = $this->readerMap[$selectedRestVersion['version']];
$packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
}
private function selectRestVersion($channelXml, $supportedVersions)
{
$channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
foreach ($supportedVersions as $version) {
$xpathTest = "ns:servers/ns:primary/ns:rest/ns:baseurl[@type='{$version}']";
$testResult = $channelXml->xpath($xpathTest);
if (count($testResult) > 0) {
return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
}
}
return null;
}
}
<?php
namespace Composer\Repository\Pear;
class PackageInfo
{
private $channelName;
private $packageName;
private $license;
private $shortDescription;
private $description;
private $releases;
public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
{
$this->channelName = $channelName;
$this->packageName = $packageName;
$this->license = $license;
$this->shortDescription = $shortDescription;
$this->description = $description;
$this->releases = $releases;
}
public function getChannelName()
{
return $this->channelName;
}
public function getPackageName()
{
return $this->packageName;
}
public function getDescription()
{
return $this->description;
}
public function getShortDescription()
{
return $this->shortDescription;
}
public function getLicense()
{
return $this->license;
}
public function getReleases()
{
return $this->releases;
}
}
<?php
namespace Composer\Repository\Pear;
class DependencyConstraint
{
private $type;
private $constraint;
private $channelName;
private $packageName;
public function __construct($type, $constraint, $channelName, $packageName)
{
$this->type = $type;
$this->constraint = $constraint;
$this->channelName = $channelName;
$this->packageName = $packageName;
}
public function getChannelName()
{
return $this->channelName;
}
public function getConstraint()
{
return $this->constraint;
}
public function getPackageName()
{
return $this->packageName;
}
public function getType()
{
return $this->type;
}
}
<?php
namespace Composer\Repository\Pear;
class ChannelRest11Reader extends BaseChannelReader
{
private $dependencyReader;
public function __construct($rfs)
{
parent::__construct($rfs);
$this->dependencyReader = new PackageDependencyParser();
}
public function read($baseUrl)
{
return $this->readChannelPackages($baseUrl);
}
private function readChannelPackages($baseUrl)
{
$result = array();
$xml = $this->requestXml($baseUrl, "/c/categories.xml");
$xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
foreach ($xml->xpath('ns:c') as $node) {
$categoryName = (string) $node;
$categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
$result = array_merge($result, $categoryPackages);
}
return $result;
}
private function readCategoryPackages($baseUrl, $categoryName)
{
$result = array();
$categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
$xml = $this->requestXml($baseUrl, $categoryPath);
$xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
foreach ($xml->xpath('ns:pi') as $node) {
$packageInfo = $this->parsePackage($node);
$result[] = $packageInfo;
}
return $result;
}
private function parsePackage($packageInfo)
{
$packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
$channelName = (string) $packageInfo->p->c;
$packageName = (string) $packageInfo->p->n;
$license = (string) $packageInfo->p->l;
$shortDescription = (string) $packageInfo->p->s;
$description = (string) $packageInfo->p->d;
$dependencies = array();
foreach ($packageInfo->xpath('ns:deps') as $node) {
$dependencyVersion = (string) $node->v;
$dependencyArray = unserialize((string) $node->d);
$dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
$dependencies[$dependencyVersion] = $dependencyInfo;
}
$releases = array();
$releasesInfo = $packageInfo->xpath('ns:a/ns:r');
if ($releasesInfo) {
foreach ($releasesInfo as $node) {
$releaseVersion = (string) $node->v;
$releaseStability = (string) $node->s;
$releases[$releaseVersion] = new ReleaseInfo(
$releaseStability,
isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
);
}
}
return new PackageInfo(
$channelName,
$packageName,
$license,
$shortDescription,
$description,
$releases
);
}
}
<?php
namespace Composer\Repository\Pear;
class ReleaseInfo
{
private $stability;
private $dependencyInfo;
public function __construct($stability, $dependencyInfo)
{
$this->stability = $stability;
$this->dependencyInfo = $dependencyInfo;
}
public function getDependencyInfo()
{
return $this->dependencyInfo;
}
public function getStability()
{
return $this->stability;
}
}
<?php
namespace Composer\Repository\Pear;
use Composer\Util\RemoteFilesystem;
abstract class BaseChannelReader
{
const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
private $rfs;
protected function __construct(RemoteFilesystem $rfs)
{
$this->rfs = $rfs;
}
protected function requestContent($origin, $path)
{
$url = rtrim($origin, '/') . '/' . ltrim($path, '/');
$content = $this->rfs->getContents($origin, $url, false);
if (!$content) {
throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
}
return $content;
}
protected function requestXml($origin, $path)
{
$xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
if (false == $xml) {
$url = rtrim($origin, '/') . '/' . ltrim($path, '/');
throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
}
return $xml;
}
}
<?php
namespace Composer\Repository\Pear;
use Composer\Downloader\TransportException;
class ChannelRest10Reader extends BaseChannelReader
{
private $dependencyReader;
public function __construct($rfs)
{
parent::__construct($rfs);
$this->dependencyReader = new PackageDependencyParser();
}
public function read($baseUrl)
{
return $this->readPackages($baseUrl);
}
private function readPackages($baseUrl)
{
$result = array();
$xmlPath = '/p/packages.xml';
$xml = $this->requestXml($baseUrl, $xmlPath);
$xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
foreach ($xml->xpath('ns:p') as $node) {
$packageName = (string) $node;
$packageInfo = $this->readPackage($baseUrl, $packageName);
$result[] = $packageInfo;
}
return $result;
}
private function readPackage($baseUrl, $packageName)
{
$xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
$xml = $this->requestXml($baseUrl, $xmlPath);
$xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
$channelName = (string) $xml->c;
$packageName = (string) $xml->n;
$license = (string) $xml->l;
$shortDescription = (string) $xml->s;
$description = (string) $xml->d;
return new PackageInfo(
$channelName,
$packageName,
$license,
$shortDescription,
$description,
$this->readPackageReleases($baseUrl, $packageName)
);
}
private function readPackageReleases($baseUrl, $packageName)
{
$result = array();
try {
$xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
$xml = $this->requestXml($baseUrl, $xmlPath);
$xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
foreach ($xml->xpath('ns:r') as $node) {
$releaseVersion = (string) $node->v;
$releaseStability = (string) $node->s;
try {
$result[$releaseVersion] = new ReleaseInfo(
$releaseStability,
$this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
);
} catch (TransportException $exception) {
if ($exception->getCode() != 404) {
throw $exception;
}
}
}
} catch (TransportException $exception) {
if ($exception->getCode() != 404) {
throw $exception;
}
}
return $result;
}
private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
{
$dependencyReader = new PackageDependencyParser();
$depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
$content = $this->requestContent($baseUrl, $depthPath);
$dependencyArray = unserialize($content);
$result = $dependencyReader->buildDependencyInfo($dependencyArray);
return $result;
}
}
<?php
namespace Composer\Repository;
use Composer\Package\PackageInterface;
interface RepositoryInterface extends \Countable
{
const SEARCH_FULLTEXT = 0;
const SEARCH_NAME = 1;
public function hasPackage(PackageInterface $package);
public function findPackage($name, $version);
public function findPackages($name, $version = null);
public function getPackages();
public function search($query, $mode = 0);
}
<?php
namespace Composer\Repository;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Loader\ValidatingArrayLoader;
class PackageRepository extends ArrayRepository
{
private $config;
public function __construct(array $config)
{
$this->config = $config['package'];
if (!is_numeric(key($this->config))) {
$this->config = array($this->config);
}
}
protected function initialize()
{
parent::initialize();
$loader = new ValidatingArrayLoader(new ArrayLoader, false);
foreach ($this->config as $package) {
try {
$package = $loader->load($package);
} catch (\Exception $e) {
throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
}
$this->addPackage($package);
}
}
}
<?php
namespace Composer\Package;
class CompletePackage extends Package implements CompletePackageInterface
{
protected $repositories;
protected $license = array();
protected $keywords;
protected $authors;
protected $description;
protected $homepage;
protected $scripts = array();
protected $support = array();
public function setScripts(array $scripts)
{
$this->scripts = $scripts;
}
public function getScripts()
{
return $this->scripts;
}
public function setRepositories($repositories)
{
$this->repositories = $repositories;
}
public function getRepositories()
{
return $this->repositories;
}
public function setLicense(array $license)
{
$this->license = $license;
}
public function getLicense()
{
return $this->license;
}
public function setKeywords(array $keywords)
{
$this->keywords = $keywords;
}
public function getKeywords()
{
return $this->keywords;
}
public function setAuthors(array $authors)
{
$this->authors = $authors;
}
public function getAuthors()
{
return $this->authors;
}
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function setHomepage($homepage)
{
$this->homepage = $homepage;
}
public function getHomepage()
{
return $this->homepage;
}
public function setSupport(array $support)
{
$this->support = $support;
}
public function getSupport()
{
return $this->support;
}
}
<?php
namespace Composer\Package\Dumper;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
use Composer\Package\CompletePackageInterface;
use Composer\Package\RootPackageInterface;
use Composer\Package\Link;
class ArrayDumper
{
public function dump(PackageInterface $package)
{
$keys = array(
'binaries' => 'bin',
'type',
'extra',
'installationSource' => 'installation-source',
'autoload',
'notificationUrl' => 'notification-url',
'includePaths' => 'include-path',
);
$data = array();
$data['name'] = $package->getPrettyName();
$data['version'] = $package->getPrettyVersion();
$data['version_normalized'] = $package->getVersion();
if ($package->getTargetDir()) {
$data['target-dir'] = $package->getTargetDir();
}
if ($package->getSourceType()) {
$data['source']['type'] = $package->getSourceType();
$data['source']['url'] = $package->getSourceUrl();
$data['source']['reference'] = $package->getSourceReference();
}
if ($package->getDistType()) {
$data['dist']['type'] = $package->getDistType();
$data['dist']['url'] = $package->getDistUrl();
$data['dist']['reference'] = $package->getDistReference();
$data['dist']['shasum'] = $package->getDistSha1Checksum();
}
if ($package->getArchiveExcludes()) {
$data['archive']['exclude'] = $package->getArchiveExcludes();
}
foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
foreach ($links as $link) {
$data[$type][$link->getTarget()] = $link->getPrettyConstraint();
}
ksort($data[$type]);
}
}
if ($packages = $package->getSuggests()) {
ksort($packages);
$data['suggest'] = $packages;
}
if ($package->getReleaseDate()) {
$data['time'] = $package->getReleaseDate()->format('Y-m-d H:i:s');
}
$data = $this->dumpValues($package, $keys, $data);
if ($package instanceof CompletePackageInterface) {
$keys = array(
'scripts',
'license',
'authors',
'description',
'homepage',
'keywords',
'repositories',
'support',
);
$data = $this->dumpValues($package, $keys, $data);
if (isset($data['keywords']) && is_array($data['keywords'])) {
sort($data['keywords']);
}
}
if ($package instanceof RootPackageInterface) {
$minimumStability = $package->getMinimumStability();
if ($minimumStability) {
$data['minimum-stability'] = $minimumStability;
}
}
return $data;
}
private function dumpValues(PackageInterface $package, array $keys, array $data)
{
foreach ($keys as $method => $key) {
if (is_numeric($method)) {
$method = $key;
}
$getter = 'get'.ucfirst($method);
$value = $package->$getter();
if (null !== $value && !(is_array($value) && 0 === count($value))) {
$data[$key] = $value;
}
}
return $data;
}
}
<?php
namespace Composer\Package\Loader;
class InvalidPackageException extends \Exception
{
private $errors;
private $warnings;
private $data;
public function __construct(array $errors, array $warnings, array $data)
{
$this->errors = $errors;
$this->warnings = $warnings;
$this->data = $data;
parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
}
public function getData()
{
return $this->data;
}
public function getErrors()
{
return $this->errors;
}
public function getWarnings()
{
return $this->warnings;
}
}
<?php
namespace Composer\Package\Loader;
use Composer\Json\JsonFile;
class JsonLoader
{
private $loader;
public function __construct(LoaderInterface $loader)
{
$this->loader = $loader;
}
public function load($json)
{
if ($json instanceof JsonFile) {
$config = $json->read();
} elseif (file_exists($json)) {
$config = JsonFile::parseJson(file_get_contents($json), $json);
} elseif (is_string($json)) {
$config = JsonFile::parseJson($json);
}
return $this->loader->load($config);
}
}
<?php
namespace Composer\Package\Loader;
interface LoaderInterface
{
public function load(array $package, $class = 'Composer\Package\CompletePackage');
}
<?php
namespace Composer\Package\Loader;
use Composer\Package;
use Composer\Package\Version\VersionParser;
class ArrayLoader implements LoaderInterface
{
protected $versionParser;
public function __construct(VersionParser $parser = null)
{
if (!$parser) {
$parser = new VersionParser;
}
$this->versionParser = $parser;
}
public function load(array $config, $class = 'Composer\Package\CompletePackage')
{
if (!isset($config['name'])) {
throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
}
if (!isset($config['version'])) {
throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
}
if (isset($config['version_normalized'])) {
$version = $config['version_normalized'];
} else {
$version = $this->versionParser->normalize($config['version']);
}
$package = new $class($config['name'], $version, $config['version']);
$package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
if (isset($config['target-dir'])) {
$package->setTargetDir($config['target-dir']);
}
if (isset($config['extra']) && is_array($config['extra'])) {
$package->setExtra($config['extra']);
}
if (isset($config['bin'])) {
if (!is_array($config['bin'])) {
throw new \UnexpectedValueException('Package '.$config['name'].'\'s bin key should be an array, '.gettype($config['bin']).' given.');
}
foreach ($config['bin'] as $key => $bin) {
$config['bin'][$key]= ltrim($bin, '/');
}
$package->setBinaries($config['bin']);
}
if (isset($config['installation-source'])) {
$package->setInstallationSource($config['installation-source']);
}
if (isset($config['source'])) {
if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
throw new \UnexpectedValueException(sprintf(
"Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
$config['name'],
json_encode($config['source'])
));
}
$package->setSourceType($config['source']['type']);
$package->setSourceUrl($config['source']['url']);
$package->setSourceReference($config['source']['reference']);
}
if (isset($config['dist'])) {
if (!isset($config['dist']['type'])
|| !isset($config['dist']['url'])) {
throw new \UnexpectedValueException(sprintf(
"Package %s's dist key should be specified as ".
"{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
$config['name'],
json_encode($config['dist'])
));
}
$package->setDistType($config['dist']['type']);
$package->setDistUrl($config['dist']['url']);
$package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
$package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
}
if ($aliasNormalized = $this->getBranchAlias($config)) {
$package->setAlias($aliasNormalized);
$package->setPrettyAlias(preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
}
foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
if (isset($config[$type])) {
$method = 'set'.ucfirst($opts['method']);
$package->{$method}(
$this->versionParser->parseLinks(
$package->getName(),
$package->getPrettyVersion(),
$opts['description'],
$config[$type]
)
);
}
}
if (isset($config['suggest']) && is_array($config['suggest'])) {
foreach ($config['suggest'] as $target => $reason) {
if ('self.version' === trim($reason)) {
$config['suggest'][$target] = $package->getPrettyVersion();
}
}
$package->setSuggests($config['suggest']);
}
if (isset($config['autoload'])) {
$package->setAutoload($config['autoload']);
}
if (isset($config['include-path'])) {
$package->setIncludePaths($config['include-path']);
}
if (!empty($config['time'])) {
$time = ctype_digit($config['time']) ? '@'.$config['time'] : $config['time'];
try {
$date = new \DateTime($time, new \DateTimeZone('UTC'));
$package->setReleaseDate($date);
} catch (\Exception $e) {
}
}
if (!empty($config['notification-url'])) {
$package->setNotificationUrl($config['notification-url']);
}
if (!empty($config['archive']['exclude'])) {
$package->setArchiveExcludes($config['archive']['exclude']);
}
if ($package instanceof Package\CompletePackageInterface) {
if (isset($config['scripts']) && is_array($config['scripts'])) {
foreach ($config['scripts'] as $event => $listeners) {
$config['scripts'][$event] = (array) $listeners;
}
$package->setScripts($config['scripts']);
}
if (!empty($config['description']) && is_string($config['description'])) {
$package->setDescription($config['description']);
}
if (!empty($config['homepage']) && is_string($config['homepage'])) {
$package->setHomepage($config['homepage']);
}
if (!empty($config['keywords']) && is_array($config['keywords'])) {
$package->setKeywords($config['keywords']);
}
if (!empty($config['license'])) {
$package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
}
if (!empty($config['authors']) && is_array($config['authors'])) {
$package->setAuthors($config['authors']);
}
if (isset($config['support'])) {
$package->setSupport($config['support']);
}
}
return $package;
}
public function getBranchAlias(array $config)
{
if ('dev-' !== substr($config['version'], 0, 4)
|| !isset($config['extra']['branch-alias'])
|| !is_array($config['extra']['branch-alias'])
) {
return;
}
foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
if ('-dev' !== substr($targetBranch, -4)) {
continue;
}
$validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
if ('-dev' !== substr($validatedTargetBranch, -4)) {
continue;
}
if (strtolower($config['version']) !== strtolower($sourceBranch)) {
continue;
}
return $validatedTargetBranch;
}
}
}
<?php
namespace Composer\Package\Loader;
use Composer\Package;
use Composer\Package\BasePackage;
use Composer\Package\Version\VersionParser;
class ValidatingArrayLoader implements LoaderInterface
{
private $loader;
private $versionParser;
private $errors;
private $warnings;
private $config;
private $strictName;
public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null)
{
$this->loader = $loader;
$this->versionParser = $parser ?: new VersionParser();
$this->strictName = $strictName;
}
public function load(array $config, $class = 'Composer\Package\CompletePackage')
{
$this->errors = array();
$this->warnings = array();
$this->config = $config;
if ($this->strictName) {
$this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
} else {
$this->validateString('name', true);
}
if (!empty($this->config['version'])) {
try {
$this->versionParser->normalize($this->config['version']);
} catch (\Exception $e) {
unset($this->config['version']);
$this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
}
}
$this->validateRegex('type', '[A-Za-z0-9-]+');
$this->validateString('target-dir');
$this->validateArray('extra');
$this->validateFlatArray('bin');
$this->validateArray('scripts');
$this->validateString('description');
$this->validateUrl('homepage');
$this->validateFlatArray('keywords', '[A-Za-z0-9 ._-]+');
if (isset($this->config['license'])) {
if (is_string($this->config['license'])) {
$this->validateRegex('license', '[A-Za-z0-9+. ()-]+');
} else {
$this->validateFlatArray('license', '[A-Za-z0-9+. ()-]+');
}
}
$this->validateString('time');
if (!empty($this->config['time'])) {
try {
$date = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
} catch (\Exception $e) {
$this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
unset($this->config['time']);
}
}
if ($this->validateArray('authors') && !empty($this->config['authors'])) {
foreach ($this->config['authors'] as $key => $author) {
if (!is_array($author)) {
$this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
unset($this->config['authors'][$key]);
continue;
}
foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
if (isset($author[$authorData]) && !is_string($author[$authorData])) {
$this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
unset($this->config['authors'][$key][$authorData]);
}
}
if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
$this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
unset($this->config['authors'][$key]['homepage']);
}
if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
$this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
unset($this->config['authors'][$key]['email']);
}
if (empty($this->config['authors'][$key])) {
unset($this->config['authors'][$key]);
}
}
if (empty($this->config['authors'])) {
unset($this->config['authors']);
}
}
if ($this->validateArray('support') && !empty($this->config['support'])) {
foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc') as $key) {
if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
$this->errors[] = 'support.'.$key.' : invalid value, must be a string';
unset($this->config['support'][$key]);
}
}
if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
$this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
unset($this->config['support']['email']);
}
if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
$this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
unset($this->config['support']['irc']);
}
foreach (array('issues', 'forum', 'wiki', 'source') as $key) {
if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
$this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
unset($this->config['support'][$key]);
}
}
if (empty($this->config['support'])) {
unset($this->config['support']);
}
}
foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
foreach ($this->config[$linkType] as $package => $constraint) {
if (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
$this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
}
if (!is_string($constraint)) {
$this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
unset($this->config[$linkType][$package]);
} elseif ('self.version' !== $constraint) {
try {
$this->versionParser->parseConstraints($constraint);
} catch (\Exception $e) {
$this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
unset($this->config[$linkType][$package]);
}
}
}
}
}
if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
foreach ($this->config['suggest'] as $package => $description) {
if (!is_string($description)) {
$this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
unset($this->config['suggest'][$package]);
}
}
}
if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
$this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
unset($this->config['minimum-stability']);
}
}
$this->validateFlatArray('include-path');
if (isset($this->config['extra']['branch-alias'])) {
if (!is_array($this->config['extra']['branch-alias'])) {
$this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
} else {
foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
if ('-dev' !== substr($targetBranch, -4)) {
$this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
unset($this->config['extra']['branch-alias'][$sourceBranch]);
continue;
}
$validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
if ('-dev' !== substr($validatedTargetBranch, -4)) {
$this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
unset($this->config['extra']['branch-alias'][$sourceBranch]);
}
}
}
}
if ($this->errors) {
throw new InvalidPackageException($this->errors, $this->warnings, $config);
}
$package = $this->loader->load($this->config, $class);
$this->config = null;
return $package;
}
public function getWarnings()
{
return $this->warnings;
}
public function getErrors()
{
return $this->errors;
}
private function validateRegex($property, $regex, $mandatory = false)
{
if (!$this->validateString($property, $mandatory)) {
return false;
}
if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
$message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
if ($mandatory) {
$this->errors[] = $message;
} else {
$this->warnings[] = $message;
}
unset($this->config[$property]);
return false;
}
return true;
}
private function validateString($property, $mandatory = false)
{
if (isset($this->config[$property]) && !is_string($this->config[$property])) {
$this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
unset($this->config[$property]);
return false;
}
if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
if ($mandatory) {
$this->errors[] = $property.' : must be present';
}
unset($this->config[$property]);
return false;
}
return true;
}
private function validateArray($property, $mandatory = false)
{
if (isset($this->config[$property]) && !is_array($this->config[$property])) {
$this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
unset($this->config[$property]);
return false;
}
if (!isset($this->config[$property]) || !count($this->config[$property])) {
if ($mandatory) {
$this->errors[] = $property.' : must be present and contain at least one element';
}
unset($this->config[$property]);
return false;
}
return true;
}
private function validateFlatArray($property, $regex = null, $mandatory = false)
{
if (!$this->validateArray($property, $mandatory)) {
return false;
}
$pass = true;
foreach ($this->config[$property] as $key => $value) {
if (!is_string($value) && !is_numeric($value)) {
$this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
unset($this->config[$property][$key]);
$pass = false;
continue;
}
if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
$this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
unset($this->config[$property][$key]);
$pass = false;
}
}
return $pass;
}
private function validateUrl($property, $mandatory = false)
{
if (!$this->validateString($property, $mandatory)) {
return false;
}
if (!$this->filterUrl($this->config[$property])) {
$this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
unset($this->config[$property]);
return false;
}
return true;
}
private function filterUrl($value, array $schemes = array('http', 'https'))
{
if ($value === '') {
return true;
}
$bits = parse_url($value);
if (empty($bits['scheme']) || empty($bits['host'])) {
return false;
}
if (!in_array($bits['scheme'], $schemes, true)) {
return false;
}
return true;
}
}
<?php
namespace Composer\Package\Loader;
use Composer\Package\BasePackage;
use Composer\Config;
use Composer\Factory;
use Composer\Package\Version\VersionParser;
use Composer\Repository\RepositoryManager;
use Composer\Repository\Vcs\HgDriver;
use Composer\IO\NullIO;
use Composer\Util\ProcessExecutor;
class RootPackageLoader extends ArrayLoader
{
private $manager;
private $config;
private $process;
public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, ProcessExecutor $process = null)
{
$this->manager = $manager;
$this->config = $config;
$this->process = $process ?: new ProcessExecutor();
parent::__construct($parser);
}
public function load(array $config, $class = 'Composer\Package\RootPackage')
{
if (!isset($config['name'])) {
$config['name'] = '__root__';
}
if (!isset($config['version'])) {
if (getenv('COMPOSER_ROOT_VERSION')) {
$version = getenv('COMPOSER_ROOT_VERSION');
} else {
$version = $this->guessVersion($config);
}
if (!$version) {
$version = '1.0.0';
}
$config['version'] = $version;
} else {
$version = $config['version'];
}
$package = parent::load($config, $class);
$aliases = array();
$stabilityFlags = array();
$references = array();
foreach (array('require', 'require-dev') as $linkType) {
if (isset($config[$linkType])) {
$linkInfo = BasePackage::$supportedLinkTypes[$linkType];
$method = 'get'.ucfirst($linkInfo['method']);
$links = array();
foreach ($package->$method() as $link) {
$links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
}
$aliases = $this->extractAliases($links, $aliases);
$stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags);
$references = $this->extractReferences($links, $references);
}
}
$package->setAliases($aliases);
$package->setStabilityFlags($stabilityFlags);
$package->setReferences($references);
if (isset($config['minimum-stability'])) {
$package->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
}
$repos = Factory::createDefaultRepositories(null, $this->config, $this->manager);
foreach ($repos as $repo) {
$this->manager->addRepository($repo);
}
$package->setRepositories($this->config->getRepositories());
return $package;
}
private function extractAliases(array $requires, array $aliases)
{
foreach ($requires as $reqName => $reqVersion) {
if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
$aliases[] = array(
'package' => strtolower($reqName),
'version' => $this->versionParser->normalize($match[1], $reqVersion),
'alias' => $match[2],
'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
);
}
}
return $aliases;
}
private function extractStabilityFlags(array $requires, array $stabilityFlags)
{
$stabilities = BasePackage::$stabilities;
foreach ($requires as $reqName => $reqVersion) {
if (preg_match('{^[^,\s]*?@('.implode('|', array_keys($stabilities)).')$}i', $reqVersion, $match)) {
$name = strtolower($reqName);
$stability = $stabilities[VersionParser::normalizeStability($match[1])];
if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
continue;
}
$stabilityFlags[$name] = $stability;
continue;
}
$reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
$name = strtolower($reqName);
$stability = $stabilities[$stabilityName];
if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
continue;
}
$stabilityFlags[$name] = $stability;
}
}
return $stabilityFlags;
}
private function extractReferences(array $requires, array $references)
{
foreach ($requires as $reqName => $reqVersion) {
$reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === ($stabilityName = VersionParser::parseStability($reqVersion))) {
$name = strtolower($reqName);
$references[$name] = $match[1];
}
}
return $references;
}
private function guessVersion(array $config)
{
if (function_exists('proc_open')) {
$version = $this->guessGitVersion($config);
if (null !== $version) {
return $version;
}
return $this->guessHgVersion($config);
}
}
private function guessGitVersion(array $config)
{
if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output)) {
$branches = array();
$isFeatureBranch = false;
$version = null;
foreach ($this->process->splitLines($output) as $branch) {
if ($branch && preg_match('{^(?:\* ) *(\S+|\(no branch\)) *([a-f0-9]+) .*$}', $branch, $match)) {
if ($match[1] === '(no branch)') {
$version = 'dev-'.$match[2];
$isFeatureBranch = true;
} else {
$version = $this->versionParser->normalizeBranch($match[1]);
$isFeatureBranch = 0 === strpos($version, 'dev-');
if ('9999999-dev' === $version) {
$version = 'dev-'.$match[1];
}
}
}
if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
$branches[] = $match[1];
}
}
}
if (!$isFeatureBranch) {
return $version;
}
$version = $this->guessFeatureVersion($config, $version, $branches, 'git rev-list %candidate%..%branch%');
return $version;
}
}
private function guessHgVersion(array $config)
{
if (0 === $this->process->execute('hg branch', $output)) {
$branch = trim($output);
$version = $this->versionParser->normalizeBranch($branch);
$isFeatureBranch = 0 === strpos($version, 'dev-');
if ('9999999-dev' === $version) {
$version = 'dev-'.$branch;
}
if (!$isFeatureBranch) {
return $version;
}
$config = array('url' => getcwd());
$driver = new HgDriver($config, new NullIO(), $this->config, $this->process);
$branches = array_keys($driver->getBranches());
$version = $this->guessFeatureVersion($config, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"');
return $version;
}
}
private function guessFeatureVersion(array $config, $version, array $branches, $scmCmdline)
{
if ((isset($config['extra']['branch-alias']) && !isset($config['extra']['branch-alias'][$version]))
|| strpos(json_encode($config), '"self.version"')
) {
$branch = preg_replace('{^dev-}', '', $version);
$length = PHP_INT_MAX;
foreach ($branches as $candidate) {
if ($candidate === $branch || !preg_match('{^(master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
continue;
}
$cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
if (0 !== $this->process->execute($cmdLine, $output)) {
continue;
}
if (strlen($output) < $length) {
$length = strlen($output);
$version = $this->versionParser->normalizeBranch($candidate);
if ('9999999-dev' === $version) {
$version = 'dev-'.$match[1];
}
}
}
}
return $version;
}
}
<?php
namespace Composer\Package;
use Composer\Json\JsonFile;
use Composer\Installer\InstallationManager;
use Composer\Repository\RepositoryManager;
use Composer\Util\ProcessExecutor;
use Composer\Package\AliasPackage;
use Composer\Repository\ArrayRepository;
use Composer\Package\Dumper\ArrayDumper;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Version\VersionParser;
class Locker
{
private $lockFile;
private $repositoryManager;
private $installationManager;
private $hash;
private $loader;
private $dumper;
private $lockDataCache;
public function __construct(JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $hash)
{
$this->lockFile = $lockFile;
$this->repositoryManager = $repositoryManager;
$this->installationManager = $installationManager;
$this->hash = $hash;
$this->loader = new ArrayLoader();
$this->dumper = new ArrayDumper();
}
public function isLocked()
{
if (!$this->lockFile->exists()) {
return false;
}
$data = $this->getLockData();
return isset($data['packages']);
}
public function isFresh()
{
$lock = $this->lockFile->read();
return $this->hash === $lock['hash'];
}
public function getLockedRepository($withDevReqs = false)
{
$lockData = $this->getLockData();
$packages = new ArrayRepository();
$lockedPackages = $lockData['packages'];
if ($withDevReqs) {
if (isset($lockData['packages-dev'])) {
$lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
} else {
throw new \RuntimeException('The lock file does not contain require-dev information, run install without --dev or run update to install those packages.');
}
}
if (empty($lockedPackages)) {
return $packages;
}
if (isset($lockedPackages[0]['name'])) {
foreach ($lockedPackages as $info) {
$packages->addPackage($this->loader->load($info));
}
return $packages;
}
throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
}
public function getPlatformRequirements($withDevReqs = false)
{
$lockData = $this->getLockData();
$versionParser = new VersionParser();
$requirements = array();
if (!empty($lockData['platform'])) {
$requirements = $versionParser->parseLinks(
'__ROOT__',
'1.0.0',
'requires',
isset($lockData['platform']) ? $lockData['platform'] : array()
);
}
if ($withDevReqs && !empty($lockData['platform-dev'])) {
$devRequirements = $versionParser->parseLinks(
'__ROOT__',
'1.0.0',
'requires',
isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
);
$requirements = array_merge($requirements, $devRequirements);
}
return $requirements;
}
public function getMinimumStability()
{
$lockData = $this->getLockData();
return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
}
public function getStabilityFlags()
{
$lockData = $this->getLockData();
return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
}
public function getAliases()
{
$lockData = $this->getLockData();
return isset($lockData['aliases']) ? $lockData['aliases'] : array();
}
public function getLockData()
{
if (null !== $this->lockDataCache) {
return $this->lockDataCache;
}
if (!$this->lockFile->exists()) {
throw new \LogicException('No lockfile found. Unable to read locked packages');
}
return $this->lockDataCache = $this->lockFile->read();
}
public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags)
{
$lock = array(
'hash' => $this->hash,
'packages' => null,
'packages-dev' => null,
'aliases' => array(),
'minimum-stability' => $minimumStability,
'stability-flags' => $stabilityFlags,
);
foreach ($aliases as $package => $versions) {
foreach ($versions as $version => $alias) {
$lock['aliases'][] = array(
'alias' => $alias['alias'],
'alias_normalized' => $alias['alias_normalized'],
'version' => $version,
'package' => $package,
);
}
}
$lock['packages'] = $this->lockPackages($packages);
if (null !== $devPackages) {
$lock['packages-dev'] = $this->lockPackages($devPackages);
}
if (empty($lock['packages']) && empty($lock['packages-dev'])) {
if ($this->lockFile->exists()) {
unlink($this->lockFile->getPath());
}
return false;
}
$lock['platform'] = $platformReqs;
$lock['platform-dev'] = $platformDevReqs;
if (!$this->isLocked() || $lock !== $this->getLockData()) {
$this->lockFile->write($lock);
$this->lockDataCache = null;
return true;
}
return false;
}
private function lockPackages(array $packages)
{
$locked = array();
foreach ($packages as $package) {
if ($package instanceof AliasPackage) {
continue;
}
$name = $package->getPrettyName();
$version = $package->getPrettyVersion();
if (!$name || !$version) {
throw new \LogicException(sprintf(
'Package "%s" has no version or name and can not be locked', $package
));
}
$spec = $this->dumper->dump($package);
unset($spec['version_normalized']);
$time = isset($spec['time']) ? $spec['time'] : null;
unset($spec['time']);
if ($package->isDev()) {
$time = $this->getPackageTime($package) ?: $time;
}
if (null !== $time) {
$spec['time'] = $time;
}
unset($spec['installation-source']);
$locked[] = $spec;
}
usort($locked, function ($a, $b) {
$comparison = strcmp($a['name'], $b['name']);
if (0 !== $comparison) {
return $comparison;
}
return strcmp($a['version'], $b['version']);
});
return $locked;
}
private function getPackageTime(PackageInterface $package)
{
if (!function_exists('proc_open')) {
return null;
}
$path = $this->installationManager->getInstallPath($package);
$sourceType = $package->getSourceType();
$datetime = null;
if ($path && in_array($sourceType, array('git', 'hg'))) {
$sourceRef = $package->getSourceReference() ?: $package->getDistReference();
$process = new ProcessExecutor();
switch ($sourceType) {
case 'git':
if (0 === $process->execute('git log -n1 --pretty=%ct '.escapeshellarg($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
$datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
}
break;
case 'hg':
if (0 === $process->execute('hg log --template "{date|hgdate}" -r '.escapeshellarg($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
$datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
}
break;
}
}
return $datetime ? $datetime->format('Y-m-d H:i:s') : null;
}
}
<?php
namespace Composer\Package;
use Composer\Repository\RepositoryInterface;
interface PackageInterface
{
public function getName();
public function getPrettyName();
public function getNames();
public function setId($id);
public function getId();
public function isDev();
public function getType();
public function getTargetDir();
public function getExtra();
public function setInstallationSource($type);
public function getInstallationSource();
public function getSourceType();
public function getSourceUrl();
public function getSourceReference();
public function getDistType();
public function getDistUrl();
public function getDistReference();
public function getDistSha1Checksum();
public function getVersion();
public function getPrettyVersion();
public function getReleaseDate();
public function getStability();
public function getRequires();
public function getConflicts();
public function getProvides();
public function getReplaces();
public function getDevRequires();
public function getSuggests();
public function getAutoload();
public function getIncludePaths();
public function setRepository(RepositoryInterface $repository);
public function getRepository();
public function getBinaries();
public function getAlias();
public function getPrettyAlias();
public function getUniqueName();
public function getNotificationUrl();
public function __toString();
public function getPrettyString();
public function getArchiveExcludes();
}
<?php
namespace Composer\Package;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\PlatformRepository;
abstract class BasePackage implements PackageInterface
{
public static $supportedLinkTypes = array(
'require' => array('description' => 'requires', 'method' => 'requires'),
'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
'provide' => array('description' => 'provides', 'method' => 'provides'),
'replace' => array('description' => 'replaces', 'method' => 'replaces'),
'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
);
const STABILITY_STABLE = 0;
const STABILITY_RC = 5;
const STABILITY_BETA = 10;
const STABILITY_ALPHA = 15;
const STABILITY_DEV = 20;
public static $stabilities = array(
'stable' => self::STABILITY_STABLE,
'RC' => self::STABILITY_RC,
'beta' => self::STABILITY_BETA,
'alpha' => self::STABILITY_ALPHA,
'dev' => self::STABILITY_DEV,
);
protected $name;
protected $prettyName;
protected $repository;
protected $id;
public function __construct($name)
{
$this->prettyName = $name;
$this->name = strtolower($name);
$this->id = -1;
}
public function getName()
{
return $this->name;
}
public function getPrettyName()
{
return $this->prettyName;
}
public function getNames()
{
$names = array(
$this->getName() => true,
);
foreach ($this->getProvides() as $link) {
$names[$link->getTarget()] = true;
}
foreach ($this->getReplaces() as $link) {
$names[$link->getTarget()] = true;
}
return array_keys($names);
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setRepository(RepositoryInterface $repository)
{
if ($this->repository) {
throw new \LogicException('A package can only be added to one repository');
}
$this->repository = $repository;
}
public function getRepository()
{
return $this->repository;
}
public function isPlatform()
{
return $this->getRepository() instanceof PlatformRepository;
}
public function getUniqueName()
{
return $this->getName().'-'.$this->getVersion();
}
public function equals(PackageInterface $package)
{
$self = $this;
if ($this instanceof AliasPackage) {
$self = $this->getAliasOf();
}
if ($package instanceof AliasPackage) {
$package = $package->getAliasOf();
}
return $package === $self;
}
public function __toString()
{
return $this->getUniqueName();
}
public function getPrettyString()
{
return $this->getPrettyName().' '.$this->getPrettyVersion();
}
public function __clone()
{
$this->repository = null;
$this->id = -1;
}
}
<?php
namespace Composer\Package\Version;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
use Composer\Package\Link;
use Composer\Package\LinkConstraint\MultiConstraint;
use Composer\Package\LinkConstraint\VersionConstraint;
class VersionParser
{
private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)(?:[.-]?(\d+))?)?([.-]?dev)?';
public static function parseStability($version)
{
$version = preg_replace('{#.+$}i', '', $version);
if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
return 'dev';
}
preg_match('{'.self::$modifierRegex.'$}i', strtolower($version), $match);
if (!empty($match[3])) {
return 'dev';
}
if (!empty($match[1])) {
if ('beta' === $match[1] || 'b' === $match[1]) {
return 'beta';
}
if ('alpha' === $match[1] || 'a' === $match[1]) {
return 'alpha';
}
if ('rc' === $match[1]) {
return 'RC';
}
}
return 'stable';
}
public static function normalizeStability($stability)
{
$stability = strtolower($stability);
return $stability === 'rc' ? 'RC' : $stability;
}
public static function formatVersion(PackageInterface $package, $truncate = true)
{
if (!$package->isDev() || !in_array($package->getSourceType(), array('hg', 'git'))) {
return $package->getPrettyVersion();
}
if ($truncate && strlen($package->getSourceReference()) === 40) {
return $package->getPrettyVersion() . ' ' . substr($package->getSourceReference(), 0, 7);
}
return $package->getPrettyVersion() . ' ' . $package->getSourceReference();
}
public function normalize($version, $fullVersion = null)
{
$version = trim($version);
if (null === $fullVersion) {
$fullVersion = $version;
}
if (preg_match('{^([^,\s]+) +as +([^,\s]+)$}', $version, $match)) {
$version = $match[1];
}
if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
return '9999999-dev';
}
if ('dev-' === strtolower(substr($version, 0, 4))) {
return 'dev-'.substr($version, 4);
}
if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?'.self::$modifierRegex.'$}i', $version, $matches)) {
$version = $matches[1]
.(!empty($matches[2]) ? $matches[2] : '.0')
.(!empty($matches[3]) ? $matches[3] : '.0')
.(!empty($matches[4]) ? $matches[4] : '.0');
$index = 5;
} elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)'.self::$modifierRegex.'$}i', $version, $matches)) {
$version = preg_replace('{\D}', '-', $matches[1]);
$index = 2;
}
if (isset($index)) {
if (!empty($matches[$index])) {
if ('stable' === $matches[$index]) {
return $version;
}
$version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index+1]) ? $matches[$index+1] : '');
}
if (!empty($matches[$index+2])) {
$version .= '-dev';
}
return $version;
}
if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
try {
return $this->normalizeBranch($match[1]);
} catch (\Exception $e) {}
}
$extraMessage = '';
if (preg_match('{ +as +'.preg_quote($version).'$}', $fullVersion)) {
$extraMessage = ' in "'.$fullVersion.'", the alias must be an exact version';
} elseif (preg_match('{^'.preg_quote($version).' +as +}', $fullVersion)) {
$extraMessage = ' in "'.$fullVersion.'", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
}
throw new \UnexpectedValueException('Invalid version string "'.$version.'"'.$extraMessage);
}
public function normalizeBranch($name)
{
$name = trim($name);
if (in_array($name, array('master', 'trunk', 'default'))) {
return $this->normalize($name);
}
if (preg_match('#^v?(\d+)(\.(?:\d+|[x*]))?(\.(?:\d+|[x*]))?(\.(?:\d+|[x*]))?$#i', $name, $matches)) {
$version = '';
for ($i = 1; $i < 5; $i++) {
$version .= isset($matches[$i]) ? str_replace('*', 'x', $matches[$i]) : '.x';
}
return str_replace('x', '9999999', $version).'-dev';
}
return 'dev-'.$name;
}
public function parseLinks($source, $sourceVersion, $description, $links)
{
$res = array();
foreach ($links as $target => $constraint) {
if ('self.version' === $constraint) {
$parsedConstraint = $this->parseConstraints($sourceVersion);
} else {
$parsedConstraint = $this->parseConstraints($constraint);
}
$res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
}
return $res;
}
public function parseConstraints($constraints)
{
$prettyConstraint = $constraints;
if (preg_match('{^([^,\s]*?)@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $constraints, $match)) {
$constraints = empty($match[1]) ? '*' : $match[1];
}
if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
$constraints = $match[1];
}
$constraints = preg_split('{\s*,\s*}', trim($constraints));
if (count($constraints) > 1) {
$constraintObjects = array();
foreach ($constraints as $constraint) {
$constraintObjects = array_merge($constraintObjects, $this->parseConstraint($constraint));
}
} else {
$constraintObjects = $this->parseConstraint($constraints[0]);
}
if (1 === count($constraintObjects)) {
$constraint = $constraintObjects[0];
} else {
$constraint = new MultiConstraint($constraintObjects);
}
$constraint->setPrettyString($prettyConstraint);
return $constraint;
}
private function parseConstraint($constraint)
{
if (preg_match('{^([^,\s]+?)@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $constraint, $match)) {
$constraint = $match[1];
if ($match[2] !== 'stable') {
$stabilityModifier = $match[2];
}
}
if (preg_match('{^[x*](\.[x*])*$}i', $constraint)) {
return array();
}
if (preg_match('{^~(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?'.self::$modifierRegex.'?$}i', $constraint, $matches)) {
if (isset($matches[4]) && '' !== $matches[4]) {
$highVersion = $matches[1] . '.' . $matches[2] . '.' . ($matches[3] + 1) . '.0-dev';
$lowVersion = $matches[1] . '.' . $matches[2] . '.' . $matches[3]. '.' . $matches[4];
} elseif (isset($matches[3]) && '' !== $matches[3]) {
$highVersion = $matches[1] . '.' . ($matches[2] + 1) . '.0.0-dev';
$lowVersion = $matches[1] . '.' . $matches[2] . '.' . $matches[3]. '.0';
} else {
$highVersion = ($matches[1] + 1) . '.0.0.0-dev';
if (isset($matches[2]) && '' !== $matches[2]) {
$lowVersion = $matches[1] . '.' . $matches[2] . '.0.0';
} else {
$lowVersion = $matches[1] . '.0.0.0';
}
}
if (!empty($matches[5])) {
$lowVersion .= '-' . $this->expandStability($matches[5]) . (!empty($matches[6]) ? $matches[6] : '');
}
if (!empty($matches[7])) {
$lowVersion .= '-dev';
}
return array(
new VersionConstraint('>=', $lowVersion),
new VersionConstraint('<', $highVersion),
);
}
if (preg_match('{^(\d+)(?:\.(\d+))?(?:\.(\d+))?\.[x*]$}', $constraint, $matches)) {
if (isset($matches[3])) {
$highVersion = $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.9999999';
if ($matches[3] === '0') {
$lowVersion = $matches[1] . '.' . ($matches[2] - 1) . '.9999999.9999999';
} else {
$lowVersion = $matches[1] . '.' . $matches[2] . '.' . ($matches[3] - 1). '.9999999';
}
} elseif (isset($matches[2])) {
$highVersion = $matches[1] . '.' . $matches[2] . '.9999999.9999999';
if ($matches[2] === '0') {
$lowVersion = ($matches[1] - 1) . '.9999999.9999999.9999999';
} else {
$lowVersion = $matches[1] . '.' . ($matches[2] - 1) . '.9999999.9999999';
}
} else {
$highVersion = $matches[1] . '.9999999.9999999.9999999';
if ($matches[1] === '0') {
return array(new VersionConstraint('<', $highVersion));
} else {
$lowVersion = ($matches[1] - 1) . '.9999999.9999999.9999999';
}
}
return array(
new VersionConstraint('>', $lowVersion),
new VersionConstraint('<', $highVersion),
);
}
if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
try {
$version = $this->normalize($matches[2]);
if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
$version .= '-' . $stabilityModifier;
} elseif ('<' === $matches[1]) {
if (!preg_match('/-stable$/', strtolower($matches[2]))) {
$version .= '-dev';
}
}
return array(new VersionConstraint($matches[1] ?: '=', $version));
} catch (\Exception $e) { }
}
$message = 'Could not parse version constraint '.$constraint;
if (isset($e)) {
$message .= ': '.$e->getMessage();
}
throw new \UnexpectedValueException($message);
}
private function expandStability($stability)
{
$stability = strtolower($stability);
switch ($stability) {
case 'a':
return 'alpha';
case 'b':
return 'beta';
case 'p':
case 'pl':
return 'patch';
case 'rc':
return 'RC';
default:
return $stability;
}
}
public function parseNameVersionPairs(array $pairs)
{
$pairs = array_values($pairs);
$result = array();
for ($i = 0, $count = count($pairs); $i < $count; $i++) {
$pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
if (false === strpos($pair, ' ') && isset($pairs[$i+1]) && false === strpos($pairs[$i+1], '/')) {
$pair .= ' '.$pairs[$i+1];
$i++;
}
if (strpos($pair, ' ')) {
list($name, $version) = explode(" ", $pair, 2);
$result[] = array('name' => $name, 'version' => $version);
} else {
$result[] = array('name' => $pair);
}
}
return $result;
}
}
<?php
namespace Composer\Package;
interface CompletePackageInterface extends PackageInterface
{
public function getScripts();
public function getRepositories();
public function getLicense();
public function getKeywords();
public function getDescription();
public function getHomepage();
public function getAuthors();
public function getSupport();
}
<?php
namespace Composer\Package;
interface RootPackageInterface extends CompletePackageInterface
{
public function getMinimumStability();
public function getStabilityFlags();
public function getReferences();
}
<?php
namespace Composer\Package;
class RootPackage extends CompletePackage implements RootPackageInterface
{
protected $minimumStability = 'stable';
protected $stabilityFlags = array();
protected $references = array();
public function setMinimumStability($minimumStability)
{
$this->minimumStability = $minimumStability;
}
public function getMinimumStability()
{
return $this->minimumStability;
}
public function setStabilityFlags(array $stabilityFlags)
{
$this->stabilityFlags = $stabilityFlags;
}
public function getStabilityFlags()
{
return $this->stabilityFlags;
}
public function setReferences(array $references)
{
$this->references = $references;
}
public function getReferences()
{
return $this->references;
}
}
<?php
namespace Composer\Package\Archiver;
use Composer\Package\PackageInterface;
interface ArchiverInterface
{
public function archive($sources, $target, $format, array $excludes = array());
public function supports($format, $sourceType);
}
<?php
namespace Composer\Package\Archiver;
class ComposerExcludeFilter extends BaseExcludeFilter
{
public function __construct($sourcePath, array $excludeRules)
{
parent::__construct($sourcePath);
$this->excludePatterns = $this->generatePatterns($excludeRules);
}
}
<?php
namespace Composer\Package\Archiver;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
class PharArchiver implements ArchiverInterface
{
protected static $formats = array(
'zip' => \Phar::ZIP,
'tar' => \Phar::TAR,
);
public function archive($sources, $target, $format, array $excludes = array())
{
$sources = realpath($sources);
if (file_exists($target)) {
unlink($target);
}
try {
$phar = new \PharData($target, null, null, static::$formats[$format]);
$files = new ArchivableFilesFinder($sources, $excludes);
$phar->buildFromIterator($files, $sources);
return $target;
} catch (\UnexpectedValueException $e) {
$message = sprintf("Could not create archive '%s' from '%s': %s",
$target,
$sources,
$e->getMessage()
);
throw new \RuntimeException($message, $e->getCode(), $e);
}
}
public function supports($format, $sourceType)
{
return isset(static::$formats[$format]);
}
}
<?php
namespace Composer\Package\Archiver;
use Symfony\Component\Finder;
abstract class BaseExcludeFilter
{
protected $sourcePath;
protected $excludePatterns;
public function __construct($sourcePath)
{
$this->sourcePath = $sourcePath;
$this->excludePatterns = array();
}
public function filter($relativePath, $exclude)
{
foreach ($this->excludePatterns as $patternData) {
list($pattern, $negate, $stripLeadingSlash) = $patternData;
if ($stripLeadingSlash) {
$path = substr($relativePath, 1);
} else {
$path = $relativePath;
}
if (preg_match($pattern, $path)) {
$exclude = !$negate;
}
}
return $exclude;
}
protected function parseLines(array $lines, $lineParser)
{
return array_filter(
array_map(
function ($line) use ($lineParser) {
$line = trim($line);
$commentHash = strpos($line, '#');
if ($commentHash !== false) {
$line = substr($line, 0, $commentHash);
}
if ($line) {
return call_user_func($lineParser, $line);
}
return null;
}, $lines),
function ($pattern) {
return $pattern !== null;
}
);
}
protected function generatePatterns($rules)
{
$patterns = array();
foreach ($rules as $rule) {
$patterns[] = $this->generatePattern($rule);
}
return $patterns;
}
protected function generatePattern($rule)
{
$negate = false;
$pattern = '#';
if (strlen($rule) && $rule[0] === '!') {
$negate = true;
$rule = substr($rule, 1);
}
if (strlen($rule) && $rule[0] === '/') {
$pattern .= '^/';
$rule = substr($rule, 1);
}
$pattern .= substr(Finder\Glob::toRegex($rule), 2, -2);
return array($pattern . '#', $negate, false);
}
}
<?php
namespace Composer\Package\Archiver;
class GitExcludeFilter extends BaseExcludeFilter
{
public function __construct($sourcePath)
{
parent::__construct($sourcePath);
if (file_exists($sourcePath.'/.gitignore')) {
$this->excludePatterns = $this->parseLines(
file($sourcePath.'/.gitignore'),
array($this, 'parseGitIgnoreLine')
);
}
if (file_exists($sourcePath.'/.gitattributes')) {
$this->excludePatterns = array_merge(
$this->excludePatterns,
$this->parseLines(
file($sourcePath.'/.gitattributes'),
array($this, 'parseGitAttributesLine')
));
}
}
public function parseGitIgnoreLine($line)
{
return $this->generatePattern($line);
}
public function parseGitAttributesLine($line)
{
$parts = preg_split('#\s+#', $line);
if (count($parts) != 2) {
return null;
}
if ($parts[1] === 'export-ignore') {
return $this->generatePattern($parts[0]);
}
}
}
<?php
namespace Composer\Package\Archiver;
use Composer\Package\BasePackage;
use Composer\Package\PackageInterface;
use Symfony\Component\Finder;
class ArchivableFilesFinder extends \FilterIterator
{
protected $finder;
public function __construct($sources, array $excludes)
{
$sources = realpath($sources);
$filters = array(
new HgExcludeFilter($sources),
new GitExcludeFilter($sources),
new ComposerExcludeFilter($sources, $excludes),
);
$this->finder = new Finder\Finder();
$this->finder
->in($sources)
->filter(function (\SplFileInfo $file) use ($sources, $filters) {
$relativePath = preg_replace(
'#^'.preg_quote($sources, '#').'#',
'',
str_replace(DIRECTORY_SEPARATOR, '/', $file->getRealPath())
);
$exclude = false;
foreach ($filters as $filter) {
$exclude = $filter->filter($relativePath, $exclude);
}
return !$exclude;
})
->ignoreVCS(true)
->ignoreDotFiles(false);
parent::__construct($this->finder->getIterator());
}
public function accept()
{
return !$this->getInnerIterator()->current()->isDir();
}
}
<?php
namespace Composer\Package\Archiver;
use Composer\Downloader\DownloadManager;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackage;
use Composer\Util\Filesystem;
class ArchiveManager
{
protected $downloadManager;
protected $archivers = array();
protected $overwriteFiles = true;
public function __construct(DownloadManager $downloadManager)
{
$this->downloadManager = $downloadManager;
}
public function addArchiver(ArchiverInterface $archiver)
{
$this->archivers[] = $archiver;
}
public function setOverwriteFiles($overwriteFiles)
{
$this->overwriteFiles = $overwriteFiles;
return $this;
}
public function getPackageFilename(PackageInterface $package)
{
$nameParts = array(preg_replace('#[^a-z0-9-_.]#i', '-', $package->getName()));
if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
$nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
} else {
$nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
}
if ($package->getSourceReference()) {
$nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
}
return implode('-', array_filter($nameParts, function ($p) {
return !empty($p);
}));
}
public function archive(PackageInterface $package, $format, $targetDir)
{
if (empty($format)) {
throw new \InvalidArgumentException('Format must be specified');
}
$usableArchiver = null;
foreach ($this->archivers as $archiver) {
if ($archiver->supports($format, $package->getSourceType())) {
$usableArchiver = $archiver;
break;
}
}
if (null === $usableArchiver) {
throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
}
$filesystem = new Filesystem();
$packageName = $this->getPackageFilename($package);
$filesystem->ensureDirectoryExists($targetDir);
$target = realpath($targetDir).'/'.$packageName.'.'.$format;
$filesystem->ensureDirectoryExists(dirname($target));
if (!$this->overwriteFiles && file_exists($target)) {
return $target;
}
if ($package instanceof RootPackage) {
$sourcePath = realpath('.');
} else {
$sourcePath = sys_get_temp_dir().'/composer_archiver/'.$packageName;
$filesystem->ensureDirectoryExists($sourcePath);
$this->downloadManager->download($package, $sourcePath, true);
}
return $usableArchiver->archive($sourcePath, $target, $format, $package->getArchiveExcludes());
}
}
<?php
namespace Composer\Package\Archiver;
use Symfony\Component\Finder;
class HgExcludeFilter extends BaseExcludeFilter
{
const HG_IGNORE_REGEX = 1;
const HG_IGNORE_GLOB = 2;
protected $patternMode;
public function __construct($sourcePath)
{
parent::__construct($sourcePath);
$this->patternMode = self::HG_IGNORE_REGEX;
if (file_exists($sourcePath.'/.hgignore')) {
$this->excludePatterns = $this->parseLines(
file($sourcePath.'/.hgignore'),
array($this, 'parseHgIgnoreLine')
);
}
}
public function parseHgIgnoreLine($line)
{
if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
if ($matches[1] === 'glob') {
$this->patternMode = self::HG_IGNORE_GLOB;
} else {
$this->patternMode = self::HG_IGNORE_REGEX;
}
return null;
}
if ($this->patternMode == self::HG_IGNORE_GLOB) {
return $this->patternFromGlob($line);
} else {
return $this->patternFromRegex($line);
}
}
protected function patternFromGlob($line)
{
$pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
$pattern = str_replace('[^/]*', '.*', $pattern);
return array($pattern, false, true);
}
public function patternFromRegex($line)
{
$pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
return array($pattern, false, true);
}
}
<?php
namespace Composer\Package;
use Composer\Package\Version\VersionParser;
class Package extends BasePackage
{
protected $type;
protected $targetDir;
protected $installationSource;
protected $sourceType;
protected $sourceUrl;
protected $sourceReference;
protected $distType;
protected $distUrl;
protected $distReference;
protected $distSha1Checksum;
protected $version;
protected $prettyVersion;
protected $releaseDate;
protected $extra = array();
protected $binaries = array();
protected $aliases = array();
protected $alias;
protected $prettyAlias;
protected $dev;
protected $stability;
protected $notificationUrl;
protected $requires = array();
protected $conflicts = array();
protected $provides = array();
protected $replaces = array();
protected $devRequires = array();
protected $suggests = array();
protected $autoload = array();
protected $includePaths = array();
protected $archiveExcludes = array();
public function __construct($name, $version, $prettyVersion)
{
parent::__construct($name);
$this->version = $version;
$this->prettyVersion = $prettyVersion;
$this->stability = VersionParser::parseStability($version);
$this->dev = $this->stability === 'dev';
}
public function isDev()
{
return $this->dev;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type ?: 'library';
}
public function getStability()
{
return $this->stability;
}
public function setTargetDir($targetDir)
{
$this->targetDir = $targetDir;
}
public function getTargetDir()
{
if (null === $this->targetDir) {
return;
}
return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
}
public function setExtra(array $extra)
{
$this->extra = $extra;
}
public function getExtra()
{
return $this->extra;
}
public function setBinaries(array $binaries)
{
$this->binaries = $binaries;
}
public function getBinaries()
{
return $this->binaries;
}
public function setAliases(array $aliases)
{
$this->aliases = $aliases;
}
public function getAliases()
{
return $this->aliases;
}
public function setAlias($alias)
{
$this->alias = $alias;
}
public function getAlias()
{
return $this->alias;
}
public function setPrettyAlias($prettyAlias)
{
$this->prettyAlias = $prettyAlias;
}
public function getPrettyAlias()
{
return $this->prettyAlias;
}
public function setInstallationSource($type)
{
$this->installationSource = $type;
}
public function getInstallationSource()
{
return $this->installationSource;
}
public function setSourceType($type)
{
$this->sourceType = $type;
}
public function getSourceType()
{
return $this->sourceType;
}
public function setSourceUrl($url)
{
$this->sourceUrl = $url;
}
public function getSourceUrl()
{
return $this->sourceUrl;
}
public function setSourceReference($reference)
{
$this->sourceReference = $reference;
}
public function getSourceReference()
{
return $this->sourceReference;
}
public function setDistType($type)
{
$this->distType = $type;
}
public function getDistType()
{
return $this->distType;
}
public function setDistUrl($url)
{
$this->distUrl = $url;
}
public function getDistUrl()
{
return $this->distUrl;
}
public function setDistReference($reference)
{
$this->distReference = $reference;
}
public function getDistReference()
{
return $this->distReference;
}
public function setDistSha1Checksum($sha1checksum)
{
$this->distSha1Checksum = $sha1checksum;
}
public function getDistSha1Checksum()
{
return $this->distSha1Checksum;
}
public function getVersion()
{
return $this->version;
}
public function getPrettyVersion()
{
return $this->prettyVersion;
}
public function setReleaseDate(\DateTime $releaseDate)
{
$this->releaseDate = $releaseDate;
}
public function getReleaseDate()
{
return $this->releaseDate;
}
public function setRequires(array $requires)
{
$this->requires = $requires;
}
public function getRequires()
{
return $this->requires;
}
public function setConflicts(array $conflicts)
{
$this->conflicts = $conflicts;
}
public function getConflicts()
{
return $this->conflicts;
}
public function setProvides(array $provides)
{
$this->provides = $provides;
}
public function getProvides()
{
return $this->provides;
}
public function setReplaces(array $replaces)
{
$this->replaces = $replaces;
}
public function getReplaces()
{
return $this->replaces;
}
public function setDevRequires(array $devRequires)
{
$this->devRequires = $devRequires;
}
public function getDevRequires()
{
return $this->devRequires;
}
public function setSuggests(array $suggests)
{
$this->suggests = $suggests;
}
public function getSuggests()
{
return $this->suggests;
}
public function setAutoload(array $autoload)
{
$this->autoload = $autoload;
}
public function getAutoload()
{
return $this->autoload;
}
public function setIncludePaths(array $includePaths)
{
$this->includePaths = $includePaths;
}
public function getIncludePaths()
{
return $this->includePaths;
}
public function setNotificationUrl($notificationUrl)
{
$this->notificationUrl = $notificationUrl;
}
public function getNotificationUrl()
{
return $this->notificationUrl;
}
public function setArchiveExcludes(array $excludes)
{
$this->archiveExcludes = $excludes;
}
public function getArchiveExcludes()
{
return $this->archiveExcludes;
}
}
<?php
namespace Composer\Package;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Version\VersionParser;
class AliasPackage extends BasePackage implements CompletePackageInterface
{
protected $version;
protected $prettyVersion;
protected $dev;
protected $aliasOf;
protected $rootPackageAlias = false;
protected $stability;
protected $requires;
protected $conflicts;
protected $provides;
protected $replaces;
protected $recommends;
protected $suggests;
public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
{
parent::__construct($aliasOf->getName());
$this->version = $version;
$this->prettyVersion = $prettyVersion;
$this->aliasOf = $aliasOf;
$this->stability = VersionParser::parseStability($version);
$this->dev = $this->stability === 'dev';
foreach (array('requires', 'devRequires') as $type) {
$links = $aliasOf->{'get'.ucfirst($type)}();
foreach ($links as $index => $link) {
if ('self.version' === $link->getPrettyConstraint()) {
$links[$index] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $prettyVersion);
}
}
$this->$type = $links;
}
foreach (array('conflicts', 'provides', 'replaces') as $type) {
$links = $aliasOf->{'get'.ucfirst($type)}();
$newLinks = array();
foreach ($links as $link) {
if ('self.version' === $link->getPrettyConstraint()) {
$newLinks[] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $prettyVersion);
}
}
$this->$type = array_merge($links, $newLinks);
}
}
public function getAliasOf()
{
return $this->aliasOf;
}
public function getVersion()
{
return $this->version;
}
public function getStability()
{
return $this->stability;
}
public function getPrettyVersion()
{
return $this->prettyVersion;
}
public function isDev()
{
return $this->dev;
}
public function getRequires()
{
return $this->requires;
}
public function getConflicts()
{
return $this->conflicts;
}
public function getProvides()
{
return $this->provides;
}
public function getReplaces()
{
return $this->replaces;
}
public function getDevRequires()
{
return $this->devRequires;
}
public function setRootPackageAlias($value)
{
return $this->rootPackageAlias = $value;
}
public function isRootPackageAlias()
{
return $this->rootPackageAlias;
}
public function getAlias()
{
return '';
}
public function getPrettyAlias()
{
return '';
}
public function getType()
{
return $this->aliasOf->getType();
}
public function getTargetDir()
{
return $this->aliasOf->getTargetDir();
}
public function getExtra()
{
return $this->aliasOf->getExtra();
}
public function setInstallationSource($type)
{
$this->aliasOf->setInstallationSource($type);
}
public function getInstallationSource()
{
return $this->aliasOf->getInstallationSource();
}
public function getSourceType()
{
return $this->aliasOf->getSourceType();
}
public function getSourceUrl()
{
return $this->aliasOf->getSourceUrl();
}
public function getSourceReference()
{
return $this->aliasOf->getSourceReference();
}
public function setSourceReference($reference)
{
return $this->aliasOf->setSourceReference($reference);
}
public function getDistType()
{
return $this->aliasOf->getDistType();
}
public function getDistUrl()
{
return $this->aliasOf->getDistUrl();
}
public function getDistReference()
{
return $this->aliasOf->getDistReference();
}
public function getDistSha1Checksum()
{
return $this->aliasOf->getDistSha1Checksum();
}
public function getScripts()
{
return $this->aliasOf->getScripts();
}
public function setAliases(array $aliases)
{
return $this->aliasOf->setAliases($aliases);
}
public function getAliases()
{
return $this->aliasOf->getAliases();
}
public function getLicense()
{
return $this->aliasOf->getLicense();
}
public function getAutoload()
{
return $this->aliasOf->getAutoload();
}
public function getIncludePaths()
{
return $this->aliasOf->getIncludePaths();
}
public function getRepositories()
{
return $this->aliasOf->getRepositories();
}
public function getReleaseDate()
{
return $this->aliasOf->getReleaseDate();
}
public function getBinaries()
{
return $this->aliasOf->getBinaries();
}
public function getKeywords()
{
return $this->aliasOf->getKeywords();
}
public function getDescription()
{
return $this->aliasOf->getDescription();
}
public function getHomepage()
{
return $this->aliasOf->getHomepage();
}
public function getSuggests()
{
return $this->aliasOf->getSuggests();
}
public function getAuthors()
{
return $this->aliasOf->getAuthors();
}
public function getSupport()
{
return $this->aliasOf->getSupport();
}
public function getNotificationUrl()
{
return $this->aliasOf->getNotificationUrl();
}
public function getArchiveExcludes()
{
return $this->aliasOf->getArchiveExcludes();
}
public function __toString()
{
return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
}
}
<?php
namespace Composer\Package;
use Composer\Package\LinkConstraint\LinkConstraintInterface;
use Composer\Package\PackageInterface;
class Link
{
protected $source;
protected $target;
protected $constraint;
protected $description;
protected $prettyConstraint;
public function __construct($source, $target, LinkConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
{
$this->source = strtolower($source);
$this->target = strtolower($target);
$this->constraint = $constraint;
$this->description = $description;
$this->prettyConstraint = $prettyConstraint;
}
public function getSource()
{
return $this->source;
}
public function getTarget()
{
return $this->target;
}
public function getConstraint()
{
return $this->constraint;
}
public function getPrettyConstraint()
{
if (null === $this->prettyConstraint) {
throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
}
return $this->prettyConstraint;
}
public function __toString()
{
return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
}
public function getPrettyString(PackageInterface $sourcePackage)
{
return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
}
}
<?php
namespace Composer\Package\LinkConstraint;
class MultiConstraint implements LinkConstraintInterface
{
protected $constraints;
protected $prettyString;
public function __construct(array $constraints)
{
$this->constraints = $constraints;
}
public function matches(LinkConstraintInterface $provider)
{
foreach ($this->constraints as $constraint) {
if (!$constraint->matches($provider)) {
return false;
}
}
return true;
}
public function setPrettyString($prettyString)
{
$this->prettyString = $prettyString;
}
public function getPrettyString()
{
if ($this->prettyString) {
return $this->prettyString;
}
return $this->__toString();
}
public function __toString()
{
$constraints = array();
foreach ($this->constraints as $constraint) {
$constraints[] = $constraint->__toString();
}
return '['.implode(', ', $constraints).']';
}
}
<?php
namespace Composer\Package\LinkConstraint;
class VersionConstraint extends SpecificConstraint
{
private $operator;
private $version;
public function __construct($operator, $version)
{
if ('=' === $operator) {
$operator = '==';
}
if ('<>' === $operator) {
$operator = '!=';
}
$this->operator = $operator;
$this->version = $version;
}
public function versionCompare($a, $b, $operator)
{
if ('dev-' === substr($a, 0, 4) && 'dev-' === substr($b, 0, 4)) {
return $operator == '==' && $a === $b;
}
return version_compare($a, $b, $operator);
}
public function matchSpecific(VersionConstraint $provider)
{
$noEqualOp = str_replace('=', '', $this->operator);
$providerNoEqualOp = str_replace('=', '', $provider->operator);
$isEqualOp = '==' === $this->operator;
$isNonEqualOp = '!=' === $this->operator;
$isProviderEqualOp = '==' === $provider->operator;
$isProviderNonEqualOp = '!=' === $provider->operator;
if ($isNonEqualOp || $isProviderNonEqualOp) {
return !$isEqualOp && !$isProviderEqualOp
|| $this->versionCompare($provider->version, $this->version, '!=');
}
if ($this->operator != '==' && $noEqualOp == $providerNoEqualOp) {
return true;
}
if ($this->versionCompare($provider->version, $this->version, $this->operator)) {
if ($provider->version == $this->version && $provider->operator == $providerNoEqualOp && $this->operator != $noEqualOp) {
return false;
}
return true;
}
return false;
}
public function __toString()
{
return $this->operator.' '.$this->version;
}
}
<?php
namespace Composer\Package\LinkConstraint;
abstract class SpecificConstraint implements LinkConstraintInterface
{
protected $prettyString;
public function matches(LinkConstraintInterface $provider)
{
if ($provider instanceof MultiConstraint) {
return $provider->matches($this);
} elseif ($provider instanceof $this) {
return $this->matchSpecific($provider);
}
return true;
}
public function setPrettyString($prettyString)
{
$this->prettyString = $prettyString;
}
public function getPrettyString()
{
if ($this->prettyString) {
return $this->prettyString;
}
return $this->__toString();
}
}
<?php
namespace Composer\Package\LinkConstraint;
interface LinkConstraintInterface
{
public function matches(LinkConstraintInterface $provider);
public function setPrettyString($prettyString);
public function getPrettyString();
public function __toString();
}
<?php
namespace Composer;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
use Symfony\Component\Finder\Finder;
class Cache
{
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 (!is_dir($this->root)) {
if (!@mkdir($this->root, 0777, true)) {
$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)) {
return file_get_contents($this->root . $file);
}
return false;
}
public function write($file, $contents)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
return file_put_contents($this->root . $file, $contents);
}
return false;
}
public function copyFrom($file, $source)
{
if ($this->enabled) {
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
$this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
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)) {
touch($this->root . $file);
return copy($this->root . $file, $target);
}
return false;
}
public function remove($file)
{
$file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
if ($this->enabled && file_exists($this->root . $file)) {
return unlink($this->root . $file);
}
return false;
}
public function gc($ttl, $maxSize)
{
$expire = new \DateTime();
$expire->modify('-'.$ttl.' seconds');
$finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
foreach ($finder as $file) {
unlink($file->getRealPath());
}
$totalSize = $this->filesystem->size($this->root);
if ($totalSize > $maxSize) {
$iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
while ($totalSize > $maxSize && $iterator->valid()) {
$filepath = $iterator->current()->getRealPath();
$totalSize -= $this->filesystem->size($filepath);
unlink($filepath);
$iterator->next();
}
}
return true;
}
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\DependencyResolver;
use Composer\Package\PackageInterface;
interface PolicyInterface
{
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
public function selectPreferedPackages(Pool $pool, array $installedMap, array $literals);
}
<?php
namespace Composer\DependencyResolver;
class RuleSet implements \IteratorAggregate, \Countable
{
const TYPE_PACKAGE = 0;
const TYPE_JOB = 1;
const TYPE_LEARNED = 4;
protected static $types = array(
-1 => 'UNKNOWN',
self::TYPE_PACKAGE => 'PACKAGE',
self::TYPE_JOB => 'JOB',
self::TYPE_LEARNED => 'LEARNED',
);
protected $rules;
protected $ruleById;
protected $nextRuleId;
protected $rulesByHash;
public function __construct()
{
$this->nextRuleId = 0;
foreach ($this->getTypes() as $type) {
$this->rules[$type] = array();
}
$this->rulesByHash = array();
}
public function add(Rule $rule, $type)
{
if (!isset(self::$types[$type])) {
throw new \OutOfBoundsException('Unknown rule type: ' . $type);
}
if (!isset($this->rules[$type])) {
$this->rules[$type] = array();
}
$this->rules[$type][] = $rule;
$this->ruleById[$this->nextRuleId] = $rule;
$rule->setType($type);
$rule->setId($this->nextRuleId);
$this->nextRuleId++;
$hash = $rule->getHash();
if (!isset($this->rulesByHash[$hash])) {
$this->rulesByHash[$hash] = array($rule);
} else {
$this->rulesByHash[$hash][] = $rule;
}
}
public function count()
{
return $this->nextRuleId;
}
public function ruleById($id)
{
return $this->ruleById[$id];
}
public function getRules()
{
return $this->rules;
}
public function getIterator()
{
return new RuleSetIterator($this->getRules());
}
public function getIteratorFor($types)
{
if (!is_array($types)) {
$types = array($types);
}
$allRules = $this->getRules();
$rules = array();
foreach ($types as $type) {
$rules[$type] = $allRules[$type];
}
return new RuleSetIterator($rules);
}
public function getIteratorWithout($types)
{
if (!is_array($types)) {
$types = array($types);
}
$rules = $this->getRules();
foreach ($types as $type) {
unset($rules[$type]);
}
return new RuleSetIterator($rules);
}
public function getTypes()
{
$types = self::$types;
unset($types[-1]);
return array_keys($types);
}
public function containsEqual($rule)
{
if (isset($this->rulesByHash[$rule->getHash()])) {
$potentialDuplicates = $this->rulesByHash[$rule->getHash()];
foreach ($potentialDuplicates as $potentialDuplicate) {
if ($rule->equals($potentialDuplicate)) {
return true;
}
}
}
return false;
}
public function __toString()
{
$string = "\n";
foreach ($this->rules as $type => $rules) {
$string .= str_pad(self::$types[$type], 8, ' ') . ": ";
foreach ($rules as $rule) {
$string .= $rule."\n";
}
$string .= "\n\n";
}
return $string;
}
}
<?php
namespace Composer\DependencyResolver;
class SolverBugException extends \RuntimeException
{
public function __construct($message)
{
parent::__construct(
$message."\nThis exception was most likely caused by a bug in Composer.\n".
"Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n");
}
}
<?php
namespace Composer\DependencyResolver;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\Package\LinkConstraint\VersionConstraint;
class DefaultPolicy implements PolicyInterface
{
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
{
$constraint = new VersionConstraint($operator, $b->getVersion());
$version = new VersionConstraint('==', $a->getVersion());
return $constraint->matchSpecific($version);
}
public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package)
{
$packages = array();
foreach ($pool->whatProvides($package->getName()) as $candidate) {
if ($candidate !== $package) {
$packages[] = $candidate;
}
}
return $packages;
}
public function getPriority(Pool $pool, PackageInterface $package)
{
return $pool->getPriority($package->getRepository());
}
public function selectPreferedPackages(Pool $pool, array $installedMap, array $literals)
{
$packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
foreach ($packages as &$literals) {
$policy = $this;
usort($literals, function ($a, $b) use ($policy, $pool, $installedMap) {
return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), true);
});
}
foreach ($packages as &$literals) {
$literals = $this->pruneToBestVersion($pool, $literals);
$literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
$literals = $this->pruneRemoteAliases($pool, $literals);
}
$selected = call_user_func_array('array_merge', $packages);
usort($selected, function ($a, $b) use ($policy, $pool, $installedMap) {
return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b));
});
return $selected;
}
protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
{
$packages = array();
foreach ($literals as $literal) {
$packageName = $pool->literalToPackage($literal)->getName();
if (!isset($packages[$packageName])) {
$packages[$packageName] = array();
}
if (isset($installedMap[abs($literal)])) {
array_unshift($packages[$packageName], $literal);
} else {
$packages[$packageName][] = $literal;
}
}
return $packages;
}
public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $ignoreReplace = false)
{
if ($a->getRepository() === $b->getRepository()) {
if ($a->getName() === $b->getName()) {
$aAliased = $a instanceof AliasPackage;
$bAliased = $b instanceof AliasPackage;
if ($aAliased && !$bAliased) {
return -1;
}
if (!$aAliased && $bAliased) {
return 1;
}
}
if (!$ignoreReplace) {
if ($this->replaces($a, $b)) {
return 1;
}
if ($this->replaces($b, $a)) {
return -1;
}
}
if ($a->getId() === $b->getId()) {
return 0;
}
return ($a->getId() < $b->getId()) ? -1 : 1;
}
if (isset($installedMap[$a->getId()])) {
return -1;
}
if (isset($installedMap[$b->getId()])) {
return 1;
}
return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
}
protected function replaces(PackageInterface $source, PackageInterface $target)
{
foreach ($source->getReplaces() as $link) {
if ($link->getTarget() === $target->getName()
) {
return true;
}
}
return false;
}
protected function pruneToBestVersion(Pool $pool, $literals)
{
$bestLiterals = array($literals[0]);
$bestPackage = $pool->literalToPackage($literals[0]);
foreach ($literals as $i => $literal) {
if (0 === $i) {
continue;
}
$package = $pool->literalToPackage($literal);
if ($this->versionCompare($package, $bestPackage, '>')) {
$bestPackage = $package;
$bestLiterals = array($literal);
} elseif ($this->versionCompare($package, $bestPackage, '==')) {
$bestLiterals[] = $literal;
}
}
return $bestLiterals;
}
protected function selectNewestPackages(array $installedMap, array $literals)
{
$maxLiterals = array($literals[0]);
$maxPackage = $literals[0]->getPackage();
foreach ($literals as $i => $literal) {
if (0 === $i) {
continue;
}
if ($this->versionCompare($literal->getPackage(), $maxPackage, '>')) {
$maxPackage = $literal->getPackage();
$maxLiterals = array($literal);
} elseif ($this->versionCompare($literal->getPackage(), $maxPackage, '==')) {
$maxLiterals[] = $literal;
}
}
return $maxLiterals;
}
protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
{
$selected = array();
$priority = null;
foreach ($literals as $literal) {
$package = $pool->literalToPackage($literal);
if (isset($installedMap[$package->getId()])) {
$selected[] = $literal;
continue;
}
if (null === $priority) {
$priority = $this->getPriority($pool, $package);
}
if ($this->getPriority($pool, $package) != $priority) {
break;
}
$selected[] = $literal;
}
return $selected;
}
protected function pruneRemoteAliases(Pool $pool, array $literals)
{
$hasLocalAlias = false;
foreach ($literals as $literal) {
$package = $pool->literalToPackage($literal);
if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
$hasLocalAlias = true;
break;
}
}
if (!$hasLocalAlias) {
return $literals;
}
$selected = array();
foreach ($literals as $literal) {
$package = $pool->literalToPackage($literal);
if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
$selected[] = $literal;
}
}
return $selected;
}
}
<?php
namespace Composer\DependencyResolver;
class Decisions implements \Iterator, \Countable
{
const DECISION_LITERAL = 0;
const DECISION_REASON = 1;
protected $pool;
protected $decisionMap;
protected $decisionQueue = array();
public function __construct($pool)
{
$this->pool = $pool;
$this->decisionMap = array();
}
public function decide($literal, $level, $why)
{
$this->addDecision($literal, $level);
$this->decisionQueue[] = array(
self::DECISION_LITERAL => $literal,
self::DECISION_REASON => $why,
);
}
public function satisfy($literal)
{
$packageId = abs($literal);
return (
$literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
$literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
);
}
public function conflict($literal)
{
$packageId = abs($literal);
return (
(isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
(isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
);
}
public function decided($literalOrPackageId)
{
return !empty($this->decisionMap[abs($literalOrPackageId)]);
}
public function undecided($literalOrPackageId)
{
return empty($this->decisionMap[abs($literalOrPackageId)]);
}
public function decidedInstall($literalOrPackageId)
{
$packageId = abs($literalOrPackageId);
return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
}
public function decisionLevel($literalOrPackageId)
{
$packageId = abs($literalOrPackageId);
if (isset($this->decisionMap[$packageId])) {
return abs($this->decisionMap[$packageId]);
}
return 0;
}
public function decisionRule($literalOrPackageId)
{
$packageId = abs($literalOrPackageId);
foreach ($this->decisionQueue as $i => $decision) {
if ($packageId === abs($decision[self::DECISION_LITERAL])) {
return $decision[self::DECISION_REASON];
}
}
return null;
}
public function atOffset($queueOffset)
{
return $this->decisionQueue[$queueOffset];
}
public function validOffset($queueOffset)
{
return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
}
public function lastReason()
{
return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
}
public function lastLiteral()
{
return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
}
public function reset()
{
while ($decision = array_pop($this->decisionQueue)) {
$this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
}
}
public function resetToOffset($offset)
{
while (count($this->decisionQueue) > $offset + 1) {
$decision = array_pop($this->decisionQueue);
$this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
}
}
public function revertLast()
{
$this->decisionMap[abs($this->lastLiteral())] = 0;
array_pop($this->decisionQueue);
}
public function count()
{
return count($this->decisionQueue);
}
public function rewind()
{
end($this->decisionQueue);
}
public function current()
{
return current($this->decisionQueue);
}
public function key()
{
return key($this->decisionQueue);
}
public function next()
{
return prev($this->decisionQueue);
}
public function valid()
{
return false !== current($this->decisionQueue);
}
public function isEmpty()
{
return count($this->decisionQueue) === 0;
}
protected function addDecision($literal, $level)
{
$packageId = abs($literal);
$previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
if ($previousDecision != 0) {
$literalString = $this->pool->literalToString($literal);
$package = $this->pool->literalToPackage($literal);
throw new SolverBugException(
"Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
);
}
if ($literal > 0) {
$this->decisionMap[$packageId] = $level;
} else {
$this->decisionMap[$packageId] = -$level;
}
}
}
<?php
namespace Composer\DependencyResolver;
class RuleWatchNode
{
public $watch1;
public $watch2;
protected $rule;
public function __construct($rule)
{
$this->rule = $rule;
$literals = $rule->getLiterals();
$this->watch1 = count($literals) > 0 ? $literals[0] : 0;
$this->watch2 = count($literals) > 1 ? $literals[1] : 0;
}
public function watch2OnHighest(Decisions $decisions)
{
$literals = $this->rule->getLiterals();
if ($literals < 3) {
return;
}
$watchLevel = 0;
foreach ($literals as $literal) {
$level = $decisions->decisionLevel($literal);
if ($level > $watchLevel) {
$this->rule->watch2 = $literal;
$watchLevel = $level;
}
}
}
public function getRule()
{
return $this->rule;
}
public function getOtherWatch($literal)
{
if ($this->watch1 == $literal) {
return $this->watch2;
} else {
return $this->watch1;
}
}
public function moveWatch($from, $to)
{
if ($this->watch1 == $from) {
$this->watch1 = $to;
} else {
$this->watch2 = $to;
}
}
}
<?php
namespace Composer\DependencyResolver;
class SolverProblemsException extends \RuntimeException
{
protected $problems;
protected $installedMap;
public function __construct(array $problems, array $installedMap)
{
$this->problems = $problems;
$this->installedMap = $installedMap;
parent::__construct($this->createMessage());
}
protected function createMessage()
{
$text = "\n";
foreach ($this->problems as $i => $problem) {
$text .= " Problem ".($i+1).$problem->getPrettyString($this->installedMap)."\n";
}
if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
$text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.\n\nRead <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
}
return $text;
}
public function getProblems()
{
return $this->problems;
}
}
<?php
namespace Composer\DependencyResolver;
use Composer\Package\AliasPackage;
use Composer\DependencyResolver\Operation;
class Transaction
{
protected $policy;
protected $pool;
protected $installedMap;
protected $decisions;
protected $transaction;
public function __construct($policy, $pool, $installedMap, $decisions)
{
$this->policy = $policy;
$this->pool = $pool;
$this->installedMap = $installedMap;
$this->decisions = $decisions;
$this->transaction = array();
}
public function getOperations()
{
$installMeansUpdateMap = $this->findUpdates();
$updateMap = array();
$installMap = array();
$uninstallMap = array();
foreach ($this->decisions as $i => $decision) {
$literal = $decision[Decisions::DECISION_LITERAL];
$reason = $decision[Decisions::DECISION_REASON];
$package = $this->pool->literalToPackage($literal);
if (($literal > 0) == (isset($this->installedMap[$package->getId()]))) {
continue;
}
if ($literal > 0) {
if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
$source = $installMeansUpdateMap[abs($literal)];
$updateMap[$package->getId()] = array(
'package' => $package,
'source' => $source,
'reason' => $reason,
);
unset($installMeansUpdateMap[abs($literal)]);
$ignoreRemove[$source->getId()] = true;
} else {
$installMap[$package->getId()] = array(
'package' => $package,
'reason' => $reason,
);
}
}
}
foreach ($this->decisions as $i => $decision) {
$literal = $decision[Decisions::DECISION_LITERAL];
$package = $this->pool->literalToPackage($literal);
if ($literal <= 0 &&
isset($this->installedMap[$package->getId()]) &&
!isset($ignoreRemove[$package->getId()])) {
$uninstallMap[$package->getId()] = array(
'package' => $package,
'reason' => $reason,
);
}
}
$this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
return $this->transaction;
}
protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
{
$queue = array_map(function ($operation) {
return $operation['package'];
},
$this->findRootPackages($installMap, $updateMap)
);
$visited = array();
while (!empty($queue)) {
$package = array_pop($queue);
$packageId = $package->getId();
if (!isset($visited[$packageId])) {
array_push($queue, $package);
if ($package instanceof AliasPackage) {
array_push($queue, $package->getAliasOf());
} else {
foreach ($package->getRequires() as $link) {
$possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
foreach ($possibleRequires as $require) {
array_push($queue, $require);
}
}
}
$visited[$package->getId()] = true;
} else {
if (isset($installMap[$packageId])) {
$this->install(
$installMap[$packageId]['package'],
$installMap[$packageId]['reason']
);
unset($installMap[$packageId]);
}
if (isset($updateMap[$packageId])) {
$this->update(
$updateMap[$packageId]['source'],
$updateMap[$packageId]['package'],
$updateMap[$packageId]['reason']
);
unset($updateMap[$packageId]);
}
}
}
foreach ($uninstallMap as $uninstall) {
$this->uninstall($uninstall['package'], $uninstall['reason']);
}
}
protected function findRootPackages($installMap, $updateMap)
{
$packages = $installMap + $updateMap;
$roots = $packages;
foreach ($packages as $packageId => $operation) {
$package = $operation['package'];
if (!isset($roots[$packageId])) {
continue;
}
foreach ($package->getRequires() as $link) {
$possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
foreach ($possibleRequires as $require) {
unset($roots[$require->getId()]);
}
}
}
return $roots;
}
protected function findUpdates()
{
$installMeansUpdateMap = array();
foreach ($this->decisions as $i => $decision) {
$literal = $decision[Decisions::DECISION_LITERAL];
$package = $this->pool->literalToPackage($literal);
if ($package instanceof AliasPackage) {
continue;
}
if ($literal <= 0 && isset($this->installedMap[$package->getId()])) {
$updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
$literals = array($package->getId());
foreach ($updates as $update) {
$literals[] = $update->getId();
}
foreach ($literals as $updateLiteral) {
if ($updateLiteral !== $literal) {
$installMeansUpdateMap[abs($updateLiteral)] = $package;
}
}
}
}
return $installMeansUpdateMap;
}
protected function install($package, $reason)
{
if ($package instanceof AliasPackage) {
return $this->markAliasInstalled($package, $reason);
}
$this->transaction[] = new Operation\InstallOperation($package, $reason);
}
protected function update($from, $to, $reason)
{
$this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
}
protected function uninstall($package, $reason)
{
if ($package instanceof AliasPackage) {
return $this->markAliasUninstalled($package, $reason);
}
$this->transaction[] = new Operation\UninstallOperation($package, $reason);
}
protected function markAliasInstalled($package, $reason)
{
$this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
}
protected function markAliasUninstalled($package, $reason)
{
$this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
}
}
<?php
namespace Composer\DependencyResolver\Operation;
use Composer\Package\PackageInterface;
class UninstallOperation extends SolverOperation
{
protected $package;
public function __construct(PackageInterface $package, $reason = null)
{
parent::__construct($reason);
$this->package = $package;
}
public function getPackage()
{
return $this->package;
}
public function getJobType()
{
return 'uninstall';
}
public function __toString()
{
return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
}
}
<?php
namespace Composer\DependencyResolver\Operation;
use Composer\Package\PackageInterface;
class UpdateOperation extends SolverOperation
{
protected $initialPackage;
protected $targetPackage;
public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
{
parent::__construct($reason);
$this->initialPackage = $initial;
$this->targetPackage = $target;
}
public function getInitialPackage()
{
return $this->initialPackage;
}
public function getTargetPackage()
{
return $this->targetPackage;
}
public function getJobType()
{
return 'update';
}
public function __toString()
{
return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
$this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
}
}
<?php
namespace Composer\DependencyResolver\Operation;
use Composer\Package\AliasPackage;
class MarkAliasInstalledOperation extends SolverOperation
{
protected $package;
public function __construct(AliasPackage $package, $reason = null)
{
parent::__construct($reason);
$this->package = $package;
}
public function getPackage()
{
return $this->package;
}
public function getJobType()
{
return 'markAliasInstalled';
}
public function __toString()
{
return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
}
}
<?php
namespace Composer\DependencyResolver\Operation;
use Composer\Package\PackageInterface;
class InstallOperation extends SolverOperation
{
protected $package;
public function __construct(PackageInterface $package, $reason = null)
{
parent::__construct($reason);
$this->package = $package;
}
public function getPackage()
{
return $this->package;
}
public function getJobType()
{
return 'install';
}
public function __toString()
{
return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
}
}
<?php
namespace Composer\DependencyResolver\Operation;
use Composer\Package\Version\VersionParser;
use Composer\Package\PackageInterface;
abstract class SolverOperation implements OperationInterface
{
protected $reason;
public function __construct($reason = null)
{
$this->reason = $reason;
}
public function getReason()
{
return $this->reason;
}
protected function formatVersion(PackageInterface $package)
{
return VersionParser::formatVersion($package);
}
}
<?php
namespace Composer\DependencyResolver\Operation;
use Composer\Package\AliasPackage;
class MarkAliasUninstalledOperation extends SolverOperation
{
protected $package;
public function __construct(AliasPackage $package, $reason = null)
{
parent::__construct($reason);
$this->package = $package;
}
public function getPackage()
{
return $this->package;
}
public function getJobType()
{
return 'markAliasUninstalled';
}
public function __toString()
{
return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
}
}
<?php
namespace Composer\DependencyResolver\Operation;
interface OperationInterface
{
public function getJobType();
public function getReason();
public function __toString();
}
<?php
namespace Composer\DependencyResolver;
use Composer\Package\BasePackage;
use Composer\Package\AliasPackage;
use Composer\Package\Version\VersionParser;
use Composer\Package\Link;
use Composer\Package\LinkConstraint\LinkConstraintInterface;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\CompositeRepository;
use Composer\Repository\ComposerRepository;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Repository\StreamableRepositoryInterface;
use Composer\Repository\PlatformRepository;
class Pool
{
const MATCH_NAME = -1;
const MATCH_NONE = 0;
const MATCH = 1;
const MATCH_PROVIDE = 2;
const MATCH_REPLACE = 3;
protected $repositories = array();
protected $providerRepos = array();
protected $packages = array();
protected $packageByName = array();
protected $acceptableStabilities;
protected $stabilityFlags;
protected $versionParser;
protected $providerCache = array();
protected $id = 1;
public function __construct($minimumStability = 'stable', array $stabilityFlags = array())
{
$stabilities = BasePackage::$stabilities;
$this->versionParser = new VersionParser;
$this->acceptableStabilities = array();
foreach (BasePackage::$stabilities as $stability => $value) {
if ($value <= BasePackage::$stabilities[$minimumStability]) {
$this->acceptableStabilities[$stability] = $value;
}
}
$this->stabilityFlags = $stabilityFlags;
}
public function addRepository(RepositoryInterface $repo, $rootAliases = array())
{
if ($repo instanceof CompositeRepository) {
$repos = $repo->getRepositories();
} else {
$repos = array($repo);
}
foreach ($repos as $repo) {
$this->repositories[] = $repo;
$exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
$this->providerRepos[] = $repo;
$repo->setRootAliases($rootAliases);
$repo->resetPackageIds();
} elseif ($repo instanceof StreamableRepositoryInterface) {
foreach ($repo->getMinimalPackages() as $package) {
$name = $package['name'];
$version = $package['version'];
$stability = VersionParser::parseStability($version);
if ($exempt || $this->isPackageAcceptable($name, $stability)) {
$package['id'] = $this->id++;
$this->packages[] = $package;
$names = array(
$name => true,
);
if (isset($package['provide'])) {
foreach ($package['provide'] as $target => $constraint) {
$names[$target] = true;
}
}
if (isset($package['replace'])) {
foreach ($package['replace'] as $target => $constraint) {
$names[$target] = true;
}
}
foreach (array_keys($names) as $provided) {
$this->packageByName[$provided][] =& $this->packages[$this->id - 2];
}
unset($rootAliasData);
if (isset($rootAliases[$name][$version])) {
$rootAliasData = $rootAliases[$name][$version];
} elseif (isset($package['alias_normalized']) && isset($rootAliases[$name][$package['alias_normalized']])) {
$rootAliasData = $rootAliases[$name][$package['alias_normalized']];
}
if (isset($rootAliasData)) {
$alias = $package;
unset($alias['raw']);
$alias['version'] = $rootAliasData['alias_normalized'];
$alias['alias'] = $rootAliasData['alias'];
$alias['alias_of'] = $package['id'];
$alias['id'] = $this->id++;
$alias['root_alias'] = true;
$this->packages[] = $alias;
foreach (array_keys($names) as $provided) {
$this->packageByName[$provided][] =& $this->packages[$this->id - 2];
}
}
if (isset($package['alias'])) {
$alias = $package;
unset($alias['raw']);
$alias['version'] = $package['alias_normalized'];
$alias['alias'] = $package['alias'];
$alias['alias_of'] = $package['id'];
$alias['id'] = $this->id++;
$this->packages[] = $alias;
foreach (array_keys($names) as $provided) {
$this->packageByName[$provided][] =& $this->packages[$this->id - 2];
}
}
}
}
} else {
foreach ($repo->getPackages() as $package) {
$name = $package->getName();
$stability = $package->getStability();
if ($exempt || $this->isPackageAcceptable($name, $stability)) {
$package->setId($this->id++);
$this->packages[] = $package;
foreach ($package->getNames() as $provided) {
$this->packageByName[$provided][] = $package;
}
if (isset($rootAliases[$name][$package->getVersion()])) {
$alias = $rootAliases[$name][$package->getVersion()];
$package->setAlias($alias['alias_normalized']);
$package->setPrettyAlias($alias['alias']);
$package->getRepository()->addPackage($aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']));
$aliasPackage->setRootPackageAlias(true);
$aliasPackage->setId($this->id++);
$this->packages[] = $aliasPackage;
foreach ($aliasPackage->getNames() as $name) {
$this->packageByName[$name][] = $aliasPackage;
}
}
}
}
}
}
}
public function getPriority(RepositoryInterface $repo)
{
$priority = array_search($repo, $this->repositories, true);
if (false === $priority) {
throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
}
return -$priority;
}
public function packageById($id)
{
$this->ensurePackageIsLoaded($this->packages[$id - 1]);
return $this->packages[$id - 1];
}
public function whatProvides($name, LinkConstraintInterface $constraint = null)
{
if (isset($this->providerCache[$name][(string) $constraint])) {
return $this->providerCache[$name][(string) $constraint];
}
return $this->providerCache[$name][(string) $constraint] = $this->computeWhatProvides($name, $constraint);
}
private function computeWhatProvides($name, $constraint)
{
$candidates = array();
foreach ($this->providerRepos as $repo) {
foreach ($repo->whatProvides($this, $name) as $candidate) {
$candidates[] = $candidate;
if ($candidate->getId() < 1) {
$candidate->setId($this->id++);
$this->packages[$this->id - 2] = $candidate;
}
}
}
if (isset($this->packageByName[$name])) {
$candidates = array_merge($candidates, $this->packageByName[$name]);
}
if (null === $constraint) {
foreach ($candidates as $key => $candidate) {
$candidates[$key] = $this->ensurePackageIsLoaded($candidate);
}
return $candidates;
}
$matches = $provideMatches = array();
$nameMatch = false;
foreach ($candidates as $candidate) {
switch ($this->match($candidate, $name, $constraint)) {
case self::MATCH_NONE:
break;
case self::MATCH_NAME:
$nameMatch = true;
break;
case self::MATCH:
$nameMatch = true;
$matches[] = $this->ensurePackageIsLoaded($candidate);
break;
case self::MATCH_PROVIDE:
$provideMatches[] = $this->ensurePackageIsLoaded($candidate);
break;
case self::MATCH_REPLACE:
$matches[] = $this->ensurePackageIsLoaded($candidate);
break;
default:
throw new \UnexpectedValueException('Unexpected match type');
}
}
if ($nameMatch) {
return $matches;
}
return array_merge($matches, $provideMatches);
}
public function literalToPackage($literal)
{
$packageId = abs($literal);
return $this->packageById($packageId);
}
public function literalToString($literal)
{
return ($literal > 0 ? '+' : '-') . $this->literalToPackage($literal);
}
public function literalToPrettyString($literal, $installedMap)
{
$package = $this->literalToPackage($literal);
if (isset($installedMap[$package->getId()])) {
$prefix = ($literal > 0 ? 'keep' : 'remove');
} else {
$prefix = ($literal > 0 ? 'install' : 'don\'t install');
}
return $prefix.' '.$package->getPrettyString();
}
public function isPackageAcceptable($name, $stability)
{
if (!isset($this->stabilityFlags[$name]) && isset($this->acceptableStabilities[$stability])) {
return true;
}
if (isset($this->stabilityFlags[$name]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$name]) {
return true;
}
return false;
}
private function ensurePackageIsLoaded($data)
{
if (is_array($data)) {
if (isset($data['alias_of'])) {
$aliasOf = $this->packageById($data['alias_of']);
$package = $this->packages[$data['id'] - 1] = $data['repo']->loadAliasPackage($data, $aliasOf);
$package->setRootPackageAlias(!empty($data['root_alias']));
} else {
$package = $this->packages[$data['id'] - 1] = $data['repo']->loadPackage($data);
}
$package->setId($data['id']);
$data = $package;
}
return $data;
}
private function match($candidate, $name, LinkConstraintInterface $constraint)
{
if (is_array($candidate)) {
$candidateName = $candidate['name'];
$candidateVersion = $candidate['version'];
} else {
$candidateName = $candidate->getName();
$candidateVersion = $candidate->getVersion();
}
if ($candidateName === $name) {
return $constraint->matches(new VersionConstraint('==', $candidateVersion)) ? self::MATCH : self::MATCH_NAME;
}
if (is_array($candidate)) {
$provides = isset($candidate['provide'])
? $this->versionParser->parseLinks($candidateName, $candidateVersion, 'provides', $candidate['provide'])
: array();
$replaces = isset($candidate['replace'])
? $this->versionParser->parseLinks($candidateName, $candidateVersion, 'replaces', $candidate['replace'])
: array();
} else {
$provides = $candidate->getProvides();
$replaces = $candidate->getReplaces();
}
if (isset($replaces[0]) || isset($provides[0])) {
foreach ($provides as $link) {
if ($link->getTarget() === $name && $constraint->matches($link->getConstraint())) {
return self::MATCH_PROVIDE;
}
}
foreach ($replaces as $link) {
if ($link->getTarget() === $name && $constraint->matches($link->getConstraint())) {
return self::MATCH_REPLACE;
}
}
return self::MATCH_NONE;
}
if (isset($provides[$name]) && $constraint->matches($provides[$name]->getConstraint())) {
return self::MATCH_PROVIDE;
}
if (isset($replaces[$name]) && $constraint->matches($replaces[$name]->getConstraint())) {
return self::MATCH_REPLACE;
}
return self::MATCH_NONE;
}
}
<?php
namespace Composer\DependencyResolver;
class Rule
{
const RULE_INTERNAL_ALLOW_UPDATE = 1;
const RULE_JOB_INSTALL = 2;
const RULE_JOB_REMOVE = 3;
const RULE_PACKAGE_CONFLICT = 6;
const RULE_PACKAGE_REQUIRES = 7;
const RULE_PACKAGE_OBSOLETES = 8;
const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
const RULE_PACKAGE_SAME_NAME = 10;
const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
const RULE_LEARNED = 12;
const RULE_PACKAGE_ALIAS = 13;
protected $pool;
protected $disabled;
protected $literals;
protected $type;
protected $id;
protected $job;
protected $ruleHash;
public function __construct(Pool $pool, array $literals, $reason, $reasonData, $job = null)
{
$this->pool = $pool;
sort($literals);
$this->literals = $literals;
$this->reason = $reason;
$this->reasonData = $reasonData;
$this->disabled = false;
$this->job = $job;
$this->type = -1;
$this->ruleHash = substr(md5(implode(',', $this->literals)), 0, 5);
}
public function getHash()
{
return $this->ruleHash;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function getJob()
{
return $this->job;
}
public function equals(Rule $rule)
{
if ($this->ruleHash !== $rule->ruleHash) {
return false;
}
if (count($this->literals) != count($rule->literals)) {
return false;
}
for ($i = 0, $n = count($this->literals); $i < $n; $i++) {
if ($this->literals[$i] !== $rule->literals[$i]) {
return false;
}
}
return true;
}
public function setType($type)
{
$this->type = $type;
}
public function getType()
{
return $this->type;
}
public function disable()
{
$this->disabled = true;
}
public function enable()
{
$this->disabled = false;
}
public function isDisabled()
{
return $this->disabled;
}
public function isEnabled()
{
return !$this->disabled;
}
public function getLiterals()
{
return $this->literals;
}
public function isAssertion()
{
return 1 === count($this->literals);
}
public function getPrettyString(array $installedMap = array())
{
$ruleText = '';
foreach ($this->literals as $i => $literal) {
if ($i != 0) {
$ruleText .= '|';
}
$ruleText .= $this->pool->literalToPrettyString($literal, $installedMap);
}
switch ($this->reason) {
case self::RULE_INTERNAL_ALLOW_UPDATE:
return $ruleText;
case self::RULE_JOB_INSTALL:
return "Install command rule ($ruleText)";
case self::RULE_JOB_REMOVE:
return "Remove command rule ($ruleText)";
case self::RULE_PACKAGE_CONFLICT:
$package1 = $this->pool->literalToPackage($this->literals[0]);
$package2 = $this->pool->literalToPackage($this->literals[1]);
return $package1->getPrettyString().' conflicts with '.$package2->getPrettyString().'.';
case self::RULE_PACKAGE_REQUIRES:
$literals = $this->literals;
$sourceLiteral = array_shift($literals);
$sourcePackage = $this->pool->literalToPackage($sourceLiteral);
$requires = array();
foreach ($literals as $literal) {
$requires[] = $this->pool->literalToPackage($literal);
}
$text = $this->reasonData->getPrettyString($sourcePackage);
if ($requires) {
$requireText = array();
foreach ($requires as $require) {
$requireText[] = $require->getPrettyString();
}
$text .= ' -> satisfiable by '.implode(', ', $requireText).'.';
} else {
$targetName = $this->reasonData->getTarget();
if (0 === strpos($targetName, 'ext-')) {
$ext = substr($targetName, 4);
$error = extension_loaded($ext) ? 'has the wrong version ('.phpversion($ext).') installed' : 'is missing from your system';
$text .= ' -> the requested PHP extension '.$ext.' '.$error.'.';
} elseif (0 === strpos($targetName, 'lib-')) {
$lib = substr($targetName, 4);
$text .= ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
} else {
$text .= ' -> no matching package found.';
}
}
return $text;
case self::RULE_PACKAGE_OBSOLETES:
return $ruleText;
case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
return $ruleText;
case self::RULE_PACKAGE_SAME_NAME:
$text = "Can only install one of: ";
$packages = array();
foreach ($this->literals as $i => $literal) {
$packages[] = $this->pool->literalToPackage($literal)->getPrettyString();
}
return $text.implode(', ', $packages).'.';
case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
return $ruleText;
case self::RULE_LEARNED:
return 'Conclusion: '.$ruleText;
case self::RULE_PACKAGE_ALIAS:
return $ruleText;
}
}
public function __toString()
{
$result = ($this->isDisabled()) ? 'disabled(' : '(';
foreach ($this->literals as $i => $literal) {
if ($i != 0) {
$result .= '|';
}
$result .= $this->pool->literalToString($literal);
}
$result .= ')';
return $result;
}
}
<?php
namespace Composer\DependencyResolver;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
class RuleSetGenerator
{
protected $policy;
protected $pool;
protected $rules;
protected $jobs;
protected $installedMap;
public function __construct(PolicyInterface $policy, Pool $pool)
{
$this->policy = $policy;
$this->pool = $pool;
}
protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
{
$literals = array(-$package->getId());
foreach ($providers as $provider) {
if ($provider === $package) {
return null;
}
$literals[] = $provider->getId();
}
return new Rule($this->pool, $literals, $reason, $reasonData);
}
protected function createInstallOneOfRule(array $packages, $reason, $job)
{
$literals = array();
foreach ($packages as $package) {
$literals[] = $package->getId();
}
return new Rule($this->pool, $literals, $reason, $job['packageName'], $job);
}
protected function createRemoveRule(PackageInterface $package, $reason, $job)
{
return new Rule($this->pool, array(-$package->getId()), $reason, $job['packageName'], $job);
}
protected function createConflictRule(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
{
if ($issuer === $provider) {
return null;
}
return new Rule($this->pool, array(-$issuer->getId(), -$provider->getId()), $reason, $reasonData);
}
private function addRule($type, Rule $newRule = null)
{
if (!$newRule || $this->rules->containsEqual($newRule)) {
return;
}
$this->rules->add($newRule, $type);
}
protected function addRulesForPackage(PackageInterface $package)
{
$workQueue = new \SplQueue;
$workQueue->enqueue($package);
while (!$workQueue->isEmpty()) {
$package = $workQueue->dequeue();
if (isset($this->addedMap[$package->getId()])) {
continue;
}
$this->addedMap[$package->getId()] = true;
foreach ($package->getRequires() as $link) {
$possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
$this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
foreach ($possibleRequires as $require) {
$workQueue->enqueue($require);
}
}
foreach ($package->getConflicts() as $link) {
$possibleConflicts = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
foreach ($possibleConflicts as $conflict) {
$this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $conflict, Rule::RULE_PACKAGE_CONFLICT, $link));
}
}
$isInstalled = (isset($this->installedMap[$package->getId()]));
foreach ($package->getReplaces() as $link) {
$obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
foreach ($obsoleteProviders as $provider) {
if ($provider === $package) {
continue;
}
if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
$reason = ($isInstalled) ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
$this->addRule(RuleSet::TYPE_PACKAGE, $this->createConflictRule($package, $provider, $reason, $link));
}
}
}
$obsoleteProviders = $this->pool->whatProvides($package->getName(), null);
foreach ($obsoleteProviders as $provider) {
if ($provider === $package) {
continue;
}
if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
$this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
} elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
$reason = ($package->getName() == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
$this->addRule(RuleSet::TYPE_PACKAGE, $rule = $this->createConflictRule($package, $provider, $reason, $package));
}
}
}
}
protected function obsoleteImpossibleForAlias($package, $provider)
{
$packageIsAlias = $package instanceof AliasPackage;
$providerIsAlias = $provider instanceof AliasPackage;
$impossible = (
($packageIsAlias && $package->getAliasOf() === $provider) ||
($providerIsAlias && $provider->getAliasOf() === $package) ||
($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
);
return $impossible;
}
private function addRulesForUpdatePackages(PackageInterface $package)
{
$updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
foreach ($updates as $update) {
$this->addRulesForPackage($update);
}
}
protected function addRulesForJobs()
{
foreach ($this->jobs as $job) {
switch ($job['cmd']) {
case 'install':
if ($job['packages']) {
foreach ($job['packages'] as $package) {
if (!isset($this->installedMap[$package->getId()])) {
$this->addRulesForPackage($package);
}
}
$rule = $this->createInstallOneOfRule($job['packages'], Rule::RULE_JOB_INSTALL, $job);
$this->addRule(RuleSet::TYPE_JOB, $rule);
}
break;
case 'remove':
foreach ($job['packages'] as $package) {
$rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
$this->addRule(RuleSet::TYPE_JOB, $rule);
}
break;
}
}
}
public function getRulesFor($jobs, $installedMap)
{
$this->jobs = $jobs;
$this->rules = new RuleSet;
$this->installedMap = $installedMap;
foreach ($this->installedMap as $package) {
$this->addRulesForPackage($package);
$this->addRulesForUpdatePackages($package);
}
$this->addRulesForJobs();
return $this->rules;
}
}
<?php
namespace Composer\DependencyResolver;
class DebugSolver extends Solver
{
protected function printDecisionMap()
{
echo "\nDecisionMap: \n";
foreach ($this->decisionMap as $packageId => $level) {
if ($packageId === 0) {
continue;
}
if ($level > 0) {
echo ' +' . $this->pool->packageById($packageId)."\n";
} elseif ($level < 0) {
echo ' -' . $this->pool->packageById($packageId)."\n";
} else {
echo ' ?' . $this->pool->packageById($packageId)."\n";
}
}
echo "\n";
}
protected function printDecisionQueue()
{
echo "DecisionQueue: \n";
foreach ($this->decisionQueue as $i => $literal) {
echo ' ' . $this->pool->literalToString($literal) . ' ' . $this->decisionQueueWhy[$i]." level ".$this->decisionMap[abs($literal)]."\n";
}
echo "\n";
}
protected function printWatches()
{
echo "\nWatches:\n";
foreach ($this->watches as $literalId => $watch) {
echo ' '.$this->literalFromId($literalId)."\n";
$queue = array(array(' ', $watch));
while (!empty($queue)) {
list($indent, $watch) = array_pop($queue);
echo $indent.$watch;
if ($watch) {
echo ' [id='.$watch->getId().',watch1='.$this->literalFromId($watch->watch1).',watch2='.$this->literalFromId($watch->watch2)."]";
}
echo "\n";
if ($watch && ($watch->next1 == $watch || $watch->next2 == $watch)) {
if ($watch->next1 == $watch) {
echo $indent." 1 *RECURSION*";
}
if ($watch->next2 == $watch) {
echo $indent." 2 *RECURSION*";
}
} elseif ($watch && ($watch->next1 || $watch->next2)) {
$indent = str_replace(array('1', '2'), ' ', $indent);
array_push($queue, array($indent.' 2 ', $watch->next2));
array_push($queue, array($indent.' 1 ', $watch->next1));
}
}
echo "\n";
}
}
}
<?php
namespace Composer\DependencyResolver;
class RuleSetIterator implements \Iterator
{
protected $rules;
protected $types;
protected $currentOffset;
protected $currentType;
protected $currentTypeOffset;
public function __construct(array $rules)
{
$this->rules = $rules;
$this->types = array_keys($rules);
sort($this->types);
$this->rewind();
}
public function current()
{
return $this->rules[$this->currentType][$this->currentOffset];
}
public function key()
{
return $this->currentType;
}
public function next()
{
$this->currentOffset++;
if (!isset($this->rules[$this->currentType])) {
return;
}
if ($this->currentOffset >= sizeof($this->rules[$this->currentType])) {
$this->currentOffset = 0;
do {
$this->currentTypeOffset++;
if (!isset($this->types[$this->currentTypeOffset])) {
$this->currentType = -1;
break;
}
$this->currentType = $this->types[$this->currentTypeOffset];
} while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
}
}
public function rewind()
{
$this->currentOffset = 0;
$this->currentTypeOffset = -1;
$this->currentType = -1;
do {
$this->currentTypeOffset++;
if (!isset($this->types[$this->currentTypeOffset])) {
$this->currentType = -1;
break;
}
$this->currentType = $this->types[$this->currentTypeOffset];
} while (isset($this->types[$this->currentTypeOffset]) && !sizeof($this->rules[$this->currentType]));
}
public function valid()
{
return isset($this->rules[$this->currentType])
&& isset($this->rules[$this->currentType][$this->currentOffset]);
}
}
<?php
namespace Composer\DependencyResolver;
class RuleWatchChain extends \SplDoublyLinkedList
{
protected $offset = 0;
public function seek($offset)
{
$this->rewind();
for ($i = 0; $i < $offset; $i++, $this->next());
}
public function remove()
{
$offset = $this->key();
$this->offsetUnset($offset);
$this->seek($offset);
}
}
<?php
namespace Composer\DependencyResolver;
use Composer\Repository\RepositoryInterface;
class Solver
{
const BRANCH_LITERALS = 0;
const BRANCH_LEVEL = 1;
protected $policy;
protected $pool;
protected $installed;
protected $rules;
protected $ruleSetGenerator;
protected $updateAll;
protected $addedMap = array();
protected $updateMap = array();
protected $watchGraph;
protected $decisions;
protected $installedMap;
protected $propagateIndex;
protected $branches = array();
protected $problems = array();
protected $learnedPool = array();
public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed)
{
$this->policy = $policy;
$this->pool = $pool;
$this->installed = $installed;
$this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
}
private function makeAssertionRuleDecisions()
{
$decisionStart = count($this->decisions) - 1;
$rulesCount = count($this->rules);
for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
$rule = $this->rules->ruleById($ruleIndex);
if (!$rule->isAssertion() || $rule->isDisabled()) {
continue;
}
$literals = $rule->getLiterals();
$literal = $literals[0];
if (!$this->decisions->decided(abs($literal))) {
$this->decisions->decide($literal, 1, $rule);
continue;
}
if ($this->decisions->satisfy($literal)) {
continue;
}
if (RuleSet::TYPE_LEARNED === $rule->getType()) {
$rule->disable();
continue;
}
$conflict = $this->decisions->decisionRule($literal);
if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
$problem = new Problem($this->pool);
$problem->addRule($rule);
$problem->addRule($conflict);
$this->disableProblem($rule);
$this->problems[] = $problem;
continue;
}
$problem = new Problem($this->pool);
$problem->addRule($rule);
$problem->addRule($conflict);
foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
continue;
}
$assertRuleLiterals = $assertRule->getLiterals();
$assertRuleLiteral = $assertRuleLiterals[0];
if (abs($literal) !== abs($assertRuleLiteral)) {
continue;
}
$problem->addRule($assertRule);
$this->disableProblem($assertRule);
}
$this->problems[] = $problem;
$this->decisions->resetToOffset($decisionStart);
$ruleIndex = -1;
}
}
protected function setupInstalledMap()
{
$this->installedMap = array();
foreach ($this->installed->getPackages() as $package) {
$this->installedMap[$package->getId()] = $package;
}
foreach ($this->jobs as $job) {
switch ($job['cmd']) {
case 'update':
foreach ($job['packages'] as $package) {
if (isset($this->installedMap[$package->getId()])) {
$this->updateMap[$package->getId()] = true;
}
}
break;
case 'update-all':
foreach ($this->installedMap as $package) {
$this->updateMap[$package->getId()] = true;
}
break;
case 'install':
if (!$job['packages']) {
$problem = new Problem($this->pool);
$problem->addRule(new Rule($this->pool, array(), null, null, $job));
$this->problems[] = $problem;
}
break;
}
}
}
public function solve(Request $request)
{
$this->jobs = $request->getJobs();
$this->setupInstalledMap();
$this->decisions = new Decisions($this->pool);
$this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap);
$this->watchGraph = new RuleWatchGraph;
foreach ($this->rules as $rule) {
$this->watchGraph->insert(new RuleWatchNode($rule));
}
$this->makeAssertionRuleDecisions();
$this->runSat(true);
foreach ($this->installedMap as $packageId => $void) {
if ($this->decisions->undecided($packageId)) {
$this->decisions->decide(-$packageId, 1, null);
}
}
if ($this->problems) {
throw new SolverProblemsException($this->problems, $this->installedMap);
}
$transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
return $transaction->getOperations();
}
protected function literalFromId($id)
{
$package = $this->pool->packageById(abs($id));
return new Literal($package, $id > 0);
}
protected function propagate($level)
{
while ($this->decisions->validOffset($this->propagateIndex)) {
$decision = $this->decisions->atOffset($this->propagateIndex);
$conflict = $this->watchGraph->propagateLiteral(
$decision[Decisions::DECISION_LITERAL],
$level,
$this->decisions
);
$this->propagateIndex++;
if ($conflict) {
return $conflict;
}
}
return null;
}
private function revert($level)
{
while (!$this->decisions->isEmpty()) {
$literal = $this->decisions->lastLiteral();
if ($this->decisions->undecided($literal)) {
break;
}
$decisionLevel = $this->decisions->decisionLevel($literal);
if ($decisionLevel <= $level) {
break;
}
$this->decisions->revertLast();
$this->propagateIndex = count($this->decisions);
}
while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
array_pop($this->branches);
}
}
private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
{
$level++;
$this->decisions->decide($literal, $level, $rule);
while (true) {
$rule = $this->propagate($level);
if (!$rule) {
break;
}
if ($level == 1) {
return $this->analyzeUnsolvable($rule, $disableRules);
}
list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
if ($newLevel <= 0 || $newLevel >= $level) {
throw new SolverBugException(
"Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
);
} elseif (!$newRule) {
throw new SolverBugException(
"No rule was learned from analyzing $rule at level $level."
);
}
$level = $newLevel;
$this->revert($level);
$this->rules->add($newRule, RuleSet::TYPE_LEARNED);
$this->learnedWhy[$newRule->getId()] = $why;
$ruleNode = new RuleWatchNode($newRule);
$ruleNode->watch2OnHighest($this->decisions);
$this->watchGraph->insert($ruleNode);
$this->decisions->decide($learnLiteral, $level, $newRule);
}
return $level;
}
private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
{
$literals = $this->policy->selectPreferedPackages($this->pool, $this->installedMap, $decisionQueue);
$selectedLiteral = array_shift($literals);
if (count($literals)) {
$this->branches[] = array($literals, $level);
}
return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
}
protected function analyze($level, $rule)
{
$analyzedRule = $rule;
$ruleLevel = 1;
$num = 0;
$l1num = 0;
$seen = array();
$learnedLiterals = array(null);
$decisionId = count($this->decisions);
$this->learnedPool[] = array();
while (true) {
$this->learnedPool[count($this->learnedPool) - 1][] = $rule;
foreach ($rule->getLiterals() as $literal) {
if ($this->decisions->satisfy($literal)) {
continue;
}
if (isset($seen[abs($literal)])) {
continue;
}
$seen[abs($literal)] = true;
$l = $this->decisions->decisionLevel($literal);
if (1 === $l) {
$l1num++;
} elseif ($level === $l) {
$num++;
} else {
$learnedLiterals[] = $literal;
if ($l > $ruleLevel) {
$ruleLevel = $l;
}
}
}
$l1retry = true;
while ($l1retry) {
$l1retry = false;
if (!$num && !--$l1num) {
break 2;
}
while (true) {
if ($decisionId <= 0) {
throw new SolverBugException(
"Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
);
}
$decisionId--;
$decision = $this->decisions->atOffset($decisionId);
$literal = $decision[Decisions::DECISION_LITERAL];
if (isset($seen[abs($literal)])) {
break;
}
}
unset($seen[abs($literal)]);
if ($num && 0 === --$num) {
$learnedLiterals[0] = -abs($literal);
if (!$l1num) {
break 2;
}
foreach ($learnedLiterals as $i => $learnedLiteral) {
if ($i !== 0) {
unset($seen[abs($learnedLiteral)]);
}
}
$l1num++;
$l1retry = true;
}
}
$decision = $this->decisions->atOffset($decisionId);
$rule = $decision[Decisions::DECISION_REASON];
}
$why = count($this->learnedPool) - 1;
if (!$learnedLiterals[0]) {
throw new SolverBugException(
"Did not find a learnable literal in analyzed rule $analyzedRule."
);
}
$newRule = new Rule($this->pool, $learnedLiterals, Rule::RULE_LEARNED, $why);
return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
}
private function analyzeUnsolvableRule($problem, $conflictRule)
{
$why = $conflictRule->getId();
if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
$learnedWhy = $this->learnedWhy[$why];
$problemRules = $this->learnedPool[$learnedWhy];
foreach ($problemRules as $problemRule) {
$this->analyzeUnsolvableRule($problem, $problemRule);
}
return;
}
if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
return;
}
$problem->nextSection();
$problem->addRule($conflictRule);
}
private function analyzeUnsolvable($conflictRule, $disableRules)
{
$problem = new Problem($this->pool);
$problem->addRule($conflictRule);
$this->analyzeUnsolvableRule($problem, $conflictRule);
$this->problems[] = $problem;
$seen = array();
$literals = $conflictRule->getLiterals();
foreach ($literals as $literal) {
if ($this->decisions->satisfy($literal)) {
continue;
}
$seen[abs($literal)] = true;
}
foreach ($this->decisions as $decision) {
$literal = $decision[Decisions::DECISION_LITERAL];
if (!isset($seen[abs($literal)])) {
continue;
}
$why = $decision[Decisions::DECISION_REASON];
$problem->addRule($why);
$this->analyzeUnsolvableRule($problem, $why);
$literals = $why->getLiterals();
foreach ($literals as $literal) {
if ($this->decisions->satisfy($literal)) {
continue;
}
$seen[abs($literal)] = true;
}
}
if ($disableRules) {
foreach ($this->problems[count($this->problems) - 1] as $reason) {
$this->disableProblem($reason['rule']);
}
$this->resetSolver();
return 1;
}
return 0;
}
private function disableProblem($why)
{
$job = $why->getJob();
if (!$job) {
$why->disable();
return;
}
foreach ($this->rules as $rule) {
if ($job === $rule->getJob()) {
$rule->disable();
}
}
}
private function resetSolver()
{
$this->decisions->reset();
$this->propagateIndex = 0;
$this->branches = array();
$this->enableDisableLearnedRules();
$this->makeAssertionRuleDecisions();
}
private function enableDisableLearnedRules()
{
foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
$why = $this->learnedWhy[$rule->getId()];
$problemRules = $this->learnedPool[$why];
$foundDisabled = false;
foreach ($problemRules as $problemRule) {
if ($problemRule->isDisabled()) {
$foundDisabled = true;
break;
}
}
if ($foundDisabled && $rule->isEnabled()) {
$rule->disable();
} elseif (!$foundDisabled && $rule->isDisabled()) {
$rule->enable();
}
}
}
private function runSat($disableRules = true)
{
$this->propagateIndex = 0;
$decisionQueue = array();
$decisionSupplementQueue = array();
$disableRules = array();
$level = 1;
$systemLevel = $level + 1;
$installedPos = 0;
while (true) {
if (1 === $level) {
$conflictRule = $this->propagate($level);
if (null !== $conflictRule) {
if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
continue;
}
return;
}
}
if ($level < $systemLevel) {
$iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
foreach ($iterator as $rule) {
if ($rule->isEnabled()) {
$decisionQueue = array();
$noneSatisfied = true;
foreach ($rule->getLiterals() as $literal) {
if ($this->decisions->satisfy($literal)) {
$noneSatisfied = false;
break;
}
if ($literal > 0 && $this->decisions->undecided($literal)) {
$decisionQueue[] = $literal;
}
}
if ($noneSatisfied && count($decisionQueue)) {
if (count($this->installed) != count($this->updateMap)) {
$prunedQueue = array();
foreach ($decisionQueue as $literal) {
if (isset($this->installedMap[abs($literal)])) {
$prunedQueue[] = $literal;
if (isset($this->updateMap[abs($literal)])) {
$prunedQueue = $decisionQueue;
break;
}
}
}
$decisionQueue = $prunedQueue;
}
}
if ($noneSatisfied && count($decisionQueue)) {
$oLevel = $level;
$level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
if (0 === $level) {
return;
}
if ($level <= $oLevel) {
break;
}
}
}
}
$systemLevel = $level + 1;
$iterator->next();
if ($iterator->valid()) {
continue;
}
}
if ($level < $systemLevel) {
$systemLevel = $level;
}
for ($i = 0, $n = 0; $n < count($this->rules); $i++, $n++) {
if ($i == count($this->rules)) {
$i = 0;
}
$rule = $this->rules->ruleById($i);
$literals = $rule->getLiterals();
if ($rule->isDisabled()) {
continue;
}
$decisionQueue = array();
foreach ($literals as $literal) {
if ($literal <= 0) {
if (!$this->decisions->decidedInstall(abs($literal))) {
continue 2;
}
} else {
if ($this->decisions->decidedInstall(abs($literal))) {
continue 2;
}
if ($this->decisions->undecided(abs($literal))) {
$decisionQueue[] = $literal;
}
}
}
if (count($decisionQueue) < 2) {
continue;
}
$oLevel = $level;
$level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
if (0 === $level) {
return;
}
$n = -1;
}
if ($level < $systemLevel) {
continue;
}
if (count($this->branches)) {
$lastLiteral = null;
$lastLevel = null;
$lastBranchIndex = 0;
$lastBranchOffset = 0;
$l = 0;
for ($i = count($this->branches) - 1; $i >= 0; $i--) {
list($literals, $l) = $this->branches[$i];
foreach ($literals as $offset => $literal) {
if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
$lastLiteral = $literal;
$lastBranchIndex = $i;
$lastBranchOffset = $offset;
$lastLevel = $l;
}
}
}
if ($lastLiteral) {
unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
array_values($this->branches[$lastBranchIndex][self::BRANCH_LITERALS]);
$level = $lastLevel;
$this->revert($level);
$why = $this->decisions->lastReason();
$oLevel = $level;
$level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
if ($level == 0) {
return;
}
continue;
}
}
break;
}
}
}
<?php
namespace Composer\DependencyResolver;
use Composer\Package\LinkConstraint\LinkConstraintInterface;
class Request
{
protected $jobs;
protected $pool;
public function __construct(Pool $pool)
{
$this->pool = $pool;
$this->jobs = array();
}
public function install($packageName, LinkConstraintInterface $constraint = null)
{
$this->addJob($packageName, 'install', $constraint);
}
public function update($packageName, LinkConstraintInterface $constraint = null)
{
$this->addJob($packageName, 'update', $constraint);
}
public function remove($packageName, LinkConstraintInterface $constraint = null)
{
$this->addJob($packageName, 'remove', $constraint);
}
protected function addJob($packageName, $cmd, LinkConstraintInterface $constraint = null)
{
$packageName = strtolower($packageName);
$packages = $this->pool->whatProvides($packageName, $constraint);
$this->jobs[] = array(
'packages' => $packages,
'cmd' => $cmd,
'packageName' => $packageName,
'constraint' => $constraint,
);
}
public function updateAll()
{
$this->jobs[] = array('cmd' => 'update-all', 'packages' => array());
}
public function getJobs()
{
return $this->jobs;
}
}
<?php
namespace Composer\DependencyResolver;
class Problem
{
protected $reasonSeen;
protected $reasons = array();
protected $section = 0;
protected $pool;
public function __construct(Pool $pool)
{
$this->pool = $pool;
}
public function addRule(Rule $rule)
{
$this->addReason($rule->getId(), array(
'rule' => $rule,
'job' => $rule->getJob(),
));
}
public function getReasons()
{
return $this->reasons;
}
public function getPrettyString(array $installedMap = array())
{
$reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
if (count($reasons) === 1) {
reset($reasons);
$reason = current($reasons);
$rule = $reason['rule'];
$job = $reason['job'];
if ($job && $job['cmd'] === 'install' && empty($job['packages'])) {
if (0 === stripos($job['packageName'], 'ext-')) {
$ext = substr($job['packageName'], 4);
$error = extension_loaded($ext) ? 'has the wrong version ('.phpversion($ext).') installed' : 'is missing from your system';
return "\n - The requested PHP extension ".$job['packageName'].$this->constraintToText($job['constraint']).' '.$error.'.';
}
if (0 === stripos($job['packageName'], 'lib-')) {
$lib = substr($job['packageName'], 4);
return "\n - The requested linked library ".$job['packageName'].$this->constraintToText($job['constraint']).' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
}
if (!preg_match('{^[A-Za-z0-9_./-]+$}', $job['packageName'])) {
$illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $job['packageName']);
return "\n - The requested package ".$job['packageName'].' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
}
if (!$this->pool->whatProvides($job['packageName'])) {
return "\n - The requested package ".$job['packageName'].' could not be found in any version, there may be a typo in the package name.';
}
return "\n - The requested package ".$job['packageName'].$this->constraintToText($job['constraint']).' could not be found.';
}
}
$messages = array();
foreach ($reasons as $reason) {
$rule = $reason['rule'];
$job = $reason['job'];
if ($job) {
$messages[] = $this->jobToText($job);
} elseif ($rule) {
if ($rule instanceof Rule) {
$messages[] = $rule->getPrettyString($installedMap);
}
}
}
return "\n - ".implode("\n - ", $messages);
}
protected function addReason($id, $reason)
{
if (!isset($this->reasonSeen[$id])) {
$this->reasonSeen[$id] = true;
$this->reasons[$this->section][] = $reason;
}
}
public function nextSection()
{
$this->section++;
}
protected function jobToText($job)
{
switch ($job['cmd']) {
case 'install':
if (!$job['packages']) {
return 'No package found to satisfy install request for '.$job['packageName'].$this->constraintToText($job['constraint']);
}
return 'Installation request for '.$job['packageName'].$this->constraintToText($job['constraint']).' -> satisfiable by '.$this->getPackageList($job['packages']).'.';
case 'update':
return 'Update request for '.$job['packageName'].$this->constraintToText($job['constraint']).'.';
case 'remove':
return 'Removal request for '.$job['packageName'].$this->constraintToText($job['constraint']).'';
}
return 'Job(cmd='.$job['cmd'].', target='.$job['packageName'].', packages=['.$this->getPackageList($job['packages']).'])';
}
protected function getPackageList($packages)
{
return implode(', ', array_unique(array_map(function ($package) {
return $package->getPrettyString();
},
$packages
)));
}
protected function constraintToText($constraint)
{
return ($constraint) ? ' '.$constraint->getPrettyString() : '';
}
}
<?php
namespace Composer\DependencyResolver;
class RuleWatchGraph
{
protected $watchChains = array();
public function insert(RuleWatchNode $node)
{
if ($node->getRule()->isAssertion()) {
return;
}
foreach (array($node->watch1, $node->watch2) as $literal) {
if (!isset($this->watchChains[$literal])) {
$this->watchChains[$literal] = new RuleWatchChain;
}
$this->watchChains[$literal]->unshift($node);
}
}
public function propagateLiteral($decidedLiteral, $level, $decisions)
{
$literal = -$decidedLiteral;
if (!isset($this->watchChains[$literal])) {
return null;
}
$chain = $this->watchChains[$literal];
$chain->rewind();
while ($chain->valid()) {
$node = $chain->current();
$otherWatch = $node->getOtherWatch($literal);
if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
$ruleLiterals = $node->getRule()->getLiterals();
$alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
return $literal !== $ruleLiteral &&
$otherWatch !== $ruleLiteral &&
!$decisions->conflict($ruleLiteral);
});
if ($alternativeLiterals) {
reset($alternativeLiterals);
$this->moveWatch($literal, current($alternativeLiterals), $node);
continue;
}
if ($decisions->conflict($otherWatch)) {
return $node->getRule();
}
$decisions->decide($otherWatch, $level, $node->getRule());
}
$chain->next();
}
return null;
}
protected function moveWatch($fromLiteral, $toLiteral, $node)
{
if (!isset($this->watchChains[$toLiteral])) {
$this->watchChains[$toLiteral] = new RuleWatchChain;
}
$node->moveWatch($fromLiteral, $toLiteral);
$this->watchChains[$fromLiteral]->remove();
$this->watchChains[$toLiteral]->unshift($node);
}
}
<?php
namespace Composer\Config;
interface ConfigSourceInterface
{
public function addRepository($name, $config);
public function removeRepository($name);
public function addConfigSetting($name, $value);
public function removeConfigSetting($name);
public function addLink($type, $name, $value);
public function removeLink($type, $name);
}
<?php
namespace Composer\Config;
use Composer\Json\JsonFile;
use Composer\Json\JsonManipulator;
class JsonConfigSource implements ConfigSourceInterface
{
private $file;
private $manipulator;
public function __construct(JsonFile $file)
{
$this->file = $file;
}
public function addRepository($name, $config)
{
$this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
$config['repositories'][$repo] = $repoConfig;
});
}
public function removeRepository($name)
{
$this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
unset($config['repositories'][$repo]);
});
}
public function addConfigSetting($name, $value)
{
$this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) {
$config['config'][$key] = $val;
});
}
public function removeConfigSetting($name)
{
$this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) {
unset($config['config'][$key]);
});
}
public function addLink($type, $name, $value)
{
$this->manipulateJson('addLink', $type, $name, $value, function (&$config, $key) {
$config[$type][$name] = $value;
});
}
public function removeLink($type, $name)
{
$this->manipulateJson('removeSubNode', $type, $name, function (&$config, $key) {
unset($config[$type][$name]);
});
}
protected function manipulateJson($method, $args, $fallback)
{
$args = func_get_args();
array_shift($args);
$fallback = array_pop($args);
if ($this->file->exists()) {
$contents = file_get_contents($this->file->getPath());
} else {
$contents = "{\n \"config\": {\n }\n}\n";
}
$manipulator = new JsonManipulator($contents);
$newFile = !$this->file->exists();
if (call_user_func_array(array($manipulator, $method), $args)) {
file_put_contents($this->file->getPath(), $manipulator->getContents());
} else {
$config = $this->file->read();
array_unshift($args, $config);
call_user_func_array($fallback, $args);
$this->file->write($config);
}
if ($newFile) {
chmod($this->file->getPath(), 0600);
}
}
}
<?php
namespace Composer;
use Composer\Config\JsonConfigSource;
use Composer\Json\JsonFile;
use Composer\IO\IOInterface;
use Composer\Package\Archiver;
use Composer\Repository\ComposerRepository;
use Composer\Repository\RepositoryManager;
use Composer\Util\ProcessExecutor;
use Composer\Util\RemoteFilesystem;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Composer\Script\EventDispatcher;
use Composer\Autoload\AutoloadGenerator;
class Factory
{
public static function createConfig()
{
$home = getenv('COMPOSER_HOME');
$cacheDir = getenv('COMPOSER_CACHE_DIR');
if (!$home) {
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
$home = strtr(getenv('APPDATA'), '\\', '/') . '/Composer';
} else {
$home = rtrim(getenv('HOME'), '/') . '/.composer';
}
}
if (!$cacheDir) {
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
if ($cacheDir = getenv('LOCALAPPDATA')) {
$cacheDir .= '/Composer';
} else {
$cacheDir = getenv('APPDATA') . '/Composer/cache';
}
$cacheDir = strtr($cacheDir, '\\', '/');
} else {
$cacheDir = $home.'/cache';
}
}
foreach (array($home, $cacheDir) as $dir) {
if (!file_exists($dir . '/.htaccess')) {
if (!is_dir($dir)) {
@mkdir($dir, 0777, true);
}
@file_put_contents($dir . '/.htaccess', 'Deny from all');
}
}
$config = new Config();
$config->merge(array('config' => array('home' => $home, 'cache-dir' => $cacheDir)));
$file = new JsonFile($home.'/config.json');
if ($file->exists()) {
$config->merge($file->read());
}
$config->setConfigSource(new JsonConfigSource($file));
$legacyPaths = array(
'cache-repo-dir' => array('/cache' => '/http*', '/cache.svn' => '/*', '/cache.github' => '/*'),
'cache-vcs-dir' => array('/cache.git' => '/*', '/cache.hg' => '/*'),
'cache-files-dir' => array('/cache.files' => '/*'),
);
foreach ($legacyPaths as $key => $oldPaths) {
foreach ($oldPaths as $oldPath => $match) {
$dir = $config->get($key);
if ('/cache.github' === $oldPath) {
$dir .= '/github.com';
}
$oldPath = $config->get('home').$oldPath;
$oldPathMatch = $oldPath . $match;
if (is_dir($oldPath) && $dir !== $oldPath) {
if (!is_dir($dir)) {
if (!@mkdir($dir, 0777, true)) {
continue;
}
}
if (is_array($children = glob($oldPathMatch))) {
foreach ($children as $child) {
@rename($child, $dir.'/'.basename($child));
}
}
@rmdir($oldPath);
}
}
}
return $config;
}
public static function getComposerFile()
{
return trim(getenv('COMPOSER')) ?: 'composer.json';
}
public static function createAdditionalStyles()
{
return array(
'highlight' => new OutputFormatterStyle('red'),
'warning' => new OutputFormatterStyle('black', 'yellow'),
);
}
public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
{
$repos = array();
if (!$config) {
$config = static::createConfig();
}
if (!$rm) {
if (!$io) {
throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
}
$factory = new static;
$rm = $factory->createRepositoryManager($io, $config);
}
foreach ($config->getRepositories() as $index => $repo) {
if (!is_array($repo)) {
throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
}
if (!isset($repo['type'])) {
throw new \UnexpectedValueException('Repository '.$index.' ('.json_encode($repo).') must have a type defined');
}
$name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
while (isset($repos[$name])) {
$name .= '2';
}
$repos[$name] = $rm->createRepository($repo['type'], $repo);
}
return $repos;
}
public function createComposer(IOInterface $io, $localConfig = null)
{
if (null === $localConfig) {
$localConfig = static::getComposerFile();
}
if (is_string($localConfig)) {
$composerFile = $localConfig;
$file = new JsonFile($localConfig, new RemoteFilesystem($io));
if (!$file->exists()) {
if ($localConfig === 'composer.json') {
$message = 'Composer could not find a composer.json file in '.getcwd();
} else {
$message = 'Composer could not find the config file: '.$localConfig;
}
$instructions = 'To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section';
throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
}
$file->validateSchema(JsonFile::LAX_SCHEMA);
$localConfig = $file->read();
}
$config = static::createConfig();
$config->merge($localConfig);
if ($tokens = $config->get('github-oauth')) {
foreach ($tokens as $domain => $token) {
if (!preg_match('{^[a-z0-9]+$}', $token)) {
throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
}
$io->setAuthentication($domain, $token, 'x-oauth-basic');
}
}
$vendorDir = $config->get('vendor-dir');
$binDir = $config->get('bin-dir');
ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
$rm = $this->createRepositoryManager($io, $config);
$this->addLocalRepository($rm, $vendorDir);
$loader = new Package\Loader\RootPackageLoader($rm, $config);
$package = $loader->load($localConfig);
$dm = $this->createDownloadManager($io, $config);
$im = $this->createInstallationManager();
$composer = new Composer();
$composer->setConfig($config);
$composer->setPackage($package);
$composer->setRepositoryManager($rm);
$composer->setDownloadManager($dm);
$composer->setInstallationManager($im);
$dispatcher = new EventDispatcher($composer, $io);
$composer->setEventDispatcher($dispatcher);
$generator = new AutoloadGenerator($dispatcher);
$composer->setAutoloadGenerator($generator);
$this->createDefaultInstallers($im, $composer, $io);
$this->purgePackages($rm, $im);
if (isset($composerFile)) {
$lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
? substr($composerFile, 0, -4).'lock'
: $composerFile . '.lock';
$locker = new Package\Locker(new JsonFile($lockFile, new RemoteFilesystem($io)), $rm, $im, md5_file($composerFile));
$composer->setLocker($locker);
}
return $composer;
}
protected function createRepositoryManager(IOInterface $io, Config $config)
{
$rm = new RepositoryManager($io, $config);
$rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
$rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
$rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
$rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
$rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
return $rm;
}
protected function addLocalRepository(RepositoryManager $rm, $vendorDir)
{
$rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json')));
}
public function createDownloadManager(IOInterface $io, Config $config)
{
$cache = null;
if ($config->get('cache-files-ttl') > 0) {
$cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
}
$dm = new Downloader\DownloadManager();
$dm->setDownloader('git', new Downloader\GitDownloader($io, $config));
$dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config));
$dm->setDownloader('hg', new Downloader\HgDownloader($io, $config));
$dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $cache));
$dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $cache));
$dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $cache));
$dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $cache));
return $dm;
}
public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
{
if (null === $dm) {
$dm = $this->createDownloadManager(new IO\NullIO(), $config);
}
$am = new Archiver\ArchiveManager($dm);
$am->addArchiver(new Archiver\PharArchiver);
return $am;
}
protected function createInstallationManager()
{
return new Installer\InstallationManager();
}
protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
{
$im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
$im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
$im->addInstaller(new Installer\InstallerInstaller($io, $composer));
$im->addInstaller(new Installer\MetapackageInstaller($io));
}
protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im)
{
$repo = $rm->getLocalRepository();
foreach ($repo->getPackages() as $package) {
if (!$im->isPackageInstalled($repo, $package)) {
$repo->removePackage($package);
}
}
}
public static function create(IOInterface $io, $config = null)
{
$factory = new static();
return $factory->createComposer($io, $config);
}
}
<?php
namespace Composer\Util;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
class Filesystem
{
private $processExecutor;
public function __construct(ProcessExecutor $executor = null)
{
$this->processExecutor = $executor ?: new ProcessExecutor();
}
public function remove($file)
{
if (is_dir($file)) {
return $this->removeDirectory($file);
}
if (file_exists($file)) {
return unlink($file);
}
return false;
}
public function removeDirectory($directory)
{
if (!is_dir($directory)) {
return true;
}
if (!function_exists('proc_open')) {
return $this->removeDirectoryPhp($directory);
}
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$cmd = sprintf('rmdir /S /Q %s', escapeshellarg(realpath($directory)));
} else {
$cmd = sprintf('rm -rf %s', escapeshellarg($directory));
}
$result = $this->getProcess()->execute($cmd, $output) === 0;
clearstatcache();
return $result && !is_dir($directory);
}
public function removeDirectoryPhp($directory)
{
$it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($ri as $file) {
if ($file->isDir()) {
rmdir($file->getPathname());
} else {
unlink($file->getPathname());
}
}
return rmdir($directory);
}
public function ensureDirectoryExists($directory)
{
if (!is_dir($directory)) {
if (file_exists($directory)) {
throw new \RuntimeException(
$directory.' exists and is not a directory.'
);
}
if (!@mkdir($directory, 0777, true)) {
throw new \RuntimeException(
$directory.' does not exist and could not be created.'
);
}
}
}
public function copyThenRemove($source, $target)
{
$it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
if (!file_exists($target)) {
mkdir($target, 0777, true);
}
foreach ($ri as $file) {
$targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
if ($file->isDir()) {
mkdir($targetPath);
} else {
copy($file->getPathname(), $targetPath);
}
}
$this->removeDirectoryPhp($source);
}
public function rename($source, $target)
{
if (true === @rename($source, $target)) {
return;
}
if (!function_exists('proc_open')) {
return $this->copyThenRemove($source, $target);
}
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$command = sprintf('xcopy %s %s /E /I /Q', escapeshellarg($source), escapeshellarg($target));
$result = $this->processExecutor->execute($command, $output);
clearstatcache();
if (0 === $result) {
$this->remove($source);
return;
}
return $this->copyThenRemove($source, $target);
} else {
$command = sprintf('mv %s %s', escapeshellarg($source), escapeshellarg($target));
$result = $this->processExecutor->execute($command, $output);
clearstatcache();
if (0 === $result) {
return;
}
}
throw new \RuntimeException(sprintf('Could not rename "%s" to "%s".', $source, $target));
}
public function findShortestPath($from, $to, $directories = false)
{
if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
}
$from = lcfirst(rtrim(strtr($from, '\\', '/'), '/'));
$to = lcfirst(rtrim(strtr($to, '\\', '/'), '/'));
if ($directories) {
$from .= '/dummy_file';
}
if (dirname($from) === dirname($to)) {
return './'.basename($to);
}
$commonPath = $to;
while (strpos($from, $commonPath) !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
$commonPath = strtr(dirname($commonPath), '\\', '/');
}
if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
return $to;
}
$commonPath = rtrim($commonPath, '/') . '/';
$sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
$commonPathCode = str_repeat('../', $sourcePathDepth);
return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
}
public function findShortestPathCode($from, $to, $directories = false)
{
if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
}
$from = lcfirst(strtr($from, '\\', '/'));
$to = lcfirst(strtr($to, '\\', '/'));
if ($from === $to) {
return $directories ? '__DIR__' : '__FILE__';
}
$commonPath = $to;
while (strpos($from, $commonPath) !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
$commonPath = strtr(dirname($commonPath), '\\', '/');
}
if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
return var_export($to, true);
}
$commonPath = rtrim($commonPath, '/') . '/';
if (strpos($to, $from.'/') === 0) {
return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
}
$sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
$relTarget = substr($to, strlen($commonPath));
return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
}
public function isAbsolutePath($path)
{
return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':';
}
public function size($path)
{
if (!file_exists($path)) {
throw new \RuntimeException("$path does not exist.");
}
if (is_dir($path)) {
return $this->directorySize($path);
}
return filesize($path);
}
protected function directorySize($directory)
{
$it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
$ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
$size = 0;
foreach ($ri as $file) {
if ($file->isFile()) {
$size += $file->getSize();
}
}
return $size;
}
protected function getProcess()
{
return new ProcessExecutor;
}
}
<?php
namespace Composer\Util;
use Composer\IO\IOInterface;
use Composer\Config;
use Composer\Downloader\TransportException;
use Composer\Json\JsonFile;
class GitHub
{
protected $io;
protected $config;
protected $process;
protected $remoteFilesystem;
public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
{
$this->io = $io;
$this->config = $config;
$this->process = $process ?: new ProcessExecutor;
$this->remoteFilesystem = $remoteFilesystem ?: new RemoteFilesystem($io);
}
public function authorizeOAuth($originUrl)
{
if ('github.com' !== $originUrl) {
return false;
}
if (0 === $this->process->execute('git config github.accesstoken', $output)) {
$this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
return true;
}
return false;
}
public function authorizeOAuthInteractively($originUrl, $message = null)
{
$attemptCounter = 0;
if ($message) {
$this->io->write($message);
}
$this->io->write('The credentials will be swapped for an OAuth token stored in '.$this->config->get('home').'/config.json, your password will not be stored');
$this->io->write('To revoke access to this token you can visit https://github.com/settings/applications');
while ($attemptCounter++ < 5) {
try {
$username = $this->io->ask('Username: ');
$password = $this->io->askAndHideAnswer('Password: ');
$this->io->setAuthentication($originUrl, $username, $password);
$appName = 'Composer';
if (0 === $this->process->execute('hostname', $output)) {
$appName .= ' on ' . trim($output);
}
$contents = JsonFile::parseJson($this->remoteFilesystem->getContents($originUrl, 'https://api.github.com/authorizations', false, array(
'http' => array(
'method' => 'POST',
'follow_location' => false,
'header' => "Content-Type: application/json\r\n",
'content' => json_encode(array(
'scopes' => array('repo'),
'note' => $appName,
'note_url' => 'https://getcomposer.org/',
)),
)
)));
} catch (TransportException $e) {
if (in_array($e->getCode(), array(403, 401))) {
$this->io->write('Invalid credentials.');
continue;
}
throw $e;
}
$this->io->setAuthentication($originUrl, $contents['token'], 'x-oauth-basic');
$githubTokens = $this->config->get('github-oauth') ?: array();
$githubTokens[$originUrl] = $contents['token'];
$this->config->getConfigSource()->addConfigSetting('github-oauth', $githubTokens);
return true;
}
throw new \RuntimeException("Invalid GitHub credentials 5 times in a row, aborting.");
}
}
<?php
namespace Composer\Util;
use Symfony\Component\Process\Process;
class ProcessExecutor
{
protected static $timeout = 300;
protected $captureOutput;
protected $errorOutput;
public function execute($command, &$output = null, $cwd = null)
{
$this->captureOutput = count(func_get_args()) > 1;
$this->errorOutput = null;
$process = new Process($command, $cwd, null, null, static::getTimeout());
$callback = is_callable($output) ? $output : array($this, 'outputHandler');
$process->run($callback);
if ($this->captureOutput && !is_callable($output)) {
$output = $process->getOutput();
}
$this->errorOutput = $process->getErrorOutput();
return $process->getExitCode();
}
public function splitLines($output)
{
return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
}
public function getErrorOutput()
{
return $this->errorOutput;
}
public function outputHandler($type, $buffer)
{
if ($this->captureOutput) {
return;
}
echo $buffer;
}
public static function getTimeout()
{
return static::$timeout;
}
public static function setTimeout($timeout)
{
static::$timeout = $timeout;
}
}
<?php
namespace Composer\Util;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Downloader\TransportException;
class RemoteFilesystem
{
private $io;
private $firstCall;
private $bytesMax;
private $originUrl;
private $fileUrl;
private $fileName;
private $result;
private $progress;
private $lastProgress;
private $options;
public function __construct(IOInterface $io, $options = array())
{
$this->io = $io;
$this->options = $options;
}
public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
{
$this->get($originUrl, $fileUrl, $options, $fileName, $progress);
return $this->result;
}
public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
{
$this->get($originUrl, $fileUrl, $options, null, $progress);
return $this->result;
}
protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
{
$this->bytesMax = 0;
$this->result = null;
$this->originUrl = $originUrl;
$this->fileUrl = $fileUrl;
$this->fileName = $fileName;
$this->progress = $progress;
$this->lastProgress = null;
$options = $this->getOptionsForUrl($originUrl, $additionalOptions);
if (isset($options['github-token'])) {
$fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
unset($options['github-token']);
}
$ctx = StreamContextFactory::getContext($options, array('notification' => array($this, 'callbackGet')));
if ($this->progress) {
$this->io->write(" Downloading: <comment>connection...</comment>", false);
}
$errorMessage = '';
$errorCode = 0;
set_error_handler(function ($code, $msg) use (&$errorMessage) {
if ($errorMessage) {
$errorMessage .= "\n";
}
$errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
});
try {
$result = file_get_contents($fileUrl, false, $ctx);
} catch (\Exception $e) {
if ($e instanceof TransportException && !empty($http_response_header[0])) {
$e->setHeaders($http_response_header);
}
}
if ($errorMessage && !ini_get('allow_url_fopen')) {
$errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
}
restore_error_handler();
if (isset($e)) {
throw $e;
}
if (!empty($http_response_header[0]) && preg_match('{^HTTP/\S+ ([45]\d\d)}i', $http_response_header[0], $match)) {
$result = false;
$errorCode = $match[1];
}
if (false !== $result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http') {
$decode = false;
foreach ($http_response_header as $header) {
if (preg_match('{^content-encoding: *gzip *$}i', $header)) {
$decode = true;
continue;
} elseif (preg_match('{^HTTP/}i', $header)) {
$decode = false;
}
}
if ($decode) {
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
$result = zlib_decode($result);
} else {
$result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
}
}
}
if ($this->progress) {
$this->io->overwrite(" Downloading: <comment>100%</comment>");
}
if (false !== $result && null !== $fileName) {
$errorMessage = '';
set_error_handler(function ($code, $msg) use (&$errorMessage) {
if ($errorMessage) {
$errorMessage .= "\n";
}
$errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
});
$result = (bool) file_put_contents($fileName, $result);
restore_error_handler();
if (false === $result) {
throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
}
}
if (null === $this->result) {
$this->result = $result;
}
if (false === $this->result) {
$e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
if (!empty($http_response_header[0])) {
$e->setHeaders($http_response_header);
}
throw $e;
}
}
protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
{
switch ($notificationCode) {
case STREAM_NOTIFY_FAILURE:
throw new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.trim($message).')', $messageCode);
break;
case STREAM_NOTIFY_AUTH_REQUIRED:
if (401 === $messageCode) {
if (!$this->io->isInteractive()) {
$message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console";
throw new TransportException($message, 401);
}
$this->io->overwrite(' Authentication required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
$username = $this->io->ask(' Username: ');
$password = $this->io->askAndHideAnswer(' Password: ');
$this->io->setAuthentication($this->originUrl, $username, $password);
$this->get($this->originUrl, $this->fileUrl, $this->fileName, $this->progress);
}
break;
case STREAM_NOTIFY_AUTH_RESULT:
if (403 === $messageCode) {
$message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $message;
throw new TransportException($message, 403);
}
break;
case STREAM_NOTIFY_FILE_SIZE_IS:
if ($this->bytesMax < $bytesMax) {
$this->bytesMax = $bytesMax;
}
break;
case STREAM_NOTIFY_PROGRESS:
if ($this->bytesMax > 0 && $this->progress) {
$progression = 0;
if ($this->bytesMax > 0) {
$progression = round($bytesTransferred / $this->bytesMax * 100);
}
if ((0 === $progression % 5) && $progression !== $this->lastProgress) {
$this->lastProgress = $progression;
$this->io->overwrite(" Downloading: <comment>$progression%</comment>", false);
}
}
break;
default:
break;
}
}
protected function getOptionsForUrl($originUrl, $additionalOptions)
{
$headers = array(
sprintf(
'User-Agent: Composer/%s (%s; %s; PHP %s.%s.%s)',
Composer::VERSION === '83ea90296e001c3df6f1eb9933db65c1d45a1b37' ? 'source' : Composer::VERSION,
php_uname('s'),
php_uname('r'),
PHP_MAJOR_VERSION,
PHP_MINOR_VERSION,
PHP_RELEASE_VERSION
)
);
if (extension_loaded('zlib')) {
$headers[] = 'Accept-Encoding: gzip';
}
$options = array_replace_recursive($this->options, $additionalOptions);
if ($this->io->hasAuthentication($originUrl)) {
$auth = $this->io->getAuthentication($originUrl);
if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
$options['github-token'] = $auth['username'];
} else {
$authStr = base64_encode($auth['username'] . ':' . $auth['password']);
$headers[] = 'Authorization: Basic '.$authStr;
}
}
if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
$options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
}
foreach ($headers as $header) {
$options['http']['header'][] = $header;
}
return $options;
}
}
<?php
namespace Composer\Util;
final class StreamContextFactory
{
public static function getContext(array $defaultOptions = array(), array $defaultParams = array())
{
$options = array('http' => array());
if (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy'])) {
$proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
}
if (!empty($proxy)) {
$proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
$proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
if (isset($proxy['port'])) {
$proxyURL .= ":" . $proxy['port'];
} elseif ('http://' == substr($proxyURL, 0, 7)) {
$proxyURL .= ":80";
} elseif ('https://' == substr($proxyURL, 0, 8)) {
$proxyURL .= ":443";
}
$proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
}
$options['http'] = array(
'proxy' => $proxyURL,
'request_fulluri' => true,
);
if (isset($proxy['user'])) {
$auth = $proxy['user'];
if (isset($proxy['pass'])) {
$auth .= ':' . $proxy['pass'];
}
$auth = base64_encode($auth);
if (isset($defaultOptions['http']['header'])) {
if (is_string($defaultOptions['http']['header'])) {
$defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
}
$defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
} else {
$options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
}
}
}
$options = array_replace_recursive($options, $defaultOptions);
if (isset($options['http']['header'])) {
$options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
}
return stream_context_create($options, $defaultParams);
}
private static function fixHttpHeaderField($header)
{
if (!is_array($header)) {
$header = explode("\r\n", $header);
}
uasort($header, function ($el) {
return preg_match('{^content-type}i', $el) ? 1 : -1;
});
return $header;
}
}
<?php
namespace Composer\Util;
use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Loader\ValidatingArrayLoader;
use Composer\Package\Loader\InvalidPackageException;
use Composer\Json\JsonValidationException;
use Composer\IO\IOInterface;
use Composer\Json\JsonFile;
class ConfigValidator
{
private $io;
public function __construct(IOInterface $io)
{
$this->io = $io;
}
public function validate($file)
{
$errors = array();
$publishErrors = array();
$warnings = array();
$laxValid = false;
$valid = false;
try {
$json = new JsonFile($file, new RemoteFilesystem($this->io));
$manifest = $json->read();
$json->validateSchema(JsonFile::LAX_SCHEMA);
$laxValid = true;
$json->validateSchema();
$valid = true;
} catch (JsonValidationException $e) {
foreach ($e->getErrors() as $message) {
if ($laxValid) {
$publishErrors[] = $message;
} else {
$errors[] = $message;
}
}
} catch (\Exception $e) {
$errors[] = $e->getMessage();
return array($errors, $publishErrors, $warnings);
}
if (!empty($manifest['license'])) {
if (is_array($manifest['license'])) {
foreach ($manifest['license'] as $key => $license) {
if ('proprietary' === $license) {
unset($manifest['license'][$key]);
}
}
}
$licenseValidator = new SpdxLicenseIdentifier();
if ('proprietary' !== $manifest['license'] && array() !== $manifest['license'] && !$licenseValidator->validate($manifest['license'])) {
$warnings[] = sprintf(
'License %s is not a valid SPDX license identifier, see http://www.spdx.org/licenses/ if you use an open license.'
."\nIf the software is closed-source, you may use \"proprietary\" as license.",
json_encode($manifest['license'])
);
}
} else {
$warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
}
if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
$suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
$suggestName = strtolower($suggestName);
$warnings[] = sprintf(
'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
$manifest['name'],
$suggestName
);
}
try {
$loader = new ValidatingArrayLoader(new ArrayLoader());
if (!isset($manifest['version'])) {
$manifest['version'] = '1.0.0';
}
if (!isset($manifest['name'])) {
$manifest['name'] = 'dummy/dummy';
}
$loader->load($manifest);
} catch (InvalidPackageException $e) {
$errors = array_merge($errors, $e->getErrors());
}
$warnings = array_merge($warnings, $loader->getWarnings());
return array($errors, $publishErrors, $warnings);
}
}
<?php
namespace Composer\Util;
class ErrorHandler
{
public static function handle($level, $message, $file, $line)
{
if (!error_reporting()) {
return;
}
if (ini_get('xdebug.scream')) {
$message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
"\na legitimately suppressed error that you were not supposed to see.";
}
throw new \ErrorException($message, 0, $level, $file, $line);
}
public static function register()
{
set_error_handler(array(__CLASS__, 'handle'));
}
}
<?php
namespace Composer\Util;
use Composer\Json\JsonFile;
class SpdxLicenseIdentifier
{
private $identifiers;
public function __construct()
{
$this->initIdentifiers();
}
public function validate($license)
{
if (is_array($license)) {
$count = count($license);
if ($count !== count(array_filter($license, 'is_string'))) {
throw new \InvalidArgumentException('Array of strings expected.');
}
$license = $count > 1 ? '('.implode(' or ', $license).')' : (string) reset($license);
}
if (!is_string($license)) {
throw new \InvalidArgumentException(sprintf(
'Array or String expected, %s given.', gettype($license)
));
}
return $this->isValidLicenseString($license);
}
private function initIdentifiers()
{
$jsonFile = new JsonFile(__DIR__ . '/../../../res/spdx-identifier.json');
$this->identifiers = $jsonFile->read();
}
private function isValidLicenseIdentifier($identifier)
{
return in_array($identifier, $this->identifiers);
}
private function isValidLicenseString($license)
{
$tokens = array(
'po' => '\(',
'pc' => '\)',
'op' => '(?:or|and)',
'lix' => '(?:NONE|NOASSERTION)',
'lir' => 'LicenseRef-\d+',
'lic' => '[-+_.a-zA-Z0-9]{3,}',
'ws' => '\s+',
'_' => '.',
);
$next = function () use ($license, $tokens) {
static $offset = 0;
if ($offset >= strlen($license)) {
return null;
}
foreach ($tokens as $name => $token) {
if (false === $r = preg_match('{' . $token . '}', $license, $matches, PREG_OFFSET_CAPTURE, $offset)) {
throw new \RuntimeException('Pattern for token %s failed (regex error).', $name);
}
if ($r === 0) {
continue;
}
if ($matches[0][1] !== $offset) {
continue;
}
$offset += strlen($matches[0][0]);
return array($name, $matches[0][0]);
}
throw new \RuntimeException('At least the last pattern needs to match, but it did not (dot-match-all is missing?).');
};
$open = 0;
$require = 1;
$lastop = null;
while (list($token, $string) = $next()) {
switch ($token) {
case 'po':
if ($open || !$require) {
return false;
}
$open = 1;
break;
case 'pc':
if ($open !== 1 || $require || !$lastop) {
return false;
}
$open = 2;
break;
case 'op':
if ($require || !$open) {
return false;
}
$lastop || $lastop = $string;
if ($lastop !== $string) {
return false;
}
$require = 1;
break;
case 'lix':
if ($open) {
return false;
}
goto lir;
case 'lic':
if (!$this->isValidLicenseIdentifier($string)) {
return false;
}
case 'lir':
lir:
if (!$require) {
return false;
}
$require = 0;
break;
case 'ws':
break;
case '_':
return false;
default:
throw new \RuntimeException(sprintf('Unparsed token: %s.', print_r($token, true)));
}
}
return !($open % 2 || $require);
}
}
<?php
namespace Composer\Util;
use Composer\IO\IOInterface;
class Svn
{
protected $credentials;
protected $hasAuth;
protected $io;
protected $url;
protected $cacheCredentials = true;
protected $process;
public function __construct($url, IOInterface $io, ProcessExecutor $process = null)
{
$this->url = $url;
$this->io = $io;
$this->process = $process ?: new ProcessExecutor;
}
public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
{
$svnCommand = $this->getCommand($command, $url, $path);
$output = null;
$io = $this->io;
$handler = function ($type, $buffer) use (&$output, $io, $verbose) {
if ($type !== 'out') {
return;
}
$output .= $buffer;
if ($verbose) {
$io->write($buffer, false);
}
};
$status = $this->process->execute($svnCommand, $handler, $cwd);
if (0 === $status) {
return $output;
}
if (empty($output)) {
$output = $this->process->getErrorOutput();
}
if (false === stripos($output, 'Could not authenticate to server:')) {
throw new \RuntimeException($output);
}
if (!$this->io->isInteractive()) {
throw new \RuntimeException(
'can not ask for authentication in non interactive mode ('.$output.')'
);
}
if (!$this->hasAuth()) {
$this->doAuthDance();
return $this->execute($command, $url, $cwd, $path, $verbose);
}
throw new \RuntimeException(
'wrong credentials provided ('.$output.')'
);
}
protected function doAuthDance()
{
$this->io->write("The Subversion server ({$this->url}) requested credentials:");
$this->hasAuth = true;
$this->credentials['username'] = $this->io->ask("Username: ");
$this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
$this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
return $this;
}
protected function getCommand($cmd, $url, $path = null)
{
$cmd = sprintf('%s %s%s %s',
$cmd,
'--non-interactive ',
$this->getCredentialString(),
escapeshellarg($url)
);
if ($path) {
$cmd .= ' ' . escapeshellarg($path);
}
return $cmd;
}
protected function getCredentialString()
{
if (!$this->hasAuth()) {
return '';
}
return sprintf(
' %s--username %s --password %s ',
$this->getAuthCache(),
escapeshellarg($this->getUsername()),
escapeshellarg($this->getPassword())
);
}
protected function getPassword()
{
if ($this->credentials === null) {
throw new \LogicException("No svn auth detected.");
}
return isset($this->credentials['password']) ? $this->credentials['password'] : '';
}
protected function getUsername()
{
if ($this->credentials === null) {
throw new \LogicException("No svn auth detected.");
}
return $this->credentials['username'];
}
protected function hasAuth()
{
if (null !== $this->hasAuth) {
return $this->hasAuth;
}
$uri = parse_url($this->url);
if (empty($uri['user'])) {
return $this->hasAuth = false;
}
$this->credentials['username'] = $uri['user'];
if (!empty($uri['pass'])) {
$this->credentials['password'] = $uri['pass'];
}
return $this->hasAuth = true;
}
protected function getAuthCache()
{
return $this->cacheCredentials ? '' : '--no-auth-cache ';
}
}
<?php
namespace Composer;
use Composer\Package\RootPackageInterface;
use Composer\Package\Locker;
use Composer\Repository\RepositoryManager;
use Composer\Installer\InstallationManager;
use Composer\Downloader\DownloadManager;
use Composer\Script\EventDispatcher;
use Composer\Autoload\AutoloadGenerator;
class Composer
{
const VERSION = '83ea90296e001c3df6f1eb9933db65c1d45a1b37';
private $package;
private $locker;
private $repositoryManager;
private $downloadManager;
private $installationManager;
private $config;
private $eventDispatcher;
private $autoloadGenerator;
public function setPackage(RootPackageInterface $package)
{
$this->package = $package;
}
public function getPackage()
{
return $this->package;
}
public function setConfig(Config $config)
{
$this->config = $config;
}
public function getConfig()
{
return $this->config;
}
public function setLocker(Locker $locker)
{
$this->locker = $locker;
}
public function getLocker()
{
return $this->locker;
}
public function setRepositoryManager(RepositoryManager $manager)
{
$this->repositoryManager = $manager;
}
public function getRepositoryManager()
{
return $this->repositoryManager;
}
public function setDownloadManager(DownloadManager $manager)
{
$this->downloadManager = $manager;
}
public function getDownloadManager()
{
return $this->downloadManager;
}
public function setInstallationManager(InstallationManager $manager)
{
$this->installationManager = $manager;
}
public function getInstallationManager()
{
return $this->installationManager;
}
public function setEventDispatcher(EventDispatcher $eventDispatcher)
{
$this->eventDispatcher = $eventDispatcher;
}
public function getEventDispatcher()
{
return $this->eventDispatcher;
}
public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
{
$this->autoloadGenerator = $autoloadGenerator;
}
public function getAutoloadGenerator()
{
return $this->autoloadGenerator;
}
}
<?php
namespace Composer\Json;
class JsonManipulator
{
private static $RECURSE_BLOCKS = '(?:[^{}]*|\{(?:[^{}]*|\{(?:[^{}]*|\{(?:[^{}]*|\{[^{}]*\})*\})*\})*\})*';
private $contents;
private $newline;
private $indent;
public function __construct($contents)
{
$contents = trim($contents);
if (!preg_match('#^\{(.*)\}$#s', $contents)) {
throw new \InvalidArgumentException('The json file must be an object ({})');
}
$this->newline = false !== strpos($contents, "\r\n") ? "\r\n": "\n";
$this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
$this->detectIndenting();
}
public function getContents()
{
return $this->contents . $this->newline;
}
public function addLink($type, $package, $constraint)
{
if (!preg_match('#"'.$type.'":\s*\{#', $this->contents)) {
$this->addMainKey($type, $this->format(array($package => $constraint)));
return true;
}
$linksRegex = '#("'.$type.'":\s*\{)([^}]+)(\})#s';
if (!preg_match($linksRegex, $this->contents, $match)) {
return false;
}
$links = $match[2];
$packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
if (preg_match('{"'.$packageRegex.'"\s*:}i', $links)) {
$links = preg_replace('{"'.$packageRegex.'"(\s*:\s*)"[^"]+"}i', addcslashes(JsonFile::encode($package).'${1}"'.$constraint.'"', '\\'), $links);
} elseif (preg_match('#[^\s](\s*)$#', $links, $match)) {
$links = preg_replace(
'#'.$match[1].'$#',
addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\'),
$links
);
} else {
$links = $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $links;
}
$this->contents = preg_replace($linksRegex, addcslashes('${1}'.$links.'$3', '\\'), $this->contents);
return true;
}
public function addRepository($name, $config)
{
return $this->addSubNode('repositories', $name, $config);
}
public function removeRepository($name)
{
return $this->removeSubNode('repositories', $name);
}
public function addConfigSetting($name, $value)
{
return $this->addSubNode('config', $name, $value);
}
public function removeConfigSetting($name)
{
return $this->removeSubNode('config', $name);
}
public function addSubNode($mainNode, $name, $value)
{
if (!preg_match('#"'.$mainNode.'":\s*\{#', $this->contents)) {
$this->addMainKey(''.$mainNode.'', $this->format(array($name => $value)));
return true;
}
$subName = null;
if (false !== strpos($name, '.')) {
list($name, $subName) = explode('.', $name, 2);
}
$nodeRegex = '#("'.$mainNode.'":\s*\{)('.self::$RECURSE_BLOCKS.')(\})#s';
if (!preg_match($nodeRegex, $this->contents, $match)) {
return false;
}
$children = $match[2];
if (!json_decode('{'.$children.'}')) {
return false;
}
$that = $this;
if (preg_match('{("'.preg_quote($name).'"\s*:\s*)([0-9.]+|null|true|false|"[^"]+"|\[[^\]]*\]|\{'.self::$RECURSE_BLOCKS.'\})(,?)}', $children, $matches)) {
$children = preg_replace_callback('{("'.preg_quote($name).'"\s*:\s*)([0-9.]+|null|true|false|"[^"]+"|\[[^\]]*\]|\{'.self::$RECURSE_BLOCKS.'\})(,?)}', function ($matches) use ($name, $subName, $value, $that) {
if ($subName !== null) {
$curVal = json_decode($matches[2], true);
$curVal[$subName] = $value;
$value = $curVal;
}
return $matches[1] . $that->format($value, 1) . $matches[3];
}, $children);
} elseif (preg_match('#[^\s](\s*)$#', $children, $match)) {
if ($subName !== null) {
$value = array($subName => $value);
}
$children = preg_replace(
'#'.$match[1].'$#',
addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $match[1], '\\'),
$children
);
} else {
if ($subName !== null) {
$value = array($subName => $value);
}
$children = $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $children;
}
$this->contents = preg_replace($nodeRegex, addcslashes('${1}'.$children.'$3', '\\'), $this->contents);
return true;
}
public function removeSubNode($mainNode, $name)
{
if (!preg_match('#"'.$mainNode.'":\s*\{#', $this->contents)) {
return true;
}
if (preg_match('#"'.$mainNode.'":\s*\{\s*\}#s', $this->contents)) {
return true;
}
$nodeRegex = '#("'.$mainNode.'":\s*\{)('.self::$RECURSE_BLOCKS.')(\})#s';
if (!preg_match($nodeRegex, $this->contents, $match)) {
return false;
}
$children = $match[2];
if (!json_decode('{'.$children.'}')) {
return false;
}
$subName = null;
if (false !== strpos($name, '.')) {
list($name, $subName) = explode('.', $name, 2);
}
if (preg_match('{"'.preg_quote($name).'"\s*:}i', $children)) {
if (preg_match_all('{"'.preg_quote($name).'"\s*:\s*(?:[0-9.]+|null|true|false|"[^"]+"|\[[^\]]*\]|\{'.self::$RECURSE_BLOCKS.'\})}', $children, $matches)) {
$bestMatch = '';
foreach ($matches[0] as $match) {
if (strlen($bestMatch) < strlen($match)) {
$bestMatch = $match;
}
}
$childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
if (1 !== $count) {
$childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
if (1 !== $count) {
return false;
}
}
}
}
if (!trim($childrenClean)) {
$this->contents = preg_replace($nodeRegex, '$1'.$this->newline.$this->indent.'}', $this->contents);
if ($subName !== null) {
$curVal = json_decode('{'.$children.'}', true);
unset($curVal[$name][$subName]);
$this->addSubNode($mainNode, $name, $curVal[$name]);
}
return true;
}
$that = $this;
$this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
if ($subName !== null) {
$curVal = json_decode('{'.$matches[2].'}', true);
unset($curVal[$name][$subName]);
$childrenClean = substr($that->format($curVal, 0), 1, -1);
}
return $matches[1] . $childrenClean . $matches[3];
}, $this->contents);
return true;
}
public function addMainKey($key, $content)
{
if (preg_match('#[^{\s](\s*)\}$#', $this->contents, $match)) {
$this->contents = preg_replace(
'#'.$match[1].'\}$#',
addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\'),
$this->contents
);
} else {
$this->contents = preg_replace(
'#\}$#',
addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\'),
$this->contents
);
}
}
public function format($data, $depth = 0)
{
if (is_array($data)) {
reset($data);
if (is_numeric(key($data))) {
foreach ($data as $key => $val) {
$data[$key] = $this->format($val, $depth + 1);
}
return '['.implode(', ', $data).']';
}
$out = '{' . $this->newline;
foreach ($data as $key => $val) {
$elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
}
return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
}
return JsonFile::encode($data);
}
protected function detectIndenting()
{
if (preg_match('{^(\s+)"}', $this->contents, $match)) {
$this->indent = $match[1];
} else {
$this->indent = ' ';
}
}
}
<?php
namespace Composer\Json;
use Composer\Composer;
use JsonSchema\Validator;
use Seld\JsonLint\JsonParser;
use Seld\JsonLint\ParsingException;
use Composer\Util\RemoteFilesystem;
use Composer\Downloader\TransportException;
class JsonFile
{
const LAX_SCHEMA = 1;
const STRICT_SCHEMA = 2;
const JSON_UNESCAPED_SLASHES = 64;
const JSON_PRETTY_PRINT = 128;
const JSON_UNESCAPED_UNICODE = 256;
private $path;
private $rfs;
public function __construct($path, RemoteFilesystem $rfs = null)
{
$this->path = $path;
if (null === $rfs && preg_match('{^https?://}i', $path)) {
throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
}
$this->rfs = $rfs;
}
public function getPath()
{
return $this->path;
}
public function exists()
{
return is_file($this->path);
}
public function read()
{
try {
if ($this->rfs) {
$json = $this->rfs->getContents($this->path, $this->path, false);
} else {
$json = file_get_contents($this->path);
}
} catch (TransportException $e) {
throw new \RuntimeException($e->getMessage(), 0, $e);
} catch (\Exception $e) {
throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
}
return static::parseJson($json, $this->path);
}
public function write(array $hash, $options = 448)
{
$dir = dirname($this->path);
if (!is_dir($dir)) {
if (file_exists($dir)) {
throw new \UnexpectedValueException(
$dir.' exists and is not a directory.'
);
}
if (!@mkdir($dir, 0777, true)) {
throw new \UnexpectedValueException(
$dir.' does not exist and could not be created.'
);
}
}
file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
}
public function validateSchema($schema = self::STRICT_SCHEMA)
{
$content = file_get_contents($this->path);
$data = json_decode($content);
if (null === $data && 'null' !== $content) {
self::validateSyntax($content, $this->path);
}
$schemaFile = __DIR__ . '/../../../res/composer-schema.json';
$schemaData = json_decode(file_get_contents($schemaFile));
if ($schema === self::LAX_SCHEMA) {
$schemaData->additionalProperties = true;
$schemaData->properties->name->required = false;
$schemaData->properties->description->required = false;
}
$validator = new Validator();
$validator->check($data, $schemaData);
if (!$validator->isValid()) {
$errors = array();
foreach ((array) $validator->getErrors() as $error) {
$errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
}
throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
}
return true;
}
public static function encode($data, $options = 448)
{
if (version_compare(PHP_VERSION, '5.4', '>=')) {
return json_encode($data, $options);
}
$json = json_encode($data);
$prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
$unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
$unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
return $json;
}
$result = '';
$pos = 0;
$strLen = strlen($json);
$indentStr = ' ';
$newLine = "\n";
$outOfQuotes = true;
$buffer = '';
$noescape = true;
for ($i = 0; $i < $strLen; $i++) {
$char = substr($json, $i, 1);
if ('"' === $char && $noescape) {
$outOfQuotes = !$outOfQuotes;
}
if (!$outOfQuotes) {
$buffer .= $char;
$noescape = '\\' === $char ? !$noescape : true;
continue;
} elseif ('' !== $buffer) {
if ($unescapeSlashes) {
$buffer = str_replace('\\/', '/', $buffer);
}
if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
$buffer = preg_replace_callback('/\\\\u([0-9a-f]{4})/i', function($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}, $buffer);
}
$result .= $buffer.$char;
$buffer = '';
continue;
}
if (':' === $char) {
$char .= ' ';
} elseif (('}' === $char || ']' === $char)) {
$pos--;
$prevChar = substr($json, $i - 1, 1);
if ('{' !== $prevChar && '[' !== $prevChar) {
$result .= $newLine;
for ($j = 0; $j < $pos; $j++) {
$result .= $indentStr;
}
} else {
$result = rtrim($result)."\n\n".$indentStr;
}
}
$result .= $char;
if (',' === $char || '{' === $char || '[' === $char) {
$result .= $newLine;
if ('{' === $char || '[' === $char) {
$pos++;
}
for ($j = 0; $j < $pos; $j++) {
$result .= $indentStr;
}
}
}
return $result;
}
public static function parseJson($json, $file = null)
{
$data = json_decode($json, true);
if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
self::validateSyntax($json, $file);
}
return $data;
}
protected static function validateSyntax($json, $file = null)
{
$parser = new JsonParser();
$result = $parser->lint($json);
if (null === $result) {
if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
}
return true;
}
throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
}
}
<?php
namespace Composer\Json;
use Exception;
class JsonValidationException extends Exception
{
protected $errors;
public function __construct($message, $errors = array())
{
$this->errors = $errors;
parent::__construct($message);
}
public function getErrors()
{
return $this->errors;
}
}
<?php
namespace Composer;
use Composer\Config\ConfigSourceInterface;
class Config
{
public static $defaultConfig = array(
'process-timeout' => 300,
'use-include-path' => false,
'preferred-install' => 'auto',
'notify-on-install' => true,
'github-protocols' => array('git', 'https', 'http'),
'vendor-dir' => 'vendor',
'bin-dir' => '{$vendor-dir}/bin',
'cache-dir' => '{$home}/cache',
'cache-files-dir' => '{$cache-dir}/files',
'cache-repo-dir' => '{$cache-dir}/repo',
'cache-vcs-dir' => '{$cache-dir}/vcs',
'cache-ttl' => 15552000,
'cache-files-ttl' => null,
'cache-files-maxsize' => '300MiB',
'discard-changes' => false,
);
public static $defaultRepositories = array(
'packagist' => array(
'type' => 'composer',
'url' => 'https?://packagist.org',
'allow_ssl_downgrade' => true,
)
);
private $config;
private $repositories;
private $configSource;
public function __construct()
{
$this->config = static::$defaultConfig;
$this->repositories = static::$defaultRepositories;
}
public function setConfigSource(ConfigSourceInterface $source)
{
$this->configSource = $source;
}
public function getConfigSource()
{
return $this->configSource;
}
public function merge(array $config)
{
if (!empty($config['config']) && is_array($config['config'])) {
foreach ($config['config'] as $key => $val) {
if (in_array($key, array('github-oauth')) && isset($this->config[$key])) {
$this->config[$key] = array_merge($this->config[$key], $val);
} else {
$this->config[$key] = $val;
}
}
}
if (!empty($config['repositories']) && is_array($config['repositories'])) {
$this->repositories = array_reverse($this->repositories, true);
$newRepos = array_reverse($config['repositories'], true);
foreach ($newRepos as $name => $repository) {
if (false === $repository) {
unset($this->repositories[$name]);
continue;
}
if (1 === count($repository) && false === current($repository)) {
unset($this->repositories[key($repository)]);
continue;
}
if (is_int($name)) {
$this->repositories[] = $repository;
} else {
$this->repositories[$name] = $repository;
}
}
$this->repositories = array_reverse($this->repositories, true);
}
}
public function getRepositories()
{
return $this->repositories;
}
public function get($key)
{
switch ($key) {
case 'vendor-dir':
case 'bin-dir':
case 'process-timeout':
case 'cache-dir':
case 'cache-files-dir':
case 'cache-repo-dir':
case 'cache-vcs-dir':
$env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
return rtrim($this->process(getenv($env) ?: $this->config[$key]), '/\\');
case 'cache-ttl':
return (int) $this->config[$key];
case 'cache-files-maxsize':
if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
throw new \RuntimeException(
"Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
);
}
$size = $matches[1];
if (isset($matches[2])) {
switch (strtolower($matches[2])) {
case 'g':
$size *= 1024;
case 'm':
$size *= 1024;
case 'k':
$size *= 1024;
break;
}
}
return $size;
case 'cache-files-ttl':
if (isset($this->config[$key])) {
return (int) $this->config[$key];
}
return (int) $this->config['cache-ttl'];
case 'home':
return rtrim($this->process($this->config[$key]), '/\\');
case 'discard-changes':
if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
throw new \RuntimeException(
"Invalid value for 'discard-changes': {$this->config[$key]}"
);
}
return $this->config[$key];
default:
if (!isset($this->config[$key])) {
return null;
}
return $this->process($this->config[$key]);
}
}
public function all()
{
$all = array(
'repositories' => $this->getRepositories(),
);
foreach (array_keys($this->config) as $key) {
$all['config'][$key] = $this->get($key);
}
return $all;
}
public function raw()
{
return array(
'repositories' => $this->getRepositories(),
'config' => $this->config,
);
}
public function has($key)
{
return array_key_exists($key, $this->config);
}
private function process($value)
{
$config = $this;
if (!is_string($value)) {
return $value;
}
return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config) {
return $config->get($match[1]);
}, $value);
}
}
<?php
namespace Composer\Script;
use Composer\Composer;
use Composer\IO\IOInterface;
class Event
{
private $name;
private $composer;
private $io;
private $devMode;
public function __construct($name, Composer $composer, IOInterface $io, $devMode = false)
{
$this->name = $name;
$this->composer = $composer;
$this->io = $io;
$this->devMode = $devMode;
}
public function getName()
{
return $this->name;
}
public function getComposer()
{
return $this->composer;
}
public function getIO()
{
return $this->io;
}
public function isDevMode()
{
return $this->devMode;
}
}
<?php
namespace Composer\Script;
class ScriptEvents
{
const PRE_INSTALL_CMD = 'pre-install-cmd';
const POST_INSTALL_CMD = 'post-install-cmd';
const PRE_UPDATE_CMD = 'pre-update-cmd';
const POST_UPDATE_CMD = 'post-update-cmd';
const PRE_PACKAGE_INSTALL = 'pre-package-install';
const POST_PACKAGE_INSTALL = 'post-package-install';
const PRE_PACKAGE_UPDATE = 'pre-package-update';
const POST_PACKAGE_UPDATE = 'post-package-update';
const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
}
<?php
namespace Composer\Script;
use Composer\Composer;
class CommandEvent extends Event
{
}
<?php
namespace Composer\Script;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\DependencyResolver\Operation\OperationInterface;
class PackageEvent extends Event
{
private $operation;
public function __construct($name, Composer $composer, IOInterface $io, $devMode, OperationInterface $operation)
{
parent::__construct($name, $composer, $io, $devMode);
$this->operation = $operation;
}
public function getOperation()
{
return $this->operation;
}
}
<?php
namespace Composer\Script;
use Composer\Autoload\AutoloadGenerator;
use Composer\IO\IOInterface;
use Composer\Composer;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Util\ProcessExecutor;
class EventDispatcher
{
protected $composer;
protected $io;
protected $loader;
protected $process;
public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
{
$this->composer = $composer;
$this->io = $io;
$this->process = $process ?: new ProcessExecutor();
}
public function dispatch($eventName, Event $event = null)
{
if (null == $event) {
$event = new Event($eventName, $this->composer, $this->io);
}
$this->doDispatch($event);
}
public function dispatchPackageEvent($eventName, $devMode, OperationInterface $operation)
{
$this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $operation));
}
public function dispatchCommandEvent($eventName, $devMode)
{
$this->doDispatch(new CommandEvent($eventName, $this->composer, $this->io, $devMode));
}
protected function doDispatch(Event $event)
{
$listeners = $this->getListeners($event);
foreach ($listeners as $callable) {
if ($this->isPhpScript($callable)) {
$className = substr($callable, 0, strpos($callable, '::'));
$methodName = substr($callable, strpos($callable, '::') + 2);
if (!class_exists($className)) {
$this->io->write('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>');
continue;
}
if (!is_callable($callable)) {
$this->io->write('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>');
continue;
}
try {
$this->executeEventPhpScript($className, $methodName, $event);
} catch (\Exception $e) {
$message = "Script %s handling the %s event terminated with an exception";
$this->io->write('<error>'.sprintf($message, $callable, $event->getName()).'</error>');
throw $e;
}
} else {
if (0 !== $this->process->execute($callable)) {
$event->getIO()->write(sprintf('<error>Script %s handling the %s event returned with an error: %s</error>', $callable, $event->getName(), $this->process->getErrorOutput()));
}
}
}
}
protected function executeEventPhpScript($className, $methodName, Event $event)
{
$className::$methodName($event);
}
protected function getListeners(Event $event)
{
$package = $this->composer->getPackage();
$scripts = $package->getScripts();
if (empty($scripts[$event->getName()])) {
return array();
}
if ($this->loader) {
$this->loader->unregister();
}
$generator = $this->composer->getAutoloadGenerator();
$packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages();
$packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
$map = $generator->parseAutoloads($packageMap, $package);
$this->loader = $generator->createLoader($map);
$this->loader->register();
return $scripts[$event->getName()];
}
protected function isPhpScript($callable)
{
return false === strpos($callable, ' ') && false !== strpos($callable, '::');
}
}
<?php
namespace Composer\Installer;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;
class NoopInstaller implements InstallerInterface
{
public function supports($packageType)
{
return true;
}
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
return $repo->hasPackage($package);
}
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
$repo->addPackage(clone $package);
}
}
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
if (!$repo->hasPackage($initial)) {
throw new \InvalidArgumentException('Package is not installed: '.$initial);
}
$repo->removePackage($initial);
if (!$repo->hasPackage($target)) {
$repo->addPackage(clone $target);
}
}
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
return;
throw new \InvalidArgumentException('Package is not installed: '.$package);
}
$repo->removePackage($package);
}
public function getInstallPath(PackageInterface $package)
{
$targetDir = $package->getTargetDir();
return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
}
}
<?php
namespace Composer\Installer;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;
class MetapackageInstaller implements InstallerInterface
{
public function supports($packageType)
{
return $packageType === 'metapackage';
}
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
return $repo->hasPackage($package);
}
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
$repo->addPackage(clone $package);
}
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
if (!$repo->hasPackage($initial)) {
throw new \InvalidArgumentException('Package is not installed: '.$initial);
}
$repo->removePackage($initial);
$repo->addPackage(clone $target);
}
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
return;
throw new \InvalidArgumentException('Package is not installed: '.$package);
}
$repo->removePackage($package);
}
public function getInstallPath(PackageInterface $package)
{
return '';
}
}
<?php
namespace Composer\Installer;
use Composer\IO\IOInterface;
use Composer\Composer;
use Composer\Downloader\PearPackageExtractor;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;
class PearInstaller extends LibraryInstaller
{
public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
{
parent::__construct($io, $composer, $type);
}
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
$this->uninstall($repo, $initial);
$this->install($repo, $target);
}
protected function installCode(PackageInterface $package)
{
parent::installCode($package);
parent::initializeBinDir();
$isWindows = defined('PHP_WINDOWS_VERSION_BUILD');
$php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
if (!$isWindows) {
$php_bin = '/usr/bin/env ' . $php_bin;
}
$installPath = $this->getInstallPath($package);
$vars = array(
'os' => $isWindows ? 'windows' : 'linux',
'php_bin' => $php_bin,
'pear_php' => $installPath,
'php_dir' => $installPath,
'bin_dir' => $installPath . '/bin',
'data_dir' => $installPath . '/data',
'version' => $package->getPrettyVersion(),
);
$packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
$pearExtractor = new PearPackageExtractor($packageArchive);
$pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
if ($this->io->isVerbose()) {
$this->io->write(' Cleaning up');
}
unlink($packageArchive);
}
protected function getBinaries(PackageInterface $package)
{
$binariesPath = $this->getInstallPath($package) . '/bin/';
$binaries = array();
if (file_exists($binariesPath)) {
foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
if (!$value->isDir()) {
$binaries[] = 'bin/'.$fileName;
}
}
}
return $binaries;
}
protected function initializeBinDir()
{
parent::initializeBinDir();
file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
chmod($this->binDir.'/composer-php', 0777);
file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
chmod($this->binDir.'/composer-php.bat', 0777);
}
protected function generateWindowsProxyCode($bin, $link)
{
$binPath = $this->filesystem->findShortestPath($link, $bin);
if ('.bat' === substr($bin, -4)) {
$caller = 'call';
} else {
$handle = fopen($bin, 'r');
$line = fgets($handle);
fclose($handle);
if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
$caller = trim($match[1]);
} else {
$caller = 'php';
}
if ($caller === 'php') {
return "@echo off\r\n".
"pushd .\r\n".
"cd %~dp0\r\n".
"set PHP_PROXY=%CD%\\composer-php.bat\r\n".
"cd ".escapeshellarg(dirname($binPath))."\r\n".
"set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
"popd\r\n".
"%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
}
}
return "@echo off\r\n".
"pushd .\r\n".
"cd %~dp0\r\n".
"cd ".escapeshellarg(dirname($binPath))."\r\n".
"set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
"popd\r\n".
$caller." \"%BIN_TARGET%\" %*\r\n";
}
private function generateWindowsPhpProxyCode()
{
$binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
return
"@echo off\r\n" .
"setlocal enabledelayedexpansion\r\n" .
"set BIN_DIR=%~dp0\r\n" .
"set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
"set DIRS=.\r\n" .
"FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
" FOR /D %%P IN (%%V\\*) DO (\r\n" .
" set DIRS=!DIRS!;%%~fP\r\n" .
" )\r\n" .
")\r\n" .
"php.exe -d include_path=!DIRS! %*\r\n";
}
private function generateUnixyPhpProxyCode()
{
$binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
return
"#!/usr/bin/env sh\n".
"SRC_DIR=`pwd`\n".
"BIN_DIR=`dirname $0`\n".
"VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
"DIRS=\"\"\n".
"for vendor in \$VENDOR_DIR/*; do\n".
" if [ -d \"\$vendor\" ]; then\n".
" for package in \$vendor/*; do\n".
" if [ -d \"\$package\" ]; then\n".
" DIRS=\"\${DIRS}:\${package}\"\n".
" fi\n".
" done\n".
" fi\n".
"done\n".
"php -d include_path=\".\$DIRS\" $@\n";
}
}
<?php
namespace Composer\Installer;
use Composer\Package\PackageInterface;
use Composer\Downloader\DownloadManager;
use Composer\Repository\InstalledRepositoryInterface;
class ProjectInstaller implements InstallerInterface
{
private $installPath;
private $downloadManager;
public function __construct($installPath, DownloadManager $dm)
{
$this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
$this->downloadManager = $dm;
}
public function supports($packageType)
{
return true;
}
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
return false;
}
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
$installPath = $this->installPath;
if (file_exists($installPath) && (count(glob($installPath.'*')) || (count(glob($installPath.'.*')) > 2))) {
throw new \InvalidArgumentException("Project directory $installPath is not empty.");
}
if (!is_dir($installPath)) {
mkdir($installPath, 0777, true);
}
$this->downloadManager->download($package, $installPath);
}
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
throw new \InvalidArgumentException("not supported");
}
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
throw new \InvalidArgumentException("not supported");
}
public function getInstallPath(PackageInterface $package)
{
return $this->installPath;
}
}
<?php
namespace Composer\Installer;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Downloader\DownloadManager;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;
use Composer\Util\Filesystem;
class LibraryInstaller implements InstallerInterface
{
protected $composer;
protected $vendorDir;
protected $binDir;
protected $downloadManager;
protected $io;
protected $type;
protected $filesystem;
public function __construct(IOInterface $io, Composer $composer, $type = 'library')
{
$this->composer = $composer;
$this->downloadManager = $composer->getDownloadManager();
$this->io = $io;
$this->type = $type;
$this->filesystem = new Filesystem();
$this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
$this->binDir = rtrim($composer->getConfig()->get('bin-dir'), '/');
}
public function supports($packageType)
{
return $packageType === $this->type || null === $this->type;
}
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));
}
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
$this->initializeVendorDir();
$downloadPath = $this->getInstallPath($package);
if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
$this->removeBinaries($package);
}
$this->installCode($package);
$this->installBinaries($package);
if (!$repo->hasPackage($package)) {
$repo->addPackage(clone $package);
}
}
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
if (!$repo->hasPackage($initial)) {
throw new \InvalidArgumentException('Package is not installed: '.$initial);
}
$this->initializeVendorDir();
$this->removeBinaries($initial);
$this->updateCode($initial, $target);
$this->installBinaries($target);
$repo->removePackage($initial);
if (!$repo->hasPackage($target)) {
$repo->addPackage(clone $target);
}
}
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if (!$repo->hasPackage($package)) {
return;
throw new \InvalidArgumentException('Package is not installed: '.$package);
}
$this->removeCode($package);
$this->removeBinaries($package);
$repo->removePackage($package);
$downloadPath = $this->getPackageBasePath($package);
if (strpos($package->getName(), '/')) {
$packageVendorDir = dirname($downloadPath);
if (is_dir($packageVendorDir) && !glob($packageVendorDir.'/*')) {
@rmdir($packageVendorDir);
}
}
}
public function getInstallPath(PackageInterface $package)
{
$targetDir = $package->getTargetDir();
return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : '');
}
protected function getPackageBasePath(PackageInterface $package)
{
$this->initializeVendorDir();
return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
}
protected function installCode(PackageInterface $package)
{
$downloadPath = $this->getInstallPath($package);
$this->downloadManager->download($package, $downloadPath);
}
protected function updateCode(PackageInterface $initial, PackageInterface $target)
{
$downloadPath = $this->getInstallPath($initial);
$this->downloadManager->update($initial, $target, $downloadPath);
}
protected function removeCode(PackageInterface $package)
{
$downloadPath = $this->getPackageBasePath($package);
$this->downloadManager->remove($package, $downloadPath);
}
protected function getBinaries(PackageInterface $package)
{
return $package->getBinaries();
}
protected function installBinaries(PackageInterface $package)
{
$binaries = $this->getBinaries($package);
if (!$binaries) {
return;
}
foreach ($binaries as $bin) {
$binPath = $this->getInstallPath($package).'/'.$bin;
if (!file_exists($binPath)) {
$this->io->write(' <warning>Skipped installation of '.$bin.' for package '.$package->getName().': file not found in package</warning>');
continue;
}
$this->initializeBinDir();
$link = $this->binDir.'/'.basename($bin);
if (file_exists($link)) {
if (is_link($link)) {
chmod($link, 0777 & ~umask());
}
$this->io->write(' Skipped installation of '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
continue;
}
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
if ('.bat' !== substr($binPath, -4)) {
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
chmod($link, 0777 & ~umask());
$link .= '.bat';
if (file_exists($link)) {
$this->io->write(' Skipped installation of '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
}
}
if (!file_exists($link)) {
file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
}
} else {
$cwd = getcwd();
try {
$relativeBin = $this->filesystem->findShortestPath($link, $binPath);
chdir(dirname($link));
symlink($relativeBin, $link);
} catch (\ErrorException $e) {
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
}
chdir($cwd);
}
chmod($link, 0777 & ~umask());
}
}
protected function removeBinaries(PackageInterface $package)
{
$binaries = $this->getBinaries($package);
if (!$binaries) {
return;
}
foreach ($binaries as $bin) {
$link = $this->binDir.'/'.basename($bin);
if (is_link($link) || file_exists($link)) {
unlink($link);
}
if (file_exists($link.'.bat')) {
unlink($link.'.bat');
}
}
}
protected function initializeVendorDir()
{
$this->filesystem->ensureDirectoryExists($this->vendorDir);
$this->vendorDir = realpath($this->vendorDir);
}
protected function initializeBinDir()
{
$this->filesystem->ensureDirectoryExists($this->binDir);
$this->binDir = realpath($this->binDir);
}
protected function generateWindowsProxyCode($bin, $link)
{
$binPath = $this->filesystem->findShortestPath($link, $bin);
if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
$caller = 'call';
} else {
$handle = fopen($bin, 'r');
$line = fgets($handle);
fclose($handle);
if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
$caller = trim($match[1]);
} else {
$caller = 'php';
}
}
return "@ECHO OFF\r\n".
"SET BIN_TARGET=%~dp0\\".escapeshellarg(dirname($binPath)).'\\'.basename($binPath)."\r\n".
"{$caller} \"%BIN_TARGET%\" %*\r\n";
}
protected function generateUnixyProxyCode($bin, $link)
{
$binPath = $this->filesystem->findShortestPath($link, $bin);
return "#!/usr/bin/env sh\n".
'SRC_DIR="`pwd`"'."\n".
'cd "`dirname "$0"`"'."\n".
'cd '.escapeshellarg(dirname($binPath))."\n".
'BIN_TARGET="`pwd`/'.basename($binPath)."\"\n".
'cd "$SRC_DIR"'."\n".
'"$BIN_TARGET" "$@"'."\n";
}
}
<?php
namespace Composer\Installer;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
use Composer\Util\StreamContextFactory;
class InstallationManager
{
private $installers = array();
private $cache = array();
private $notifiablePackages = array();
public function reset()
{
$this->notifiablePackages = array();
}
public function addInstaller(InstallerInterface $installer)
{
array_unshift($this->installers, $installer);
$this->cache = array();
}
public function removeInstaller(InstallerInterface $installer)
{
if (false !== ($key = array_search($installer, $this->installers, true))) {
array_splice($this->installers, $key, 1);
$this->cache = array();
}
}
public function disableCustomInstallers()
{
foreach ($this->installers as $i => $installer) {
if (!$installer instanceof InstallerInstaller) {
continue;
}
unset($this->installers[$i]);
}
}
public function getInstaller($type)
{
$type = strtolower($type);
if (isset($this->cache[$type])) {
return $this->cache[$type];
}
foreach ($this->installers as $installer) {
if ($installer->supports($type)) {
return $this->cache[$type] = $installer;
}
}
throw new \InvalidArgumentException('Unknown installer type: '.$type);
}
public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
{
if ($package instanceof AliasPackage) {
return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
}
return $this->getInstaller($package->getType())->isInstalled($repo, $package);
}
public function execute(RepositoryInterface $repo, OperationInterface $operation)
{
$method = $operation->getJobType();
$this->$method($repo, $operation);
}
public function install(RepositoryInterface $repo, InstallOperation $operation)
{
$package = $operation->getPackage();
$installer = $this->getInstaller($package->getType());
$installer->install($repo, $package);
$this->markForNotification($package);
}
public function update(RepositoryInterface $repo, UpdateOperation $operation)
{
$initial = $operation->getInitialPackage();
$target = $operation->getTargetPackage();
$initialType = $initial->getType();
$targetType = $target->getType();
if ($initialType === $targetType) {
$installer = $this->getInstaller($initialType);
$installer->update($repo, $initial, $target);
$this->markForNotification($target);
} else {
$this->getInstaller($initialType)->uninstall($repo, $initial);
$this->getInstaller($targetType)->install($repo, $target);
}
}
public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
{
$package = $operation->getPackage();
$installer = $this->getInstaller($package->getType());
$installer->uninstall($repo, $package);
}
public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
{
$package = $operation->getPackage();
if (!$repo->hasPackage($package)) {
$repo->addPackage(clone $package);
}
}
public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
{
$package = $operation->getPackage();
$repo->removePackage($package);
}
public function getInstallPath(PackageInterface $package)
{
$installer = $this->getInstaller($package->getType());
return $installer->getInstallPath($package);
}
public function notifyInstalls()
{
foreach ($this->notifiablePackages as $repoUrl => $packages) {
if (strpos($repoUrl, '%package%')) {
foreach ($packages as $package) {
$url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
$params = array(
'version' => $package->getPrettyVersion(),
'version_normalized' => $package->getVersion(),
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => array('Content-type: application/x-www-form-urlencoded'),
'content' => http_build_query($params, '', '&'),
'timeout' => 3,
)
);
$context = StreamContextFactory::getContext($opts);
@file_get_contents($url, false, $context);
}
continue;
}
$postData = array('downloads' => array());
foreach ($packages as $package) {
$postData['downloads'][] = array(
'name' => $package->getPrettyName(),
'version' => $package->getVersion(),
);
}
$opts = array('http' =>
array(
'method' => 'POST',
'header' => array('Content-Type: application/json'),
'content' => json_encode($postData),
'timeout' => 6,
)
);
$context = StreamContextFactory::getContext($opts);
@file_get_contents($repoUrl, false, $context);
}
$this->reset();
}
private function markForNotification(PackageInterface $package)
{
if ($package->getNotificationUrl()) {
$this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
}
}
}
<?php
namespace Composer\Installer;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;
interface InstallerInterface
{
public function supports($packageType);
public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
public function getInstallPath(PackageInterface $package);
}
<?php
namespace Composer\Installer;
use Composer\Composer;
use Composer\Package\Package;
use Composer\IO\IOInterface;
use Composer\Autoload\AutoloadGenerator;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Package\PackageInterface;
class InstallerInstaller extends LibraryInstaller
{
private $installationManager;
private static $classCounter = 0;
public function __construct(IOInterface $io, Composer $composer, $type = 'library')
{
parent::__construct($io, $composer, 'composer-installer');
$this->installationManager = $composer->getInstallationManager();
$repo = $composer->getRepositoryManager()->getLocalRepository();
foreach ($repo->getPackages() as $package) {
if ('composer-installer' === $package->getType()) {
$this->registerInstaller($package);
}
}
}
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
$extra = $package->getExtra();
if (empty($extra['class'])) {
throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-installer packages should have a class defined in their extra key to be usable.');
}
parent::install($repo, $package);
$this->registerInstaller($package);
}
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
{
$extra = $target->getExtra();
if (empty($extra['class'])) {
throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-installer packages should have a class defined in their extra key to be usable.');
}
parent::update($repo, $initial, $target);
$this->registerInstaller($target);
}
private function registerInstaller(PackageInterface $package)
{
$downloadPath = $this->getInstallPath($package);
$extra = $package->getExtra();
$classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
$generator = $this->composer->getAutoloadGenerator();
$map = $generator->parseAutoloads(array(array($package, $downloadPath)), new Package('dummy', '1.0.0.0', '1.0.0'));
$classLoader = $generator->createLoader($map);
$classLoader->register();
foreach ($classes as $class) {
if (class_exists($class, false)) {
$code = file_get_contents($classLoader->findFile($class));
$code = preg_replace('{^class\s+(\S+)}mi', 'class $1_composer_tmp'.self::$classCounter, $code);
eval('?>'.$code);
$class .= '_composer_tmp'.self::$classCounter;
self::$classCounter++;
}
$installer = new $class($this->io, $this->composer);
$this->installationManager->addInstaller($installer);
}
}
}
<?php
namespace Composer\Console;
use Symfony\Component\Console\Application as BaseApplication;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Composer\Command;
use Composer\Command\Helper\DialogHelper;
use Composer\Composer;
use Composer\Factory;
use Composer\IO\IOInterface;
use Composer\IO\ConsoleIO;
use Composer\Json\JsonValidationException;
use Composer\Util\ErrorHandler;
class Application extends BaseApplication
{
protected $composer;
protected $io;
private static $logo = ' ______
/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
';
public function __construct()
{
if (function_exists('ini_set')) {
ini_set('xdebug.show_exception_trace', false);
ini_set('xdebug.scream', false);
}
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
date_default_timezone_set(@date_default_timezone_get());
}
ErrorHandler::register();
parent::__construct('Composer', Composer::VERSION);
}
public function run(InputInterface $input = null, OutputInterface $output = null)
{
if (null === $output) {
$styles = Factory::createAdditionalStyles();
$formatter = new OutputFormatter(null, $styles);
$output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
}
return parent::run($input, $output);
}
public function doRun(InputInterface $input, OutputInterface $output)
{
$this->io = new ConsoleIO($input, $output, $this->getHelperSet());
if (version_compare(PHP_VERSION, '5.3.2', '<')) {
$output->writeln('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
}
if (defined('COMPOSER_DEV_WARNING_TIME') && $this->getCommandName($input) !== 'self-update') {
if (time() > COMPOSER_DEV_WARNING_TIME) {
$output->writeln(sprintf('<warning>Warning: This development build of composer is over 30 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
}
}
if (getenv('COMPOSER_NO_INTERACTION')) {
$input->setInteractive(false);
}
if ($input->hasParameterOption('--profile')) {
$startTime = microtime(true);
$this->io->enableDebugging($startTime);
}
if ($newWorkDir = $this->getNewWorkingDir($input)) {
$oldWorkingDir = getcwd();
chdir($newWorkDir);
}
$result = parent::doRun($input, $output);
if (isset($oldWorkingDir)) {
chdir($oldWorkingDir);
}
if (isset($startTime)) {
$output->writeln('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MB), time: '.round(microtime(true) - $startTime, 2).'s');
}
return $result;
}
private function getNewWorkingDir(InputInterface $input)
{
$workingDir = $input->getParameterOption(array('--working-dir', '-d'));
if (false !== $workingDir && !is_dir($workingDir)) {
throw new \RuntimeException('Invalid working directory specified.');
}
return $workingDir;
}
public function getComposer($required = true)
{
if (null === $this->composer) {
try {
$this->composer = Factory::create($this->io);
} catch (\InvalidArgumentException $e) {
if ($required) {
$this->io->write($e->getMessage());
exit(1);
}
} catch (JsonValidationException $e) {
$errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
$message = $e->getMessage() . ':' . PHP_EOL . $errors;
throw new JsonValidationException($message);
}
}
return $this->composer;
}
public function getIO()
{
return $this->io;
}
public function getHelp()
{
return self::$logo . parent::getHelp();
}
protected function getDefaultCommands()
{
$commands = parent::getDefaultCommands();
$commands[] = new Command\AboutCommand();
$commands[] = new Command\ConfigCommand();
$commands[] = new Command\DependsCommand();
$commands[] = new Command\InitCommand();
$commands[] = new Command\InstallCommand();
$commands[] = new Command\CreateProjectCommand();
$commands[] = new Command\UpdateCommand();
$commands[] = new Command\SearchCommand();
$commands[] = new Command\ValidateCommand();
$commands[] = new Command\ShowCommand();
$commands[] = new Command\RequireCommand();
$commands[] = new Command\DumpAutoloadCommand();
$commands[] = new Command\StatusCommand();
$commands[] = new Command\ArchiveCommand();
if ('phar:' === substr(__FILE__, 0, 5)) {
$commands[] = new Command\SelfUpdateCommand();
}
return $commands;
}
protected function getDefaultInputDefinition()
{
$definition = parent::getDefaultInputDefinition();
$definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
$definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
return $definition;
}
protected function getDefaultHelperSet()
{
$helperSet = parent::getDefaultHelperSet();
$helperSet->set(new DialogHelper());
return $helperSet;
}
}
<?php
namespace Composer\Console;
use Symfony\Component\Console\Formatter\OutputFormatter;
class HtmlOutputFormatter extends OutputFormatter
{
private static $availableForegroundColors = array(
30 => 'black',
31 => 'red',
32 => 'green',
33 => 'yellow',
34 => 'blue',
35 => 'magenta',
36 => 'cyan',
37 => 'white'
);
private static $availableBackgroundColors = array(
40 => 'black',
41 => 'red',
42 => 'green',
43 => 'yellow',
44 => 'blue',
45 => 'magenta',
46 => 'cyan',
47 => 'white'
);
private static $availableOptions = array(
1 => 'bold',
4 => 'underscore',
);
public function __construct(array $styles = array())
{
parent::__construct(true, $styles);
}
public function format($message)
{
$formatted = parent::format($message);
return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[0m}s", array($this, 'formatHtml'), $formatted);
}
private function formatHtml($matches)
{
$out = '<span style="';
foreach (explode(';', $matches[1]) as $code) {
if (isset(self::$availableForegroundColors[$code])) {
$out .= 'color:'.self::$availableForegroundColors[$code].';';
} elseif (isset(self::$availableBackgroundColors[$code])) {
$out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
} elseif (isset(self::$availableOptions[$code])) {
switch (self::$availableOptions[$code]) {
case 'bold':
$out .= 'font-weight:bold;';
break;
case 'underscore':
$out .= 'text-decoration:underline;';
break;
}
}
}
return $out . '">'.$matches[2].'</span>';
}
}
<?php
namespace Composer\Autoload;
use Composer\Config;
use Composer\Installer\InstallationManager;
use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
use Composer\Repository\RepositoryInterface;
use Composer\Util\Filesystem;
use Composer\Script\EventDispatcher;
use Composer\Script\ScriptEvents;
class AutoloadGenerator
{
private $eventDispatcher;
public function __construct(EventDispatcher $eventDispatcher)
{
$this->eventDispatcher = $eventDispatcher;
}
public function dump(Config $config, RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
{
$filesystem = new Filesystem();
$filesystem->ensureDirectoryExists($config->get('vendor-dir'));
$vendorPath = strtr(realpath($config->get('vendor-dir')), '\\', '/');
$useGlobalIncludePath = (bool) $config->get('use-include-path');
$targetDir = $vendorPath.'/'.$targetDir;
$filesystem->ensureDirectoryExists($targetDir);
$cwd = getcwd();
$relVendorPath = $filesystem->findShortestPath($cwd, $vendorPath, true);
$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, $cwd, true);
$appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
$namespacesFile = <<<EOF
<?php
// autoload_namespaces.php generated by Composer
\$vendorDir = $vendorPathCode52;
\$baseDir = $appBaseDirCode;
return array(
EOF;
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getPackages());
$autoloads = $this->parseAutoloads($packageMap, $mainPackage);
foreach ($autoloads['psr-0'] as $namespace => $paths) {
$exportedPaths = array();
foreach ($paths as $path) {
$exportedPaths[] = $this->getPathCode($filesystem, $relVendorPath, $vendorPath, $path);
}
$exportedPrefix = var_export($namespace, true);
$namespacesFile .= " $exportedPrefix => ";
if (count($exportedPaths) > 1) {
$namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
} else {
$namespacesFile .= $exportedPaths[0].",\n";
}
}
$namespacesFile .= ");\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('/', trim(strtr($mainPackage->getTargetDir(), '\\', '/'), '/')));
$prefixes = implode(', ', array_map(function ($prefix) {
return var_export($prefix, true);
}, array_keys($mainAutoload['psr-0'])));
$baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $cwd, 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;
}
$classMap = array();
if ($scanPsr0Packages) {
foreach ($autoloads['psr-0'] as $namespace => $paths) {
foreach ($paths as $dir) {
$dir = $this->getPath($filesystem, $relVendorPath, $vendorPath, $dir);
$whitelist = sprintf(
'{%s/%s.+(?<!(?<!/)Test\.php)$}',
preg_quote(rtrim($dir, '/')),
strpos($namespace, '_') === false ? preg_quote(strtr($namespace, '\\', '/')) : ''
);
if (!is_dir($dir)) {
continue;
}
foreach (ClassMapGenerator::createMap($dir, $whitelist) as $class => $path) {
if ('' === $namespace || 0 === strpos($class, $namespace)) {
$path = '/'.$filesystem->findShortestPath($cwd, $path, true);
if (!isset($classMap[$class])) {
$classMap[$class] = '$baseDir . '.var_export($path, true).",\n";
}
}
}
}
}
}
$autoloads['classmap'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['classmap']));
foreach ($autoloads['classmap'] as $dir) {
foreach (ClassMapGenerator::createMap($dir) as $class => $path) {
$path = $filesystem->findShortestPath($cwd, $path, true);
if ($filesystem->isAbsolutePath($path)) {
$classMap[$class] = var_export($path, true).",\n";
} else {
$classMap[$class] = '$baseDir . '.var_export('/'.$path, true).",\n";
}
}
}
ksort($classMap);
foreach ($classMap as $class => $code) {
$classmapFile .= ' '.var_export($class, true).' => '.$code;
}
$classmapFile .= ");\n";
$filesCode = "";
$autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files']));
foreach ($autoloads['files'] as $functionFile) {
$filesCode .= ' require '.$this->getPathCode($filesystem, $relVendorPath, $vendorPath, $functionFile).";\n";
}
if (!$suffix) {
$suffix = md5(uniqid('', true));
}
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
if ($includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $relVendorPath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
file_put_contents($targetDir.'/include_paths.php', $includePathFile);
}
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath));
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
$this->eventDispatcher->dispatch(ScriptEvents::POST_AUTOLOAD_DUMP);
}
public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
{
$packageMap = array(array($mainPackage, ''));
foreach ($packages as $package) {
if ($package instanceof AliasPackage) {
continue;
}
$packageMap[] = array(
$package,
$installationManager->getInstallPath($package)
);
}
return $packageMap;
}
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);
$classmap = $this->parseAutoloadsType($sortedPackageMap, 'classmap', $mainPackage);
$files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
krsort($psr0);
return array('psr-0' => $psr0, 'classmap' => $classmap, 'files' => $files);
}
public function createLoader(array $autoloads)
{
$loader = new ClassLoader();
if (isset($autoloads['psr-0'])) {
foreach ($autoloads['psr-0'] as $namespace => $path) {
$loader->add($namespace, $path);
}
}
return $loader;
}
protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $relVendorPath, $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;
}
$includePathsFile = <<<EOF
<?php
// include_paths.php generated by Composer
\$vendorDir = $vendorPathCode;
\$baseDir = $appBaseDirCode;
return array(
EOF;
foreach ($includePaths as $path) {
$includePathsFile .= " " . $this->getPathCode($filesystem, $relVendorPath, $vendorPath, $path) . ",\n";
}
return $includePathsFile . ");\n";
}
protected function getPathCode(Filesystem $filesystem, $relVendorPath, $vendorPath, $path)
{
$path = strtr($path, '\\', '/');
$baseDir = '';
if (!$filesystem->isAbsolutePath($path)) {
if (strpos($path, $relVendorPath) === 0) {
$path = substr($path, strlen($relVendorPath));
$baseDir = '$vendorDir . ';
} else {
$path = '/'.$path;
$baseDir = '$baseDir . ';
}
} elseif (strpos($path, $vendorPath) === 0) {
$path = substr($path, strlen($vendorPath));
$baseDir = '$vendorDir . ';
}
if (preg_match('/\.phar$/', $path)){
$baseDir = "'phar://' . '" . $baseDir;
}
return $baseDir.var_export($path, true);
}
protected function getPath(Filesystem $filesystem, $relVendorPath, $vendorPath, $path)
{
$path = strtr($path, '\\', '/');
if (!$filesystem->isAbsolutePath($path)) {
if (strpos($path, $relVendorPath) === 0) {
return $vendorPath . substr($path, strlen($relVendorPath));
}
return strtr(getcwd(), '\\', '/').'/'.$path;
}
return $path;
}
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
{
return <<<AUTOLOAD
<?php
// autoload.php generated by Composer
require_once $vendorPathToTargetDirCode . '/autoload_real.php';
return ComposerAutoloaderInit$suffix::getLoader();
AUTOLOAD;
}
protected function getAutoloadRealFile($usePSR0, $useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath)
{
if ($filesCode) {
$filesCode = "\n\n".rtrim($filesCode);
}
$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, true);
self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
\$vendorDir = $vendorPathCode;
\$baseDir = $appBaseDirCode;
HEADER;
if ($useIncludePath) {
$file .= <<<'INCLUDE_PATH'
$includePaths = require __DIR__ . '/include_paths.php';
array_push($includePaths, get_include_path());
set_include_path(join(PATH_SEPARATOR, $includePaths));
INCLUDE_PATH;
}
if ($usePSR0) {
$file .= <<<'PSR0'
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
PSR0;
}
if ($useClassMap) {
$file .= <<<'CLASSMAP'
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
CLASSMAP;
}
if ($useGlobalIncludePath) {
$file .= <<<'INCLUDEPATH'
$loader->setUseIncludePath(true);
INCLUDEPATH;
}
if ($targetDirLoader) {
$file .= <<<REGISTER_AUTOLOAD
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
REGISTER_AUTOLOAD;
}
$file .= <<<METHOD_FOOTER
\$loader->register(true);{$filesCode}
return \$loader;
}
METHOD_FOOTER;
$file .= $targetDirLoader;
return $file . <<<FOOTER
}
FOOTER;
}
protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
{
$autoloads = array();
foreach ($packageMap as $item) {
list($package, $installPath) = $item;
$autoload = $package->getAutoload();
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' && $package === $mainPackage && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
$targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
$path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
}
if ($type === 'files' && $package !== $mainPackage && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
$path = $package->getTargetDir() . '/' . $path;
}
if ($type === 'classmap' && $package === $mainPackage && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
$targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
$path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
}
if ($type === 'classmap' && $package !== $mainPackage && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
$path = $package->getTargetDir() . '/' . $path;
}
$autoloads[$namespace][] = empty($installPath) ? $path : $installPath.'/'.$path;
}
}
}
return $autoloads;
}
protected function sortPackageMap(array $packageMap)
{
$positions = array();
$names = array();
$indexes = array();
foreach ($packageMap as $position => $item) {
$mainName = $item[0]->getName();
$names = array_merge(array_fill_keys($item[0]->getNames(), $mainName), $names);
$names[$mainName] = $mainName;
$indexes[$mainName] = $positions[$mainName] = $position;
}
foreach ($packageMap as $item) {
$position = $positions[$item[0]->getName()];
foreach (array_merge($item[0]->getRequires(), $item[0]->getDevRequires()) as $link) {
$target = $link->getTarget();
if (!isset($names[$target])) {
continue;
}
$target = $names[$target];
if ($positions[$target] <= $position) {
continue;
}
foreach ($positions as $key => $value) {
if ($value >= $position) {
break;
}
$positions[$key]--;
}
$positions[$target] = $position - 1;
}
asort($positions);
}
$sortedPackageMap = array();
foreach (array_keys($positions) as $packageName) {
$sortedPackageMap[] = $packageMap[$indexes[$packageName]];
}
return $sortedPackageMap;
}
}
<?php
namespace Composer\Autoload;
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, $whitelist = null)
{
if (is_string($path)) {
if (is_file($path)) {
$path = array(new \SplFileInfo($path));
} elseif (is_dir($path)) {
$path = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($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();
foreach ($path as $file) {
if (!$file->isFile()) {
continue;
}
$filePath = $file->getRealPath();
if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc'))) {
continue;
}
if ($whitelist && !preg_match($whitelist, strtr($filePath, '\\', '/'))) {
continue;
}
$classes = self::findClasses($filePath);
foreach ($classes as $class) {
$map[$class] = $filePath;
}
}
return $map;
}
private static function findClasses($path)
{
$traits = version_compare(PHP_VERSION, '5.4', '<') ? '' : '|trait';
try {
$contents = php_strip_whitespace($path);
} catch (\Exception $e) {
throw new \RuntimeException('Could not scan for classes inside '.$path.": \n".$e->getMessage(), 0, $e);
}
if (!preg_match('{\b(?:class|interface'.$traits.')\b}i', $contents)) {
return array();
}
$contents = preg_replace('{<<<\'?(\w+)\'?(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)\\1(?=\r\n|\n|\r|;)}s', 'null', $contents);
$contents = preg_replace('{"[^"\\\\]*(\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(\\\\.[^\'\\\\]*)*\'}', 'null', $contents);
if (substr($contents, 0, 2) !== '<?') {
$contents = preg_replace('{^.+?<\?}s', '<?', $contents);
}
$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'.$traits.') \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 {
$classes[] = ltrim($namespace . $matches['name'][$i], '\\');
}
}
return $classes;
}
}
<?php
namespace Composer;
use Composer\Autoload\AutoloadGenerator;
use Composer\DependencyResolver\DefaultPolicy;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Solver;
use Composer\DependencyResolver\SolverProblemsException;
use Composer\Downloader\DownloadManager;
use Composer\Installer\InstallationManager;
use Composer\Config;
use Composer\Installer\NoopInstaller;
use Composer\IO\IOInterface;
use Composer\Json\JsonFile;
use Composer\Package\AliasPackage;
use Composer\Package\Link;
use Composer\Package\LinkConstraint\VersionConstraint;
use Composer\Package\Locker;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface;
use Composer\Repository\CompositeRepository;
use Composer\Repository\InstalledArrayRepository;
use Composer\Repository\InstalledFilesystemRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\RepositoryManager;
use Composer\Script\EventDispatcher;
use Composer\Script\ScriptEvents;
class Installer
{
protected $io;
protected $config;
protected $package;
protected $downloadManager;
protected $repositoryManager;
protected $locker;
protected $installationManager;
protected $eventDispatcher;
protected $autoloadGenerator;
protected $preferSource = false;
protected $preferDist = false;
protected $optimizeAutoloader = false;
protected $devMode = false;
protected $dryRun = false;
protected $verbose = false;
protected $update = false;
protected $runScripts = true;
protected $updateWhitelist = null;
protected $suggestedPackages;
protected $additionalInstalledRepository;
public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
{
$this->io = $io;
$this->config = $config;
$this->package = $package;
$this->downloadManager = $downloadManager;
$this->repositoryManager = $repositoryManager;
$this->locker = $locker;
$this->installationManager = $installationManager;
$this->eventDispatcher = $eventDispatcher;
$this->autoloadGenerator = $autoloadGenerator;
}
public function run()
{
if ($this->dryRun) {
$this->verbose = true;
$this->runScripts = false;
$this->installationManager->addInstaller(new NoopInstaller);
$this->mockLocalRepositories($this->repositoryManager);
}
$devRepo = new InstalledFilesystemRepository(new JsonFile($this->config->get('vendor-dir').'/composer/installed_dev.json'));
if ($devRepo->getPackages()) {
$this->io->write('<warning>BC Notice: Removing old dev packages to migrate to the new require-dev handling.</warning>');
foreach ($devRepo->getPackages() as $package) {
if ($this->installationManager->isPackageInstalled($devRepo, $package)) {
$this->installationManager->uninstall($devRepo, new UninstallOperation($package));
}
}
unlink($this->config->get('vendor-dir').'/composer/installed_dev.json');
}
unset($devRepo, $package);
if ($this->preferSource) {
$this->downloadManager->setPreferSource(true);
}
if ($this->preferDist) {
$this->downloadManager->setPreferDist(true);
}
$installedRootPackage = clone $this->package;
$installedRootPackage->setRequires(array());
$installedRootPackage->setDevRequires(array());
$localRepo = $this->repositoryManager->getLocalRepository();
$platformRepo = new PlatformRepository();
$repos = array(
$localRepo,
new InstalledArrayRepository(array($installedRootPackage)),
$platformRepo,
);
$installedRepo = new CompositeRepository($repos);
if ($this->additionalInstalledRepository) {
$installedRepo->addRepository($this->additionalInstalledRepository);
}
$aliases = $this->getRootAliases();
$this->aliasPlatformPackages($platformRepo, $aliases);
if ($this->runScripts) {
$eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
$this->eventDispatcher->dispatchCommandEvent($eventName, $this->devMode);
}
try {
$this->suggestedPackages = array();
if (!$this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $this->devMode)) {
return false;
}
} catch (\Exception $e) {
$this->installationManager->notifyInstalls();
throw $e;
}
$this->installationManager->notifyInstalls();
foreach ($this->suggestedPackages as $suggestion) {
$target = $suggestion['target'];
foreach ($installedRepo->getPackages() as $package) {
if (in_array($target, $package->getNames())) {
continue 2;
}
}
$this->io->write($suggestion['source'].' suggests installing '.$suggestion['target'].' ('.$suggestion['reason'].')');
}
if (!$this->dryRun) {
if ($this->update || !$this->locker->isLocked()) {
$localRepo->reload();
$devPackages = ($this->devMode || !$this->package->getDevRequires()) ? array() : null;
if ($this->devMode && $this->package->getDevRequires()) {
$policy = new DefaultPolicy();
$pool = $this->createPool();
$pool->addRepository($installedRepo, $aliases);
$request = $this->createRequest($pool, $this->package, $platformRepo);
$request->updateAll();
foreach ($this->package->getRequires() as $link) {
$request->install($link->getTarget(), $link->getConstraint());
}
$solver = new Solver($policy, $pool, $installedRepo);
$ops = $solver->solve($request);
foreach ($ops as $op) {
if ($op->getJobType() === 'uninstall') {
$devPackages[] = $op->getPackage();
}
}
}
$platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
$platformDevReqs = $this->devMode ? $this->extractPlatformRequirements($this->package->getDevRequires()) : array();
$updatedLock = $this->locker->setLockData(
array_diff($localRepo->getPackages(), (array) $devPackages),
$devPackages,
$platformReqs,
$platformDevReqs,
$aliases,
$this->package->getMinimumStability(),
$this->package->getStabilityFlags()
);
if ($updatedLock) {
$this->io->write('<info>Writing lock file</info>');
}
}
$this->io->write('<info>Generating autoload files</info>');
$this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
if ($this->runScripts) {
$eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
$this->eventDispatcher->dispatchCommandEvent($eventName, $this->devMode);
}
}
return true;
}
protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $withDevReqs)
{
$lockedRepository = null;
$repositories = null;
$installFromLock = false;
if (!$this->update && $this->locker->isLocked()) {
$installFromLock = true;
$lockedRepository = $this->locker->getLockedRepository($withDevReqs);
}
$this->whitelistUpdateDependencies(
$localRepo,
$withDevReqs,
$this->package->getRequires(),
$this->package->getDevRequires()
);
$this->io->write('<info>Loading composer repositories with package information</info>');
$policy = new DefaultPolicy();
$pool = $this->createPool();
$pool->addRepository($installedRepo, $aliases);
if ($installFromLock) {
$pool->addRepository($lockedRepository, $aliases);
}
if (!$installFromLock) {
$repositories = $this->repositoryManager->getRepositories();
foreach ($repositories as $repository) {
$pool->addRepository($repository, $aliases);
}
}
$request = $this->createRequest($pool, $this->package, $platformRepo);
if (!$installFromLock) {
$removedUnstablePackages = array();
foreach ($localRepo->getPackages() as $package) {
if (
!$pool->isPackageAcceptable($package->getName(), $package->getStability())
&& $this->installationManager->isPackageInstalled($localRepo, $package)
) {
$removedUnstablePackages[$package->getName()] = true;
$request->remove($package->getName(), new VersionConstraint('=', $package->getVersion()));
}
}
}
if ($this->update) {
$this->io->write('<info>Updating dependencies'.($withDevReqs?' (including require-dev)':'').'</info>');
$request->updateAll();
if ($withDevReqs) {
$links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
} else {
$links = $this->package->getRequires();
}
foreach ($links as $link) {
$request->install($link->getTarget(), $link->getConstraint());
}
if ($this->updateWhitelist) {
if ($this->locker->isLocked()) {
try {
$currentPackages = $this->locker->getLockedRepository($withDevReqs)->getPackages();
} catch (\RuntimeException $e) {
$currentPackages = $this->locker->getLockedRepository()->getPackages();
}
} else {
$currentPackages = $installedRepo->getPackages();
}
$candidates = array();
foreach ($links as $link) {
$candidates[$link->getTarget()] = true;
}
foreach ($localRepo->getPackages() as $package) {
$candidates[$package->getName()] = true;
}
foreach ($candidates as $candidate => $dummy) {
foreach ($currentPackages as $curPackage) {
if ($curPackage->getName() === $candidate) {
if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
$constraint = new VersionConstraint('=', $curPackage->getVersion());
$request->install($curPackage->getName(), $constraint);
}
break;
}
}
}
}
} elseif ($installFromLock) {
$this->io->write('<info>Installing dependencies'.($withDevReqs?' (including require-dev)':'').' from lock file</info>');
if (!$this->locker->isFresh()) {
$this->io->write('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.</warning>');
}
foreach ($lockedRepository->getPackages() as $package) {
$version = $package->getVersion();
if (isset($aliases[$package->getName()][$version])) {
$version = $aliases[$package->getName()][$version]['alias_normalized'];
}
$constraint = new VersionConstraint('=', $version);
$constraint->setPrettyString($package->getPrettyVersion());
$request->install($package->getName(), $constraint);
}
foreach ($this->locker->getPlatformRequirements($withDevReqs) as $link) {
$request->install($link->getTarget(), $link->getConstraint());
}
} else {
$this->io->write('<info>Installing dependencies'.($withDevReqs?' (including require-dev)':'').'</info>');
if ($withDevReqs) {
$links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
} else {
$links = $this->package->getRequires();
}
foreach ($links as $link) {
$request->install($link->getTarget(), $link->getConstraint());
}
}
$this->processDevPackages($localRepo, $pool, $policy, $repositories, $lockedRepository, $installFromLock, 'force-links');
$solver = new Solver($policy, $pool, $installedRepo);
try {
$operations = $solver->solve($request);
} catch (SolverProblemsException $e) {
$this->io->write('<error>Your requirements could not be resolved to an installable set of packages.</error>');
$this->io->write($e->getMessage());
return false;
}
$operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $lockedRepository, $installFromLock, 'force-updates', $operations);
if (!$operations) {
$this->io->write('Nothing to install or update');
}
foreach ($operations as $operation) {
if ('install' === $operation->getJobType()) {
foreach ($operation->getPackage()->getSuggests() as $target => $reason) {
$this->suggestedPackages[] = array(
'source' => $operation->getPackage()->getPrettyName(),
'target' => $target,
'reason' => $reason,
);
}
}
$event = 'Composer\Script\ScriptEvents::PRE_PACKAGE_'.strtoupper($operation->getJobType());
if (defined($event) && $this->runScripts) {
$this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $operation);
}
if (!$installFromLock) {
$package = null;
if ('update' === $operation->getJobType()) {
$package = $operation->getTargetPackage();
} elseif ('install' === $operation->getJobType()) {
$package = $operation->getPackage();
}
if ($package && $package->isDev()) {
$references = $this->package->getReferences();
if (isset($references[$package->getName()])) {
$package->setSourceReference($references[$package->getName()]);
$package->setDistReference($references[$package->getName()]);
}
}
}
if ($this->dryRun || ($this->verbose && false !== strpos($operation->getJobType(), 'Alias'))) {
$this->io->write(' - ' . $operation);
}
$this->installationManager->execute($localRepo, $operation);
$event = 'Composer\Script\ScriptEvents::POST_PACKAGE_'.strtoupper($operation->getJobType());
if (defined($event) && $this->runScripts) {
$this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $operation);
}
if (!$this->dryRun) {
$localRepo->write();
}
}
return true;
}
private function createPool()
{
$minimumStability = $this->package->getMinimumStability();
$stabilityFlags = $this->package->getStabilityFlags();
if (!$this->update && $this->locker->isLocked()) {
$minimumStability = $this->locker->getMinimumStability();
$stabilityFlags = $this->locker->getStabilityFlags();
}
return new Pool($minimumStability, $stabilityFlags);
}
private function createRequest(Pool $pool, RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
{
$request = new Request($pool);
$constraint = new VersionConstraint('=', $rootPackage->getVersion());
$constraint->setPrettyString($rootPackage->getPrettyVersion());
$request->install($rootPackage->getName(), $constraint);
foreach ($platformRepo->getPackages() as $package) {
$constraint = new VersionConstraint('=', $package->getVersion());
$constraint->setPrettyString($package->getPrettyVersion());
if (!($provided = $rootPackage->getProvides())
|| !isset($provided[$package->getName()])
|| !$provided[$package->getName()]->getConstraint()->matches($constraint)
) {
$request->install($package->getName(), $constraint);
}
}
return $request;
}
private function processDevPackages($localRepo, $pool, $policy, $repositories, $lockedRepository, $installFromLock, $task, array $operations = null)
{
if ($task === 'force-updates' && null === $operations) {
throw new \InvalidArgumentException('Missing operations argument');
}
if ($task === 'force-links') {
$operations = array();
}
foreach ($localRepo->getPackages() as $package) {
if (!$package->isDev()) {
continue;
}
if ($package instanceof AliasPackage) {
continue;
}
foreach ($operations as $operation) {
if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
|| ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
) {
continue 2;
}
}
if ($installFromLock) {
foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
if ($task === 'force-links') {
$package->setRequires($lockedPackage->getRequires());
$package->setConflicts($lockedPackage->getConflicts());
$package->setProvides($lockedPackage->getProvides());
$package->setReplaces($lockedPackage->getReplaces());
} elseif ($task === 'force-updates') {
if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
|| ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
) {
$operations[] = new UpdateOperation($package, $lockedPackage);
}
}
break;
}
}
} else {
if ($this->update) {
if ($this->updateWhitelist && !$this->isUpdateable($package)) {
continue;
}
$matches = $pool->whatProvides($package->getName(), new VersionConstraint('=', $package->getVersion()));
foreach ($matches as $index => $match) {
if (!in_array($match->getRepository(), $repositories, true)) {
unset($matches[$index]);
continue;
}
if ($match->getName() !== $package->getName()) {
unset($matches[$index]);
continue;
}
$matches[$index] = $match->getId();
}
if ($matches && $matches = $policy->selectPreferedPackages($pool, array(), $matches)) {
$newPackage = $pool->literalToPackage($matches[0]);
if ($task === 'force-links' && $newPackage) {
$package->setRequires($newPackage->getRequires());
$package->setConflicts($newPackage->getConflicts());
$package->setProvides($newPackage->getProvides());
$package->setReplaces($newPackage->getReplaces());
}
if ($task === 'force-updates' && $newPackage && (
(($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
|| ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
)
)) {
$operations[] = new UpdateOperation($package, $newPackage);
}
}
}
if ($task === 'force-updates') {
$references = $this->package->getReferences();
if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
$operations[] = new UpdateOperation($package, clone $package);
}
}
}
}
return $operations;
}
private function getRootAliases()
{
if (!$this->update && $this->locker->isLocked()) {
$aliases = $this->locker->getAliases();
} else {
$aliases = $this->package->getAliases();
}
$normalizedAliases = array();
foreach ($aliases as $alias) {
$normalizedAliases[$alias['package']][$alias['version']] = array(
'alias' => $alias['alias'],
'alias_normalized' => $alias['alias_normalized']
);
}
return $normalizedAliases;
}
private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
{
foreach ($aliases as $package => $versions) {
foreach ($versions as $version => $alias) {
$packages = $platformRepo->findPackages($package, $version);
foreach ($packages as $package) {
$package->setAlias($alias['alias_normalized']);
$package->setPrettyAlias($alias['alias']);
$aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
$aliasPackage->setRootPackageAlias(true);
$platformRepo->addPackage($aliasPackage);
}
}
}
}
private function isUpdateable(PackageInterface $package)
{
if (!$this->updateWhitelist) {
throw new \LogicException('isUpdateable should only be called when a whitelist is present');
}
foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
$cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
if (preg_match("{^".$cleanedWhiteListedPattern."$}i", $package->getName())) {
return true;
}
}
return false;
}
private function extractPlatformRequirements($links) {
$platformReqs = array();
foreach ($links as $link) {
if (preg_match('{^(?:php(?:-64bit)?|(?:ext|lib)-[^/]+)$}i', $link->getTarget())) {
$platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
}
}
return $platformReqs;
}
private function whitelistUpdateDependencies($localRepo, $devMode, array $rootRequires, array $rootDevRequires)
{
if (!$this->updateWhitelist) {
return;
}
$requiredPackageNames = array();
foreach (array_merge($rootRequires, $rootDevRequires) as $require) {
$requiredPackageNames[] = $require->getTarget();
}
if ($devMode) {
$rootRequires = array_merge($rootRequires, $rootDevRequires);
}
$skipPackages = array();
foreach ($rootRequires as $require) {
$skipPackages[$require->getTarget()] = true;
}
$pool = new Pool;
$pool->addRepository($localRepo);
$seen = array();
foreach ($this->updateWhitelist as $packageName => $void) {
$packageQueue = new \SplQueue;
$depPackages = $pool->whatProvides($packageName);
if (count($depPackages) == 0 && !in_array($packageName, $requiredPackageNames) && !in_array($packageName, array('nothing', 'lock'))) {
$this->io->write('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.<warning>');
}
foreach ($depPackages as $depPackage) {
$packageQueue->enqueue($depPackage);
}
while (!$packageQueue->isEmpty()) {
$package = $packageQueue->dequeue();
if (isset($seen[$package->getId()])) {
continue;
}
$seen[$package->getId()] = true;
$this->updateWhitelist[$package->getName()] = true;
$requires = $package->getRequires();
if ($devMode) {
$requires = array_merge($requires, $package->getDevRequires());
}
foreach ($requires as $require) {
$requirePackages = $pool->whatProvides($require->getTarget());
foreach ($requirePackages as $requirePackage) {
if (isset($skipPackages[$requirePackage->getName()])) {
continue;
}
$packageQueue->enqueue($requirePackage);
}
}
}
}
}
private function mockLocalRepositories(RepositoryManager $rm)
{
$packages = array_map(function ($p) {
return clone $p;
}, $rm->getLocalRepository()->getPackages());
foreach ($packages as $key => $package) {
if ($package instanceof AliasPackage) {
unset($packages[$key]);
}
}
$rm->setLocalRepository(
new InstalledArrayRepository($packages)
);
}
public static function create(IOInterface $io, Composer $composer)
{
return new static(
$io,
$composer->getConfig(),
$composer->getPackage(),
$composer->getDownloadManager(),
$composer->getRepositoryManager(),
$composer->getLocker(),
$composer->getInstallationManager(),
$composer->getEventDispatcher(),
$composer->getAutoloadGenerator()
);
}
public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
{
$this->additionalInstalledRepository = $additionalInstalledRepository;
return $this;
}
public function setDryRun($dryRun = true)
{
$this->dryRun = (boolean) $dryRun;
return $this;
}
public function setPreferSource($preferSource = true)
{
$this->preferSource = (boolean) $preferSource;
return $this;
}
public function setPreferDist($preferDist = true)
{
$this->preferDist = (boolean) $preferDist;
return $this;
}
public function setOptimizeAutoloader($optimizeAutoloader = false)
{
$this->optimizeAutoloader = (boolean) $optimizeAutoloader;
return $this;
}
public function setUpdate($update = true)
{
$this->update = (boolean) $update;
return $this;
}
public function setDevMode($devMode = true)
{
$this->devMode = (boolean) $devMode;
return $this;
}
public function setRunScripts($runScripts = true)
{
$this->runScripts = (boolean) $runScripts;
return $this;
}
public function setConfig(Config $config)
{
$this->config = $config;
return $this;
}
public function setVerbose($verbose = true)
{
$this->verbose = (boolean) $verbose;
return $this;
}
public function setUpdateWhitelist(array $packages)
{
$this->updateWhitelist = array_flip(array_map('strtolower', $packages));
return $this;
}
public function disableCustomInstallers()
{
$this->installationManager->disableCustomInstallers();
return $this;
}
}
<?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
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0 class loader
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class ClassLoader
{
private $prefixes = array();
private $fallbackDirs = array();
private $useIncludePath = false;
private $classMap = array();
public function getPrefixes()
{
return $this->prefixes;
}
public function getFallbackDirs()
{
return $this->fallbackDirs;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of classes, merging with any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
* @param bool $prepend Prepend the location(s)
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirs = array_merge(
(array) $paths,
$this->fallbackDirs
);
} else {
$this->fallbackDirs = array_merge(
$this->fallbackDirs,
(array) $paths
);
}
return;
}
if (!isset($this->prefixes[$prefix])) {
$this->prefixes[$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixes[$prefix] = array_merge(
(array) $paths,
$this->prefixes[$prefix]
);
} else {
$this->prefixes[$prefix] = array_merge(
$this->prefixes[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of classes, replacing any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirs = (array) $paths;
return;
}
$this->prefixes[$prefix] = (array) $paths;
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
include $file;
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
$className = substr($class, $pos + 1);
} else {
// PEAR-like class name
$classPath = null;
$className = $class;
}
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
foreach ($this->prefixes as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
}
}
foreach ($this->fallbackDirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
return $file;
}
return $this->classMap[$class] = false;
}
}
[
"AFL-1.1", "AFL-1.2", "AFL-2.0", "AFL-2.1", "AFL-3.0", "APL-1.0", "Aladdin",
"ANTLR-PD", "Apache-1.0", "Apache-1.1", "Apache-2.0", "APSL-1.0",
"APSL-1.1", "APSL-1.2", "APSL-2.0", "Artistic-1.0", "Artistic-2.0", "AAL",
"BitTorrent-1.0", "BitTorrent-1.1", "BSL-1.0", "BSD-3-Clause-Clear",
"BSD-2-Clause", "BSD-2-Clause-FreeBSD", "BSD-2-Clause-NetBSD",
"BSD-3-Clause", "BSD-4-Clause", "BSD-4-Clause-UC", "CECILL-1.0",
"CECILL-1.1", "CECILL-2.0", "CECILL-B", "CECILL-C", "ClArtistic",
"CNRI-Python", "CNRI-Python-GPL-Compatible", "CDDL-1.0", "CDDL-1.1",
"CPAL-1.0", "CPL-1.0", "CATOSL-1.1", "Condor-1.1", "CC-BY-1.0", "CC-BY-2.0",
"CC-BY-2.5", "CC-BY-3.0", "CC-BY-ND-1.0", "CC-BY-ND-2.0", "CC-BY-ND-2.5",
"CC-BY-ND-3.0", "CC-BY-NC-1.0", "CC-BY-NC-2.0", "CC-BY-NC-2.5",
"CC-BY-NC-3.0", "CC-BY-NC-ND-1.0", "CC-BY-NC-ND-2.0", "CC-BY-NC-ND-2.5",
"CC-BY-NC-ND-3.0", "CC-BY-NC-SA-1.0", "CC-BY-NC-SA-2.0", "CC-BY-NC-SA-2.5",
"CC-BY-NC-SA-3.0", "CC-BY-SA-1.0", "CC-BY-SA-2.0", "CC-BY-SA-2.5",
"CC-BY-SA-3.0", "CC0-1.0", "CUA-OPL-1.0", "WTFPL", "EPL-1.0", "eCos-2.0",
"ECL-1.0", "ECL-2.0", "EFL-1.0", "EFL-2.0", "Entessa", "ErlPL-1.1",
"EUDatagrid", "EUPL-1.0", "EUPL-1.1", "Fair", "Frameworx-1.0", "FTL",
"AGPL-3.0", "GFDL-1.1", "GFDL-1.2", "GFDL-1.3", "GPL-1.0", "GPL-1.0+",
"GPL-2.0", "GPL-2.0+", "GPL-2.0-with-autoconf-exception",
"GPL-2.0-with-bison-exception", "GPL-2.0-with-classpath-exception",
"GPL-2.0-with-font-exception", "GPL-2.0-with-GCC-exception", "GPL-3.0",
"GPL-3.0+", "GPL-3.0-with-autoconf-exception", "GPL-3.0-with-GCC-exception",
"LGPL-2.1", "LGPL-2.1+", "LGPL-3.0", "LGPL-3.0+", "LGPL-2.0", "LGPL-2.0+",
"gSOAP-1.3b", "HPND", "IPL-1.0", "Imlib2", "IJG", "Intel", "IPA", "ISC",
"JSON", "LPPL-1.3a", "LPPL-1.0", "LPPL-1.1", "LPPL-1.2", "LPPL-1.3c",
"Libpng", "LPL-1.02", "LPL-1.0", "MS-PL", "MS-RL", "MirOS", "MIT",
"Motosoto", "MPL-1.0", "MPL-1.1", "MPL-2.0",
"MPL-2.0-no-copyleft-exception", "Multics", "NASA-1.3", "Naumen",
"NBPL-1.0", "NGPL", "NOSL", "NPL-1.0", "NPL-1.1", "Nokia", "NPOSL-3.0",
"NTP", "OCLC-2.0", "ODbL-1.0", "PDDL-1.0", "OGTSL", "OLDAP-2.2.2",
"OLDAP-1.1", "OLDAP-1.2", "OLDAP-1.3", "OLDAP-1.4", "OLDAP-2.0",
"OLDAP-2.0.1", "OLDAP-2.1", "OLDAP-2.2", "OLDAP-2.2.1", "OLDAP-2.3",
"OLDAP-2.4", "OLDAP-2.5", "OLDAP-2.6", "OLDAP-2.7", "OPL-1.0", "OSL-1.0",
"OSL-2.0", "OSL-2.1", "OSL-3.0", "OLDAP-2.8", "OpenSSL", "PHP-3.0",
"PHP-3.01", "PostgreSQL", "Python-2.0", "QPL-1.0", "RPSL-1.0", "RPL-1.5",
"RHeCos-1.1", "RSCPL", "Ruby", "SAX-PD", "SGI-B-1.0", "SGI-B-1.1",
"SGI-B-2.0", "OFL-1.0", "OFL-1.1", "SimPL-2.0", "Sleepycat", "SMLNJ",
"SugarCRM-1.1.3", "SISSL", "SPL-1.0", "Watcom-1.0", "NCSA", "VSL-1.0",
"W3C", "WXwindows", "Xnet", "X11", "XFree86-1.1", "YPL-1.0", "YPL-1.1",
"Zimbra-1.3", "Zlib", "ZPL-1.1", "ZPL-2.0", "ZPL-2.1"
]{
"name": "Package",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Package name, including 'vendor-name/' prefix.",
"required": true
},
"type": {
"description": "Package type, either 'library' for common packages, 'composer-installer' for custom installers, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
"type": "string"
},
"target-dir": {
"description": "Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
"type": "string"
},
"description": {
"type": "string",
"description": "Short package description.",
"required": true
},
"keywords": {
"type": "array",
"items": {
"type": "string",
"description": "A tag/keyword that this package relates to."
}
},
"homepage": {
"type": "string",
"description": "Homepage URL for the project.",
"format": "uri"
},
"version": {
"type": "string",
"description": "Package version, see http://getcomposer.org/doc/04-schema.md#version for more info on valid schemes."
},
"time": {
"type": "string",
"description": "Package release date, in 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' format."
},
"license": {
"type": ["string", "array"],
"description": "License name. Or an array of license names."
},
"authors": {
"type": "array",
"description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Full name of the author.",
"required": true
},
"email": {
"type": "string",
"description": "Email address of the author.",
"format": "email"
},
"homepage": {
"type": "string",
"description": "Homepage URL for the author.",
"format": "uri"
},
"role": {
"type": "string",
"description": "Author's role in the project."
}
}
}
},
"require": {
"type": "object",
"description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
"additionalProperties": true
},
"replace": {
"type": "object",
"description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
"additionalProperties": true
},
"conflict": {
"type": "object",
"description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
"additionalProperties": true
},
"provide": {
"type": "object",
"description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
"additionalProperties": true
},
"require-dev": {
"type": "object",
"description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
"additionalProperties": true
},
"suggest": {
"type": "object",
"description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
"additionalProperties": true
},
"config": {
"type": "object",
"description": "Composer options.",
"properties": {
"process-timeout": {
"type": "integer",
"description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
},
"use-include-path": {
"type": "boolean",
"description": "If true, the Composer autoloader will also look for classes in the PHP include path."
},
"preferred-install": {
"type": "string",
"description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist or auto."
},
"notify-on-install": {
"type": "boolean",
"description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
},
"github-protocols": {
"type": "array",
"description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
"items": {
"type": "string"
}
},
"github-oauth": {
"type": "object",
"description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
"additionalProperties": true
},
"vendor-dir": {
"type": "string",
"description": "The location where all packages are installed, defaults to \"vendor\"."
},
"bin-dir": {
"type": "string",
"description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
},
"cache-dir": {
"type": "string",
"description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
},
"cache-files-dir": {
"type": "string",
"description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
},
"cache-repo-dir": {
"type": "string",
"description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
},
"cache-vcs-dir": {
"type": "string",
"description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
},
"cache-ttl": {
"type": "integer",
"description": "The default cache time-to-live, defaults to 15552000 (6 months)."
},
"cache-files-ttl": {
"type": "integer",
"description": "The cache time-to-live for files, defaults to the value of cache-ttl."
},
"cache-files-maxsize": {
"type": ["string", "integer"],
"description": "The cache max size for the files cache, defaults to \"300MiB\"."
},
"discard-changes": {
"type": ["string", "boolean"],
"description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
}
}
},
"extra": {
"type": ["object", "array"],
"description": "Arbitrary extra data that can be used by custom installers, for example, package of type composer-installer must have a 'class' key defining the installer class name.",
"additionalProperties": true
},
"autoload": {
"type": "object",
"description": "Description of how the package can be autoloaded.",
"properties": {
"psr-0": {
"type": "object",
"description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
"additionalProperties": true
},
"classmap": {
"type": "array",
"description": "This is an array of directories that contain classes to be included in the class-map generation process."
},
"files": {
"type": "array",
"description": "This is an array of files that are always required on every request."
}
}
},
"archive": {
"type": ["object"],
"description": "Options for creating package archives for distribution.",
"properties": {
"exclude": {
"type": "array",
"description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
}
}
},
"repositories": {
"type": ["object", "array"],
"description": "A set of additional repositories where packages can be found.",
"additionalProperties": true
},
"minimum-stability": {
"type": ["string"],
"description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable."
},
"bin": {
"type": ["array"],
"description": "A set of files that should be treated as binaries and symlinked into bin-dir (from config).",
"items": {
"type": "string"
}
},
"include-path": {
"type": ["array"],
"description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
"items": {
"type": "string"
}
},
"scripts": {
"type": ["object"],
"description": "Scripts listeners that will be executed before/after some events.",
"properties": {
"pre-install-cmd": {
"type": ["array", "string"],
"description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
},
"post-install-cmd": {
"type": ["array", "string"],
"description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
},
"pre-update-cmd": {
"type": ["array", "string"],
"description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
},
"post-update-cmd": {
"type": ["array", "string"],
"description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
},
"pre-package-install": {
"type": ["array", "string"],
"description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
},
"post-package-install": {
"type": ["array", "string"],
"description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
},
"pre-package-update": {
"type": ["array", "string"],
"description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
},
"post-package-update": {
"type": ["array", "string"],
"description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
},
"pre-package-uninstall": {
"type": ["array", "string"],
"description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
},
"post-package-uninstall": {
"type": ["array", "string"],
"description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
},
"post-autoload-dump": {
"type": ["array", "string"],
"description": "Occurs after a the autoloader is dumped, contains one or more Class::method callables or shell commands."
}
}
},
"support": {
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "Email address for support.",
"format": "email"
},
"issues": {
"type": "string",
"description": "URL to the Issue Tracker.",
"format": "uri"
},
"forum": {
"type": "string",
"description": "URL to the Forum.",
"format": "uri"
},
"wiki": {
"type": "string",
"description": "URL to the Wiki.",
"format": "uri"
},
"irc": {
"type": "string",
"description": "IRC channel for support, as irc://server/channel.",
"format": "uri"
},
"source": {
"type": "string",
"description": "URL to browse or download the sources.",
"format": "uri"
}
}
}
}
}
MZ����@��� �!�L�!This program cannot be run in DOS mode.
$�,�;�B�;�B�;�B�2�מ:�B�2���-�B�2�ƞ9�B�2�ў?�B�a9�8�B�;�C��B�2�Ȟ:�B�2�֞:�B�2�Ӟ:�B�Rich;�B�PEL�MoO� 
8 @`?�@��"P@ Pp!8!@ �.text 
 `.rdata�
@@.data�0@�.rsrc @@@.reloc�P"@Bj$��@�xj�� @�e����E�PV� @�EЃ��PV� @�M��X @�e��E�P�5H @�L @YY�5\ @�E�P�5` @�D @YY���P @�M���M��T @3��H�; 0@u���h�@��l3@�$40@�5h3@�40@h$0@h(0@h 0@�� @���00@��}j�Y�jh"@�3ۉ]�d��p�]俀3@SVW�0 @;�t;�u3�F�u��h��4 @��3�F�|3@;�u
j�\Y�;�|3@��u,�5|3@h� @h� @�YY��t�E����������5<0@�|3@;�uh� @h� @�lYY�|3@9]�uSW�8 @9�3@th�3@�Y��t
SjS��3@�$0@� � @��5$0@�5(0@�5 0@������ �80@9,0@u7P�� @�E�� �M�PQ�YYËe�E�80@3�9,0@uP�h @9<0@u�� @�E������80@��øMZf9@t3��M�<@��@�8PEu��H�� t�� uՃ��v�3�9����xtv�3�9������j�,0@�p @j��l @YY��3@��3@�� @� t3@��� @� p3@��� @��x3@�V��=0@u h�@�� @Y�g�=0@�u j��� @Y3���{������U���(�H1@� D1@�@1@�<1@�581@�=41@f�`1@f� T1@f�01@f�,1@f�%(1@f�-$1@��X1@�E�L1@�E�P1@�E�\1@��������0@�P1@�L0@�@0@ ��D0@�0@�������0@������� @��0@j�?Yj� @h!@�$ @�=�0@uj�Yh ��( @P�, @�Ë�U��E��8csm�u*�xu$�@= �t=!�t="�t=@�u��3�]�hH@� @3���%� @jh("@�b�5�3@�5� @��Y�E���u �u�� @Y�gj�Y�e��5�3@�։E��5�3@��YY�E��E�P�E�P�u�5l @��YP�U�E��u��֣�3@�u��փ���3@�E������ �E���j�YË�U���u�N��������YH]Ë�V��!@��!@W��;�s���t�Ѓ�;�r�_^Ë�V�"@�"@W��;�s���t�Ѓ�;�r�_^��%� @���̋�U��M�MZf9t3�]ËA<��8PEu�3ҹ f9H�‹�]�����������̋�U��E�H<��ASV�q3�W�D��v�} �H ;�r �X�;�r
B��(;�r�3�_^[]������������̋�U��j�hH"@he@d�P��SVW�0@1E�3�P�E�d��e��E�h@�*�������tU�E-@Ph@�P�������t;�@$���Ѓ��E������M�d� Y_^[��]ËE��3�=��‹�Ëe��E�����3��M�d� Y_^[��]���%� @�%� @��he@d�5�D$�l$�l$+�SVW�0@1E�3�P�e��u�E��E������E�E�d�ËM�d� Y__^[��]QË�U���u�u�u �uh�@h0@����]Ë�Vhh3�V���� ��t VVVVV����^�3�Ë�U����0@�e��e�SW�N�@����;�t ��t �У0@�`V�E�P�< @�u�3u�� @3�� @3�� @3��E�P� @�E�3E�3�;�u�O�@�� ��u���� ��50@�։50@^_[���%t @�%x @�%| @�%� @�%� @�%� @�%� @�%� @�%� @Pd�5�D$ +d$ SVW�(��0@3�P�E��u��E������E�d�ËM�d� Y__^[��]QËM�3�����������M��%T @�T$�B �J�3������J�3������l"@�s����#�#�#�)r)b)H)4))�(�(�(�(�(�(�)�#�$%�%&d&�&�$('�'�'�'�'(((6(�'H(Z(t(�('''�'�'l'^'R'F'>'>(0'�'�)�@W@�@�MoOl�!�@0@�0@bad allocationH0@�!@RSDSь���J�!���LZc:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdbe�������������@@������������:@�������������@�@�����@"�d"@�"�# $#�&D H#(h �#�#�#�)r)b)H)4))�(�(�(�(�(�(�)�#�$%�%&d&�&�$('�'�'�'�'(((6(�'H(Z(t(�('''�'�'l'^'R'F'>'>(0'�'�)�GetConsoleMode�SetConsoleMode;GetStdHandleKERNEL32.dll??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@AJ?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ�?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@ZMSVCP90.dll_amsg_exit�__getmainargs,_cexit|_exitf_XcptFilter�exit�__initenv_initterm_initterm_e<_configthreadlocale�__setusermatherr _adjust_fdiv�__p__commode�__p__fmodej_encode_pointer�__set_app_typeK_crt_debugger_hookC?terminate@@YAXXZMSVCR90.dll�_unlock�__dllonexitv_lock_onexit`_decode_pointers_except_handler4_common _invoke_watson?_controlfp_s�InterlockedExchange!Sleep�InterlockedCompareExchange-TerminateProcess�GetCurrentProcess>UnhandledExceptionFilterSetUnhandledExceptionFilter�IsDebuggerPresentTQueryPerformanceCounterfGetTickCount�GetCurrentThreadId�GetCurrentProcessIdOGetSystemTimeAsFileTimes__CxxFrameHandler3N�@���D������������$!@ �8�P�h� � ��@(��CV�(4VS_VERSION_INFO����StringFileInfob040904b0�QFileDescriptionReads from stdin without leaking info to the terminal and outputs back to stdout6 FileVersion1, 0, 0, 08 InternalNamehiddeninputPLegalCopyrightJordi Boggiano - 2012HOriginalFilenamehiddeninput.exe: ProductNameHidden Input: ProductVersion1, 0, 0, 0DVarFileInfo$Translation �<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING@00!0/080F0L0T0^0d0n0{0�0�0�0�0�0�0�0�0�0�0�0�0�01#1-1@1J1O1T1v1{1�1�1�1�1�1�1�1�1�1�1�1�1�1�12"2*23292A2M2_2j2p2�2�2�2�2�2�2�2�2�2�2�2 333%303N3T3Z3`3f3l3s3z3�3�3�3�3�3�3�3�3�3�3�3�3�3�3�3�34444%4;4B4�4�4�4�4�4�4�4�4�4�45!5^5c5�5�5�5H6M6_6}6�6�677 7*7w7|7�7�7�7�78 88=8E8P8V8\8b8h8n8t8z8�8�8�89 $�0�0�01 1t1x12 2@2\2`2h2t20 0<?php
namespace Symfony\Component\Process;
use Symfony\Component\Process\Exception\RuntimeException;
class PhpProcess extends Process
{
private $executableFinder;
public function __construct($script, $cwd = null, array $env = array(), $timeout = 60, array $options = array())
{
parent::__construct(null, $cwd, $env, $script, $timeout, $options);
$this->executableFinder = new PhpExecutableFinder();
}
public function setPhpBinary($php)
{
$this->setCommandLine($php);
}
public function start($callback = null)
{
if (null === $this->getCommandLine()) {
if (false === $php = $this->executableFinder->find()) {
throw new RuntimeException('Unable to find the PHP executable.');
}
$this->setCommandLine($php);
}
parent::start($callback);
}
}
<?php
namespace Symfony\Component\Process;
class ExecutableFinder
{
private $suffixes = array('.exe', '.bat', '.cmd', '.com');
public function setSuffixes(array $suffixes)
{
$this->suffixes = $suffixes;
}
public function addSuffix($suffix)
{
$this->suffixes[] = $suffix;
}
public function find($name, $default = null, array $extraDirs = array())
{
if (ini_get('open_basedir')) {
$searchPath = explode(PATH_SEPARATOR, getenv('open_basedir'));
$dirs = array();
foreach ($searchPath as $path) {
if (is_dir($path)) {
$dirs[] = $path;
} else {
$file = str_replace(dirname($path), '', $path);
if ($file == $name && is_executable($path)) {
return $path;
}
}
}
} else {
$dirs = array_merge(
explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
$extraDirs
);
}
$suffixes = array('');
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$pathExt = getenv('PATHEXT');
$suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
}
foreach ($suffixes as $suffix) {
foreach ($dirs as $dir) {
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && (defined('PHP_WINDOWS_VERSION_BUILD') || is_executable($file))) {
return $file;
}
}
}
return $default;
}
}
<?php
namespace Symfony\Component\Process;
use Symfony\Component\Process\Exception\InvalidArgumentException;
use Symfony\Component\Process\Exception\RuntimeException;
class Process
{
const ERR = 'err';
const OUT = 'out';
const STATUS_READY = 'ready';
const STATUS_STARTED = 'started';
const STATUS_TERMINATED = 'terminated';
const STDIN = 0;
const STDOUT = 1;
const STDERR = 2;
private $commandline;
private $cwd;
private $env;
private $stdin;
private $timeout;
private $options;
private $exitcode;
private $fallbackExitcode;
private $processInformation;
private $stdout;
private $stderr;
private $enhanceWindowsCompatibility;
private $enhanceSigchildCompatibility;
private $pipes;
private $process;
private $status = self::STATUS_READY;
private $incrementalOutputOffset;
private $incrementalErrorOutputOffset;
private $fileHandles;
private $readBytes;
private static $sigchild;
public static $exitCodes = array(
0 => 'OK',
1 => 'General error',
2 => 'Misuse of shell builtins',
126 => 'Invoked command cannot execute',
127 => 'Command not found',
128 => 'Invalid exit argument',
129 => 'Hangup',
130 => 'Interrupt',
131 => 'Quit and dump core',
132 => 'Illegal instruction',
133 => 'Trace/breakpoint trap',
134 => 'Process aborted',
135 => 'Bus error: "access to undefined portion of memory object"',
136 => 'Floating point exception: "erroneous arithmetic operation"',
137 => 'Kill (terminate immediately)',
138 => 'User-defined 1',
139 => 'Segmentation violation',
140 => 'User-defined 2',
141 => 'Write to pipe with no one reading',
142 => 'Signal raised by alarm',
143 => 'Termination (request to terminate)',
145 => 'Child process terminated, stopped (or continued*)',
146 => 'Continue if stopped',
147 => 'Stop executing temporarily',
148 => 'Terminal stop signal',
149 => 'Background process attempting to read from tty ("in")',
150 => 'Background process attempting to write to tty ("out")',
151 => 'Urgent data available on socket',
152 => 'CPU time limit exceeded',
153 => 'File size limit exceeded',
154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
155 => 'Profiling timer expired',
157 => 'Pollable event',
159 => 'Bad syscall',
);
public function __construct($commandline, $cwd = null, array $env = null, $stdin = null, $timeout = 60, array $options = array())
{
if (!function_exists('proc_open')) {
throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
}
$this->commandline = $commandline;
$this->cwd = $cwd;
if (null === $this->cwd && defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->cwd = getcwd();
}
if (null !== $env) {
$this->env = array();
foreach ($env as $key => $value) {
$this->env[(binary) $key] = (binary) $value;
}
} else {
$this->env = null;
}
$this->stdin = $stdin;
$this->setTimeout($timeout);
$this->enhanceWindowsCompatibility = true;
$this->enhanceSigchildCompatibility = !defined('PHP_WINDOWS_VERSION_BUILD') && $this->isSigchildEnabled();
$this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
}
public function __destruct()
{
$this->stop();
}
public function __clone()
{
$this->exitcode = null;
$this->fallbackExitcode = null;
$this->processInformation = null;
$this->stdout = null;
$this->stderr = null;
$this->pipes = null;
$this->process = null;
$this->status = self::STATUS_READY;
$this->fileHandles = null;
$this->readBytes = null;
}
public function run($callback = null)
{
$this->start($callback);
return $this->wait($callback);
}
public function start($callback = null)
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running');
}
$this->stdout = '';
$this->stderr = '';
$this->incrementalOutputOffset = 0;
$this->incrementalErrorOutputOffset = 0;
$callback = $this->buildCallback($callback);
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->fileHandles = array(
self::STDOUT => tmpfile(),
);
if (false === $this->fileHandles[self::STDOUT]) {
throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
}
$this->readBytes = array(
self::STDOUT => 0,
);
$descriptors = array(array('pipe', 'r'), $this->fileHandles[self::STDOUT], array('pipe', 'w'));
} else {
$descriptors = array(
array('pipe', 'r'),
array('pipe', 'w'),
array('pipe', 'w'),
);
if ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
$descriptors = array_merge($descriptors, array(array('pipe', 'w')));
$this->commandline = '('.$this->commandline.') 3>/dev/null; code=$?; echo $code >&3; exit $code';
}
}
$commandline = $this->commandline;
if (defined('PHP_WINDOWS_VERSION_BUILD') && $this->enhanceWindowsCompatibility) {
$commandline = 'cmd /V:ON /E:ON /C "'.$commandline.'"';
if (!isset($this->options['bypass_shell'])) {
$this->options['bypass_shell'] = true;
}
}
$this->process = proc_open($commandline, $descriptors, $this->pipes, $this->cwd, $this->env, $this->options);
if (!is_resource($this->process)) {
throw new RuntimeException('Unable to launch a new process.');
}
$this->status = self::STATUS_STARTED;
foreach ($this->pipes as $pipe) {
stream_set_blocking($pipe, false);
}
if (null === $this->stdin) {
fclose($this->pipes[0]);
unset($this->pipes[0]);
return;
}
$writePipes = array($this->pipes[0]);
unset($this->pipes[0]);
$stdinLen = strlen($this->stdin);
$stdinOffset = 0;
while ($writePipes) {
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->processFileHandles($callback);
}
$r = $this->pipes;
$w = $writePipes;
$e = null;
$n = @stream_select($r, $w, $e, $this->timeout);
if (false === $n) {
break;
}
if ($n === 0) {
proc_terminate($this->process);
throw new RuntimeException('The process timed out.');
}
if ($w) {
$written = fwrite($writePipes[0], (binary) substr($this->stdin, $stdinOffset), 8192);
if (false !== $written) {
$stdinOffset += $written;
}
if ($stdinOffset >= $stdinLen) {
fclose($writePipes[0]);
$writePipes = null;
}
}
foreach ($r as $pipe) {
$type = array_search($pipe, $this->pipes);
$data = fread($pipe, 8192);
if (strlen($data) > 0) {
call_user_func($callback, $type == 1 ? self::OUT : self::ERR, $data);
}
if (false === $data || feof($pipe)) {
fclose($pipe);
unset($this->pipes[$type]);
}
}
}
$this->updateStatus();
}
public function restart($callback = null)
{
if ($this->isRunning()) {
throw new \RuntimeException('Process is already running');
}
$process = clone $this;
$process->start($callback);
return $process;
}
public function wait($callback = null)
{
$this->updateStatus();
$callback = $this->buildCallback($callback);
while ($this->pipes || (defined('PHP_WINDOWS_VERSION_BUILD') && $this->fileHandles)) {
if (defined('PHP_WINDOWS_VERSION_BUILD') && $this->fileHandles) {
$this->processFileHandles($callback, !$this->pipes);
}
if ($this->pipes) {
$r = $this->pipes;
$w = null;
$e = null;
if (false === $n = @stream_select($r, $w, $e, $this->timeout)) {
$lastError = error_get_last();
if (isset($lastError['message']) && false === stripos($lastError['message'], 'interrupted system call')) {
$this->pipes = array();
}
continue;
}
if (0 === $n) {
proc_terminate($this->process);
throw new RuntimeException('The process timed out.');
}
foreach ($r as $pipe) {
$type = array_search($pipe, $this->pipes);
$data = fread($pipe, 8192);
if (strlen($data) > 0) {
if (3 == $type) {
$this->fallbackExitcode = (int) $data;
} else {
call_user_func($callback, $type == 1 ? self::OUT : self::ERR, $data);
}
}
if (false === $data || feof($pipe)) {
fclose($pipe);
unset($this->pipes[$type]);
}
}
}
}
$this->updateStatus();
if ($this->processInformation['signaled']) {
throw new RuntimeException(sprintf('The process stopped because of a "%s" signal.', $this->processInformation['stopsig']));
}
$time = 0;
while ($this->isRunning() && $time < 1000000) {
$time += 1000;
usleep(1000);
}
$exitcode = proc_close($this->process);
if ($this->processInformation['signaled']) {
throw new RuntimeException(sprintf('The process stopped because of a "%s" signal.', $this->processInformation['stopsig']));
}
$this->exitcode = $this->processInformation['running'] ? $exitcode : $this->processInformation['exitcode'];
if (-1 == $this->exitcode && null !== $this->fallbackExitcode) {
$this->exitcode = $this->fallbackExitcode;
}
return $this->exitcode;
}
public function getOutput()
{
$this->updateOutput();
return $this->stdout;
}
public function getIncrementalOutput()
{
$data = $this->getOutput();
$latest = substr($data, $this->incrementalOutputOffset);
$this->incrementalOutputOffset = strlen($data);
return $latest;
}
public function getErrorOutput()
{
$this->updateErrorOutput();
return $this->stderr;
}
public function getIncrementalErrorOutput()
{
$data = $this->getErrorOutput();
$latest = substr($data, $this->incrementalErrorOutputOffset);
$this->incrementalErrorOutputOffset = strlen($data);
return $latest;
}
public function getExitCode()
{
if ($this->isSigchildEnabled() && !$this->enhanceSigchildCompatibility) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method');
}
$this->updateStatus();
return $this->exitcode;
}
public function getExitCodeText()
{
$exitcode = $this->getExitCode();
return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
}
public function isSuccessful()
{
return 0 == $this->getExitCode();
}
public function hasBeenSignaled()
{
if ($this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved');
}
$this->updateStatus();
return $this->processInformation['signaled'];
}
public function getTermSignal()
{
if ($this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved');
}
$this->updateStatus();
return $this->processInformation['termsig'];
}
public function hasBeenStopped()
{
$this->updateStatus();
return $this->processInformation['stopped'];
}
public function getStopSignal()
{
$this->updateStatus();
return $this->processInformation['stopsig'];
}
public function isRunning()
{
if (self::STATUS_STARTED !== $this->status) {
return false;
}
$this->updateStatus();
return $this->processInformation['running'];
}
public function isStarted()
{
return $this->status != self::STATUS_READY;
}
public function isTerminated()
{
$this->updateStatus();
return $this->status == self::STATUS_TERMINATED;
}
public function getStatus()
{
$this->updateStatus();
return $this->status;
}
public function stop($timeout = 10)
{
$timeoutMicro = (int) $timeout*10E6;
if ($this->isRunning()) {
proc_terminate($this->process);
$time = 0;
while (1 == $this->isRunning() && $time < $timeoutMicro) {
$time += 1000;
usleep(1000);
}
foreach ($this->pipes as $pipe) {
fclose($pipe);
}
$this->pipes = array();
$exitcode = proc_close($this->process);
$this->exitcode = -1 === $this->processInformation['exitcode'] ? $exitcode : $this->processInformation['exitcode'];
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
foreach ($this->fileHandles as $fileHandle) {
fclose($fileHandle);
}
$this->fileHandles = array();
}
}
$this->status = self::STATUS_TERMINATED;
return $this->exitcode;
}
public function addOutput($line)
{
$this->stdout .= $line;
}
public function addErrorOutput($line)
{
$this->stderr .= $line;
}
public function getCommandLine()
{
return $this->commandline;
}
public function setCommandLine($commandline)
{
$this->commandline = $commandline;
return $this;
}
public function getTimeout()
{
return $this->timeout;
}
public function setTimeout($timeout)
{
if (null === $timeout) {
$this->timeout = null;
return $this;
}
$timeout = (integer) $timeout;
if ($timeout < 0) {
throw new InvalidArgumentException('The timeout value must be a valid positive integer.');
}
$this->timeout = $timeout;
return $this;
}
public function getWorkingDirectory()
{
if (null === $this->cwd) {
return getcwd() ?: null;
}
return $this->cwd;
}
public function setWorkingDirectory($cwd)
{
$this->cwd = $cwd;
return $this;
}
public function getEnv()
{
return $this->env;
}
public function setEnv(array $env)
{
$this->env = $env;
return $this;
}
public function getStdin()
{
return $this->stdin;
}
public function setStdin($stdin)
{
$this->stdin = $stdin;
return $this;
}
public function getOptions()
{
return $this->options;
}
public function setOptions(array $options)
{
$this->options = $options;
return $this;
}
public function getEnhanceWindowsCompatibility()
{
return $this->enhanceWindowsCompatibility;
}
public function setEnhanceWindowsCompatibility($enhance)
{
$this->enhanceWindowsCompatibility = (Boolean) $enhance;
return $this;
}
public function getEnhanceSigchildCompatibility()
{
return $this->enhanceSigchildCompatibility;
}
public function setEnhanceSigchildCompatibility($enhance)
{
$this->enhanceSigchildCompatibility = (Boolean) $enhance;
return $this;
}
protected function buildCallback($callback)
{
$that = $this;
$out = self::OUT;
$err = self::ERR;
$callback = function ($type, $data) use ($that, $callback, $out, $err) {
if ($out == $type) {
$that->addOutput($data);
} else {
$that->addErrorOutput($data);
}
if (null !== $callback) {
call_user_func($callback, $type, $data);
}
};
return $callback;
}
protected function updateStatus()
{
if (self::STATUS_STARTED !== $this->status) {
return;
}
$this->processInformation = proc_get_status($this->process);
if (!$this->processInformation['running']) {
$this->status = self::STATUS_TERMINATED;
if (-1 !== $this->processInformation['exitcode']) {
$this->exitcode = $this->processInformation['exitcode'];
}
}
}
protected function updateErrorOutput()
{
if (isset($this->pipes[self::STDERR]) && is_resource($this->pipes[self::STDERR])) {
$this->addErrorOutput(stream_get_contents($this->pipes[self::STDERR]));
}
}
protected function updateOutput()
{
if (defined('PHP_WINDOWS_VERSION_BUILD') && isset($this->fileHandles[self::STDOUT]) && is_resource($this->fileHandles[self::STDOUT])) {
fseek($this->fileHandles[self::STDOUT], $this->readBytes[self::STDOUT]);
$this->addOutput(stream_get_contents($this->fileHandles[self::STDOUT]));
} elseif (isset($this->pipes[self::STDOUT]) && is_resource($this->pipes[self::STDOUT])) {
$this->addOutput(stream_get_contents($this->pipes[self::STDOUT]));
}
}
protected function isSigchildEnabled()
{
if (null !== self::$sigchild) {
return self::$sigchild;
}
ob_start();
phpinfo(INFO_GENERAL);
return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
}
private function processFileHandles($callback, $closeEmptyHandles = false)
{
$fh = $this->fileHandles;
foreach ($fh as $type => $fileHandle) {
fseek($fileHandle, $this->readBytes[$type]);
$data = fread($fileHandle, 8192);
if (strlen($data) > 0) {
$this->readBytes[$type] += strlen($data);
call_user_func($callback, $type == 1 ? self::OUT : self::ERR, $data);
}
if (false === $data || ($closeEmptyHandles && '' === $data && feof($fileHandle))) {
fclose($fileHandle);
unset($this->fileHandles[$type]);
}
}
}
}
<?php
namespace Symfony\Component\Process;
use Symfony\Component\Process\Exception\InvalidArgumentException;
use Symfony\Component\Process\Exception\LogicException;
class ProcessBuilder
{
private $arguments;
private $cwd;
private $env;
private $stdin;
private $timeout;
private $options;
private $inheritEnv;
public function __construct(array $arguments = array())
{
$this->arguments = $arguments;
$this->timeout = 60;
$this->options = array();
$this->env = array();
$this->inheritEnv = true;
}
public static function create(array $arguments = array())
{
return new static($arguments);
}
public function add($argument)
{
$this->arguments[] = $argument;
return $this;
}
public function setArguments(array $arguments)
{
$this->arguments = $arguments;
return $this;
}
public function setWorkingDirectory($cwd)
{
$this->cwd = $cwd;
return $this;
}
public function inheritEnvironmentVariables($inheritEnv = true)
{
$this->inheritEnv = $inheritEnv;
return $this;
}
public function setEnv($name, $value)
{
$this->env[$name] = $value;
return $this;
}
public function setInput($stdin)
{
$this->stdin = $stdin;
return $this;
}
public function setTimeout($timeout)
{
if (null === $timeout) {
$this->timeout = null;
return $this;
}
$timeout = (integer) $timeout;
if ($timeout < 0) {
throw new InvalidArgumentException('The timeout value must be a valid positive integer.');
}
$this->timeout = $timeout;
return $this;
}
public function setOption($name, $value)
{
$this->options[$name] = $value;
return $this;
}
public function getProcess()
{
if (!count($this->arguments)) {
throw new LogicException('You must add() command arguments before calling getProcess().');
}
$options = $this->options;
$script = implode(' ', array_map('escapeshellarg', $this->arguments));
if ($this->inheritEnv) {
$env = $this->env ? $this->env + $_ENV : null;
} else {
$env = $this->env;
}
return new Process($script, $this->cwd, $env, $this->stdin, $this->timeout, $options);
}
}
<?php
namespace Symfony\Component\Process\Exception;
interface ExceptionInterface
{
}
<?php
namespace Symfony\Component\Process\Exception;
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
<?php
namespace Symfony\Component\Process\Exception;
class LogicException extends \LogicException implements ExceptionInterface
{
}
<?php
namespace Symfony\Component\Process\Exception;
use Symfony\Component\Process\Process;
class ProcessFailedException extends RuntimeException
{
private $process;
public function __construct(Process $process)
{
if ($process->isSuccessful()) {
throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
}
parent::__construct(
sprintf(
'The command "%s" failed.'."\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
$process->getCommandLine(),
$process->getOutput(),
$process->getErrorOutput()
)
);
$this->process = $process;
}
public function getProcess()
{
return $this->process;
}
}
<?php
namespace Symfony\Component\Process\Exception;
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}
<?php
namespace Symfony\Component\Process;
class PhpExecutableFinder
{
private $executableFinder;
public function __construct()
{
$this->executableFinder = new ExecutableFinder();
}
public function find()
{
if (defined('PHP_BINARY') && PHP_BINARY && ('cli' === PHP_SAPI)) {
return PHP_BINARY;
}
if ($php = getenv('PHP_PATH')) {
if (!is_executable($php)) {
return false;
}
return $php;
}
if ($php = getenv('PHP_PEAR_PHP_BIN')) {
if (is_executable($php)) {
return $php;
}
}
$dirs = array(PHP_BINDIR);
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$dirs[] = 'C:\xampp\php\\';
}
return $this->executableFinder->find('php', false, $dirs);
}
}
<?php
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
class HelpCommand extends Command
{
private $command;
protected function configure()
{
$this->ignoreValidationErrors();
$this
->setName('help')
->setDefinition(array(
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
))
->setDescription('Displays help for a command')
->setHelp(<<<EOF
The <info>%command.name%</info> command displays help for a given command:
<info>php %command.full_name% list</info>
You can also output the help as XML by using the <comment>--xml</comment> option:
<info>php %command.full_name% --xml list</info>
To display the list of available commands, please use the <info>list</info> command.
EOF
)
;
}
public function setCommand(Command $command)
{
$this->command = $command;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
if (null === $this->command) {
$this->command = $this->getApplication()->find($input->getArgument('command_name'));
}
if ($input->getOption('xml')) {
$output->writeln($this->command->asXml(), OutputInterface::OUTPUT_RAW);
} else {
$output->writeln($this->command->asText());
}
$this->command = null;
}
}
<?php
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Helper\HelperSet;
class Command
{
private $application;
private $name;
private $aliases;
private $definition;
private $help;
private $description;
private $ignoreValidationErrors;
private $applicationDefinitionMerged;
private $code;
private $synopsis;
private $helperSet;
public function __construct($name = null)
{
$this->definition = new InputDefinition();
$this->ignoreValidationErrors = false;
$this->applicationDefinitionMerged = false;
$this->aliases = array();
if (null !== $name) {
$this->setName($name);
}
$this->configure();
if (!$this->name) {
throw new \LogicException('The command name cannot be empty.');
}
}
public function ignoreValidationErrors()
{
$this->ignoreValidationErrors = true;
}
public function setApplication(Application $application = null)
{
$this->application = $application;
if ($application) {
$this->setHelperSet($application->getHelperSet());
} else {
$this->helperSet = null;
}
}
public function setHelperSet(HelperSet $helperSet)
{
$this->helperSet = $helperSet;
}
public function getHelperSet()
{
return $this->helperSet;
}
public function getApplication()
{
return $this->application;
}
public function isEnabled()
{
return true;
}
protected function configure()
{
}
protected function execute(InputInterface $input, OutputInterface $output)
{
throw new \LogicException('You must override the execute() method in the concrete command class.');
}
protected function interact(InputInterface $input, OutputInterface $output)
{
}
protected function initialize(InputInterface $input, OutputInterface $output)
{
}
public function run(InputInterface $input, OutputInterface $output)
{
$this->getSynopsis();
$this->mergeApplicationDefinition();
try {
$input->bind($this->definition);
} catch (\Exception $e) {
if (!$this->ignoreValidationErrors) {
throw $e;
}
}
$this->initialize($input, $output);
if ($input->isInteractive()) {
$this->interact($input, $output);
}
$input->validate();
if ($this->code) {
$statusCode = call_user_func($this->code, $input, $output);
} else {
$statusCode = $this->execute($input, $output);
}
return is_numeric($statusCode) ? $statusCode : 0;
}
public function setCode($code)
{
if (!is_callable($code)) {
throw new \InvalidArgumentException('Invalid callable provided to Command::setCode.');
}
$this->code = $code;
return $this;
}
private function mergeApplicationDefinition($mergeArgs = true)
{
if (null === $this->application || true === $this->applicationDefinitionMerged) {
return;
}
if ($mergeArgs) {
$currentArguments = $this->definition->getArguments();
$this->definition->setArguments($this->application->getDefinition()->getArguments());
$this->definition->addArguments($currentArguments);
}
$this->definition->addOptions($this->application->getDefinition()->getOptions());
$this->applicationDefinitionMerged = true;
}
public function setDefinition($definition)
{
if ($definition instanceof InputDefinition) {
$this->definition = $definition;
} else {
$this->definition->setDefinition($definition);
}
$this->applicationDefinitionMerged = false;
return $this;
}
public function getDefinition()
{
return $this->definition;
}
protected function getNativeDefinition()
{
return $this->getDefinition();
}
public function addArgument($name, $mode = null, $description = '', $default = null)
{
$this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
return $this;
}
public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
{
$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
return $this;
}
public function setName($name)
{
$this->validateName($name);
$this->name = $name;
return $this;
}
public function getName()
{
return $this->name;
}
public function setDescription($description)
{
$this->description = $description;
return $this;
}
public function getDescription()
{
return $this->description;
}
public function setHelp($help)
{
$this->help = $help;
return $this;
}
public function getHelp()
{
return $this->help;
}
public function getProcessedHelp()
{
$name = $this->name;
$placeholders = array(
'%command.name%',
'%command.full_name%'
);
$replacements = array(
$name,
$_SERVER['PHP_SELF'].' '.$name
);
return str_replace($placeholders, $replacements, $this->getHelp());
}
public function setAliases($aliases)
{
foreach ($aliases as $alias) {
$this->validateName($alias);
}
$this->aliases = $aliases;
return $this;
}
public function getAliases()
{
return $this->aliases;
}
public function getSynopsis()
{
if (null === $this->synopsis) {
$this->synopsis = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis()));
}
return $this->synopsis;
}
public function getHelper($name)
{
return $this->helperSet->get($name);
}
public function asText()
{
if ($this->application && !$this->applicationDefinitionMerged) {
$this->getSynopsis();
$this->mergeApplicationDefinition(false);
}
$messages = array(
'<comment>Usage:</comment>',
' '.$this->getSynopsis(),
'',
);
if ($this->getAliases()) {
$messages[] = '<comment>Aliases:</comment> <info>'.implode(', ', $this->getAliases()).'</info>';
}
$messages[] = $this->getNativeDefinition()->asText();
if ($help = $this->getProcessedHelp()) {
$messages[] = '<comment>Help:</comment>';
$messages[] = ' '.str_replace("\n", "\n ", $help)."\n";
}
return implode("\n", $messages);
}
public function asXml($asDom = false)
{
if ($this->application && !$this->applicationDefinitionMerged) {
$this->getSynopsis();
$this->mergeApplicationDefinition(false);
}
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$dom->appendChild($commandXML = $dom->createElement('command'));
$commandXML->setAttribute('id', $this->name);
$commandXML->setAttribute('name', $this->name);
$commandXML->appendChild($usageXML = $dom->createElement('usage'));
$usageXML->appendChild($dom->createTextNode(sprintf($this->getSynopsis(), '')));
$commandXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $this->getDescription())));
$commandXML->appendChild($helpXML = $dom->createElement('help'));
$helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $this->getProcessedHelp())));
$commandXML->appendChild($aliasesXML = $dom->createElement('aliases'));
foreach ($this->getAliases() as $alias) {
$aliasesXML->appendChild($aliasXML = $dom->createElement('alias'));
$aliasXML->appendChild($dom->createTextNode($alias));
}
$definition = $this->getNativeDefinition()->asXml(true);
$commandXML->appendChild($dom->importNode($definition->getElementsByTagName('arguments')->item(0), true));
$commandXML->appendChild($dom->importNode($definition->getElementsByTagName('options')->item(0), true));
return $asDom ? $dom : $dom->saveXml();
}
private function validateName($name)
{
if (!preg_match('/^[^\:]+(\:[^\:]+)*$/', $name)) {
throw new \InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
}
}
}
<?php
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputDefinition;
class ListCommand extends Command
{
protected function configure()
{
$this
->setName('list')
->setDefinition($this->createDefinition())
->setDescription('Lists commands')
->setHelp(<<<EOF
The <info>%command.name%</info> command lists all commands:
<info>php %command.full_name%</info>
You can also display the commands for a specific namespace:
<info>php %command.full_name% test</info>
You can also output the information as XML by using the <comment>--xml</comment> option:
<info>php %command.full_name% --xml</info>
It's also possible to get raw list of commands (useful for embedding command runner):
<info>php %command.full_name% --raw</info>
EOF
)
;
}
protected function getNativeDefinition()
{
return $this->createDefinition();
}
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('xml')) {
$output->writeln($this->getApplication()->asXml($input->getArgument('namespace')), OutputInterface::OUTPUT_RAW);
} else {
$output->writeln($this->getApplication()->asText($input->getArgument('namespace'), $input->getOption('raw')));
}
}
private function createDefinition()
{
return new InputDefinition(array(
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
));
}
}
<?php
namespace Symfony\Component\Console\Tester;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;
class ApplicationTester
{
private $application;
private $input;
private $output;
public function __construct(Application $application)
{
$this->application = $application;
}
public function run(array $input, $options = array())
{
$this->input = new ArrayInput($input);
if (isset($options['interactive'])) {
$this->input->setInteractive($options['interactive']);
}
$this->output = new StreamOutput(fopen('php://memory', 'w', false));
if (isset($options['decorated'])) {
$this->output->setDecorated($options['decorated']);
}
if (isset($options['verbosity'])) {
$this->output->setVerbosity($options['verbosity']);
}
return $this->application->run($this->input, $this->output);
}
public function getDisplay()
{
rewind($this->output->getStream());
return stream_get_contents($this->output->getStream());
}
public function getInput()
{
return $this->input;
}
public function getOutput()
{
return $this->output;
}
}
<?php
namespace Symfony\Component\Console\Tester;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\StreamOutput;
class CommandTester
{
private $command;
private $input;
private $output;
public function __construct(Command $command)
{
$this->command = $command;
}
public function execute(array $input, array $options = array())
{
$this->input = new ArrayInput($input);
if (isset($options['interactive'])) {
$this->input->setInteractive($options['interactive']);
}
$this->output = new StreamOutput(fopen('php://memory', 'w', false));
if (isset($options['decorated'])) {
$this->output->setDecorated($options['decorated']);
}
if (isset($options['verbosity'])) {
$this->output->setVerbosity($options['verbosity']);
}
return $this->command->run($this->input, $this->output);
}
public function getDisplay()
{
rewind($this->output->getStream());
return stream_get_contents($this->output->getStream());
}
public function getInput()
{
return $this->input;
}
public function getOutput()
{
return $this->output;
}
}
<?php
namespace Symfony\Component\Console\Formatter;
class OutputFormatterStyleStack
{
private $styles;
private $emptyStyle;
public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
{
$this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
$this->reset();
}
public function reset()
{
$this->styles = array();
}
public function push(OutputFormatterStyleInterface $style)
{
$this->styles[] = $style;
}
public function pop(OutputFormatterStyleInterface $style = null)
{
if (empty($this->styles)) {
return $this->emptyStyle;
}
if (null === $style) {
return array_pop($this->styles);
}
foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
if ($style->apply('') === $stackedStyle->apply('')) {
$this->styles = array_slice($this->styles, 0, $index);
return $stackedStyle;
}
}
throw new \InvalidArgumentException('Incorrectly nested style tag found.');
}
public function getCurrent()
{
if (empty($this->styles)) {
return $this->emptyStyle;
}
return $this->styles[count($this->styles)-1];
}
public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
{
$this->emptyStyle = $emptyStyle;
return $this;
}
public function getEmptyStyle()
{
return $this->emptyStyle;
}
}
<?php
namespace Symfony\Component\Console\Formatter;
class OutputFormatterStyle implements OutputFormatterStyleInterface
{
private static $availableForegroundColors = array(
'black' => 30,
'red' => 31,
'green' => 32,
'yellow' => 33,
'blue' => 34,
'magenta' => 35,
'cyan' => 36,
'white' => 37
);
private static $availableBackgroundColors = array(
'black' => 40,
'red' => 41,
'green' => 42,
'yellow' => 43,
'blue' => 44,
'magenta' => 45,
'cyan' => 46,
'white' => 47
);
private static $availableOptions = array(
'bold' => 1,
'underscore' => 4,
'blink' => 5,
'reverse' => 7,
'conceal' => 8
);
private $foreground;
private $background;
private $options = array();
public function __construct($foreground = null, $background = null, array $options = array())
{
if (null !== $foreground) {
$this->setForeground($foreground);
}
if (null !== $background) {
$this->setBackground($background);
}
if (count($options)) {
$this->setOptions($options);
}
}
public function setForeground($color = null)
{
if (null === $color) {
$this->foreground = null;
return;
}
if (!isset(static::$availableForegroundColors[$color])) {
throw new \InvalidArgumentException(sprintf(
'Invalid foreground color specified: "%s". Expected one of (%s)',
$color,
implode(', ', array_keys(static::$availableForegroundColors))
));
}
$this->foreground = static::$availableForegroundColors[$color];
}
public function setBackground($color = null)
{
if (null === $color) {
$this->background = null;
return;
}
if (!isset(static::$availableBackgroundColors[$color])) {
throw new \InvalidArgumentException(sprintf(
'Invalid background color specified: "%s". Expected one of (%s)',
$color,
implode(', ', array_keys(static::$availableBackgroundColors))
));
}
$this->background = static::$availableBackgroundColors[$color];
}
public function setOption($option)
{
if (!isset(static::$availableOptions[$option])) {
throw new \InvalidArgumentException(sprintf(
'Invalid option specified: "%s". Expected one of (%s)',
$option,
implode(', ', array_keys(static::$availableOptions))
));
}
if (false === array_search(static::$availableOptions[$option], $this->options)) {
$this->options[] = static::$availableOptions[$option];
}
}
public function unsetOption($option)
{
if (!isset(static::$availableOptions[$option])) {
throw new \InvalidArgumentException(sprintf(
'Invalid option specified: "%s". Expected one of (%s)',
$option,
implode(', ', array_keys(static::$availableOptions))
));
}
$pos = array_search(static::$availableOptions[$option], $this->options);
if (false !== $pos) {
unset($this->options[$pos]);
}
}
public function setOptions(array $options)
{
$this->options = array();
foreach ($options as $option) {
$this->setOption($option);
}
}
public function apply($text)
{
$codes = array();
if (null !== $this->foreground) {
$codes[] = $this->foreground;
}
if (null !== $this->background) {
$codes[] = $this->background;
}
if (count($this->options)) {
$codes = array_merge($codes, $this->options);
}
if (0 === count($codes)) {
return $text;
}
return sprintf("\033[%sm%s\033[0m", implode(';', $codes), $text);
}
}
<?php
namespace Symfony\Component\Console\Formatter;
interface OutputFormatterStyleInterface
{
public function setForeground($color = null);
public function setBackground($color = null);
public function setOption($option);
public function unsetOption($option);
public function setOptions(array $options);
public function apply($text);
}
<?php
namespace Symfony\Component\Console\Formatter;
class OutputFormatter implements OutputFormatterInterface
{
const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?: [^<\\\\]+ | (?!<(?:/?[a-z]|/>)). | .(?<=\\\\<) )*)#isx';
private $decorated;
private $styles = array();
private $styleStack;
public static function escape($text)
{
return preg_replace('/([^\\\\]?)</is', '$1\\<', $text);
}
public function __construct($decorated = null, array $styles = array())
{
$this->decorated = (Boolean) $decorated;
$this->setStyle('error', new OutputFormatterStyle('white', 'red'));
$this->setStyle('info', new OutputFormatterStyle('green'));
$this->setStyle('comment', new OutputFormatterStyle('yellow'));
$this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
foreach ($styles as $name => $style) {
$this->setStyle($name, $style);
}
$this->styleStack = new OutputFormatterStyleStack();
}
public function setDecorated($decorated)
{
$this->decorated = (Boolean) $decorated;
}
public function isDecorated()
{
return $this->decorated;
}
public function setStyle($name, OutputFormatterStyleInterface $style)
{
$this->styles[strtolower($name)] = $style;
}
public function hasStyle($name)
{
return isset($this->styles[strtolower($name)]);
}
public function getStyle($name)
{
if (!$this->hasStyle($name)) {
throw new \InvalidArgumentException('Undefined style: '.$name);
}
return $this->styles[strtolower($name)];
}
public function format($message)
{
$message = preg_replace_callback(self::FORMAT_PATTERN, array($this, 'replaceStyle'), $message);
return str_replace('\\<', '<', $message);
}
public function getStyleStack()
{
return $this->styleStack;
}
private function replaceStyle($match)
{
if ('\\' === $match[1]) {
return $this->applyCurrentStyle($match[0]);
}
if ('' === $match[3]) {
if ('/' === $match[2]) {
$this->styleStack->pop();
return $this->applyCurrentStyle($match[4]);
}
return '<>'.$this->applyCurrentStyle($match[4]);
}
if (isset($this->styles[strtolower($match[3])])) {
$style = $this->styles[strtolower($match[3])];
} else {
$style = $this->createStyleFromString($match[3]);
if (false === $style) {
return $this->applyCurrentStyle($match[0]);
}
}
if ('/' === $match[2]) {
$this->styleStack->pop($style);
} else {
$this->styleStack->push($style);
}
return $this->applyCurrentStyle($match[4]);
}
private function createStyleFromString($string)
{
if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
return false;
}
$style = new OutputFormatterStyle();
foreach ($matches as $match) {
array_shift($match);
if ('fg' == $match[0]) {
$style->setForeground($match[1]);
} elseif ('bg' == $match[0]) {
$style->setBackground($match[1]);
} else {
$style->setOption($match[1]);
}
}
return $style;
}
private function applyCurrentStyle($text)
{
return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
}
}
<?php
namespace Symfony\Component\Console\Formatter;
interface OutputFormatterInterface
{
public function setDecorated($decorated);
public function isDecorated();
public function setStyle($name, OutputFormatterStyleInterface $style);
public function hasStyle($name);
public function getStyle($name);
public function format($message);
}
<?php
namespace Symfony\Component\Console;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\HelpCommand;
use Symfony\Component\Console\Command\ListCommand;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\DialogHelper;
use Symfony\Component\Console\Helper\ProgressHelper;
class Application
{
private $commands;
private $wantHelps = false;
private $runningCommand;
private $name;
private $version;
private $catchExceptions;
private $autoExit;
private $definition;
private $helperSet;
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
{
$this->name = $name;
$this->version = $version;
$this->catchExceptions = true;
$this->autoExit = true;
$this->commands = array();
$this->helperSet = $this->getDefaultHelperSet();
$this->definition = $this->getDefaultInputDefinition();
foreach ($this->getDefaultCommands() as $command) {
$this->add($command);
}
}
public function run(InputInterface $input = null, OutputInterface $output = null)
{
if (null === $input) {
$input = new ArgvInput();
}
if (null === $output) {
$output = new ConsoleOutput();
}
try {
$statusCode = $this->doRun($input, $output);
} catch (\Exception $e) {
if (!$this->catchExceptions) {
throw $e;
}
if ($output instanceof ConsoleOutputInterface) {
$this->renderException($e, $output->getErrorOutput());
} else {
$this->renderException($e, $output);
}
$statusCode = $e->getCode();
$statusCode = is_numeric($statusCode) && $statusCode ? $statusCode : 1;
}
if ($this->autoExit) {
if ($statusCode > 255) {
$statusCode = 255;
}
exit($statusCode);
}
return $statusCode;
}
public function doRun(InputInterface $input, OutputInterface $output)
{
$name = $this->getCommandName($input);
if (true === $input->hasParameterOption(array('--ansi'))) {
$output->setDecorated(true);
} elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
$output->setDecorated(false);
}
if (true === $input->hasParameterOption(array('--help', '-h'))) {
if (!$name) {
$name = 'help';
$input = new ArrayInput(array('command' => 'help'));
} else {
$this->wantHelps = true;
}
}
if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
$input->setInteractive(false);
}
if (function_exists('posix_isatty') && $this->getHelperSet()->has('dialog')) {
$inputStream = $this->getHelperSet()->get('dialog')->getInputStream();
if (!posix_isatty($inputStream)) {
$input->setInteractive(false);
}
}
if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
} elseif (true === $input->hasParameterOption(array('--verbose', '-v'))) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
}
if (true === $input->hasParameterOption(array('--version', '-V'))) {
$output->writeln($this->getLongVersion());
return 0;
}
if (!$name) {
$name = 'list';
$input = new ArrayInput(array('command' => 'list'));
}
$command = $this->find($name);
$this->runningCommand = $command;
$statusCode = $command->run($input, $output);
$this->runningCommand = null;
return is_numeric($statusCode) ? $statusCode : 0;
}
public function setHelperSet(HelperSet $helperSet)
{
$this->helperSet = $helperSet;
}
public function getHelperSet()
{
return $this->helperSet;
}
public function setDefinition(InputDefinition $definition)
{
$this->definition = $definition;
}
public function getDefinition()
{
return $this->definition;
}
public function getHelp()
{
$messages = array(
$this->getLongVersion(),
'',
'<comment>Usage:</comment>',
' [options] command [arguments]',
'',
'<comment>Options:</comment>',
);
foreach ($this->getDefinition()->getOptions() as $option) {
$messages[] = sprintf(' %-29s %s %s',
'<info>--'.$option->getName().'</info>',
$option->getShortcut() ? '<info>-'.$option->getShortcut().'</info>' : ' ',
$option->getDescription()
);
}
return implode(PHP_EOL, $messages);
}
public function setCatchExceptions($boolean)
{
$this->catchExceptions = (Boolean) $boolean;
}
public function setAutoExit($boolean)
{
$this->autoExit = (Boolean) $boolean;
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
public function getVersion()
{
return $this->version;
}
public function setVersion($version)
{
$this->version = $version;
}
public function getLongVersion()
{
if ('UNKNOWN' !== $this->getName() && 'UNKNOWN' !== $this->getVersion()) {
return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
}
return '<info>Console Tool</info>';
}
public function register($name)
{
return $this->add(new Command($name));
}
public function addCommands(array $commands)
{
foreach ($commands as $command) {
$this->add($command);
}
}
public function add(Command $command)
{
$command->setApplication($this);
if (!$command->isEnabled()) {
$command->setApplication(null);
return;
}
$this->commands[$command->getName()] = $command;
foreach ($command->getAliases() as $alias) {
$this->commands[$alias] = $command;
}
return $command;
}
public function get($name)
{
if (!isset($this->commands[$name])) {
throw new \InvalidArgumentException(sprintf('The command "%s" does not exist.', $name));
}
$command = $this->commands[$name];
if ($this->wantHelps) {
$this->wantHelps = false;
$helpCommand = $this->get('help');
$helpCommand->setCommand($command);
return $helpCommand;
}
return $command;
}
public function has($name)
{
return isset($this->commands[$name]);
}
public function getNamespaces()
{
$namespaces = array();
foreach ($this->commands as $command) {
$namespaces[] = $this->extractNamespace($command->getName());
foreach ($command->getAliases() as $alias) {
$namespaces[] = $this->extractNamespace($alias);
}
}
return array_values(array_unique(array_filter($namespaces)));
}
public function findNamespace($namespace)
{
$allNamespaces = array();
foreach ($this->getNamespaces() as $n) {
$allNamespaces[$n] = explode(':', $n);
}
$found = array();
foreach (explode(':', $namespace) as $i => $part) {
$abbrevs = static::getAbbreviations(array_unique(array_values(array_filter(array_map(function ($p) use ($i) { return isset($p[$i]) ? $p[$i] : ''; }, $allNamespaces)))));
if (!isset($abbrevs[$part])) {
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
if (1 <= $i) {
$part = implode(':', $found).':'.$part;
}
if ($alternatives = $this->findAlternativeNamespace($part, $abbrevs)) {
if (1 == count($alternatives)) {
$message .= "\n\nDid you mean this?\n ";
} else {
$message .= "\n\nDid you mean one of these?\n ";
}
$message .= implode("\n ", $alternatives);
}
throw new \InvalidArgumentException($message);
}
if (count($abbrevs[$part]) > 1) {
throw new \InvalidArgumentException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions($abbrevs[$part])));
}
$found[] = $abbrevs[$part][0];
}
return implode(':', $found);
}
public function find($name)
{
$namespace = '';
$searchName = $name;
if (false !== $pos = strrpos($name, ':')) {
$namespace = $this->findNamespace(substr($name, 0, $pos));
$searchName = $namespace.substr($name, $pos);
}
$commands = array();
foreach ($this->commands as $command) {
$extractedNamespace = $this->extractNamespace($command->getName());
if ($extractedNamespace === $namespace
|| !empty($namespace) && 0 === strpos($extractedNamespace, $namespace)
) {
$commands[] = $command->getName();
}
}
$abbrevs = static::getAbbreviations(array_unique($commands));
if (isset($abbrevs[$searchName]) && 1 == count($abbrevs[$searchName])) {
return $this->get($abbrevs[$searchName][0]);
}
if (isset($abbrevs[$searchName]) && count($abbrevs[$searchName]) > 1) {
$suggestions = $this->getAbbreviationSuggestions($abbrevs[$searchName]);
throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions));
}
$aliases = array();
foreach ($this->commands as $command) {
foreach ($command->getAliases() as $alias) {
$extractedNamespace = $this->extractNamespace($alias);
if ($extractedNamespace === $namespace
|| !empty($namespace) && 0 === strpos($extractedNamespace, $namespace)
) {
$aliases[] = $alias;
}
}
}
$aliases = static::getAbbreviations(array_unique($aliases));
if (!isset($aliases[$searchName])) {
$message = sprintf('Command "%s" is not defined.', $name);
if ($alternatives = $this->findAlternativeCommands($searchName, $abbrevs)) {
if (1 == count($alternatives)) {
$message .= "\n\nDid you mean this?\n ";
} else {
$message .= "\n\nDid you mean one of these?\n ";
}
$message .= implode("\n ", $alternatives);
}
throw new \InvalidArgumentException($message);
}
if (count($aliases[$searchName]) > 1) {
throw new \InvalidArgumentException(sprintf('Command "%s" is ambiguous (%s).', $name, $this->getAbbreviationSuggestions($aliases[$searchName])));
}
return $this->get($aliases[$searchName][0]);
}
public function all($namespace = null)
{
if (null === $namespace) {
return $this->commands;
}
$commands = array();
foreach ($this->commands as $name => $command) {
if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
$commands[$name] = $command;
}
}
return $commands;
}
public static function getAbbreviations($names)
{
$abbrevs = array();
foreach ($names as $name) {
for ($len = strlen($name) - 1; $len > 0; --$len) {
$abbrev = substr($name, 0, $len);
if (!isset($abbrevs[$abbrev])) {
$abbrevs[$abbrev] = array($name);
} else {
$abbrevs[$abbrev][] = $name;
}
}
}
foreach ($names as $name) {
$abbrevs[$name] = array($name);
}
return $abbrevs;
}
public function asText($namespace = null, $raw = false)
{
$commands = $namespace ? $this->all($this->findNamespace($namespace)) : $this->commands;
$width = 0;
foreach ($commands as $command) {
$width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width;
}
$width += 2;
if ($raw) {
$messages = array();
foreach ($this->sortCommands($commands) as $space => $commands) {
foreach ($commands as $name => $command) {
$messages[] = sprintf("%-${width}s %s", $name, $command->getDescription());
}
}
return implode(PHP_EOL, $messages);
}
$messages = array($this->getHelp(), '');
if ($namespace) {
$messages[] = sprintf("<comment>Available commands for the \"%s\" namespace:</comment>", $namespace);
} else {
$messages[] = '<comment>Available commands:</comment>';
}
foreach ($this->sortCommands($commands) as $space => $commands) {
if (!$namespace && '_global' !== $space) {
$messages[] = '<comment>'.$space.'</comment>';
}
foreach ($commands as $name => $command) {
$messages[] = sprintf(" <info>%-${width}s</info> %s", $name, $command->getDescription());
}
}
return implode(PHP_EOL, $messages);
}
public function asXml($namespace = null, $asDom = false)
{
$commands = $namespace ? $this->all($this->findNamespace($namespace)) : $this->commands;
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$dom->appendChild($xml = $dom->createElement('symfony'));
$xml->appendChild($commandsXML = $dom->createElement('commands'));
if ($namespace) {
$commandsXML->setAttribute('namespace', $namespace);
} else {
$namespacesXML = $dom->createElement('namespaces');
$xml->appendChild($namespacesXML);
}
foreach ($this->sortCommands($commands) as $space => $commands) {
if (!$namespace) {
$namespaceArrayXML = $dom->createElement('namespace');
$namespacesXML->appendChild($namespaceArrayXML);
$namespaceArrayXML->setAttribute('id', $space);
}
foreach ($commands as $name => $command) {
if ($name !== $command->getName()) {
continue;
}
if (!$namespace) {
$commandXML = $dom->createElement('command');
$namespaceArrayXML->appendChild($commandXML);
$commandXML->appendChild($dom->createTextNode($name));
}
$node = $command->asXml(true)->getElementsByTagName('command')->item(0);
$node = $dom->importNode($node, true);
$commandsXML->appendChild($node);
}
}
return $asDom ? $dom : $dom->saveXml();
}
public function renderException($e, $output)
{
$strlen = function ($string) {
if (!function_exists('mb_strlen')) {
return strlen($string);
}
if (false === $encoding = mb_detect_encoding($string)) {
return strlen($string);
}
return mb_strlen($string, $encoding);
};
do {
$title = sprintf(' [%s] ', get_class($e));
$len = $strlen($title);
$width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
$lines = array();
foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) {
foreach (str_split($line, $width - 4) as $line) {
$lines[] = sprintf(' %s ', $line);
$len = max($strlen($line) + 4, $len);
}
}
$messages = array(str_repeat(' ', $len), $title.str_repeat(' ', max(0, $len - $strlen($title))));
foreach ($lines as $line) {
$messages[] = $line.str_repeat(' ', $len - $strlen($line));
}
$messages[] = str_repeat(' ', $len);
$output->writeln("");
$output->writeln("");
foreach ($messages as $message) {
$output->writeln('<error>'.$message.'</error>');
}
$output->writeln("");
$output->writeln("");
if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) {
$output->writeln('<comment>Exception trace:</comment>');
$trace = $e->getTrace();
array_unshift($trace, array(
'function' => '',
'file' => $e->getFile() != null ? $e->getFile() : 'n/a',
'line' => $e->getLine() != null ? $e->getLine() : 'n/a',
'args' => array(),
));
for ($i = 0, $count = count($trace); $i < $count; $i++) {
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
$type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
$function = $trace[$i]['function'];
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
$output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line));
}
$output->writeln("");
$output->writeln("");
}
} while ($e = $e->getPrevious());
if (null !== $this->runningCommand) {
$output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())));
$output->writeln("");
$output->writeln("");
}
}
protected function getTerminalWidth()
{
$dimensions = $this->getTerminalDimensions();
return $dimensions[0];
}
protected function getTerminalHeight()
{
$dimensions = $this->getTerminalDimensions();
return $dimensions[1];
}
public function getTerminalDimensions()
{
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
return array((int) $matches[1], (int) $matches[2]);
}
if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
return array((int) $matches[1], (int) $matches[2]);
}
}
if ($sttyString = $this->getSttyColumns()) {
if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
return array((int) $matches[2], (int) $matches[1]);
}
if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
return array((int) $matches[2], (int) $matches[1]);
}
}
return array(null, null);
}
protected function getCommandName(InputInterface $input)
{
return $input->getFirstArgument();
}
protected function getDefaultInputDefinition()
{
return new InputDefinition(array(
new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message.'),
new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'),
new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version.'),
new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output.'),
new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output.'),
new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question.'),
));
}
protected function getDefaultCommands()
{
return array(new HelpCommand(), new ListCommand());
}
protected function getDefaultHelperSet()
{
return new HelperSet(array(
new FormatterHelper(),
new DialogHelper(),
new ProgressHelper(),
));
}
private function getSttyColumns()
{
if (!function_exists('proc_open')) {
return;
}
$descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
if (is_resource($process)) {
$info = stream_get_contents($pipes[1]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
return $info;
}
}
private function getConsoleMode()
{
if (!function_exists('proc_open')) {
return;
}
$descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
if (is_resource($process)) {
$info = stream_get_contents($pipes[1]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
return $matches[2].'x'.$matches[1];
}
}
}
private function sortCommands($commands)
{
$namespacedCommands = array();
foreach ($commands as $name => $command) {
$key = $this->extractNamespace($name, 1);
if (!$key) {
$key = '_global';
}
$namespacedCommands[$key][$name] = $command;
}
ksort($namespacedCommands);
foreach ($namespacedCommands as &$commands) {
ksort($commands);
}
return $namespacedCommands;
}
private function getAbbreviationSuggestions($abbrevs)
{
return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], count($abbrevs) > 2 ? sprintf(' and %d more', count($abbrevs) - 2) : '');
}
private function extractNamespace($name, $limit = null)
{
$parts = explode(':', $name);
array_pop($parts);
return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit));
}
private function findAlternativeCommands($name, $abbrevs)
{
$callback = function($item) {
return $item->getName();
};
return $this->findAlternatives($name, $this->commands, $abbrevs, $callback);
}
private function findAlternativeNamespace($name, $abbrevs)
{
return $this->findAlternatives($name, $this->getNamespaces(), $abbrevs);
}
private function findAlternatives($name, $collection, $abbrevs, $callback = null)
{
$alternatives = array();
foreach ($collection as $item) {
if (null !== $callback) {
$item = call_user_func($callback, $item);
}
$lev = levenshtein($name, $item);
if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
$alternatives[$item] = $lev;
}
}
if (!$alternatives) {
foreach ($abbrevs as $key => $values) {
$lev = levenshtein($name, $key);
if ($lev <= strlen($name) / 3 || false !== strpos($key, $name)) {
foreach ($values as $value) {
$alternatives[$value] = $lev;
}
}
}
}
asort($alternatives);
return array_keys($alternatives);
}
}
<?php
namespace Symfony\Component\Console\Input;
class InputArgument
{
const REQUIRED = 1;
const OPTIONAL = 2;
const IS_ARRAY = 4;
private $name;
private $mode;
private $default;
private $description;
public function __construct($name, $mode = null, $description = '', $default = null)
{
if (null === $mode) {
$mode = self::OPTIONAL;
} elseif (!is_int($mode) || $mode > 7 || $mode < 1) {
throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
}
$this->name = $name;
$this->mode = $mode;
$this->description = $description;
$this->setDefault($default);
}
public function getName()
{
return $this->name;
}
public function isRequired()
{
return self::REQUIRED === (self::REQUIRED & $this->mode);
}
public function isArray()
{
return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
}
public function setDefault($default = null)
{
if (self::REQUIRED === $this->mode && null !== $default) {
throw new \LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
}
if ($this->isArray()) {
if (null === $default) {
$default = array();
} elseif (!is_array($default)) {
throw new \LogicException('A default value for an array argument must be an array.');
}
}
$this->default = $default;
}
public function getDefault()
{
return $this->default;
}
public function getDescription()
{
return $this->description;
}
}
<?php
namespace Symfony\Component\Console\Input;
abstract class Input implements InputInterface
{
protected $definition;
protected $options;
protected $arguments;
protected $interactive = true;
public function __construct(InputDefinition $definition = null)
{
if (null === $definition) {
$this->arguments = array();
$this->options = array();
$this->definition = new InputDefinition();
} else {
$this->bind($definition);
$this->validate();
}
}
public function bind(InputDefinition $definition)
{
$this->arguments = array();
$this->options = array();
$this->definition = $definition;
$this->parse();
}
abstract protected function parse();
public function validate()
{
if (count($this->arguments) < $this->definition->getArgumentRequiredCount()) {
throw new \RuntimeException('Not enough arguments.');
}
}
public function isInteractive()
{
return $this->interactive;
}
public function setInteractive($interactive)
{
$this->interactive = (Boolean) $interactive;
}
public function getArguments()
{
return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
}
public function getArgument($name)
{
if (!$this->definition->hasArgument($name)) {
throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
}
public function setArgument($name, $value)
{
if (!$this->definition->hasArgument($name)) {
throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
$this->arguments[$name] = $value;
}
public function hasArgument($name)
{
return $this->definition->hasArgument($name);
}
public function getOptions()
{
return array_merge($this->definition->getOptionDefaults(), $this->options);
}
public function getOption($name)
{
if (!$this->definition->hasOption($name)) {
throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
}
return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
}
public function setOption($name, $value)
{
if (!$this->definition->hasOption($name)) {
throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
}
$this->options[$name] = $value;
}
public function hasOption($name)
{
return $this->definition->hasOption($name);
}
}
<?php
namespace Symfony\Component\Console\Input;
class StringInput extends ArgvInput
{
const REGEX_STRING = '([^ ]+?)(?: |(?<!\\\\)"|(?<!\\\\)\'|$)';
const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
public function __construct($input, InputDefinition $definition = null)
{
parent::__construct(array(), $definition);
$this->setTokens($this->tokenize($input));
}
private function tokenize($input)
{
$input = preg_replace('/(\r\n|\r|\n|\t)/', ' ', $input);
$tokens = array();
$length = strlen($input);
$cursor = 0;
while ($cursor < $length) {
if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
} elseif (preg_match('/([^="\' ]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
$tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2)));
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
$tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2));
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
$tokens[] = stripcslashes($match[1]);
} else {
throw new \InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
}
$cursor += strlen($match[0]);
}
return $tokens;
}
}
<?php
namespace Symfony\Component\Console\Input;
class InputOption
{
const VALUE_NONE = 1;
const VALUE_REQUIRED = 2;
const VALUE_OPTIONAL = 4;
const VALUE_IS_ARRAY = 8;
private $name;
private $shortcut;
private $mode;
private $default;
private $description;
public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
{
if (0 === strpos($name, '--')) {
$name = substr($name, 2);
}
if (empty($name)) {
throw new \InvalidArgumentException('An option name cannot be empty.');
}
if (empty($shortcut)) {
$shortcut = null;
}
if (null !== $shortcut) {
if ('-' === $shortcut[0]) {
$shortcut = substr($shortcut, 1);
}
if (empty($shortcut)) {
throw new \InvalidArgumentException('An option shortcut cannot be empty.');
}
}
if (null === $mode) {
$mode = self::VALUE_NONE;
} elseif (!is_int($mode) || $mode > 15 || $mode < 1) {
throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
}
$this->name = $name;
$this->shortcut = $shortcut;
$this->mode = $mode;
$this->description = $description;
if ($this->isArray() && !$this->acceptValue()) {
throw new \InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
}
$this->setDefault($default);
}
public function getShortcut()
{
return $this->shortcut;
}
public function getName()
{
return $this->name;
}
public function acceptValue()
{
return $this->isValueRequired() || $this->isValueOptional();
}
public function isValueRequired()
{
return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
}
public function isValueOptional()
{
return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
}
public function isArray()
{
return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
}
public function setDefault($default = null)
{
if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
throw new \LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
}
if ($this->isArray()) {
if (null === $default) {
$default = array();
} elseif (!is_array($default)) {
throw new \LogicException('A default value for an array option must be an array.');
}
}
$this->default = $this->acceptValue() ? $default : false;
}
public function getDefault()
{
return $this->default;
}
public function getDescription()
{
return $this->description;
}
public function equals(InputOption $option)
{
return $option->getName() === $this->getName()
&& $option->getShortcut() === $this->getShortcut()
&& $option->getDefault() === $this->getDefault()
&& $option->isArray() === $this->isArray()
&& $option->isValueRequired() === $this->isValueRequired()
&& $option->isValueOptional() === $this->isValueOptional()
;
}
}
<?php
namespace Symfony\Component\Console\Input;
class ArgvInput extends Input
{
private $tokens;
private $parsed;
public function __construct(array $argv = null, InputDefinition $definition = null)
{
if (null === $argv) {
$argv = $_SERVER['argv'];
}
array_shift($argv);
$this->tokens = $argv;
parent::__construct($definition);
}
protected function setTokens(array $tokens)
{
$this->tokens = $tokens;
}
protected function parse()
{
$parseOptions = true;
$this->parsed = $this->tokens;
while (null !== $token = array_shift($this->parsed)) {
if ($parseOptions && '' == $token) {
$this->parseArgument($token);
} elseif ($parseOptions && '--' == $token) {
$parseOptions = false;
} elseif ($parseOptions && 0 === strpos($token, '--')) {
$this->parseLongOption($token);
} elseif ($parseOptions && '-' === $token[0]) {
$this->parseShortOption($token);
} else {
$this->parseArgument($token);
}
}
}
private function parseShortOption($token)
{
$name = substr($token, 1);
if (strlen($name) > 1) {
if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
$this->addShortOption($name[0], substr($name, 1));
} else {
$this->parseShortOptionSet($name);
}
} else {
$this->addShortOption($name, null);
}
}
private function parseShortOptionSet($name)
{
$len = strlen($name);
for ($i = 0; $i < $len; $i++) {
if (!$this->definition->hasShortcut($name[$i])) {
throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
}
$option = $this->definition->getOptionForShortcut($name[$i]);
if ($option->acceptValue()) {
$this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
break;
} else {
$this->addLongOption($option->getName(), true);
}
}
}
private function parseLongOption($token)
{
$name = substr($token, 2);
if (false !== $pos = strpos($name, '=')) {
$this->addLongOption(substr($name, 0, $pos), substr($name, $pos + 1));
} else {
$this->addLongOption($name, null);
}
}
private function parseArgument($token)
{
$c = count($this->arguments);
if ($this->definition->hasArgument($c)) {
$arg = $this->definition->getArgument($c);
$this->arguments[$arg->getName()] = $arg->isArray()? array($token) : $token;
} elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
$arg = $this->definition->getArgument($c - 1);
$this->arguments[$arg->getName()][] = $token;
} else {
throw new \RuntimeException('Too many arguments.');
}
}
private function addShortOption($shortcut, $value)
{
if (!$this->definition->hasShortcut($shortcut)) {
throw new \RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
}
$this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
}
private function addLongOption($name, $value)
{
if (!$this->definition->hasOption($name)) {
throw new \RuntimeException(sprintf('The "--%s" option does not exist.', $name));
}
$option = $this->definition->getOption($name);
if (null === $value && $option->acceptValue() && count($this->parsed)) {
$next = array_shift($this->parsed);
if (isset($next[0]) && '-' !== $next[0]) {
$value = $next;
} elseif (empty($next)) {
$value = '';
} else {
array_unshift($this->parsed, $next);
}
}
if (null === $value) {
if ($option->isValueRequired()) {
throw new \RuntimeException(sprintf('The "--%s" option requires a value.', $name));
}
$value = $option->isValueOptional() ? $option->getDefault() : true;
}
if ($option->isArray()) {
$this->options[$name][] = $value;
} else {
$this->options[$name] = $value;
}
}
public function getFirstArgument()
{
foreach ($this->tokens as $token) {
if ($token && '-' === $token[0]) {
continue;
}
return $token;
}
}
public function hasParameterOption($values)
{
$values = (array) $values;
foreach ($this->tokens as $v) {
if (in_array($v, $values)) {
return true;
}
}
return false;
}
public function getParameterOption($values, $default = false)
{
$values = (array) $values;
$tokens = $this->tokens;
while ($token = array_shift($tokens)) {
foreach ($values as $value) {
if (0 === strpos($token, $value)) {
if (false !== $pos = strpos($token, '=')) {
return substr($token, $pos + 1);
}
return array_shift($tokens);
}
}
}
return $default;
}
}
<?php
namespace Symfony\Component\Console\Input;
interface InputInterface
{
public function getFirstArgument();
public function hasParameterOption($values);
public function getParameterOption($values, $default = false);
public function bind(InputDefinition $definition);
public function validate();
public function getArguments();
public function getArgument($name);
public function setArgument($name, $value);
public function hasArgument($name);
public function getOptions();
public function getOption($name);
public function setOption($name, $value);
public function hasOption($name);
public function isInteractive();
public function setInteractive($interactive);
}
<?php
namespace Symfony\Component\Console\Input;
class ArrayInput extends Input
{
private $parameters;
public function __construct(array $parameters, InputDefinition $definition = null)
{
$this->parameters = $parameters;
parent::__construct($definition);
}
public function getFirstArgument()
{
foreach ($this->parameters as $key => $value) {
if ($key && '-' === $key[0]) {
continue;
}
return $value;
}
}
public function hasParameterOption($values)
{
$values = (array) $values;
foreach ($this->parameters as $k => $v) {
if (!is_int($k)) {
$v = $k;
}
if (in_array($v, $values)) {
return true;
}
}
return false;
}
public function getParameterOption($values, $default = false)
{
$values = (array) $values;
foreach ($this->parameters as $k => $v) {
if (is_int($k) && in_array($v, $values)) {
return true;
} elseif (in_array($k, $values)) {
return $v;
}
}
return $default;
}
protected function parse()
{
foreach ($this->parameters as $key => $value) {
if (0 === strpos($key, '--')) {
$this->addLongOption(substr($key, 2), $value);
} elseif ('-' === $key[0]) {
$this->addShortOption(substr($key, 1), $value);
} else {
$this->addArgument($key, $value);
}
}
}
private function addShortOption($shortcut, $value)
{
if (!$this->definition->hasShortcut($shortcut)) {
throw new \InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
}
$this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
}
private function addLongOption($name, $value)
{
if (!$this->definition->hasOption($name)) {
throw new \InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
}
$option = $this->definition->getOption($name);
if (null === $value) {
if ($option->isValueRequired()) {
throw new \InvalidArgumentException(sprintf('The "--%s" option requires a value.', $name));
}
$value = $option->isValueOptional() ? $option->getDefault() : true;
}
$this->options[$name] = $value;
}
private function addArgument($name, $value)
{
if (!$this->definition->hasArgument($name)) {
throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
$this->arguments[$name] = $value;
}
}
<?php
namespace Symfony\Component\Console\Input;
class InputDefinition
{
private $arguments;
private $requiredCount;
private $hasAnArrayArgument = false;
private $hasOptional;
private $options;
private $shortcuts;
public function __construct(array $definition = array())
{
$this->setDefinition($definition);
}
public function setDefinition(array $definition)
{
$arguments = array();
$options = array();
foreach ($definition as $item) {
if ($item instanceof InputOption) {
$options[] = $item;
} else {
$arguments[] = $item;
}
}
$this->setArguments($arguments);
$this->setOptions($options);
}
public function setArguments($arguments = array())
{
$this->arguments = array();
$this->requiredCount = 0;
$this->hasOptional = false;
$this->hasAnArrayArgument = false;
$this->addArguments($arguments);
}
public function addArguments($arguments = array())
{
if (null !== $arguments) {
foreach ($arguments as $argument) {
$this->addArgument($argument);
}
}
}
public function addArgument(InputArgument $argument)
{
if (isset($this->arguments[$argument->getName()])) {
throw new \LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
}
if ($this->hasAnArrayArgument) {
throw new \LogicException('Cannot add an argument after an array argument.');
}
if ($argument->isRequired() && $this->hasOptional) {
throw new \LogicException('Cannot add a required argument after an optional one.');
}
if ($argument->isArray()) {
$this->hasAnArrayArgument = true;
}
if ($argument->isRequired()) {
++$this->requiredCount;
} else {
$this->hasOptional = true;
}
$this->arguments[$argument->getName()] = $argument;
}
public function getArgument($name)
{
$arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
if (!$this->hasArgument($name)) {
throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
return $arguments[$name];
}
public function hasArgument($name)
{
$arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
return isset($arguments[$name]);
}
public function getArguments()
{
return $this->arguments;
}
public function getArgumentCount()
{
return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
}
public function getArgumentRequiredCount()
{
return $this->requiredCount;
}
public function getArgumentDefaults()
{
$values = array();
foreach ($this->arguments as $argument) {
$values[$argument->getName()] = $argument->getDefault();
}
return $values;
}
public function setOptions($options = array())
{
$this->options = array();
$this->shortcuts = array();
$this->addOptions($options);
}
public function addOptions($options = array())
{
foreach ($options as $option) {
$this->addOption($option);
}
}
public function addOption(InputOption $option)
{
if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
} elseif (isset($this->shortcuts[$option->getShortcut()]) && !$option->equals($this->options[$this->shortcuts[$option->getShortcut()]])) {
throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $option->getShortcut()));
}
$this->options[$option->getName()] = $option;
if ($option->getShortcut()) {
$this->shortcuts[$option->getShortcut()] = $option->getName();
}
}
public function getOption($name)
{
if (!$this->hasOption($name)) {
throw new \InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
}
return $this->options[$name];
}
public function hasOption($name)
{
return isset($this->options[$name]);
}
public function getOptions()
{
return $this->options;
}
public function hasShortcut($name)
{
return isset($this->shortcuts[$name]);
}
public function getOptionForShortcut($shortcut)
{
return $this->getOption($this->shortcutToName($shortcut));
}
public function getOptionDefaults()
{
$values = array();
foreach ($this->options as $option) {
$values[$option->getName()] = $option->getDefault();
}
return $values;
}
private function shortcutToName($shortcut)
{
if (!isset($this->shortcuts[$shortcut])) {
throw new \InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
}
return $this->shortcuts[$shortcut];
}
public function getSynopsis()
{
$elements = array();
foreach ($this->getOptions() as $option) {
$shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
$elements[] = sprintf('['.($option->isValueRequired() ? '%s--%s="..."' : ($option->isValueOptional() ? '%s--%s[="..."]' : '%s--%s')).']', $shortcut, $option->getName());
}
foreach ($this->getArguments() as $argument) {
$elements[] = sprintf($argument->isRequired() ? '%s' : '[%s]', $argument->getName().($argument->isArray() ? '1' : ''));
if ($argument->isArray()) {
$elements[] = sprintf('... [%sN]', $argument->getName());
}
}
return implode(' ', $elements);
}
public function asText()
{
$max = 0;
foreach ($this->getOptions() as $option) {
$nameLength = strlen($option->getName()) + 2;
if ($option->getShortcut()) {
$nameLength += strlen($option->getShortcut()) + 3;
}
$max = max($max, $nameLength);
}
foreach ($this->getArguments() as $argument) {
$max = max($max, strlen($argument->getName()));
}
++$max;
$text = array();
if ($this->getArguments()) {
$text[] = '<comment>Arguments:</comment>';
foreach ($this->getArguments() as $argument) {
if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) {
$default = sprintf('<comment> (default: %s)</comment>', $this->formatDefaultValue($argument->getDefault()));
} else {
$default = '';
}
$description = str_replace("\n", "\n".str_repeat(' ', $max + 2), $argument->getDescription());
$text[] = sprintf(" <info>%-${max}s</info> %s%s", $argument->getName(), $description, $default);
}
$text[] = '';
}
if ($this->getOptions()) {
$text[] = '<comment>Options:</comment>';
foreach ($this->getOptions() as $option) {
if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) {
$default = sprintf('<comment> (default: %s)</comment>', $this->formatDefaultValue($option->getDefault()));
} else {
$default = '';
}
$multiple = $option->isArray() ? '<comment> (multiple values allowed)</comment>' : '';
$description = str_replace("\n", "\n".str_repeat(' ', $max + 2), $option->getDescription());
$optionMax = $max - strlen($option->getName()) - 2;
$text[] = sprintf(" <info>%s</info> %-${optionMax}s%s%s%s",
'--'.$option->getName(),
$option->getShortcut() ? sprintf('(-%s) ', $option->getShortcut()) : '',
$description,
$default,
$multiple
);
}
$text[] = '';
}
return implode("\n", $text);
}
public function asXml($asDom = false)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$dom->appendChild($definitionXML = $dom->createElement('definition'));
$definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
foreach ($this->getArguments() as $argument) {
$argumentsXML->appendChild($argumentXML = $dom->createElement('argument'));
$argumentXML->setAttribute('name', $argument->getName());
$argumentXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
$argumentXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
$argumentXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
$argumentXML->appendChild($defaultsXML = $dom->createElement('defaults'));
$defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
foreach ($defaults as $default) {
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
$defaultXML->appendChild($dom->createTextNode($default));
}
}
$definitionXML->appendChild($optionsXML = $dom->createElement('options'));
foreach ($this->getOptions() as $option) {
$optionsXML->appendChild($optionXML = $dom->createElement('option'));
$optionXML->setAttribute('name', '--'.$option->getName());
$optionXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
$optionXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
$optionXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
$optionXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
$optionXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
if ($option->acceptValue()) {
$optionXML->appendChild($defaultsXML = $dom->createElement('defaults'));
$defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
foreach ($defaults as $default) {
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
$defaultXML->appendChild($dom->createTextNode($default));
}
}
}
return $asDom ? $dom : $dom->saveXml();
}
private function formatDefaultValue($default)
{
if (version_compare(PHP_VERSION, '5.4', '<')) {
return str_replace('\/', '/', json_encode($default));
}
return json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}
}
<?php
namespace Symfony\Component\Console;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Process\PhpExecutableFinder;
class Shell
{
private $application;
private $history;
private $output;
private $hasReadline;
private $prompt;
private $processIsolation;
public function __construct(Application $application)
{
$this->hasReadline = function_exists('readline');
$this->application = $application;
$this->history = getenv('HOME').'/.history_'.$application->getName();
$this->output = new ConsoleOutput();
$this->prompt = $application->getName().' > ';
$this->processIsolation = false;
}
public function run()
{
$this->application->setAutoExit(false);
$this->application->setCatchExceptions(true);
if ($this->hasReadline) {
readline_read_history($this->history);
readline_completion_function(array($this, 'autocompleter'));
}
$this->output->writeln($this->getHeader());
$php = null;
if ($this->processIsolation) {
$finder = new PhpExecutableFinder();
$php = $finder->find();
$this->output->writeln(<<<EOF
<info>Running with process isolation, you should consider this:</info>
* each command is executed as separate process,
* commands don't support interactivity, all params must be passed explicitly,
* commands output is not colorized.
EOF
);
}
while (true) {
$command = $this->readline();
if (false === $command) {
$this->output->writeln("\n");
break;
}
if ($this->hasReadline) {
readline_add_history($command);
readline_write_history($this->history);
}
if ($this->processIsolation) {
$pb = new ProcessBuilder();
$process = $pb
->add($php)
->add($_SERVER['argv'][0])
->add($command)
->inheritEnvironmentVariables(true)
->getProcess()
;
$output = $this->output;
$process->run(function($type, $data) use ($output) {
$output->writeln($data);
});
$ret = $process->getExitCode();
} else {
$ret = $this->application->run(new StringInput($command), $this->output);
}
if (0 !== $ret) {
$this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
}
}
}
protected function getHeader()
{
return <<<EOF
Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
At the prompt, type <comment>help</comment> for some help,
or <comment>list</comment> to get a list of available commands.
To exit the shell, type <comment>^D</comment>.
EOF;
}
private function autocompleter($text)
{
$info = readline_info();
$text = substr($info['line_buffer'], 0, $info['end']);
if ($info['point'] !== $info['end']) {
return true;
}
if (false === strpos($text, ' ') || !$text) {
return array_keys($this->application->all());
}
try {
$command = $this->application->find(substr($text, 0, strpos($text, ' ')));
} catch (\Exception $e) {
return true;
}
$list = array('--help');
foreach ($command->getDefinition()->getOptions() as $option) {
$list[] = '--'.$option->getName();
}
return $list;
}
private function readline()
{
if ($this->hasReadline) {
$line = readline($this->prompt);
} else {
$this->output->write($this->prompt);
$line = fgets(STDIN, 1024);
$line = (!$line && strlen($line) == 0) ? false : rtrim($line);
}
return $line;
}
public function getProcessIsolation()
{
return $this->processIsolation;
}
public function setProcessIsolation($processIsolation)
{
$this->processIsolation = (Boolean) $processIsolation;
if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
throw new \RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
}
}
}
<?php
namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Formatter\OutputFormatter;
abstract class Output implements OutputInterface
{
private $verbosity;
private $formatter;
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
{
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
$this->formatter = null === $formatter ? new OutputFormatter() : $formatter;
$this->formatter->setDecorated((Boolean) $decorated);
}
public function setFormatter(OutputFormatterInterface $formatter)
{
$this->formatter = $formatter;
}
public function getFormatter()
{
return $this->formatter;
}
public function setDecorated($decorated)
{
$this->formatter->setDecorated((Boolean) $decorated);
}
public function isDecorated()
{
return $this->formatter->isDecorated();
}
public function setVerbosity($level)
{
$this->verbosity = (int) $level;
}
public function getVerbosity()
{
return $this->verbosity;
}
public function writeln($messages, $type = 0)
{
$this->write($messages, true, $type);
}
public function write($messages, $newline = false, $type = 0)
{
if (self::VERBOSITY_QUIET === $this->verbosity) {
return;
}
$messages = (array) $messages;
foreach ($messages as $message) {
switch ($type) {
case OutputInterface::OUTPUT_NORMAL:
$message = $this->formatter->format($message);
break;
case OutputInterface::OUTPUT_RAW:
break;
case OutputInterface::OUTPUT_PLAIN:
$message = strip_tags($this->formatter->format($message));
break;
default:
throw new \InvalidArgumentException(sprintf('Unknown output type given (%s)', $type));
}
$this->doWrite($message, $newline);
}
}
abstract protected function doWrite($message, $newline);
}
<?php
namespace Symfony\Component\Console\Output;
class NullOutput extends Output
{
protected function doWrite($message, $newline)
{
}
}
<?php
namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Output\OutputInterface;
interface ConsoleOutputInterface extends OutputInterface
{
public function getErrorOutput();
public function setErrorOutput(OutputInterface $error);
}
<?php
namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
class StreamOutput extends Output
{
private $stream;
public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
{
if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) {
throw new \InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
}
$this->stream = $stream;
if (null === $decorated) {
$decorated = $this->hasColorSupport();
}
parent::__construct($verbosity, $decorated, $formatter);
}
public function getStream()
{
return $this->stream;
}
protected function doWrite($message, $newline)
{
if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) {
throw new \RuntimeException('Unable to write output.');
}
fflush($this->stream);
}
protected function hasColorSupport()
{
if (DIRECTORY_SEPARATOR == '\\') {
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
}
return function_exists('posix_isatty') && @posix_isatty($this->stream);
}
}
<?php
namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
interface OutputInterface
{
const VERBOSITY_QUIET = 0;
const VERBOSITY_NORMAL = 1;
const VERBOSITY_VERBOSE = 2;
const OUTPUT_NORMAL = 0;
const OUTPUT_RAW = 1;
const OUTPUT_PLAIN = 2;
public function write($messages, $newline = false, $type = 0);
public function writeln($messages, $type = 0);
public function setVerbosity($level);
public function getVerbosity();
public function setDecorated($decorated);
public function isDecorated();
public function setFormatter(OutputFormatterInterface $formatter);
public function getFormatter();
}
<?php
namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
{
private $stderr;
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
{
$outputStream = 'php://stdout';
if (!$this->hasStdoutSupport()) {
$outputStream = 'php://output';
}
parent::__construct(fopen($outputStream, 'w'), $verbosity, $decorated, $formatter);
$this->stderr = new StreamOutput(fopen('php://stderr', 'w'), $verbosity, $decorated, $formatter);
}
public function setDecorated($decorated)
{
parent::setDecorated($decorated);
$this->stderr->setDecorated($decorated);
}
public function setFormatter(OutputFormatterInterface $formatter)
{
parent::setFormatter($formatter);
$this->stderr->setFormatter($formatter);
}
public function setVerbosity($level)
{
parent::setVerbosity($level);
$this->stderr->setVerbosity($level);
}
public function getErrorOutput()
{
return $this->stderr;
}
public function setErrorOutput(OutputInterface $error)
{
$this->stderr = $error;
}
protected function hasStdoutSupport()
{
return ('OS400' != php_uname('s'));
}
}
<?php
namespace Symfony\Component\Console\Helper;
interface HelperInterface
{
public function setHelperSet(HelperSet $helperSet = null);
public function getHelperSet();
public function getName();
}
<?php
namespace Symfony\Component\Console\Helper;
use Symfony\Component\Console\Formatter\OutputFormatter;
class FormatterHelper extends Helper
{
public function formatSection($section, $message, $style = 'info')
{
return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
}
public function formatBlock($messages, $style, $large = false)
{
$messages = (array) $messages;
$len = 0;
$lines = array();
foreach ($messages as $message) {
$message = OutputFormatter::escape($message);
$lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
$len = max($this->strlen($message) + ($large ? 4 : 2), $len);
}
$messages = $large ? array(str_repeat(' ', $len)) : array();
foreach ($lines as $line) {
$messages[] = $line.str_repeat(' ', $len - $this->strlen($line));
}
if ($large) {
$messages[] = str_repeat(' ', $len);
}
foreach ($messages as &$message) {
$message = sprintf('<%s>%s</%s>', $style, $message, $style);
}
return implode("\n", $messages);
}
private function strlen($string)
{
if (!function_exists('mb_strlen')) {
return strlen($string);
}
if (false === $encoding = mb_detect_encoding($string)) {
return strlen($string);
}
return mb_strlen($string, $encoding);
}
public function getName()
{
return 'formatter';
}
}
<?php
namespace Symfony\Component\Console\Helper;
use Symfony\Component\Console\Command\Command;
class HelperSet
{
private $helpers;
private $command;
public function __construct(array $helpers = array())
{
$this->helpers = array();
foreach ($helpers as $alias => $helper) {
$this->set($helper, is_int($alias) ? null : $alias);
}
}
public function set(HelperInterface $helper, $alias = null)
{
$this->helpers[$helper->getName()] = $helper;
if (null !== $alias) {
$this->helpers[$alias] = $helper;
}
$helper->setHelperSet($this);
}
public function has($name)
{
return isset($this->helpers[$name]);
}
public function get($name)
{
if (!$this->has($name)) {
throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
}
return $this->helpers[$name];
}
public function setCommand(Command $command = null)
{
$this->command = $command;
}
public function getCommand()
{
return $this->command;
}
}
<?php
namespace Symfony\Component\Console\Helper;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
class DialogHelper extends Helper
{
private $inputStream;
private static $shell;
private static $stty;
public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid')
{
$width = max(array_map('strlen', array_keys($choices)));
$messages = (array) $question;
foreach ($choices as $key => $value) {
$messages[] = sprintf(" [<info>%-${width}s</info>] %s", $key, $value);
}
$output->writeln($messages);
$result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage) {
if (empty($choices[$picked])) {
throw new \InvalidArgumentException(sprintf($errorMessage, $picked));
}
return $picked;
}, $attempts, $default);
return $result;
}
public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
{
$output->write($question);
$inputStream = $this->inputStream ?: STDIN;
if (null === $autocomplete || !$this->hasSttyAvailable()) {
$ret = fgets($inputStream, 4096);
if (false === $ret) {
throw new \RuntimeException('Aborted');
}
$ret = trim($ret);
} else {
$ret = '';
$i = 0;
$ofs = -1;
$matches = $autocomplete;
$numMatches = count($matches);
$sttyMode = shell_exec('stty -g');
shell_exec('stty -icanon -echo');
$output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
while ($c = fread($inputStream, 1)) {
if ("\177" === $c) {
if (0 === $numMatches && 0 !== $i) {
$i--;
$output->write("\033[1D");
}
if ($i === 0) {
$ofs = -1;
$matches = $autocomplete;
$numMatches = count($matches);
} else {
$numMatches = 0;
}
$ret = substr($ret, 0, $i);
} elseif ("\033" === $c) {
$c .= fread($inputStream, 2);
if ('A' === $c[2] || 'B' === $c[2]) {
if ('A' === $c[2] && -1 === $ofs) {
$ofs = 0;
}
if (0 === $numMatches) {
continue;
}
$ofs += ('A' === $c[2]) ? -1 : 1;
$ofs = ($numMatches + $ofs) % $numMatches;
}
} elseif (ord($c) < 32) {
if ("\t" === $c || "\n" === $c) {
if ($numMatches > 0 && -1 !== $ofs) {
$ret = $matches[$ofs];
$output->write(substr($ret, $i));
$i = strlen($ret);
}
if ("\n" === $c) {
$output->write($c);
break;
}
$numMatches = 0;
}
continue;
} else {
$output->write($c);
$ret .= $c;
$i++;
$numMatches = 0;
$ofs = 0;
foreach ($autocomplete as $value) {
if (0 === strpos($value, $ret) && $i !== strlen($value)) {
$matches[$numMatches++] = $value;
}
}
}
$output->write("\033[K");
if ($numMatches > 0 && -1 !== $ofs) {
$output->write("\0337");
$output->write('<hl>' . substr($matches[$ofs], $i) . '</hl>');
$output->write("\0338");
}
}
shell_exec(sprintf('stty %s', $sttyMode));
}
return strlen($ret) > 0 ? $ret : $default;
}
public function askConfirmation(OutputInterface $output, $question, $default = true)
{
$answer = 'z';
while ($answer && !in_array(strtolower($answer[0]), array('y', 'n'))) {
$answer = $this->ask($output, $question);
}
if (false === $default) {
return $answer && 'y' == strtolower($answer[0]);
}
return !$answer || 'y' == strtolower($answer[0]);
}
public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
{
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$exe = __DIR__ . '/../../Resources/bin/hiddeninput.exe';
if ('phar:' === substr(__FILE__, 0, 5)) {
$tmpExe = sys_get_temp_dir() . '/../../Resources/bin/hiddeninput.exe';
copy($exe, $tmpExe);
$exe = $tmpExe;
}
$output->write($question);
$value = rtrim(shell_exec($exe));
$output->writeln('');
if (isset($tmpExe)) {
unlink($tmpExe);
}
return $value;
}
if ($this->hasSttyAvailable()) {
$output->write($question);
$sttyMode = shell_exec('stty -g');
shell_exec('stty -echo');
$value = fgets($this->inputStream ?: STDIN, 4096);
shell_exec(sprintf('stty %s', $sttyMode));
if (false === $value) {
throw new \RuntimeException('Aborted');
}
$value = trim($value);
$output->writeln('');
return $value;
}
if (false !== $shell = $this->getShell()) {
$output->write($question);
$readCmd = $shell === 'csh' ? 'set mypassword = $<' : 'read -r mypassword';
$command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
$value = rtrim(shell_exec($command));
$output->writeln('');
return $value;
}
if ($fallback) {
return $this->ask($output, $question);
}
throw new \RuntimeException('Unable to hide the response');
}
public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
{
$that = $this;
$interviewer = function() use ($output, $question, $default, $autocomplete, $that) {
return $that->ask($output, $question, $default, $autocomplete);
};
return $this->validateAttempts($interviewer, $output, $validator, $attempts);
}
public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
{
$that = $this;
$interviewer = function() use ($output, $question, $fallback, $that) {
return $that->askHiddenResponse($output, $question, $fallback);
};
return $this->validateAttempts($interviewer, $output, $validator, $attempts);
}
public function setInputStream($stream)
{
$this->inputStream = $stream;
}
public function getInputStream()
{
return $this->inputStream;
}
public function getName()
{
return 'dialog';
}
private function getShell()
{
if (null !== self::$shell) {
return self::$shell;
}
self::$shell = false;
if (file_exists('/usr/bin/env')) {
$test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
self::$shell = $sh;
break;
}
}
}
return self::$shell;
}
private function hasSttyAvailable()
{
if (null !== self::$stty) {
return self::$stty;
}
exec('stty 2>&1', $output, $exitcode);
return self::$stty = $exitcode === 0;
}
private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
{
$error = null;
while (false === $attempts || $attempts--) {
if (null !== $error) {
$output->writeln($this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'));
}
try {
return call_user_func($validator, $interviewer());
} catch (\Exception $error) {
}
}
throw $error;
}
}
<?php
namespace Symfony\Component\Console\Helper;
abstract class Helper implements HelperInterface
{
protected $helperSet = null;
public function setHelperSet(HelperSet $helperSet = null)
{
$this->helperSet = $helperSet;
}
public function getHelperSet()
{
return $this->helperSet;
}
}
<?php
namespace Symfony\Component\Console\Helper;
use Symfony\Component\Console\Output\OutputInterface;
class ProgressHelper extends Helper
{
const FORMAT_QUIET = ' %percent%%';
const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
const FORMAT_QUIET_NOMAX = ' %current%';
const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
private $barWidth = 28;
private $barChar = '=';
private $emptyBarChar = '-';
private $progressChar = '>';
private $format = null;
private $redrawFreq = 1;
private $lastMessagesLength;
private $barCharOriginal;
private $output;
private $current;
private $max;
private $startTime;
private $defaultFormatVars = array(
'current',
'max',
'bar',
'percent',
'elapsed',
);
private $formatVars;
private $widths = array(
'current' => 4,
'max' => 4,
'percent' => 3,
'elapsed' => 6,
);
private $timeFormats = array(
array(0, '???'),
array(2, '1 sec'),
array(59, 'secs', 1),
array(60, '1 min'),
array(3600, 'mins', 60),
array(5400, '1 hr'),
array(86400, 'hrs', 3600),
array(129600, '1 day'),
array(604800, 'days', 86400),
);
public function setBarWidth($size)
{
$this->barWidth = (int) $size;
}
public function setBarCharacter($char)
{
$this->barChar = $char;
}
public function setEmptyBarCharacter($char)
{
$this->emptyBarChar = $char;
}
public function setProgressCharacter($char)
{
$this->progressChar = $char;
}
public function setFormat($format)
{
$this->format = $format;
}
public function setRedrawFrequency($freq)
{
$this->redrawFreq = (int) $freq;
}
public function start(OutputInterface $output, $max = null)
{
$this->startTime = time();
$this->current = 0;
$this->max = (int) $max;
$this->output = $output;
if (null === $this->format) {
switch ($output->getVerbosity()) {
case OutputInterface::VERBOSITY_QUIET:
$this->format = self::FORMAT_QUIET_NOMAX;
if ($this->max > 0) {
$this->format = self::FORMAT_QUIET;
}
break;
case OutputInterface::VERBOSITY_VERBOSE:
$this->format = self::FORMAT_VERBOSE_NOMAX;
if ($this->max > 0) {
$this->format = self::FORMAT_VERBOSE;
}
break;
default:
$this->format = self::FORMAT_NORMAL_NOMAX;
if ($this->max > 0) {
$this->format = self::FORMAT_NORMAL;
}
break;
}
}
$this->initialize();
}
public function advance($step = 1, $redraw = false)
{
if (null === $this->startTime) {
throw new \LogicException('You must start the progress bar before calling advance().');
}
if ($this->current === 0) {
$redraw = true;
}
$this->current += $step;
if ($redraw || $this->current % $this->redrawFreq === 0) {
$this->display();
}
}
public function display($finish = false)
{
if (null === $this->startTime) {
throw new \LogicException('You must start the progress bar before calling display().');
}
$message = $this->format;
foreach ($this->generate($finish) as $name => $value) {
$message = str_replace("%{$name}%", $value, $message);
}
$this->overwrite($this->output, $message);
}
public function finish()
{
if (null === $this->startTime) {
throw new \LogicException('You must start the progress bar before calling finish().');
}
if ($this->startTime !== null) {
if (!$this->max) {
$this->barChar = $this->barCharOriginal;
$this->display(true);
}
$this->startTime = null;
$this->output->writeln('');
$this->output = null;
}
}
private function initialize()
{
$this->formatVars = array();
foreach ($this->defaultFormatVars as $var) {
if (strpos($this->format, "%{$var}%") !== false) {
$this->formatVars[$var] = true;
}
}
if ($this->max > 0) {
$this->widths['max'] = strlen($this->max);
$this->widths['current'] = $this->widths['max'];
} else {
$this->barCharOriginal = $this->barChar;
$this->barChar = $this->emptyBarChar;
}
}
private function generate($finish = false)
{
$vars = array();
$percent = 0;
if ($this->max > 0) {
$percent = (double) round($this->current / $this->max, 2);
}
if (isset($this->formatVars['bar'])) {
$completeBars = 0;
$emptyBars = 0;
if ($this->max > 0) {
$completeBars = floor($percent * $this->barWidth);
} else {
if (!$finish) {
$completeBars = floor($this->current % $this->barWidth);
} else {
$completeBars = $this->barWidth;
}
}
$emptyBars = $this->barWidth - $completeBars - strlen($this->progressChar);
$bar = str_repeat($this->barChar, $completeBars);
if ($completeBars < $this->barWidth) {
$bar .= $this->progressChar;
$bar .= str_repeat($this->emptyBarChar, $emptyBars);
}
$vars['bar'] = $bar;
}
if (isset($this->formatVars['elapsed'])) {
$elapsed = time() - $this->startTime;
$vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
}
if (isset($this->formatVars['current'])) {
$vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
}
if (isset($this->formatVars['max'])) {
$vars['max'] = $this->max;
}
if (isset($this->formatVars['percent'])) {
$vars['percent'] = str_pad($percent * 100, $this->widths['percent'], ' ', STR_PAD_LEFT);
}
return $vars;
}
private function humaneTime($secs)
{
$text = '';
foreach ($this->timeFormats as $format) {
if ($secs < $format[0]) {
if (count($format) == 2) {
$text = $format[1];
break;
} else {
$text = ceil($secs / $format[2]) . ' ' . $format[1];
break;
}
}
}
return $text;
}
private function overwrite(OutputInterface $output, $messages)
{
$output->write("\x0D");
if ($this->lastMessagesLength!==null) {
$output->write(str_repeat("\x20", $this->lastMessagesLength));
$output->write("\x0D");
}
$output->write($messages);
$this->lastMessagesLength=strlen($messages);
}
public function getName()
{
return 'progress';
}
}
<?php
namespace Symfony\Component\Finder;
class Finder implements \IteratorAggregate, \Countable
{
const IGNORE_VCS_FILES = 1;
const IGNORE_DOT_FILES = 2;
private $mode = 0;
private $names = array();
private $notNames = array();
private $exclude = array();
private $filters = array();
private $depths = array();
private $sizes = array();
private $followLinks = false;
private $sort = false;
private $ignore = 0;
private $dirs = array();
private $dates = array();
private $iterators = array();
private $contains = array();
private $notContains = array();
private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
public function __construct()
{
$this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
}
public static function create()
{
return new static();
}
public function directories()
{
$this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
return $this;
}
public function files()
{
$this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
return $this;
}
public function depth($level)
{
$this->depths[] = new Comparator\NumberComparator($level);
return $this;
}
public function date($date)
{
$this->dates[] = new Comparator\DateComparator($date);
return $this;
}
public function name($pattern)
{
$this->names[] = $pattern;
return $this;
}
public function notName($pattern)
{
$this->notNames[] = $pattern;
return $this;
}
public function contains($pattern)
{
$this->contains[] = $pattern;
return $this;
}
public function notContains($pattern)
{
$this->notContains[] = $pattern;
return $this;
}
public function size($size)
{
$this->sizes[] = new Comparator\NumberComparator($size);
return $this;
}
public function exclude($dirs)
{
$this->exclude = array_merge($this->exclude, (array) $dirs);
return $this;
}
public function ignoreDotFiles($ignoreDotFiles)
{
if ($ignoreDotFiles) {
$this->ignore = $this->ignore | static::IGNORE_DOT_FILES;
} else {
$this->ignore = $this->ignore & ~static::IGNORE_DOT_FILES;
}
return $this;
}
public function ignoreVCS($ignoreVCS)
{
if ($ignoreVCS) {
$this->ignore = $this->ignore | static::IGNORE_VCS_FILES;
} else {
$this->ignore = $this->ignore & ~static::IGNORE_VCS_FILES;
}
return $this;
}
public static function addVCSPattern($pattern)
{
self::$vcsPatterns[] = $pattern;
}
public function sort(\Closure $closure)
{
$this->sort = $closure;
return $this;
}
public function sortByName()
{
$this->sort = Iterator\SortableIterator::SORT_BY_NAME;
return $this;
}
public function sortByType()
{
$this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
return $this;
}
public function sortByAccessedTime()
{
$this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
return $this;
}
public function sortByChangedTime()
{
$this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
return $this;
}
public function sortByModifiedTime()
{
$this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
return $this;
}
public function filter(\Closure $closure)
{
$this->filters[] = $closure;
return $this;
}
public function followLinks()
{
$this->followLinks = true;
return $this;
}
public function in($dirs)
{
$dirs = (array) $dirs;
foreach ($dirs as $dir) {
if (!is_dir($dir)) {
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
}
}
$this->dirs = array_merge($this->dirs, $dirs);
return $this;
}
public function getIterator()
{
if (0 === count($this->dirs)) {
throw new \LogicException('You must call the in() method before iterating over a Finder.');
}
if (1 === count($this->dirs) && 0 === count($this->iterators)) {
return $this->searchInDirectory($this->dirs[0]);
}
$iterator = new \AppendIterator();
foreach ($this->dirs as $dir) {
$iterator->append($this->searchInDirectory($dir));
}
foreach ($this->iterators as $it) {
$iterator->append($it);
}
return $iterator;
}
public function append($iterator)
{
if ($iterator instanceof \IteratorAggregate) {
$this->iterators[] = $iterator->getIterator();
} elseif ($iterator instanceof \Iterator) {
$this->iterators[] = $iterator;
} elseif ($iterator instanceof \Traversable || is_array($iterator)) {
$it = new \ArrayIterator();
foreach ($iterator as $file) {
$it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
}
$this->iterators[] = $it;
} else {
throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
}
}
public function count()
{
return iterator_count($this->getIterator());
}
private function searchInDirectory($dir)
{
$flags = \RecursiveDirectoryIterator::SKIP_DOTS;
if ($this->followLinks) {
$flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
}
$iterator = new \RecursiveIteratorIterator(
new Iterator\RecursiveDirectoryIterator($dir, $flags),
\RecursiveIteratorIterator::SELF_FIRST
);
if ($this->depths) {
$iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->depths);
}
if ($this->mode) {
$iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
}
if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
$this->exclude = array_merge($this->exclude, self::$vcsPatterns);
}
if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
$this->notNames[] = '/^\..+/';
}
if ($this->exclude) {
$iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
}
if ($this->names || $this->notNames) {
$iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
}
if ($this->contains || $this->notContains) {
$iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
}
if ($this->sizes) {
$iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
}
if ($this->dates) {
$iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
}
if ($this->filters) {
$iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
}
if ($this->sort) {
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
$iterator = $iteratorAggregate->getIterator();
}
return $iterator;
}
}
<?php
namespace Symfony\Component\Finder;
class Glob
{
public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true)
{
$firstByte = true;
$escaping = false;
$inCurlies = 0;
$regex = '';
$sizeGlob = strlen($glob);
for ($i = 0; $i < $sizeGlob; $i++) {
$car = $glob[$i];
if ($firstByte) {
if ($strictLeadingDot && '.' !== $car) {
$regex .= '(?=[^\.])';
}
$firstByte = false;
}
if ('/' === $car) {
$firstByte = true;
}
if ('.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
$regex .= "\\$car";
} elseif ('*' === $car) {
$regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
} elseif ('?' === $car) {
$regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
} elseif ('{' === $car) {
$regex .= $escaping ? '\\{' : '(';
if (!$escaping) {
++$inCurlies;
}
} elseif ('}' === $car && $inCurlies) {
$regex .= $escaping ? '}' : ')';
if (!$escaping) {
--$inCurlies;
}
} elseif (',' === $car && $inCurlies) {
$regex .= $escaping ? ',' : '|';
} elseif ('\\' === $car) {
if ($escaping) {
$regex .= '\\\\';
$escaping = false;
} else {
$escaping = true;
}
continue;
} else {
$regex .= $car;
}
$escaping = false;
}
return '#^'.$regex.'$#';
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
class DepthRangeFilterIterator extends FilterIterator
{
private $minDepth = 0;
public function __construct(\RecursiveIteratorIterator $iterator, array $comparators)
{
$minDepth = 0;
$maxDepth = INF;
foreach ($comparators as $comparator) {
switch ($comparator->getOperator()) {
case '>':
$minDepth = $comparator->getTarget() + 1;
break;
case '>=':
$minDepth = $comparator->getTarget();
break;
case '<':
$maxDepth = $comparator->getTarget() - 1;
break;
case '<=':
$maxDepth = $comparator->getTarget();
break;
default:
$minDepth = $maxDepth = $comparator->getTarget();
}
}
$this->minDepth = $minDepth;
$iterator->setMaxDepth(INF === $maxDepth ? -1 : $maxDepth);
parent::__construct($iterator);
}
public function accept()
{
return $this->getInnerIterator()->getDepth() >= $this->minDepth;
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
class SortableIterator implements \IteratorAggregate
{
const SORT_BY_NAME = 1;
const SORT_BY_TYPE = 2;
const SORT_BY_ACCESSED_TIME = 3;
const SORT_BY_CHANGED_TIME = 4;
const SORT_BY_MODIFIED_TIME = 5;
private $iterator;
private $sort;
public function __construct(\Traversable $iterator, $sort)
{
$this->iterator = $iterator;
if (self::SORT_BY_NAME === $sort) {
$this->sort = function ($a, $b) {
return strcmp($a->getRealpath(), $b->getRealpath());
};
} elseif (self::SORT_BY_TYPE === $sort) {
$this->sort = function ($a, $b) {
if ($a->isDir() && $b->isFile()) {
return -1;
} elseif ($a->isFile() && $b->isDir()) {
return 1;
}
return strcmp($a->getRealpath(), $b->getRealpath());
};
} elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
$this->sort = function ($a, $b) {
return ($a->getATime() > $b->getATime());
};
} elseif (self::SORT_BY_CHANGED_TIME === $sort) {
$this->sort = function ($a, $b) {
return ($a->getCTime() > $b->getCTime());
};
} elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
$this->sort = function ($a, $b) {
return ($a->getMTime() > $b->getMTime());
};
} elseif (is_callable($sort)) {
$this->sort = $sort;
} else {
throw new \InvalidArgumentException('The SortableIterator takes a PHP callback or a valid built-in sort algorithm as an argument.');
}
}
public function getIterator()
{
$array = iterator_to_array($this->iterator, true);
uasort($array, $this->sort);
return new \ArrayIterator($array);
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
class FilecontentFilterIterator extends MultiplePcreFilterIterator
{
public function accept()
{
if (!$this->matchRegexps && !$this->noMatchRegexps) {
return true;
}
$fileinfo = $this->current();
if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
return false;
}
$content = $fileinfo->getContents();
if (!$content) {
return false;
}
foreach ($this->noMatchRegexps as $regex) {
if (preg_match($regex, $content)) {
return false;
}
}
$match = true;
if ($this->matchRegexps) {
$match = false;
foreach ($this->matchRegexps as $regex) {
if (preg_match($regex, $content)) {
return true;
}
}
}
return $match;
}
protected function toRegex($str)
{
return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
class SizeRangeFilterIterator extends FilterIterator
{
private $comparators = array();
public function __construct(\Iterator $iterator, array $comparators)
{
$this->comparators = $comparators;
parent::__construct($iterator);
}
public function accept()
{
$fileinfo = $this->current();
if (!$fileinfo->isFile()) {
return true;
}
$filesize = $fileinfo->getSize();
foreach ($this->comparators as $compare) {
if (!$compare->test($filesize)) {
return false;
}
}
return true;
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
class ExcludeDirectoryFilterIterator extends FilterIterator
{
private $patterns;
public function __construct(\Iterator $iterator, array $directories)
{
$this->patterns = array();
foreach ($directories as $directory) {
$this->patterns[] = '#(^|/)'.preg_quote($directory, '#').'(/|$)#';
}
parent::__construct($iterator);
}
public function accept()
{
$path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
$path = strtr($path, '\\', '/');
foreach ($this->patterns as $pattern) {
if (preg_match($pattern, $path)) {
return false;
}
}
return true;
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
abstract class FilterIterator extends \FilterIterator
{
public function rewind()
{
$iterator = $this;
while ($iterator instanceof \OuterIterator) {
if ($iterator->getInnerIterator() instanceof \FilesystemIterator) {
$iterator->getInnerIterator()->next();
$iterator->getInnerIterator()->rewind();
}
$iterator = $iterator->getInnerIterator();
}
parent::rewind();
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
abstract class MultiplePcreFilterIterator extends FilterIterator
{
protected $matchRegexps;
protected $noMatchRegexps;
public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
{
$this->matchRegexps = array();
foreach ($matchPatterns as $pattern) {
$this->matchRegexps[] = $this->toRegex($pattern);
}
$this->noMatchRegexps = array();
foreach ($noMatchPatterns as $pattern) {
$this->noMatchRegexps[] = $this->toRegex($pattern);
}
parent::__construct($iterator);
}
protected function isRegex($str)
{
if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
$start = substr($m[1], 0, 1);
$end = substr($m[1], -1);
if ($start === $end) {
return !preg_match('/[*?[:alnum:] \\\\]/', $start);
}
if ($start === '{' && $end === '}') {
return true;
}
}
return false;
}
abstract protected function toRegex($str);
}
<?php
namespace Symfony\Component\Finder\Iterator;
class CustomFilterIterator extends FilterIterator
{
private $filters = array();
public function __construct(\Iterator $iterator, array $filters)
{
foreach ($filters as $filter) {
if (!is_callable($filter)) {
throw new \InvalidArgumentException('Invalid PHP callback.');
}
}
$this->filters = $filters;
parent::__construct($iterator);
}
public function accept()
{
$fileinfo = $this->current();
foreach ($this->filters as $filter) {
if (false === call_user_func($filter, $fileinfo)) {
return false;
}
}
return true;
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
use Symfony\Component\Finder\Glob;
class FilenameFilterIterator extends MultiplePcreFilterIterator
{
public function accept()
{
$filename = $this->current()->getFilename();
foreach ($this->noMatchRegexps as $regex) {
if (preg_match($regex, $filename)) {
return false;
}
}
$match = true;
if ($this->matchRegexps) {
$match = false;
foreach ($this->matchRegexps as $regex) {
if (preg_match($regex, $filename)) {
return true;
}
}
}
return $match;
}
protected function toRegex($str)
{
return $this->isRegex($str) ? $str : Glob::toRegex($str);
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
class DateRangeFilterIterator extends FilterIterator
{
private $comparators = array();
public function __construct(\Iterator $iterator, array $comparators)
{
$this->comparators = $comparators;
parent::__construct($iterator);
}
public function accept()
{
$fileinfo = $this->current();
if (!$fileinfo->isFile()) {
return true;
}
$filedate = $fileinfo->getMTime();
foreach ($this->comparators as $compare) {
if (!$compare->test($filedate)) {
return false;
}
}
return true;
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
class FileTypeFilterIterator extends FilterIterator
{
const ONLY_FILES = 1;
const ONLY_DIRECTORIES = 2;
private $mode;
public function __construct(\Iterator $iterator, $mode)
{
$this->mode = $mode;
parent::__construct($iterator);
}
public function accept()
{
$fileinfo = $this->current();
if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
return false;
} elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
return false;
}
return true;
}
}
<?php
namespace Symfony\Component\Finder\Iterator;
use Symfony\Component\Finder\SplFileInfo;
class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
{
public function __construct($path, $flags)
{
if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
throw new \RuntimeException('This iterator only support returning current as fileinfo.');
}
parent::__construct($path, $flags);
}
public function current()
{
return new SplFileInfo(parent::current()->getPathname(), $this->getSubPath(), $this->getSubPathname());
}
}
<?php
namespace Symfony\Component\Finder\Comparator;
class DateComparator extends Comparator
{
public function __construct($test)
{
if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
}
try {
$date = new \DateTime($matches[2]);
$target = $date->format('U');
} catch (\Exception $e) {
throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
}
$operator = isset($matches[1]) ? $matches[1] : '==';
if ('since' === $operator || 'after' === $operator) {
$operator = '>';
}
if ('until' === $operator || 'before' === $operator) {
$operator = '<';
}
$this->setOperator($operator);
$this->setTarget($target);
}
}
<?php
namespace Symfony\Component\Finder\Comparator;
class NumberComparator extends Comparator
{
public function __construct($test)
{
if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
}
$target = $matches[2];
if (!is_numeric($target)) {
throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
}
if (isset($matches[3])) {
switch (strtolower($matches[3])) {
case 'k':
$target *= 1000;
break;
case 'ki':
$target *= 1024;
break;
case 'm':
$target *= 1000000;
break;
case 'mi':
$target *= 1024*1024;
break;
case 'g':
$target *= 1000000000;
break;
case 'gi':
$target *= 1024*1024*1024;
break;
}
}
$this->setTarget($target);
$this->setOperator(isset($matches[1]) ? $matches[1] : '==');
}
}
<?php
namespace Symfony\Component\Finder\Comparator;
class Comparator
{
private $target;
private $operator = '==';
public function getTarget()
{
return $this->target;
}
public function setTarget($target)
{
$this->target = $target;
}
public function getOperator()
{
return $this->operator;
}
public function setOperator($operator)
{
if (!$operator) {
$operator = '==';
}
if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
}
$this->operator = $operator;
}
public function test($test)
{
switch ($this->operator) {
case '>':
return $test > $this->target;
case '>=':
return $test >= $this->target;
case '<':
return $test < $this->target;
case '<=':
return $test <= $this->target;
case '!=':
return $test != $this->target;
}
return $test == $this->target;
}
}
<?php
namespace Symfony\Component\Finder;
class SplFileInfo extends \SplFileInfo
{
private $relativePath;
private $relativePathname;
public function __construct($file, $relativePath, $relativePathname)
{
parent::__construct($file);
$this->relativePath = $relativePath;
$this->relativePathname = $relativePathname;
}
public function getRelativePath()
{
return $this->relativePath;
}
public function getRelativePathname()
{
return $this->relativePathname;
}
public function getContents()
{
$level = error_reporting(0);
$content = file_get_contents($this->getRealpath());
error_reporting($level);
if (false === $content) {
$error = error_get_last();
throw new \RuntimeException($error['message']);
}
return $content;
}
}
<?php
namespace Seld\JsonLint;
class Undefined
{
}
<?php
namespace Seld\JsonLint;
use stdClass;
class JsonParser
{
const DETECT_KEY_CONFLICTS = 1;
const ALLOW_DUPLICATE_KEYS = 2;
private $flags;
private $stack;
private $vstack;
private $lstack;
private $yy;
private $symbols = array(
'error' => 2,
'JSONString' => 3,
'STRING' => 4,
'JSONNumber' => 5,
'NUMBER' => 6,
'JSONNullLiteral' => 7,
'NULL' => 8,
'JSONBooleanLiteral' => 9,
'TRUE' => 10,
'FALSE' => 11,
'JSONText' => 12,
'JSONValue' => 13,
'EOF' => 14,
'JSONObject' => 15,
'JSONArray' => 16,
'{' => 17,
'}' => 18,
'JSONMemberList' => 19,
'JSONMember' => 20,
':' => 21,
',' => 22,
'[' => 23,
']' => 24,
'JSONElementList' => 25,
'$accept' => 0,
'$end' => 1,
);
private $terminals_ = array(
2 => "error",
4 => "STRING",
6 => "NUMBER",
8 => "NULL",
10 => "TRUE",
11 => "FALSE",
14 => "EOF",
17 => "{",
18 => "}",
21 => ":",
22 => ",",
23 => "[",
24 => "]",
);
private $productions_ = array(
0,
array(3, 1),
array(5, 1),
array(7, 1),
array(9, 1),
array(9, 1),
array(12, 2),
array(13, 1),
array(13, 1),
array(13, 1),
array(13, 1),
array(13, 1),
array(13, 1),
array(15, 2),
array(15, 3),
array(20, 3),
array(19, 1),
array(19, 3),
array(16, 2),
array(16, 3),
array(25, 1),
array(25, 3)
);
private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
);
private $defaultActions = array(
16 => array(2, 6)
);
public function lint($input)
{
try {
$this->parse($input);
} catch (ParsingException $e) {
return $e;
}
}
public function parse($input, $flags = 0)
{
$this->flags = $flags;
$this->stack = array(0);
$this->vstack = array(null);
$this->lstack = array();
$yytext = '';
$yylineno = 0;
$yyleng = 0;
$recovering = 0;
$TERROR = 2;
$EOF = 1;
$this->lexer = new Lexer();
$this->lexer->setInput($input);
$yyloc = $this->lexer->yylloc;
$this->lstack[] = $yyloc;
$symbol = null;
$preErrorSymbol = null;
$state = null;
$action = null;
$a = null;
$r = null;
$yyval = new stdClass;
$p = null;
$len = null;
$newState = null;
$expected = null;
$errStr = null;
while (true) {
$state = $this->stack[count($this->stack)-1];
if (isset($this->defaultActions[$state])) {
$action = $this->defaultActions[$state];
} else {
if ($symbol == null) {
$symbol = $this->lex();
}
$action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
}
if (!$action || !$action[0]) {
if (!$recovering) {
$expected = array();
foreach ($this->table[$state] as $p => $ignore) {
if (isset($this->terminals_[$p]) && $p > 2) {
$expected[] = "'" . $this->terminals_[$p] . "'";
}
}
$message = null;
if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
$message = "Invalid string";
if ("'" === substr($this->lexer->match, 0, 1)) {
$message .= ", it appears you used single quotes instead of double quotes";
} elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
$message .= ", it appears you have an unescaped backslash at: ".$match[1];
} elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
$message .= ", it appears you forgot to terminated the string, or attempted to write a multiline string which is invalid";
}
}
$errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
$errStr .= $this->lexer->showPosition() . "\n";
if ($message) {
$errStr .= $message;
} else {
$errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
$errStr .= implode(', ', $expected);
}
if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
$errStr .= " - It appears you have an extra trailing comma";
}
$this->parseError($errStr, array(
'text' => $this->lexer->match,
'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
'line' => $this->lexer->yylineno,
'loc' => $yyloc,
'expected' => $expected,
));
}
if ($recovering == 3) {
if ($symbol == $EOF) {
throw new ParsingException($errStr ?: 'Parsing halted.');
}
$yyleng = $this->lexer->yyleng;
$yytext = $this->lexer->yytext;
$yylineno = $this->lexer->yylineno;
$yyloc = $this->lexer->yylloc;
$symbol = $this->lex();
}
while (true) {
if (array_key_exists($TERROR, $this->table[$state])) {
break;
}
if ($state == 0) {
throw new ParsingException($errStr ?: 'Parsing halted.');
}
$this->popStack(1);
$state = $this->stack[count($this->stack)-1];
}
$preErrorSymbol = $symbol;
$symbol = $TERROR;
$state = $this->stack[count($this->stack)-1];
$action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
$recovering = 3;
}
if (is_array($action[0]) && count($action) > 1) {
throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
}
switch ($action[0]) {
case 1:
$this->stack[] = $symbol;
$this->vstack[] = $this->lexer->yytext;
$this->lstack[] = $this->lexer->yylloc;
$this->stack[] = $action[1];
$symbol = null;
if (!$preErrorSymbol) {
$yyleng = $this->lexer->yyleng;
$yytext = $this->lexer->yytext;
$yylineno = $this->lexer->yylineno;
$yyloc = $this->lexer->yylloc;
if ($recovering > 0) {
$recovering--;
}
} else {
$symbol = $preErrorSymbol;
$preErrorSymbol = null;
}
break;
case 2:
$len = $this->productions_[$action[1]][1];
$yyval->token = $this->vstack[count($this->vstack) - $len];
$yyval->store = array(
'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
);
$r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
if (!$r instanceof Undefined) {
return $r;
}
if ($len) {
$this->popStack($len);
}
$this->stack[] = $this->productions_[$action[1]][0];
$this->vstack[] = $yyval->token;
$this->lstack[] = $yyval->store;
$newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
$this->stack[] = $newState;
break;
case 3:
return true;
}
}
return true;
}
protected function parseError($str, $hash)
{
throw new ParsingException($str, $hash);
}
private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
{
$len = count($tokens) - 1;
switch ($yystate) {
case 1:
$yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
$yyval->token = $yytext;
break;
case 2:
if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
$yyval->token = floatval($yytext);
} else {
$yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
}
break;
case 3:
$yyval->token = null;
break;
case 4:
$yyval->token = true;
break;
case 5:
$yyval->token = false;
break;
case 6:
return $yyval->token = $tokens[$len-1];
case 13:
$yyval->token = new stdClass;
break;
case 14:
$yyval->token = $tokens[$len-1];
break;
case 15:
$yyval->token = array($tokens[$len-2], $tokens[$len]);
break;
case 16:
$yyval->token = new stdClass;
$property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
$yyval->token->$property = $tokens[$len][1];
break;
case 17:
$yyval->token = $tokens[$len-2];
$key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
$errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
$errStr .= $this->lexer->showPosition() . "\n";
$errStr .= "Duplicate key: ".$tokens[$len][0];
throw new ParsingException($errStr);
} elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
$duplicateCount = 1;
do {
$duplicateKey = $key . '.' . $duplicateCount++;
} while (isset($tokens[$len-2]->$duplicateKey));
$key = $duplicateKey;
}
$tokens[$len-2]->$key = $tokens[$len][1];
break;
case 18:
$yyval->token = array();
break;
case 19:
$yyval->token = $tokens[$len-1];
break;
case 20:
$yyval->token = array($tokens[$len]);
break;
case 21:
$tokens[$len-2][] = $tokens[$len];
$yyval->token = $tokens[$len-2];
break;
}
return new Undefined();
}
private function stringInterpolation($match)
{
switch ($match[0]) {
case '\\\\':
return '\\';
case '\"':
return '"';
case '\b':
return chr(8);
case '\f':
return chr(12);
case '\n':
return "\n";
case '\r':
return "\r";
case '\t':
return "\t";
case '\/':
return "/";
default:
return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', 0, 'UTF-8');
}
}
private function popStack($n)
{
$this->stack = array_slice($this->stack, 0, - (2 * $n));
$this->vstack = array_slice($this->vstack, 0, - $n);
$this->lstack = array_slice($this->lstack, 0, - $n);
}
private function lex()
{
$token = $this->lexer->lex() ?: 1;
if (!is_numeric($token)) {
$token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
}
return $token;
}
}
<?php
namespace Seld\JsonLint;
class Lexer
{
private $EOF = 1;
private $rules = array(
0 => '/^\s+/',
1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
2 => '{^"(\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x09\x0a-\x1f\\\\"])*"}',
3 => '/^\{/',
4 => '/^\}/',
5 => '/^\[/',
6 => '/^\]/',
7 => '/^,/',
8 => '/^:/',
9 => '/^true\b/',
10 => '/^false\b/',
11 => '/^null\b/',
12 => '/^$/',
13 => '/^./',
);
private $conditions = array(
"INITIAL" => array(
"rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
"inclusive" => true,
),
);
private $conditionStack;
private $input;
private $more;
private $done;
private $matched;
public $match;
public $yylineno;
public $yyleng;
public $yytext;
public $yylloc;
public function lex()
{
$r = $this->next();
if (!$r instanceof Undefined) {
return $r;
}
return $this->lex();
}
public function setInput($input)
{
$this->input = $input;
$this->more = false;
$this->done = false;
$this->yylineno = $this->yyleng = 0;
$this->yytext = $this->matched = $this->match = '';
$this->conditionStack = array('INITIAL');
$this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
return $this;
}
public function showPosition()
{
$pre = str_replace("\n", '', $this->getPastInput());
$c = str_repeat('-', strlen($pre));
return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
}
public function getPastInput()
{
$past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
}
public function getUpcomingInput()
{
$next = $this->match;
if (strlen($next) < 20) {
$next .= substr($this->input, 0, 20 - strlen($next));
}
return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
}
protected function parseError($str, $hash)
{
throw new \Exception($str);
}
private function next()
{
if ($this->done) {
return $this->EOF;
}
if (!$this->input) {
$this->done = true;
}
$token = null;
$match = null;
$col = null;
$lines = null;
if (!$this->more) {
$this->yytext = '';
$this->match = '';
}
$rules = $this->getCurrentRules();
$rulesLen = count($rules);
for ($i=0; $i < $rulesLen; $i++) {
if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
preg_match_all('/\n.*/', $match[0], $lines);
$lines = $lines[0];
if ($lines) {
$this->yylineno += count($lines);
}
$this->yylloc = array(
'first_line' => $this->yylloc['last_line'],
'last_line' => $this->yylineno+1,
'first_column' => $this->yylloc['last_column'],
'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
);
$this->yytext .= $match[0];
$this->match .= $match[0];
$this->matches = $match;
$this->yyleng = strlen($this->yytext);
$this->more = false;
$this->input = substr($this->input, strlen($match[0]));
$this->matched .= $match[0];
$token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
if ($token) {
return $token;
}
return new Undefined();
}
}
if ($this->input === "") {
return $this->EOF;
}
$this->parseError(
'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
array(
'text' => "",
'token' => null,
'line' => $this->yylineno,
)
);
}
private function begin($condition)
{
$this->conditionStack[] = $condition;
}
private function popState()
{
return array_pop($this->conditionStack);
}
private function getCurrentRules()
{
return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
}
private function performAction($avoiding_name_collisions, $YY_START)
{
$YYSTATE = $YY_START;
switch ($avoiding_name_collisions) {
case 0:
break;
case 1:
return 6;
break;
case 2:
$this->yytext = substr($this->yytext, 1, $this->yyleng-2);
return 4;
case 3:
return 17;
case 4:
return 18;
case 5:
return 23;
case 6:
return 24;
case 7:
return 22;
case 8:
return 21;
case 9:
return 10;
case 10:
return 11;
case 11:
return 8;
case 12:
return 14;
case 13:
return 'INVALID';
}
}
}
<?php
namespace Seld\JsonLint;
class ParsingException extends \Exception
{
protected $details;
public function __construct($message, $details = array())
{
$this->details = $details;
parent::__construct($message);
}
public function getDetails()
{
return $this->details;
}
}
<?php
namespace JsonSchema\Constraints;
class Undefined extends Constraint
{
function check($value, $schema = null, $path = null, $i = null)
{
if (!is_object($schema)) {
return;
}
$path = $this->incrementPath($path, $i);
$this->validateCommonProperties($value, $schema, $path);
$this->validateTypes($value, $schema, $path, $i);
}
public function validateTypes($value, $schema = null, $path = null, $i = null)
{
if (is_array($value)) {
$this->checkArray($value, $schema, $path, $i);
}
if (is_object($value) && isset($schema->properties)) {
$this->checkObject($value, $schema->properties, $path, isset($schema->additionalProperties) ? $schema->additionalProperties : null);
}
if (is_string($value)) {
$this->checkString($value, $schema, $path, $i);
}
if (is_numeric($value)) {
$this->checkNumber($value, $schema, $path, $i);
}
if (isset($schema->enum)) {
$this->checkEnum($value, $schema, $path, $i);
}
}
protected function validateCommonProperties($value, $schema = null, $path = null, $i = null)
{
if (isset($schema->extends)) {
$this->checkUndefined($value, $schema->extends, $path, $i);
}
if (is_object($value) && $value instanceOf Undefined) {
if (isset($schema->required) && $schema->required) {
$this->addError($path, "is missing and it is required");
}
} else {
$this->checkType($value, $schema, $path);
}
if (isset($schema->disallow)) {
$initErrors = $this->getErrors();
$this->checkUndefined($value, $schema->disallow, $path);
if (count($this->getErrors()) == count($initErrors)) {
$this->addError($path, " disallowed value was matched");
} else {
$this->errors = $initErrors;
}
}
}
}<?php
namespace JsonSchema\Constraints;
class Type extends Constraint
{
function check($value = null, $schema = null, $path = null, $i = null)
{
$type = isset($schema->type) ? $schema->type : null;
$isValid = true;
if (is_array($type)) {
$validatedOneType = false;
$errors = array();
foreach ($type as $tp) {
$validator = new Type($this->checkMode);
$subSchema = new \stdClass();
$subSchema->type = $tp;
$validator->check($value, $subSchema, $path, null);
$error = $validator->getErrors();
if (!count($error)) {
$validatedOneType = true;
break;
} else {
$errors = $error;
}
}
if (!$validatedOneType) {
return $this->addErrors($errors);
}
} elseif (is_object($type)) {
$this->checkUndefined($value, $type, $path);
} else {
$isValid = $this->validateType($value, $type);
}
if ($isValid === false) {
$this->addError($path, gettype($value) . " value found, but a " . $type . " is required");
}
}
protected function validateType($value, $type)
{
if (!$type) {
return true;
}
switch ($type) {
case 'integer' :
return (integer)$value == $value ? true : is_int($value);
case 'number' :
return is_numeric($value);
case 'boolean' :
return is_bool($value);
case 'object' :
return is_object($value);
case 'array' :
return is_array($value);
case 'string' :
return is_string($value);
case 'null' :
return is_null($value);
case 'any' :
return true;
default:
throw new \InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is a invalid type for ' . $type);
}
}
}<?php
namespace JsonSchema\Constraints;
class Schema extends Constraint
{
public function check($element, $schema = null, $path = null, $i = null)
{
if ($schema !== null) {
$this->checkUndefined($element, $schema, '', '');
} elseif (isset($element->{$this->inlineSchemaProperty})) {
$this->checkUndefined($element, $element->{$this->inlineSchemaProperty}, '', '');
} else {
throw new \InvalidArgumentException('no schema found to verify against');
}
}
}<?php
namespace JsonSchema\Constraints;
class Number extends Constraint
{
public function check($element, $schema = null, $path = null, $i = null)
{
if (isset($schema->minimum) && $element < $schema->minimum) {
$this->addError($path, "must have a minimum value of " . $schema->minimum);
}
if (isset($schema->maximum) && $element > $schema->maximum) {
$this->addError($path, "must have a maximum value of " . $schema->maximum);
}
if (isset($schema->divisibleBy) && $element % $schema->divisibleBy != 0) {
$this->addError($path, "is not divisible by " . $schema->divisibleBy);
}
}
}<?php
namespace JsonSchema\Constraints;
class Object extends Constraint
{
function check($element, $definition = null, $path = null, $additionalProp = null)
{
$this->validateDefinition($element, $definition, $path);
$this->validateElement($element, $definition, $path, $additionalProp);
}
public function validateElement($element, $objectDefinition = null, $path = null, $additionalProp = null)
{
foreach ($element as $i => $value) {
$property = $this->getProperty($element, $i, new Undefined());
$definition = $this->getProperty($objectDefinition, $i);
if ($this->getProperty($definition, 'required') && !$property) {
$this->addError($path, "the property " . $i . " is required");
}
if ($additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
$this->addError($path, "The property " . $i . " is not defined and the definition does not allow additional properties");
}
if ($additionalProp && !$definition) {
$this->checkUndefined($value, $additionalProp, $path, $i);
}
$require = $this->getProperty($definition, 'requires');
if ($require && !$this->getProperty($element, $require)) {
$this->addError($path, "the presence of the property " . $i . " requires that " . $require . " also be present");
}
$this->checkUndefined($value, $definition ? : new \stdClass(), $path, $i);
}
}
public function validateDefinition($element, $objectDefinition = null, $path = null)
{
foreach ($objectDefinition as $i => $value) {
$property = $this->getProperty($element, $i, new Undefined());
$definition = $this->getProperty($objectDefinition, $i);
$this->checkUndefined($property, $definition, $path, $i);
}
}
protected function getProperty($element, $property, $fallback = null)
{
if (is_array($element) ) {
return array_key_exists($property, $element) ? $element[$property] : $fallback;
} else {
return isset($element->$property) ? $element->$property : $fallback;
}
}
}<?php
namespace JsonSchema\Constraints;
interface ConstraintInterface
{
function getErrors();
function addErrors(array $errors);
function addError($path, $message);
function isValid();
function check($value, $schema = null, $path = null, $i = null);
}<?php
namespace JsonSchema\Constraints;
abstract class Constraint implements ConstraintInterface
{
protected $checkMode = self::CHECK_MODE_NORMAL;
protected $errors = array();
protected $inlineSchemaProperty = '$schema';
const CHECK_MODE_NORMAL = 1;
const CHECK_MODE_TYPE_CAST = 2;
public function __construct($checkMode = self::CHECK_MODE_NORMAL)
{
$this->checkMode = $checkMode;
}
public function addError($path, $message)
{
$this->errors[] = array(
'property' => $path,
'message' => $message
);
}
public function addErrors(array $errors)
{
$this->errors = array_merge($this->errors, $errors);
}
public function getErrors()
{
return array_unique($this->errors, SORT_REGULAR);
}
protected function incrementPath($path, $i)
{
if ($path !== '') {
if (is_int($i)) {
$path .= '[' . $i . ']';
} else if ($i == '') {
$path .= '';
} else {
$path .= '.' . $i;
}
} else {
$path = $i;
}
return $path;
}
protected function checkArray($value, $schema = null, $path = null, $i = null)
{
$validator = new Collection($this->checkMode);
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
}
protected function checkObject($value, $schema = null, $path = null, $i = null)
{
$validator = new Object($this->checkMode);
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
}
protected function checkType($value, $schema = null, $path = null, $i = null)
{
$validator = new Type($this->checkMode);
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
}
protected function checkUndefined($value, $schema = null, $path = null, $i = null)
{
$validator = new Undefined($this->checkMode);
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
}
protected function checkString($value, $schema = null, $path = null, $i = null)
{
$validator = new String($this->checkMode);
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
}
protected function checkNumber($value, $schema = null, $path = null, $i = null)
{
$validator = new Number($this->checkMode);
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
}
protected function checkEnum($value, $schema = null, $path = null, $i = null)
{
$validator = new Enum($this->checkMode);
$validator->check($value, $schema, $path, $i);
$this->addErrors($validator->getErrors());
}
public function isValid()
{
return !$this->getErrors();
}
}<?php
namespace JsonSchema\Constraints;
class Collection extends Constraint
{
public function check($value, $schema = null, $path = null, $i = null)
{
if (isset($schema->minItems) && count($value) < $schema->minItems) {
$this->addError($path, "There must be a minimum of " . $schema->minItems . " in the array");
}
if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
$this->addError($path, "There must be a maximum of " . $schema->maxItems . " in the array");
}
if (isset($schema->uniqueItems) && array_unique($value) != $value) {
$this->addError($path, "There are no duplicates allowed in the array");
}
if (isset($schema->items)) {
$this->validateItems($value, $schema, $path, $i);
}
}
protected function validateItems($value, $schema = null, $path = null, $i = null)
{
if (!is_array($schema->items)) {
foreach ($value as $k => $v) {
$initErrors = $this->getErrors();
if (!isset($schema->additionalItems) || $schema->additionalItems === false) {
$this->checkUndefined($v, $schema->items, $path, $k);
}
if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
$secondErrors = $this->getErrors();
$this->checkUndefined($v, $schema->additionalItems, $path, $k);
}
if (isset($secondErrors) && count($secondErrors) < $this->getErrors()) {
$this->errors = $secondErrors;
} elseif (isset($secondErrors) && count($secondErrors) == count($this->getErrors())) {
$this->errors = $initErrors;
}
}
} else {
foreach ($value as $k => $v) {
if (array_key_exists($k, $schema->items)) {
$this->checkUndefined($v, $schema->items[$k], $path, $k);
} else {
if (array_key_exists('additionalItems', $schema) && $schema->additionalItems !== false) {
$this->checkUndefined($v, $schema->additionalItems, $path, $k);
} else {
$this->addError(
$path,
'The item ' . $i . '[' . $k . '] is not defined in the objTypeDef and the objTypeDef does not allow additional properties'
);
}
}
}
for ($k = count($value); $k < count($schema->items); $k++) {
$this->checkUndefined(new Undefined(), $schema->items[$k], $path, $k);
}
}
}
}<?php
namespace JsonSchema\Constraints;
class Enum extends Constraint
{
public function check($element, $schema = null, $path = null, $i = null)
{
foreach ($schema->enum as $possibleValue) {
if ($possibleValue == $element) {
$found = true;
break;
}
}
if (!isset($found)) {
$this->addError($path, "does not have a value in the enumeration " . implode(', ', $schema->enum));
}
}
}<?php
namespace JsonSchema\Constraints;
class String extends Constraint
{
public function check($element, $schema = null, $path = null, $i = null)
{
if (isset($schema->maxLength) && strlen($element) > $schema->maxLength) {
$this->addError($path, "must be at most " . $schema->maxLength . " characters long");
}
if (isset($schema->minLength) && strlen($element) < $schema->minLength) {
$this->addError($path, "must be at least " . $schema->minLength . " characters long");
}
if (isset($schema->pattern) && !preg_match('/' . $schema->pattern . '/', $element)) {
$this->addError($path, "does not match the regex pattern " . $schema->pattern);
}
}
}<?php
namespace JsonSchema;
use JsonSchema\Constraints\Schema;
use JsonSchema\Constraints\Constraint;
class Validator extends Constraint
{
function check($value, $schema = null, $path = null, $i = null)
{
$validator = new Schema($this->checkMode);
$validator->check($value, $schema);
$this->addErrors($validator->getErrors());
}
}<?php
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit661673363ffe50e6163cfd6e082b4d8d::getLoader();
<?php
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Symfony\\Component\\Process\\' => $vendorDir . '/symfony/process/',
'Symfony\\Component\\Finder' => $vendorDir . '/symfony/finder/',
'Symfony\\Component\\Console\\' => $vendorDir . '/symfony/console/',
'Seld\\JsonLint' => $vendorDir . '/seld/jsonlint/src/',
'JsonSchema' => $vendorDir . '/justinrainbow/json-schema/src/',
'Composer' => $baseDir . '/src/',
);
<?php
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
);
<?php
class ComposerAutoloaderInit661673363ffe50e6163cfd6e082b4d8d
{
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('ComposerAutoloaderInit661673363ffe50e6163cfd6e082b4d8d', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit661673363ffe50e6163cfd6e082b4d8d', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->add($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
$loader->register(true);
return $loader;
}
}
<?php
namespace Composer\Autoload;
class ClassLoader
{
private $prefixes = array();
private $fallbackDirs = array();
private $useIncludePath = false;
private $classMap = array();
public function getPrefixes()
{
return $this->prefixes;
}
public function getFallbackDirs()
{
return $this->fallbackDirs;
}
public function getClassMap()
{
return $this->classMap;
}
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirs = array_merge(
(array) $paths,
$this->fallbackDirs
);
} else {
$this->fallbackDirs = array_merge(
$this->fallbackDirs,
(array) $paths
);
}
return;
}
if (!isset($this->prefixes[$prefix])) {
$this->prefixes[$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixes[$prefix] = array_merge(
(array) $paths,
$this->prefixes[$prefix]
);
} else {
$this->prefixes[$prefix] = array_merge(
$this->prefixes[$prefix],
(array) $paths
);
}
}
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirs = (array) $paths;
return;
}
$this->prefixes[$prefix] = (array) $paths;
}
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
public function getUseIncludePath()
{
return $this->useIncludePath;
}
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
include $file;
return true;
}
}
public function findFile($class)
{
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if (false !== $pos = strrpos($class, '\\')) {
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
$className = substr($class, $pos + 1);
} else {
$classPath = null;
$className = $class;
}
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
foreach ($this->prefixes as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
}
}
foreach ($this->fallbackDirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) {
return $file;
}
return $this->classMap[$class] = false;
}
}
<?php
require __DIR__.'/../src/bootstrap.php';
use Composer\Console\Application;
error_reporting(-1);
if (function_exists('ini_set')) {
@ini_set('display_errors', 1);
$memoryInBytes = function ($value) {
$unit = strtolower(substr($value, -1, 1));
$value = (int) $value;
switch($unit) {
case 'g':
$value *= 1024;
// no break (cumulative multiplier)
case 'm':
$value *= 1024;
// no break (cumulative multiplier)
case 'k':
$value *= 1024;
}
return $value;
};
$memoryLimit = trim(ini_get('memory_limit'));
// Increase memory_limit if it is lower than 512M
if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 512 * 1024 * 1024) {
@ini_set('memory_limit', '512M');
}
unset($memoryInBytes, $memoryLimit);
}
// run the command application
$application = new Application();
$application->run();
Copyright (c) 2011 Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
���T��v�w�i/-Q�˲{
GBMB
<?php
return array(
// This should be an array of module namespaces used in the application.
'modules' => array(
'Application',
),
// These are various options for the listeners attached to the ModuleManager
'module_listener_options' => array(
// This should be an array of paths in which modules reside.
// If a string key is provided, the listener will consider that a module
// namespace, the value of that key the specific path to that module's
// Module class.
'module_paths' => array(
'./module',
'./vendor',
),
// An array of paths from which to glob configuration files after
// modules are loaded. These effectively override configuration
// provided by modules themselves. Paths may use GLOB_BRACE notation.
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
// Whether or not to enable a configuration cache.
// If enabled, the merged configuration will be cached and used in
// subsequent requests.
//'config_cache_enabled' => $booleanValue,
// The key used to create the configuration cache file name.
//'config_cache_key' => $stringKey,
// Whether or not to enable a module class map cache.
// If enabled, creates a module class map cache which will be used
// by in future requests, to reduce the autoloading process.
//'module_map_cache_enabled' => $booleanValue,
// The key used to create the class map cache file name.
//'module_map_cache_key' => $stringKey,
// The path in which to cache merged configuration.
//'cache_dir' => $stringPath,
// Whether or not to enable modules dependency checking.
// Enabled by default, prevents usage of modules that depend on other modules
// that weren't loaded.
// 'check_dependencies' => true,
),
// Used to create an own service manager. May contain one or more child arrays.
//'service_listener_options' => array(
// array(
// 'service_manager' => $stringServiceManagerName,
// 'config_key' => $stringConfigKey,
// 'interface' => $stringOptionalInterface,
// 'method' => $stringRequiredMethodName,
// ),
// )
// Initial configuration with which to seed the ServiceManager.
// Should be compatible with Zend\ServiceManager\Config.
// 'service_manager' => array(),
);
<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.
*/
return array(
// ...
);
<?php
/**
* Local Configuration Override
*
* This configuration override file is for overriding environment-specific and
* security-sensitive configuration information. Copy this file without the
* .dist extension at the end and populate values as needed.
*
* @NOTE: This file is ignored from Git by default with the .gitignore included
* in ZendSkeletonApplication. This is a good practice, as it prevents sensitive
* credentials from accidentally being committed into version control.
*/
return array(
// Whether or not to enable a configuration cache.
// If enabled, the merged configuration will be cached and used in
// subsequent requests.
//'config_cache_enabled' => false,
// The key used to create the configuration cache file name.
//'config_cache_key' => 'module_config_cache',
// The path in which to cache merged configuration.
//'cache_dir' => './data/cache',
// ...
);

About this directory:

By default, this application is configured to load all configs in ./config/autoload/{,*.}{global,local}.php. Doing this provides a location for a developer to drop in configuration override files provided by modules, as well as cleanly provide individual, application-wide config files for things like database connections, etc.

<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* This autoloading setup is really more complicated than it needs to be for most
* applications. The added complexity is simply to reduce the time it takes for
* new developers to be productive with a fresh skeleton. It allows autoloading
* to be correctly configured, regardless of the installation method and keeps
* the use of composer completely optional. This setup should work fine for
* most users, however, feel free to configure autoloading however you'd like.
*/
// Composer autoloading
if (file_exists('vendor/autoload.php')) {
$loader = include 'vendor/autoload.php';
}
$zf2Path = false;
if (is_dir('vendor/ZF2/library')) {
$zf2Path = 'vendor/ZF2/library';
} elseif (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment variable or git submodule
$zf2Path = getenv('ZF2_PATH');
} elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value
$zf2Path = get_cfg_var('zf2_path');
}
if ($zf2Path) {
if (isset($loader)) {
$loader->add('Zend', $zf2Path);
} else {
include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
Zend\Loader\AutoloaderFactory::factory(array(
'Zend\Loader\StandardAutoloader' => array(
'autoregister_zf' => true
)
));
}
}
if (!class_exists('Zend\Loader\AutoloaderFactory')) {
throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
}
Copyright (c) 2005-2013, Zend Technologies USA, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Zend Technologies USA, Inc. nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
127.0.0.1 - - [02/Aug/2013:19:52:38 +0300] "GET / HTTP/1.1" 200 4393 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:19:52:39 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 200 103314 "http://sklad.test/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:19:52:39 +0300] "GET /css/style.css HTTP/1.1" 200 1042 "http://sklad.test/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:19:52:39 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 200 16553 "http://sklad.test/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:19:52:39 +0300] "GET /js/jquery.min.js HTTP/1.1" 200 93069 "http://sklad.test/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:19:52:39 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 200 31596 "http://sklad.test/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:19:52:39 +0300] "GET /img/zf2-logo.png HTTP/1.1" 200 738 "http://sklad.test/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:19:52:39 +0300] "GET /img/favicon.ico HTTP/1.1" 200 1406 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:19:53:09 +0300] "GET / HTTP/1.1" 200 4393 "http://sklad.test/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:05:04 +0300] "GET / HTTP/1.1" 200 4393 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:05:04 +0300] "GET /css/style.css HTTP/1.1" 200 1042 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:05:04 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 200 16553 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:05:04 +0300] "GET /js/jquery.min.js HTTP/1.1" 200 93069 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:05:04 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 200 31596 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:05:04 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 200 103314 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:05:04 +0300] "GET /img/zf2-logo.png HTTP/1.1" 200 738 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:05:04 +0300] "GET /img/favicon.ico HTTP/1.1" 200 1406 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET / HTTP/1.1" 200 4376 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET / HTTP/1.1" 200 4376 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:39 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:51 +0300] "GET / HTTP/1.1" 200 4376 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:51 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:51 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:51 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:51 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:07:51 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:11:26 +0300] "GET / HTTP/1.1" 200 5006 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:11:26 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:11:26 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:11:26 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:11:26 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:11:26 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:11:26 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:11:36 +0300] "GET / HTTP/1.1" 200 5006 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:12:16 +0300] "GET /sdfsdf HTTP/1.1" 404 2159 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:12:46 +0300] "GET / HTTP/1.1" 200 5006 "http://sklad.dev/sdfsdf" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:18:42 +0300] "GET / HTTP/1.1" 200 5006 "http://sklad.dev/sdfsdf" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:18:42 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 200 67222 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:18:42 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:18:42 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:18:42 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:18:42 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 200 27242 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:18:42 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:37:35 +0300] "GET / HTTP/1.1" 500 - "http://sklad.dev/sdfsdf" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:37:35 +0300] "GET /favicon.ico HTTP/1.1" 500 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:38:18 +0300] "GET / HTTP/1.1" 200 5710 "http://sklad.dev/sdfsdf" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:38:19 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:38:19 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:38:19 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:38:19 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:38:19 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:38:19 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:38:31 +0300] "GET / HTTP/1.1" 200 5710 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:03 +0300] "GET / HTTP/1.1" 200 5710 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:03 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:03 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:03 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:03 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:03 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:03 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:05 +0300] "GET / HTTP/1.1" 200 5710 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:05 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:05 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:05 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:05 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:05 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:06 +0300] "GET / HTTP/1.1" 200 5710 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:06 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:06 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:06 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:06 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:06 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:40 +0300] "GET / HTTP/1.1" 200 5710 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:40 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:40 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:40 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:40 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:40 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET / HTTP/1.1" 200 5710 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET / HTTP/1.1" 200 5710 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:44:42 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:58:55 +0300] "GET / HTTP/1.1" 200 5080 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:58:57 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:58:57 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:58:57 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:58:57 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:58:57 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:20:58:57 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:06:54 +0300] "GET / HTTP/1.1" 200 5712 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:06:54 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:06:54 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:06:54 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:06:54 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:06:54 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:06:54 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:07:50 +0300] "GET / HTTP/1.1" 200 5712 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:07:50 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:07:50 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:07:50 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:07:50 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:07:50 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:13 +0300] "GET / HTTP/1.1" 200 5712 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:13 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:13 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:13 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:13 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:13 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:25 +0300] "GET / HTTP/1.1" 200 5698 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:26 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:26 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:26 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:26 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:26 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:38 +0300] "GET / HTTP/1.1" 200 5712 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:38 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:38 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:38 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:38 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:09:38 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:10:53 +0300] "GET / HTTP/1.1" 200 5539 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:10:53 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:10:53 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:10:53 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:10:53 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:10:53 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:10 +0300] "GET / HTTP/1.1" 200 5539 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:10 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:10 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:10 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:10 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:10 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:46 +0300] "GET / HTTP/1.1" 200 5737 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:46 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:46 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:46 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:46 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:12:46 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:15:30 +0300] "GET / HTTP/1.1" 200 5679 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:15:30 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:15:30 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:15:30 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:15:30 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:15:30 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:15:30 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:16:05 +0300] "GET / HTTP/1.1" 200 5629 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:16:05 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:16:05 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:16:05 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:16:05 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:16:05 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:21 +0300] "GET / HTTP/1.1" 200 4952 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:22 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:22 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:22 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:22 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:22 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:59 +0300] "GET / HTTP/1.1" 200 4952 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:59 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:59 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:59 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:59 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:18:59 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:00 +0300] "GET / HTTP/1.1" 200 4952 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:00 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:00 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:00 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:00 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:00 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:29 +0300] "GET / HTTP/1.1" 200 4950 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:29 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:29 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:29 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:29 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:29 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:38 +0300] "GET / HTTP/1.1" 200 4951 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:38 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:38 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:38 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:38 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:38 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:39 +0300] "GET / HTTP/1.1" 200 4951 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:39 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:39 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:39 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:39 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:20:39 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:23:55 +0300] "GET / HTTP/1.1" 200 4705 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:23:55 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:23:55 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:23:55 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:23:55 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:23:55 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:24 +0300] "GET / HTTP/1.1" 200 4459 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:24 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:24 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:24 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:24 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:24 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:24 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:31 +0300] "GET / HTTP/1.1" 200 4459 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:31 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:31 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:31 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:31 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:26:31 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:04 +0300] "GET / HTTP/1.1" 200 4448 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:04 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:04 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:04 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:04 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:04 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:21 +0300] "GET / HTTP/1.1" 200 4454 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:21 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:21 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:21 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:21 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:21 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:47 +0300] "GET / HTTP/1.1" 200 4403 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:47 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:47 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:47 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:47 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:27:47 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:38 +0300] "GET / HTTP/1.1" 200 5343 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:38 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:38 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:38 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:38 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:38 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:46 +0300] "GET / HTTP/1.1" 200 5343 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:46 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:46 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:46 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:46 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:46 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:52 +0300] "GET / HTTP/1.1" 200 5343 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:52 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:52 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:52 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:52 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:52 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:59 +0300] "GET / HTTP/1.1" 200 5343 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:59 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:59 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:59 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:59 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:30:59 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:17 +0300] "GET / HTTP/1.1" 200 5343 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:17 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:17 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:17 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:17 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:17 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:27 +0300] "GET / HTTP/1.1" 200 5344 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:27 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:27 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:27 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:27 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:31:27 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:06 +0300] "GET / HTTP/1.1" 200 5399 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:06 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:06 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:06 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:06 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:06 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:23 +0300] "GET / HTTP/1.1" 200 5393 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:23 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:23 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:23 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:23 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:34:23 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:19 +0300] "GET / HTTP/1.1" 200 5479 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:21 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:21 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:21 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:21 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:21 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:58 +0300] "GET / HTTP/1.1" 200 6074 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:58 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:58 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:58 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:58 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:58 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:36:59 +0300] "GET /img/favicon.ico HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:38:50 +0300] "GET / HTTP/1.1" 200 6044 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:38:50 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:38:50 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:38:50 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:38:50 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:38:50 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:36 +0300] "GET / HTTP/1.1" 200 6056 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:36 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:36 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:36 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:36 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:36 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:55 +0300] "GET / HTTP/1.1" 200 6072 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:55 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:55 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:55 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:55 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:43:55 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:44:36 +0300] "GET / HTTP/1.1" 200 6068 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:44:36 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:44:36 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:44:36 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:44:36 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:44:36 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:45:37 +0300] "GET / HTTP/1.1" 200 6076 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:45:37 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:45:37 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:45:37 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:45:37 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:45:37 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:46:35 +0300] "GET / HTTP/1.1" 200 6120 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:46:35 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:46:35 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:46:35 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:46:35 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:46:35 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:47:06 +0300] "GET / HTTP/1.1" 200 6125 "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:47:06 +0300] "GET /css/bootstrap.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:47:06 +0300] "GET /css/style.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:47:06 +0300] "GET /css/bootstrap-responsive.min.css HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:47:06 +0300] "GET /js/jquery.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
127.0.0.1 - - [02/Aug/2013:21:47:06 +0300] "GET /js/bootstrap.min.js HTTP/1.1" 304 - "http://sklad.dev/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31"
[Fri Aug 02 20:37:35.302686 2013] [:error] [pid 20907] [client 127.0.0.1:38467] PHP Fatal error: Uncaught exception 'Zend\\Mvc\\Router\\Exception\\RuntimeException' with message 'Route with name "about" not found' in /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Router/Http/TreeRouteStack.php:313\nStack trace:\n#0 /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/View/Helper/Url.php(102): Zend\\Mvc\\Router\\Http\\TreeRouteStack->assemble(Array, Array)\n#1 [internal function]: Zend\\View\\Helper\\Url->__invoke('about')\n#2 /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(400): call_user_func_array(Object(Zend\\View\\Helper\\Url), Array)\n#3 /home/lesha/Zend/ZF2/sklad.dev/module/Application/view/layout/layout.phtml(35): Zend\\View\\Renderer\\PhpRenderer->__call('url', Array)\n#4 /home/lesha/Zend/ZF2/sklad.dev/module/Application/view/layout/layout.phtml(35): Zend\\View\\Renderer\\PhpRenderer->url('about')\n#5 /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRender in /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Router/Http/TreeRouteStack.php on line 313, referer: http://sklad.dev/sdfsdf
[Fri Aug 02 20:37:35.530452 2013] [:error] [pid 20908] [client 127.0.0.1:38468] PHP Fatal error: Uncaught exception 'Zend\\Mvc\\Router\\Exception\\RuntimeException' with message 'Route with name "about" not found' in /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Router/Http/TreeRouteStack.php:313\nStack trace:\n#0 /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/View/Helper/Url.php(102): Zend\\Mvc\\Router\\Http\\TreeRouteStack->assemble(Array, Array)\n#1 [internal function]: Zend\\View\\Helper\\Url->__invoke('about')\n#2 /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(400): call_user_func_array(Object(Zend\\View\\Helper\\Url), Array)\n#3 /home/lesha/Zend/ZF2/sklad.dev/module/Application/view/layout/layout.phtml(35): Zend\\View\\Renderer\\PhpRenderer->__call('url', Array)\n#4 /home/lesha/Zend/ZF2/sklad.dev/module/Application/view/layout/layout.phtml(35): Zend\\View\\Renderer\\PhpRenderer->url('about')\n#5 /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRender in /home/lesha/Zend/ZF2/sklad.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Router/Http/TreeRouteStack.php on line 313
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
return array(
'router' => array(
'routes' => array(
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'index',
),
),
),
// The following is a route to simplify getting started creating
// new controllers and actions without needing to create a new
// module. Simply drop new controllers in, and you can access them
// using the path /application/:controller/:action
'application' => array(
'type' => 'Literal',
'options' => array(
'route' => '/application',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
),
),
'service_manager' => array(
'abstract_factories' => array(
'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
'Zend\Log\LoggerAbstractServiceFactory',
),
'aliases' => array(
'translator' => 'MvcTranslator',
),
),
'translator' => array(
'locale' => 'ru_RU',
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
'controllers' => array(
'invokables' => array(
'Application\Controller\Index' => 'Application\Controller\IndexController'
),
),
'view_manager' => array(
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => array(
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
),
'template_path_stack' => array(
__DIR__ . '/../view',
),
),
// Placeholder for console routes
'console' => array(
'router' => array(
'routes' => array(
),
),
),
);
Ю•ф%М`avЌўнґўіЗМЯя)1HWk ЂЊMЌ.Ы<
GgU~жФ»
2 WE *ќ 5И ю " M( v ” РҐ
v Ѓў%Ѕгщl pz?л=+(i’¬ 
  A 404 error occurredAdditional informationAll rights reserved.An error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.Discover ModulesExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportHomeIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsSkeleton ApplicationStack traceThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!Project-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2013-04-16 20:08-1900
PO-Revision-Date: 2013-04-16 20:08-1900
Last-Translator: Anas Al-Far <anas@al-far.com>
Language-Team: ZF Contibutors <zf-devteam@zend.com>
Language: Arabic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 16bit
X-Poedit-KeywordsList: translate
X-Poedit-Language: Arabic
X-Poedit-Country: JORDAN
X-Poedit-Basepath: .
X-Poedit-SearchPath-0: ..
Ш­ШЇШ« Ш®Ш·ШЈ 404Щ…Ш№Щ„Щ€Щ…Ш§ШЄ ШҐШ¶Ш§ЩЃЩЉШ©Ш¬Щ…ЩЉШ№ Ш§Щ„Ш­Щ‚Щ€Щ‚ Щ…Ш­ЩЃЩ€ШёШ© Щ„ЩЂ Ш­ШЇШ« Ш®Ш·ШЈ ШЈШ«Щ†Ш§ШЎ ШЄЩ†ЩЃЩЉШ° Ш§Щ„Ш№Щ…Щ„ЩЉШ©ШЄЩ‡Ш§Щ†ЩЉЩ†Ш§! Щ„Щ‚ШЇ Щ‚Щ…ШЄ ШЁШЄШ«ШЁЩЉШЄ %s Ш§Щ„ШЄШ·ШЁЩЉЩ‚ Ш§Щ„Щ‡ЩЉЩѓЩ„ЩЉ Щ„ЩЂ ZF2 %s ШЁЩ†Ш¬Ш§Ш­. ШЈЩ†ШЄ ШЄЩ‚Щ€Щ… Ш­Ш§Щ„ЩЉШ§ ШЁШЄШґШєЩЉЩ„ Ш§Щ„Щ†ШіШ®Ш© %s Щ…Щ† Zend Framework. ШЄШіШЄШ·ЩЉШ№ ШЈЩ† ШЄШіШЄШ№Щ…Щ„ Щ‡Ш°Ш§ Ш§Щ„ШЄШ·ШЁЩЉЩ‚ Ш§Щ„Щ‡ЩЉЩѓЩ„ЩЉ ЩѓЩ†Щ‚Ш·Ш© ШҐЩ†Ш·Щ„Ш§Щ‚ ШіЩ‡Щ„Ш© Щ„ШЁЩ†Ш§ШЎ Ш§Щ„ШЄШ·ШЁЩЉЩ‚ Ш§Щ„Ш®Ш§Шµ ШЁЩѓ ШЁШ§ШіШЄШ®ШЇШ§Щ… ZF2. ШҐЩѓШЄШґЩЃ Ш§Щ„Щ€Ш­ШЇШ§ШЄ Ш§Щ„ШЁШ±Щ…Ш¬ЩЉШ©Ш§ШіШЄШ№Ш±Ш¶ Ш§Щ„Щ€Ш­ШЇШ§ШЄ Ш§Щ„ШЁШ±Щ…Ш¬ЩЉШ© Щ„ЩЂ ZF2Щ…Щ„ЩЃШЄШ§ШЁШ№ Ш№Щ…Щ„ЩЉШ© Ш§Щ„ШЄШ·Щ€ЩЉШ±Щ‚Щ… ШЁШЄШ­Щ…ЩЉЩ„ ЩЃШ±Ш№ Ш¬ШЇЩЉШЇ Щ…Щ† Zend Framewok 2 Ш№Щ„Щ‰ Щ…Щ†ШµШ© GitHubШ§Щ„Щ…ШіШ§Ш№ШЇШ© Щ€Ш§Щ„ШЇШ№Щ…Ш§Щ„Ш±Ш¦ЩЉШіЩЉШ©ШҐШ°Ш§ ЩѓЩ†ШЄ ШЄШ­ШЄШ§Ш¬ ШҐЩ„Щ‰ Ш§Щ„Щ…ШіШ§Ш№ШЇШ© ШЈЩ€ Ш§Щ„ШЇШ№Щ… ШЈШ«Щ†Ш§ШЎ Ш§ШіШЄШ®ШЇШ§Щ…Щѓ ZF2ШЊ ЩЉЩ…ЩѓЩ†Щѓ Ш§Щ„Ш§ШЄШµШ§Щ„ ШЁЩ†Ш§ Щ…Щ† Ш®Щ„Ш§Щ„ ШґШЁЩѓШ© IRC: %s#zftalk Ш№Щ„Щ‰ ШіЩЉШ±ЩЃШ± Freenode%s. ШіЩ€ЩЃ Щ†ЩѓЩ€Щ† ШіШ№ЩЉШЇЩЉЩ† Ш¬ШЇШ§ ШЁШ§Щ„Ш§ШіШЄЩ…Ш§Ш№ ШҐЩ„Щ‰ ШЈЩЉ ШіШ¤Ш§Щ„ ШЈЩ€ Щ…Щ„Ш§Ш­ШёШ© Щ„ШЇЩЉЩѓ Ш­Щ€Щ„ Ш§Щ„Щ†ШіШ® Ш§Щ„ШЄШ¬Ш±ЩЉШЁЩЉШ©. Щ€Щ…Щ† Ш¬Щ‡Ш© ШЈШ®Ш±Щ‰ШЊ ШЄШіШЄШ·ЩЉШ№ ШЈЩ† ШЄШґШЄШ±Щѓ Щ€ШЄШ±ШіЩ„ ШЈШіШ¦Щ„ШЄЩѓ ШҐЩ„Щ‰ %sШ§Щ„Щ‚Ш§Ш¦Щ…Ш© Ш§Щ„ШЁШ±ЩЉШЇЩЉШ©%s. Ш±ШіШ§Щ„Ш©Щ„Щ… ЩЉШ­ШЇШ« Ш§ШіШЄШ«Щ†Ш§ШЎШ§ШЄШ§ШЄШµЩ„ ШЁЩ†Ш§ Ш№Щ„Щ‰ IRCШ§Щ„Ш§ШіШЄШ«Щ†Ш§ШЎШ§ШЄ Ш§Щ„ШіШ§ШЁЩ‚Ш©ШЄШ·ШЁЩЉЩ‚ Щ‡ЩЉЩѓЩ„ЩЉШЄШЄШЁШ№ Ш§Щ„Ш­ШЇШ«ШҐЩ† Щ…Ш¬ШЄЩ…Ш№ Ш§Щ„Щ…ШЁШ±Щ…Ш¬ЩЉЩ† Ш§Щ„Щ…Ш­ШЄШ±ЩЃЩЉЩ† ЩЉШ№Щ…Щ„ Ш§Щ„ШўЩ† Ш№Щ„Щ‰ ШЄШ·Щ€ЩЉШ± Щ…Щ€Щ‚Ш№ Ш®Ш§Шµ ШЁЩ‡Щ… Щ„ЩЉШ®ШЇЩ… ЩѓЩ…ШµШЇШ± Щ„Щ€Ш­ШЇШ§ШЄ ZF2 Ш§Щ„ШЁШ±Щ…Ш¬ЩЉШ©. Ш§Щ„Щ…ШґШ±Щ€Ш№ Щ…ШЄЩ€ЩЃШ± Ш№Щ„Щ‰ Щ…Щ†ШµШ© %sGitHub%s. ШҐЩ† Ш§Щ„Щ…Щ€Щ‚Ш№ Щ…ШЄЩ€ЩЃШ± Ш§Щ„ШўЩ† Щ€ЩЉШ­ШЄЩ€ЩЉ Ш№Щ„Щ‰ ШЁШ№Ш¶ Ш§Щ„Щ€Ш­ШЇШ§ШЄ Ш§Щ„ШЁШ±Щ…Ш¬ЩЉШ© Ш§Щ„Ш¬Ш§Щ‡ШІШ© Щ„Щ„Ш§ШіШЄШ®ШЇШ§Щ… ЩЃЩЉ ZF2.Щ„Щ… ЩЉШіШЄШ·Ш№ ZF2 Щ…Щ† Щ…Ш·Ш§ШЁЩ‚Ш© Щ€Ш­ШЇШ© Ш§Щ„ШЄШ­ЩѓЩ… Ш§Щ„Щ…Ш·Щ„Щ€ШЁШ© ШЁШ§Щ„Щ…ШµЩ†ЩЃШ§ШЄ Ш§Щ„Щ…Щ€Ш¬Щ€ШЇШ©Щ„Щ… ЩЉШЄЩ… Щ…Ш·Ш§ШЁЩ‚Ш© Щ€Ш­ШЇШ© Ш§Щ„ШЄШ­ЩѓЩ… Ш§Щ„Щ…Ш·Щ„Щ€ШЁШ©Щ„Щ… ШЄШіШЄШ·Ш№ Щ€Ш­ШЇШ© Ш§Щ„ШЄШ­ЩѓЩ… Щ…Ш№Ш§Щ„Ш¬Ш© Ш§Щ„Ш·Щ„ШЁШЈЩ‡Щ„Ш§ ШЁЩѓ ЩЃЩЉ %sZend Framework 2%sШЁЩ€Ш§ШЁШ© ШЄШ·Щ€ЩЉШ± ZF2ШҐЩ† Ш№Щ…Щ„ЩЉШ© ШЄШ·Щ€ЩЉШ± Щ…Щ†ШёЩ€Щ…Ш© Zend Framework 2 Щ†ШґШ·Ш© Ш¬ШЇШ§. ШҐШ°Ш§ ЩѓЩ†ШЄ Щ…Щ‡ШЄЩ…Ш§ ШЁЩ…ШЄШ§ШЁШ№Ш© Ш№Щ…Щ„ЩЉШ© Ш§Щ„ШЄШ·Щ€ЩЉШ± Щ„Щ…Щ†ШёЩ€Щ…Ш© ZF2ШЊ ЩЃЩ‡Щ†Ш§Щѓ ШЁЩ€Ш§ШЁШ© Ш®Ш§ШµШ© ШЁЩЂ ZF2 Ш№Щ„Щ‰ Ш§Щ„Щ…Щ€Щ‚Ш№ Ш§Щ„Ш±ШіЩ…ЩЉ Щ„ЩЂ Zend Framework Щ€Ш§Щ„Ш°ЩЉ ЩЉШ­ШЄЩ€ЩЉ Ш№Щ„Щ‰ Щ€ШµЩ„Ш§ШЄ Ш®Ш§ШµШ© Щ„ЩЂ %sЩ€ЩЉЩѓЩЉШЁЩЉШЇЩЉШ§%sШЊ %sЩ…ШЇЩ€Щ†Ш© Ш§Щ„Щ…Ш·Щ€Ш±ЩЉЩ†%sШЊ %sЩ…ШЄШ§ШЁШ№Ш© Ш§Щ„Щ…ШґШ§ЩѓЩ„%sШЊ Щ€ШєЩЉШ±Щ‡Ш§ ЩѓШ«ЩЉШ±. ШҐЩ†Щ‡ Щ…ШµШЇШ± Щ…Щ…ЩЉШІ ЩЉШЁЩ‚ЩЉЩѓ Ш№Щ„Щ‰ Ш§Ш·Щ„Ш§Ш№ ШЁШўШ®Ш± Щ…ШіШЄШ¬ШЇШ§ШЄ Ш№Щ…Щ„ЩЉШ© Ш§Щ„ШЄШ·Щ€ЩЉШ±.
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-16 20:08-1900\n"
"PO-Revision-Date: 2013-04-16 20:08-1900\n"
"Last-Translator: Anas Al-Far <anas@al-far.com>\n"
"Language-Team: ZF Contibutors <zf-devteam@zend.com>\n"
"Language: Arabic\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 16bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Language: Arabic\n"
"X-Poedit-Country: JORDAN\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../view/layout/layout.phtml:6
#: ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr "تطبيق هيكلي"
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr "الرئيسية"
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr "جميع الحقوق محفوظة لـ "
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr "أهلا بك في %sZend Framework 2%s"
#: ../view/application/index/index.phtml:3
#, php-format
msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2."
msgstr "تهانينا! لقد قمت بتثبيت %s التطبيق الهيكلي لـ ZF2 %s بنجاح. أنت تقوم حاليا بتشغيل النسخة %s من Zend Framework. تستطيع أن تستعمل هذا التطبيق الهيكلي كنقطة إنطلاق سهلة لبناء التطبيق الخاص بك باستخدام ZF2. "
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr "قم بتحميل فرع جديد من Zend Framewok 2 على منصة GitHub"
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr "تابع عملية التطوير"
#: ../view/application/index/index.phtml:11
#, php-format
msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!"
msgstr "إن عملية تطوير منظومة Zend Framework 2 نشطة جدا. إذا كنت مهتما بمتابعة عملية التطوير لمنظومة ZF2، فهناك بوابة خاصة بـ ZF2 على الموقع الرسمي لـ Zend Framework والذي يحتوي على وصلات خاصة لـ %sويكيبيديا%s، %sمدونة المطورين%s، %sمتابعة المشاكل%s، وغيرها كثير. إنه مصدر مميز يبقيك على اطلاع بآخر مستجدات عملية التطوير."
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr "بوابة تطوير ZF2"
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr "إكتشف الوحدات البرمجية"
#: ../view/application/index/index.phtml:17
#, php-format
msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2."
msgstr "إن مجتمع المبرمجين المحترفين يعمل الآن على تطوير موقع خاص بهم ليخدم كمصدر لوحدات ZF2 البرمجية. المشروع متوفر على منصة %sGitHub%s. إن الموقع متوفر الآن ويحتوي على بعض الوحدات البرمجية الجاهزة للاستخدام في ZF2."
#: ../view/application/index/index.phtmlمl:18
msgid "Explore ZF2 Modules"
msgstr "استعرض الوحدات البرمجية لـ ZF2"
#: ../view/application/index/index.phtml:22
msgid "Help &amp; Support"
msgstr "المساعدة والدعم"
#: ../view/application/index/index.phtml:23
#, php-format
msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s."
msgstr "إذا كنت تحتاج إلى المساعدة أو الدعم أثناء استخدامك ZF2، يمكنك الاتصال بنا من خلال شبكة IRC: %s#zftalk على سيرفر Freenode%s. سوف نكون سعيدين جدا بالاستماع إلى أي سؤال أو ملاحظة لديك حول النسخ التجريبية. ومن جهة أخرى، تستطيع أن تشترك وترسل أسئلتك إلى %sالقائمة البريدية%s. "
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr "اتصل بنا على IRC"
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr "حدث خطأ أثناء تنفيذ العملية"
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr "معلومات إضافية"
#: ../view/error/index.phtml:11
#: ../view/error/index.phtml:35
msgid "File"
msgstr "ملف"
#: ../view/error/index.phtml:15
#: ../view/error/index.phtml:39
msgid "Message"
msgstr "رسالة"
#: ../view/error/index.phtml:19
#: ../view/error/index.phtml:43
#: ../view/error/404.phtml:55
msgid "Stack trace"
msgstr "تتبع الحدث"
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr "الاستثناءات السابقة"
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr "لم يحدث استثناءات"
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr "حدث خطأ 404"
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr "لم تستطع وحدة التحكم معالجة الطلب"
#: ../view/error/404.phtml:13
msgid "The requested controller could not be mapped to an existing controller class."
msgstr "لم يستطع ZF2 من مطابقة وحدة التحكم المطلوبة بالمصنفات الموجودة"
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr "لم يتم مطابقة وحدة التحكم المطلوبة"
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr ""
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr ""
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr ""
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr ""
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr ""
Ю• +ИЙЮх
н
 &0DI\|Џ”¦®ЕФи э 2
M=.‹<є9ч1QUhѕ юН 4М  "" E "Y | Њ ­ ї Ь г +0PУnBQe‚ µBН?qPDВJYR(¬2Хv
   A 404 error occurredAdditional informationAll rights reserved.An error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.ControllerDiscover ModulesExceptionExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportHomeIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsSkeleton ApplicationStack traceThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested URL could not be matched by routing.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.We cannot determine at this time why a 404 was generated.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!resolves to %sProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-05 22:17-0700
PO-Revision-Date: 2012-07-07 13:58+0300
Last-Translator: Tawfek Daghistani <tawfekov@gmail.com>
Language-Team: Arabic <>
Language:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-KeywordsList: translate
X-Poedit-Language: English
X-Poedit-Country: UNITED STATES
X-Poedit-Basepath: .
X-Poedit-SearchPath-0: ..
Plural-Forms: nplurals=2; plural=(n!=1);
Ш­ШµЩ„ Ш®Ш·ШЈ 404 , Ш§Щ„ШµЩЃШ­Ш© ШєЩЉШ± Щ…Щ€Ш¬Щ€ШЇШ©Щ…ШІЩЉШЇ Щ…Щ† Ш§Щ„Щ…Ш№Щ„Щ€Щ…Ш§ШЄШ¬Щ…ЩЉШ№ Ш§Щ„Ш­Щ‚Щ€Щ‚ Щ…Ш­ЩЃЩ€ШёШ©Ш­ШµЩ„ Ш®Ш·ШЈ Щ…Ш§ ШЄЩ‡Ш§Щ†ЩЉЩ†Ш§! Щ„Щ‚ШЇ Щ‚Щ…ШЄ ШЁШЄЩ†ШµЩЉШЁ %sZF2 Skeleton Application%s . ШЈЩ†ШЄ Ш§Щ„ШўЩ† ШЄШіШЄШ®ШЇЩ… Щ…ЩѓШЄШЁШ© ШІЩЉЩ†ШЇ Ш§Щ„ШҐШµШЇШ§Ш± %s . Щ‡Ш°Ш§ Ш§Щ„ШЄШ·ШЁЩЉЩ‚ ЩЉЩ…ЩѓЩ† ШЈЩ† ЩЉЩѓЩ€Щ† Щ„Щѓ Щ†Щ‚Ш·Ш© ШЁШЇШ§ЩЉШ© ШіЩ‡Щ„Ш© ЩЃЩЉ ШЁЩ†Ш§ШЎ ШЁШ±Ш§Щ…Ш¬Щѓ Ш§Щ„Ш®Ш§ШµШ© Ш№Щ„Щ‰ Щ…ЩѓШЄШЁШ© ШІЩЉЩ†ШЇ Ш§Щ„Щ…ШЄШ­ЩѓЩ… ШЄШ№Ш±ЩЃ Ш№Щ„Щ‰ Ш§Щ„ШҐШ¶Ш§ЩЃШ§ШЄШ®Ш·ШЈ ШЁШ±Щ…Ш¬ЩЉШҐЩѓШЄШґЩЃ ШҐШ¶Ш§ЩЃШ§ШЄ ZF2 Щ…Щ„ЩЃШЄШ§ШЁШ№ ШЈШ®Ш± Ш§Щ„ШЄШ·Щ€Ш±Ш§ШЄШ§ШґШЄЩ‚ Щ…ЩѓШЄШЁШ© ШІЩЉЩ†ШЇ Ш№Щ„Щ‰ GitHub Ш§Щ„ШЇШ№Щ… Щ€ Ш§Щ„Щ…ШіШ§Ш№ШЇШ© Ш§Щ„ШµЩЃШ­Ш© Ш§Щ„Ш±Ш¦ЩЉШіЩЉШ©ШҐШ°Ш§ ЩѓЩ†ШЄ ШЄШ±ЩЉШЇ Ш§Щ„Ш­ШµЩ€Щ„ Ш№Щ„Щ‰ ШЇШ№Щ… ЩЃЩ†ЩЉ ШЈЩ€ Щ…ШіШ§Ш№ШЇШ© ЩЃЩЉ ШЄШ·Щ€ЩЉШ± ZF2 , ШЁШҐЩ…ЩѓШ§Щ†Щѓ Ш§Щ„ШЄЩ€Ш§ШµЩ„ Ш№ШЁШ± IRC: %s#zftalk on Freenode%s. Щ†Ш­Щ† Щ†Ш±ЩЉШЇ ШЈЩ† Щ†ШіЩ…Ш№ Щ…Щ†Щѓ Ш§Щ„Щ…ШІЩЉШЇ Щ…Щ† Ш§Щ„ШЈШіШ¦Щ„Ш© , Ш§Щ„ШЈШ±Ш§ШЎ Щ€ Ш§Щ„Щ…Щ„Ш§Ш­ШёШ§ШЄ Ш№Щ„Щ‰ Ш§Щ„Щ†ШіШ®Ш© Ш§Щ„ШЄШ¬Ш±ШЁЩЉШ© Щ…Щ† Ш§Щ„Щ…ЩѓШЄШЁШ© , ШЈЩ€ ШЁШҐЩ…ЩѓШ§Щ†Щѓ Ш§Щ„ШҐШґШЄШ±Ш§Щѓ Щ€ Ш§Щ„ШЄЩЃШ§Ш№Щ„ ШЈЩ€ Щ€Ш¶Ш№ Ш§Щ„ШЈШіШ¦Щ„Ш© ЩЃЩЉ Ш§Щ„Щ‚Ш§Ш¦Щ…Ш© Ш§Щ„ШЁШ±ЩЉШЇЩЉШ© %smailing lists%s.Ш§Щ„Ш±ШіШ§Щ„Ш©Щ„Ш§ЩЉЩ€Ш¬ШЇ Ш®Ш·ШЈШЄЩ€Ш§ШµЩ„ Щ…Ш№Щ†Ш§ ЩЃЩЉ IRCШ§Щ„ШЈШ®Ш·Ш§ШЎ Ш§Щ„ШіШ§ШЁЩ‚Ш©Skeleton ApplicationШЄЩЃШ§ШµЩЉЩ„ Ш§Щ„Ш®Ш·ШЈШ§Щ„Щ…Ш¬ШЄЩ…Ш№ Ш§Щ„ШЁШ±Щ…Ш¬ЩЉ ЩЉШ№Щ…Щ„ Ш№Щ„Щ‰ ШЄШ·Щ€ЩЉШ± Щ…Щ€Щ‚Ш№ Ш®Ш§Шµ ШЁЩ‡ Щ„ЩЉЩѓЩ€Щ† ЩѓЩ…ШµШЇШ± Щ€ Щ…Ш№Ш±Ш¶ Щ„ШҐШ¶Ш§ЩЃШ§ШЄ ZF2 . Щ‡Ш°Ш§ Ш§Щ„Щ…ШґШ±Щ€Ш№ Щ…Щ€Ш¬Щ€ШЇ Ш№Щ„Щ‰ %son GitHub%s . Щ‡Ш°Ш§ Ш§Щ„Щ…Щ€Щ‚Ш№ ЩЉШ®Ш¶Ш№ Щ„Щ„ШЄШ·Щ€ЩЉШ± Ш§Щ„Щ…ШіШЄЩ…Ш± Щ€ ЩЉШ­ШЄЩ€ЩЉ Ш№Щ„Щ‰ Щ‚Ш§Ш¦Щ…Ш© Щ…Щ† Ш§Щ„ШҐШ¶Ш§ЩЃШ§ШЄ Ш§Щ„Ш®Ш§ШµШ© ШЁ ZF2 Ш§Щ„Ш±Ш§ШЁШ· Ш§Щ„Щ…Ш·Щ„Щ€ШЁ ШєЩЉШ± Щ…Ш№Ш±ЩЃ Щ„ШЇЩ‰ Ш§Щ„Щ…Щ€Ш¬Щ‡Щ„Ш§ ЩЉЩ…ЩѓЩ† Ш±ШЁШ· Ш§Щ„Щ…ШЄШ­ЩѓЩ… Ш§Щ„Щ…Ш·Щ„Щ€ШЁ ШЁШЈЩЉ Щ…Щ† Ш§Щ„Щ…ШЄШ­ЩѓЩ…Ш§ШЄ Ш§Щ„Щ…Щ€Ш¬Щ€ШЇШ© Ш­Ш§Щ„ЩЉШ§Щ‹ЩЋШ§Щ„Щ…ШЄШ­ЩѓЩ… Ш§Щ„Щ…Ш·Щ„Щ€ШЁ ШєЩЉШ± Щ‚Ш§ШЇШ± Ш№Щ„Щ‰ Ш§Щ„ШҐШ¬Ш§ШЁШ© Ш§Щ„Щ…ШЄШ­ЩѓЩ… Ш§Щ„Щ…Ш·Щ„Щ€ШЁ ШєЩЉШ± Щ‚Ш§ШЇШ± Ш№Щ„Щ‰ ШҐШ¬Ш§ШЁШ© Ш§Щ„Ш·Щ„ШЁЩ„Ш§ ЩЉЩ…ЩѓЩ†Щ†ЩЉ Ш§Щ„ШЄШ­ШЇЩЉШЇ Щ„Щ…Ш§Ш°Ш§ Ш­ШµЩ„ Ш§Щ„Ш®Ш·ШЈ 404 ЩЃЩЉ Щ‡Ш°Ш§ Ш§Щ„Щ€Щ‚ШЄ ШЈЩ‡Щ„Ш§ ШЁЩѓ ЩЃЩЉ %sZend Framework 2%sШЁЩ€Ш§ШЁШ© Ш§Щ„ШЄШ·Щ€ЩЉШ± Ш§Щ„Ш®Ш§ШµШ© ШЁ ШІЩЉЩ†ШЇЩ…ЩѓШЄШЁШ© ШІЩЉЩ†ШЇ ШЄШ®Ш¶Ш№ Щ„Щ„ШЄШ·Щ€ЩЉШ± Ш§Щ„Щ…ШіШЄЩ…Ш± , ШҐШ°Ш§ ЩѓШ§Щ† Щ„ШЇЩЉЩѓ Ш§Щ„Ш±ШєШЁШ© ЩЃЩЉ Щ…ШЄШ§ШЁШ№Ш© Ш§Щ„ШЄШ·Щ€Ш±Ш§ШЄ , ШЁШҐЩ…ЩѓШ§Щ†Щѓ ШЄШµЩЃШ­ Ш§Щ„Щ…Щ€Щ‚Ш№ Ш§Щ„Ш±ШіЩ…ЩЉ Щ„Щ„Щ…ЩѓШЄШЁШ© Ш§Щ„Ш°ЩЉ ЩЉШ­ШЄЩ€ЩЉ Ш№Щ„Щ‰ Ш±Щ€Ш§ШЁШ· ШҐЩ„Щ‰ %swiki%s, %sdev blog%s, %sissue tracker%s, ,Щ€ Ш§Щ„Щ…ШІЩЉШЇ . Щ‡Ш°Щ‡ Щ…ШµШ§ШЇШ± Ш±Ш§Ш¦Ш№Ш© Щ„Щ…ШЄШ§ШЁШ№Ш© ШЈШ®Ш± Ш§Щ„ШЄШ·Щ€Ш±Ш§ШЄЩЉЩ€ШµЩ„ ШҐЩ„Щ‰ %s
#
# tawfek daghistani <tawfekov@gmail.com>, 2012.
# Tawfek Daghistani <tawfekov@gmail.com>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 22:17-0700\n"
"PO-Revision-Date: 2012-07-07 13:58+0300\n"
"Last-Translator: Tawfek Daghistani <tawfekov@gmail.com>\n"
"Language-Team: Arabic <>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Language: English\n"
"X-Poedit-Country: UNITED STATES\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"
"Plural-Forms: nplurals=2; plural=(n!=1);\n"
#: ../view/layout/layout.phtml:6 ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr "Skeleton Application"
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr "الصفحة الرئيسية"
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr "جميع الحقوق محفوظة"
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr "أهلا بك في %sZend Framework 2%s"
#: ../view/application/index/index.phtml:3
#, php-format
msgid ""
"Congratulations! You have successfully installed the %sZF2 Skeleton "
"Application%s. You are currently running Zend Framework version %s. This "
"skeleton can serve as a simple starting point for you to begin building your "
"application on ZF2."
msgstr ""
"تهانينا! لقد قمت بتنصيب %sZF2 Skeleton Application%s . أنت الآن تستخدم مكتبة "
"زيند الإصدار %s . هذا التطبيق يمكن أن يكون لك نقطة بداية سهلة في بناء "
"برامجك الخاصة على مكتبة زيند "
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr "اشتق مكتبة زيند على GitHub "
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr "تابع أخر التطورات"
#: ../view/application/index/index.phtml:11
#, php-format
msgid ""
"Zend Framework 2 is under active development. If you are interested in "
"following the development of ZF2, there is a special ZF2 portal on the "
"official Zend Framework website which provides links to the ZF2 %swiki%s, "
"%sdev blog%s, %sissue tracker%s, and much more. This is a great resource for "
"staying up to date with the latest developments!"
msgstr ""
"مكتبة زيند تخضع للتطوير المستمر , إذا كان لديك الرغبة في متابعة التطورات , "
"بإمكانك تصفح الموقع الرسمي للمكتبة الذي يحتوي على روابط إلى %swiki%s, %sdev "
"blog%s, %sissue tracker%s, ,و المزيد . هذه مصادر رائعة لمتابعة أخر التطورات"
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr "بوابة التطوير الخاصة ب زيند"
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr "تعرف على الإضافات"
#: ../view/application/index/index.phtml:17
#, php-format
msgid ""
"The community is working on developing a community site to serve as a "
"repository and gallery for ZF2 modules. The project is available %son GitHub"
"%s. The site is currently live and currently contains a list of some of the "
"modules already available for ZF2."
msgstr ""
"المجتمع البرمجي يعمل على تطوير موقع خاص به ليكون كمصدر و معرض لإضافات ZF2 . "
"هذا المشروع موجود على %son GitHub%s . هذا الموقع يخضع للتطوير المستمر و "
"يحتوي على قائمة من الإضافات الخاصة ب ZF2 "
#: ../view/application/index/index.phtml:18
msgid "Explore ZF2 Modules"
msgstr "إكتشف إضافات ZF2 "
#: ../view/application/index/index.phtml:22
msgid "Help &amp; Support"
msgstr "الدعم و المساعدة "
#: ../view/application/index/index.phtml:23
#, php-format
msgid ""
"If you need any help or support while developing with ZF2, you may reach us "
"via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or "
"feedback you may have regarding the beta releases. Alternatively, you may "
"subscribe and post questions to the %smailing lists%s."
msgstr ""
"إذا كنت تريد الحصول على دعم فني أو مساعدة في تطوير ZF2 , بإمكانك التواصل عبر "
"IRC: %s#zftalk on Freenode%s. نحن نريد أن نسمع منك المزيد من الأسئلة , "
"الأراء و الملاحظات على النسخة التجربية من المكتبة , أو بإمكانك الإشتراك و "
"التفاعل أو وضع الأسئلة في القائمة البريدية %smailing lists%s."
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr "تواصل معنا في IRC"
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr "حصل خطأ ما "
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr "مزيد من المعلومات"
#: ../view/error/index.phtml:11 ../view/error/index.phtml:35
msgid "File"
msgstr "ملف"
#: ../view/error/index.phtml:15 ../view/error/index.phtml:39
msgid "Message"
msgstr "الرسالة"
#: ../view/error/index.phtml:19 ../view/error/index.phtml:43
#: ../view/error/404.phtml:55
msgid "Stack trace"
msgstr "تفاصيل الخطأ"
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr "الأخطاء السابقة"
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr "لايوجد خطأ"
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr "حصل خطأ 404 , الصفحة غير موجودة"
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr "المتحكم المطلوب غير قادر على إجابة الطلب"
#: ../view/error/404.phtml:13
msgid ""
"The requested controller could not be mapped to an existing controller class."
msgstr "لا يمكن ربط المتحكم المطلوب بأي من المتحكمات الموجودة حالياًَ"
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr "المتحكم المطلوب غير قادر على الإجابة "
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr "الرابط المطلوب غير معرف لدى الموجه"
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr "لا يمكنني التحديد لماذا حصل الخطأ 404 في هذا الوقت "
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr "المتحكم "
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr "يوصل إلى %s"
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr "خطأ برمجي"
Ю• +ИЙЮх
н
 &0DI\|Џ”¦®ЕФи э 2
M=.‹<є9ч1QUhѕ оН ј Т д я 
  . 7 O V f † љ P  с#щ4I%[иЃFj^±N4_E”Ъъaw
   A 404 error occurredAdditional informationAll rights reserved.An error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.ControllerDiscover ModulesExceptionExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportHomeIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsSkeleton ApplicationStack traceThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested URL could not be matched by routing.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.We cannot determine at this time why a 404 was generated.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!resolves to %sProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-05 22:17-0700
PO-Revision-Date: 2012-07-06 13:05+0100
Last-Translator: David Lukas <david.lukas@zfdaily.com>
Language-Team: ZF Contibutors <zf-devteam@zend.com>
Language:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-KeywordsList: translate
X-Poedit-Language: Czech
X-Poedit-Country: CZECH REPUBLIC
X-Poedit-Basepath: .
X-Poedit-SearchPath-0: ..
Vyskytla se chyba 404DalЕЎГ­ informaceVЕЎechna prГЎva vyhrazena.Vyskytla se chybaBlahopЕ™ejeme! ГљspД›ЕЎnД› jste nainstalovali %sZF2 Skeleton Application%s. PrГЎvД› pouЕѕГ­vГЎte Zend Framework verze %s. Tato kostra aplikace vГЎm poslouЕѕГ­ jako jednoduchГЅ vГЅchozГ­ bod, ze kterГ©ho mЕЇЕѕete vyjГ­t pЕ™i tvorbД› vlastnГ­ aplikace nad ZF2.ControllerObjevte ModulyVГЅjimkaProzkoumejte Moduly ZF2SouborSledujte vГЅvojFork Zend Framework 2 na GitHubPomoc &amp; PodporaГљvodBudete-li pЕ™i vГЅvoji se ZF2 potЕ™ebovat jakoukoli pomoc nebo podporu, mЕЇЕѕete nГЎs zastihnout pЕ™es IRC: %s#zftalk na Freenode%s. Budeme rГЎdi za jakГ©koli vaЕЎe otГЎzky nebo pЕ™ipomГ­nky tГЅkajГ­cГ­ se beta verzГ­. PЕ™Г­padnД› se takГ© mЕЇЕѕete pЕ™ihlГЎsit k odbД›ru a posГ­lat otГЎzky na naЕЎe %se-mailovГ© distribuДЌnГ­ seznamy%s.ZprГЎvaЕЅГЎdnГЎ vГЅjimka nenГ­ k dispoziciOzvД›te se nГЎm na IRCPЕ™edchozГ­ vГЅjimkySkeleton aplikaceTrasovГЎnГ­ zГЎsobnГ­ku (Stack trace)Komunita pracuje na vГЅvoji komunitnГ­ho webu, kterГЅ bude slouЕѕit jako archiv a galerie modulЕЇ ZF2. Tento projekt je dostupnГЅ %sna GitHub%s. Web je aktuГЎlnД› v provozu a obsahuje seznam nД›kterГЅch jiЕѕ dostupnГЅch modulЕЇ ZF2.S poЕѕadovanГЅm URL nebyla pЕ™i smД›rovГЎnГ­ (routing) nalezena shoda.PoЕѕadovanГЅ controller se nepodaЕ™ilo namapovat na ЕѕГЎdnou existujГ­cГ­ tЕ™Г­du controlleru.PoЕѕadovanГЅ controller nepodporuje vyЕ™Г­zenГ­ (controller not dispatchable).PoЕѕadovanГЅ controller nemohl vyЕ™Г­dit poЕѕadavek.MomentГЎlnД› nedokГЎЕѕeme urДЌit, proДЌ byla vygenerovГЎna chyba 404.VГ­tejte v %sZend Framework 2%sVГЅvojГЎЕ™skГЅ portГЎl ZF2Zend Framework 2 je aktivnД› vyvГ­jen. Chcete-li sledovat vГЅvoj ZF2, mГЎte na oficiГЎlnГ­ch webovГЅch strГЎnkГЎch Zend Framework k dispozici zvlГЎЕЎtnГ­ portГЎl ZF2, na kterГ©m najdete odkazy na ZF2 %swiki%s, %svГЅvojГЎЕ™skГЅ blog%s, %sissue tracker%s a mnoho dalЕЎГ­ho. Tento portГЎl je skvД›lГЅ zdroj aktuГЎlnГ­ch informacГ­ o nejnovД›jЕЎГ­m vГЅvoji!je mapovГЎn na %s
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 22:17-0700\n"
"PO-Revision-Date: 2012-07-06 13:05+0100\n"
"Last-Translator: David Lukas <david.lukas@zfdaily.com>\n"
"Language-Team: ZF Contibutors <zf-devteam@zend.com>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Language: Czech\n"
"X-Poedit-Country: CZECH REPUBLIC\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../view/layout/layout.phtml:6
#: ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr "Skeleton aplikace"
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr "Úvod"
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr "Všechna práva vyhrazena."
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr "Vítejte v %sZend Framework 2%s"
#: ../view/application/index/index.phtml:3
#, php-format
msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2."
msgstr "Blahopřejeme! Úspěšně jste nainstalovali %sZF2 Skeleton Application%s. Právě používáte Zend Framework verze %s. Tato kostra aplikace vám poslouží jako jednoduchý výchozí bod, ze kterého můžete vyjít při tvorbě vlastní aplikace nad ZF2."
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr "Fork Zend Framework 2 na GitHub"
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr "Sledujte vývoj"
#: ../view/application/index/index.phtml:11
#, php-format
msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!"
msgstr "Zend Framework 2 je aktivně vyvíjen. Chcete-li sledovat vývoj ZF2, máte na oficiálních webových stránkách Zend Framework k dispozici zvláštní portál ZF2, na kterém najdete odkazy na ZF2 %swiki%s, %svývojářský blog%s, %sissue tracker%s a mnoho dalšího. Tento portál je skvělý zdroj aktuálních informací o nejnovějším vývoji!"
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr "Vývojářský portál ZF2"
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr "Objevte Moduly"
#: ../view/application/index/index.phtml:17
#, php-format
msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2."
msgstr "Komunita pracuje na vývoji komunitního webu, který bude sloužit jako archiv a galerie modulů ZF2. Tento projekt je dostupný %sna GitHub%s. Web je aktuálně v provozu a obsahuje seznam některých již dostupných modulů ZF2."
#: ../view/application/index/index.phtml:18
msgid "Explore ZF2 Modules"
msgstr "Prozkoumejte Moduly ZF2"
#: ../view/application/index/index.phtml:22
msgid "Help &amp; Support"
msgstr "Pomoc &amp; Podpora"
#: ../view/application/index/index.phtml:23
#, php-format
msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s."
msgstr "Budete-li při vývoji se ZF2 potřebovat jakoukoli pomoc nebo podporu, můžete nás zastihnout přes IRC: %s#zftalk na Freenode%s. Budeme rádi za jakékoli vaše otázky nebo připomínky týkající se beta verzí. Případně se také můžete přihlásit k odběru a posílat otázky na naše %se-mailové distribuční seznamy%s."
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr "Ozvěte se nám na IRC"
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr "Vyskytla se chyba"
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr "Další informace"
#: ../view/error/index.phtml:11
#: ../view/error/index.phtml:35
msgid "File"
msgstr "Soubor"
#: ../view/error/index.phtml:15
#: ../view/error/index.phtml:39
msgid "Message"
msgstr "Zpráva"
#: ../view/error/index.phtml:19
#: ../view/error/index.phtml:43
#: ../view/error/404.phtml:55
msgid "Stack trace"
msgstr "Trasování zásobníku (Stack trace)"
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr "Předchozí výjimky"
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr "Žádná výjimka není k dispozici"
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr "Vyskytla se chyba 404"
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr "Požadovaný controller nemohl vyřídit požadavek."
#: ../view/error/404.phtml:13
msgid "The requested controller could not be mapped to an existing controller class."
msgstr "Požadovaný controller se nepodařilo namapovat na žádnou existující třídu controlleru."
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr "Požadovaný controller nepodporuje vyřízení (controller not dispatchable)."
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr "S požadovaným URL nebyla při směrování (routing) nalezena shoda."
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr "Momentálně nedokážeme určit, proč byla vygenerována chyba 404."
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr "Controller"
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr "je mapován na %s"
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr "Výjimka"
Ю•) °±ЖЭтн
тэ ,1Ddw|Ћ–­ј РЬ2ЭM.^<Ќ9К$U;‘ б  ‚ ќ ¶ П к
ч    8 > T u
‰ z”  8TgzHѓNМ0MLaљ&ь#І9м  
 A 404 error occurredAdditional informationAll rights reserved.An error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.ControllerDiscover ModulesExceptionExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportHomeIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsStack traceThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested URL could not be matched by routing.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.We cannot determine at this time why a 404 was generated.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!resolves to %sProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-05 23:45-0700
PO-Revision-Date: 2012-07-06 08:18-0700
Last-Translator: Evan Coury <me@evancoury.com>
Language-Team: ZF Contributors <zf-devteam@zend.com>
Language:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-KeywordsList: translate
X-Poedit-Basepath: .
X-Poedit-Language: German
X-Poedit-Country: GERMANY
X-Poedit-SearchPath-0: ..
Es trat ein 404 Fehler aufZusätzliche InformationAlle Rechte vorbehalten.Ein Fehler ist aufgetretenHerzlichen Glückwunsch! Sie haben die %sZF2 Skeleton Application%s erfolgreich installiert und benutzen gerade die Version %s des Zend Frameworks. Dieses Gerüst kann Ihnen als Einstiegspunkt, für Ihre weitere Entwicklung, basierend auf dem Zend Framework 2, dienen.ControllerEntdecken Sie ModuleAusnahmeErkunden Sie ZF2 ModuleDateiFolge der EntwicklungFork Zend Framework 2 auf GitHubHilfe &amp; SupportStartseiteSollten Sie Hilfe jeglicher Art bei der Entwicklung mit dem Zend Framework 2 benötigen, kontaktieren Sie uns doch einfach über das IRC: %s#zftalk on Freenode%s. Wir freuen uns darauf, Ihnen bei Ihren Fragen zu helfen oder aber auch Ihre Meinung bezüglich der Beta Versionen zu hören. Alternativ können Sie auch die %smailing lists%s abonnieren und Ihre Fragen dort stellen.MeldungEs ist keine Ausnahme verfügbarSchreiben Sie uns im IRC anVorherige AusnahmeStapelüberwachungDie Community arbeitet momentan an einer Community Seite, welche als Galerie für ZF2 Module dient. Dieses Projekt ist %sauf GitHub%s verfügbar. Die Webseite ist bereits Online und enthält eine Liste mit schon veröffentlichten Modulen für das Zend Framework 2.Für die angeforderte URL konnte keine Übereinstimmung gefunden werden.Der angeforderte Controller konnte keiner Controller Klasse zugeordnet werden.Der angeforderte Controller ist nicht aufrufbar.Der angeforderte Controller war nicht in der Lage die Anfrage zu verarbeiten.Zu diesem Zeitpunkt ist es uns nicht möglich zu bestimmen, warum ein 404 Fehler aufgetreten ist.Willkommen zu dem %sZend Framework 2%sZF2 Entwickler PortalDas Zend Framework 2 wird z.Z. aktiv weiterentwickelt. Sollten Sie daran interessiert sein, die Entwicklung von ZF2 zu verfolgen, so bietet Ihnen die offizielle Webseite einen eigens für das Zend Framework 2 eingerichteten Bereich, auf der Sie Verlinkungen zum ZF2 %sWiki%s, %sEntwickler Blog%s, einem %sFehlerverfolgungssystem%s und noch vielem mehr finden. Dieser Bereich ist eine hervorragende Quelle um stets aktuell zu bleiben.wird aufgelöst in %s
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 23:45-0700\n"
"PO-Revision-Date: 2012-07-06 08:18-0700\n"
"Last-Translator: Evan Coury <me@evancoury.com>\n"
"Language-Team: ZF Contributors <zf-devteam@zend.com>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: German\n"
"X-Poedit-Country: GERMANY\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../view/layout/layout.phtml:6
#: ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr ""
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr "Startseite"
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr "Alle Rechte vorbehalten."
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr "Willkommen zu dem %sZend Framework 2%s"
#: ../view/application/index/index.phtml:3
#, php-format
msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2."
msgstr "Herzlichen Glückwunsch! Sie haben die %sZF2 Skeleton Application%s erfolgreich installiert und benutzen gerade die Version %s des Zend Frameworks. Dieses Gerüst kann Ihnen als Einstiegspunkt, für Ihre weitere Entwicklung, basierend auf dem Zend Framework 2, dienen."
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr "Fork Zend Framework 2 auf GitHub"
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr "Folge der Entwicklung"
#: ../view/application/index/index.phtml:11
#, php-format
msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!"
msgstr "Das Zend Framework 2 wird z.Z. aktiv weiterentwickelt. Sollten Sie daran interessiert sein, die Entwicklung von ZF2 zu verfolgen, so bietet Ihnen die offizielle Webseite einen eigens für das Zend Framework 2 eingerichteten Bereich, auf der Sie Verlinkungen zum ZF2 %sWiki%s, %sEntwickler Blog%s, einem %sFehlerverfolgungssystem%s und noch vielem mehr finden. Dieser Bereich ist eine hervorragende Quelle um stets aktuell zu bleiben."
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr "ZF2 Entwickler Portal"
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr "Entdecken Sie Module"
#: ../view/application/index/index.phtml:17
#, php-format
msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2."
msgstr "Die Community arbeitet momentan an einer Community Seite, welche als Galerie für ZF2 Module dient. Dieses Projekt ist %sauf GitHub%s verfügbar. Die Webseite ist bereits Online und enthält eine Liste mit schon veröffentlichten Modulen für das Zend Framework 2."
#: ../view/application/index/index.phtml:18
msgid "Explore ZF2 Modules"
msgstr "Erkunden Sie ZF2 Module"
#: ../view/application/index/index.phtml:22
msgid "Help &amp; Support"
msgstr "Hilfe &amp; Support"
#: ../view/application/index/index.phtml:23
#, php-format
msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s."
msgstr "Sollten Sie Hilfe jeglicher Art bei der Entwicklung mit dem Zend Framework 2 benötigen, kontaktieren Sie uns doch einfach über das IRC: %s#zftalk on Freenode%s. Wir freuen uns darauf, Ihnen bei Ihren Fragen zu helfen oder aber auch Ihre Meinung bezüglich der Beta Versionen zu hören. Alternativ können Sie auch die %smailing lists%s abonnieren und Ihre Fragen dort stellen."
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr "Schreiben Sie uns im IRC an"
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr "Ein Fehler ist aufgetreten"
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr "Zusätzliche Information"
#: ../view/error/index.phtml:11
#: ../view/error/index.phtml:35
msgid "File"
msgstr "Datei"
#: ../view/error/index.phtml:15
#: ../view/error/index.phtml:39
msgid "Message"
msgstr "Meldung"
#: ../view/error/index.phtml:19
#: ../view/error/index.phtml:43
#: ../view/error/404.phtml:55
msgid "Stack trace"
msgstr "Stapelüberwachung"
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr "Vorherige Ausnahme"
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr "Es ist keine Ausnahme verfügbar"
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr "Es trat ein 404 Fehler auf"
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr "Der angeforderte Controller war nicht in der Lage die Anfrage zu verarbeiten."
#: ../view/error/404.phtml:13
msgid "The requested controller could not be mapped to an existing controller class."
msgstr "Der angeforderte Controller konnte keiner Controller Klasse zugeordnet werden."
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr "Der angeforderte Controller ist nicht aufrufbar."
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr "Für die angeforderte URL konnte keine Übereinstimmung gefunden werden."
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr "Zu diesem Zeitpunkt ist es uns nicht möglich zu bestimmen, warum ein 404 Fehler aufgetreten ist."
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr "Controller"
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr "wird aufgelöst in %s"
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr "Ausnahme"
Ю•,<P QЛ^*Program nameProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-05 22:17-0700
PO-Revision-Date: 2013-08-02 21:06+0300
Last-Translator: Evan Coury <me@evancoury.com>
Language-Team: ZF Contibutors <zf-devteam@zend.com>
Language: en_US
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-KeywordsList: translate
X-Poedit-Basepath: .
X-Generator: Poedit 1.5.4
X-Poedit-SearchPath-0: ..
Store
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 22:17-0700\n"
"PO-Revision-Date: 2013-08-02 21:06+0300\n"
"Last-Translator: Evan Coury <me@evancoury.com>\n"
"Language-Team: ZF Contibutors <zf-devteam@zend.com>\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.5.4\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../view/layout/layout.phtml:6 ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr ""
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr ""
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr ""
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr ""
#: ../view/application/index/index.phtml:3
#, php-format
msgid ""
"Congratulations! You have successfully installed the %sZF2 Skeleton "
"Application%s. You are currently running Zend Framework version %s. This "
"skeleton can serve as a simple starting point for you to begin building your "
"application on ZF2."
msgstr ""
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr ""
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr ""
#: ../view/application/index/index.phtml:11
#, php-format
msgid ""
"Zend Framework 2 is under active development. If you are interested in "
"following the development of ZF2, there is a special ZF2 portal on the "
"official Zend Framework website which provides links to the ZF2 %swiki%s, "
"%sdev blog%s, %sissue tracker%s, and much more. This is a great resource for "
"staying up to date with the latest developments!"
msgstr ""
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr ""
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr ""
#: ../view/application/index/index.phtml:17
#, php-format
msgid ""
"The community is working on developing a community site to serve as a "
"repository and gallery for ZF2 modules. The project is available %son GitHub"
"%s. The site is currently live and currently contains a list of some of the "
"modules already available for ZF2."
msgstr ""
#: ../view/application/index/index.phtml:18
msgid "Explore ZF2 Modules"
msgstr ""
#: ../view/application/index/index.phtml:22
msgid "Help &amp; Support"
msgstr ""
#: ../view/application/index/index.phtml:23
#, php-format
msgid ""
"If you need any help or support while developing with ZF2, you may reach us "
"via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or "
"feedback you may have regarding the beta releases. Alternatively, you may "
"subscribe and post questions to the %smailing lists%s."
msgstr ""
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr ""
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr ""
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr ""
#: ../view/error/index.phtml:11 ../view/error/index.phtml:35
msgid "File"
msgstr ""
#: ../view/error/index.phtml:15 ../view/error/index.phtml:39
msgid "Message"
msgstr ""
#: ../view/error/index.phtml:19 ../view/error/index.phtml:43
#: ../view/error/404.phtml:55
msgid "Stack trace"
msgstr ""
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr ""
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr ""
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr ""
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr ""
#: ../view/error/404.phtml:13
msgid ""
"The requested controller could not be mapped to an existing controller class."
msgstr ""
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr ""
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr ""
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr ""
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr ""
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr ""
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr ""
msgid "Program name"
msgstr "Store"
Ю• +ИЙЮх
н
 &0DI\|Џ”¦®ЕФи э 2
M=.‹<є9ч1QUhѕ зН µ О е  ъ
 
0 ; X ` ,u ў ¶ MЅ  %9Of$|'Ў<ЙS+Z8†=ї"э t=І
   A 404 error occurredAdditional informationAll rights reserved.An error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.ControllerDiscover ModulesExceptionExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportHomeIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsSkeleton ApplicationStack traceThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested URL could not be matched by routing.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.We cannot determine at this time why a 404 was generated.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!resolves to %sProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-06 19:07+0100
PO-Revision-Date: 2012-07-06 19:09+0100
Last-Translator: Adolfo Abegg <adolfoabegg@gmail.com>
Language-Team: ZF Contributors <zf-devteam@zend.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Language:
X-Poedit-KeywordsList: translate
X-Poedit-Basepath: .
X-Poedit-Language: Spanish
X-Poedit-Country: SPAIN
X-Poedit-SearchPath-0: ..
Ha ocurrido un error 404InformaciГіn adicionalTodos los derechos reservadosHa ocurrido un errorВЎFelicitaciones! Haz instalado correctamente el %sla aplicaciГіn esqueleto del ZF2%s. EstГЎs corriendo la versiГіn %s del Zend Framework. Este esqueleto te servirГЎ como un punto de inicio sencillo para empezar a construir tu aplicaciГіn con el ZF2.ControllerDescubre MГіdulosExcepciГіnExplora los mГіdulos del ZF2ArchivoSeguir el DesarrolloHacer un Fork del Zend Framework 2 en GitHubAyuda &amp; SoporteInicioSi necesitas alguna ayuda o soporte mientras estГЎs desarrollando con el ZF2, puedes encontrarnos via IRC: %s#zftalk en Freenode%s. Nos encantarГ­a leer tus preguntas o cualquier feedback que puedas tener en relaciГіn a los lanzamientos de las versiones beta. TambiГ©n puedes subscribirte y enviar preguntas %sa la lista de correos%sMensajeNo hay ninguna ExcepciГіn disponible.EscrГ­benos en el IRCExcepciones anterioresAplicaciГіn EsqueletoSeguimiento de la pila (stack trace)La comunidad estГЎ trabajando en el desarrollo de una web comunitaria que servirГЎ de repositorio y galerГ­a de los mГіdulos del ZF2. El proyecto estГЎ disponible %sen GitHub%s. El sitio web estГЎ en lГ­nea y actualmente posee una lista de algunos mГіdulos que ya estГЎn disponibles para el ZF2.El ruteador no ha encontrado la ruta para la URL solicitada.El controlador solicitado no se pudo mapear con una clase de controlador existente.El controlador solicitado no es ejecutable.El controlador solicitado no pudo ejecutar la peticiГіn.No pudimos determinar por quГ© un error 404 ha sido generado.Bienvenido al %sZend Framework 2%sPortal de Desarrollo del ZF2El Zend Framework 2 estГЎ en pleno desarrollo. Si estГЎs interesado en seguir el desarrollo del ZF2, existe un portal especial para el ZF2 en el sitio web oficial del Zend Framework el cual provee enlaces %sa la Wiki%s, %sal Blog de desarrollo%s, %sal issue tracker%s y mucho mГЎs. Este es un gran recurso para mantenerte al dГ­a con los Гєltimos avances en el desarrollo!se resuelve a %s
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-06 19:07+0100\n"
"PO-Revision-Date: 2012-07-06 19:09+0100\n"
"Last-Translator: Adolfo Abegg <adolfoabegg@gmail.com>\n"
"Language-Team: ZF Contributors <zf-devteam@zend.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: Spanish\n"
"X-Poedit-Country: SPAIN\n"
"X-Poedit-SearchPath-0: ..\n"
msgid "Skeleton Application"
msgstr "Aplicación Esqueleto"
msgid "Home"
msgstr "Inicio"
msgid "All rights reserved."
msgstr "Todos los derechos reservados"
msgid "Welcome to %sZend Framework 2%s"
msgstr "Bienvenido al %sZend Framework 2%s"
msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2."
msgstr "¡Felicitaciones! Haz instalado correctamente el %sla aplicación esqueleto del ZF2%s. Estás corriendo la versión %s del Zend Framework. Este esqueleto te servirá como un punto de inicio sencillo para empezar a construir tu aplicación con el ZF2."
msgid "Fork Zend Framework 2 on GitHub"
msgstr "Hacer un Fork del Zend Framework 2 en GitHub"
msgid "Follow Development"
msgstr "Seguir el Desarrollo"
msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!"
msgstr "El Zend Framework 2 está en pleno desarrollo. Si estás interesado en seguir el desarrollo del ZF2, existe un portal especial para el ZF2 en el sitio web oficial del Zend Framework el cual provee enlaces %sa la Wiki%s, %sal Blog de desarrollo%s, %sal issue tracker%s y mucho más. Este es un gran recurso para mantenerte al día con los últimos avances en el desarrollo!"
msgid "ZF2 Development Portal"
msgstr "Portal de Desarrollo del ZF2"
msgid "Discover Modules"
msgstr "Descubre Módulos"
msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2."
msgstr "La comunidad está trabajando en el desarrollo de una web comunitaria que servirá de repositorio y galería de los módulos del ZF2. El proyecto está disponible %sen GitHub%s. El sitio web está en línea y actualmente posee una lista de algunos módulos que ya están disponibles para el ZF2."
msgid "Explore ZF2 Modules"
msgstr "Explora los módulos del ZF2"
msgid "Help &amp; Support"
msgstr "Ayuda &amp; Soporte"
msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s."
msgstr "Si necesitas alguna ayuda o soporte mientras estás desarrollando con el ZF2, puedes encontrarnos via IRC: %s#zftalk en Freenode%s. Nos encantaría leer tus preguntas o cualquier feedback que puedas tener en relación a los lanzamientos de las versiones beta. También puedes subscribirte y enviar preguntas %sa la lista de correos%s"
msgid "Ping us on IRC"
msgstr "Escríbenos en el IRC"
msgid "An error occurred"
msgstr "Ha ocurrido un error"
msgid "Additional information"
msgstr "Información adicional"
msgid "File"
msgstr "Archivo"
msgid "Message"
msgstr "Mensaje"
msgid "Stack trace"
msgstr "Seguimiento de la pila (stack trace)"
msgid "Previous exceptions"
msgstr "Excepciones anteriores"
msgid "No Exception available"
msgstr "No hay ninguna Excepción disponible."
msgid "A 404 error occurred"
msgstr "Ha ocurrido un error 404"
msgid "The requested controller was unable to dispatch the request."
msgstr "El controlador solicitado no pudo ejecutar la petición."
msgid "The requested controller could not be mapped to an existing controller class."
msgstr "El controlador solicitado no se pudo mapear con una clase de controlador existente."
msgid "The requested controller was not dispatchable."
msgstr "El controlador solicitado no es ejecutable."
msgid "The requested URL could not be matched by routing."
msgstr "El ruteador no ha encontrado la ruta para la URL solicitada."
msgid "We cannot determine at this time why a 404 was generated."
msgstr "No pudimos determinar por qué un error 404 ha sido generado."
msgid "Controller"
msgstr "Controller"
msgid "resolves to %s"
msgstr "se resuelve a %s"
msgid "Exception"
msgstr "Excepción"
Ю• +ИЙЮх
н
 &0DI\|Џ”¦®ЕФи э 2
M=.‹<є9ч1QUhѕ ШН ¦ В а ш    6 @ Y a -z Ё » GГ  /F_t$†;«Nз069gSЎ#х$Ѓ> А
   A 404 error occurredAdditional informationAll rights reserved.An error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.ControllerDiscover ModulesExceptionExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportHomeIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsSkeleton ApplicationStack traceThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested URL could not be matched by routing.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.We cannot determine at this time why a 404 was generated.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!resolves to %sProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-06 01:46-0500
PO-Revision-Date: 2012-07-06 02:08-0500
Last-Translator: EBB Dev <me@email.com>
Language-Team: ZF Contibutors <zf-devteam@zend.com>
Language:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-KeywordsList: translate
X-Poedit-Language: French
X-Poedit-Country: CANADA
X-Poedit-Basepath: .
X-Poedit-SearchPath-0: ..
Une erreur 404 est survenueInformations complГ©mentairesTous droits rГ©servГ©s.Une erreur est survenueFГ©licitations ! Vous avez installГ© %sZF2 Skeleton Application%s avec succГЁs. Vous utilisez actuellement Zend Framework version %s. Cette structure peut vous servir comme point de dГ©part simple pour dГ©marrer la construction de votre application avec ZF2.ContrГґleurDГ©couvrez les modulesExceptionExplorer les modules ZF2FichierSuivre le dГ©veloppementFaites un Fork de Zend Framework 2 sur GitHubAide &amp; supportAccueilSi vous avez besoin d'aide ou de soutient en dГ©veloppant avec ZF2, vous pouvez nous joindre sur IRC : %s#zftalk sur Freenode%s. Nous aimerions connaГ®tre vos questions ou les commentaires que vous pourriez avoir au sujet des versions beta. Sinon, vous pouvez vous abonner, et poser des questions sur la %sliste de diffusion%s.MessageAucune exception disponibleRejoignez-nous sur IRCExceptions prГ©cГ©dentesSkeleton ApplicationPile d'exГ©cutionLa communautГ© travaille sur le dГ©veloppement d'un site communautaire avec l'objectif de servir de dГ©pГґt et de galerie pour les modules ZF2. Le projet est disponible %ssur GitHub%s. Le site est dГ©jГ  en ligne, et contient une liste non exhaustive des modules dГ©jГ  disponibles pour ZF2.L'URL demandГ©e n'a pas pu trouver de route correspondante.Le contrГґleur demandГ© ne correspond pas Г  une classe contrГґleur existante.Le contrГґleur demandГ© ne peut ГЄtre acheminГ©.Le contrГґleur demandГ© n'a pas pu acheminer la requГЄte.Nous ne pouvons pas dГ©terminer pour le moment pourquoi une 404 a Г©tГ© gГ©nГ©rГ©e.Bienvenue dans %sZend Framework 2%sPortail sur le dГ©veloppement de ZF2Zend Framework 2 est en cours de dГ©veloppement. Si vous ГЄtes intГ©ressГ© pour suivre l'Г©volution de ZF2, il existe un portail dГ©diГ© Г  ZF2 sur le site officiel Zend Framework qui propose des liens vers le %swiki%s ZF2, le %sblogue de dev%s, le %ssuivi des problГЁmes%s, et bien plus encore. Il s'agit d'une excellente ressource pour rester Г  jour sur les derniГЁres Г©volutions !rГ©sout en %s
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-06 01:46-0500\n"
"PO-Revision-Date: 2012-07-06 02:08-0500\n"
"Last-Translator: EBB Dev <me@email.com>\n"
"Language-Team: ZF Contibutors <zf-devteam@zend.com>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Language: French\n"
"X-Poedit-Country: CANADA\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr "Une erreur 404 est survenue"
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr "Le contrôleur demandé n'a pas pu acheminer la requête."
#: ../view/error/404.phtml:13
msgid "The requested controller could not be mapped to an existing controller class."
msgstr "Le contrôleur demandé ne correspond pas à une classe contrôleur existante."
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr "Le contrôleur demandé ne peut être acheminé."
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr "L'URL demandée n'a pas pu trouver de route correspondante."
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr "Nous ne pouvons pas déterminer pour le moment pourquoi une 404 a été générée."
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr "Contrôleur"
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr "résout en %s"
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr "Exception"
#: ../view/error/404.phtml:55
#: ../view/error/index.phtml:19
#: ../view/error/index.phtml:43
msgid "Stack trace"
msgstr "Pile d'exécution"
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr "Une erreur est survenue"
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr "Informations complémentaires"
#: ../view/error/index.phtml:11
#: ../view/error/index.phtml:35
msgid "File"
msgstr "Fichier"
#: ../view/error/index.phtml:15
#: ../view/error/index.phtml:39
msgid "Message"
msgstr "Message"
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr "Exceptions précédentes"
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr "Aucune exception disponible"
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr "Bienvenue dans %sZend Framework 2%s"
#: ../view/application/index/index.phtml:3
#, php-format
msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2."
msgstr "Félicitations ! Vous avez installé %sZF2 Skeleton Application%s avec succès. Vous utilisez actuellement Zend Framework version %s. Cette structure peut vous servir comme point de départ simple pour démarrer la construction de votre application avec ZF2."
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr "Faites un Fork de Zend Framework 2 sur GitHub"
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr "Suivre le développement"
#: ../view/application/index/index.phtml:11
#, php-format
msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!"
msgstr "Zend Framework 2 est en cours de développement. Si vous êtes intéressé pour suivre l'évolution de ZF2, il existe un portail dédié à ZF2 sur le site officiel Zend Framework qui propose des liens vers le %swiki%s ZF2, le %sblogue de dev%s, le %ssuivi des problèmes%s, et bien plus encore. Il s'agit d'une excellente ressource pour rester à jour sur les dernières évolutions !"
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr "Portail sur le développement de ZF2"
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr "Découvrez les modules"
#: ../view/application/index/index.phtml:17
#, php-format
msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2."
msgstr "La communauté travaille sur le développement d'un site communautaire avec l'objectif de servir de dépôt et de galerie pour les modules ZF2. Le projet est disponible %ssur GitHub%s. Le site est déjà en ligne, et contient une liste non exhaustive des modules déjà disponibles pour ZF2."
#: ../view/application/index/index.phtml:18
msgid "Explore ZF2 Modules"
msgstr "Explorer les modules ZF2"
#: ../view/application/index/index.phtml:22
msgid "Help &amp; Support"
msgstr "Aide &amp; support"
#: ../view/application/index/index.phtml:23
#, php-format
msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s."
msgstr "Si vous avez besoin d'aide ou de soutient en développant avec ZF2, vous pouvez nous joindre sur IRC : %s#zftalk sur Freenode%s. Nous aimerions connaître vos questions ou les commentaires que vous pourriez avoir au sujet des versions beta. Sinon, vous pouvez vous abonner, et poser des questions sur la %sliste de diffusion%s."
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr "Rejoignez-nous sur IRC"
#: ../view/layout/layout.phtml:6
#: ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr "Skeleton Application"
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr "Accueil"
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr "Tous droits réservés."
Ю• +ИЙЮх
н
 &0DI\|Џ”¦®ЕФи э 2
M=.‹<є9ч1QUhѕ ЯН ­ Й з я  , C M f n -‡ µ И BР 7Ng|$Ћ;іQп/A:qS¬&$'vL Г
   A 404 error occurredAdditional informationAll rights reserved.An error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.ControllerDiscover ModulesExceptionExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportHomeIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsSkeleton ApplicationStack traceThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested URL could not be matched by routing.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.We cannot determine at this time why a 404 was generated.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!resolves to %sProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-05 22:32-0700
PO-Revision-Date: 2012-07-05 23:36-0700
Last-Translator: Evan Coury <me@evancoury.com>
Language-Team: ZF Contibutors <zf-devteam@zend.com>
Language:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-KeywordsList: translate
X-Poedit-Language: French
X-Poedit-Country: FRANCE
X-Poedit-Basepath: .
X-Poedit-SearchPath-0: ..
Une erreur 404 est survenueInformations complГ©mentairesTous droits rГ©servГ©s.Une erreur est survenueFГ©licitations ! Vous avez installГ© avec succГЁs le %sZF2 Skeleton Application%s. Vous utilisez actuellement Zend Framework version %s. Cette structure peut vous servir comme un point de dГ©part simple pour dГ©marrer la construction de votre application avec ZF2.ContrГґleurDГ©couvrez les modulesExceptionExplorer les modules ZF2FichierSuivre le dГ©veloppementFaites un Fork de Zend Framework 2 sur GitHubAide &amp; supportAccueilSi vous avez besoin d'aide ou de support en dГ©veloppant avec ZF2, vous pouvez nous joindre sur IRC : %s#zftalk sur Freenode%s. Nous aimerions avoir vos questions ou vos commentaires que vous pourriez avoir au sujet des versions bГЄta. Sinon, vous pouvez vous abonner, et poser des questions sur la %sliste de diffusion%s.MessageAucune exception disponibleRejoignez-nous sur IRCExceptions prГ©cГ©dentesSkeleton ApplicationPile d'exГ©cutionLa communautГ© travaille sur le dГ©veloppement d'un site communautaire avec l'objectif de servir de dГ©pГґt et de galerie pour les modules ZF2. Le projet est disponible %ssur GitHub%s. Le site est dГ©jГ  en ligne, et contient une liste non exhaustive des modules dГ©jГ  disponibles pour ZF2.L'URL demandГ©e n'a pas pu trouver de route correspondante.Le contrГґleur demandГ© ne correspond pas Г  une classe existante de contrГґleur.Le contrГґleur demandГ© n'est pas dispatchable.Le contrГґleur demandГ© n'a pas pu dispatcher la requГЄte.Nous ne pouvons pas dГ©terminer pour le moment pourquoi une 404 a Г©tГ© gГ©nГ©rГ©e.Bienvenue dans le %sZend Framework 2%sPortail sur le dГ©veloppement de ZF2Zend Framework 2 est en cours de dГ©veloppement. Si vous ГЄtes intГ©ressГ© pour suivre l'Г©volution de ZF2, il existe un portail dГ©diГ© Г  ZF2 sur le site officiel Zend Framework qui propose des liens vers le %swiki%s ZF2, %sdev blog%s, %ssuivi des problГЁmes%s, et bien plus encore. Il s'agit d'une excellente ressource pour rester Г  jour sur les derniГЁres Г©volutions !rГ©sout en %s
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 22:32-0700\n"
"PO-Revision-Date: 2012-07-05 23:36-0700\n"
"Last-Translator: Evan Coury <me@evancoury.com>\n"
"Language-Team: ZF Contibutors <zf-devteam@zend.com>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Language: French\n"
"X-Poedit-Country: FRANCE\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../view/layout/layout.phtml:6
#: ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr "Skeleton Application"
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr "Accueil"
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr "Tous droits réservés."
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr "Bienvenue dans le %sZend Framework 2%s"
#: ../view/application/index/index.phtml:3
#, php-format
msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2."
msgstr "Félicitations ! Vous avez installé avec succès le %sZF2 Skeleton Application%s. Vous utilisez actuellement Zend Framework version %s. Cette structure peut vous servir comme un point de départ simple pour démarrer la construction de votre application avec ZF2."
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr "Faites un Fork de Zend Framework 2 sur GitHub"
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr "Suivre le développement"
#: ../view/application/index/index.phtml:11
#, php-format
msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!"
msgstr "Zend Framework 2 est en cours de développement. Si vous êtes intéressé pour suivre l'évolution de ZF2, il existe un portail dédié à ZF2 sur le site officiel Zend Framework qui propose des liens vers le %swiki%s ZF2, %sdev blog%s, %ssuivi des problèmes%s, et bien plus encore. Il s'agit d'une excellente ressource pour rester à jour sur les dernières évolutions !"
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr "Portail sur le développement de ZF2"
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr "Découvrez les modules"
#: ../view/application/index/index.phtml:17
#, php-format
msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2."
msgstr "La communauté travaille sur le développement d'un site communautaire avec l'objectif de servir de dépôt et de galerie pour les modules ZF2. Le projet est disponible %ssur GitHub%s. Le site est déjà en ligne, et contient une liste non exhaustive des modules déjà disponibles pour ZF2."
#: ../view/application/index/index.phtml:18
msgid "Explore ZF2 Modules"
msgstr "Explorer les modules ZF2"
#: ../view/application/index/index.phtml:22
msgid "Help &amp; Support"
msgstr "Aide &amp; support"
#: ../view/application/index/index.phtml:23
#, php-format
msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s."
msgstr "Si vous avez besoin d'aide ou de support en développant avec ZF2, vous pouvez nous joindre sur IRC : %s#zftalk sur Freenode%s. Nous aimerions avoir vos questions ou vos commentaires que vous pourriez avoir au sujet des versions bêta. Sinon, vous pouvez vous abonner, et poser des questions sur la %sliste de diffusion%s."
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr "Rejoignez-nous sur IRC"
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr "Une erreur est survenue"
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr "Informations complémentaires"
#: ../view/error/index.phtml:11
#: ../view/error/index.phtml:35
msgid "File"
msgstr "Fichier"
#: ../view/error/index.phtml:15
#: ../view/error/index.phtml:39
msgid "Message"
msgstr "Message"
#: ../view/error/index.phtml:19
#: ../view/error/index.phtml:43
#: ../view/error/404.phtml:55
msgid "Stack trace"
msgstr "Pile d'exécution"
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr "Exceptions précédentes"
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr "Aucune exception disponible"
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr "Une erreur 404 est survenue"
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr "Le contrôleur demandé n'a pas pu dispatcher la requête."
#: ../view/error/404.phtml:13
msgid "The requested controller could not be mapped to an existing controller class."
msgstr "Le contrôleur demandé ne correspond pas à une classe existante de contrôleur."
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr "Le contrôleur demandé n'est pas dispatchable."
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr "L'URL demandée n'a pas pu trouver de route correspondante."
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr "Nous ne pouvons pas déterminer pour le moment pourquoi une 404 a été générée."
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr "Contrôleur"
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr "résout en %s"
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr "Exception"
Ю• )ь Ў¶Нвнф
вн ю!4Tgl~†ќ¬А2БMф.B<q9®иUu „ њ » У у я
  ) 3 K P *b Ќ ў /І в#м"ю7T6X‹7дHVe!јЮ%ь"  
 A 404 error occurredAdditional informationAll rights reserved.An error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.ControllerDiscover ModulesExceptionExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportHomeIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested URL could not be matched by routing.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.We cannot determine at this time why a 404 was generated.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!resolves to %sProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-05 23:45-0700
PO-Revision-Date: 2012-07-12 22:14+0100
Last-Translator: Marco Pivetta <ocramius@gmail.com>
Language-Team: ZF Contributors <zf-devteam@zend.com>
Language:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-KeywordsList: translate
X-Poedit-Basepath: .
X-Poedit-Language: German
X-Poedit-Country: GERMANY
X-Poedit-Bookmarks: -1,-1,-1,-1,-1,-1,5,-1,-1,-1
X-Poedit-SearchPath-0: ..
Si ГЁ verificato un errore 404Informazioni aggiuntiveTutti i diritti sono riservati.Si ГЁ verificato un erroreCongratulazioni! Hai appena installato con successo %sZF2 Skeleton Application%s e stai utilizzando la versione %s di Zend Framework. Questa struttura puГІ servirti come semplice punto di riferimento per iniziare a costruire un'applicazione basata su ZF2.ControllerScopri i ModuliEccezioneEsplora i Moduli di ZF2FileSegui lo sviluppoCrea un fork di Zend Framework 2 su GitHubAiuto &amp; SupportoPagina inizialeQualora ti servisse aiuto o supporto mentre sviluppi con ZF2, puoi contattarci tramite IRC: %s#zftalk on Freenode%s. Ci piacerebbe moltissimo ricevere le tue domande o qualunque feedback tu possa avere riguardo alle beta release. In alternativa, puoi iscriverti e inviare domande alla %smailing lists%s.MessaggioNon ГЁ disponibile alcuna eccezioneContattaci su IRCEccezioni precedentiLa community sta lavorando allo sviluppo di un sito che deve servire come raccolta e gallery di Moduli per ZF2. Il progetto ГЁ disponibile %son Github%s. Il sito ГЁ visitabile e al momento contiene una lista di alcuni dei Moduli giГ  disponibili per ZF2.Non ГЁ stato possibile effettuare il match dell'indirizzo richiesto tramite routing.Non ГЁ stato possibile mappare il controller richiesto ad una classe di tipo controller.Il controller richiesto non ГЁ un oggetto dispatchable.Il controller richiesto non ГЁ stato in grado di elaborare la richiesta.In questo momento non siamo in grado di determinare perchГЁ sia stato generato un 404.Benvenuto in %sZend Framework 2%sPortale sullo sviluppo di ZF2Zend Framework 2 ГЁ in forte sviluppo. Se sei interessato a seguire lo sviluppo di ZF2, ГЁ presente un portale che fornisce link al %swiki%s, al %sdev blog%s, all'%sissue tracker%s e a molto altro riguardo a ZF2. Il Portale ГЁ un'ottima risorsa per rimanere aggiornati con gli ultimi sviluppi!viene risolto in %s
msgid ""
msgstr ""
"Project-Id-Version: ZendSkeletonApplication\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 23:45-0700\n"
"PO-Revision-Date: 2012-07-12 22:14+0100\n"
"Last-Translator: Marco Pivetta <ocramius@gmail.com>\n"
"Language-Team: ZF Contributors <zf-devteam@zend.com>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: translate\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-Language: German\n"
"X-Poedit-Country: GERMANY\n"
"X-Poedit-Bookmarks: -1,-1,-1,-1,-1,-1,5,-1,-1,-1\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../view/layout/layout.phtml:6
#: ../view/layout/layout.phtml:33
msgid "Skeleton Application"
msgstr ""
#: ../view/layout/layout.phtml:36
msgid "Home"
msgstr "Pagina iniziale"
#: ../view/layout/layout.phtml:50
msgid "All rights reserved."
msgstr "Tutti i diritti sono riservati."
#: ../view/application/index/index.phtml:2
#, php-format
msgid "Welcome to %sZend Framework 2%s"
msgstr "Benvenuto in %sZend Framework 2%s"
#: ../view/application/index/index.phtml:3
#, php-format
msgid "Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2."
msgstr "Congratulazioni! Hai appena installato con successo %sZF2 Skeleton Application%s e stai utilizzando la versione %s di Zend Framework. Questa struttura può servirti come semplice punto di riferimento per iniziare a costruire un'applicazione basata su ZF2."
#: ../view/application/index/index.phtml:4
msgid "Fork Zend Framework 2 on GitHub"
msgstr "Crea un fork di Zend Framework 2 su GitHub"
#: ../view/application/index/index.phtml:10
msgid "Follow Development"
msgstr "Segui lo sviluppo"
#: ../view/application/index/index.phtml:11
#, php-format
msgid "Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!"
msgstr "Zend Framework 2 è in forte sviluppo. Se sei interessato a seguire lo sviluppo di ZF2, è presente un portale che fornisce link al %swiki%s, al %sdev blog%s, all'%sissue tracker%s e a molto altro riguardo a ZF2. Il Portale è un'ottima risorsa per rimanere aggiornati con gli ultimi sviluppi!"
#: ../view/application/index/index.phtml:12
msgid "ZF2 Development Portal"
msgstr "Portale sullo sviluppo di ZF2"
#: ../view/application/index/index.phtml:16
msgid "Discover Modules"
msgstr "Scopri i Moduli"
#: ../view/application/index/index.phtml:17
#, php-format
msgid "The community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2."
msgstr "La community sta lavorando allo sviluppo di un sito che deve servire come raccolta e gallery di Moduli per ZF2. Il progetto è disponibile %son Github%s. Il sito è visitabile e al momento contiene una lista di alcuni dei Moduli già disponibili per ZF2."
#: ../view/application/index/index.phtml:18
msgid "Explore ZF2 Modules"
msgstr "Esplora i Moduli di ZF2"
#: ../view/application/index/index.phtml:22
msgid "Help &amp; Support"
msgstr "Aiuto &amp; Supporto"
#: ../view/application/index/index.phtml:23
#, php-format
msgid "If you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s."
msgstr "Qualora ti servisse aiuto o supporto mentre sviluppi con ZF2, puoi contattarci tramite IRC: %s#zftalk on Freenode%s. Ci piacerebbe moltissimo ricevere le tue domande o qualunque feedback tu possa avere riguardo alle beta release. In alternativa, puoi iscriverti e inviare domande alla %smailing lists%s."
#: ../view/application/index/index.phtml:24
msgid "Ping us on IRC"
msgstr "Contattaci su IRC"
#: ../view/error/index.phtml:1
msgid "An error occurred"
msgstr "Si è verificato un errore"
#: ../view/error/index.phtml:8
msgid "Additional information"
msgstr "Informazioni aggiuntive"
#: ../view/error/index.phtml:11
#: ../view/error/index.phtml:35
msgid "File"
msgstr "File"
#: ../view/error/index.phtml:15
#: ../view/error/index.phtml:39
msgid "Message"
msgstr "Messaggio"
#: ../view/error/index.phtml:19
#: ../view/error/index.phtml:43
#: ../view/error/404.phtml:55
msgid "Stack trace"
msgstr ""
#: ../view/error/index.phtml:29
msgid "Previous exceptions"
msgstr "Eccezioni precedenti"
#: ../view/error/index.phtml:58
msgid "No Exception available"
msgstr "Non è disponibile alcuna eccezione"
#: ../view/error/404.phtml:1
msgid "A 404 error occurred"
msgstr "Si è verificato un errore 404"
#: ../view/error/404.phtml:10
msgid "The requested controller was unable to dispatch the request."
msgstr "Il controller richiesto non è stato in grado di elaborare la richiesta."
#: ../view/error/404.phtml:13
msgid "The requested controller could not be mapped to an existing controller class."
msgstr "Non è stato possibile mappare il controller richiesto ad una classe di tipo controller."
#: ../view/error/404.phtml:16
msgid "The requested controller was not dispatchable."
msgstr "Il controller richiesto non è un oggetto dispatchable."
#: ../view/error/404.phtml:19
msgid "The requested URL could not be matched by routing."
msgstr "Non è stato possibile effettuare il match dell'indirizzo richiesto tramite routing."
#: ../view/error/404.phtml:22
msgid "We cannot determine at this time why a 404 was generated."
msgstr "In questo momento non siamo in grado di determinare perchè sia stato generato un 404."
#: ../view/error/404.phtml:34
msgid "Controller"
msgstr "Controller"
#: ../view/error/404.phtml:41
#, php-format
msgid "resolves to %s"
msgstr "viene risolto in %s"
#: ../view/error/404.phtml:51
msgid "Exception"
msgstr "Eccezione"
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Application;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
class Module
{
public function onBootstrap(MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
}

ZendSkeletonApplication

Introduction

This is a simple, skeleton application using the ZF2 MVC layer and module systems. This application is meant to be used as a starting place for those looking to get their feet wet with ZF2.

Installation

Using Composer (recommended)

The recommended way to get a working copy of this project is to clone the repository and use composer to install dependencies using the create-project command:

curl -s https://getcomposer.org/installer | php --
php composer.phar create-project -sdev --repository-url="http://packages.zendframework.com" zendframework/skeleton-application path/to/install

Alternately, clone the repository and manually invoke composer using the shipped composer.phar:

cd my/project/dir
git clone git://github.com/zendframework/ZendSkeletonApplication.git
cd ZendSkeletonApplication
php composer.phar self-update
php composer.phar install

(The self-update directive is to ensure you have an up-to-date composer.phar available.)

Another alternative for downloading the project is to grab it via curl, and then pass it to tar:

cd my/project/dir
curl -#L https://github.com/zendframework/ZendSkeletonApplication/tarball/master | tar xz --strip-components=1

You would then invoke composer to install dependencies per the previous example.

Using Git submodules

Alternatively, you can install using native git submodules:

git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive

Virtual Host

Afterwards, set up a virtual host to point to the public/ directory of the project and you should be ready to go!

This file has been truncated, but you can view the full file.
Ю•)мђ‘¦ЅнП
ЅИ Щгчь/BT\s‚ –ў2ЈMЦ.$<S9ђКкUW Жf !- O _ E~ Д Ч ц э  & +6 b Ќ{  8 LYNrKБx K†cТK6$‚§qѕ 0 
  A 404 error occurredAdditional informationAn error occurredCongratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.ControllerDiscover ModulesExceptionExplore ZF2 ModulesFileFollow DevelopmentFork Zend Framework 2 on GitHubHelp &amp; SupportIf you need any help or support while developing with ZF2, you may reach us via IRC: %s#zftalk on Freenode%s. We'd love to hear any questions or feedback you may have regarding the beta releases. Alternatively, you may subscribe and post questions to the %smailing lists%s.MessageNo Exception availablePing us on IRCPrevious exceptionsStack traceThe community is working on developing a community site to serve as a repository and gallery for ZF2 modules. The project is available %son GitHub%s. The site is currently live and currently contains a list of some of the modules already available for ZF2.The requested URL could not be matched by routing.The requested controller could not be mapped to an existing controller class.The requested controller was not dispatchable.The requested controller was unable to dispatch the request.We cannot determine at this time why a 404 was generated.Welcome to %sZend Framework 2%sZF2 Development PortalZend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!resolves to %sProject-Id-Version: ZendSkeletonApplication
Report-Msgid-Bugs-To:
POT-Creation-Date: 2012-07-05 19:30-0700
PO-Revision-Date: 2012-07-15 08:20+0900
Last-Translator: sasezaki <sasezaki@gmail.com>
Language-Team: Japanese
Language: ja
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Poedit-KeywordsList: translate
X-Poedit-Language: Japanese
X-Poedit-Country: Japan
X-Poedit-Basepath: .
X-Poedit-SearchPath-0: ..
404エラーが発生しました追加の情報エラーが発生しましたおめでとうございます! %sZF2 Skeleton Application%s のインストールに成功しました。 あなたは Zend Framework version %s を動作させています。このスケルトンはZF2上でのアプリケーション構築を始めるためにシンプルなスタートポイントを提供します。コントローラモジュールを見つける例外ZF2モジュールを探すファイル開発を追うGitHub で Zend Framework 2 をフォーク�ルプとサポートZF2 で開発中に何らかのお手伝いやサポートが必要な場合、IRC を通�て私たちと連絡することができます。: %s#zftalk on Freenode%s ベータ版についてあなたが抱えるかもしれない質問やフィードバックを何でも聞きたいと望みます。あるいは、%smailing lists%s を購読したり質問をポストしたりできます。メッセージ例外が利用できませんIRC で呼び出す前の例外スタックトレースコミュニティーはZF2モジュールのためのリポジトリとギャラリーを提供するコミュニティーサイトを開発中です。プロジェクトは %s GitHub%s で利用可能です。サイトは現在運営されており、ZF2ですでに利用可能なモジュールのリストを持っています。要求されたURLはルーティングにマッチしませんでした。要求されたコントローラは�在するコントローラクラスにマッピングできませんでした。要求されたコントローラはディスパッチ不可能
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment