Heray-Was-Here
Server : Apache
System : Linux binac.nextwavehosting.net 4.18.0-553.120.1.el8_10.x86_64 #1 SMP Mon Apr 20 18:04:27 EDT 2026 x86_64
User : homes21 ( 1062)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
Directory :  /usr/local/bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/bin/cv
#!/usr/bin/env php
<?php

/*
 * Generated by Humbug Box 3.8.4@120b0a3.
 *
 * @link https://github.com/humbug/box
 */

Phar::mapPhar('box-auto-generated-alias-08d41abe052d.phar');

require 'phar://box-auto-generated-alias-08d41abe052d.phar/.box/bin/check-requirements.php';

require 'phar://box-auto-generated-alias-08d41abe052d.phar/bin/cv';

__HALT_COMPILER(); ?>
���src/SiteConfigReader.php��/b�' |�%src/Command/DebugContainerCommand.php�	�/b�	I����src/Command/ApiCommand.php��/b���nO�&src/Command/ExtensionEnableCommand.phpz
�/bz
�~Ӷ)src/Command/ExtensionUpgradeDbCommand.php��/b�-�a�src/Command/ScriptCommand.phpq�/bq#���src/Command/UpgradeCommand.php�	�/b�	.�#src/Command/CoreCheckReqCommand.phpM	�/bM	�5�src/Command/ApiBatchCommand.php��/b�}^
@�src/Command/SqlCliCommand.phpI�/bI�ԢX�src/Command/EvalCommand.php$�/b$�O͡� src/Command/UpgradeDbCommand.php3�/b3����src/Command/BootCommand.php��/b�H���$src/Command/ExtensionListCommand.php��/b��X�src/Command/BaseCommand.php��/b�J�6�"src/Command/CoreInstallCommand.phpL�/bL�X X�!src/Command/UpgradeGetCommand.phpA	�/bA	p[ö$src/Command/CoreUninstallCommand.phpf�/bf��(�src/Command/PipeCommand.php�/b����(src/Command/AngularModuleListCommand.php��/b��0k�src/Command/FillCommand.php��/b��p��$src/Command/UpgradeReportCommand.phpw�/bw��_%�&src/Command/DebugDispatcherCommand.phpj�/bj6~�src/Command/PathCommand.phpa�/baZĵ/�'src/Command/ExtensionDisableCommand.php�/b}Ru�src/Command/EditCommand.php`�/b`��$��src/Command/FlushCommand.php��/b�~w�j�&src/Command/AngularHtmlListCommand.php�	�/b�	Pz�~�src/Command/UrlCommand.php��/b��%�&src/Command/AngularHtmlShowCommand.php��/b��Ҷsrc/Command/CliCommand.phpj�/bjH��0�)src/Command/ExtensionUninstallCommand.php��/b�c�w϶$src/Command/BaseExtensionCommand.php~	�/b~	P� src/Command/UpgradeDlCommand.php`�/b`���src/Command/Api4Command.php��/b�dd��src/Command/ShowCommand.php�/b��Ҷ(src/Command/ExtensionDownloadCommand.phpp$�/bp$!��src/Util/Datasource.phpc�/bc��Q�src/Util/BootTrait.phpF�/bF�L�'� src/Util/OptionCallbackTrait.php��/b���G��src/Util/CliEditor.php�/b/&��src/Util/HeadlessDownloader.php{	�/b{	�w5��src/Util/Filesystem.php#	�/b#	z�4{�!src/Util/DebugDispatcherTrait.php��/b�}�oP�src/Util/ConsoleQueueRunner.php��/b�e?���src/Util/ArrayUtil.php��/b���3�src/Util/Cv.php_�/b_।ƶsrc/Util/Api4ArgParser.php
�/b
B�W��"src/Util/StructuredOutputTrait.phpR�/bR�Ц��src/Util/Rand.php��/b��V�src/Util/Process.php��/b�(M�ζsrc/Util/SetupCommandTrait.php]�/b]`^.�src/Encoder.phpW�/bWS�^+�src/Config.php��/b�a�[P�src/Application.php��/b���!��src/BuildkitReader.phpT�/bTIZ�Q�src/Bootstrap.php�$�/b�$Sm=��src/CmsBootstrap.php:#�/b:#�u��'src/Exception/ProcessErrorException.php+�/b+i%iضbin/cv`�/b`M��Ŷ@vendor/jakub-onderka/php-console-highlighter/src/Highlighter.php��/b�xŠ�Avendor/jakub-onderka/php-console-highlighter/examples/snippet.php,�/b,7d߇�Dvendor/jakub-onderka/php-console-highlighter/examples/whole_file.php'�/b'�b�Qvendor/jakub-onderka/php-console-highlighter/examples/whole_file_line_numbers.php6�/b6�=�@�Dvendor/jakub-onderka/php-console-color/src/InvalidStyleException.php��/b��+�v�;vendor/jakub-onderka/php-console-color/src/ConsoleColor.php��/b��r�2vendor/jakub-onderka/php-console-color/example.phpz�/bzD��?vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php��/b�U��H�?vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.phpR�/bR��w�<vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php��/b�� �<vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php��/b���{I�Bvendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php[�/b[�s�;�&vendor/symfony/process/InputStream.php�/b~/V�.vendor/symfony/process/PhpExecutableFinder.phpL�/bLW<�K�+vendor/symfony/process/ExecutableFinder.php��/b��ö*vendor/symfony/process/Pipes/UnixPipes.php��/b��O�˶-vendor/symfony/process/Pipes/WindowsPipes.php/
�/b/
>��/vendor/symfony/process/Pipes/PipesInterface.php��/b�fQ��.vendor/symfony/process/Pipes/AbstractPipes.php�
�/b�

�|��"vendor/symfony/process/Process.php�d�/b�d[(���'vendor/symfony/process/ProcessUtils.php�/b���[�%vendor/symfony/process/PhpProcess.php��/b�MW�ֶ7vendor/symfony/process/Exception/ExceptionInterface.phpy�/byqVXJ�5vendor/symfony/process/Exception/RuntimeException.php��/b���:�;vendor/symfony/process/Exception/ProcessFailedException.phpx�/bx��zy�3vendor/symfony/process/Exception/LogicException.php��/b� ���=vendor/symfony/process/Exception/InvalidArgumentException.php��/b��+_�=vendor/symfony/process/Exception/ProcessTimedOutException.php1�/b1�'Z�=vendor/symfony/process/Exception/ProcessSignaledException.php�/bYש�.vendor/symfony/polyfill-mbstring/bootstrap.php��/b���;��@vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php�@�/b�@��ض@vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpfA�/bfA�f�߶Fvendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php��/b��y_��-vendor/symfony/polyfill-mbstring/Mbstring.php�G�/b�Gɖз�(vendor/symfony/filesystem/Filesystem.php<�/b<�i��:vendor/symfony/filesystem/Exception/ExceptionInterface.php|�/b|��D�=vendor/symfony/filesystem/Exception/FileNotFoundException.php��/b�%󇑶<vendor/symfony/filesystem/Exception/IOExceptionInterface.php��/b�j�wM�@vendor/symfony/filesystem/Exception/InvalidArgumentException.php��/b��!Ƕ3vendor/symfony/filesystem/Exception/IOException.php��/b�3�L׶+vendor/symfony/polyfill-ctype/bootstrap.phpI�/bI�D!e�'vendor/symfony/polyfill-ctype/Ctype.phpH	�/bH	���ݶ1vendor/symfony/console/Helper/HelperInterface.php��/b����2vendor/symfony/console/Helper/InputAwareHelper.phpc�/bc���3vendor/symfony/console/Helper/ProgressIndicator.php�/b��15�0vendor/symfony/console/Helper/TableSeparator.php��/b�����+vendor/symfony/console/Helper/HelperSet.phpg�/bg��tն7vendor/symfony/console/Helper/SymfonyQuestionHelper.php��/b��׶6vendor/symfony/console/Helper/DebugFormatterHelper.phpt�/bt�R8��(vendor/symfony/console/Helper/Helper.php��/b����+vendor/symfony/console/Helper/TableRows.php1�/b1O�(vendor/symfony/console/Helper/Dumper.php�/b��ܽ�/vendor/symfony/console/Helper/ProcessHelper.php��/b��jLѶ1vendor/symfony/console/Helper/FormatterHelper.phpD�/bD+��L�2vendor/symfony/console/Helper/DescriptorHelper.phpe�/be2��_�,vendor/symfony/console/Helper/TableStyle.php��/b��N5��+vendor/symfony/console/Helper/TableCell.php,�/b,��J�-vendor/symfony/console/Helper/ProgressBar.php�,�/b�,�.}˶0vendor/symfony/console/Helper/QuestionHelper.php�(�/b�(���'vendor/symfony/console/Helper/Table.phpkE�/bkE]b��=vendor/symfony/console/Formatter/OutputFormatterInterface.php��/b�v�Lն4vendor/symfony/console/Formatter/OutputFormatter.php�/b�S1��Fvendor/symfony/console/Formatter/WrappableOutputFormatterInterface.php��/b�]
'¶>vendor/symfony/console/Formatter/OutputFormatterStyleStack.php��/b�F�x��Bvendor/symfony/console/Formatter/OutputFormatterStyleInterface.php��/b���G�9vendor/symfony/console/Formatter/OutputFormatterStyle.phpD�/bDE�޳�.vendor/symfony/console/Command/ListCommand.php6�/b6c��=�*vendor/symfony/console/Command/Command.php!"�/b!"G�j�.vendor/symfony/console/Command/HelpCommand.php��/b�G�?~�0vendor/symfony/console/Command/LockableTrait.php�/b����/vendor/symfony/console/Logger/ConsoleLogger.php�/b\W
�*vendor/symfony/console/Input/ArgvInput.phpr�/brZ��}�0vendor/symfony/console/Input/InputDefinition.php��/b�4�9��&vendor/symfony/console/Input/Input.phpB�/bBS*��.vendor/symfony/console/Input/InputArgument.php!�/b!�y��+vendor/symfony/console/Input/ArrayInput.phpf�/bf���,vendor/symfony/console/Input/StringInput.phpB�/bB.�/�4vendor/symfony/console/Input/InputAwareInterface.php��/b��O��9vendor/symfony/console/Input/StreamableInputInterface.php��/b���B��,vendor/symfony/console/Input/InputOption.php8�/b8��˶/vendor/symfony/console/Input/InputInterface.php��/b�rrg�Dvendor/symfony/console/DependencyInjection/AddConsoleCommandPass.phpE
�/bE
�/H�-vendor/symfony/console/Tester/TesterTrait.php��/b�n‡�3vendor/symfony/console/Tester/ApplicationTester.php��/b��z���/vendor/symfony/console/Tester/CommandTester.php�/bS�?˶4vendor/symfony/console/Event/ConsoleCommandEvent.php��/b�W��6vendor/symfony/console/Event/ConsoleTerminateEvent.php{�/b{ _y<�2vendor/symfony/console/Event/ConsoleErrorEvent.php��/b������-vendor/symfony/console/Event/ConsoleEvent.php��/b��/��,vendor/symfony/console/Question/Question.php
�/b
�`�8vendor/symfony/console/Question/ConfirmationQuestion.php�/b�yń�2vendor/symfony/console/Question/ChoiceQuestion.php�
�/b�
F�``�-vendor/symfony/console/Style/SymfonyStyle.php6&�/b6&/��X�,vendor/symfony/console/Style/OutputStyle.phpX�/bX����/vendor/symfony/console/Style/StyleInterface.php��/b����&vendor/symfony/console/Application.phpn�/bnqh�ܶ6vendor/symfony/console/EventListener/ErrorListener.php1�/b1`]��8vendor/symfony/console/Output/ConsoleOutputInterface.php��/b��,ݶ5vendor/symfony/console/Output/TrimmedBufferOutput.php��/b������.vendor/symfony/console/Output/StreamOutput.phpx�/bx|�	l�6vendor/symfony/console/Output/ConsoleSectionOutput.php�	�/b�	����(vendor/symfony/console/Output/Output.php�	�/b�	?�q�1vendor/symfony/console/Output/OutputInterface.php��/b�h��ж,vendor/symfony/console/Output/NullOutput.php��/b����Z�/vendor/symfony/console/Output/ConsoleOutput.php		�/b		�(D��0vendor/symfony/console/Output/BufferedOutput.php`�/b`�蟗�?vendor/symfony/console/CommandLoader/CommandLoaderInterface.phpG�/bG?����?vendor/symfony/console/CommandLoader/ContainerCommandLoader.phpG�/bGk{UĶ=vendor/symfony/console/CommandLoader/FactoryCommandLoader.php��/b��m���(vendor/symfony/console/ConsoleEvents.php��/b���J�8vendor/symfony/console/Descriptor/MarkdownDescriptor.php��/b��S]��9vendor/symfony/console/Descriptor/DescriptorInterface.php��/b��P~��4vendor/symfony/console/Descriptor/JsonDescriptor.php|�/b|YA��3vendor/symfony/console/Descriptor/XmlDescriptor.php/�/b/c��޶4vendor/symfony/console/Descriptor/TextDescriptor.php�"�/b�"9�H��<vendor/symfony/console/Descriptor/ApplicationDescription.php�	�/b�	�g���0vendor/symfony/console/Descriptor/Descriptor.phpi�/biR���?vendor/symfony/console/Exception/NamespaceNotFoundException.php��/b���n��7vendor/symfony/console/Exception/ExceptionInterface.phpy�/by�9[&�;vendor/symfony/console/Exception/InvalidOptionException.php��/b���H�5vendor/symfony/console/Exception/RuntimeException.php��/b���,6�:vendor/symfony/console/Exception/MissingInputException.php��/b��S
��=vendor/symfony/console/Exception/CommandNotFoundException.php��/b��w��3vendor/symfony/console/Exception/LogicException.php��/b��O\e�=vendor/symfony/console/Exception/InvalidArgumentException.php��/b��̽Z�#vendor/symfony/console/Terminal.php�
�/b�
Js�'vendor/symfony/polyfill-php73/Php73.phpy�/by��+vendor/symfony/polyfill-php73/bootstrap.php��/b�AY8ƶ?vendor/symfony/polyfill-php73/Resources/stubs/JsonException.php:�/b:aг�+vendor/symfony/polyfill-php80/bootstrap.php��/b�����;vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php��/b�p��N�Evendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php3�/b3y4%�<vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php*�/b*���*�<vendor/symfony/polyfill-php80/Resources/stubs/Stringable.phpb�/bb�ћ<�'vendor/symfony/polyfill-php80/Php80.php-	�/b-	�KW�6vendor/symfony/var-dumper/Resources/functions/dump.php��/b�0̑>�.vendor/symfony/var-dumper/Caster/TraceStub.php�/b�,LԶ.vendor/symfony/var-dumper/Caster/SplCaster.phpo�/boFk�۶2vendor/symfony/var-dumper/Caster/SymfonyCaster.php��/b�U���-vendor/symfony/var-dumper/Caster/ArgsStub.php��/b���ܶ.vendor/symfony/var-dumper/Caster/ClassStub.phpB�/bB�[�3vendor/symfony/var-dumper/Caster/ResourceCaster.php��/b�V�
��4vendor/symfony/var-dumper/Caster/ExceptionCaster.php4)�/b4)��y�3vendor/symfony/var-dumper/Caster/DoctrineCaster.php�/b�6��+vendor/symfony/var-dumper/Caster/Caster.php�
�/b�
���z�0vendor/symfony/var-dumper/Caster/PgSqlCaster.php
�/b
��\�/vendor/symfony/var-dumper/Caster/AmqpCaster.php��/b���ζ,vendor/symfony/var-dumper/Caster/CutStub.php��/b�S�4$�.vendor/symfony/var-dumper/Caster/FrameStub.php>�/b>S!���-vendor/symfony/var-dumper/Caster/LinkStub.php��/b���L��.vendor/symfony/var-dumper/Caster/PdoCaster.phpL	�/bL	�0�>�.vendor/symfony/var-dumper/Caster/ConstStub.php/�/b/1�D]�1vendor/symfony/var-dumper/Caster/CutArrayStub.phpg�/bg+|&J�-vendor/symfony/var-dumper/Caster/EnumStub.php"�/b"�UMö0vendor/symfony/var-dumper/Caster/RedisCaster.php��/b��Y�i�.vendor/symfony/var-dumper/Caster/DOMCaster.php��/b�kZnI�0vendor/symfony/var-dumper/Caster/MongoCaster.php!�/b!��'��/vendor/symfony/var-dumper/Caster/DateCaster.php��/b��iE�5vendor/symfony/var-dumper/Caster/ReflectionCaster.php["�/b["f>� �4vendor/symfony/var-dumper/Caster/XmlReaderCaster.phpK�/bKO\�$�6vendor/symfony/var-dumper/Caster/XmlResourceCaster.php��/b�@���/vendor/symfony/var-dumper/Caster/StubCaster.php�/bL�M�)vendor/symfony/var-dumper/Cloner/Data.php� �/b� ��}4�)vendor/symfony/var-dumper/Cloner/Stub.php��/b���ˤ�4vendor/symfony/var-dumper/Cloner/DumperInterface.php��/b�j4���.vendor/symfony/var-dumper/Cloner/VarCloner.php)�/b)�ܕ�+vendor/symfony/var-dumper/Cloner/Cursor.php��/b�t���4vendor/symfony/var-dumper/Cloner/ClonerInterface.php��/b�\�o]�3vendor/symfony/var-dumper/Cloner/AbstractCloner.php\0�/b\0x���'vendor/symfony/var-dumper/VarDumper.php �/b V�|�?vendor/symfony/var-dumper/Exception/ThrowingCasterException.php�/b����8vendor/symfony/var-dumper/Dumper/DataDumperInterface.php��/b��F�/vendor/symfony/var-dumper/Dumper/HtmlDumper.phpij�/bijS{\�3vendor/symfony/var-dumper/Dumper/AbstractDumper.php
�/b
w��b�.vendor/symfony/var-dumper/Dumper/CliDumper.phpB-�/bB-#f�%vendor/symfony/debug/ErrorHandler.php�F�/b�F,(R��)vendor/symfony/debug/DebugClassLoader.php��/b�Y�f�(vendor/symfony/debug/BufferingLogger.phpt�/bt=hܶ)vendor/symfony/debug/ExceptionHandler.php3�/b3䀫ɶvendor/symfony/debug/Debug.php��/b��xa?�6vendor/symfony/debug/Exception/FatalThrowableError.phpD�/bD���8vendor/symfony/debug/Exception/ContextErrorException.php��/b�-
d2�=vendor/symfony/debug/Exception/UndefinedFunctionException.php��/b��G�n�;vendor/symfony/debug/Exception/UndefinedMethodException.php��/b��L�:�1vendor/symfony/debug/Exception/DummyException.php�/b-"�d�3vendor/symfony/debug/Exception/FlattenException.php��/b�H���9vendor/symfony/debug/Exception/ClassNotFoundException.php��/b�n����6vendor/symfony/debug/Exception/FatalErrorException.php�/b���7vendor/symfony/debug/Exception/OutOfMemoryException.php~�/b~�o�Kvendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php��/b��β�Ivendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php5�/b5� L�Mvendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpu�/bu�j�Evendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php�/bĹBV�=vendor/symfony/service-contracts/ServiceProviderInterface.php��/b�oe
��8vendor/symfony/service-contracts/ServiceLocatorTrait.php�	�/b�	)��۶3vendor/symfony/service-contracts/ResetInterface.phpy�/by��j�?vendor/symfony/service-contracts/ServiceSubscriberInterface.php��/b���d�;vendor/symfony/service-contracts/ServiceSubscriberTrait.php\�/b\�<��#vendor/composer/autoload_static.php;%�/b;%y���vendor/composer/ClassLoader.phpn4�/bn4���;�!vendor/composer/autoload_real.php7�/b7����%vendor/composer/autoload_classmap.php���/b��b�ȶ!vendor/composer/autoload_psr4.php��/b��E��vendor/composer/LICENSE.�/b. ��"vendor/composer/autoload_files.php��/b��Y	��'vendor/composer/autoload_namespaces.php��/b�(�vendor/autoload.php��/b�w�n.�<vendor/civicrm/composer-downloads-plugin/src/GlobCleaner.php��/b��BL�@vendor/civicrm/composer-downloads-plugin/src/DownloadsParser.php��/b�oDi��7vendor/civicrm/composer-downloads-plugin/src/Plugin.php��/b���j��;vendor/civicrm/composer-downloads-plugin/src/Subpackage.php��/b����Dvendor/civicrm/composer-downloads-plugin/src/Handler/FileHandler.phpX�/bXs�4�Dvendor/civicrm/composer-downloads-plugin/src/Handler/PharHandler.phpu�/bu�\�¶Dvendor/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php�/b��]�Gvendor/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php�/b��Y|�,vendor/psy/psysh/src/ConsoleColorFactory.php�/b!u�R�0vendor/psy/psysh/src/Formatter/CodeFormatter.php��/b���,vendor/psy/psysh/src/Formatter/Formatter.php��/b�n��Y�4vendor/psy/psysh/src/Formatter/DocblockFormatter.php.
�/b.
Y+U;�5vendor/psy/psysh/src/Formatter/SignatureFormatter.php)�/b)s��*vendor/psy/psysh/src/Readline/Readline.php��/b��*#޶,vendor/psy/psysh/src/Readline/HoaConsole.php��/b�~��q�)vendor/psy/psysh/src/Readline/Libedit.php��/b�2X���+vendor/psy/psysh/src/Readline/Transient.php��/b���^�-vendor/psy/psysh/src/Readline/GNUReadline.php��/b���*!� vendor/psy/psysh/src/Context.phpl�/blnL���-vendor/psy/psysh/src/Command/ClearCommand.php]�/b]-�Q޶0vendor/psy/psysh/src/Command/WhereamiCommand.phpJ�/bJqN�+vendor/psy/psysh/src/Command/WtfCommand.php
�/b
c�z��,vendor/psy/psysh/src/Command/ListCommand.phpk�/bk�<�˶<vendor/psy/psysh/src/Command/TimeitCommand/TimeitVisitor.php��/b�9m�2�/vendor/psy/psysh/src/Command/ThrowUpCommand.php�
�/b�
�p�/vendor/psy/psysh/src/Command/HistoryCommand.php��/b���B۶(vendor/psy/psysh/src/Command/Command.php��/b�ǣ��-vendor/psy/psysh/src/Command/TraceCommand.phpv�/bv�����Dvendor/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php��/b�bt�=vendor/psy/psysh/src/Command/ListCommand/MethodEnumerator.php��/b�p`iG�<vendor/psy/psysh/src/Command/ListCommand/ClassEnumerator.php��/b�d�h�?vendor/psy/psysh/src/Command/ListCommand/VariableEnumerator.php�/bi��7�?vendor/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php�	�/b�	�z��Evendor/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php��/b��Ͷ?vendor/psy/psysh/src/Command/ListCommand/FunctionEnumerator.phpL�/bLx��
�7vendor/psy/psysh/src/Command/ListCommand/Enumerator.php�/b7�c�?vendor/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php�	�/b�	�#Yֶ-vendor/psy/psysh/src/Command/ParseCommand.php��/b���D��.vendor/psy/psysh/src/Command/BufferCommand.php/�/b/���,vendor/psy/psysh/src/Command/ExitCommand.phps�/bs9Iq�,vendor/psy/psysh/src/Command/EditCommand.php��/b���2�,vendor/psy/psysh/src/Command/SudoCommand.php
�/b
?E]�,vendor/psy/psysh/src/Command/HelpCommand.php��/b���8F�2vendor/psy/psysh/src/Command/ReflectingCommand.php�/bL���2vendor/psy/psysh/src/Command/PsyVersionCommand.php�/b�����+vendor/psy/psysh/src/Command/DocCommand.phpW�/bW��_�,vendor/psy/psysh/src/Command/ShowCommand.php	�/b	�d��,vendor/psy/psysh/src/Command/DumpCommand.php��/b�9fWu�.vendor/psy/psysh/src/Command/TimeitCommand.php;�/b;´�	�"vendor/psy/psysh/src/functions.phpv!�/bv!�3#:�-vendor/psy/psysh/src/ExecutionLoopClosure.php)�/b)�����)vendor/psy/psysh/src/Input/ShellInput.php��/b��q?2�*vendor/psy/psysh/src/Input/SilentInput.php��/b� e��+vendor/psy/psysh/src/Input/CodeArgument.php��/b��iֶ,vendor/psy/psysh/src/Input/FilterOptions.php��/b��B-�;vendor/psy/psysh/src/Reflection/ReflectionClassConstant.php��/b����?vendor/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php\�/b\{�Hvendor/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php�/b�!$˶7vendor/psy/psysh/src/Reflection/ReflectionConstant_.php�/b�3"��6vendor/psy/psysh/src/Reflection/ReflectionConstant.php�/b���5vendor/psy/psysh/src/VersionUpdater/GitHubChecker.phpM�/bM���3vendor/psy/psysh/src/VersionUpdater/NoopChecker.php��/b���ȶ/vendor/psy/psysh/src/VersionUpdater/Checker.php�/b��e�7vendor/psy/psysh/src/VersionUpdater/IntervalChecker.phpv�/bv�a�4vendor/psy/psysh/src/ExecutionLoop/ProcessForker.php��/b�~�ı�/vendor/psy/psysh/src/ExecutionLoop/Listener.php��/b��D^�7vendor/psy/psysh/src/ExecutionLoop/AbstractListener.php��/b��gĶ5vendor/psy/psysh/src/ExecutionLoop/RunkitReloader.php��/b��7}g�&vendor/psy/psysh/src/Util/Docblock.php��/b�����$vendor/psy/psysh/src/Util/Mirror.php��/b�7V;r�"vendor/psy/psysh/src/Util/Json.php��/b��.��!vendor/psy/psysh/src/Util/Str.php��/b�Q���vendor/psy/psysh/src/Shell.php�M�/b�MK8�	�vendor/psy/psysh/src/Sudo.php��/b�����1vendor/psy/psysh/src/VarDumper/PresenterAware.php��/b�Z}�)vendor/psy/psysh/src/VarDumper/Dumper.php7�/b7�A���)vendor/psy/psysh/src/VarDumper/Cloner.php�/b��Sٶ,vendor/psy/psysh/src/VarDumper/Presenter.phpY�/bY'���&vendor/psy/psysh/src/ParserFactory.php��/b�(��@�8vendor/psy/psysh/src/CodeCleaner/FunctionContextPass.php�/b�9[�9vendor/psy/psysh/src/CodeCleaner/ValidConstructorPass.phpF�/bF
kwK�3vendor/psy/psysh/src/CodeCleaner/InstanceOfPass.php{�/b{Š+�Evendor/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php"�/b"�BԦ�5vendor/psy/psysh/src/CodeCleaner/UseStatementPass.php��/b��Qts�:vendor/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php��/b������;vendor/psy/psysh/src/CodeCleaner/EmptyArrayDimFetchPass.php��/b�f����3vendor/psy/psysh/src/CodeCleaner/FinalClassPass.php��/b��	���5vendor/psy/psysh/src/CodeCleaner/LabelContextPass.php��/b�ɩ?�4vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php��/b�=�Ix�@vendor/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php��/b�L���-vendor/psy/psysh/src/CodeCleaner/ListPass.php�/b�F�m�7vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php��/b�3��#�2vendor/psy/psysh/src/CodeCleaner/NamespacePass.php��/b�1�1�4vendor/psy/psysh/src/CodeCleaner/StrictTypesPass.phpf�/bfb>��4vendor/psy/psysh/src/CodeCleaner/CalledClassPass.php��/b�?�z?�2vendor/psy/psysh/src/CodeCleaner/NoReturnValue.php�/bVEm�7vendor/psy/psysh/src/CodeCleaner/MagicConstantsPass.php�/b�`w�6vendor/psy/psysh/src/CodeCleaner/AbstractClassPass.php��/b���A�-vendor/psy/psysh/src/CodeCleaner/ExitPass.php��/b��2-��<vendor/psy/psysh/src/CodeCleaner/PassableByReferencePass.php@�/b@�ö;vendor/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php��/b����7vendor/psy/psysh/src/CodeCleaner/NamespaceAwarePass.phpb�/bb���4vendor/psy/psysh/src/CodeCleaner/CodeCleanerPass.php��/b���h�8vendor/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php��/b�v��ж7vendor/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php��/b�@�",�0vendor/psy/psysh/src/CodeCleaner/RequirePass.php��/b��y�`�6vendor/psy/psysh/src/CodeCleaner/ValidConstantPass.php��/b�
zԞ�+vendor/psy/psysh/src/Output/OutputPager.php��/b�I�+vendor/psy/psysh/src/Output/ShellOutput.php��/b�r��-vendor/psy/psysh/src/Output/PassthruPager.php+�/b+����/vendor/psy/psysh/src/Output/ProcOutputPager.php��/b����&vendor/psy/psysh/src/Configuration.php�=�/b�=����%vendor/psy/psysh/src/ContextAware.phpt�/bt!i�-�$vendor/psy/psysh/src/CodeCleaner.phpZ�/bZ��k�$vendor/psy/psysh/src/ConfigPaths.php�
�/b�
�R~H�1vendor/psy/psysh/src/Exception/ErrorException.php[�/b[z��C�1vendor/psy/psysh/src/Exception/BreakException.php��/b�>�&z�3vendor/psy/psysh/src/Exception/RuntimeException.php~�/b~Ӑ�I�,vendor/psy/psysh/src/Exception/Exception.phpm�/bmϲ��3vendor/psy/psysh/src/Exception/ThrowUpException.php��/b�ic�>�6vendor/psy/psysh/src/Exception/ParseErrorException.php��/b��V��6vendor/psy/psysh/src/Exception/DeprecatedException.phpe�/be�[J�6vendor/psy/psysh/src/Exception/FatalErrorException.phpa�/ba���Q�5vendor/psy/psysh/src/Exception/TypeErrorException.php.�/b.����)vendor/psy/psysh/src/ExecutionClosure.php��/b�*����Svendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php��/b�!��Bvendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php)�/b)�3+�Evendor/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php��/b�k�ȶCvendor/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.phpT�/bT����Avendor/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php��/b�̰���Ovendor/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php��/b��dQ��Ovendor/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php�/bO��?vendor/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php��/b�:�1�?vendor/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php�/bV���>vendor/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.phpp�/bp	ǶFvendor/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php?�/b?���Cvendor/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php��/b�D%Y�Jvendor/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php��/b�z���>vendor/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php[	�/b[	�m�޶>vendor/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php��/b��3�m�@vendor/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php��/b�y��9�?vendor/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php��/b��V��Rvendor/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php!�/b!=��4vendor/psy/psysh/src/TabCompletion/AutoCompleter.php��/b�����)vendor/psy/psysh/src/Sudo/SudoVisitor.php��/b��61�+vendor/dnoegel/php-xdg-base-dir/src/Xdg.phpd�/bd�xߘ�7vendor/psr/container/src/NotFoundExceptionInterface.phpt�/bt�cV�/vendor/psr/container/src/ContainerInterface.php��/b�~�ٶ8vendor/psr/container/src/ContainerExceptionInterface.phpQ�/bQ��>�%vendor/psr/log/Psr/Log/NullLogger.php��/b����+vendor/psr/log/Psr/Log/LoggerAwareTrait.php��/b�T��B�#vendor/psr/log/Psr/Log/LogLevel.php��/b�j��8�*vendor/psr/log/Psr/Log/LoggerInterface.php��/b��sg�/vendor/psr/log/Psr/Log/LoggerAwareInterface.php|�/b|$���&vendor/psr/log/Psr/Log/LoggerTrait.phpi�/bi35�޶)vendor/psr/log/Psr/Log/AbstractLogger.php;�/b;�>3[�3vendor/psr/log/Psr/Log/InvalidArgumentException.php`�/b` �X1�2vendor/nikic/php-parser/grammar/rebuildParsers.php��/b�F�[�)vendor/nikic/php-parser/lib/bootstrap.php��/b�?3�/vendor/nikic/php-parser/lib/PhpParser/Lexer.php��/b�/n���9vendor/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php��/b�����1vendor/nikic/php-parser/lib/PhpParser/Builder.phpR�/bRKj�׶8vendor/nikic/php-parser/lib/PhpParser/Serializer/XML.php�	�/b�	뉔r�=vendor/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php	�/b	�<遶@vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.phpQv�/bQvta:�9vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php��/b�`�|��5vendor/nikic/php-parser/lib/PhpParser/Parser/Php5.php��/b��L�5vendor/nikic/php-parser/lib/PhpParser/Parser/Php7.php���/b���<�7vendor/nikic/php-parser/lib/PhpParser/Parser/Tokens.php
�/b
ۿ[G�6vendor/nikic/php-parser/lib/PhpParser/NodeAbstract.php��/b��ݶ.vendor/nikic/php-parser/lib/PhpParser/Node.php��/b�ͧ�:vendor/nikic/php-parser/lib/PhpParser/Unserializer/XML.php�
�/b�
Iʽ��6vendor/nikic/php-parser/lib/PhpParser/ErrorHandler.phpg�/bg�Ż��/vendor/nikic/php-parser/lib/PhpParser/Error.php`	�/b`	�� Ӷ?vendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php��/b�����Avendor/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php��/b��U0�7vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php��/b���1vendor/nikic/php-parser/lib/PhpParser/Comment.php9�/b9�Zζ;vendor/nikic/php-parser/lib/PhpParser/Node/NullableType.php9�/b9V�ٶ3vendor/nikic/php-parser/lib/PhpParser/Node/Name.php	�/b	�
�(�5vendor/nikic/php-parser/lib/PhpParser/Node/Const_.phpq�/bq����3vendor/nikic/php-parser/lib/PhpParser/Node/Stmt.phpk�/bk��D�=vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php�	�/b�	��@vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php7�/b7�Drٶ>vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.phpY�/bYQ�q�=vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.phpf�/bf�"8��Hvendor/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.phpD�/bDC��=vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php��/b�F�3p�Evendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php��/b��8��Evendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php��/b����Gvendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php��/b�1���Gvendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php��/b�����Gvendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php��/b��Ƨ��Jvendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php��/b��߶Kvendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php��/b�:��Dvendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php��/b�]ad�4vendor/nikic/php-parser/lib/PhpParser/Node/Param.phpM�/bM%��.�;vendor/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php��/b����^�Avendor/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.phph�/bh�=�Ķ;vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php.�/b.1�?�;vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php��/b��j�P�<vendor/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php��/b���_�<vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php/�/b/%�ض@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.phpq�/bq�59�Fvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.phpw�/bwI�
�Dvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.phpu�/bu��˶Dvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.phpu�/bu�>�m�Bvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.phps�/bs҆
��Kvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php|�/b|�Lwu�Fvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.phpx�/bx�(|D�@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.phpq�/bq��p�@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.phpq�/bq2+l�Bvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.phps�/bs€V�Fvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.phpw�/bw��2�Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.phpx�/bx���@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.phpq�/bqc]��Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.phpx�/bxH�遶Ivendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.phpz�/bz�C::�Kvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php|�/b|ق��Evendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.phpv�/bv��<�Fvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.phpw�/bw���@�Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.phpx�/bx��}�Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.phpx�/bx��J@�Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.phpx�/bxL|,�Fvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.phpw�/bw�<U�Avendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.phpr�/br��p�Cvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.phpt�/bt�G~�Fvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.phpw�/bw�p׶Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.phpx�/bx����Evendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.phpw�/bwW|�]�<vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.phpq�/bqe�]��<vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php{�/b{���=vendor/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php5�/b5VM}��>vendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php��/b�C��?vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php��/b��=ȶ9vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php1�/b1bJﴶ:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.phps�/bsH���9vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php��/b��|�9vendor/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php7�/b7��\$�;vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php��/b��{�Ƕ=vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php;�/b;���8vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php9�/b9U�\Ƕ>vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.phpm�/bm;[o�Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php��/b���$�9vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.phpc�/bc"�le�>vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php6�/b6&b���>vendor/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php��/b��̀��>vendor/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php6�/b6G��<vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php��/b��T���8vendor/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php��/b��0���:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.phpf�/bf���@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.phpq�/bqZI�Fvendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.phpw�/bw!���Bvendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.phps�/bs���@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.phpq�/bqx�Eֶ@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.phpq�/bq�y��Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.phpx�/bxu�0F�@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.phpq�/bq��:�Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.phpx�/bx�*�Gvendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.phpx�/bx2�ֶAvendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.phpr�/br[Wr�Cvendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.phpt�/bt��&�Fvendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.phpw�/bw���!�>vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php6�/b6�X��:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php2�/b2��OX�:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php-�/b-�"��:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php3�/b3tel$�:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.phpy�/by'��^�;vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php.�/b.fWư�:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php2�/b2��2��Avendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.phpo�/bohN��=vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php��/b�;�8�=vendor/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php5�/b5���ٶAvendor/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php9�/b9�(ᙶ=vendor/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.phpi�/biW�v$�:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php2�/b2un5�@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.phpj�/bj�>JW�?vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.phph�/bhb��!�?vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.phph�/bh����@vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.phpj�/bjj�*�?vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.phpi�/bi�ۯڶ>vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.phph�/bh�8g�=vendor/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.phpg�/bg��6��:vendor/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php-�/b-W�p=�>vendor/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.phpO�/bOcZ�Cvendor/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php��/b�?{�9vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php,�/b,#�n��9vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.phpA�/bA8p۶<vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php��/b�Gߵ��8vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php��/b���a�7vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php}�/b}HV�e�;vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.phpw�/bw$X���7vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php��/b�j�PO�:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php3�/b3����9vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php,�/b,� ���9vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.phpu�/bu�d��>vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php �/b �Hڶ:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php��/b�8�=vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php��/b��tZ�:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php=�/b=xB�8vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php��/b���l*�;vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php?�/b?�
䲶<vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php��/b��T�>vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php��/b��Eq�=vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php�/b�/���;vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php��/b��k��<vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php��/b��'��<vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.phpD�/bDt�޶9vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php7�/b7����?vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php)�/b)H)��Bvendor/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.phps�/bs�S��:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php`�/b`A���<vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php��/b���.��:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php7�/b7�r�@vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.phpL�/bL,�I}�:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php��/b��;l�:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php��/b���т�Dvendor/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php��/b� gȶ=vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php<�/b<l��:�>vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php6�/b6"��]�Fvendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php��/b�lw��Qvendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php��/b�ÖCR�Lvendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php�/b��ކ�=vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php�/b|��r�7vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php{�/b{�g�ڶ;vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php4�/b4&*-h�>vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php��/b����Ͷ<vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php;�/b;�rQ��:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php��/b�a��8�<vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php��/b���+Ѷ;vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php4�/b4٘���:vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php9�/b9�oU�2vendor/nikic/php-parser/lib/PhpParser/Node/Arg.php��/b����3vendor/nikic/php-parser/lib/PhpParser/Node/Expr.phpk�/bk�Pp@�Bvendor/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php8�/b8��qʶ<vendor/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php2�/b2�!Y�5vendor/nikic/php-parser/lib/PhpParser/Node/Scalar.phpH�/bH/��8vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php8�/b8�Dr��?vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.phpn�/bn3*i�4vendor/nikic/php-parser/lib/PhpParser/Serializer.phph�/bh�}��0vendor/nikic/php-parser/lib/PhpParser/Parser.php}�/b}����8vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php?�/b?��:�7vendor/nikic/php-parser/lib/PhpParser/ParserFactory.phpP�/bPr(,d�Bvendor/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php��/b�8'�ö4vendor/nikic/php-parser/lib/PhpParser/Autoloader.php��/b�]��9vendor/nikic/php-parser/lib/PhpParser/BuilderAbstract.php$�/b$�=�~�@vendor/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php��/b�>~m�5vendor/nikic/php-parser/lib/PhpParser/Comment/Doc.phpM�/bM��MӶ6vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php7�/b7�1O��8vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php��/b�N��^�7vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php��/b�K�ζ<vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php�/b�3�)�8vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.phpJ�/bJ<d�>vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php!�/b!2���8vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.phpa�/ba 5���;vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.phpA�/bA�V!K�<vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php��/b�e��:vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php��/b�H�ƶ=vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php��/b������6vendor/nikic/php-parser/lib/PhpParser/Unserializer.phph�/bho��R�5vendor/nikic/php-parser/lib/PhpParser/NodeVisitor.php�/bH�թ�4vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php8�/b8=���(vendor/nikic/php-parser/test_old/run.php��/b����.box/src/Printer.php
�/b
{���".box/src/IsPhpVersionFulfilled.php?�/b?f7I�.box/src/Requirement.php|�/b|��n��.box/src/Checker.php��/b���Y��".box/src/RequirementCollection.php��/b��ۊ��.box/src/IsFulfilled.phpu�/bu�>��.box/src/Terminal.phpy
�/by
���Ƕ!.box/src/IsExtensionFulfilled.php��/b�OoX��.box/src/IO.php;�/b;C#Y�.box/.requirements.php��/b�T�.��.box/bin/check-requirements.php�/b雔��(.box/vendor/composer/autoload_static.php��/b��A�$.box/vendor/composer/ClassLoader.php�4�/b�4�z���&.box/vendor/composer/autoload_real.php��/b�g���1.box/vendor/composer/semver/src/VersionParser.php:�/b:Z�Sq�..box/vendor/composer/semver/src/Comparator.php��/b�_��;�*.box/vendor/composer/semver/src/Semver.php��/b��Q�z�B.box/vendor/composer/semver/src/Constraint/ConstraintInterface.php�/bu�ȃ�9.box/vendor/composer/semver/src/Constraint/Constraint.php�/b��B�>.box/vendor/composer/semver/src/Constraint/MultiConstraint.php��/b��6���A.box/vendor/composer/semver/src/Constraint/AbstractConstraint.php��/b���2�>.box/vendor/composer/semver/src/Constraint/EmptyConstraint.php��/b�Ԣ6_�#.box/vendor/composer/semver/LICENSE�/bBh�*.box/vendor/composer/autoload_classmap.php�/bL��b�&.box/vendor/composer/autoload_psr4.php4�/b4}�G�.box/vendor/composer/LICENSE.�/b. ��,.box/vendor/composer/autoload_namespaces.php��/b�t�!׶.box/vendor/autoload.php��/b����<?php
namespace Civi\Cv;

class SiteConfigReader {

protected $settingsFile;

protected $cache = array();






public function __construct($settingsFile) {
$this->settingsFile = $settingsFile;
}






public function compile($parts) {
$data = array();

foreach ($parts as $part) {
switch ($part) {
case 'buildkit':
$data = array_merge($data, $this->readBuildkitConfig());
break;

case 'home':
$data = array_merge($data, $this->readHomeConfig());
break;

case 'active':
$data = array_merge($data, $this->readActiveConfig());
break;
}

}
return $this->clean($data);
}






public function readBuildkitConfig() {
if (!isset($this->cache['buildkit'])) {
$shFile = BuildkitReader::findShFile($this->settingsFile);
$this->cache['buildkit'] = $shFile ? BuildkitReader::readShFile($shFile) : array();
}
return $this->cache['buildkit'];
}






public function readHomeConfig() {
if (!isset($this->cache['home'])) {
$config = Config::read();
$this->cache['home'] = isset($config['sites'][$this->settingsFile])
? $config['sites'][$this->settingsFile] : array();
}
return $this->cache['home'];
}




public function readActiveConfig() {
if (!defined('CIVICRM_SETTINGS_PATH') || CIVICRM_SETTINGS_PATH !== $this->settingsFile) {
return array();
}

$paths = is_callable(array('Civi', 'paths')) ? \Civi::paths() : NULL;
$data = array(
'CMS_DB_DSN' => CIVICRM_UF_DSN,
'CMS_VERSION' => \CRM_Core_Config::singleton()->userSystem->getVersion(),
'CIVI_DB_DSN' => CIVICRM_DSN,
'CIVI_SITE_KEY' => CIVICRM_SITE_KEY,
'CIVI_VERSION' => \CRM_Utils_System::version(),
'CIVI_SETTINGS' => CIVICRM_SETTINGS_PATH,
'CIVI_TEMPLATEC' => \CRM_Core_Config::singleton()->templateCompileDir,
'CIVI_UF' => \CRM_Core_Config::singleton()->userFramework,
'IS_INSTALLED' => '1',
'SITE_TYPE' => 'cv-auto',
);

if (is_callable(array('Civi', 'paths'))) {
$data += [
'CMS_URL' => \Civi::paths()->getUrl('[cms.root]/', 'absolute'),
'CMS_ROOT' => \Civi::paths()->getPath('[cms.root]/.'),
'CIVI_CORE' => \Civi::paths()->getPath('[civicrm.root]/.'),

 'CIVI_URL' => \Civi::paths()->getUrl('[civicrm.root]/', 'absolute'),
'CIVI_FILES' => \Civi::paths()->getPath('[civicrm.files]/.'),
];
}
else {
$data += [
'CMS_URL' => \CRM_Utils_System::languageNegotiationURL(\CRM_Utils_System::baseCMSURL(), FALSE, TRUE),
'CMS_ROOT' => \CRM_Core_Config::singleton()->userSystem->cmsRootPath(),
'CIVI_CORE' => $GLOBALS['civicrm_root'],

 'CIVI_URL' => '',

 'CIVI_FILES' => dirname(\CRM_Core_Config::singleton()->templateCompileDir),
];
}

return $data;
}

/**
@parm

*/
public function clean($data) {
$this->cleanPaths($data);
$this->cleanUrls($data);
$this->cleanDbs($data);
ksort($data);
return $data;
}




protected function cleanPaths(&$data) {
$paths = array('CIVI_CORE', 'CIVI_FILES', 'CIVI_TEMPLATEC', 'CMS_ROOT');
foreach ($paths as $path) {
if (!empty($data[$path])) {
$data[$path] = rtrim($data[$path], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}
}
}




protected function cleanUrls(&$data) {
$urls = array('CMS_URL', 'CIVI_URL');
foreach ($urls as $url) {
if (isset($data[$url])) {
$data[$url] = rtrim($data[$url], '/') . '/';
}
}
}




protected function cleanDbs(&$data) {
foreach (array('CIVI', 'CMS', 'TEST') as $prefix) {
if (isset($data["{$prefix}_DB_DSN"])) {
$data = array_merge($data, $this->parseDsn($prefix, $data["{$prefix}_DB_DSN"]));
}
}
}

protected function parseDsn($prefix, $dsn) {
$url = parse_url($dsn);


 $parts = array();
if (!empty($url['host'])) {
$parts[] = '-h';
$parts[] = $url['host'];
}
if (!empty($url['user'])) {
$parts[] = '-u';
$parts[] = $url['user'];
}
if (!empty($url['pass'])) {
$parts[] = '-p' . $url['user'];
}
if (!empty($url['port'])) {
$parts[] = '-P';
$parts[] = $url['port'];
}
if (!empty($url['path'])) {
$parts[] = trim($url['path'], '/');
}
foreach ($parts as $part) {
if (!preg_match('/^[a-zA-Z0-9\._+\-]*$/', $part)) {
throw new \InvalidArgumentException("Cannot format DB CLI arguments ($dsn)");
}
}

return array(
"{$prefix}_DB_USER" => empty($url['user']) ? '' : $url['user'],
"{$prefix}_DB_PASS" => empty($url['pass']) ? '' : $url['pass'],
"{$prefix}_DB_HOST" => empty($url['host']) ? '' : $url['host'],
"{$prefix}_DB_PORT" => empty($url['port']) ? '' : $url['port'],
"{$prefix}_DB_NAME" => empty($url['path']) ? '' : trim($url['path'], '/'),
"{$prefix}_DB_ARGS" => implode(' ', $parts),
);
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
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 DebugContainerCommand extends BaseCommand {

use BootTrait;
use StructuredOutputTrait;

protected function configure() {
$this
->setName('debug:container')
->setDescription('Dump the container configuration')
->addArgument('name', InputArgument::OPTIONAL, 'An service name or regex')
->addOption('concrete', 'C', InputOption::VALUE_NONE, 'Display concrete class names. (This requires activating every matching service.)')
->configureOutputOptions(['tabular' => TRUE, 'fallback' => 'table'])
->setHelp('
Dump the container configuration
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
define('CIVICRM_CONTAINER_CACHE', 'never');
$output->getErrorOutput()->writeln('<comment>The debug command ignores the container cache.</comment>');
$this->boot($input, $output);


 $z = new \Civi\Core\Container();
$c = $z->createContainer();
if (version_compare(\CRM_Utils_System::version(), '4.7.0', '>=')) {
$c->compile();
}

$filterPat = $input->getArgument('name');
if (empty($filterPat)) {
$filter = function () {
return TRUE;
};
}
elseif ($filterPat[0] === '/') {
$filter = function ($n) use ($filterPat) {
return (bool) preg_match($filterPat, $n);
};
}
else {
$filter = function ($n) use ($filterPat) {
return $n === $filterPat;
};
}

$rows = array();
$definitions = $c->getDefinitions();
ksort($definitions);
foreach ($definitions as $name => $definition) {
if (!$filter($name)) {
continue;
}

$extras = array();
foreach (['getFactoryClass', 'getFactoryMethod', 'getFactoryService', 'getFactory'] as $factoryCheck) {
if (is_callable([$definition, $factoryCheck]) && $definition->$factoryCheck()) {
$extras[] = 'factory';
}
}
if ($definition->getMethodCalls()) {
$extras[] = sprintf("calls[%s]", count($definition->getMethodCalls()));
}
if ($definition->getTags()) {
$extras[] = sprintf("tags[%s]", count($definition->getTags()));
}
$class = $input->getOption('concrete') ? get_class(\Civi::service($name)) : $definition->getClass();

$rows[] = array('service' => $name, 'class' => $class, 'extras' => implode(' ', $extras));
}

$this->sendTable($input, $output, $rows, array('service', 'class', 'extras'));
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Encoder;
use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
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 ApiCommand extends BaseCommand {

use BootTrait;
use StructuredOutputTrait;




public $defaults;




public function __construct($name = NULL) {
$this->defaults = array('version' => 3);
parent::__construct($name);
}

protected function configure() {
$this
->setName('api')
->setAliases(['api3'])
->setDescription('Call APIv3')
->addOption('in', NULL, InputOption::VALUE_REQUIRED, 'Input format (args,json)', 'args')
->configureOutputOptions(['tabular' => TRUE, 'shortcuts' => ['table', 'list']])
->addArgument('Entity.action', InputArgument::REQUIRED)
->addArgument('key=value', InputArgument::IS_ARRAY)
->setHelp('Call APIv3

Examples:
  cv api system.get
  cv api contact.get id=10
  echo \'{"id":10, "api.Email.get": 1}\' | cv api contact.get --in=json

TIP: To change the default output format, set CV_OUTPUT.

TIP: To display a full backtrace of any errors, pass "-vv" (very verbose).
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$C = '<comment>';
$_C = '</comment>';
$I = '<info>';
$_I = '</info>';

$this->boot($input, $output);

list($entity, $action) = explode('.', $input->getArgument('Entity.action'));
$params = $this->parseParams($input);

if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE && !array_key_exists('debug', $params)) {
$params['debug'] = 1;
}

if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$output->writeln("{$I}Entity{$_I}: {$C}$entity{$_C}");
$output->writeln("{$I}Action{$_I}: {$C}$action{$_C}");
$output->writeln("{$I}Params{$_I}: " . json_encode($params, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
}

$result = \civicrm_api($entity, $action, $params);

if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE && $result['trace']) {
$output->getErrorOutput()->writeln("<error>Error: " . (isset($result['error_message']) ? $result['error_message'] : "") . "</error>");
$output->getErrorOutput()->writeln("  " . str_replace("\n", "\n  ", $result['trace']), OutputInterface::OUTPUT_RAW);
$output->getErrorOutput()->write("\n");
unset($result['trace']);
}

$out = $input->getOption('out');
if (!in_array($out, Encoder::getFormats()) && in_array($out, Encoder::getTabularFormats())) {

 if ($action !== 'get' || !isset($result['values']) || !empty($result['is_error'])) {
$output->getErrorOutput()
->writeln("<error>The output format \"$out\" only works with tabular data. Try using a \"get\" API. Forcing format to \"json-pretty\".</error>");
$input->setOption('out', 'json-pretty');
$this->sendResult($input, $output, $result);
}
else {
$columns = empty($params['return']) ? NULL : explode(',',
$params['return']);
$this->sendTable($input, $output, array_values($result['values']),
$columns);
}
}
else {
$this->sendResult($input, $output, $result);
}

return empty($result['is_error']) ? 0 : 1;
}






protected function parseParams(InputInterface $input) {
$args = $input->getArgument('key=value');
switch ($input->getOption('in')) {
case 'args':
$params = $this->defaults;
foreach ($args as $arg) {
preg_match('/^([^=]+)=(.*)$/', $arg, $matches);
$params[$matches[1]] = $matches[2];
}
break;

case 'json':
$json = stream_get_contents(STDIN);
if (empty($json)) {
$params = $this->defaults;
}
else {
$params = array_merge($this->defaults, json_decode($json, TRUE));
}
break;

default:
throw new \RuntimeException('Unknown input format');
}
return $params;
}

}
<?php
namespace Civi\Cv\Command;

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 ExtensionEnableCommand extends BaseExtensionCommand {




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ext:enable')
->setAliases(array('en'))
->setDescription('Enable an extension')
->addOption('refresh', 'r', InputOption::VALUE_NONE, 'Refresh the local list of extensions (Default: Only refresh on cache-miss)')
->addOption('ignore-missing', NULL, InputOption::VALUE_NONE, 'If a requested extension is missing, skip it')
->addArgument('key-or-name', InputArgument::IS_ARRAY, 'One or more extensions to enable. Identify the extension by full key ("org.example.foobar") or short name ("foobar")')
->setHelp('Enable an extension

Examples:
  cv ext:enable org.example.foobar
  cv en foobar

Note:
  Beginning circa CiviCRM v4.2+, it has been recommended that extensions
  include a unique long name ("org.example.foobar") and a unique short
  name ("foobar"). However, short names are not strongly guaranteed.
  
  This subcommand does not output parseable data. For parseable output,
  consider using `cv api extension.install`.
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);


 $refresh = $input->getOption('refresh') ? 'yes' : 'auto';

 while (TRUE) {
if ($refresh === 'yes') {
$output->writeln("<info>Refreshing extension cache</info>");
$result = $this->callApiSuccess($input, $output, 'Extension', 'refresh', array(
'local' => TRUE,
'remote' => FALSE,
));
if (!empty($result['is_error'])) {
return 1;
}
}

list ($foundKeys, $missingKeys) = $this->parseKeys($input, $output);
if ($refresh == 'auto' && !empty($missingKeys)) {
$output->writeln("<info>Extension cache does not contain requested item(s)</info>");
$refresh = 'yes';
}
else {
break;
}
}

if ($missingKeys) {
if ($input->getOption('ignore-missing')) {
foreach ($missingKeys as $key) {
$output->getErrorOutput()->writeln("<error>Warning: Skipped unrecognized extension \"$key\"</error>");
}

}
else {
foreach ($missingKeys as $key) {
$output->getErrorOutput()->writeln("<error>Error: Unrecognized extension \"$key\"</error>");
}
return 1;
}
}

foreach ($foundKeys as $key) {
$output->writeln("<info>Enabling extension \"$key\"</info>");
}

$result = $this->callApiSuccess($input, $output, 'Extension', 'install', array(
'keys' => $foundKeys,
));
return empty($result['is_error']) ? 0 : 1;
}

}
<?php
namespace Civi\Cv\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ExtensionUpgradeDbCommand extends BaseExtensionCommand {




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ext:upgrade-db')
->setAliases(array())
->setDescription('Apply DB upgrades for any extensions')
->setHelp('Apply DB upgrades for any extensions

Examples:
  cv ext:upgrade-db

Note:
  This subcommand does not output parseable data. For parseable output,
  consider using `cv api extension.upgrade`.
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);

$output->writeln("<info>Applying database upgrades from extensions</info>");
$result = $this->callApiSuccess($input, $output, 'Extension', 'upgrade', array());
if (!empty($result['is_error'])) {
return 1;
}
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\Filesystem;
use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ScriptCommand extends BaseCommand {

use BootTrait;

protected function configure() {
$this
->setName('php:script')
->setAliases(array('scr'))
->setDescription('Execute a PHP script')
->addArgument('script', InputArgument::REQUIRED);
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$fs = new Filesystem();
$origScript = $fs->toAbsolutePath($input->getArgument('script'));

$origCwd = getcwd();
$this->boot($input, $output);
$postCwd = getcwd();


 if (file_exists($origScript)) {
chdir($origCwd);
$this->runScript($output, $origScript);
return 0;
}


 $postScript = $fs->toAbsolutePath($input->getArgument('script'));
if (file_exists($postScript)) {
$output->getErrorOutput()->writeln("<comment>WARNING: Loaded script relative to CMS root -- which is deprecated. Script path should be (a) absolute or (b) relative to CWD.</comment>");
chdir($postCwd);
$this->runScript($output, $postScript);
return 0;
}

$output->getErrorOutput()->writeln("<error>Failed to locate script: " . $input->getArgument('script') . "</error>");
return 1;
}





protected function runScript(OutputInterface $output, $script) {
$output->writeln("<info>[ScriptCommand]</info> Start \"$script\"", OutputInterface::VERBOSITY_DEBUG);
require $script;
$output->writeln("<info>[ScriptCommand]</info> Finish \"$script\"", OutputInterface::VERBOSITY_DEBUG);
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class UpgradeCommand extends BaseCommand {

use StructuredOutputTrait;

protected function configure() {
$this
->setName('upgrade')
->setDescription('Download CiviCRM and upgrade the site')
->addOption('in', NULL, InputOption::VALUE_REQUIRED, 'Input format (args,json)', 'args')
->configureOutputOptions()
->addOption('stability', 's', InputOption::VALUE_REQUIRED, 'Specify the stability of the version to get (nightly, rc, stable)', 'stable')
->setHelp('Download CiviCRM, extract in place, and upgrade the site, notifying civicrm.org
Examples:
  cv upgrade --stability=rc
');

 }

protected function execute(InputInterface $input, OutputInterface $output) {

throw new \RuntimeException("FIXME: Calls to run() should be escaped, e.g. with Process::sprintf()");

$exitCode = 0;
$stage = 'Start';
$result = array();
$reportName = \Civi\Cv\Util\Rand::createName();
try {
$stability = $input->getOption('stability');
$stage = 'Lookup';
$dl = \Civi\Cv\Util\Cv::run("upgrade:get --stability=$stability");
$result['dl-data'] = $dl;
if (!empty($dl['error'])) {
throw new \RuntimeException($dl['error'], 1);
}
$stage = 'Start report';
$startReport = \Civi\Cv\Util\Cv::run("upgrade:report --started --revision={$dl['rev']} --name=$reportName");
$stage = 'Download and extract';
$extract = \Civi\Cv\Util\Cv::run("upgrade:dl --url={$dl['url']}");
$result['extract-data'] = $extract;
$stage = 'Download report';
$dlReport = \Civi\Cv\Util\Cv::run("upgrade:report --downloaded --download-url {$dl['url']} --extracted --name $reportName");
$stage = 'Database upgrade';
$db = \Civi\Cv\Util\Cv::run("upgrade:db");
$result['db-upgrade'] = $db;
$messageFile = sys_get_temp_dir() . "/upgrademessages-$reportName.html";
file_put_contents($messageFile, $db['message']);
$stage = 'Upgrade report';
$finishReport = \Civi\Cv\Util\Cv::run("upgrade:report --upgraded --upgrade-messages $messageFile --name $reportName");


 $stage = 'Cleanup';
unlink($messageFile);
}
catch (\RuntimeException $e) {
$exitCode = 1;
$result['error-stage'] = $stage;
$result['error-message'] = $e->getMessage();
$problem = "$stage problem: {$result['error_message']}";
$result['fail-report'] = \Civi\Cv\Util\Cv::run("upgrade:report --failed --problem-message '$problem' --name $reportName");
}

$this->sendResult($input, $output, $result);
return $exitCode;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\SetupCommandTrait;
use Civi\Cv\Util\DebugDispatcherTrait;
use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class CoreCheckReqCommand extends BaseCommand {

use SetupCommandTrait;
use DebugDispatcherTrait;
use StructuredOutputTrait;

protected function configure() {
$this
->setName('core:check-req')
->setDescription('Check installation requirements')
->configureOutputOptions(['tabular' => TRUE, 'fallback' => 'table'])
->addOption('filter-warnings', 'w', InputOption::VALUE_NONE, 'Show warnings')
->addOption('filter-errors', 'e', InputOption::VALUE_NONE, 'Show errors')
->addOption('filter-infos', 'i', InputOption::VALUE_NONE, 'Show info')
->configureSetupOptions()
->setHelp('
Check whether installation requirements are met.

Example: Show all checks
$ cv core:check-req

Example: Show only errors
$ cv core:check-req -e

Example: Show warnings and errors
$ cv core:check-req -we
');
$this->configureBootOptions('none');
}

protected function execute(InputInterface $input, OutputInterface $output) {
$filterSeverities = $this->parseFilter($input);

$showBootMsgsByDefault = in_array($input->getOption('out'), ['table', 'pretty']);
$setup = $this->bootSetupSubsystem($input, $output, $showBootMsgsByDefault ? 0 : OutputInterface::VERBOSITY_VERBOSE);
$reqs = $setup->checkRequirements();
$messages = array_filter($reqs->getMessages(), function ($m) use ($filterSeverities) {
return in_array($m['severity'], $filterSeverities);
});
uasort($messages, function ($a, $b) {
return strcmp(
$a['severity'] . '-' . $a['section'] . '-' . $a['name'],
$b['severity'] . '-' . $b['section'] . '-' . $b['name']
);
});
$this->sendTable($input, $output, $messages, array('severity', 'section', 'name', 'message'));
return $reqs->getErrors() ? 1 : 0;
}





protected function parseFilter(InputInterface $input) {
$filterSeverities = array();
if ($input->getOption('filter-warnings')) {
$filterSeverities[] = 'warning';
}
if ($input->getOption('filter-errors')) {
$filterSeverities[] = 'error';
}
if ($input->getOption('filter-infos')) {
$filterSeverities[] = 'info';
}
if ($filterSeverities === array()) {
$filterSeverities = array('warning', 'error', 'info');
}
return $filterSeverities;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class ApiBatchCommand extends BaseCommand {

use BootTrait;




public $defaults = [];

public $metaDefaults = [
'v3' => ['version' => 3],
'v4' => ['version' => 4, 'checkPermissions' => FALSE],
];




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('api:batch')
->setDescription('Call multiple APIs via STDIN/STDOUT (bidirectional pipe; batch mode)')
->addOption('in', NULL, InputOption::VALUE_REQUIRED, 'Input format (json)', 'json')
->addOption('out', NULL, InputOption::VALUE_REQUIRED, 'Output format (json)', 'json')
->addOption('defaults', NULL, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Set default options for all requests (Either string \'v3\', \'v4\', or a JSON object \'{key:value...}\'', ['v3'])
->setHelp('Call multiple APIs via STDIN/STDOUT (bidirectional pipe; batch mode)

The api:batch command implements a line-oriented protocol for running CiviCRM APIs using pipes. In basic form, you may pipe in JSON:

Example: APIv3
  echo \'[["Contact","get",{"id":100}],["Contact","get",{"id":101}]]\' | cv api:batch

Example: APIv4
  echo \'[["Contact","get",{"where":[["id","=",100]]}]]\' | cv api:batch --defaults=v4

Example: Extra defaults
  echo \'[["Contact","get",{"where":[["id","=",100]]}]]\' | cv api:batch --defaults=\'{"version":4,"checkPermissions":true}\'

More advanced consumers may use bi-directional piping to send and receive multiple, dynamic calls - without requiring multiple bootstraps.

Protocol:

* Client may submit multiple lines of input (separated by \\n).
* Each line is executed synchronously. Caller should write one line and then read one line.
* Each line of input is a JSON document, listing a batch of API requests.
* Each line of output is a JSON document, listing a batch of API responses.
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
if ($input->getOption('in') !== 'json' || $input->getOption('out') !== 'json') {

 throw new \Exception("api:batch only supports JSON dialog");
}
$this->boot($input, $output);

$addDefault = function($v) {
$this->defaults = \CRM_Utils_Array::crmArrayMerge($v, $this->defaults);
};
foreach ((array) $input->getOption('defaults') as $dflExpr) {
if (isset($this->metaDefaults[$dflExpr])) {
$addDefault($this->metaDefaults[$dflExpr]);
}
elseif ($dflExpr[0] === '{') {
if (($parsed = json_decode($dflExpr, 1)) !== NULL) {
$addDefault($parsed);
}
else {
throw new \Exception("Malformed defaults (JSON): $dflExpr");
}
}
else {
throw new \Exception("Malformed defaults: $dflExpr");
}
}

if ($output->isVerbose()) {
fwrite(STDERR, sprintf("Set API defaults: %s\n", json_encode($this->defaults, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)));
}

$lineNum = 0;


 while (FALSE !== ($line = fgets(STDIN))) {
$lineNum++;
$line = trim($line);
if (empty($line)) {
continue;
}

$todos = json_decode($line, TRUE);
$result = array();
if ($todos === NULL) {
fwrite(STDERR, sprintf("JSON cannot be decoded (line $lineNum)"));
}
else {
foreach ($todos as $k => $api) {
if (!is_array($api) || !isset($api[1]) || !is_string($api[0]) || !is_string($api[1])) {
fwrite(STDERR, "JSON data is structured incorrectly (line $lineNum)\n");
$result[$k] = array('is_error' => 1, 'error_message' => "JSON data is structured incorrectly (line $lineNum)");
continue;
}
list ($entity, $action, $params) = $api;
$params = \CRM_Utils_Array::crmArrayMerge($params, $this->defaults);
if ($output->isVerbose()) {
fwrite(STDERR, sprintf("Execute API calls: %s\n", json_encode([$entity, $action, $params], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)));
}
$result[$k] = \civicrm_api($entity, $action, $params);
}
}
echo json_encode($result);
echo "\n";

if (ob_get_level() > 0) {

 ob_flush();
}
flush();
}
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\Datasource;
use Civi\Cv\Util\Process;
use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class SqlCliCommand extends BaseCommand {

use BootTrait;

protected function configure() {
$this
->setName('sql')
->setAliases(array('sql:cli'))
->setDescription('Open the SQL CLI')
->addOption('eval', 'e', InputOption::VALUE_NONE, 'Enable evaluation of preprocessing expressions. (Pipe-only)')
->addOption('target', 'T', InputOption::VALUE_REQUIRED, 'Target DB (civi, cms)', 'civi')
->addOption('dry-run', 'N', InputOption::VALUE_NONE, 'Preview the SQL commands. Do not execute. (Pipe-only)')
->setHelp("
The \"sql\" command allows you to execute SQL interactively or through a pipe.

This is a wrapper for the \"mysql\" CLI command -- the general semantics
and notation are therefore inherited from MySQL's CLI.

Optionally, when piping in SQL, the \"--eval\" option adds support for extra
pre-processing features. Specifically, it interpolates and escapes environment variables:

  export USERNAME=badguy
  echo 'DELETE FROM users WHERE username = @ENV[USERNAME]' | cv sql -e

The ENV expressions are prefixed to indicate their escaping rule:

  @ENV[FOO]    Produces an escaped version of string FOO
  #ENV[FOO]    Produces the numerical value of FOO (or fails)
  !ENV[FOO]    Produces the raw, unescaped string version of FOO
");
$this->configureBootOptions();
}

protected function initialize(InputInterface $input, OutputInterface $output) {
if ($input->getOption('dry-run') && $output->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
}
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);

$datasource = new Datasource();
$datasource->loadFromCiviDSN($this->pickDsn($input->getOption('target')));

$mysql = Process::findCommand('mysql');
if (Process::isShellScript($mysql)) {
$output->getErrorOutput()->writeln("<info>[SqlCommand]</info> <comment>WARNING: The mysql command appears to be a wrapper script. In some environments, this may interfere with credential passing.</comment>");
}

$cmd = escapeshellcmd($mysql) . " " . $datasource->toMySQLArguments($this->findCreateTmpDir());
$output->getErrorOutput()->writeln("<info>[SqlCommand]</info> Launch sub-command: <comment>$cmd</comment>", OutputInterface::VERBOSITY_VERBOSE);

if (!$input->getOption('dry-run')) {
$process = proc_open(
$cmd,
array(
0 => $input->getOption('eval') ? array('pipe', 'r') : STDIN,
1 => STDOUT,
2 => STDERR,
),
$pipes
);
}

$finalSql = NULL;
if ($input->getOption('dry-run') || $input->getOption('eval')) {
$rawSql = trim(file_get_contents('php://stdin'), "\r\n");
$output->getErrorOutput()->writeln("<info>[SqlCommand]</info> Raw SQL:   <comment>$rawSql</comment>", OutputInterface::VERBOSITY_VERBOSE);

$finalSql = $input->getOption('eval') ? $this->filterSql($rawSql) : $rawSql;
$output->getErrorOutput()->writeln("<info>[SqlCommand]</info> Final SQL: <comment>$finalSql</comment>", OutputInterface::VERBOSITY_VERBOSE);
}

if (!$input->getOption('dry-run')) {
if ($finalSql !== NULL) {
fwrite($pipes[0], $finalSql);
fclose($pipes[0]);
}
return proc_close($process);
}
else {
return 0;
}
}

protected function filterSql($sql) {
$changed = preg_replace_callback('/([#!@])ENV\[([a-zA-Z0-9_]+)\]/', function ($matches) use ($pdo) {
$value = getenv($matches[2]);
switch ($matches[1]) {

 case '!':
return $value;


 case '#':
if (!is_numeric($value)) {
throw new \RuntimeException("Environment variable " . $matches[2] . " is not numeric!");
}
return $value;


 case '@':
return '"' . \CRM_Core_DAO::escapeString($value) . '"';

default:
throw new \RuntimeException("Variable prefix not recognized.");
}
}, $sql);
return $changed;
}




protected function findCreateTmpDir() {
$path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'cv-cli-' . posix_getuid();
if (!is_dir($path)) {
mkdir($path, 0700);
}
return $path;
}

/**
@host




*/
protected function pickDsn($target) {
$dsn = NULL;

switch ($target) {
case 'civi':
$dsn = CIVICRM_DSN;
break;

case 'cms':
$dsn = \CRM_Core_Config::singleton()->userFrameworkDSN;
break;
}

if (empty($dsn)) {
throw new \RuntimeException("Failed determine DSN for target \"$target\".");
}

return $dsn;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Encoder;
use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class EvalCommand extends BaseCommand {

use BootTrait;
use StructuredOutputTrait;

protected function configure() {
$this
->setName('php:eval')
->setAliases(array('ev'))
->setDescription('Evaluate a snippet of PHP code')
->addArgument('code')
->addOption('out', NULL, InputArgument::OPTIONAL, 'Specify return format (auto,' . implode(',', Encoder::getFormats()) . ')', 'auto')
->setHelp('
Evaluate a snippet of PHP code

Examples:
  cv ev \'civicrm_api3("System", "flush", array());\'
  cv ev \'if (rand(0,10)<5) echo "heads\n"; else echo "tails\n";\'

When reading data, you may use "return":
  cv ev \'return CRM_Utils_System::version()\'
  cv ev \'return CRM_Utils_System::version()\' --out=shell
  cv ev \'return CRM_Utils_System::version()\' --out=json

If the output format is set to "auto". This will be produce silent output -- unless
you use a "return" statement. In that case, it will use the default (' . \Civi\Cv\Encoder::getDefaultFormat() . ').

NOTE: To change the default output format, set CV_OUTPUT.
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);

if ($input->getOption('out') === 'auto') {
$hasReturn = preg_match('/^\s*return[ \t\r\n]/', $input->getArgument('code'))
|| preg_match('/[;\{]\s*return[ \t\r\n]/', $input->getArgument('code'));
$input->setOption('out', $hasReturn ? \Civi\Cv\Encoder::getDefaultFormat() : 'none');
}

$value = eval($input->getArgument('code') . ';');
$this->sendResult($input, $output, $value);
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
use Civi\Cv\Util\ConsoleQueueRunner;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;




class UpgradeDbCommand extends BaseCommand {

use BootTrait;
use StructuredOutputTrait;

protected function configure() {
$this
->setName('upgrade:db')
->setDescription('Run the database upgrade')
->configureOutputOptions(['fallback' => 'pretty'])
->addOption('dry-run', NULL, InputOption::VALUE_NONE, 'Preview the list of upgrade tasks')
->addOption('retry', NULL, InputOption::VALUE_NONE, 'Resume a failed upgrade, retrying the last step')
->addOption('skip', NULL, InputOption::VALUE_NONE, 'Resume a failed upgrade, skipping the last step')
->setHelp('Run the database upgrade

Examples:
  cv upgrade:db
  cv upgrade:db --dry-run
  cv upgrade:db --retry
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
if (!defined('CIVICRM_UPGRADE_ACTIVE')) {
define('CIVICRM_UPGRADE_ACTIVE', 1);
}
$this->boot($input, $output);

if (!ini_get('safe_mode')) {
set_time_limit(0);
}

$niceMsgVerbosity = $input->getOption('out') === 'pretty' ? OutputInterface::VERBOSITY_NORMAL : OutputInterface::VERBOSITY_VERBOSE;
$isFirstTry = !$input->getOption('retry') && !$input->getOption('skip');

$codeVer = \CRM_Utils_System::version();
$dbVer = \CRM_Core_BAO_Domain::version();
$postUpgradeMessageFile = $this->getUpgradeFile();
$output->writeln(sprintf("<info>Found CiviCRM database version <comment>%s</comment>.</info>", $dbVer), $niceMsgVerbosity);
$output->writeln(sprintf("<info>Found CiviCRM code version <comment>%s</comment>.</info>", $codeVer), $niceMsgVerbosity);

if (version_compare($codeVer, $dbVer) == 0) {
$result = array(
'latestVer' => $codeVer,
'message' => "You are already upgraded to CiviCRM $codeVer",
);
$result['text'] = $result['message'];
$this->sendResult($input, $output, $result);
return 0;
}

if ($isFirstTry && FALSE !== stripos($dbVer, 'upgrade')) {
throw new \Exception("Cannot begin upgrade: The database indicates that an incomplete upgrade is pending. If you would like to resume, use --retry or --skip.");
}
if (!$isFirstTry && !file_exists($postUpgradeMessageFile)) {
throw new \Exception("Cannot resume upgrade: The log file ($postUpgradeMessageFile) is missing. Consider a regular upgrade (without --retry or --skip).");
}

$upgrade = new \CRM_Upgrade_Form();

if ($error = $upgrade->checkUpgradeableVersion($dbVer, $codeVer)) {
throw new \Exception($error);
}

if ($isFirstTry) {
$output->writeln("<info>Checking pre-upgrade messages...</info>", $niceMsgVerbosity);
$preUpgradeMessage = NULL;
$upgrade->setPreUpgradeMessage($preUpgradeMessage, $dbVer, $codeVer);
if ($preUpgradeMessage) {
$output->writeln(\CRM_Utils_String::htmlToText($preUpgradeMessage), $niceMsgVerbosity);
if ($input->isInteractive() && $input->getOption('out') === 'pretty') {
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion("\n<comment>Press ENTER to continue</comment>\n", TRUE);
if (!$helper->ask($input, $output, $question)) {
$output->writeln("<error>Abort</error>");
return 1;
}
}
}
else {
$output->writeln("(No messages)", $niceMsgVerbosity);
}
}


 if ($isFirstTry) {
$output->writeln("<info>Dropping SQL triggers...</info>", $niceMsgVerbosity);
if (!$input->getOption('dry-run')) {
\CRM_Core_DAO::dropTriggers();
}
}

if ($isFirstTry) {
$output->writeln("<info>Preparing upgrade...</info>", $niceMsgVerbosity);
file_put_contents($postUpgradeMessageFile, "");
chmod($postUpgradeMessageFile, 0700);
$queue = \CRM_Upgrade_Form::buildQueue($dbVer, $codeVer, $postUpgradeMessageFile);

if (!($queue instanceof \CRM_Queue_Queue_Sql)) {

 throw new \RuntimeException("Error: \"cv upgrade\" only supports SQL-based queues.");
}
}
else {
$output->writeln("<info>Resuming upgrade...</info>", $niceMsgVerbosity);
$queue = \CRM_Queue_Service::singleton()->load(array(
'name' => \CRM_Upgrade_Form::QUEUE_NAME,
'type' => 'Sql',
));

if ($input->getOption('skip')) {
$item = $queue->stealItem();
$output->writeln(sprintf("<error>Skip task: %s</error>", $item->data->title));
$queue->deleteItem($item);
}

}

$output->writeln("<info>Executing upgrade...</info>", $niceMsgVerbosity);
$runner = new ConsoleQueueRunner($input, $output, $queue, $input->getOption('dry-run'));
$runner->runAll();

$output->writeln("<info>Finishing upgrade...</info>", $niceMsgVerbosity);
if (!$input->getOption('dry-run')) {
\CRM_Upgrade_Form::doFinish();
}

$output->writeln("<info>Upgrade to <comment>$codeVer</comment> completed.</info>", $niceMsgVerbosity);

if (version_compare($codeVer, '5.26.alpha', '<')) {

 
 $output->writeln('<info>Detected CiviCRM 5.25 or earlier. Force flush.</info>');
\Civi\Cv\Util\Cv::passthru("flush");
}

$output->writeln("<info>Checking post-upgrade messages...</info>", $niceMsgVerbosity);
$message = file_get_contents($postUpgradeMessageFile);
if ($input->getOption('out') === 'pretty') {
if ($message) {
$output->writeln(\CRM_Utils_String::htmlToText($message), OutputInterface::OUTPUT_RAW);
}
else {
$output->writeln("(No messages)", $niceMsgVerbosity);
}
$output->writeln("<info>Have a nice day.</info>", $niceMsgVerbosity);
}
else {
$this->sendResult($input, $output, array(
'latestVer' => $codeVer,
'message' => $message,
'text' => \CRM_Utils_String::htmlToText($message),
));
}
unlink($postUpgradeMessageFile);
}









protected function getUpgradeFile() {
$home = getenv('HOME') ? getenv('HOME') : getenv('USERPROFILE');
if (empty($home) || !file_exists($home)) {
throw new \RuntimeException("Failed to locate HOME or USERPROFILE");
}

$dir = implode(DIRECTORY_SEPARATOR, [$home, '.cv', 'upgrade']);
if (!file_exists($dir)) {
if (!mkdir($dir, 0777, TRUE)) {
throw new \RuntimeException("Failed to initialize upgrade data folder: $dir");
}
}

$id = md5(implode(\CRM_Core_DAO::VALUE_SEPARATOR, array(
function_exists('posix_getuid') ? posix_getuid() : 0,
$home,
CIVICRM_SETTINGS_PATH,
$GLOBALS['civicrm_root'],


 parse_url(CIVICRM_DSN, PHP_URL_PATH),


 \CRM_Utils_Array::value('SCRIPT_FILENAME', $_SERVER, ''),


 \CRM_Utils_Array::value('HTTP_HOST', $_SERVER, ''),


 \CRM_Utils_Array::value('SERVER_PORT', $_SERVER, ''),
)));

return $dir . DIRECTORY_SEPARATOR . $id . '.dat';
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class BootCommand extends BaseCommand {

use BootTrait;

protected function configure() {
$this
->setName('php:boot')
->setDescription('Generate PHP bootstrap code');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);

switch ($input->getOption('level')) {
case 'classloader':
$code = sprintf('require_once  %s . "/CRM/Core/ClassLoader.php";', var_export(rtrim($GLOBALS["civicrm_root"], '/'), 1))
. '\CRM_Core_ClassLoader::singleton()->register();';
break;

case 'settings':
$code = \Civi\Cv\Bootstrap::singleton()->generate()
. '\CRM_Core_Config::singleton(FALSE);';
break;

case 'full':
$code = \Civi\Cv\Bootstrap::singleton()->generate()
. '\CRM_Core_Config::singleton();'
. '\CRM_Utils_System::loadBootStrap(array(), FALSE);';
break;

case 'none':
break;

default:
throw new \Exception("Cannot generate boot instructions for given boot level.");
}

$output->writeln('/*BEGINPHP*/');
$output->writeln($code);
$output->writeln('/*ENDPHP*/');
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\StructuredOutputTrait;
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 ExtensionListCommand extends BaseExtensionCommand {

use StructuredOutputTrait;




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ext:list')
->setAliases(array())
->setDescription('List extensions')
->addOption('local', 'L', InputOption::VALUE_NONE, 'Filter extensions by location (local)')
->addOption('remote', 'R', InputOption::VALUE_NONE, 'Filter extensions by location (remote)')
->addOption('refresh', 'r', InputOption::VALUE_NONE, 'Refresh the list of extensions')
->addOption('installed', 'i', InputOption::VALUE_NONE, 'Filter extensions by "installed" status (Equivalent to --statuses=installed)')
->addOption('statuses', NULL, InputOption::VALUE_REQUIRED, 'Filter extensions by status (comma separated)', '*')
->configureOutputOptions(['tabular' => TRUE, 'fallback' => 'table', 'defaultColumns' => 'location,key,name,version,status,downloadUrl'])
->addArgument('regex', InputArgument::OPTIONAL, 'Filter extensions by full key or short name')
->setHelp('List extensions

Examples:
  cv ext:list
  cv ext:list --remote --dev /mail/
  cv ext:list /^org.civicrm.*/
  cv ext:list -Li --columns=key,label

Note:
  If you do not specify --local (-L) or --remote (-R), then all are listed.

  Beginning circa CiviCRM v4.2+, it has been recommended that extensions
  include a unique long name ("org.example.foobar") and a unique short
  name ("foobar"). However, short names are not strongly guaranteed.
');
parent::configureRepoOptions();
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$wo = ($input->getOption('out') === 'table')
? (OutputInterface::OUTPUT_NORMAL | OutputInterface::VERBOSITY_NORMAL)
: (OutputInterface::OUTPUT_NORMAL | OutputInterface::VERBOSITY_VERBOSE);

list($local, $remote) = $this->parseLocalRemote($input);

if ($extRepoUrl = $this->parseRepoUrl($input)) {
global $civicrm_setting;
$civicrm_setting['Extension Preferences']['ext_repo_url'] = $extRepoUrl;
}

$this->boot($input, $output);

if ($remote) {
$output->writeln("<info>Using extension feed \"" . \CRM_Extension_System::singleton()->getBrowser()->getRepositoryUrl() . "\"</info>", $wo);
}

if ($input->getOption('refresh')) {
$output->writeln("<info>Refreshing extensions</info>", $wo);
$result = $this->callApiSuccess($input, $output, 'Extension', 'refresh', array(
'local' => $local,
'remote' => $remote,
));
if (!empty($result['is_error'])) {
return 1;
}
}

$columns = explode(',', $input->getOption('columns'));
$records = $this->sort($this->find($input), $columns);

$this->sendTable($input, $output, $records, $columns);

return 0;
}







protected function getRemoteInfos() {
static $cache = NULL;
if ($cache === NULL) {
$cache = \CRM_Extension_System::singleton()
->getBrowser()->getExtensions();
}
return $cache;
}







protected function find($input) {
$regex = $input->getArgument('regex');
list($local, $remote) = $this->parseLocalRemote($input);

if ($input->getOption('installed')) {
$statusFilter = array('installed');
}
elseif ($input->getOption('statuses') && $input->getOption('statuses') !== '*') {
$statusFilter = explode(',', $input->getOption('statuses'));
}
else {
$statusFilter = NULL;
}

$rows = array();

if ($remote) {
foreach ($this->getRemoteInfos() as $info) {
$rows[] = array(
'location' => 'remote',
'key' => $info->key,
'name' => $info->file,
'version' => $info->version,
'label' => $info->label,
'status' => '',
'type' => $info->type,
'path' => '',
'downloadUrl' => $info->downloadUrl,
);
}
}

if ($local) {
$keys = \CRM_Extension_System::singleton()->getFullContainer()->getKeys();
$statuses = \CRM_Extension_System::singleton()->getManager()->getStatuses();
$mapper = \CRM_Extension_System::singleton()->getMapper();
foreach ($keys as $key) {
$info = $mapper->keyToInfo($key);
$rows[] = array(
'location' => 'local',
'key' => $key,
'name' => $info->file,
'version' => $info->version,
'label' => $info->label,
'status' => isset($statuses[$key]) ? $statuses[$key] : '',
'type' => $info->type,
'path' => $mapper->keyToBasePath($key),
'downloadUrl' => $info->downloadUrl,
);
}
}

$rows = array_filter($rows, function ($row) use ($regex, $statusFilter) {
if ($statusFilter !== NULL && !in_array($row['status'], $statusFilter)) {
return FALSE;
}
if ($regex) {
if (!preg_match($regex, $row['key']) && !preg_match($regex, $row['name'])) {
return FALSE;
}
}
return TRUE;
});

return $rows;
}

protected function sort($rows, $orderByColumns) {
usort($rows, function ($a, $b) use ($orderByColumns) {
foreach ($orderByColumns as $col) {
if ($a[$col] < $b[$col]) {
return -1;
}
if ($a[$col] > $b[$col]) {
return 1;
}
}

return 0;
});

return $rows;
}





protected function parseLocalRemote(InputInterface $input) {
if ($input->getOption('local') || $input->getOption('remote')) {
$local = (bool) $input->getOption('local');
$remote = (bool) $input->getOption('remote');
return array($local, $remote);
}
else {
$local = $remote = TRUE;
return array($local, $remote);
}
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Encoder;
use Civi\Cv\Util\OptionCallbackTrait;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class BaseCommand extends Command {

use OptionCallbackTrait;





protected function initialize(InputInterface $input, OutputInterface $output) {
parent::initialize($input, $output);
$this->runOptionCallbacks($input, $output);
}

protected function assertBooted() {
if (!$this->isBooted()) {
throw new \Exception("Error: This command requires bootstrapping, but the system does not appear to be bootstrapped. Perhaps you set --level=none?");
}
}














protected function callApiSuccess(InputInterface $input, OutputInterface $output, $entity, $action, $params) {
$this->assertBooted();
$params['debug'] = 1;
if (!isset($params['version'])) {
$params['version'] = 3;
}
$output->writeln("Calling $entity $action API", OutputInterface::VERBOSITY_DEBUG);
$result = \civicrm_api($entity, $action, $params);
if (!empty($result['is_error']) || $output->isDebug()) {
$data = array(
'entity' => $entity,
'action' => $action,
'params' => $params,
'result' => $result,
);
if (!empty($result['is_error'])) {
$output->getErrorOutput()->writeln("<error>Error: API Call Failed</error>: "
. Encoder::encode($data, 'pretty'));
}
else {
$output->writeln("API success" . Encoder::encode($data, 'pretty'),
OutputInterface::VERBOSITY_DEBUG);
}
}
return $result;
}





















public function parseOptionalOption(InputInterface $input, $rawNames, $omittedDefault, $activeDefault) {
$value = NULL;
foreach ($rawNames as $rawName) {
if ($input->hasParameterOption($rawName)) {
if (NULL === $input->getParameterOption($rawName)) {
return $activeDefault;
}
else {
return $input->getParameterOption($rawName);
}
}
}
return $omittedDefault;
}




protected function isBooted() {
return defined('CIVICRM_DSN');
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Encoder;
use Civi\Cv\Util\SetupCommandTrait;
use Civi\Cv\Util\DebugDispatcherTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;

class CoreInstallCommand extends BaseCommand {

use SetupCommandTrait;
use DebugDispatcherTrait;

protected function configure() {
$this
->setName('core:install')
->setDescription('Initialize the CiviCRM data-files and database-schema')
->configureSetupOptions()
->addOption('abort', 'A', InputOption::VALUE_NONE, 'In the event of conflict, abort.')
->addOption('keep', 'K', InputOption::VALUE_NONE, 'In the event of conflict, keep existing files/tables.')
->addOption('force', 'f', InputOption::VALUE_NONE, 'In the event of conflict, overwrite existing files/tables.')
->addOption('debug-event', NULL, InputOption::VALUE_OPTIONAL, 'Display debug information about events and exit. Give an event name or regex.')
->addOption('debug-model', NULL, InputOption::VALUE_NONE, 'Display debug information about model and exit.')
->setHelp('
Initialize the CiviCRM data-files and database-schema

Example: Install on a basic WordPress build.
$ cv core:install
$ wp plugin activate civicrm

Example: Install on a basic Drupal 7 build.
$ cv core:install --cms-base-url=http://example.com/
$ drush -y en civicrm

Example: Install on WordPress with a custom language and database.
$ cv core:install --lang=fr_FR --db=mysql://user:pass@host:3306/database
$ wp plugin activate civicrm

Example: Forcibly reinstall/overwrite. Display verbose debug info.
$ cv core:install -f -vv

Example: Inspect the installer events+plugins
$ cv core:install --debug-event

Example: Install while setting a hidden option
$ cv core:install --model=extras.opt-in.versionCheck=1
$ cv core:install -m extras.opt-in.versionCheck=1
');
$this->configureBootOptions('none');
}

protected function execute(InputInterface $input, OutputInterface $output) {
$setup = $this->bootSetupSubsystem($input, $output);

$debugMode = FALSE;

$debugEvent = $this->parseOptionalOption($input, ['--debug-event'], NULL, '');
if ($debugEvent !== NULL) {
$eventNames = $this->findEventNames($setup->getDispatcher(), $debugEvent);
$this->printEventListeners($output, $setup->getDispatcher(), $eventNames);
$debugMode = TRUE;
}

if ($input->getOption('debug-model')) {
$output->writeln(Encoder::encode($setup->getModel()->getValues(), 'json-pretty'));
$debugMode = 1;
}

if ($debugMode) {
return 0;
}

$this->runSetup($input, $output, $setup);
if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$output->writeln(Encoder::encode($setup->getModel()->getValues(), 'json-pretty'));
}
}











protected function pickConflictAction(
InputInterface $input,
OutputInterface $output,
$title
) {
if ($input->getOption('abort')) {
return 'abort';
}
if ($input->getOption('keep')) {
return 'keep';
}
if ($input->getOption('force')) {
return 'overwrite';
}

$helper = $this->getHelper('question');
$question = new ChoiceQuestion(
"The $title already exists. What you like to do?",
array(
'a' => "Abort. (Default.) (Equivalent to -A.)",
'k' => "Keep existing $title. (WARNING: This may fail if the existing version is out-of-date.) (Equivalent to -K.)",
'o' => "Overwrite with new $title. (WARNING: This may destroy data.) (Equivalent to -f.)",
),
'a'
);
switch ($helper->ask($input, $output, $question)) {
case 'k':
return 'keep';

case 'o':
return 'overwrite';

case 'a':
default:
return 'abort';
}
}







protected function runSetup(InputInterface $input, OutputInterface $output, $setup) {

 $reqs = $setup->checkRequirements();
foreach ($reqs->getWarnings() as $msg) {
$output->writeln(sprintf("<comment>WARNING: (<info>%s</info>) %s:</comment> %s", $msg['section'], $msg['name'], $msg['message']));
}
$errors = $reqs->getErrors();
if ($errors) {
foreach ($errors as $msg) {
$output->writeln(sprintf("<error>ERROR: (%s) %s:</error> %s", $msg['section'], $msg['name'], $msg['message']));
}
throw new \Exception('Requirements check failed.');
}


 $installed = $setup->checkInstalled();
if (!$installed->isSettingInstalled()) {
$output->writeln(sprintf("<info>Creating file <comment>%s</comment></info>", $setup->getModel()->settingsPath));
$setup->installFiles();
}
else {
$output->writeln(sprintf("<info>Found existing <comment>%s</comment> in <comment>%s</comment></info>", basename($setup->getModel()->settingsPath), dirname($setup->getModel()->settingsPath)));
switch ($this->pickConflictAction($input, $output, 'civicrm.settings.php')) {
case 'abort':
throw new \Exception("Aborted");

case 'overwrite':
$output->writeln(sprintf("<info>Removing <comment>%s</comment> from <comment>%s</comment></info>", basename($setup->getModel()->settingsPath), dirname($setup->getModel()->settingsPath)));
$setup->uninstallFiles();
$output->writeln(sprintf("<info>Creating <comment>%s</comment> in <comment>%s</comment></info>", basename($setup->getModel()->settingsPath), dirname($setup->getModel()->settingsPath)));
$setup->installFiles();
break;

case 'keep':
break;

default:
throw new \Exception("Unrecognized action");
}
}

if (!$installed->isDatabaseInstalled()) {
$output->writeln(sprintf("<info>Creating <comment>civicrm_*</comment> database tables in <comment>%s</comment></info>", $setup->getModel()->db['database']));
$setup->installDatabase();
}
else {
$output->writeln(sprintf("<info>Found existing <comment>civicrm_*</comment> database tables in <comment>%s</comment></info>", $setup->getModel()->db['database']));
switch ($this->pickConflictAction($input, $output, 'database tables')) {
case 'abort':
throw new \Exception("Aborted");

case 'overwrite':
$output->writeln(sprintf("<info>Removing <comment>civicrm_*</comment> database tables in <comment>%s</comment></info>", $setup->getModel()->db['database']));
$setup->uninstallDatabase();
$output->writeln(sprintf("<info>Creating <comment>civicrm_*</comment> database tables in <comment>%s</comment></info>", $setup->getModel()->db['database']));
$setup->installDatabase();
break;

case 'keep':
break;

default:
throw new \Exception("Unrecognized action");
}
}
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;




class UpgradeGetCommand extends BaseCommand {
const DEFAULT_CHECK_URL = "https://upgrade.civicrm.org/check";


use BootTrait;
use StructuredOutputTrait;




protected function configure() {
$this
->setName('upgrade:get')
->setDescription('Find out what file you should use to upgrade')
->configureOutputOptions()
->addOption('stability', 's', InputOption::VALUE_REQUIRED, 'Specify the stability of the version to get (nightly, rc, stable)', 'stable')
->addOption('cms', 'c', InputOption::VALUE_REQUIRED, 'Specify the CMS to get (Backdrop, Drupal, Drupal6, Joomla, WordPress) instead of the current site')
->setHelp('Find out what file you should use to upgrade

Examples:
  cv upgrade:get --stability=rc

Returns a JSON object with the properties:
  rev        a unique ID corresponding to the commits that are included
  path       the path to download a tarball/zipfile
  git        the corresponding commits of the civicrm repos
  vars       the site variables from cv vars:show
  error      only appears if there is an error
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$result = array();
$exitCode = 0;
$stability = $input->getOption('stability');
$cms = $input->getOption('cms');
if (empty($cms)) {
$this->boot($input, $output);
if (defined('CIVICRM_UF')) {
$cms = CIVICRM_UF;
}

 $result['vars'] = $GLOBALS['_CV'];
}
if (empty($cms)) {
throw new \RuntimeException("Cannot determine download URL without CMS");
}

$url = self::DEFAULT_CHECK_URL . "?stability=" . urlencode($stability);
$lookup = json_decode(file_get_contents($url), TRUE);

if (empty($lookup)) {
$result = array(
'error' => "Version not found at $url",
);
$exitCode = 1;
}
else {
if (array_key_exists('rev', $lookup)) {
$result['rev'] = $lookup['rev'];
}
if (array_key_exists('version', $lookup)) {
$result['version'] = $lookup['version'];
}
if (array_key_exists('git', $lookup)) {
$result['git'] = $lookup['git'];
}
if (!empty($lookup['tar'][$cms])) {
$result['url'] = $lookup['tar'][$cms];
}
}

$this->sendResult($input, $output, $result);
return $exitCode;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\SetupCommandTrait;
use Civi\Cv\Util\DebugDispatcherTrait;
use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;

class CoreUninstallCommand extends BaseCommand {

use SetupCommandTrait;
use DebugDispatcherTrait;
use StructuredOutputTrait;

protected function configure() {
$this
->setName('core:uninstall')
->setDescription('Purge CiviCRM schema and settings files')
->configureSetupOptions()
->addOption('force', 'f', InputOption::VALUE_NONE, 'Remove without any prompt or confirmation')
->configureOutputOptions()
->setHelp('
Purge CiviCRM schema and settings files

TIP: If you have a special system configuration, it may help to pass the same
options for "core:uninstall" as the preceding "core:install".
');
$this->configureBootOptions('none');
}

protected function execute(InputInterface $input, OutputInterface $output) {
$setup = $this->bootSetupSubsystem($input, $output);

$debugEvent = $this->parseOptionalOption($input, ['--debug-event'], NULL, '');
if ($debugEvent !== NULL) {
$eventNames = $this->findEventNames($setup->getDispatcher(), $debugEvent);
$this->printEventListeners($output, $setup->getDispatcher(), $eventNames);
return 0;
}

$installed = $setup->checkInstalled();
if (!$installed->isDatabaseInstalled() && !$installed->isSettingInstalled()) {
$output->writeln("<comment>CiviCRM does not appear to be installed.</comment>");
return 0;
}

if ($installed->isDatabaseInstalled()) {
$output->writeln(sprintf("<info>Found <comment>civicrm_*</comment> database tables in <comment>%s</comment></info>", $setup->getModel()->db['database']));
}

if ($installed->isSettingInstalled()) {
$output->writeln(sprintf("<info>Found <comment>%s</comment> in <comment>%s</comment></info>", basename($setup->getModel()->settingsPath), dirname($setup->getModel()->settingsPath)));
}

if (!$input->getOption('force')) {
$output->writeln('');
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('<comment>Are you sure want to purge the CiviCRM database and data files? Data may be permanently destroyed.</comment> (y/N) ', FALSE);
if (!$helper->ask($input, $output, $question)) {
$output->writeln("<comment>Aborted</comment>");
return 1;
}
}

if ($installed->isDatabaseInstalled()) {
$output->writeln(sprintf("<info>Removing <comment>civicrm_*</comment> database tables in <comment>%s</comment></info>", $setup->getModel()->db['database']));
$setup->uninstallDatabase();
}

if ($installed->isSettingInstalled()) {
$output->writeln(sprintf("<info>Removing <comment>%s</comment> from <comment>%s</comment></info>", basename($setup->getModel()->settingsPath), dirname($setup->getModel()->settingsPath)));
$setup->uninstallFiles();
}
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class PipeCommand extends BaseCommand {

use BootTrait;




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('pipe')
->setDescription('Start a Civi::pipe session (JSON-RPC 2.0)')
->setHelp('Start a Civi::pipe session (JSON-RPC 2.0)

The Civi::pipe protocol provides a line-oriented session for executing multiple requests in a single CiviCRM instance.

Callers may request *connection flags*, such as:

* v: Show version
* l: Show login support
* t: Enable trusted mode
* u: Enable untrusted mode

Examples:

  $ cv pipe
  {"Civi::pipe":{"v":"5.47.alpha1","t":"trusted","l":["nologin"]}}

  $ cv pipe uv
  {"Civi::pipe":{"u":"untrusted","v":"5.47.alpha1"}}

See also: https://docs.civicrm.org/dev/en/latest/framework/pipe
');
$this->addArgument('connection-flags', InputArgument::OPTIONAL, 'List of connection-flags (Default: Determined by civicrm-core)', NULL);

 
 

$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);
if (!is_callable(['Civi', 'pipe'])) {
fwrite(STDERR, "This version of CiviCRM does not include Civi::pipe() support.\n");
return 1;
}
if ($flags = $input->getArgument('connection-flags')) {
\Civi::pipe($flags);
}
else {
\Civi::pipe();
}
return 0;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class AngularModuleListCommand extends BaseCommand {

use BootTrait;
use StructuredOutputTrait;




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ang:module:list')
->setAliases(array())
->setDescription('List Angular modules')
->configureOutputOptions(['tabular' => TRUE, 'fallback' => 'table', 'defaultColumns' => 'name,basePages,requires'])
->addArgument('regex', InputArgument::OPTIONAL,
'Filter extensions by full key or short name')
->setHelp('List Angular modules

Examples:
  cv ang:module:list
  cv ang:module:list /crmUi/
  cv ang:module:list --columns=name,ext,extDir
  cv ang:module:list \'/crmMail/\' --user=admin --columns=extDir,css
  cv ang:module:list --columns=name,js,css --out=json-pretty
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);
if (!$input->getOption('user')) {
$output->getErrorOutput()->writeln("<comment>For a full list, try passing --user=[username].</comment>");
}

$columns = explode(',', $input->getOption('columns'));
$records = $this->sort($this->find($input), $columns);

$this->sendTable($input, $output, $records, $columns);

return 0;
}







protected function find($input) {
$regex = $input->getArgument('regex');
$ang = \Civi::service('angular');
$rows = array();

foreach ($ang->getModules() as $name => $module) {
$resources = array();
foreach (array('js', 'partials', 'css', 'settings') as $key) {
if (!empty($module[$key])) {
$resources[] = sprintf("%s(%d)", $key, count($module[$key]));
}
}

if (!isset($module['basePages'])) {
$basePages = 'civicrm/a';
}
elseif (empty($module['basePages'])) {
$basePages = '(as-needed)';
}
else {
$basePages = implode(", ", $module['basePages']);
}

$rows[] = array(
'name' => $name,
'ext' => $module['ext'],
'extDir' => \CRM_Core_Resources::singleton()->getPath($module['ext'], NULL),
'resources' => implode(', ', $resources),
'basePages' => $basePages,
'js' => isset($module['js']) ? implode(", ", $module['js']) : '',
'css' => isset($module['css']) ? implode(", ", $module['css']) : '',
'partials' => isset($module['partials']) ? implode(", ", $module['partials']) : '',
'requires' => isset($module['requires']) ? implode(', ', $module['requires']) : '',
);
}

$rows = array_filter($rows, function ($row) use ($regex) {
if ($regex) {
if (!preg_match($regex, $row['ext']) && !preg_match($regex, $row['name'])) {
return FALSE;
}
}
return TRUE;
});

return $rows;
}

protected function sort($rows, $orderByColumns) {
usort($rows, function ($a, $b) use ($orderByColumns) {
foreach ($orderByColumns as $col) {
if ($a[$col] < $b[$col]) {
return -1;
}
if ($a[$col] > $b[$col]) {
return 1;
}
}

return 0;
});

return $rows;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Config;
use Civi\Cv\Encoder;
use Civi\Cv\SiteConfigReader;
use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class FillCommand extends BaseCommand {

use BootTrait;

protected $fields;

protected function configure() {
$this
->setName('vars:fill')
->setDescription('Generate a configuration file for any missing site data')
->addOption('file', NULL, InputOption::VALUE_REQUIRED, 'Read existing configuration from a file');
$this->configureBootOptions();
}

public function __construct($name = NULL) {
parent::__construct($name);
$this->defaults = array(
'ADMIN_EMAIL' => '[email protected]',
'ADMIN_PASS' => 't0ps3cr3t',
'ADMIN_USER' => 'admin',
'CIVI_CORE' => '',
'CIVI_DB_DSN' => 'mysql://dbUser:dbPass@dbHost/dbName?new_link=true',
'CIVI_FILES' => '',
'CIVI_SETTINGS' => '',
'CIVI_SITE_KEY' => '',
'CIVI_TEMPLATEC' => '',
'CIVI_UF' => '',
'CIVI_URL' => '',
'CIVI_VERSION' => '',
'CMS_DB_DSN' => 'mysql://dbUser:dbPass@dbHost/dbName?new_link=true',
'CMS_ROOT' => '',
'CMS_TITLE' => 'Untitled installation',
'CMS_URL' => '',
'CMS_VERSION' => '',
'DEMO_EMAIL' => '[email protected]',
'DEMO_PASS' => 't0ps3cr3t',
'DEMO_USER' => 'demo',
'IS_INSTALLED' => '1',
'SITE_TOKEN' => md5(openssl_random_pseudo_bytes(256)),
'SITE_TYPE' => '',
'TEST_DB_DSN' => 'mysql://dbUser:dbPass@dbHost/dbName?new_link=true',
);
}

protected function execute(InputInterface $input, OutputInterface $output) {
if (!$input->getOption('file')) {
$this->boot($input, $output);
$reader = new SiteConfigReader(CIVICRM_SETTINGS_PATH);
$liveData = $reader->compile(array('buildkit', 'home', 'active'));
}
else {
$file = $input->getOption('file');
if (strpos($file, '://') !== FALSE) {
throw new \RuntimeException("Failed to extract current configuration.");
}
if ($file === '/dev/stdin') {
$file = 'php://stdin';
}
$liveData = json_decode(file_get_contents($file), 1);
}

if ($liveData === NULL) {
throw new \RuntimeException("Failed to extract current configuration.");
}

$siteConfig = array();
foreach ($this->defaults as $field => $value) {
if (!isset($liveData[$field])) {
$siteConfig[$field] = $value;
}
}

$output->writeln(sprintf("<info>Site:</info> %s", CIVICRM_SETTINGS_PATH));
if (empty($siteConfig)) {
$output->writeln("<info>No extra fields are required.</info>");
}
else {
$output->writeln(sprintf("<info>These fields were missing. Setting defaults:</info>"));
$output->writeln(Encoder::encode($siteConfig, 'json-pretty'));
Config::update(function ($config) use ($siteConfig, $output) {
if (isset($config['sites'][CIVICRM_SETTINGS_PATH])) {
$config['sites'][CIVICRM_SETTINGS_PATH] = array_merge($siteConfig, $config['sites'][CIVICRM_SETTINGS_PATH]);
}
else {
$config['sites'][CIVICRM_SETTINGS_PATH] = $siteConfig;
}
ksort($config['sites'][CIVICRM_SETTINGS_PATH]);
return $config;
});
$output->writeln(sprintf("<info>Please edit</info> %s", Config::getFileName()));
}
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;




class UpgradeReportCommand extends BaseCommand {
const DEFAULT_REPORT_URL = 'https://upgrade.civicrm.org/report';

use StructuredOutputTrait;

public static function getReportModes() {
return array(
'started',
'downloaded',
'extracted',
'upgraded',
'finished',
'failed',
);
}

protected function configure() {
$this
->setName('upgrade:report')
->setDescription('Notify civicrm.org of your upgrade success or failure')
->configureOutputOptions()
->addOption('name', NULL, InputOption::VALUE_REQUIRED, 'Specify the name to link the report to past reports on the same upgrade')
->addOption('revision', NULL, InputOption::VALUE_REQUIRED, 'Precise revision being installed (e.g. 4.7.16-201701020304)')
->addOption('download-url', NULL, InputOption::VALUE_REQUIRED, 'Indicate the URL for the download attempt')
->addOption('upgrade-messages', NULL, InputOption::VALUE_REQUIRED, 'Provide a file of upgrade messages')
->addOption('problem-message', NULL, InputOption::VALUE_REQUIRED, 'Provide a message about the problem')
->addOption('reporter', NULL, InputOption::VALUE_REQUIRED, "Your email address so you can be contacted with questions")
->setHelp('Notify civicrm.org of your upgrade success or failure

Examples:
  cv upgrade:report --started=1475079931

Returns a JSON object with the properties:
  name      The name under which the report was issued

');

foreach (self::getReportModes() as $mode) {
$this->addOption($mode, NULL, InputOption::VALUE_OPTIONAL, "Send a \"$mode\" report, optionally with a timestamp");
}


 
 
 }

protected function execute(InputInterface $input, OutputInterface $output) {

 

$report = array(
'cvVersion' => 'v0.3.19',
);


 foreach (self::getReportModes() as $mode) {
if (!$input->hasParameterOption("--$mode")) {
continue;
}
$modeTime = $input->getOption($mode) ?: time();

$report[$mode] = $modeTime;
}

$reportProblems = $this->checkReport($input, $report);


 if (!empty($reportProblems)) {
throw new \RuntimeException(implode("\n", $reportProblems));
}


 if (!empty($report['upgradeReport'])) {
$report['upgradeReport'] = file_get_contents($report['upgradeReport']);
}


 $report['siteId'] = \Civi\Cv\Util\Cv::run("ev \"return md5('We need to talk about your TPS reports' . CIVICRM_SITE_KEY);\" --level=settings");

if ($input->hasParameterOption('--reporter')) {
$report['reporter'] = $input->getOption('reporter');
}

$reportPoints = array(
'started',
'finished',
);

$reportsToSend = array_intersect($reportPoints, array_keys($report));

if (!empty($reportsToSend)) {
$systemReport = $this->systemReport();
foreach ($reportsToSend as $stage) {
$key = preg_replace('/ed$/', 'Report', $stage);
$report[$key] = $systemReport;
}
}


 $report['response'] = $this->reportToCivi($report);

$this->sendResult($input, $output, $report);
}







protected function systemReport() {
try {
$report = \Civi\Cv\Util\Cv::run('api system.get');
}
catch (\Exception $e) {
$report = array('error' => 'Could not produce report');
}
$vars = \Civi\Cv\Util\Cv::run('vars:show');
$domain = empty($vars['CMS_URL']) ? NULL : preg_replace(";https?://;", '', $vars['CMS_URL']);
$this->recursiveRedact($report, $domain);
return $report;
}

protected function checkReport($input, &$report) {
$reportProblems = array();


 $reportModes = self::getReportModes();
if (0 == count(array_intersect($reportModes, array_keys($report)))) {
$modeList = '--' . implode(', --', $reportModes);
$reportProblems[] = "Your report must include one of the following arguments: $modeList";
}

 $requirements = array(
'started' => array(
'revision' => array(
'label' => 'revision number',
'reportkey' => 'revision',
),
),
'downloaded' => array(
'download-url' => array(
'label' => 'download URL',
'reportkey' => 'downloadUrl',
),
),
'upgraded' => array(
'upgrade-messages' => array(
'label' => 'upgrade messages',
'reportkey' => 'upgradeReport',
),
),
'failed' => array(
'problem-message' => array(
'label' => 'problem message',
'reportkey' => 'problem',
),
'revision' => array(
'label' => 'revision number',
'reportkey' => 'revision',
'alternative' => 'name',
),
),
);
foreach ($requirements as $reqMode => $reqs) {
foreach ($reqs as $reqOpt => $req) {
if ($input->hasParameterOption("--$reqOpt")) {
$report[$req['reportkey']] = $input->getOption($reqOpt);
}
elseif (array_key_exists($reqMode, $report)) {
if (empty($req['alternative']) || empty($input->getOption($req['alternative']))) {
$reportProblems[] = "You must specify the {$req['label']} as --$reqOpt.";
}
}
}
}


 $initialModes = array(
'started',
'failed',
);
if (!($report['name'] = $input->getOption('name'))) {
if (!array_intersect($initialModes, array_keys($report))) {
$reportProblems[] = 'Unless you are sending a start report (with --started or --failed), you must specify the report name (with --name)';
}
else {
$report['name'] = \Civi\Cv\Util\Rand::createName();
}
}


 if (array_key_exists('started', $report)) {
$tooLate = array(
'extracted',
'upgraded',
'finished',
);
if (array_intersect($tooLate, array_keys($report))) {
$reportProblems[] = "You can't report a start once you have extracted or upgraded. Use --failed instead.";
}
}

return $reportProblems;
}

protected function recursiveRedact(&$report, $domain) {
foreach ($report as $k => &$v) {
if (is_array($v)) {
$this->recursiveRedact($v, $domain);
}
elseif ($v == "REDACTED") {
unset($report[$k]);
}
elseif ($domain) {
$v = preg_replace(";(https?://)?$domain;", 'REDACTEDURL/', $v);
}
}
}

protected function reportToCivi($report) {
foreach ($report as &$part) {
if (is_array($part)) {
$part = json_encode($part);
}
}

$ch = curl_init(self::DEFAULT_REPORT_URL);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($report));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\DebugDispatcherTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class DebugDispatcherCommand extends BaseCommand {

use BootTrait;
use DebugDispatcherTrait;

protected function configure() {
$this
->setName('debug:event-dispatcher')
->setDescription('Dump the list of event listeners')
->addArgument('event', InputArgument::OPTIONAL, 'An event name or regex')

 
 ->setHelp('
Dump the list of event listeners

Examples:
  cv debug:event-dispatcher
  cv debug:event-dispatcher actionSchedule.getMappings
  cv debug:event-dispatcher /^actionSchedule/
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
define('CIVICRM_CONTAINER_CACHE', 'never');
$output->getErrorOutput()->writeln('<comment>The debug command ignores the container cache.</comment>');
$this->boot($input, $output);

$container = \Civi::container();











if ($container->has('civi_api_kernel')) {
$container->get('civi_api_kernel');
}

$dispatcher = $container->get('dispatcher');
$eventFilter = $input->getArgument('event');
$eventNames = $this->findEventNames($dispatcher, $eventFilter);
$this->printEventListeners($output, $dispatcher, $eventNames);
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class PathCommand extends BaseExtensionCommand {

use StructuredOutputTrait;




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('path')
->setAliases(array())
->setDescription('Look up the path to a file or directory')
->configureOutputOptions(['tabular' => TRUE, 'fallback' => 'list', 'availColumns' => 'type,expr,value', 'shortcuts' => ['table', 'list']])
->addOption('ext', 'x', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An extension name. Identify the extension by full key ("org.example.foobar") or short name ("foobar"). Use "." for the default extension dir.')
->addOption('config', 'c', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'A config property. (Ex: "templateCompileDir/en_US")')
->addOption('dynamic', 'd', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'A dynamic path expression (v4.7+) (Ex: "[civicrm.root]/packages")')
->addOption('mkdir', 'm', InputOption::VALUE_NONE, 'Make a directory for the given path(s)')
->setHelp('Look up the path to a file or directory within CiviCRM.

Examples: Lookup extension paths
  cv path -x org.civicrm.module.cividiscount
  cv path -x cividiscount
  cv path -x cividiscount/info.xml
  cv path -x .

Examples: Lookup configuration properties
  cv path -c configAndLogDir
  cv path -c customFileUploadDir
  cv path -c customPHPPathDir
  cv path -c customTemplateDir
  cv path -c extensionsDir
  cv path -c imageUploadDir
  cv path -c uploadDir
  cv path -c templateCompileDir
  cv path -c templateCompileDir/en_US

Examples: Lookup dynamic paths
  cv path -d \'[civicrm.root]\'
  cv path -d \'[civicrm.root]/packages/DB.php\'
  cv path -d \'[civicrm.files]\'
  cv path -d \'[cms.root]/index.php\'

Example: Lookup multiple items
  cv path -x cividiscount/info.xml -x flexmailer/info.xml -d \'[civicrm.root]/civicrm-version.php\'
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);

if (!$input->getOption('ext') && !$input->getOption('config') && !$input->getOption('dynamic')) {
$output->getErrorOutput()->writeln("<error>No paths specified. Must use -x, -c, or -d. (See also: cv path -h)</error>");
return 1;
}

$results = array();
$returnValue = 0;

$mapper = \CRM_Extension_System::singleton()->getMapper();
foreach ($input->getOption('ext') as $extExpr) {
list ($keyOrName, $file) = explode('/', $extExpr, 2);
if ($keyOrName === '.') {
$results[] = array(
'type' => 'ext',
'expr' => $extExpr,
'value' => $this->pathJoin(\CRM_Core_Config::singleton()->extensionsDir, $file),
);
continue;
}

if (strpos($keyOrName, '.') === FALSE) {
$shortMap = $this->getShortMap();
if (isset($shortMap[$keyOrName]) && count($shortMap[$keyOrName]) === 1) {
$keyOrName = $shortMap[$keyOrName][0];
}
}

try {
$results[] = array(
'type' => 'ext',
'expr' => $extExpr,
'value' => $this->pathJoin($mapper->keyToBasePath($keyOrName), $file),
);
}
catch (\CRM_Extension_Exception_MissingException $e) {
$output->getErrorOutput()->writeln("<error>Ignoring unrecognized extension \"$keyOrName\"</error>");
$returnValue = 1;
}
}

foreach ($input->getOption('config') as $configExpr) {
list ($configProperty, $file) = explode('/', $configExpr, 2);
$dir = \CRM_Core_Config::singleton()->{$configProperty};
if (version_compare(\CRM_Utils_System::version(), '4.7', '<') && $configProperty === 'templateCompileDir') {

 $dir = dirname($dir);
}
$results[] = array(
'type' => 'config',
'expr' => $configExpr,
'value' => $this->pathJoin($dir, $file),
);
}

foreach ($input->getOption('dynamic') as $dynExpr) {
if (!is_callable(array('Civi', 'paths'))) {
$output->getErrorOutput()->writeln("<error>Dynamic path expressions are only available on CiviCRM v4.7+</error>");
$returnValue = 1;
break;
}

if (preg_match(';^(\[[^\]]+\])([\\/]?)$;', $dynExpr, $matches)) {

 
 $dyn = \Civi::paths()->getPath($matches[1] . "/./");
$value = preg_replace(';/./$;', '', $dyn) . $matches[2];
$results[] = array(
'type' => 'dynamic',
'expr' => $dynExpr,
'value' => $value,
);
}
else {

 $results[] = array(
'type' => 'dynamic',
'expr' => $dynExpr,
'value' => \Civi::paths()->getPath($dynExpr),
);
}
}

$columns = $this->parseColumns($input, array(
'list' => array('value'),
));

if ($input->getOption('mkdir')) {
foreach ($results as $result) {
if (!file_exists($result['value'])) {
mkdir($result['value'], 0777, TRUE);
}
}
}

$this->sendTable($input, $output, $results, $columns);
return $returnValue;
}

protected function pathJoin($folder, $file) {
if ($file !== NULL && $file !== FALSE) {
return \CRM_Utils_File::addTrailingSlash($folder) . $file;
}
else {
return rtrim($folder, DIRECTORY_SEPARATOR);
}
}

}
<?php
namespace Civi\Cv\Command;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ExtensionDisableCommand extends BaseExtensionCommand {




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ext:disable')
->setAliases(array('dis'))
->setDescription('Disable an extension')
->addArgument('key-or-name', InputArgument::IS_ARRAY, 'One or more extensions to enable. Identify the extension by full key ("org.example.foobar") or short name ("foobar")')
->setHelp('Disable an extension

Examples:
  cv ext:disable org.example.foobar
  cv dis foobar

Note:
  Beginning circa CiviCRM v4.2+, it has been recommended that extensions
  include a unique long name ("org.example.foobar") and a unique short
  name ("foobar"). However, short names are not strongly guaranteed.

  This subcommand does not output parseable data. For parseable output,
  consider using `cv api extension.disable`.
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);
list ($foundKeys, $missingKeys) = $this->parseKeys($input, $output);


 $disableKeys = array_merge($foundKeys, preg_grep('/\./', $missingKeys));
$missingKeys = preg_grep('/\./', $missingKeys, PREG_GREP_INVERT);

foreach ($missingKeys as $key) {
$output->writeln("<comment>Ignoring unrecognized extension \"$key\"</comment>");
}
foreach ($disableKeys as $key) {
$output->writeln("<info>Disabling extension \"$key\"</info>");
}

$result = $this->callApiSuccess($input, $output, 'Extension', 'disable', array(
'keys' => $disableKeys,
));
return empty($result['is_error']) ? 0 : 1;
}

}
<?php
namespace Civi\Cv\Command;






use Civi\Cv\Config;
use Civi\Cv\Encoder;
use Civi\Cv\Util\CliEditor;
use Civi\Cv\Util\Filesystem;
use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class EditCommand extends BaseCommand {

use BootTrait;




protected $editor;

protected function configure() {
$this
->setName('vars:edit')
->setDescription('Edit configuration values for this build');
$this->configureBootOptions();
}

public function __construct($name = NULL) {
parent::__construct($name);
$this->fs = new Filesystem();
$this->editor = new CliEditor();
$this->editor->setValidator(function ($file) {
$data = json_decode(file_get_contents($file));
if ($data === NULL) {
return array(
FALSE,
'// The JSON document was malformed. Please resolve syntax errors and then remove this message.',
);
}
else {
return array(TRUE, '');
}
});
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);

$config = Config::read();
$oldSiteData = empty($config['sites'][CIVICRM_SETTINGS_PATH]) ? array() : $config['sites'][CIVICRM_SETTINGS_PATH];
$oldJson = Encoder::encode($oldSiteData, 'json-pretty');
$newJson = $this->editor->editBuffer($oldJson);
$newSiteData = json_decode($newJson);

print "NEW DATA\n\n====\n$newJson\n====\n";


 
 
 
 }

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class FlushCommand extends BaseCommand {

use BootTrait;

protected function configure() {
$this
->setName('flush')
->setAliases(array())
->addOption('triggers', 'T', InputOption::VALUE_NONE, 'Rebuild triggers')
->setDescription('Flush system caches')
->setHelp('
Flush system caches
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {

 
 define('CIVICRM_CONTAINER_CACHE', 'never');
$this->boot($input, $output);

$params = array();
if ($input->getOption('triggers')) {
$params['triggers'] = TRUE;
}

$output->writeln("<info>Flushing system caches</info>");
$result = $this->callApiSuccess($input, $output, 'System', 'flush', $params);
return empty($result['is_error']) ? 0 : 1;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class AngularHtmlListCommand extends BaseCommand {

use BootTrait;
use StructuredOutputTrait;




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ang:html:list')
->setAliases(array())
->setDescription('List Angular HTML files')
->configureOutputOptions(['tabular' => TRUE, 'fallback' => 'list', 'defaultColumns' => 'file'])
->addArgument('filter', InputArgument::OPTIONAL,
'Filter by filename. For regex filtering, use semicolon delimiter.')
->setHelp('List Angular HTML files

Examples:
  cv ang:html:list
  cv ang:html:list crmUi/*
  cv ang:html:list \';(tabset|wizard)\\.html;\'
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);
if (!$input->getOption('user')) {
$output->getErrorOutput()->writeln("<comment>For a full list, try passing --user=[username].</comment>");
}

$columns = explode(',', $input->getOption('columns'));
$records = $this->sort($this->find($input), $columns);
$this->sendTable($input, $output, $records, $columns);
return 0;
}







protected function find($input) {
$regex = $input->getArgument('filter') ? $this->createRegex($input->getArgument('filter')) : NULL;
$ang = \Civi::service('angular');
$rows = array();

foreach ($ang->getModules() as $name => $module) {
$partials = $ang->getPartials($name);
foreach ($partials as $file => $html) {
$rows[] = array(
'file' => preg_replace(';^~/;', '', $file),
'module' => $name,
'ext' => $module['ext'],
);
}
}

$rows = array_filter($rows, function ($row) use ($regex) {
if ($regex) {
if (!preg_match($regex, $row['file'])) {
return FALSE;
}
}
return TRUE;
});

return $rows;
}

protected function sort($rows, $orderByColumns) {
usort($rows, function ($a, $b) use ($orderByColumns) {
foreach ($orderByColumns as $col) {
if ($a[$col] < $b[$col]) {
return -1;
}
if ($a[$col] > $b[$col]) {
return 1;
}
}

return 0;
});

return $rows;
}

protected function createRegex($filterExpr) {
if ($filterExpr[0] === ';') {
return $filterExpr;
}

 $regex = preg_quote($filterExpr, ';');
$regex = str_replace('\\*', '[^/]*', $regex);
$regex = ";^$regex.*$;";
return $regex;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Encoder;
use Civi\Cv\Util\Process;
use Civi\Cv\Util\StructuredOutputTrait;
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 UrlCommand extends BaseExtensionCommand {

use StructuredOutputTrait;

protected function configure() {
$this
->setName('url')
->setAliases(['open'])
->setDescription('Compose a URL to a CiviCRM page. (Optionally, open in a browser.)')
->addArgument('path', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Relative path to a CiviCRM page, such as "civicrm/contact/view?reset=1&cid=1"')
->configureOutputOptions(['tabular' => TRUE, 'availColumns' => 'type,expr,value', 'shortcuts' => ['table', 'list']])
->addOption('relative', 'r', InputOption::VALUE_NONE, 'Prefer relative URL format. (Default: absolute)')
->addOption('frontend', 'f', InputOption::VALUE_NONE, 'Generate a frontend URL (Default: backend)')
->addOption('open', 'O', InputOption::VALUE_NONE, 'Open a local web browser')
->addOption('ext', 'x', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An extension name. Identify the extension by full key ("org.example.foobar") or short name ("foobar"). Use "." for the default extension dir.')
->addOption('config', 'c', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'A config property. (Ex: "templateCompileDir/en_US")')
->addOption('dynamic', 'd', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'A dynamic path expression (v4.7+) (Ex: "[civicrm.root]/packages")')

 
 ->addOption('tabular', NULL, InputOption::VALUE_NONE, 'Force display in multi-record mode. (Enabled by default for list,csv,table formats.)')
->setHelp('
Compose a URL to a CiviCRM page or resource.

Examples: Lookup the site root
  cv url

Examples: Lookup URLs with the standard router
  cv url civicrm/dashboard
  cv url \'civicrm/a/#/mailing/123?angularDebug=1\'

Examples: Open URLs in a local browser (Linux/OSX)
  cv open civicrm/dashboard
  cv url civicrm/dashboard --open

Examples: Lookup URLs for extension resources
  cv url -x org.civicrm.module.cividiscount
  cv url -x cividiscount
  cv url -x cividiscount/css/example.css

Examples: Lookup URLs using configuration properties
  cv url -c imageUploadURL
  cv url -c imageUploadURL/example.png

Examples: Lookup URLs using dynamic expressions
  cv url -d \'[civicrm.root]/extern/ipn.php\'
  cv url -d \'[civicrm.files]\'
  cv url -d \'[cms.root]/index.php\'

Examples: Lookup multiple URLs
  cv url -x cividiscount -x volunteer civicrm/admin --out=table
  cv url -x cividiscount -x volunteer civicrm/admin --out=json --tabular


NOTE: To change the default output format, set CV_OUTPUT.
');
$this->configureBootOptions();
}

protected function initialize(InputInterface $input, OutputInterface $output) {
parent::initialize($input, $output);
if ($input->getFirstArgument() === 'open') {
$input->setOption('open', TRUE);
}
}

protected function execute(InputInterface $input, OutputInterface $output) {
if (in_array($input->getOption('out'), Encoder::getTabularFormats())
&& !in_array($input->getOption('out'), Encoder::getFormats())) {
$input->setOption('tabular', TRUE);
}

$this->boot($input, $output);

$rows = array();
if ($input->getOption('ext')) {
foreach ($input->getOption('ext') as $extExpr) {
$rows[] = $this->resolveExt($extExpr, $output);
}
}
if ($input->getOption('dynamic')) {
foreach ($input->getOption('dynamic') as $dynExpr) {
$rows[] = $this->resolveDynamic($dynExpr, $output);
}
}
if ($input->getOption('config')) {
foreach ($input->getOption('config') as $configExpr) {
$rows[] = $this->resolveConfig($configExpr, $output);
}
}
if ($input->getArgument('path')) {
foreach ($input->getArgument('path') as $pathExpr) {
$rows[] = $this->resolveRoute($pathExpr, $input);
}
}
if (count($rows) === 0) {
$rows[] = $this->resolveRoute('', $input);
}

if ($input->getOption('open')) {
$cmd = $this->pickCommand();
if (!$cmd) {
throw new \RuntimeException("Failed to locate 'xdg-open' or 'open'. Open not supported on this system.");
}
foreach ($rows as $row) {
if (!empty($row['value'])) {
$escaped = escapeshellarg($row['value']);
Process::runOk(new \Symfony\Component\Process\Process("$cmd $escaped"));
}
}
}

if ($input->getOption('tabular')) {
$columns = $this->parseColumns($input, array(
'list' => array('value'),
));
$this->sendTable($input, $output, $rows, $columns);
}
else {
if (count($rows) !== 1) {
$output->getErrorOutput()->writeln('<error>Detected multiple URLs. You must specify --tabular.</error>');
return 1;
}
else {
$this->sendResult($input, $output, $rows[0]['value']);
}
}

return (in_array(NULL, $rows)) ? 1 : 0;
}

protected function pickCommand($commands = array('xdg-open', 'open')) {
$paths = explode(PATH_SEPARATOR, getenv('PATH'));
foreach ($commands as $cmd) {
foreach ($paths as $path) {
$file = $path . DIRECTORY_SEPARATOR . $cmd;
if (is_file($file)) {
return $cmd;
}
}
}
return NULL;
}











protected function resolveExt($extExpr, OutputInterface $output) {
$mapper = \CRM_Extension_System::singleton()->getMapper();

list ($keyOrName, $file) = explode('/', $extExpr, 2);
if ($keyOrName === '.') {
return array(
'type' => 'ext',
'expr' => $extExpr,
'value' => $this->urlJoin(\CRM_Core_Config::singleton()->extensionsURL, $file),
);
}

if (strpos($keyOrName, '.') === FALSE) {
$shortMap = $this->getShortMap();
if (isset($shortMap[$keyOrName]) && count($shortMap[$keyOrName]) === 1) {
$keyOrName = $shortMap[$keyOrName][0];
}
}

try {
return array(
'type' => 'ext',
'expr' => $extExpr,
'value' => $this->urlJoin($mapper->keyToUrl($keyOrName), $file),
);
}
catch (\CRM_Extension_Exception_MissingException $e) {
$output->getErrorOutput()
->writeln("<error>Ignoring unrecognized extension \"$keyOrName\"</error>");

 return NULL;
}
}











protected function resolveDynamic($dynExpr, OutputInterface $output) {
if (!is_callable(array('Civi', 'paths'))) {
$output->getErrorOutput()
->writeln("<error>Dynamic path expressions are only available on CiviCRM v4.7+</error>");
return NULL;
}

if (preg_match(';^(\[[^\]]+\])([\\/]?)$;', $dynExpr, $matches)) {

 
 $dyn = \Civi::paths()->getUrl($matches[1] . "/./", 'absolute');
$value = preg_replace(';/./$;', '', $dyn) . $matches[2];
return array(
'type' => 'dynamic',
'expr' => $dynExpr,
'value' => $value,
);
}
else {

 return array(
'type' => 'dynamic',
'expr' => $dynExpr,
'value' => \Civi::paths()->getUrl($dynExpr, 'absolute'),
);
}
}











protected function resolveConfig($configExpr, OutputInterface $output) {
list ($configProperty, $file) = explode('/', $configExpr, 2);
$dir = \CRM_Core_Config::singleton()->{$configProperty};
return array(
'type' => 'config',
'expr' => $configExpr,
'value' => $this->urlJoin($dir, $file),
);
}

protected function urlJoin($folder, $file) {
if ($folder == NULL || $folder == FALSE) {
return $folder;
}
if ($file !== NULL && $file !== FALSE) {
return \CRM_Utils_File::addTrailingSlash($folder, '/') . $file;
}
else {
return rtrim($folder, DIRECTORY_SEPARATOR);
}
}






protected function resolveRoute($pathExpr, InputInterface $input) {
$path = parse_url($pathExpr, PHP_URL_PATH);
$query = parse_url($pathExpr, PHP_URL_QUERY);
$fragment = parse_url($pathExpr, PHP_URL_FRAGMENT);

return array(
'type' => 'router',
'expr' => $pathExpr,
'value' => \CRM_Utils_System::url(
$path,
$query,
!$input->getOption('relative'),
$fragment,
FALSE,
(bool) $input->getOption('frontend'),
(bool) !$input->getOption('frontend')
),
);
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\Process;
use Civi\Cv\Util\BootTrait;
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 AngularHtmlShowCommand extends BaseCommand {

use BootTrait;




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ang:html:show')
->setAliases(array())
->setDescription('Show an Angular HTML file')
->addOption('raw', NULL, InputOption::VALUE_NONE,
'Display the raw (unmodified/unhooked) content')
->addOption('diff', NULL, InputOption::VALUE_NONE,
'Display the diff (from pristine code to live code)')
->addArgument('file', InputArgument::REQUIRED | InputArgument::IS_ARRAY,
'The file to display. (The leading "~" is optional.)')
->setHelp('Show an Angular HTML file

Examples:
  cv ang:html:show crmMailing/BlockMailing.html
  cv ang:html:show crmMailing/BlockMailing.html --diff
  cv ang:html:show crmMailing/BlockMailing.html --diff | colordiff
  cv ang:html:show "~/crmMailing/BlockMailing.html"
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);
if (!$input->getOption('user')) {
$output->getErrorOutput()->writeln("<comment>For a full list, try passing --user=[username].</comment>");
}

$ang = \Civi::service('angular');
$result = 0;

if (!is_callable(array($ang, 'getRawPartials'))) {
$output->writeln('<error>This version of CiviCRM does not support getRawPartials().</error>');
return 4;
}

foreach ($input->getArgument('file') as $file) {
$file = '~/' . preg_replace(';^~/;', '', $file);
if (!preg_match(';^~/([^\/]+)/.+;', $file, $matches)) {
$output->writeln("<error>File name is malformed ($file)</error>");
$result = 1;
continue;
}
$module = $matches[1];

if ($input->getOption('diff')) {
$command = Process::findCommand('diff');
if (!$command) {
$output->writeln("<error>Command 'diff' is not available.</error>");
$result = 3;
continue;
}
$livePartials = $ang->getPartials($module);
$rawPartials = $ang->getRawPartials($module);
$prefix = preg_replace(';[^a-zA-Z0-9_\-\.];', '', $file) . '-';
$liveFile = tempnam(sys_get_temp_dir(), $prefix);
$rawFile = tempnam(sys_get_temp_dir(), $prefix);
$coder = new \Civi\Angular\Coder();
file_put_contents($rawFile, isset($rawPartials[$file]) ? $coder->recode($rawPartials[$file]) : '');
file_put_contents($liveFile, isset($livePartials[$file]) ? $coder->recode($livePartials[$file]) : '');
$cmd = sprintf("diff -u %s %s", escapeshellarg($rawFile), escapeshellarg($liveFile));
$content = `$cmd`;
if (empty($content)) {
$content = 'No differences found';
}
unlink($rawFile);
unlink($liveFile);
}
elseif ($input->getOption('raw')) {
$rawPartials = $ang->getRawPartials($module);
$content = isset($rawPartials[$file]) ? $rawPartials[$file] : NULL;
}
else {
$livePartials = $ang->getPartials($module);
$content = isset($livePartials[$file]) ? $livePartials[$file] : NULL;
}

if ($content === NULL) {
$output->writeln("<error>File \"$file\" not found in module \"$module\".</error>");
$result = 2;
}
else {
$output->writeln($content);
}
}

return $result;
}

}
<?php
namespace Civi\Cv\Command;





use Civi\Cv\Application;
use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CliCommand extends BaseCommand {

use BootTrait;

protected function configure() {
$this
->setName('cli')
->setDescription('Load interactive command line');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);

$cv = new Application();
$sh = new \Psy\Shell();
$sh->addCommands($cv->createCommands());

 
 
 
 $sh->run();
}

}
<?php
namespace Civi\Cv\Command;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ExtensionUninstallCommand extends BaseExtensionCommand {




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ext:uninstall')
->setAliases(array())
->setDescription('Uninstall an extension and purge its data')
->addArgument('key-or-name', InputArgument::IS_ARRAY, 'One or more extensions to enable. Identify the extension by full key ("org.example.foobar") or short name ("foobar")')
->setHelp('Uninstall an extension and purge its data.

Examples:
  cv ext:uninstall org.example.foobar
  cv ext:uninstall foobar

Note:
  Beginning circa CiviCRM v4.2+, it has been recommended that extensions
  include a unique long name ("org.example.foobar") and a unique short
  name ("foobar"). However, short names are not strongly guaranteed.

  This subcommand does not output parseable data. For parseable output,
  consider using `cv api extension.uninstall`.
');
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);
list ($foundKeys, $missingKeys) = $this->parseKeys($input, $output);


 $uninstallKeys = array_merge($foundKeys, preg_grep('/\./', $missingKeys));
$missingKeys = preg_grep('/\./', $missingKeys, PREG_GREP_INVERT);

foreach ($missingKeys as $key) {
$output->writeln("<comment>Ignoring unrecognized extension \"$key\"</comment>");
}
foreach ($uninstallKeys as $key) {
$output->writeln("<info>Uninstalling extension \"$key\"</info>");
}

$result = $this->callApiSuccess($input, $output, 'Extension', 'disable', array(
'keys' => $uninstallKeys,
));
if (!empty($result['is_error'])) {
return 1;
}

$result = $this->callApiSuccess($input, $output, 'Extension', 'uninstall', array(
'keys' => $uninstallKeys,
));
return empty($result['is_error']) ? 0 : 1;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class BaseExtensionCommand extends BaseCommand {

use BootTrait;




public function configureRepoOptions() {
$this
->addOption('dev', NULL, InputOption::VALUE_NONE, 'Include developmental extensions. (Equivalent to "--filter-status=* --filter-ready=*")')
->addOption('filter-ver', NULL, InputOption::VALUE_REQUIRED, 'Filter remote extensions by Civi compatibility (Ex: "4.7.15","4.6.20")', '{ver}')
->addOption('filter-uf', NULL, InputOption::VALUE_REQUIRED, 'Filter remote extensions by CMS compatibility (Ex: "Drupal", "WordPress")', '{uf}')
->addOption('filter-status', NULL, InputOption::VALUE_REQUIRED, 'Filter remote extensions by stability flag (Ex: "stable", "*")', 'stable')
->addOption('filter-ready', NULL, InputOption::VALUE_REQUIRED, 'Filter remote extensions based on reviewers\' approval (Ex: "ready", "*")', 'ready');
}







public function parseRepoUrl(InputInterface $input) {
if ($input->getOption('dev')) {
$input->setOption('filter-status', '*');
$input->setOption('filter-ready', '*');
}
$parts = array();
foreach (array('ver', 'uf', 'status', 'ready') as $key) {
$value = $input->getOption("filter-" . $key);
if ($value === '*') {
$value = '';
}
$parts[] = $key . '=' . $value;
}
return 'https://civicrm.org/extdir/' . implode('|', $parts);
}






protected function parseKeys(InputInterface $input, OutputInterface $output) {
$allKeys = \CRM_Extension_System::singleton()->getFullContainer()->getKeys();
$foundKeys = array();
$missingKeys = array();
$shortMap = NULL;

foreach ($input->getArgument('key-or-name') as $keyOrName) {
if (in_array($keyOrName, $allKeys)) {
$foundKeys[] = $keyOrName;
continue;
}

if ($shortMap === NULL) {
$shortMap = $this->getShortMap();
}
if (isset($shortMap[$keyOrName])) {
$foundKeys = array_merge($foundKeys, $shortMap[$keyOrName]);
continue;
}

$missingKeys[] = $keyOrName;
}

return array($foundKeys, $missingKeys);
}





protected function getShortMap() {
$map = array();
$mapper = \CRM_Extension_System::singleton()->getMapper();
$container = \CRM_Extension_System::singleton()->getFullContainer();

foreach ($container->getKeys() as $key) {
$info = $mapper->keyToInfo($key);
if ($info->file) {
$map[$info->file][] = $key;
}
}
return $map;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\StructuredOutputTrait;
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\Exception\ProcessFailedException;




class UpgradeDlCommand extends BaseCommand {

use StructuredOutputTrait;

protected function configure() {
$this
->setName('upgrade:dl')
->setDescription('Download CiviCRM code and put it in place for an upgrade')
->configureOutputOptions()
->addOption('stability', 's', InputOption::VALUE_REQUIRED, 'Specify the stability of the version to get (beta, rc, stable)', 'stable')
->addOption('cms', 'c', InputOption::VALUE_REQUIRED, 'Specify the cms to get (Backdrop, Drupal, Drupal6, Joomla, Wordpress) instead of the current site')
->addOption('url', 'u', InputOption::VALUE_REQUIRED, 'Specify the URL to a tarball/zipfile for downloading (regardless of --stability and --cms)')
->addOption('temploc', NULL, InputOption::VALUE_REQUIRED, 'Specify the location to put the temporary tarball', sys_get_temp_dir())
->setHelp('Download CiviCRM code and put it in place for an upgrade

Examples:
  cv upgrade:dl --stability=rc

Returns a JSON object with the properties:
  downloadedFile   The path to the downloaded archive
  extractedDir     The path to the extracted archive (not performed for Joomla)
  installedTo      The path to the `civicrm` directory of the file upgrade
');

 }

protected function execute(InputInterface $input, OutputInterface $output) {

 $url = $input->getOption('url');
if (empty($url)) {
$stability = $input->getOption('stability');
$command = "upgrade:get --stability=$stability";
$cms = $input->getOption('cms');
if (!empty($cms)) {
$command .= " --cms=$cms";
}
$dl = \Civi\Cv\Util\Cv::run($command);
if (empty($dl['url'])) {
$error = 'No URL available for downloading';
$error .= empty($dl['error']) ? '.' : ": {$dl['error']}";
throw new \RuntimeException($error);
}
$url = $dl['url'];
}


 $vars = empty($dl['vars']) ? \Civi\Cv\Util\Cv::run('vars:show') : $dl['vars'];
if (empty($cms)) {
$cms = $vars['CIVI_UF'];
}


 $temploc = $input->getOption('temploc');
$filename = basename($url);
$got = file_get_contents($url);
if ($got === FALSE) {
throw new \RuntimeException("Download of $url failed.");
}
file_put_contents("$temploc/$filename", $got);

$result = array(
'downloadedFile' => "$temploc/$filename",
);


 $dest = $vars['CIVI_CORE'];
switch ($cms) {
case 'WordPress':

 $dest = substr($dest, 0, -8);

case 'Backdrop':
case 'Drupal':
case 'Drupal6':

 if (substr($dest, -1) != '/') {
$dest .= '/';
}


 $tail = empty($dl['rev']) ? time() : $dl['rev'];
$foldername = pathinfo($filename, PATHINFO_FILENAME) . $tail;
$result['extractedDir'] = "$temploc/$foldername";
$this->extractAndRsync("$temploc/$filename", "$temploc/$foldername", $dest);
break;

case 'Joomla':

 
 
 
 $www = dirname($dest);
$sitename = basename($dest);
$p = new Process("joomla extension:installfile --www $www $sitename $temploc/$filename");
$p->run();
if (!$p->isSuccessful()) {
throw new ProcessFailedException($p);
}
break;
}
$result['installedTo'] = $dest;

$this->sendResult($input, $output, $result);
}











protected function extractAndRsync($fileloc, $folderloc, $dest) {


if (pathinfo($fileloc, PATHINFO_EXTENSION) == 'zip') {
$command = "unzip $fileloc -d $folderloc";
}
else {
$command = "tar -xzf $fileloc -C $folderloc";
}
$p = new Process("mkdir -p $folderloc && $command");
$p->run();
if (!$p->isSuccessful()) {
throw new ProcessFailedException($p);
}


 $excludeFiles = array(
'civicrm.settings.php',
'settings_location.php',
);

$command = 'rsync -rl --delete-after';
foreach ($excludeFiles as $x) {
$command .= " --exclude $x";
}

$p = new Process("$command $folderloc/civicrm/ $dest");
$p->run();
if (!$p->isSuccessful()) {
throw new ProcessFailedException($p);
}
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Encoder;
use Civi\Cv\Util\Api4ArgParser;
use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
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 Api4Command extends BaseCommand {

use BootTrait;
use StructuredOutputTrait;




public $defaults;




public function __construct($name = NULL) {
$this->defaults = array('version' => 4, 'checkPermissions' => FALSE);
parent::__construct($name);
}

protected function configure() {
$C = '<comment>';
$_C = '</comment>';
$I = '<info>';
$_I = '</info>';

$this
->setName('api4')
->setDescription('Call APIv4')
->addOption('in', NULL, InputOption::VALUE_REQUIRED, 'Input format (args,json)', 'args')
->configureOutputOptions(['tabular' => TRUE, 'shortcuts' => ['table', 'list']])
->addOption('dry-run', 'N', InputOption::VALUE_NONE, 'Preview the API call. Do not execute.')
->addArgument('Entity.action', InputArgument::REQUIRED)
->addArgument('key=value', InputArgument::IS_ARRAY)
->setHelp("Call an entity/action in APIv4

If your inputs are determined dynamically (e.g. from an external or untrusted
data-source), then it is better to pass parameters via pipe using strict JSON format.
This minimizes the risk that a dynamic value will be incorrectly escaped.

Alas, strict JSON is cumbersome to manually enter on the CLI.

If your inputs are entered manually, then it is easier to use a mix of \"+Options\"
and \"JSON-ish Key-Value\". The \"+Options\" are ideal for common parameters
(like \"select\" or \"where\"), and \"JSON-ish Key-Value\" is a decent fallback
for less common parameters.

Below, we consider a specification for each format and a set of examples.

If you'd like to inspect the behavior more carefully, try using {$I}--dry-run{$_I} ({$I}-N{$_I}).

{$C}Specification: Piped JSON${_C}

    {$C}echo{$_C} {$I}JSON{$_I} | {$C}cv api4${_C} {$I}ENTITY{$_I}.{$I}ACTION{$_I} {$C}--in=json${_C}

{$C}Specification: +Options${_C}

    {$C}cv api4${_C} {$I}ENTITY{$_I}.{$I}ACTION{$_I} [{$C}+{$_C}{$I}OP{$_I}{$C} {$_C}{$I}EXPR{$_I}]...

    Each \"+Option\" allows you to specify a common APIv4 parameter using a
    pithy, purpose-built notation. For example:

    Option         Examples
    {$C}+s{$_C}|{$C}+select{$_C}     +select id,display_name
                   +select=id,display_name
                   +s id,display_name
    {$C}+w{$_C}|{$C}+where{$_C}      +where 'first_name like \"Adams%\"'
                   +w 'first_name like \"Adams%\"'
    {$C}+o{$_C}|{$C}+orderBy{$_C}    +orderBy last_name,first_name
                   +o last_name,first_name
                   +o 'last_name DESC,first_name ASC'
    {$C}+l{$_C}|{$C}+limit{$_C}      +limit 15@60
                   +l 15
    {$C}+v{$_C}|{$C}+value{$_C}      +v name=Alice
                   +v name=Alice

    NOTE: The +{$I}OP{$_I} may be written long ({$C}+where{$_C}) or short ({$C}+w{$_C}). It is
    valid to separate the +{$I}OP{$_I} and {$I}EXPR{$_I} using a space, colon, or equals sign.

{$C}Specification: JSON-ish Key-Value${_C}

    {$C}cv api4${_C} {$I}ENTITY{$_I}.{$I}ACTION{$_I} [{$I}KEY{$_I}={$I}VALUE{$_I}]... [{$I}JSON-OBJECT{$_I}]...

    Use ${I}KEY{$_I}={$I}VALUE{$_I} to set an input to a specific value. The value may be a bare string
    or it may be JSON (beginning with '[' or '{' or '\"').

    Use {$I}JSON-OBJECT{$_I} if you want to pass several fields as one pure JSON string.
    A parameter which begins with '{' will be interpreted as a JSON expression.

{$C}Example: Get all contacts{$_C}
    cv api4 Contact.get

{$C}Example: Get ten contacts{$_C} (All examples are equivalent.)
    cv api4 Contact.get +s id,display_name +l 10
    cv api4 Contact.get select='[\"id\",\"display_name\"]' limit=10
    cv api4 Contact.get '{\"select\":[\"id\",\"display_name\"],\"limit\":10}'
    echo '{\"select\":[\"id\",\"display_name\"],\"limit\":10}' | cv api4 Contact.get --in=json

{$C}Example: Find ten contacts named \"Adam\"{$_C}
    cv api4 Contact.get +s display_name +w 'display_name LIKE \"Adam%\"' limit=10

{$C}Example: Find contact names for IDs between 100 and 200, ordered by last name{$_C}
    cv api4 Contact.get +s display_name +o last_name +w 'id >= 100' +w 'id <= 200'

{$C}Example: Change do_not_phone for everyone named Adam{$_C}
    cv api4 Contact.update +w 'display_name like %Adam%' +v do_not_phone=1

NOTE: To change the default output format, set CV_OUTPUT.
");
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$C = '<comment>';
$_C = '</comment>';
$I = '<info>';
$_I = '</info>';

$this->boot($input, $output);

if (!function_exists('civicrm_api4')) {
throw new \RuntimeException("Please enable APIv4 before running APIv4 commands.");
}

list($entity, $action) = explode('.', $input->getArgument('Entity.action'));
$params = $this->parseParams($input);
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE || $input->getOption('dry-run')) {
$output->writeln("{$I}Entity{$_I}: {$C}$entity{$_C}");
$output->writeln("{$I}Action{$_I}: {$C}$action{$_C}");
$output->writeln("{$I}Params{$_I}: " . json_encode($params, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
}
if ($input->getOption('dry-run')) {
return 0;
}
$result = \civicrm_api4($entity, $action, $params);

$out = $input->getOption('out');
if (!in_array($out, Encoder::getFormats()) && in_array($out, Encoder::getTabularFormats())) {
$columns = empty($params['select']) ? array_keys($result->first()) : $params['select'];
$this->sendTable($input, $output, (array) $result, $columns);
}
else {
$this->sendResult($input, $output, $result);
}

return empty($result['is_error']) ? 0 : 1;
}






protected function parseParams(InputInterface $input) {
$args = $input->getArgument('key=value');
switch ($input->getOption('in')) {
case 'args':
$p = new Api4ArgParser();
$params = $p->parse($args, $this->defaults);
break;

case 'json':
$json = stream_get_contents(STDIN);
if (empty($json)) {
$params = $this->defaults;
}
else {
$params = array_merge($this->defaults, json_decode($json, TRUE));
}
break;

default:
throw new \RuntimeException('Unknown input format');
}

return $params;
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\SiteConfigReader;
use Civi\Cv\Util\BootTrait;
use Civi\Cv\Util\StructuredOutputTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ShowCommand extends BaseCommand {

use BootTrait;
use StructuredOutputTrait;

protected function configure() {
$this
->setName('vars:show')
->setDescription('Show the configuration of the local CiviCRM installation')
->configureOutputOptions();
$this->configureBootOptions();
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->boot($input, $output);
$reader = new SiteConfigReader(CIVICRM_SETTINGS_PATH);
$data = $reader->compile(array('buildkit', 'home', 'active'));
$this->sendResult($input, $output, $data);
}

}
<?php
namespace Civi\Cv\Command;

use Civi\Cv\Util\Filesystem;
use Civi\Cv\Util\HeadlessDownloader;
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\Console\Question\ChoiceQuestion;

class ExtensionDownloadCommand extends BaseExtensionCommand {




public function __construct($name = NULL) {
parent::__construct($name);
}

protected function configure() {
$this
->setName('ext:download')
->setAliases(array('dl'))
->setDescription('Download and enable an extension')
->addOption('bare', 'b', InputOption::VALUE_NONE, 'Perform a basic download in a non-bootstrapped environment. Implies --level=none, --no-install, and no --refresh. You must specify the download URL.')
->addOption('refresh', 'r', InputOption::VALUE_NONE, 'Refresh the remote list of extensions (Default: Only refresh on cache-miss)')
->addOption('no-install', NULL, InputOption::VALUE_NONE, 'Only download. Skip the installation.')
->addOption('force', 'f', InputOption::VALUE_NONE, 'If an extension already exists, download it anyway.')
->addOption('to', NULL, InputOption::VALUE_OPTIONAL, 'Download to a specific directory (absolute path).')
->addOption('keep', 'k', InputOption::VALUE_NONE, 'If an extension already exists, keep it.')
->addArgument('key-or-name', InputArgument::IS_ARRAY, 'One or more extensions to enable. Identify the extension by full key ("org.example.foobar") or short name ("foobar"). Optionally append a URL.')
->setHelp('Download and enable an extension

Examples:
  cv ext:download org.example.foobar
  cv dl foobar
  cv dl --dev foobar
  cv dl -b "@https://example.org/files/foobar/info.xml" --to="$PWD/myext"

The extension can be specified using any of the following:

  - Long name (ex: "org.example.foobar"). Resolved via civicrm.org.
  - Short name (ex: "foobar"). Resolved via civicrm.org.
  - Long name + Zip URL (ex: "org.example.foobar@http://example.org/files/foobar-1.2.zip")
  - Info XML URL (ex: "@http://example.org/files/foobar/info.xml")

Note:
  By default, extensions are downloaded to the site\'s writable
  extension folder, but you can optionally specify --to.

  Beginning circa CiviCRM v4.2+, it has been recommended that extensions
  include a unique long name ("org.example.foobar") and a unique short
  name ("foobar"). However, short names are not strongly guaranteed.

  This subcommand does not output parseable data. For parseable output,
  consider using `cv api extension.install`.
');
parent::configureRepoOptions();
$this->configureBootOptions();
}

protected function initialize(InputInterface $input, OutputInterface $output) {
if ($input->hasOption('bare') && $input->getOption('bare')) {
$input->setOption('level', 'none');
$input->setOption('no-install', TRUE);
}
parent::initialize($input, $output);
}

protected function execute(InputInterface $input, OutputInterface $output) {
$fs = new Filesystem();

if ($extRepoUrl = $this->parseRepoUrl($input)) {
global $civicrm_setting;
$civicrm_setting['Extension Preferences']['ext_repo_url'] = $extRepoUrl;
}

$this->boot($input, $output);

if ($input->getOption('to') && !$fs->isAbsolutePath($input->getOption('to'))) {
throw new \RuntimeException("The --to argument requires an absolute path.");
}

if ($this->isBooted()) {
$output->writeln("<info>Using extension feed \"" . \CRM_Extension_System::singleton()->getBrowser()->getRepositoryUrl() . "\"</info>");
}


 $refresh = $input->getOption('refresh') ? 'yes' : 'auto';
while (TRUE) {
if ($refresh === 'yes' && $this->isBooted()) {
$output->writeln("<info>Refreshing extension cache</info>");
$result = $this->callApiSuccess($input, $output, 'Extension', 'refresh', array(
'local' => FALSE,
'remote' => TRUE,
));
if (!empty($result['is_error'])) {
return 1;
}
}

list ($downloads, $errors) = $this->parseDownloads($input);
if ($refresh == 'auto' && !empty($errors)) {
$output->writeln("<info>Extension cache does not contain requested item(s)</info>");
$refresh = 'yes';
}
else {
break;
}
}

if (!empty($errors)) {
foreach ($errors as $error) {
$output->getErrorOutput()->writeln("<error>$error</error>");
}
$output->getErrorOutput()->writeln("<comment>Tip: To customize the feed, review options in \"cv {$input->getFirstArgument()} --help\"");
$output->getErrorOutput()->writeln("<comment>Tip: To browse available downloads, run \"cv ext:list -R\"</comment>");
return 1;
}

if ($input->getOption('to') && count($downloads) > 1) {
throw new \RuntimeException("When specifying --to, you can only download one extension at a time.");
}

foreach ($downloads as $key => $url) {
$action = $this->pickAction($input, $output, $key);
switch ($action) {
case 'download':
if ($to = $input->getOption('to')) {
$output->writeln("<info>Downloading extension \"$key\" ($url) to \"$to\"</info>");
$dl = new HeadlessDownloader();
$dl->run($url, $key, $input->getOption('to'), TRUE);
}
else {
$output->writeln("<info>Downloading extension \"$key\" ($url)</info>");
$this->assertBooted();
$result = $this->callApiSuccess($input, $output, 'Extension', 'download', array(
'key' => $key,
'url' => $url,
'install' => !$input->getOption('no-install'),
));
}
break;

case 'install':
$output->writeln("<info>Found extension \"$key\". Enabling.</info>");
$result = $this->callApiSuccess($input, $output, 'Extension', 'enable', array(
'key' => $key,
));
break;

case 'abort':
$output->writeln("<error>Aborted</error>");
return 1;

case 'skip':
$output->writeln("<comment>Skipped extension \"$key\".</comment>");
break;

default:
throw new \RuntimeException("Unrecognized action: $action");
}

if (!empty($result['is_error'])) {
return 1;
}
}

return 0;
}







protected function getRemoteInfos() {
static $cache = NULL;
if ($cache === NULL) {
$this->assertBooted();
$cache = \CRM_Extension_System::singleton()
->getBrowser()->getExtensions();
}
return $cache;
}





protected function getRemoteShortMap() {
static $cache = NULL;
if ($cache === NULL) {
$cache = array();
foreach ($this->getRemoteInfos() as $key => $info) {
if ($info->file) {
$cache[$info->file][] = $key;
}
}
}
return $cache;
}






protected function parseDownloads(InputInterface $input) {

 $downloads = array();

 $errors = array();

$remoteInfos = NULL;
$shortMap = NULL;

if (!$input->getArgument('key-or-name')) {
$errors[] = 'Error: Please specify at least one extension to download';
}

foreach ($input->getArgument('key-or-name') as $keyOrName) {
$origExpr = $keyOrName;
$url = NULL;
if (strpos($keyOrName, '@') !== FALSE) {
list ($keyOrName, $url) = explode('@', $keyOrName, 2);
}

if (empty($keyOrName) && !empty($url)) {
if (!preg_match('/\.xml$/', $url)) {
$errors[] = "Unclear file reference ($origExpr). Please provide either \"key@http://example/file.zip\" or \"@http://example/file.xml\".";
continue;
}
$xmlString = file_get_contents($url);
if (empty($xmlString)) {
$errors[] = "Failed to fetch XML file ($origExpr).";
continue;
}
$xml = simplexml_load_string($xmlString);
$keyOrName = (string) $xml->attributes()->key;
$url = (string) $xml->downloadUrl;
if (!$keyOrName || !$url) {
$errors[] = "The specified XML file is missing the key and/or downloadUrl ($origExpr).";
continue;
}
}

if ($this->isBooted() && strpos($keyOrName, '.') === FALSE) {
if ($shortMap === NULL) {
$shortMap = $this->getRemoteShortMap();
}
if (isset($shortMap[$keyOrName])) {
if (count($shortMap[$keyOrName]) === 1) {
$keyOrName = $shortMap[$keyOrName][0];
}
else {
$otherNames = '"' . implode('", "', $shortMap[$keyOrName]) . '"';
$errors[] = "Ambiguous name \"$keyOrName\". Use a more specific key: $otherNames";
continue;
}
}
}

if ($this->isBooted() && empty($url)) {
if ($remoteInfos === NULL) {
$remoteInfos = $this->getRemoteInfos();
}

if (!empty($remoteInfos[$keyOrName]->downloadUrl)) {
$url = $remoteInfos[$keyOrName]->downloadUrl;
}
}

if (empty($url)) {
$errors[] = $this->isBooted()
? "Error: Unrecognized extension \"$keyOrName\""
: "Error: unrecognized extension \"$keyOrName\" cannot be resolved in bare environment";
continue;
}

$downloads[$keyOrName] = $url;
}
return array($downloads, $errors);
}












protected function pickAction(
InputInterface $input,
OutputInterface $output,
$key
) {
if ($input->getOption('to')) {
$exists = file_exists($input->getOption('to'));
}
elseif ($this->isBooted()) {
$existingExts = \CRM_Extension_System::singleton()
->getFullContainer()->getKeys();
$exists = in_array($key, $existingExts);
}
else {
throw new \RuntimeException("In --bare mode, you must specify the target path with --to.");
}

$action = NULL;
if (!$exists) {
return 'download';
}
elseif ($input->getOption('keep')) {
return $input->getOptions('no-install') ? 'skip' : 'install';
}
elseif ($input->getOption('force')) {
return 'download';
}
else {
$helper = $this->getHelper('question');
$question = new ChoiceQuestion(
"The extension \"$key\" already exists. What you like to do?",
array(
'k' => 'Keep existing extension. (Default) (Equivalent to option "-k")',
'd' => 'Download anyway. (Equivalent to option "-f")',
'a' => 'Abort',
),
'k'
);
switch ($helper->ask($input, $output, $question)) {
case 'd':
return 'download';

case 'k':
return $input->getOptions('no-install') ? 'skip' : 'install';

case 'a':
default:
return 'abort';
}
}
}

}
<?php
namespace Civi\Cv\Util;

class Datasource {
private static $attribute_names = array(
'database',
'driver',
'host',
'password',
'port',
'username',
);
private static $cividsn_to_settings_name = array(
'database' => 'database',
'dbsyntax' => 'driver',
'hostspec' => 'host',
'password' => 'password',
'port' => 'port',
'username' => 'username',
);
private static $settings_to_doctrine_options = array(
'database' => 'dbname',
'driver' => 'driver',
'host' => 'host',
'password' => 'password',
'port' => 'port',
'username' => 'user',
);
private static $settings_to_pdo_options = array(
'host' => 'host',
'port' => 'port',
'database' => 'dbname',
'socket_path' => 'unix_socket',
);

private $database;
private $driver;
private $host;
private $password;
private $port;
private $socket_path;
private $username;

public function __construct($options = NULL) {
if ($options !== NULL) {
if (isset($options['civi_dsn'])) {
$this->loadFromCiviDSN($options['civi_dsn']);
}
elseif ($options['settings_array']) {
$this->loadFromSettingsArray($options['settings_array']);
}
else {

 throw new \InvalidArgumentException("The options parameter needs to be blank if you want to load from CIVICRM_DSN, or it can be an array with key 'civi_dsn' that is a CiviCRM formatted DSN string, or it can be an array with key 'settings_array' than points to another array of database settings.");
}
}
}

public function loadFromCiviDSN($civi_dsn) {

 $parsed_dsn = \DB::parseDSN($civi_dsn);
foreach (static::$cividsn_to_settings_name as $key => $value) {
if (array_key_exists($key, $parsed_dsn)) {
$this->$value = $parsed_dsn[$key];
}
}
$this->updateHost();
}

public function loadFromSettingsArray($settings_array) {
foreach ($settings_array as $key => $value) {
$this->$key = $value;
}
$this->updateHost();
}




public function createPDO() {
$pdo = new \PDO($this->toPDODSN(), $this->username, $this->password);
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
return $pdo;
}




public function isValid() {
try {
$dbh = $this->createPDO();
foreach ($dbh->query('SELECT 99 as value') as $row) {
if ($row['value'] == 99) {
return TRUE;
}
}
}
catch (\PDOException $e) {
}
$dbh = NULL;
return FALSE;
}

public function toCiviDSN() {
$civi_dsn = "{$this->driver}://{$this->username}:{$this->password}@{$this->host}";
if ($this->port !== NULL) {
$civi_dsn = "$civi_dsn:{$this->port}";
}
$civi_dsn = "$civi_dsn/{$this->database}?new_link=true";
return $civi_dsn;
}

public function toDoctrineArray() {
$result = array();
foreach (self::$settings_to_doctrine_options as $key => $value) {
$result[$value] = $this->$key;
}
$result['driver'] = "pdo_{$result['driver']}";
return $result;
}

public function toDrupalDSN() {
$drupal_dsn = "{$this->driver}://{$this->username}:{$this->password}@{$this->host}";
if ($this->port !== NULL) {
$drupal_dsn = "$drupal_dsn:{$this->port}";
}
$drupal_dsn = "$drupal_dsn/{$this->database}";
return $drupal_dsn;
}






public function toMySQLArguments($tmpDir) {
$data = "[client]\n";
$data .= "host={$this->host}\n";
$data .= "user={$this->username}\n";
$data .= "password={$this->password}\n";
if ($this->port != NULL) {
$data .= "port={$this->port}\n";
}

$file = $tmpDir . '/my.cnf-' . md5($data);
if (!file_exists($file)) {
if (!file_put_contents($file, $data)) {
throw new \RuntimeException("Failed to create temporary my.cnf connection file.");
}
}

$args = "--defaults-file=" . escapeshellarg($file);
$args .= " {$this->database}";
return $args;
}

public function toPHPArrayString() {
$result = "array(\n";
foreach (static::$attribute_names as $attribute_name) {
$result .= "  '$attribute_name' => '{$this->$attribute_name}',\n";
}
$result .= ")";
return $result;
}

public function toPDODSN($options = array()) {
$pdo_dsn = "{$this->driver}:";
$pdo_dsn_options = array();
$settings_to_pdo_options = static::$settings_to_pdo_options;
if (isset($options['no_database']) && $options['no_database']) {
unset($settings_to_pdo_options['database']);
}
foreach ($settings_to_pdo_options as $settings_name => $pdo_name) {
if ($this->$settings_name !== NULL) {
$pdo_dsn_options[] = "{$pdo_name}={$this->$settings_name}";
}
}
$pdo_dsn .= implode(';', $pdo_dsn_options);
return $pdo_dsn;
}




public function updateHost() {






if ($this->port != NULL && $this->host == 'localhost') {
$this->host = '127.0.0.1';
}
}

public function setDatabase($database) {
$this->database = $database;
}

public function getDatabase() {
return $this->database;
}

public function setDriver($driver) {
$this->driver = $driver;
}

public function getDriver() {
return $this->driver;
}

public function setHost($host) {
$this->host = $host;
}

public function getHost() {
return $this->host;
}

public function setPassword($password) {
$this->password = $password;
}

public function getPassword() {
return $this->password;
}

public function setPort($port) {
$this->port = $port;
}

public function getPort() {
return $this->port;
}

public function setUsername($username) {
$this->username = $username;
}

public function getUsername() {
return $this->username;
}

public function setSocketPath($socket_path) {
$this->socket_path = $socket_path;
}

public function getSocketPath() {
return $this->socket_path;
}

}
<?php
namespace Civi\Cv\Util;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;






trait BootTrait {

public function configureBootOptions($defaultLevel = 'full') {
$this->addOption('level', NULL, InputOption::VALUE_REQUIRED, 'Bootstrap level (none,classloader,settings,full,cms-only,cms-full)', $defaultLevel);
$this->addOption('test', 't', InputOption::VALUE_NONE, 'Bootstrap the test database (CIVICRM_UF=UnitTests)');
$this->addOption('user', 'U', InputOption::VALUE_REQUIRED, 'CMS user');
}

public function boot(InputInterface $input, OutputInterface $output) {
$output->writeln('<info>[BootTrait]</info> Start', OutputInterface::VERBOSITY_DEBUG);

$this->setupErrorHandling($output);

if ($input->hasOption('test') && $input->getOption('test')) {
$output->writeln('<info>[BootTrait]</info> Use test mode', OutputInterface::VERBOSITY_DEBUG);
putenv('CIVICRM_UF=UnitTests');
$_ENV['CIVICRM_UF'] = 'UnitTests';
}

if (getenv('CIVICRM_UF') === 'UnitTests' && preg_match('/^cms-/', $input->getOption('level'))) {
throw new \Exception("UnitTest bootstrapping is not compatible with CMS bootstrapping");
}

$func = '_boot_' . strtr($input->getOption('level'), '-', '_');

if (is_callable([$this, $func])) {
call_user_func([$this, $func], $input, $output);
}
else {
throw new \Exception("Unrecognized bootstrap level");
}

$output->writeln('<info>[BootTrait]</info> Finished', OutputInterface::VERBOSITY_DEBUG);
}







public function _boot_none(InputInterface $input, OutputInterface $output) {
$output->writeln('<info>[BootTrait]</info> Skip', OutputInterface::VERBOSITY_DEBUG);
}







public function _boot_classloader(InputInterface $input, OutputInterface $output) {
$output->writeln('<info>[BootTrait]</info> Call basic cv bootstrap (' . $input->getOption('level') . ')', OutputInterface::VERBOSITY_DEBUG);
\Civi\Cv\Bootstrap::singleton()->boot($this->createBootParams($output) + array(
'prefetch' => FALSE,
));
}







public function _boot_settings(InputInterface $input, OutputInterface $output) {
$output->writeln('<info>[BootTrait]</info> Call basic cv bootstrap (' . $input->getOption('level') . ')', OutputInterface::VERBOSITY_DEBUG);
\Civi\Cv\Bootstrap::singleton()->boot($this->createBootParams($output) + array(
'prefetch' => FALSE,
));
}








public function _boot_full(InputInterface $input, OutputInterface $output) {
$output->writeln('<info>[BootTrait]</info> Call standard cv bootstrap', OutputInterface::VERBOSITY_DEBUG);
\Civi\Cv\Bootstrap::singleton()->boot($this->createBootParams($output));

$output->writeln('<info>[BootTrait]</info> Call core bootstrap', OutputInterface::VERBOSITY_DEBUG);
\CRM_Core_Config::singleton();

$output->writeln('<info>[BootTrait]</info> Call CMS bootstrap', OutputInterface::VERBOSITY_DEBUG);
\CRM_Utils_System::loadBootStrap(array(), FALSE);

if ($input->getOption('user')) {
$output->writeln('<info>[BootTrait]</info> Set system user', OutputInterface::VERBOSITY_DEBUG);
if (is_callable(array(\CRM_Core_Config::singleton()->userSystem, 'loadUser'))) {
if (!\CRM_Core_Config::singleton()->userSystem->loadUser($input->getOption('user')) || !$this->ensureUserContact($output)) {
throw new \Exception("Failed to determine contactID for user=" . $input->getOption('user'));
}
}
else {
$output->getErrorOutput()->writeln("<error>Failed to set user. Feature not supported by UF (" . CIVICRM_UF . ")</error>");
}
}

if (is_callable([\CRM_Core_Config::singleton()->userSystem, 'setMySQLTimeZone'])) {
$output->writeln('<info>[BootTrait]</info> Set active MySQL timezone', OutputInterface::VERBOSITY_DEBUG);
\CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
}
}








public function _boot_cms_only(InputInterface $input, OutputInterface $output) {
$bootstrap = $this->createCmsBootstrap($input, $output);
$output->writeln('<info>[BootTrait]</info> Call CMS bootstrap', OutputInterface::VERBOSITY_DEBUG);
$bootstrap->bootCms();
return $bootstrap;
}








public function _boot_cms_full(InputInterface $input, OutputInterface $output) {
$bootstrap = $this->_boot_cms_only($input, $output);
$output->writeln('<info>[BootTrait]</info> Call Civi bootstrap', OutputInterface::VERBOSITY_DEBUG);
$bootstrap->bootCivi();
return $bootstrap;
}






protected function createCmsBootstrap(InputInterface $input, OutputInterface $output) {
if ($output->isDebug()) {

 
 $boot_params = array('output' => $output);
}
else {
$boot_params = array();
}

if ($input->getOption('user')) {
$boot_params['user'] = $input->getOption('user');
}

return \Civi\Cv\CmsBootstrap::singleton()->addOptions($boot_params);
}








public function ensureUserContact(OutputInterface $output) {
if ($cid = \CRM_Core_Session::getLoggedInContactID()) {
return $cid;
}


 switch (CIVICRM_UF) {
case 'Drupal':
case 'Drupal6':
case 'Backdrop':
\CRM_Core_BAO_UFMatch::synchronize($GLOBALS['user'], TRUE,
CIVICRM_UF, 'Individual');
break;

case 'Drupal8':
\CRM_Core_BAO_UFMatch::synchronize(\Drupal::currentUser(), TRUE,
CIVICRM_UF, 'Individual');
break;

case 'Joomla':
\CRM_Core_BAO_UFMatch::synchronize(\JFactory::getUser(), TRUE,
CIVICRM_UF, 'Individual');
break;

case 'WordPress':
\CRM_Core_BAO_UFMatch::synchronize($GLOBALS['current_user'], TRUE,
CIVICRM_UF, 'Individual');
break;

default:
$output->writeln("<error>Unrecognized UF: " . CIVICRM_UF . "</error>");
}

return \CRM_Core_Session::getLoggedInContactID();
}

protected function setupErrorHandling(OutputInterface $output) {
$output->writeln('[BootTrait] Attempting to set verbose error reporting', OutputInterface::VERBOSITY_DEBUG);

 error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 'stderr');
ini_set('display_startup_errors', TRUE);
}





protected function createBootParams(OutputInterface $output) {
if ($output->isDebug()) {
$boot_params = array('output' => $output);
}
else {
$boot_params = array();
}
return $boot_params;
}

}
<?php
namespace Civi\Cv\Util;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;











trait OptionCallbackTrait {






abstract public function getDefinition();





private $optionCallbacks = [];







public function addOptionCallback($name, $callback) {
$this->optionCallbacks[] = [$name, $callback];
return $this;
}






protected function runOptionCallbacks(InputInterface $input, OutputInterface $output) {
$defn = $this->getDefinition();

foreach ($this->optionCallbacks as $optionCallbackDefn) {
list ($optionName, $callback) = $optionCallbackDefn;
if ($defn->hasOption($optionName)) {
$callback($input, $output, $defn->getOption($optionName));
}
}

return $this;
}

}
<?php
namespace Civi\Cv\Util;






class CliEditor {




protected $validator = NULL;







public function editBuffer($buffer, $attempts = 2) {
$tmpFile = tempnam(sys_get_temp_dir(), 'cv-editor-');
chmod($tmpFile, 0600);
file_put_contents($tmpFile, $buffer);

if (!$this->editFile($tmpFile, $attempts)) {
unlink($tmpFile);
return NULL;
}

$buffer = file_get_contents($tmpFile);
unlink($tmpFile);
return $buffer;
}









public function editFile($file, $maxAttempts = 2) {
$attempt = 0;
do {
$attempt++;
$cmd = $this->pick();
if (!$cmd) {
return FALSE;
}
passthru("$cmd " . escapeshellarg($file), $return);
if (!$return !== 0) {
return FALSE;
}

if ($this->validator === NULL) {
$isValid = TRUE;
}
else {
list ($isValid, $message) = call_user_func($this->validator, $file);
if (!$isValid && $attempt >= $maxAttempts) {
return FALSE;
}
if (!$isValid && $message) {
file_put_contents($file, $message . file_get_contents($file));
}
}

} while (!$isValid);
return TRUE;
}






public function pick() {
if (getenv('VISUAL') && $this->findCommand(getenv('VISUAL'))) {
return getenv('VISUAL');
}
elseif (getenv('EDITOR') && $this->findCommand(getenv('EDITOR'))) {
return getenv('EDITOR');
}
elseif ($this->findCommand('editor')) {
return 'editor';
}
elseif ($this->findCommand('vi')) {
return 'vi';
}
else {
return NULL;
}
}

protected function findCommand($name) {
return Process::findCommand($name);
}




public function getValidator() {
return $this->validator;
}




public function setValidator($validator) {
$this->validator = $validator;
}

}
<?php
namespace Civi\Cv\Util;

use ZipArchive;

class HeadlessDownloader {














public function run($zipUrl, $extKey, $outputDir, $force) {
$fs = new Filesystem();

if ($fs->exists($outputDir) && !$force) {
throw new \RuntimeException("Directory already exists: $outputDir");
}

$tmpDir = $outputDir . ".tmp";
if ($fs->exists($tmpDir) && !$force) {
throw new \RuntimeException("Directory already exists: $tmpDir");
}

$zipFile = tempnam(sys_get_temp_dir(), 'extdl-') . '.zip';
if ($fs->exists($tmpDir) && $force) {
$fs->remove($tmpDir);
}
$this->download($zipUrl, $zipFile);
$extractedZipPath = $this->extractZip($zipFile, $extKey, $tmpDir);
if ($fs->exists($outputDir) && $force) {
$fs->remove($outputDir);
}
rename($extractedZipPath, $outputDir);
rmdir($tmpDir);
unlink($zipFile);
}







public function findBaseDirs(ZipArchive $zip) {
$cnt = $zip->numFiles;
$basedirs = array();

for ($i = 0; $i < $cnt; $i++) {
$filename = $zip->getNameIndex($i);

 if (preg_match('/^[^\/]+\/$/', $filename) && $filename != './' && $filename != '../') {
$basedirs[] = rtrim($filename, '/');
}
}

return $basedirs;
}

public function guessBasedir(ZipArchive $zip, $expected) {
$candidate = FALSE;
$basedirs = $this->findBaseDirs($zip);
if (in_array($expected, $basedirs)) {
$candidate = $expected;
}
elseif (count($basedirs) == 1) {
$candidate = array_shift($basedirs);
}
if ($candidate !== FALSE && preg_match('/^[a-zA-Z0-9]/', $candidate)) {
return $candidate;
}
else {
return FALSE;
}
}

public function extractZip($zipFile, $key, $tmpDir) {
$zip = new ZipArchive();
$res = $zip->open($zipFile);
if ($res === TRUE) {
$zipSubDir = $this->guessBasedir($zip, $key);
if ($zipSubDir === FALSE) {
throw new \Exception('Unable to extract the extension: bad directory structure');
}
$extractedZipPath = $tmpDir . DIRECTORY_SEPARATOR . $zipSubDir;
if (is_dir($extractedZipPath)) {
throw new \Exception("$extractedZipPath already exists");
}
if (!is_dir($tmpDir)) {
mkdir($tmpDir, 0777, TRUE);
}
if (!$zip->extractTo($tmpDir)) {
throw new \Exception("Unable to extract the extension to $tmpDir.");
}
$zip->close();
return $extractedZipPath;
}
else {
throw new \Exception('Unable to extract the extension.');
}
}

public function download($url, $file) {
$fp = fopen($file, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_exec($ch);
curl_close($ch);
fclose($fp);
}

}
<?php
namespace Civi\Cv\Util;

class Filesystem extends \Symfony\Component\Filesystem\Filesystem {





public function toAbsolutePath($path) {
if (empty($path)) {
$res = getcwd();
}
elseif ($this->isAbsolutePath($path)) {
$res = $path;
}
else {
$res = getcwd() . DIRECTORY_SEPARATOR . $path;
}
if (is_dir($res)) {
return realpath($res);
}
else {
return $res;
}
}





public function toAbsolutePaths($paths) {
$result = array();
foreach ($paths as $path) {
$result[] = $this->toAbsolutePath($path);
}
return $result;
}

public function isDescendent($child, $parent) {
$parent = rtrim($parent, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$child = rtrim($child, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
if (strlen($parent) >= strlen($child)) {
return FALSE;
}
return ($parent == substr($child, 0, strlen($parent)));
}

public function formatPrettyPath($path, $basePaths) {
foreach ($basePaths as $basePath) {
if ($path == $basePath || $this->isDescendent($path, $basePath)) {
return rtrim($this->makePathRelative($path, dirname($basePath)), '/');
}
}
return $path;
}

public function findFirstParent($path, $basePaths) {
foreach ($basePaths as $basePath) {
if ($path == $basePath || $this->isDescendent($path, $basePath)) {
return $basePath;
}
}
return NULL;
}





public function validateExists($files) {
if (!$files instanceof \Traversable) {
$files = new \ArrayObject(is_array($files) ? $files : array($files));
}


 foreach ($files as $file) {
if (!file_exists($file)) {
throw new \RuntimeException("File not found: $file");
}
}
}












public function update($file, $filter, $maxWait = 5.0) {
$mode = file_exists($file) ? 'r+' : 'w+';
if (!($fh = fopen($file, $mode))) {
throw new \RuntimeException("Failed to open");
}

$start = microtime(TRUE);
do {
$locked = flock($fh, LOCK_EX | LOCK_NB);
if (!$locked && microtime(TRUE) - $start > $maxWait) {
throw new \RuntimeException("Failed to lock");
}
if (!$locked) {
usleep(rand(20, 100) * 1000);
}
} while (!$locked);


 $buf = '';
while (!feof($fh)) {
$buf .= fread($fh, 1024 * 1024);
}
$rawOut = call_user_func($filter, $buf);

if (!rewind($fh)) {
throw \RuntimeException('Bad rewind');
}
if (!ftruncate($fh, 0)) {
throw \RuntimeException('Bad truncate');
}

if (!fwrite($fh, $rawOut)) {
throw \RuntimeException('Bad write');
};
flock($fh, LOCK_UN);

return fclose($fh);
}

}
<?php
namespace Civi\Cv\Util;

use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\OutputInterface;

trait DebugDispatcherTrait {












public function findEventNames($dispatcher, $eventFilter) {
if (!$eventFilter) {
$listenersByEvent = $dispatcher->getListeners();
}
elseif ($eventFilter[0] === '/') {
$listenersByEvent = array();
foreach ($dispatcher->getListeners() as $e => $ls) {
if (preg_match($eventFilter, $e)) {
$listenersByEvent[$e] = $ls;
}
}
}
else {
$listenersByEvent = array($eventFilter => $dispatcher->getListeners($eventFilter));
}

$eventNames = array_keys($listenersByEvent);
sort($eventNames);
return $eventNames;
}






public function printEventListeners(OutputInterface $output, $dispatcher, $eventNames) {
$fmt = class_exists('\Civi\Core\Event\EventPrinter')
? ['\Civi\Core\Event\EventPrinter', 'formatName'] : NULL;

foreach ($eventNames as $event) {
$rows = array();
$i = 0;
foreach ($dispatcher->getListeners($event) as $listener) {
$handled = FALSE;
if ($fmt != NULL) {
$rows[] = array('#' . ++$i, $fmt($listener));
$handled = TRUE;
}
elseif (is_array($listener)) {
list ($a, $b) = $listener;
if (is_object($a)) {
$rows[] = array('#' . ++$i, get_class($a) . "->$b()");
$handled = TRUE;
}
elseif (is_string($a)) {
$rows[] = array('#' . ++$i, "$a::$b()");
$handled = TRUE;
}
}
elseif (is_string($listener)) {
$handled = TRUE;
$rows[] = array('#' . ++$i, $listener . '()');
}
elseif ($listener instanceof \Civi\Core\Event\ServiceListener) {
$handled = TRUE;
$rows[] = ['#' . ++$i, (string) $listener];
}
else {
try {
$f = new \ReflectionFunction($listener);
$rows[] = array(
'#' . ++$i,
'closure(' . $f->getFileName() . '@' . $f->getStartLine() . ')',
);
$handled = TRUE;
}
catch (\ReflectionException $e) {
}
}

if (!$handled) {
$rows[] = array('#' . ++$i, "unidentified");
}
}
$output->writeln("<info>[Event]</info> $event");
$table = new Table($output);
$table->setHeaders(array('Order', 'Callable'));
$table->addRows($rows);
$table->render();
$output->writeln("");
}
}

}
<?php
namespace Civi\Cv\Util;

use Symfony\Component\Console\Output\OutputInterface;







class ConsoleQueueRunner {




private $dryRun;




private $input;




private $output;




private $queue;









public function __construct(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output, \CRM_Queue_Queue $queue, $dryRun = FALSE) {
$this->input = $input;
$this->output = $output;
$this->queue = $queue;
$this->dryRun = $dryRun;
}




public function runAll() {
$taskCtx = new \CRM_Queue_TaskContext();
$taskCtx->queue = $this->queue;

 $taskCtx->log = \Log::singleton('display');


while ($this->queue->numberOfItems()) {

 $item = $this->queue->stealItem();
$task = $item->data;

if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {

 
 $this->output->write(".");
}
elseif ($this->output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) {
$this->output->writeln(sprintf("<info>%s</info>", $task->title));
}
elseif ($this->output->getVerbosity() > OutputInterface::VERBOSITY_VERBOSE) {
$this->output->writeln(sprintf("<info>%s</info> (<comment>%s</comment>)", $task->title, self::formatTaskCallback($task)));
}

if (!$this->dryRun) {
try {
$task->run($taskCtx);
}
catch (\Exception $e) {

 $this->output->writeln(sprintf("<error>Error executing task \"%s\"</error>", $task->title));
throw $e;
}
}

$this->queue->deleteItem($item);
}

if ($this->output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
$this->output->writeln("");
}
}

protected static function formatTaskCallback(\CRM_Queue_Task $task) {
return sprintf("%s(%s)",
implode('::', (array) $task->callback),
implode(',', $task->arguments)
);
}

}
<?php
namespace Civi\Cv\Util;

class ArrayUtil {

public static function collect($array, $index) {
$result = array();
foreach ($array as $item) {
if (isset($item[$index])) {
$result[] = $item[$index];
}
}
return $result;
}

public static function implodeTree($delim, &$arr) {
$result = array();
foreach ($arr as $key => &$value) {
if (is_array($value)) {
$temp = &self::implodeTree($delim, $value);
foreach ($temp as $key2 => $value2) {
$result[$key . $delim . $key2] = $value2;
}
}
else {
$result[$key] = $value;
}
}
return $result;
}











public static function pathSet(&$arr, $pathParts, $value) {
$r = &$arr;
$last = array_pop($pathParts);
foreach ($pathParts as $part) {
if (!isset($r[$part])) {
$r[$part] = array();
}
$r = &$r[$part];
}
$r[$last] = $value;
}
















public static function convertKeyValueRecord($records, $keyProp = 0, $valueProp = 1) {
$result = [];
foreach ($records as $key => $value) {
$result[] = [$keyProp => $key, $valueProp => $value];
}
return $result;
}














public static function convertAssocToNum($records, $columns) {
$result = array();
foreach ($records as $k => $oldRow) {
$newRow = array();
foreach ($columns as $newKey => $oldKey) {
$newRow[$newKey] = $oldRow[$oldKey];
}
$result[$k] = $newRow;
}
return $result;
}














public static function filterColumns($records, $columns) {
$result = array();
foreach ($records as $k => $oldRow) {
$newRow = array();
foreach ($columns as $key) {
if (array_key_exists($key, $oldRow)) {
$newRow[$key] = $oldRow[$key];
}
}
$result[$k] = $newRow;
}
return $result;
}







public static function findColumns($records) {
foreach ($records as $record) {
$columns = array_keys($record);
if ($columns) {
return $columns;
}
}
return NULL;
}








public static function pickFirst($values, $filter = NULL) {
foreach ($values as $value) {
if (($filter !== NULL && $filter($value)) || ($filter === NULL && $value)) {
return $value;
}
}
return NULL;
}

}
<?php

namespace Civi\Cv\Util;

class Cv {
























public static function run($cmd, $decode = 'json') {
$cmd = 'cv ' . $cmd;
$descriptorSpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => STDERR);
$oldOutput = getenv('CV_OUTPUT');
putenv("CV_OUTPUT=json");
$process = proc_open($cmd, $descriptorSpec, $pipes);
putenv("CV_OUTPUT=$oldOutput");
fclose($pipes[0]);
$result = stream_get_contents($pipes[1]);
fclose($pipes[1]);
if (proc_close($process) !== 0) {
throw new \RuntimeException("Command failed ($cmd):\n$result");
}
switch ($decode) {
case 'raw':
return $result;

case 'phpcode':

 if (substr(trim($result), 0, 12) !== "/*BEGINPHP*/" || substr(trim($result), -10) !== "/*ENDPHP*/") {
throw new \RuntimeException("Command failed ($cmd):\n$result");
}
return $result;

case 'json':
return json_decode($result, 1);

default:
throw new \RuntimeException("Bad decoder format ($decode)");
}
}











public static function passthru($cmd) {
$cmd = 'cv ' . $cmd;
$process = proc_open(
$cmd,
array(

 0 => STDIN,
1 => STDOUT,
2 => STDERR,
),
$pipes
);
return proc_close($process);
}

}
<?php

namespace Civi\Cv\Util;

class Api4ArgParser {

public function parse($args, $defaults = []) {
$state = '_TOP_';
$params = $defaults;
foreach ($args as $arg) {
if ($state !== '_TOP_') {
$this->applyOption($params, $state, $arg);
$state = '_TOP_';
}

 elseif (preg_match('/^([a-zA-Z0-9_:\.]+)=(.*)/', $arg, $matches)) {
list (, $key, $value) = $matches;
$params[$key] = $this->parseValueExpr($value);
}

 elseif (preg_match('/^\+([a-zA-Z0-9_]+)$/', $arg, $matches)) {
$state = $matches[1];
}

 elseif (preg_match('/^\+([a-zA-Z0-9_]+)[:=](.*)/', $arg, $matches)) {
list (, $key, $expr) = $matches;
$this->applyOption($params, $key, $expr);
}

 elseif (preg_match('/^\{.*\}$/', $arg)) {
$params = array_merge($params, $this->parseJsonNoisily($arg));
}
else {
throw new \RuntimeException("Unrecognized option format: $arg");
}
}
return $params;
}

protected static function mergeInto(&$params, $key, $values) {
if (!isset($params[$key])) {
$params[$key] = [];
}
$params[$key] = array_merge($params[$key], $values);
}

protected static function appendInto(&$params, $key, $values) {
if (!isset($params[$key])) {
$params[$key] = [];
}
$params[$key][] = $values;
}





protected function parseJsonNoisily($arg) {
$values = json_decode($arg, 1);
if ($values === NULL) {
throw new \RuntimeException("Failed to parse JSON: $values");
}
return $values;
}





protected function parseValueExpr($expr) {
if (strpos('{["\'', $expr[0]) !== FALSE) {
return $this->parseJsonNoisily($expr);
}
else {
return $expr;
}
}







protected function applyOption(&$params, $key, $expr) {
$aliases = [
's' => 'select',
'w' => 'where',
'o' => 'orderBy',
'l' => 'limit',
'v' => 'values',
'value' => 'values',
];
$key = isset($aliases[$key]) ? $aliases[$key] : $key;

switch ($key) {
case 'select':
self::mergeInto($params, $key, array_map([
$this,
'parseValueExpr',
], preg_split('/[, ]/', $expr)));
break;

case 'where':
self::appendInto($params, $key, $this->parseWhere($expr));
break;

case 'orderBy':
$keyOrderPairs = explode(',', $expr);
foreach ($keyOrderPairs as $keyOrderPair) {
$keyOrderPair = explode(' ', trim($keyOrderPair));
$sortKey = $keyOrderPair[0];
$sortOrder = isset($keyOrderPair[1]) ? strtoupper($keyOrderPair[1]) : 'ASC';
$params[$key][$sortKey] = $sortOrder;
}
break;

case 'limit':
if (strpos($expr, '@') !== FALSE) {
list ($limit, $offset) = explode('@', $expr);
$params['limit'] = (int) $limit;
$params['offset'] = (int) $offset;
}
else {
$params['limit'] = (int) $expr;
}
break;

case 'values':
self::mergeInto($params, $key, $this->parseAssignment($expr));
break;

default:
throw new \RuntimeException("Unrecognized option: +$key");
}
}

public function parseAssignment($expr) {
if (preg_match('/^([a-zA-Z0-9_:\.]+)\s*=\s*(.*)$/', $expr, $matches)) {
return [$matches[1] => $this->parseValueExpr($matches[2])];
}
else {
throw new \RuntimeException("Error parsing \"value\": $expr");
}
}

public function parseWhere($expr) {
if (preg_match('/^([a-zA-Z0-9_:\.]+)\s*(\<=|\>=|=|!=|\<|\>|IS NULL|IS NOT NULL|IS EMPTY|IS NOT EMPTY|LIKE|NOT LIKE|IN|NOT IN)\s*(.*)$/i', $expr, $matches)) {
if (!empty($matches[3])) {
return [$matches[1], strtoupper(trim($matches[2])), $this->parseValueExpr(trim($matches[3]))];
}
else {
return [$matches[1], strtoupper($matches[2])];
}
}
else {
throw new \RuntimeException("Error parsing \"where\": $expr");
}
}

}
<?php
namespace Civi\Cv\Util;

use Civi\Cv\Encoder;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;









trait StructuredOutputTrait {





private $outputFormatShortcuts = ['table' => 'T', 'csv' => 'C', 'list' => 'I'];








abstract public function addOptionCallback($name, $callback);























protected function configureOutputOptions($config = []) {
$fallback = !empty($config['fallback']) ? $config['fallback'] : 'json-pretty';

$formats = !empty($config['tabular']) ? Encoder::getTabularFormats() : Encoder::getFormats();
sort($formats);

$this->addOption('out', NULL, InputOption::VALUE_REQUIRED, 'Output format (' . implode(',', $formats) . ')', Encoder::getDefaultFormat($fallback));
$this->addOption('flat', NULL, InputOption::VALUE_OPTIONAL, 'Flatten output data. Optionally specified a delimiter.', '.');

if (!empty($config['shortcuts'])) {
foreach ($config['shortcuts'] as $format) {
$shortcut = $this->outputFormatShortcuts[$format];
$optName = 'out=' . $format;
$this->addOption($optName, $shortcut, InputOption::VALUE_NONE, 'Shortcut for --out=' . $format);
$this->addOptionCallback($optName, function(InputInterface $input, OutputInterface $output, InputOption $option) use ($optName, $format) {
if ($input->getOption($optName)) {
$input->setOption('out', $format);
}
});
}
}

if (array_key_exists('defaultColumns', $config) || array_key_exists('availColumns', $config)) {
$defaultValue = array_key_exists('defaultColumns', $config) ? $config['defaultColumns'] : NULL;
$desc = 'Comma-separated list of columns to display';
if (!empty($config['availColumns'])) {
$desc .= ' <comment>[available: ' . $config['availColumns'] . ']</comment>';
}
$this->addOption('columns', NULL, InputOption::VALUE_REQUIRED, $desc, $defaultValue);
}

return $this;
}







protected function sendResult(InputInterface $input, OutputInterface $output, $result) {
$flat = $this->parseOptionalOption($input, ['--flat'], FALSE, '.');
if ($flat !== FALSE) {
$result = ArrayUtil::implodeTree($flat, $result);
}
$buf = Encoder::encode($result, $input->getOption('out'));
$options = empty($result['is_error'])
? (OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_NORMAL)
: (OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_QUIET);
$output->writeln($buf, $options);
}

















protected function sendTable(InputInterface $input, OutputInterface $output, $records, $columns = NULL) {


if (is_array($columns) && in_array('*', $columns)) {
$columns = NULL;
}
$columns = $columns ? $columns : ArrayUtil::findColumns($records);


 if (!in_array($input->getOption('out'), ['table', 'csv', 'list'])) {

 $this->sendResult($input, $output, ArrayUtil::filterColumns($records, $columns));
return;
}

$flat = $this->parseOptionalOption($input, ['--flat'], FALSE, '.');
if ($flat !== FALSE) {
$filtered = ArrayUtil::filterColumns($records, $columns);
$flattened = ArrayUtil::implodeTree($flat, $filtered);
$records = ArrayUtil::convertKeyValueRecord($flattened, 'key', 'value');
$columns = ['key', 'value'];
$convertAssocToNum = function($rows, $columns) {
return $rows;
};
}
else {
$convertAssocToNum = [ArrayUtil::class, 'convertAssocToNum'];
}
$flattenValues = function($rows) {
return array_map(
function($row) {
return array_map(
function($value) {
if (is_scalar($value)) {
return $value;
}
elseif ($value === NULL) {
return '';
}
elseif (is_array($value)) {
return json_encode($value);
}
elseif (is_object($value)) {
return '(' . get_class($value) . ')';
}
else {
return '(' . gettype($value) . ')';
}
},
$row
);
},
$rows
);
};

switch ($input->getOption('out')) {
case 'table':

 $table = new Table($output);
$table->setHeaders($columns ?: []);
$table->addRows($flattenValues($convertAssocToNum($records, $columns)));
$table->render();
break;

case 'csv':

 
 fputcsv(STDOUT, $columns);
foreach ($convertAssocToNum($records, $columns) as $record) {
fputcsv(STDOUT, $record);
}
break;

case 'list':

 $col = ($flat === FALSE) ? $columns[0] : 'value';
foreach ($records as $record) {
$output->writeln($record[$col], OutputInterface::OUTPUT_RAW | OutputInterface::VERBOSITY_NORMAL);
}
break;

default:
throw new \RuntimeException("Unsupported table format: " . $input->getOption('out'));
}
}










protected function parseColumns(InputInterface $input, $defaultColumns = array()) {
$out = $input->getOption('out');
if ($input->getOption('columns')) {
return explode(',', $input->getOption('columns'));
}
elseif (isset($defaultColumns[$out])) {
return $defaultColumns[$out];
}
else {
return array('*');
}
}

}
<?php
namespace Civi\Cv\Util;

class Rand {







public static function createName() {
if (function_exists('random_bytes')) {
$hex = bin2hex(random_bytes(16));
return base_convert($hex, 16, 36);
}
elseif (function_exists('openssl_random_pseudo_bytes')) {
$hex = bin2hex(openssl_random_pseudo_bytes(16));
return base_convert($hex, 16, 36);
}
else {
$pow16 = pow(2, 16);
$buf = '';
for ($i = 0; $i < 8; $i++) {
$buf .= '-' . mt_rand(0, $pow16);
}
return base_convert(md5($buf), 16, 36);
}
}

}
<?php
namespace Civi\Cv\Util;

class Process {










public static function sprintf($expr) {
$args = func_get_args();
$newArgs = array();
$newArgs[] = array_shift($args);
foreach ($args as $arg) {
$newArgs[] = preg_match(';^[a-zA-Z0-9\.\/]+$;', $arg) ? $arg : escapeshellarg($arg);
}
return call_user_func_array('sprintf', $newArgs);
}








public static function runDebug($process) {
if (getenv('DEBUG')) {
var_dump(array(
'Working Directory' => $process->getWorkingDirectory(),
'Command' => $process->getCommandLine(),
));
ob_flush();
}

$process->run(function ($type, $buffer) {
if (getenv('DEBUG')) {
if (\Symfony\Component\Process\Process::ERR === $type) {
echo 'STDERR > ' . $buffer;
}
else {
echo 'STDOUT > ' . $buffer;
}
ob_flush();
}
});

return $process;
}








public static function runOk(\Symfony\Component\Process\Process $process) {
self::runDebug($process);
if (!$process->isSuccessful()) {
throw new \Civi\Cv\Exception\ProcessErrorException($process);
}
return $process;
}








public static function runFail(\Symfony\Component\Process\Process $process) {
self::runDebug($process);
if ($process->isSuccessful()) {
Process::dump($process);
throw new \Civi\Cv\Exception\ProcessErrorException($process, "Process succeeded unexpectedly");
}
return $process;
}







public static function findCommand($name) {
$paths = explode(PATH_SEPARATOR, getenv('PATH'));
foreach ($paths as $path) {
if (file_exists("$path/$name")) {
return "$path/$name";
}
}
return NULL;
}







public static function isShellScript($file) {
$firstLine = file_get_contents($file, NULL, NULL, 0, 120);
list($firstLine) = explode("\n", $firstLine);
return (bool) preg_match(';^#.*bin.*sh;', $firstLine);
}




public static function dump(\Symfony\Component\Process\Process $process) {
var_dump(array(
'Working Directory' => $process->getWorkingDirectory(),
'Command' => $process->getCommandLine(),
'Exit Code' => $process->getExitCode(),
'Output' => $process->getOutput(),
'Error Output' => $process->getErrorOutput(),
));
}

}
<?php
namespace Civi\Cv\Util;

use Civi\Setup\DbUtil;
use Civi\Cv\Util\BootTrait;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\OutputInterface;

define('CV_SETUP_PROTOCOL_VER', '1.0');





trait SetupCommandTrait {
use BootTrait;







public function configureSetupOptions() {
$this
->addOption('settings-path', NULL, InputOption::VALUE_OPTIONAL, 'The path to CivCRM settings file. (If omitted, use CV_SETUP_SETTINGS or try to use default.)')
->addOption('setup-path', NULL, InputOption::VALUE_OPTIONAL, 'The path to CivCRM-Setup source tree. (If omitted, read CV_SETUP_PATH or scan common defaults.)')
->addOption('src-path', NULL, InputOption::VALUE_OPTIONAL, 'The path to CivCRM-Core source tree. (If omitted, read CV_SETUP_SRC_PATH or scan common defaults.)')
->addOption('plugin-path', NULL, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'A directory with extra installer plugins')
->addOption('cms-base-url', NULL, InputOption::VALUE_OPTIONAL, 'The URL of the CMS (If omitted, attempt to autodetect.)')
->addOption('lang', NULL, InputOption::VALUE_OPTIONAL, 'Specify the installation language')
->addOption('comp', NULL, InputOption::VALUE_OPTIONAL, 'Comma-separated list of CiviCRM components to enable. (Ex: CiviEvent,CiviContribute,CiviMember,CiviMail,CiviReport)')
->addOption('ext', NULL, InputOption::VALUE_OPTIONAL, 'Comma-separated list of CiviCRM extensions to enable. (Ex: org.civicrm.shoreditch,org.civicrm.flexmailer)')
->addOption('db', NULL, InputOption::VALUE_OPTIONAL, 'Database credentials for primary Civi database.')
->addOption('model', 'm', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Set additional field in the model. Key-value pair.');

return $this;
}












protected function bootSetupSubsystem(InputInterface $input, OutputInterface $output, $defaultOutputOptions = 0) {
$b = $this->_boot_cms_only($input, $output);


 $setupOptions = array();
$setupOptions['cms'] = $b->getBootedCmsType();

$possibleSrcPaths = [
$input->getOption('src-path'),
getenv('CV_SETUP_SRC_PATH'),
implode(DIRECTORY_SEPARATOR, [$b->getBootedCmsPath(), 'sites', 'all', 'modules', 'civicrm']),
implode(DIRECTORY_SEPARATOR, [$b->getBootedCmsPath(), 'wp-content', 'plugins', 'civicrm', 'civicrm']),
implode(DIRECTORY_SEPARATOR, [$b->getBootedCmsPath(), 'modules', 'civicrm']),
implode(DIRECTORY_SEPARATOR, [$b->getBootedCmsPath(), 'vendor', 'civicrm', 'civicrm-core']),
implode(DIRECTORY_SEPARATOR, [dirname($b->getBootedCmsPath()), 'vendor', 'civicrm', 'civicrm-core']),
];
$setupOptions['srcPath'] = ArrayUtil::pickFirst($possibleSrcPaths, 'file_exists');
if ($setupOptions['srcPath']) {
$output->writeln(sprintf('<info>Found code for <comment>%s</comment> in <comment>%s</comment></info>', 'civicrm-core', $setupOptions['srcPath']), $defaultOutputOptions);
}
else {
$this->printPathError($output, 'civicrm-core', '--src-path', 'CV_SETUP_SRC_PATH', $possibleSrcPaths);
throw new \Exception("Failed to locate civicrm-core");
}

$possibleSetupPaths = [
$input->getOption('setup-path'),
getenv('CV_SETUP_PATH'),
implode(DIRECTORY_SEPARATOR, [$setupOptions['srcPath'], 'vendor', 'civicrm', 'civicrm-setup']),
implode(DIRECTORY_SEPARATOR, [$setupOptions['srcPath'], 'packages', 'civicrm-setup']),
implode(DIRECTORY_SEPARATOR, [$setupOptions['srcPath'], 'setup']),
implode(DIRECTORY_SEPARATOR, [dirname($setupOptions['srcPath']), 'civicrm-setup']),
implode(DIRECTORY_SEPARATOR, ['/usr', 'local', 'share', 'civicrm-setup']),
];
$setupOptions['setupPath'] = ArrayUtil::pickFirst($possibleSetupPaths, 'file_exists');
if ($setupOptions['setupPath']) {
$output->writeln(sprintf('<info>Found code for <comment>%s</comment> in <comment>%s</comment></info>', 'civicrm-setup', $setupOptions['setupPath']), $defaultOutputOptions);
}
else {
$this->printPathError($output, 'civicrm-setup', '--setup-path', 'CV_SETUP_PATH', $possibleSetupPaths);
throw new \Exception("Failed to locate civicrm-setup");
}


 
 
 
 if ($input->getOption('cms-base-url')) {
$setupOptions['cmsBaseUrl'] = $input->getOption('cms-base-url');
}

$pluginCallback = function($pluginFiles) use ($input) {
foreach ($input->getOption('plugin-path') as $pluginDir) {
foreach (['*.civi-setup.php'] as $pattern) {
foreach ((array) glob("$pluginDir/$pattern") as $file) {
$key = substr($file, strlen($pluginDir) + 1);
$key = preg_replace('/\.civi-setup\.php$/', '', $key);
$pluginFiles[$key] = $file;
}
}
}
ksort($pluginFiles);
return $pluginFiles;
};

$this->setupAutoloaders($setupOptions['srcPath'], $setupOptions['setupPath']);
$c = new \ReflectionClass('Civi\Setup');
if (substr($c->getFileName(), 0, strlen($setupOptions['setupPath'])) !== $setupOptions['setupPath']) {
$effSetupPath = dirname(dirname($c->getFileName()));
$output->writeln(sprintf('Warning: Autoloader prioritized code from <comment>%s</comment> instead of requested <comment>%s</comment>.', $effSetupPath, $setupOptions['setupPath']));
}

\Civi\Setup::assertProtocolCompatibility(CV_SETUP_PROTOCOL_VER);
\Civi\Setup::init($setupOptions, $pluginCallback, new ConsoleLogger($output));
$setup = \Civi\Setup::instance();


 $setup->getModel()->settingsPath = ArrayUtil::pickFirst([
$input->getOption('settings-path'),
getenv('CV_SETUP_SETTINGS'),
$setup->getModel()->settingsPath,
]);
$setup->getModel()->cmsBaseUrl = ArrayUtil::pickFirst([
$input->getOption('cms-base-url'),
$setup->getModel()->cmsBaseUrl,
]);
if ($input->getOption('db')) {
$setup->getModel()->db = DbUtil::parseDsn($input->getOption('db'));
}
if ($input->getOption('lang')) {
$setup->getModel()->lang = $input->getOption('lang');
}
if ($input->getOption('comp')) {
$setup->getModel()->components = explode(',', $input->getOption('comp'));
}
if ($input->getOption('ext')) {
$setup->getModel()->extensions = array_unique(
array_merge(
$setup->getModel()->extensions,
explode(',', $input->getOption('ext'))
)
);
}
foreach ($input->getOption('model') as $modelExpr) {
$obj = $setup->getModel();
list ($key, $value) = explode('=', $modelExpr, 2);
$keyPath = explode('.', $key);
$firstKey = array_shift($keyPath);
if ($keyPath) {
ArrayUtil::pathSet($obj->{$firstKey}, $keyPath, $value);
}
else {
$obj->{$firstKey} = $value;
}
}

return $setup;
}








protected function setupAutoloaders($srcPath, $setupPath) {

 $setupAL = implode(DIRECTORY_SEPARATOR, [$setupPath, 'civicrm-setup-autoload.php']);
if (file_exists($setupAL)) {
require_once $setupAL;
}


 $coreAL = implode(DIRECTORY_SEPARATOR, [$srcPath, 'CRM', 'Core', 'ClassLoader.php']);
if (!file_exists($coreAL)) {
throw new \Exception("Failed to load $coreAL");
}
require_once $coreAL;

\CRM_Core_ClassLoader::singleton()->register();
}








protected function printPathError(OutputInterface $output, $name, $optName, $envName, $possibleSrcPaths) {
$output->writeln(sprintf('<error>Failed to locate %s</error>', $name));
$output->writeln(sprintf('<info>Consider setting <comment>%s</comment>, setting <comment>%s</comment>, or placing it one of these folders:</info>', $optName, $envName));
foreach ($possibleSrcPaths as $path) {
if ($path) {
$output->writeln(sprintf('<info> * <comment>%s</comment></info>', $path));
}
}
}

}
<?php
namespace Civi\Cv;

class Encoder {










public static function getDefaultFormat($fallback = 'json-pretty') {
$e = getenv('CV_OUTPUT');
return $e ? $e : $fallback;
}






public static function getTabularFormats() {
$result = self::getFormats();
array_unshift($result, 'list');
array_unshift($result, 'csv');
array_unshift($result, 'table');
return $result;
}







public static function getFormats() {
return array(
'none',
'pretty',
'php',
'json-pretty',
'json-strict',
'serialize',
'shell',
);
}

public static function encode($data, $format) {
switch ($format) {
case 'none':
return '';

case 'pretty':
return print_r($data, 1);

case 'php':
return var_export($data, 1);

case 'json-pretty':
$jsonOptions = (defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0)
|
(defined('JSON_UNESCAPED_SLASHES') ? JSON_UNESCAPED_SLASHES : 0);
return json_encode($data, $jsonOptions);

case 'json':
case 'json-strict':
return json_encode($data);

case 'serialize':
return serialize($data);

case 'shell':
if (is_scalar($data)) {
return escapeshellarg($data);
}
elseif (is_array($data)) {

 $tree = \Civi\Cv\Util\ArrayUtil::implodeTree('_', $data);
$buf = '';
foreach ($tree as $k => $v) {
$buf .= (sprintf("%s=%s\n", $k, escapeshellarg($v)));
}
return $buf;
}
else {
return gettype($data);
}

default:
throw new \RuntimeException('Unknown output format');
}
}

}
<?php
namespace Civi\Cv;

use Civi\Cv\Util\Filesystem;

class Config {

public static function read() {
$file = self::getFileName();
if ($file && file_exists($file)) {
$buf = file_get_contents($file);
$config = json_decode($buf, TRUE);
if (!empty($buf) && $config === NULL) {
throw new \RuntimeException("Config file ($file) contains malformed JSON.");
}
return $config;
}
else {
return array();
}
}










public static function update($filter) {
$fs = new Filesystem();
return $fs->update(self::getFileName(), function ($rawIn) use ($filter) {
$data = empty($rawIn) ? array() : json_decode($rawIn, TRUE);
$data = call_user_func($filter, $data);
return Encoder::encode($data, 'json-pretty');
});
}




public static function getFileName() {
if (getenv('CV_CONFIG')) {
return getenv('CV_CONFIG');
}
elseif (getenv('HOME')) {
return getenv('HOME') . '/.cv.json';
}
else {
throw new \RuntimeException("Failed to determine file path for 'cv.json'.");
}
}

}
<?php
namespace Civi\Cv;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Application extends \Symfony\Component\Console\Application {




public static function main($binDir) {
$application = new Application('cv', 'v0.3.19');

$application->setAutoExit(FALSE);
$running = TRUE;
register_shutdown_function(function () use (&$running) {
$error = error_get_last();
if ($running && $error) {

 
 exit(255);
}
});
$result = $application->run();
$running = FALSE;
exit($result);
}

public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN') {
parent::__construct($name, $version);
$this->setCatchExceptions(TRUE);
$this->addCommands($this->createCommands());
}




protected function getDefaultInputDefinition() {
$definition = parent::getDefaultInputDefinition();
$definition->addOption(new InputOption('cwd', NULL, InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
return $definition;
}




public function doRun(InputInterface $input, OutputInterface $output) {
$workingDir = $input->getParameterOption(array('--cwd'));
if (FALSE !== $workingDir && '' !== $workingDir) {
if (!is_dir($workingDir)) {
throw new \RuntimeException("Invalid working directory specified, $workingDir does not exist.");
}
if (!chdir($workingDir)) {
throw new \RuntimeException("Failed to use directory specified, $workingDir as working directory.");
}
}
return parent::doRun($input, $output);
}






public function createCommands($context = 'default') {
$commands = array();
$commands[] = new \Civi\Cv\Command\ApiCommand();
$commands[] = new \Civi\Cv\Command\Api4Command();
$commands[] = new \Civi\Cv\Command\ApiBatchCommand();
$commands[] = new \Civi\Cv\Command\AngularModuleListCommand();
$commands[] = new \Civi\Cv\Command\AngularHtmlListCommand();
$commands[] = new \Civi\Cv\Command\AngularHtmlShowCommand();
$commands[] = new \Civi\Cv\Command\DebugContainerCommand();
$commands[] = new \Civi\Cv\Command\DebugDispatcherCommand();
$commands[] = new \Civi\Cv\Command\ExtensionDownloadCommand();
$commands[] = new \Civi\Cv\Command\ExtensionEnableCommand();
$commands[] = new \Civi\Cv\Command\ExtensionDisableCommand();
$commands[] = new \Civi\Cv\Command\ExtensionListCommand();
$commands[] = new \Civi\Cv\Command\ExtensionUninstallCommand();
$commands[] = new \Civi\Cv\Command\ExtensionUpgradeDbCommand();
$commands[] = new \Civi\Cv\Command\FillCommand();
$commands[] = new \Civi\Cv\Command\FlushCommand();
$commands[] = new \Civi\Cv\Command\PathCommand();
$commands[] = new \Civi\Cv\Command\PipeCommand();
$commands[] = new \Civi\Cv\Command\SqlCliCommand();
$commands[] = new \Civi\Cv\Command\ShowCommand();

 $commands[] = new \Civi\Cv\Command\UpgradeDbCommand();

 
 
 $commands[] = new \Civi\Cv\Command\UrlCommand();
if ($context !== 'repl') {
$commands[] = new \Civi\Cv\Command\BootCommand();
$commands[] = new \Civi\Cv\Command\CliCommand();
$commands[] = new \Civi\Cv\Command\EvalCommand();
$commands[] = new \Civi\Cv\Command\ScriptCommand();
$commands[] = new \Civi\Cv\Command\CoreCheckReqCommand();
$commands[] = new \Civi\Cv\Command\CoreInstallCommand();
$commands[] = new \Civi\Cv\Command\CoreUninstallCommand();
}
return $commands;
}

}
<?php
namespace Civi\Cv;

class BuildkitReader {







public static function findShFile($settingsFile) {
$parts = explode('/', str_replace('\\', '/', $settingsFile));
while (!empty($parts)) {
$last = array_pop($parts);
$basePath = implode('/', $parts);
$shFile = "$basePath/$last.sh";
if (is_dir("$basePath/$last") && file_exists($shFile)) {

 if (preg_match('/ADMIN_USER=/', file_get_contents($shFile))) {
return $shFile;
}
}
}
return NULL;
}







public static function readShFile($shFile) {
$lines = explode("\n", file_get_contents($shFile));
$result = array();
foreach ($lines as $line) {
if (empty($line) || $line[0] == '#') {
continue;
}
if (preg_match('/^([A-Z0-9_]+)=\"(.*)\"$/', $line, $matches)) {
$result[$matches[1]] = stripcslashes($matches[2]);
}
else {
throw new \RuntimeException("Malformed line [$line]");
}
}
return $result;
}

}
<?php
namespace Civi\Cv;

use Symfony\Component\Console\Output\OutputInterface;










































































class Bootstrap {

const PHP_RECOMMENDED_MIN = '7.0.0';

protected static $singleton = NULL;

protected $options = array();






protected $output = FALSE;







public function writeln($text, $level = OutputInterface::VERBOSITY_NORMAL) {
if ($this->output) {
$this->output->writeln("<info>[Bootstrap]</info> $text", $level);
}
}




public static function singleton() {
if (self::$singleton === NULL) {
self::$singleton = new Bootstrap(array(
'dynamicSettingsFile' => dirname(__DIR__) . '/settings_location.php',
'env' => 'CIVICRM_SETTINGS',
'prefetch' => TRUE,
'settingsFile' => NULL,
'search' => TRUE,
'cmsType' => NULL,
'httpHost' => array_key_exists('HTTP_HOST', $_SERVER) ? $_SERVER['HTTP_HOST'] : '',
));
}
return self::$singleton;
}





public function __construct($options = array()) {
$this->options = $options;
}








public function boot($options = array()) {
if (!empty($options['output'])) {
$this->output = $options['output'];
}

$isBooting = TRUE;
register_shutdown_function(function() use (&$isBooting) {
if (!$isBooting) {

 return;
}
$last_error = error_get_last();
switch ($last_error['type'] ?? NULL) {
case E_ERROR:
case E_PARSE:
case E_COMPILE_ERROR:
$errMsg = sprintf("PHP Error: %s\nat line %s in %s", $last_error['message'], $last_error['line'], $last_error['file']);

 
 if (!version_compare(PHP_VERSION, self::PHP_RECOMMENDED_MIN, '>=')) {
$errMsg .= sprintf("\n\nWARNING: cv recommends PHP %s+ for use with current CiviCRM versions. This command is running PHP %s.", self::PHP_RECOMMENDED_MIN, PHP_VERSION);
}

if ($this->output && is_callable([$this->output, 'getErrorOutput'])) {
$this->output->getErrorOutput()->writeln("<error>$errMsg</error>");
}
elseif ($this->output) {
$this->output->writeln("<error>$errMsg</error>");
}
else {
fwrite(STDERR, "$errMsg\n");
}
break;
}
});

if (!defined('CIVICRM_SETTINGS_PATH')) {

$this->options = $options = array_merge($this->options, $options);
$this->writeln("Options: " . json_encode($options, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), OutputInterface::VERBOSITY_DEBUG);

$this->writeln("Find settings file", OutputInterface::VERBOSITY_DEBUG);
$settings = $this->getCivicrmSettingsPhp($options);
if (empty($settings) || !file_exists($settings)) {
throw new \Exception("Failed to locate civicrm.settings.php."
. " By default, this tool searches the parent directories for a standard CMS (Drupal, WordPress, etal) and standard civicrm.settings.php."
. " Symlinks and multisite configurations may interfere."
. " To customize, set variable CIVICRM_SETTINGS to point to the preferred civicrm.settings.php.");
}

if (class_exists('Civi\Cv\SiteConfigReader')) {
$this->writeln("Load supplemental configuration for \"$settings\"", OutputInterface::VERBOSITY_DEBUG);
$reader = new SiteConfigReader($settings);
$GLOBALS['_CV'] = $reader->compile(array('buildkit', 'home'));
}
else {
$this->writeln("Warning: Not loading supplemental configuration for \"$settings\". SiteConfigReader is missing.", OutputInterface::VERBOSITY_DEBUG);
$GLOBALS['_CV'] = [];
}

$this->writeln("Load settings file \"" . $settings . "\"", OutputInterface::VERBOSITY_DEBUG);
define('CIVICRM_SETTINGS_PATH', $settings);
$error = @include_once $settings;
if ($error == FALSE) {
$this->writeln("Failed to load settings file", OutputInterface::VERBOSITY_VERBOSE);
throw new \Exception("Could not load the CiviCRM settings file: {$settings}");
}

$this->writeln("Find CMS root for \"" . $this->getSearchDir() . "\"", OutputInterface::VERBOSITY_VERBOSE);
list ($cmsType, $cmsBasePath) = $this->findCmsRoot($this->getSearchDir());
$this->writeln("Found \"$cmsType\" in \"$cmsBasePath\"", OutputInterface::VERBOSITY_VERBOSE);

if (PHP_SAPI === "cli") {
$this->writeln("Simulate web environment in CLI", OutputInterface::VERBOSITY_VERBOSE);
$_SERVER['SCRIPT_FILENAME'] = $cmsBasePath . '/index.php';
$_SERVER['REMOTE_ADDR'] = "127.0.0.1";
$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['REQUEST_METHOD'] = 'GET';
if (ord($_SERVER['SCRIPT_NAME']) != 47) {
$_SERVER['SCRIPT_NAME'] = '/' . $_SERVER['SCRIPT_NAME'];
}
}
}


 
 $this->writeln("Initialize class loader", OutputInterface::VERBOSITY_VERBOSE);
global $civicrm_root;
require_once $civicrm_root . '/CRM/Core/ClassLoader.php';
\CRM_Core_ClassLoader::singleton()->register();

if (!empty($options['prefetch'])) {
$this->writeln("Call core bootstrap", OutputInterface::VERBOSITY_VERBOSE);

 
 
 
 \CRM_Core_Config::singleton();
}
$this->writeln("Finished", OutputInterface::VERBOSITY_DEBUG);
$isBooting = FALSE;
}









public function generate() {
$code = array();

$code[] = 'if (PHP_SAPI === "cli") {';
$srvVars = array(
'SCRIPT_FILENAME',
'REMOTE_ADDR',
'SERVER_SOFTWARE',
'REQUEST_METHOD',
'SCRIPT_NAME',
);
foreach ($srvVars as $srvVar) {
$code[] = sprintf('$_SERVER["%s"] = %s;',
$srvVar, var_export($_SERVER[$srvVar], 1));
}
foreach (array('CIVICRM_UF') as $envVar) {
if (getenv($envVar)) {
$code[] = sprintf('putenv("%s=" . %s);', $envVar, var_export(getenv($envVar), 1));
$code[] = sprintf('$_ENV["%s"] = %s;', $envVar, var_export(getenv($envVar), 1));
}
}
$code[] = '}';

$code[] = sprintf('$GLOBALS[\'_CV\'] = %s;', var_export($GLOBALS['_CV'], 1));

$code[] = sprintf('define("CIVICRM_SETTINGS_PATH", %s);', var_export(CIVICRM_SETTINGS_PATH, 1));
$code[] = '$error = @include_once CIVICRM_SETTINGS_PATH;';
$code[] = 'if ($error == FALSE) {';
$code[] = '  throw new \Exception("Could not load the CiviCRM settings file: {$settings}");';
$code[] = '}';

$code[] = 'require_once $GLOBALS["civicrm_root"] . "/CRM/Core/ClassLoader.php";';
$code[] = '\CRM_Core_ClassLoader::singleton()->register();';

return implode("\n", $code);
}





public function getOptions() {
return $this->options;
}





public function setOptions($options) {
$this->options = $options;
}






public function getCivicrmSettingsPhp($options) {
if (!empty($options['dynamicSettingsFile']) && file_exists($options['dynamicSettingsFile'])) {
include $options['dynamicSettingsFile'];
}





$settings = NULL;

if (defined('CIVICRM_CONFDIR') && file_exists(CIVICRM_CONFDIR . '/civicrm.settings.php')) {
$settings = CIVICRM_CONFDIR . '/civicrm.settings.php';
}
elseif (!empty($options['env']) && getenv($options['env']) && file_exists(getenv($options['env']))) {
$settings = getenv($options['env']);
}
elseif (!empty($options['settingsFile']) && file_exists($options['settingsFile'])) {
$settings = $options['settingsFile'];
}
elseif (!empty($options['search'])) {
list (, , $settings) = $this->findCivicrmSettingsPhp($this->getSearchDir());
}

return $settings;
}









protected function findCivicrmSettingsPhp($searchDir) {
list ($cmsType, $cmsRoot) = $this->findCmsRoot($searchDir);
$settings = NULL;
switch ($cmsType) {
case 'backdrop':
$settings = $this->findFirstFile(
array_merge($this->findDrupalDirs($cmsRoot), array($cmsRoot)),
'civicrm.settings.php'
);
break;

case 'drupal':
$settings = $this->findFirstFile($this->findDrupalDirs($cmsRoot), 'civicrm.settings.php');
break;

case 'joomla':

 
 
 
 
 

$settings = $cmsRoot . '/administrator/components/com_civicrm/civicrm.settings.php';

 break;

case 'wp':
$wpDirs = array(
$cmsRoot . '/*/uploads/civicrm',
$cmsRoot . '/*/plugins/civicrm',
$cmsRoot . '/*/uploads/sites/*/civicrm',
$cmsRoot . '/*/blogs.dir/*/files/civicrm',
);
$settings = $this->findFirstFile($wpDirs, 'civicrm.settings.php');
break;
}
return array($cmsType, $cmsRoot, $settings);
}








protected function findDrupalDirs($cmsRoot) {
$dirs = array();
$server = explode('.', implode('.', array_reverse(explode(':', rtrim($this->options['httpHost'], '.')))));
for ($j = count($server); $j > 0; $j--) {
$dirs[] = "$cmsRoot/sites/" . implode('.', array_slice($server, -$j));
}
$dirs[] = "$cmsRoot/sites/default";
return $dirs;
}







protected function findCmsRoot($searchDir) {

 
 
 $cmsPatterns = array(
'wp' => array(
'wp-includes/version.php',

 ),
'joomla' => array(
'administrator/components/com_civicrm/civicrm/civicrm-version.php',
'administrator/components/com_users/users.php',

 ),
'drupal' => array(

 'modules/system/system.module',

 'core/core.services.yml',
),
'backdrop' => array(
'core/modules/layout/layout.module',
),
);

$parts = explode('/', str_replace('\\', '/', $searchDir));
while (!empty($parts)) {
$basePath = implode('/', $parts);

foreach ($cmsPatterns as $cmsType => $relPaths) {
if (!empty($this->options['cmsType']) && $this->options['cmsType'] != $cmsType) {
continue;
}
foreach ($relPaths as $relPath) {
$matches = glob("$basePath/$relPath");
if (!empty($matches)) {
return array($cmsType, $basePath);
}
$matches = glob("$basePath/web/$relPath");
if (!empty($matches)) {
return array($cmsType, "$basePath/web");
}
}
}
array_pop($parts);
}

return array(NULL, NULL);
}








protected function findFirstFile($dirs, $items) {
$dirs = (array) $dirs;
$items = (array) $items;
foreach ($dirs as $dir) {
foreach ($items as $item) {
$matches = (array) glob("$dir/$item");
if (isset($matches[0])) {
return $matches[0];
}
}
}
return NULL;
}




protected function getSearchDir() {
if ($this->options['search'] === TRUE) {

 
 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return getcwd();
}
else {
exec('pwd', $output);
return trim(implode("\n", $output));
}
}
else {
return $this->options['search'];
}
}

}
<?php
namespace Civi\Cv;

use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\Routing\Route;





































class CmsBootstrap {

protected static $singleton = NULL;

protected $options = array();







protected $output = FALSE;




protected $bootedCms = NULL;







public function writeln($text, $level = OutputInterface::VERBOSITY_NORMAL) {
if ($this->output) {
$this->output->writeln("<info>[CmsBootstrap]</info> $text", $level);
}
}




public static function singleton() {
if (self::$singleton === NULL) {
self::$singleton = new CmsBootstrap(array(
'env' => 'CIVICRM_BOOT',
'search' => TRUE,
'httpHost' => array_key_exists('HTTP_HOST', $_SERVER) ? $_SERVER['HTTP_HOST'] : 'localhost',
'user' => NULL,
));
}
return self::$singleton;
}





public function __construct($options = array()) {
$this->addOptions($options);
}







public function bootCms() {
$this->writeln("Options: " . json_encode($this->options, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), OutputInterface::VERBOSITY_DEBUG);

if ($this->options['env'] && getenv($this->options['env'])) {
$cmsExpr = getenv($this->options['env']);
$this->writeln("Parse CMS options ($cmsExpr)", OutputInterface::VERBOSITY_DEBUG);
$cms = array(
'type' => parse_url($cmsExpr, PHP_URL_SCHEME),
'path' => '/' . parse_url($cmsExpr, PHP_URL_HOST) . parse_url($cmsExpr, PHP_URL_PATH),
);
$cms['path'] = preg_replace(';^//+;', '/', $cms['path']);
if (!isset($this->options['user']) && parse_url($cmsExpr, PHP_URL_USER)) {
$this->options['user'] = parse_url($cmsExpr, PHP_URL_USER);
}
}
else {
$this->writeln("Find CMS...", OutputInterface::VERBOSITY_DEBUG);
$cms = $this->findCmsRoot($this->getSearchDir());
}

$this->writeln("CMS: " . json_encode($this->options, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), OutputInterface::VERBOSITY_DEBUG);
if (empty($cms['path']) || empty($cms['type']) || !file_exists($cms['path'])) {
throw new \Exception("Failed to parse or find a CMS");
}

if (PHP_SAPI === "cli") {
$this->writeln("Simulate web environment in CLI", OutputInterface::VERBOSITY_DEBUG);
$this->simulateWebEnv($this->options['httpHost'], $cms['path'] . '/index.php');
}
$func = 'boot' . $cms['type'];
if (!is_callable([$this, $func])) {
throw new \Exception("Failed to locate boot function ($func)");
}

call_user_func([$this, $func],
$cms['path'], $this->options['user'], $this->options['httpHost']);

if (PHP_SAPI === "cli") {
error_reporting(1);
}

$this->writeln("Finished", OutputInterface::VERBOSITY_DEBUG);
$this->bootedCms = $cms;
return $this;
}







public function getBootedCmsType() {
return isset($this->bootedCms['type']) ? $this->bootedCms['type'] : NULL;
}







public function getBootedCmsPath() {
return isset($this->bootedCms['path']) ? $this->bootedCms['path'] : NULL;
}





public function bootCivi() {

 if (function_exists('civicrm_initialize')) {
civicrm_initialize();
}
elseif (class_exists('Drupal')) {

 \Drupal::service('civicrm')->initialize();
}

 else {
throw new \Exception("This system does not appear to have CiviCRM");
}

if (!empty($this->options['user'])) {
$this->ensureUserContact();
}


 if (is_callable([\CRM_Core_Config::singleton()->userSystem, 'setMySQLTimeZone'])) {
\CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
}

return $this;
}

public function bootBackdrop($cmsPath, $cmsUser) {
if (!file_exists("$cmsPath/core/includes/bootstrap.inc")) {
throw new \Exception('Sorry, could not locate Backdrop\'s bootstrap.inc');
}
chdir($cmsPath);
define('BACKDROP_ROOT', $cmsPath);
require_once "$cmsPath/core/includes/bootstrap.inc";
require_once "$cmsPath/core/includes/config.inc";
\backdrop_bootstrap(BACKDROP_BOOTSTRAP_FULL);

if (!function_exists('module_exists')) {
throw new \Exception('Sorry, could not bootstrap Backdrop.');
}

if ($cmsUser) {
global $user;
$user = \user_load(array('name' => $cmsUser));
}

return $this;
}

public function bootDrupal($cmsPath, $cmsUser) {
if (!file_exists("$cmsPath/includes/bootstrap.inc")) {

 throw new \Exception('Sorry, could not locate Drupal\'s bootstrap.inc');
}
chdir($cmsPath);
define('DRUPAL_ROOT', $cmsPath);
require_once 'includes/bootstrap.inc';
\drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

if (!function_exists('module_exists')) {
throw new \Exception('Sorry, could not bootstrap Drupal.');
}

if ($cmsUser) {
global $user;
$user = \user_load_by_name($cmsUser);
}

return $this;
}

public function bootDrupal8($cmsRootPath, $cmsUser) {
if (!file_exists("$cmsRootPath/core/core.services.yml")) {

 throw new \Exception('Sorry, could not locate Drupal8\'s core.services.yml');
}

chdir($cmsRootPath);
define('DRUPAL_DIR', $cmsRootPath);
$autoloader = require_once DRUPAL_DIR . '/autoload.php';
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$kernel = \Drupal\Core\DrupalKernel::createFromRequest($request, $autoloader, 'prod');
$kernel->boot();
$kernel->preHandle($request);
$container = $kernel->rebuildContainer();

 $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, new Route('<none>'));
$request->attributes->set(RouteObjectInterface::ROUTE_NAME, '<none>');
$container->get('request_stack')->push($request);
$container->get('router.request_context')->fromRequest($request);

if (!function_exists('t')) {
throw new \Exception('Sorry, could not bootstrap Drupal8.');
}

if ($cmsUser) {
$entity_manager = \Drupal::entityManager();
$users = $entity_manager->getStorage($entity_manager->getEntityTypeFromClass('Drupal\user\Entity\User'))
->loadByProperties(array(
'name' => $cmsUser,
));
if (count($users) == 1) {
foreach ($users as $uid => $user) {
user_login_finalize($user);
}
}
elseif (empty($users)) {
throw new \Exception(sprintf("Failed to find Drupal8 user (%s)", $cmsUser));
}
else {
throw new \Exception(sprintf("Found too many Drupal8 users (%d)", count($users)));
}
}

return $this;
}








public function bootWordPress($cmsRootPath, $cmsUser) {
if (!file_exists($cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php')) {
throw new \Exception('Sorry, could not locate WordPress\'s wp-load.php.');
}
chdir($cmsRootPath);
require_once $cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php';

if (!function_exists('wp_set_current_user')) {
throw new \Exception('Sorry, could not bootstrap WordPress.');
}

if ($cmsUser) {
wp_set_current_user(NULL, $cmsUser);
}

return $this;
}





public function getOptions() {
return $this->options;
}






public function addOptions($options) {
$this->options = array_merge($this->options, $options);

if (!empty($options['output'])) {
$this->output = $options['output'];
}

return $this;
}







protected function findCmsRoot($searchDir) {

 
 
 $cmsPatterns = array(
'WordPress' => array(

 'wp-load.php',
),
'Joomla' => array(
'administrator/components/com_users/users.php',
),
'Drupal' => array(
'modules/system/system.module',
),
'Drupal8' => array(
'core/core.services.yml',
),
'Backdrop' => array(
'core/modules/layout/layout.module',
),
);

$parts = explode('/', str_replace('\\', '/', $searchDir));
while (!empty($parts)) {
$basePath = implode('/', $parts);

foreach ($cmsPatterns as $cmsType => $relPaths) {
if (!empty($this->options['cmsType']) && $this->options['cmsType'] != $cmsType) {
continue;
}
foreach ($relPaths as $relPath) {
$matches = glob("$basePath/$relPath");
if (!empty($matches)) {
return array('path' => $basePath, 'type' => $cmsType);
}
$matches = glob("$basePath/web/$relPath");
if (!empty($matches)) {
return array('path' => "$basePath/web", 'type' => $cmsType);
}
}
}

array_pop($parts);
}

return NULL;
}




protected function getSearchDir() {
if ($this->options['search'] === TRUE) {

 
 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
return getcwd();
}
else {
exec('pwd', $output);
return trim(implode("\n", $output));
}
}
else {
return $this->options['search'];
}
}





protected function simulateWebEnv($host, $scriptFile) {
$_SERVER['SCRIPT_FILENAME'] = $scriptFile;
$_SERVER['REMOTE_ADDR'] = "127.0.0.1";
$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['SERVER_NAME'] = $host;
$_SERVER['HTTP_HOST'] = $host;
if (ord($_SERVER['SCRIPT_NAME']) != 47) {
$_SERVER['SCRIPT_NAME'] = '/' . $_SERVER['SCRIPT_NAME'];
}
}

protected function ensureUserContact() {
if ($cid = \CRM_Core_Session::getLoggedInContactID()) {
return $cid;
}


 switch (CIVICRM_UF) {
case 'Drupal':
case 'Drupal6':
case 'Backdrop':
\CRM_Core_BAO_UFMatch::synchronize($GLOBALS['user'], TRUE, CIVICRM_UF, 'Individual');
break;

case 'Drupal8':
\CRM_Core_BAO_UFMatch::synchronize(\Drupal::currentUser(), TRUE, CIVICRM_UF, 'Individual');
break;

case 'Joomla':
\CRM_Core_BAO_UFMatch::synchronize(\JFactory::getUser(), TRUE, CIVICRM_UF, 'Individual');
break;

case 'WordPress':
\CRM_Core_BAO_UFMatch::synchronize($GLOBALS['current_user'], TRUE, CIVICRM_UF, 'Individual');
break;

default:
$this->output->writeln("<error>Unrecognized UF: " . CIVICRM_UF . "</error>");
}

return \CRM_Core_Session::getLoggedInContactID();
}

}
<?php
namespace Civi\Cv\Exception;

class ProcessErrorException extends \RuntimeException {



private $process;

public function __construct(\Symfony\Component\Process\Process $process, $message = "", $code = 0, Exception $previous = NULL) {
$this->process = $process;
if (empty($message)) {
$message = $this->createReport($process);
}
parent::__construct($message, $code, $previous);
}




public function setProcess($process) {
$this->process = $process;
}




public function getProcess() {
return $this->process;
}

public function createReport($process) {
return "Process failed:
[[ COMMAND: {$process->getCommandLine()} ]]
[[ CWD: {$process->getWorkingDirectory()} ]]
[[ EXIT CODE: {$process->getExitCode()} ]]
[[ STDOUT ]]
{$process->getOutput()}
[[ STDERR ]]
{$process->getErrorOutput()}
      ";
}

}
<?php
ini_set('display_errors', 'stderr');
if (PHP_SAPI !== 'cli') {
  printf("cv is a command-line tool. It is designed to run with PHP_SAPI \"%s\". The active PHP_SAPI is \"%s\".\n", 'cli', PHP_SAPI);
  printf("TIP: In a typical shell environment, the \"php\" command should execute php-cli - not php-cgi or similar.\n");
  exit(1);
}
if (version_compare(PHP_VERSION, '5.4', '<')) {
  echo "cv requires PHP 5.4+\n";
  exit(2);
}
$found = 0;
$autoloaders = array(
  dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php',
  dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR . 'autoload.php',
);
foreach ($autoloaders as $autoloader) {
  if (file_exists($autoloader)) {
    require_once $autoloader;
    $found = 1;
    break;
  }
}
if (!$found) {
  die("Failed to find autoloader");
}
\Civi\Cv\Application::main(__DIR__);
<?php
namespace JakubOnderka\PhpConsoleHighlighter;

use JakubOnderka\PhpConsoleColor\ConsoleColor;

class Highlighter
{
const TOKEN_DEFAULT = 'token_default',
TOKEN_COMMENT = 'token_comment',
TOKEN_STRING = 'token_string',
TOKEN_HTML = 'token_html',
TOKEN_KEYWORD = 'token_keyword';

const ACTUAL_LINE_MARK = 'actual_line_mark',
LINE_NUMBER = 'line_number';


private $color;


private $defaultTheme = array(
self::TOKEN_STRING => 'red',
self::TOKEN_COMMENT => 'yellow',
self::TOKEN_KEYWORD => 'green',
self::TOKEN_DEFAULT => 'default',
self::TOKEN_HTML => 'cyan',

self::ACTUAL_LINE_MARK => 'red',
self::LINE_NUMBER => 'dark_gray',
);





public function __construct(ConsoleColor $color)
{
$this->color = $color;

foreach ($this->defaultTheme as $name => $styles) {
if (!$this->color->hasTheme($name)) {
$this->color->addTheme($name, $styles);
}
}
}










public function getCodeSnippet($source, $lineNumber, $linesBefore = 2, $linesAfter = 2)
{
$tokenLines = $this->getHighlightedLines($source);

$offset = $lineNumber - $linesBefore - 1;
$offset = max($offset, 0);
$length = $linesAfter + $linesBefore + 1;
$tokenLines = array_slice($tokenLines, $offset, $length, $preserveKeys = true);

$lines = $this->colorLines($tokenLines);

return $this->lineNumbers($lines, $lineNumber);
}







public function getWholeFile($source)
{
$tokenLines = $this->getHighlightedLines($source);
$lines = $this->colorLines($tokenLines);
return implode(PHP_EOL, $lines);
}







public function getWholeFileWithLineNumbers($source)
{
$tokenLines = $this->getHighlightedLines($source);
$lines = $this->colorLines($tokenLines);
return $this->lineNumbers($lines);
}





private function getHighlightedLines($source)
{
$source = str_replace(array("\r\n", "\r"), "\n", $source);
$tokens = $this->tokenize($source);
return $this->splitToLines($tokens);
}





private function tokenize($source)
{
$tokens = token_get_all($source);

$output = array();
$currentType = null;
$buffer = '';

foreach ($tokens as $token) {
if (is_array($token)) {
switch ($token[0]) {
case T_WHITESPACE:
break;

case T_OPEN_TAG:
case T_OPEN_TAG_WITH_ECHO:
case T_CLOSE_TAG:
case T_STRING:
case T_VARIABLE:


 case T_DIR:
case T_FILE:
case T_METHOD_C:
case T_DNUMBER:
case T_LNUMBER:
case T_NS_C:
case T_LINE:
case T_CLASS_C:
case T_FUNC_C:
case T_TRAIT_C:
$newType = self::TOKEN_DEFAULT;
break;

case T_COMMENT:
case T_DOC_COMMENT:
$newType = self::TOKEN_COMMENT;
break;

case T_ENCAPSED_AND_WHITESPACE:
case T_CONSTANT_ENCAPSED_STRING:
$newType = self::TOKEN_STRING;
break;

case T_INLINE_HTML:
$newType = self::TOKEN_HTML;
break;

default:
$newType = self::TOKEN_KEYWORD;
}
} else {
$newType = $token === '"' ? self::TOKEN_STRING : self::TOKEN_KEYWORD;
}

if ($currentType === null) {
$currentType = $newType;
}

if ($currentType !== $newType) {
$output[] = array($currentType, $buffer);
$buffer = '';
$currentType = $newType;
}

$buffer .= is_array($token) ? $token[1] : $token;
}

if (isset($newType)) {
$output[] = array($newType, $buffer);
}

return $output;
}





private function splitToLines(array $tokens)
{
$lines = array();

$line = array();
foreach ($tokens as $token) {
foreach (explode("\n", $token[1]) as $count => $tokenLine) {
if ($count > 0) {
$lines[] = $line;
$line = array();
}

if ($tokenLine === '') {
continue;
}

$line[] = array($token[0], $tokenLine);
}
}

$lines[] = $line;

return $lines;
}







private function colorLines(array $tokenLines)
{
$lines = array();
foreach ($tokenLines as $lineCount => $tokenLine) {
$line = '';
foreach ($tokenLine as $token) {
list($tokenType, $tokenValue) = $token;
if ($this->color->hasTheme($tokenType)) {
$line .= $this->color->apply($tokenType, $tokenValue);
} else {
$line .= $tokenValue;
}
}
$lines[$lineCount] = $line;
}

return $lines;
}







private function lineNumbers(array $lines, $markLine = null)
{
end($lines);
$lineStrlen = strlen(key($lines) + 1);

$snippet = '';
foreach ($lines as $i => $line) {
if ($markLine !== null) {
$snippet .= ($markLine === $i + 1 ? $this->color->apply(self::ACTUAL_LINE_MARK, '  > ') : '    ');
}

$snippet .= $this->color->apply(self::LINE_NUMBER, str_pad($i + 1, $lineStrlen, ' ', STR_PAD_LEFT) . '| ');
$snippet .= $line . PHP_EOL;
}

return $snippet;
}
}<?php
use JakubOnderka\PhpConsoleColor\ConsoleColor;
use JakubOnderka\PhpConsoleHighlighter\Highlighter;

require __DIR__ . '/../vendor/autoload.php';

$highlighter = new Highlighter(new ConsoleColor());

$fileContent = file_get_contents(__FILE__);
echo $highlighter->getCodeSnippet($fileContent, 3);<?php
use JakubOnderka\PhpConsoleColor\ConsoleColor;
use JakubOnderka\PhpConsoleHighlighter\Highlighter;

require __DIR__ . '/../vendor/autoload.php';

$highlighter = new Highlighter(new ConsoleColor());

$fileContent = file_get_contents(__FILE__);
echo $highlighter->getWholeFile($fileContent);<?php
use JakubOnderka\PhpConsoleColor\ConsoleColor;
use JakubOnderka\PhpConsoleHighlighter\Highlighter;

require __DIR__ . '/../vendor/autoload.php';

$highlighter = new Highlighter(new ConsoleColor());

$fileContent = file_get_contents(__FILE__);
echo $highlighter->getWholeFileWithLineNumbers($fileContent);<?php
namespace JakubOnderka\PhpConsoleColor;

class InvalidStyleException extends \Exception
{
public function __construct($styleName)
{
parent::__construct("Invalid style $styleName.");
}
}<?php
namespace JakubOnderka\PhpConsoleColor;

class ConsoleColor
{
const FOREGROUND = 38,
BACKGROUND = 48;

const COLOR256_REGEXP = '~^(bg_)?color_([0-9]{1,3})$~';

const RESET_STYLE = 0;


private $isSupported;


private $forceStyle = false;


private $styles = array(
'none' => null,
'bold' => '1',
'dark' => '2',
'italic' => '3',
'underline' => '4',
'blink' => '5',
'reverse' => '7',
'concealed' => '8',

'default' => '39',
'black' => '30',
'red' => '31',
'green' => '32',
'yellow' => '33',
'blue' => '34',
'magenta' => '35',
'cyan' => '36',
'light_gray' => '37',

'dark_gray' => '90',
'light_red' => '91',
'light_green' => '92',
'light_yellow' => '93',
'light_blue' => '94',
'light_magenta' => '95',
'light_cyan' => '96',
'white' => '97',

'bg_default' => '49',
'bg_black' => '40',
'bg_red' => '41',
'bg_green' => '42',
'bg_yellow' => '43',
'bg_blue' => '44',
'bg_magenta' => '45',
'bg_cyan' => '46',
'bg_light_gray' => '47',

'bg_dark_gray' => '100',
'bg_light_red' => '101',
'bg_light_green' => '102',
'bg_light_yellow' => '103',
'bg_light_blue' => '104',
'bg_light_magenta' => '105',
'bg_light_cyan' => '106',
'bg_white' => '107',
);


private $themes = array();

public function __construct()
{
$this->isSupported = $this->isSupported();
}








public function apply($style, $text)
{
if (!$this->isStyleForced() && !$this->isSupported()) {
return $text;
}

if (is_string($style)) {
$style = array($style);
}
if (!is_array($style)) {
throw new \InvalidArgumentException("Style must be string or array.");
}

$sequences = array();

foreach ($style as $s) {
if (isset($this->themes[$s])) {
$sequences = array_merge($sequences, $this->themeSequence($s));
} else if ($this->isValidStyle($s)) {
$sequences[] = $this->styleSequence($s);
} else {
throw new InvalidStyleException($s);
}
}

$sequences = array_filter($sequences, function ($val) {
return $val !== null;
});

if (empty($sequences)) {
return $text;
}

return $this->escSequence(implode(';', $sequences)) . $text . $this->escSequence(self::RESET_STYLE);
}




public function setForceStyle($forceStyle)
{
$this->forceStyle = (bool) $forceStyle;
}




public function isStyleForced()
{
return $this->forceStyle;
}






public function setThemes(array $themes)
{
$this->themes = array();
foreach ($themes as $name => $styles) {
$this->addTheme($name, $styles);
}
}







public function addTheme($name, $styles)
{
if (is_string($styles)) {
$styles = array($styles);
}
if (!is_array($styles)) {
throw new \InvalidArgumentException("Style must be string or array.");
}

foreach ($styles as $style) {
if (!$this->isValidStyle($style)) {
throw new InvalidStyleException($style);
}
}

$this->themes[$name] = $styles;
}




public function getThemes()
{
return $this->themes;
}





public function hasTheme($name)
{
return isset($this->themes[$name]);
}




public function removeTheme($name)
{
unset($this->themes[$name]);
}




public function isSupported()
{
if (DIRECTORY_SEPARATOR === '\\') {
if (function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT)) {
return true;
} elseif (getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON') {
return true;
}
return false;
} else {
return function_exists('posix_isatty') && @posix_isatty(STDOUT);
}
}




public function are256ColorsSupported()
{
if (DIRECTORY_SEPARATOR === '\\') {
return function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT);
} else {
return strpos(getenv('TERM'), '256color') !== false;
}
}




public function getPossibleStyles()
{
return array_keys($this->styles);
}





private function themeSequence($name)
{
$sequences = array();
foreach ($this->themes[$name] as $style) {
$sequences[] = $this->styleSequence($style);
}
return $sequences;
}





private function styleSequence($style)
{
if (array_key_exists($style, $this->styles)) {
return $this->styles[$style];
}

if (!$this->are256ColorsSupported()) {
return null;
}

preg_match(self::COLOR256_REGEXP, $style, $matches);

$type = $matches[1] === 'bg_' ? self::BACKGROUND : self::FOREGROUND;
$value = $matches[2];

return "$type;5;$value";
}





private function isValidStyle($style)
{
return array_key_exists($style, $this->styles) || preg_match(self::COLOR256_REGEXP, $style);
}





private function escSequence($value)
{
return "\033[{$value}m";
}
}
<?php
$loader = require_once __DIR__ . '/vendor/autoload.php';

$consoleColor = new JakubOnderka\PhpConsoleColor\ConsoleColor();

echo "Colors are supported: " . ($consoleColor->isSupported() ? 'Yes' : 'No') . "\n";
echo "256 colors are supported: " . ($consoleColor->are256ColorsSupported() ? 'Yes' : 'No') . "\n\n";

if ($consoleColor->isSupported()) {
foreach ($consoleColor->getPossibleStyles() as $style) {
echo $consoleColor->apply($style, $style) . "\n";
}
}

echo "\n";

if ($consoleColor->are256ColorsSupported()) {
echo "Foreground colors:\n";
for ($i = 1; $i <= 255; $i++) {
echo $consoleColor->apply("color_$i", str_pad($i, 6, ' ', STR_PAD_BOTH));

if ($i % 15 === 0) {
echo "\n";
}
}

echo "\nBackground colors:\n";

for ($i = 1; $i <= 255; $i++) {
echo $consoleColor->apply("bg_color_$i", str_pad($i, 6, ' ', STR_PAD_BOTH));

if ($i % 15 === 0) {
echo "\n";
}
}

echo "\n";
}
<?php

class TOGoS_GitIgnore_Ruleset
{
protected $rules;

public function addRule($rule) {
if( is_string($rule) ) {
$str = trim($rule);
if( $str == '' ) return;
if( $str[0] == '#' ) return;
if( substr($str,0,2) == '\\#' ) $str = substr($str,1);
$rule = TOGoS_GitIgnore_Rule::parse($str);
}
if( !($rule instanceof TOGoS_GitIgnore_Rule) ) {
throw new Exception("Argument to TOGoS_GitIgnore_Ruleset#addRule should be a string or TOGoS_GitIgnore_Rule; received ".TOGoS_GitIgnore_Util::describe($rule));
}
$this->rules[] = $rule;
}

public function match($path) {
if( !is_string($path) ) {
throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path));
}
$lastResult = null;
foreach( $this->rules as $rule ) {
$result = $rule->match($path);
if( $result !== null ) $lastResult = $result;
}
return $lastResult;
}

public static function loadFromStrings($lines) {
$rs = new self;
foreach( $lines as $line ) $rs->addRule($line);
return $rs;
}

public static function loadFromString($str) {
$lines = explode("\n", $str);
return self::loadFromStrings($lines);
}

public static function loadFromFile($filename) {
$rs = new self;
$fh = fopen($filename);
while( ($line = fgets($fh)) ) $rs->addRule($line);
fclose($fh);
return $rs;
}
}
<?php

class TOGoS_GitIgnore_Pattern
{
protected $patternString;
protected $regex;
protected function __construct($pattern, $regex) {
$this->patternString = $pattern;
$this->regex = $regex;
}

public function getPatternString() {
return $this->patternString;
}

protected static function patternToRegex($pp) {
preg_match_all('/\*|\*\*|\?|[^\*\?]|\[![^\]+]|\[[^\]+]/', $pp, $bifs);
$regex = '';
foreach( $bifs[0] as $part ) {
if( $part == '**' ) $regex .= ".*";
else if( $part == '*' ) $regex .= "[^/]*";
else if( $part == '?' ) $regex .= '?';
else if( $part[0] == '[' ) {

 
 if( $part[1] == '!' ) $part[1] = '^';
$regex .= $part;
}
else $regex .= preg_quote($part, '#');
}
return $regex;
}

public static function parse($pattern) {
$r = self::patternToRegex($pattern);
if( strlen($pattern) == 0 ) {
throw new Exception("Zero-length pattern string passed to ".__METHOD__);
}
if( $pattern[0] == '/' ) {
$r = '#^'.substr($r,1).'(?:$|/)#';
} else {
$r = '#(?:^|/)'.$r.'(?:$|/)#';
}
return new self($pattern, $r);
}

public function match($path) {
if( strlen($path) > 0 and $path[0] == '/' ) {
throw new Exception("Paths passed to #match should not start with a slash; given: «".$path."»");
}
if( !is_string($path) ) {
throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path));
}
return preg_match($this->regex, $path);
}
}
<?php

class TOGoS_GitIgnore_Util
{
public static function aize($word) {
if( preg_match('/^[aeiou]/', $word) ) return "an $word";
return "a $word";
}

public static function describe($val) {
if( $val === null ) return "null";
if( is_float($val) or is_int($val) ) return "the number $val";
if( is_bool($val) ) return $val ? "true" : "false";
if( is_object($val) ) return self::aize(get_class($val));
return aize(gettype($val));
}
}
<?php

class TOGoS_GitIgnore_Rule
{
protected $isExclusion;
protected $pattern;

public function __construct(TOGoS_GitIgnore_Pattern $pattern, $isExclusion) {
$this->pattern = $pattern;
$this->isExclusion = $isExclusion;
}


public function match($path) {
if( !is_string($path) ) {
throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path));
}
if( $this->pattern->match($path) ) {
return $this->isExclusion ? false : true;
}
return null;
}

public static function parse($str) {
$isExclusion = false;
if( $str[0] == '!' ) {
$isExclusion = true;
$str = substr($str, 1);
}
$pattern = TOGoS_GitIgnore_Pattern::parse($str);
return new self($pattern, $isExclusion);
}
}
<?php

class TOGoS_GitIgnore_FileFinder
{
public function __construct(array $options) {

 $this->ruleset = $options['ruleset'];
$this->invertRulesetResult = $options['invertRulesetResult'];
$this->defaultResult = $options['defaultResult'];
$this->includeDirectories = $options['includeDirectories'];
$this->callback = $options['callback'];
}

protected function match($rootDir, $f) {
$result = $this->ruleset->match($f);
if( $this->invertRulesetResult and $result !== null ) $result = !$result;
return $result === null ? $this->defaultResult : $result;
}

protected function _findFiles($rootDir, $f) {
if( preg_match('#/$#', $rootDir) ) throw new Exception("Root directory argument to _findFiles should not end with a slash; given «{$rootDir}»");
if( preg_match('#^/|/$#', $f) ) throw new Exception("Relative path argument to _findFiles should not start or end with a slash; given «{$f}»");

 $fullPath = $f == '' ? $rootDir : $rootDir.'/'.$f;
if( $this->includeDirectories or !is_dir($fullPath) ) {
$result = $this->match($rootDir, $f);
call_user_func($this->callback, $f, $result);
}
if( is_dir($fullPath) ) {
$dh = opendir($fullPath);
while( ($fn = readdir($dh)) !== false ) {
if( $fn == '.' or $fn == '..' ) continue;
$this->_findFiles($rootDir, $f == '' ? $fn : $f.'/'.$fn);
}
closedir($dh);
}
}

public function findFiles($dir) {
self::_findFiles($dir, '');
}
}<?php










namespace Symfony\Component\Process;

use Symfony\Component\Process\Exception\RuntimeException;






class InputStream implements \IteratorAggregate
{

private $onEmpty = null;
private $input = [];
private $open = true;




public function onEmpty(callable $onEmpty = null)
{
$this->onEmpty = $onEmpty;
}







public function write($input)
{
if (null === $input) {
return;
}
if ($this->isClosed()) {
throw new RuntimeException(sprintf('"%s" is closed.', static::class));
}
$this->input[] = ProcessUtils::validateInput(__METHOD__, $input);
}




public function close()
{
$this->open = false;
}




public function isClosed()
{
return !$this->open;
}





 public function getIterator()
{
$this->open = true;

while ($this->open || $this->input) {
if (!$this->input) {
yield '';
continue;
}
$current = array_shift($this->input);

if ($current instanceof \Iterator) {
yield from $current;
} else {
yield $current;
}
if (!$this->input && $this->open && null !== $onEmpty = $this->onEmpty) {
$this->write($onEmpty($this));
}
}
}
}
<?php










namespace Symfony\Component\Process;

/**
@gmail



*/
class PhpExecutableFinder
{
private $executableFinder;

public function __construct()
{
$this->executableFinder = new ExecutableFinder();
}








public function find($includeArgs = true)
{
if ($php = getenv('PHP_BINARY')) {
if (!is_executable($php)) {
$command = '\\' === \DIRECTORY_SEPARATOR ? 'where' : 'command -v';
if ($php = strtok(exec($command.' '.escapeshellarg($php)), \PHP_EOL)) {
if (!is_executable($php)) {
return false;
}
} else {
return false;
}
}

return $php;
}

$args = $this->findArguments();
$args = $includeArgs && $args ? ' '.implode(' ', $args) : '';


 if (\PHP_BINARY && \in_array(\PHP_SAPI, ['cgi-fcgi', 'cli', 'cli-server', 'phpdbg'], true)) {
return \PHP_BINARY.$args;
}

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;
}
}

if (@is_executable($php = \PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
return $php;
}

$dirs = [\PHP_BINDIR];
if ('\\' === \DIRECTORY_SEPARATOR) {
$dirs[] = 'C:\xampp\php\\';
}

return $this->executableFinder->find('php', false, $dirs);
}






public function findArguments()
{
$arguments = [];
if ('phpdbg' === \PHP_SAPI) {
$arguments[] = '-qrr';
}

return $arguments;
}
}
<?php










namespace Symfony\Component\Process;

/**
@gmail



*/
class ExecutableFinder
{
private $suffixes = ['.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 = [])
{
if (ini_get('open_basedir')) {
$searchPath = array_merge(explode(\PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs);
$dirs = [];
foreach ($searchPath as $path) {

 if (@is_dir($path)) {
$dirs[] = $path;
} else {
if (basename($path) == $name && @is_executable($path)) {
return $path;
}
}
}
} else {
$dirs = array_merge(
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
$extraDirs
);
}

$suffixes = [''];
if ('\\' === \DIRECTORY_SEPARATOR) {
$pathExt = getenv('PATHEXT');
$suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
}
foreach ($suffixes as $suffix) {
foreach ($dirs as $dir) {
if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
return $file;
}
}
}

return $default;
}
}
<?php










namespace Symfony\Component\Process\Pipes;

use Symfony\Component\Process\Process;








class UnixPipes extends AbstractPipes
{
private $ttyMode;
private $ptyMode;
private $haveReadSupport;

public function __construct(?bool $ttyMode, bool $ptyMode, $input, bool $haveReadSupport)
{
$this->ttyMode = $ttyMode;
$this->ptyMode = $ptyMode;
$this->haveReadSupport = $haveReadSupport;

parent::__construct($input);
}




public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}

public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}

public function __destruct()
{
$this->close();
}




public function getDescriptors(): array
{
if (!$this->haveReadSupport) {
$nullstream = fopen('/dev/null', 'c');

return [
['pipe', 'r'],
$nullstream,
$nullstream,
];
}

if ($this->ttyMode) {
return [
['file', '/dev/tty', 'r'],
['file', '/dev/tty', 'w'],
['file', '/dev/tty', 'w'],
];
}

if ($this->ptyMode && Process::isPtySupported()) {
return [
['pty'],
['pty'],
['pty'],
];
}

return [
['pipe', 'r'],
['pipe', 'w'], 
 ['pipe', 'w'], 
 ];
}




public function getFiles(): array
{
return [];
}




public function readAndWrite(bool $blocking, bool $close = false): array
{
$this->unblock();
$w = $this->write();

$read = $e = [];
$r = $this->pipes;
unset($r[0]);


 set_error_handler([$this, 'handleError']);
if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
restore_error_handler();

 
 if (!$this->hasSystemCallBeenInterrupted()) {
$this->pipes = [];
}

return $read;
}
restore_error_handler();

foreach ($r as $pipe) {

 
 $read[$type = array_search($pipe, $this->pipes, true)] = '';

do {
$data = @fread($pipe, self::CHUNK_SIZE);
$read[$type] .= $data;
} while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));

if (!isset($read[$type][0])) {
unset($read[$type]);
}

if ($close && feof($pipe)) {
fclose($pipe);
unset($this->pipes[$type]);
}
}

return $read;
}




public function haveReadSupport(): bool
{
return $this->haveReadSupport;
}




public function areOpen(): bool
{
return (bool) $this->pipes;
}
}
<?php










namespace Symfony\Component\Process\Pipes;

use Symfony\Component\Process\Exception\RuntimeException;
use Symfony\Component\Process\Process;











class WindowsPipes extends AbstractPipes
{
private $files = [];
private $fileHandles = [];
private $lockHandles = [];
private $readBytes = [
Process::STDOUT => 0,
Process::STDERR => 0,
];
private $haveReadSupport;

public function __construct($input, bool $haveReadSupport)
{
$this->haveReadSupport = $haveReadSupport;

if ($this->haveReadSupport) {

 
 
 
 $pipes = [
Process::STDOUT => Process::OUT,
Process::STDERR => Process::ERR,
];
$tmpDir = sys_get_temp_dir();
$lastError = 'unknown reason';
set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
for ($i = 0;; ++$i) {
foreach ($pipes as $pipe => $name) {
$file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);

if (!$h = fopen($file.'.lock', 'w')) {
if (file_exists($file.'.lock')) {
continue 2;
}
restore_error_handler();
throw new RuntimeException('A temporary file could not be opened to write the process output: '.$lastError);
}
if (!flock($h, \LOCK_EX | \LOCK_NB)) {
continue 2;
}
if (isset($this->lockHandles[$pipe])) {
flock($this->lockHandles[$pipe], \LOCK_UN);
fclose($this->lockHandles[$pipe]);
}
$this->lockHandles[$pipe] = $h;

if (!($h = fopen($file, 'w')) || !fclose($h) || !$h = fopen($file, 'r')) {
flock($this->lockHandles[$pipe], \LOCK_UN);
fclose($this->lockHandles[$pipe]);
unset($this->lockHandles[$pipe]);
continue 2;
}
$this->fileHandles[$pipe] = $h;
$this->files[$pipe] = $file;
}
break;
}
restore_error_handler();
}

parent::__construct($input);
}




public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}

public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}

public function __destruct()
{
$this->close();
}




public function getDescriptors(): array
{
if (!$this->haveReadSupport) {
$nullstream = fopen('NUL', 'c');

return [
['pipe', 'r'],
$nullstream,
$nullstream,
];
}


 
 
 return [
['pipe', 'r'],
['file', 'NUL', 'w'],
['file', 'NUL', 'w'],
];
}




public function getFiles(): array
{
return $this->files;
}




public function readAndWrite(bool $blocking, bool $close = false): array
{
$this->unblock();
$w = $this->write();
$read = $r = $e = [];

if ($blocking) {
if ($w) {
@stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
} elseif ($this->fileHandles) {
usleep(Process::TIMEOUT_PRECISION * 1E6);
}
}
foreach ($this->fileHandles as $type => $fileHandle) {
$data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);

if (isset($data[0])) {
$this->readBytes[$type] += \strlen($data);
$read[$type] = $data;
}
if ($close) {
ftruncate($fileHandle, 0);
fclose($fileHandle);
flock($this->lockHandles[$type], \LOCK_UN);
fclose($this->lockHandles[$type]);
unset($this->fileHandles[$type], $this->lockHandles[$type]);
}
}

return $read;
}




public function haveReadSupport(): bool
{
return $this->haveReadSupport;
}




public function areOpen(): bool
{
return $this->pipes && $this->fileHandles;
}




public function close()
{
parent::close();
foreach ($this->fileHandles as $type => $handle) {
ftruncate($handle, 0);
fclose($handle);
flock($this->lockHandles[$type], \LOCK_UN);
fclose($this->lockHandles[$type]);
}
$this->fileHandles = $this->lockHandles = [];
}
}
<?php










namespace Symfony\Component\Process\Pipes;








interface PipesInterface
{
public const CHUNK_SIZE = 16384;




public function getDescriptors(): array;






public function getFiles(): array;









public function readAndWrite(bool $blocking, bool $close = false): array;




public function areOpen(): bool;




public function haveReadSupport(): bool;




public function close();
}
<?php










namespace Symfony\Component\Process\Pipes;

use Symfony\Component\Process\Exception\InvalidArgumentException;






abstract class AbstractPipes implements PipesInterface
{
public $pipes = [];

private $inputBuffer = '';
private $input;
private $blocked = true;
private $lastError;




public function __construct($input)
{
if (\is_resource($input) || $input instanceof \Iterator) {
$this->input = $input;
} elseif (\is_string($input)) {
$this->inputBuffer = $input;
} else {
$this->inputBuffer = (string) $input;
}
}




public function close()
{
foreach ($this->pipes as $pipe) {
fclose($pipe);
}
$this->pipes = [];
}




protected function hasSystemCallBeenInterrupted(): bool
{
$lastError = $this->lastError;
$this->lastError = null;


 return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
}




protected function unblock()
{
if (!$this->blocked) {
return;
}

foreach ($this->pipes as $pipe) {
stream_set_blocking($pipe, 0);
}
if (\is_resource($this->input)) {
stream_set_blocking($this->input, 0);
}

$this->blocked = false;
}






protected function write(): ?array
{
if (!isset($this->pipes[0])) {
return null;
}
$input = $this->input;

if ($input instanceof \Iterator) {
if (!$input->valid()) {
$input = null;
} elseif (\is_resource($input = $input->current())) {
stream_set_blocking($input, 0);
} elseif (!isset($this->inputBuffer[0])) {
if (!\is_string($input)) {
if (!is_scalar($input)) {
throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', \get_class($this->input), \gettype($input)));
}
$input = (string) $input;
}
$this->inputBuffer = $input;
$this->input->next();
$input = null;
} else {
$input = null;
}
}

$r = $e = [];
$w = [$this->pipes[0]];


 if (false === @stream_select($r, $w, $e, 0, 0)) {
return null;
}

foreach ($w as $stdin) {
if (isset($this->inputBuffer[0])) {
$written = fwrite($stdin, $this->inputBuffer);
$this->inputBuffer = substr($this->inputBuffer, $written);
if (isset($this->inputBuffer[0])) {
return [$this->pipes[0]];
}
}

if ($input) {
for (;;) {
$data = fread($input, self::CHUNK_SIZE);
if (!isset($data[0])) {
break;
}
$written = fwrite($stdin, $data);
$data = substr($data, $written);
if (isset($data[0])) {
$this->inputBuffer = $data;

return [$this->pipes[0]];
}
}
if (feof($input)) {
if ($this->input instanceof \Iterator) {
$this->input->next();
} else {
$this->input = null;
}
}
}
}


 if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) {
$this->input = null;
fclose($this->pipes[0]);
unset($this->pipes[0]);
} elseif (!$w) {
return [$this->pipes[0]];
}

return null;
}




public function handleError(int $type, string $msg)
{
$this->lastError = $msg;
}
}
<?php










namespace Symfony\Component\Process;

use Symfony\Component\Process\Exception\InvalidArgumentException;
use Symfony\Component\Process\Exception\LogicException;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Exception\ProcessSignaledException;
use Symfony\Component\Process\Exception\ProcessTimedOutException;
use Symfony\Component\Process\Exception\RuntimeException;
use Symfony\Component\Process\Pipes\PipesInterface;
use Symfony\Component\Process\Pipes\UnixPipes;
use Symfony\Component\Process\Pipes\WindowsPipes;

/**
@gmail




*/
class Process implements \IteratorAggregate
{
public const ERR = 'err';
public const OUT = 'out';

public const STATUS_READY = 'ready';
public const STATUS_STARTED = 'started';
public const STATUS_TERMINATED = 'terminated';

public const STDIN = 0;
public const STDOUT = 1;
public const STDERR = 2;


 public const TIMEOUT_PRECISION = 0.2;

public const ITER_NON_BLOCKING = 1; 
 public const ITER_KEEP_OUTPUT = 2; 
 public const ITER_SKIP_OUT = 4; 
 public const ITER_SKIP_ERR = 8; 

private $callback;
private $hasCallback = false;
private $commandline;
private $cwd;
private $env;
private $input;
private $starttime;
private $lastOutputTime;
private $timeout;
private $idleTimeout;
private $exitcode;
private $fallbackStatus = [];
private $processInformation;
private $outputDisabled = false;
private $stdout;
private $stderr;
private $process;
private $status = self::STATUS_READY;
private $incrementalOutputOffset = 0;
private $incrementalErrorOutputOffset = 0;
private $tty = false;
private $pty;

private $useFileHandles = false;

private $processPipes;

private $latestSignal;

private static $sigchild;






public static $exitCodes = [
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($command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
{
if (!\function_exists('proc_open')) {
throw new LogicException('The Process class relies on proc_open, which is not available on your PHP installation.');
}

if (!\is_array($command)) {
@trigger_error(sprintf('Passing a command as string when creating a "%s" instance is deprecated since Symfony 4.2, pass it as an array of its arguments instead, or use the "Process::fromShellCommandline()" constructor if you need features provided by the shell.', __CLASS__), \E_USER_DEPRECATED);
}

$this->commandline = $command;
$this->cwd = $cwd;


 
 
 
 if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
$this->cwd = getcwd();
}
if (null !== $env) {
$this->setEnv($env);
}

$this->setInput($input);
$this->setTimeout($timeout);
$this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
$this->pty = false;
}
























public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
{
$process = new static([], $cwd, $env, $input, $timeout);
$process->commandline = $command;

return $process;
}




public function __sleep()
{
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}

public function __wakeup()
{
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
}

public function __destruct()
{
$this->stop(0);
}

public function __clone()
{
$this->resetProcessData();
}
























public function run(callable $callback = null, array $env = []): int
{
$this->start($callback, $env);

return $this->wait();
}













public function mustRun(callable $callback = null, array $env = []): self
{
if (0 !== $this->run($callback, $env)) {
throw new ProcessFailedException($this);
}

return $this;
}




















public function start(callable $callback = null, array $env = [])
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running.');
}

$this->resetProcessData();
$this->starttime = $this->lastOutputTime = microtime(true);
$this->callback = $this->buildCallback($callback);
$this->hasCallback = null !== $callback;
$descriptors = $this->getDescriptors();

if ($this->env) {
$env += $this->env;
}

$env += $this->getDefaultEnv();

if (\is_array($commandline = $this->commandline)) {
$commandline = implode(' ', array_map([$this, 'escapeArgument'], $commandline));

if ('\\' !== \DIRECTORY_SEPARATOR) {

 $commandline = 'exec '.$commandline;
}
} else {
$commandline = $this->replacePlaceholders($commandline, $env);
}

$options = ['suppress_errors' => true];

if ('\\' === \DIRECTORY_SEPARATOR) {
$options['bypass_shell'] = true;
$commandline = $this->prepareWindowsCommandLine($commandline, $env);
} elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {

 $descriptors[3] = ['pipe', 'w'];


 $commandline = '{ ('.$commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
$commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';


 
 $ptsWorkaround = fopen(__FILE__, 'r');
}

$envPairs = [];
foreach ($env as $k => $v) {
if (false !== $v && 'argc' !== $k && 'argv' !== $k) {
$envPairs[] = $k.'='.$v;
}
}

if (!is_dir($this->cwd)) {
throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd));
}

$this->process = @proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $options);

if (!\is_resource($this->process)) {
throw new RuntimeException('Unable to launch a new process.');
}
$this->status = self::STATUS_STARTED;

if (isset($descriptors[3])) {
$this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
}

if ($this->tty) {
return;
}

$this->updateStatus(false);
$this->checkTimeout();
}


















public function restart(callable $callback = null, array $env = []): self
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running.');
}

$process = clone $this;
$process->start($callback, $env);

return $process;
}
















public function wait(callable $callback = null)
{
$this->requireProcessIsStarted(__FUNCTION__);

$this->updateStatus(false);

if (null !== $callback) {
if (!$this->processPipes->haveReadSupport()) {
$this->stop(0);
throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::wait".');
}
$this->callback = $this->buildCallback($callback);
}

do {
$this->checkTimeout();
$running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
$this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
} while ($running);

while ($this->isRunning()) {
$this->checkTimeout();
usleep(1000);
}

if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
throw new ProcessSignaledException($this);
}

return $this->exitcode;
}












public function waitUntil(callable $callback): bool
{
$this->requireProcessIsStarted(__FUNCTION__);
$this->updateStatus(false);

if (!$this->processPipes->haveReadSupport()) {
$this->stop(0);
throw new LogicException('Pass the callback to the "Process::start" method or call enableOutput to use a callback with "Process::waitUntil".');
}
$callback = $this->buildCallback($callback);

$ready = false;
while (true) {
$this->checkTimeout();
$running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
$output = $this->processPipes->readAndWrite($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);

foreach ($output as $type => $data) {
if (3 !== $type) {
$ready = $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data) || $ready;
} elseif (!isset($this->fallbackStatus['signaled'])) {
$this->fallbackStatus['exitcode'] = (int) $data;
}
}
if ($ready) {
return true;
}
if (!$running) {
return false;
}

usleep(1000);
}
}






public function getPid()
{
return $this->isRunning() ? $this->processInformation['pid'] : null;
}












public function signal($signal)
{
$this->doSignal($signal, true);

return $this;
}









public function disableOutput()
{
if ($this->isRunning()) {
throw new RuntimeException('Disabling output while the process is running is not possible.');
}
if (null !== $this->idleTimeout) {
throw new LogicException('Output can not be disabled while an idle timeout is set.');
}

$this->outputDisabled = true;

return $this;
}








public function enableOutput()
{
if ($this->isRunning()) {
throw new RuntimeException('Enabling output while the process is running is not possible.');
}

$this->outputDisabled = false;

return $this;
}






public function isOutputDisabled()
{
return $this->outputDisabled;
}









public function getOutput()
{
$this->readPipesForOutput(__FUNCTION__);

if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
return '';
}

return $ret;
}












public function getIncrementalOutput()
{
$this->readPipesForOutput(__FUNCTION__);

$latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
$this->incrementalOutputOffset = ftell($this->stdout);

if (false === $latest) {
return '';
}

return $latest;
}












 public function getIterator($flags = 0)
{
$this->readPipesForOutput(__FUNCTION__, false);

$clearOutput = !(self::ITER_KEEP_OUTPUT & $flags);
$blocking = !(self::ITER_NON_BLOCKING & $flags);
$yieldOut = !(self::ITER_SKIP_OUT & $flags);
$yieldErr = !(self::ITER_SKIP_ERR & $flags);

while (null !== $this->callback || ($yieldOut && !feof($this->stdout)) || ($yieldErr && !feof($this->stderr))) {
if ($yieldOut) {
$out = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);

if (isset($out[0])) {
if ($clearOutput) {
$this->clearOutput();
} else {
$this->incrementalOutputOffset = ftell($this->stdout);
}

yield self::OUT => $out;
}
}

if ($yieldErr) {
$err = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);

if (isset($err[0])) {
if ($clearOutput) {
$this->clearErrorOutput();
} else {
$this->incrementalErrorOutputOffset = ftell($this->stderr);
}

yield self::ERR => $err;
}
}

if (!$blocking && !isset($out[0]) && !isset($err[0])) {
yield self::OUT => '';
}

$this->checkTimeout();
$this->readPipesForOutput(__FUNCTION__, $blocking);
}
}






public function clearOutput()
{
ftruncate($this->stdout, 0);
fseek($this->stdout, 0);
$this->incrementalOutputOffset = 0;

return $this;
}









public function getErrorOutput()
{
$this->readPipesForOutput(__FUNCTION__);

if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
return '';
}

return $ret;
}













public function getIncrementalErrorOutput()
{
$this->readPipesForOutput(__FUNCTION__);

$latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
$this->incrementalErrorOutputOffset = ftell($this->stderr);

if (false === $latest) {
return '';
}

return $latest;
}






public function clearErrorOutput()
{
ftruncate($this->stderr, 0);
fseek($this->stderr, 0);
$this->incrementalErrorOutputOffset = 0;

return $this;
}






public function getExitCode()
{
$this->updateStatus(false);

return $this->exitcode;
}












public function getExitCodeText()
{
if (null === $exitcode = $this->getExitCode()) {
return null;
}

return self::$exitCodes[$exitcode] ?? 'Unknown error';
}






public function isSuccessful()
{
return 0 === $this->getExitCode();
}










public function hasBeenSignaled()
{
$this->requireProcessIsTerminated(__FUNCTION__);

return $this->processInformation['signaled'];
}











public function getTermSignal()
{
$this->requireProcessIsTerminated(__FUNCTION__);

if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
}

return $this->processInformation['termsig'];
}










public function hasBeenStopped()
{
$this->requireProcessIsTerminated(__FUNCTION__);

return $this->processInformation['stopped'];
}










public function getStopSignal()
{
$this->requireProcessIsTerminated(__FUNCTION__);

return $this->processInformation['stopsig'];
}






public function isRunning()
{
if (self::STATUS_STARTED !== $this->status) {
return false;
}

$this->updateStatus(false);

return $this->processInformation['running'];
}






public function isStarted()
{
return self::STATUS_READY != $this->status;
}






public function isTerminated()
{
$this->updateStatus(false);

return self::STATUS_TERMINATED == $this->status;
}








public function getStatus()
{
$this->updateStatus(false);

return $this->status;
}









public function stop($timeout = 10, $signal = null)
{
$timeoutMicro = microtime(true) + $timeout;
if ($this->isRunning()) {

 $this->doSignal(15, false);
do {
usleep(1000);
} while ($this->isRunning() && microtime(true) < $timeoutMicro);

if ($this->isRunning()) {

 
 $this->doSignal($signal ?: 9, false);
}
}

if ($this->isRunning()) {
if (isset($this->fallbackStatus['pid'])) {
unset($this->fallbackStatus['pid']);

return $this->stop(0, $signal);
}
$this->close();
}

return $this->exitcode;
}






public function addOutput(string $line)
{
$this->lastOutputTime = microtime(true);

fseek($this->stdout, 0, \SEEK_END);
fwrite($this->stdout, $line);
fseek($this->stdout, $this->incrementalOutputOffset);
}






public function addErrorOutput(string $line)
{
$this->lastOutputTime = microtime(true);

fseek($this->stderr, 0, \SEEK_END);
fwrite($this->stderr, $line);
fseek($this->stderr, $this->incrementalErrorOutputOffset);
}






public function getLastOutputTime(): ?float
{
return $this->lastOutputTime;
}






public function getCommandLine()
{
return \is_array($this->commandline) ? implode(' ', array_map([$this, 'escapeArgument'], $this->commandline)) : $this->commandline;
}










public function setCommandLine($commandline)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);

$this->commandline = $commandline;

return $this;
}






public function getTimeout()
{
return $this->timeout;
}






public function getIdleTimeout()
{
return $this->idleTimeout;
}












public function setTimeout($timeout)
{
$this->timeout = $this->validateTimeout($timeout);

return $this;
}













public function setIdleTimeout($timeout)
{
if (null !== $timeout && $this->outputDisabled) {
throw new LogicException('Idle timeout can not be set while the output is disabled.');
}

$this->idleTimeout = $this->validateTimeout($timeout);

return $this;
}










public function setTty($tty)
{
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
throw new RuntimeException('TTY mode is not supported on Windows platform.');
}

if ($tty && !self::isTtySupported()) {
throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
}

$this->tty = (bool) $tty;

return $this;
}






public function isTty()
{
return $this->tty;
}








public function setPty($bool)
{
$this->pty = (bool) $bool;

return $this;
}






public function isPty()
{
return $this->pty;
}






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 getInput()
{
return $this->input;
}












public function setInput($input)
{
if ($this->isRunning()) {
throw new LogicException('Input can not be set while the process is running.');
}

$this->input = ProcessUtils::validateInput(__METHOD__, $input);

return $this;
}










public function inheritEnvironmentVariables($inheritEnv = true)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, env variables are always inherited.', __METHOD__), \E_USER_DEPRECATED);

if (!$inheritEnv) {
throw new InvalidArgumentException('Not inheriting environment variables is not supported.');
}

return $this;
}









public function checkTimeout()
{
if (self::STATUS_STARTED !== $this->status) {
return;
}

if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
$this->stop(0);

throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
}

if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
$this->stop(0);

throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
}
}




public static function isTtySupported(): bool
{
static $isTtySupported;

if (null === $isTtySupported) {
$isTtySupported = (bool) @proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
}

return $isTtySupported;
}






public static function isPtySupported()
{
static $result;

if (null !== $result) {
return $result;
}

if ('\\' === \DIRECTORY_SEPARATOR) {
return $result = false;
}

return $result = (bool) @proc_open('echo 1 >/dev/null', [['pty'], ['pty'], ['pty']], $pipes);
}




private function getDescriptors(): array
{
if ($this->input instanceof \Iterator) {
$this->input->rewind();
}
if ('\\' === \DIRECTORY_SEPARATOR) {
$this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
} else {
$this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
}

return $this->processPipes->getDescriptors();
}











protected function buildCallback(callable $callback = null)
{
if ($this->outputDisabled) {
return function ($type, $data) use ($callback): bool {
return null !== $callback && $callback($type, $data);
};
}

$out = self::OUT;

return function ($type, $data) use ($callback, $out): bool {
if ($out == $type) {
$this->addOutput($data);
} else {
$this->addErrorOutput($data);
}

return null !== $callback && $callback($type, $data);
};
}






protected function updateStatus($blocking)
{
if (self::STATUS_STARTED !== $this->status) {
return;
}

$this->processInformation = proc_get_status($this->process);
$running = $this->processInformation['running'];

$this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);

if ($this->fallbackStatus && $this->isSigchildEnabled()) {
$this->processInformation = $this->fallbackStatus + $this->processInformation;
}

if (!$running) {
$this->close();
}
}






protected function isSigchildEnabled()
{
if (null !== self::$sigchild) {
return self::$sigchild;
}

if (!\function_exists('phpinfo')) {
return self::$sigchild = false;
}

ob_start();
phpinfo(\INFO_GENERAL);

return self::$sigchild = str_contains(ob_get_clean(), '--enable-sigchild');
}









private function readPipesForOutput(string $caller, bool $blocking = false)
{
if ($this->outputDisabled) {
throw new LogicException('Output has been disabled.');
}

$this->requireProcessIsStarted($caller);

$this->updateStatus($blocking);
}






private function validateTimeout(?float $timeout): ?float
{
$timeout = (float) $timeout;

if (0.0 === $timeout) {
$timeout = null;
} elseif ($timeout < 0) {
throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
}

return $timeout;
}







private function readPipes(bool $blocking, bool $close)
{
$result = $this->processPipes->readAndWrite($blocking, $close);

$callback = $this->callback;
foreach ($result as $type => $data) {
if (3 !== $type) {
$callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
} elseif (!isset($this->fallbackStatus['signaled'])) {
$this->fallbackStatus['exitcode'] = (int) $data;
}
}
}






private function close(): int
{
$this->processPipes->close();
if (\is_resource($this->process)) {
proc_close($this->process);
}
$this->exitcode = $this->processInformation['exitcode'];
$this->status = self::STATUS_TERMINATED;

if (-1 === $this->exitcode) {
if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {

 $this->exitcode = 128 + $this->processInformation['termsig'];
} elseif ($this->isSigchildEnabled()) {
$this->processInformation['signaled'] = true;
$this->processInformation['termsig'] = -1;
}
}


 
 
 $this->callback = null;

return $this->exitcode;
}




private function resetProcessData()
{
$this->starttime = null;
$this->callback = null;
$this->exitcode = null;
$this->fallbackStatus = [];
$this->processInformation = null;
$this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
$this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+');
$this->process = null;
$this->latestSignal = null;
$this->status = self::STATUS_READY;
$this->incrementalOutputOffset = 0;
$this->incrementalErrorOutputOffset = 0;
}













private function doSignal(int $signal, bool $throwException): bool
{
if (null === $pid = $this->getPid()) {
if ($throwException) {
throw new LogicException('Can not send signal on a non running process.');
}

return false;
}

if ('\\' === \DIRECTORY_SEPARATOR) {
exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
if ($exitCode && $this->isRunning()) {
if ($throwException) {
throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
}

return false;
}
} else {
if (!$this->isSigchildEnabled()) {
$ok = @proc_terminate($this->process, $signal);
} elseif (\function_exists('posix_kill')) {
$ok = @posix_kill($pid, $signal);
} elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), [2 => ['pipe', 'w']], $pipes)) {
$ok = false === fgets($pipes[2]);
}
if (!$ok) {
if ($throwException) {
throw new RuntimeException(sprintf('Error while sending signal "%s".', $signal));
}

return false;
}
}

$this->latestSignal = $signal;
$this->fallbackStatus['signaled'] = true;
$this->fallbackStatus['exitcode'] = -1;
$this->fallbackStatus['termsig'] = $this->latestSignal;

return true;
}

private function prepareWindowsCommandLine(string $cmd, array &$env): string
{
$uid = uniqid('', true);
$varCount = 0;
$varCache = [];
$cmd = preg_replace_callback(
'/"(?:(
                [^"%!^]*+
                (?:
                    (?: !LF! | "(?:\^[%!^])?+" )
                    [^"%!^]*+
                )++
            ) | [^"]*+ )"/x',
function ($m) use (&$env, &$varCache, &$varCount, $uid) {
if (!isset($m[1])) {
return $m[0];
}
if (isset($varCache[$m[0]])) {
return $varCache[$m[0]];
}
if (str_contains($value = $m[1], "\0")) {
$value = str_replace("\0", '?', $value);
}
if (false === strpbrk($value, "\"%!\n")) {
return '"'.$value.'"';
}

$value = str_replace(['!LF!', '"^!"', '"^%"', '"^^"', '""'], ["\n", '!', '%', '^', '"'], $value);
$value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"';
$var = $uid.++$varCount;

$env[$var] = $value;

return $varCache[$m[0]] = '!'.$var.'!';
},
$cmd
);

$cmd = 'cmd /V:ON /E:ON /D /C ('.str_replace("\n", ' ', $cmd).')';
foreach ($this->processPipes->getFiles() as $offset => $filename) {
$cmd .= ' '.$offset.'>"'.$filename.'"';
}

return $cmd;
}






private function requireProcessIsStarted(string $functionName)
{
if (!$this->isStarted()) {
throw new LogicException(sprintf('Process must be started before calling "%s()".', $functionName));
}
}






private function requireProcessIsTerminated(string $functionName)
{
if (!$this->isTerminated()) {
throw new LogicException(sprintf('Process must be terminated before calling "%s()".', $functionName));
}
}




private function escapeArgument(?string $argument): string
{
if ('' === $argument || null === $argument) {
return '""';
}
if ('\\' !== \DIRECTORY_SEPARATOR) {
return "'".str_replace("'", "'\\''", $argument)."'";
}
if (str_contains($argument, "\0")) {
$argument = str_replace("\0", '?', $argument);
}
if (!preg_match('/[\/()%!^"<>&|\s]/', $argument)) {
return $argument;
}
$argument = preg_replace('/(\\\\+)$/', '$1$1', $argument);

return '"'.str_replace(['"', '^', '%', '!', "\n"], ['""', '"^^"', '"^%"', '"^!"', '!LF!'], $argument).'"';
}

private function replacePlaceholders(string $commandline, array $env)
{
return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {
throw new InvalidArgumentException(sprintf('Command line is missing a value for parameter "%s": ', $matches[1]).$commandline);
}

return $this->escapeArgument($env[$matches[1]]);
}, $commandline);
}

private function getDefaultEnv(): array
{
$env = getenv();
$env = array_intersect_key($env, $_SERVER) ?: $env;

return $_ENV + $env;
}
}
<?php










namespace Symfony\Component\Process;

use Symfony\Component\Process\Exception\InvalidArgumentException;








class ProcessUtils
{



private function __construct()
{
}











public static function validateInput($caller, $input)
{
if (null !== $input) {
if (\is_resource($input)) {
return $input;
}
if (\is_string($input)) {
return $input;
}
if (is_scalar($input)) {
return (string) $input;
}
if ($input instanceof Process) {
return $input->getIterator($input::ITER_SKIP_ERR);
}
if ($input instanceof \Iterator) {
return $input;
}
if ($input instanceof \Traversable) {
return new \IteratorIterator($input);
}

throw new InvalidArgumentException(sprintf('"%s" only accepts strings, Traversable objects or stream resources.', $caller));
}

return $input;
}
}
<?php










namespace Symfony\Component\Process;

use Symfony\Component\Process\Exception\LogicException;
use Symfony\Component\Process\Exception\RuntimeException;










class PhpProcess extends Process
{







public function __construct(string $script, string $cwd = null, array $env = null, int $timeout = 60, array $php = null)
{
if (null === $php) {
$executableFinder = new PhpExecutableFinder();
$php = $executableFinder->find(false);
$php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());
}
if ('phpdbg' === \PHP_SAPI) {
$file = tempnam(sys_get_temp_dir(), 'dbg');
file_put_contents($file, $script);
register_shutdown_function('unlink', $file);
$php[] = $file;
$script = null;
}

parent::__construct($php, $cwd, $env, $script, $timeout);
}




public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
{
throw new LogicException(sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
}






public function setPhpBinary($php)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2, use the $php argument of the constructor instead.', __METHOD__), \E_USER_DEPRECATED);

$this->setCommandLine($php);
}




public function start(callable $callback = null, array $env = [])
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
}

parent::start($callback, $env);
}
}
<?php










namespace Symfony\Component\Process\Exception;






interface ExceptionInterface extends \Throwable
{
}
<?php










namespace Symfony\Component\Process\Exception;






class RuntimeException extends \RuntimeException 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.');
}

$error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
$process->getCommandLine(),
$process->getExitCode(),
$process->getExitCodeText(),
$process->getWorkingDirectory()
);

if (!$process->isOutputDisabled()) {
$error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
$process->getOutput(),
$process->getErrorOutput()
);
}

parent::__construct($error);

$this->process = $process;
}

public function getProcess()
{
return $this->process;
}
}
<?php










namespace Symfony\Component\Process\Exception;






class LogicException extends \LogicException implements ExceptionInterface
{
}
<?php










namespace Symfony\Component\Process\Exception;






class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}
<?php










namespace Symfony\Component\Process\Exception;

use Symfony\Component\Process\Process;






class ProcessTimedOutException extends RuntimeException
{
public const TYPE_GENERAL = 1;
public const TYPE_IDLE = 2;

private $process;
private $timeoutType;

public function __construct(Process $process, int $timeoutType)
{
$this->process = $process;
$this->timeoutType = $timeoutType;

parent::__construct(sprintf(
'The process "%s" exceeded the timeout of %s seconds.',
$process->getCommandLine(),
$this->getExceededTimeout()
));
}

public function getProcess()
{
return $this->process;
}

public function isGeneralTimeout()
{
return self::TYPE_GENERAL === $this->timeoutType;
}

public function isIdleTimeout()
{
return self::TYPE_IDLE === $this->timeoutType;
}

public function getExceededTimeout()
{
switch ($this->timeoutType) {
case self::TYPE_GENERAL:
return $this->process->getTimeout();

case self::TYPE_IDLE:
return $this->process->getIdleTimeout();

default:
throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
}
}
}
<?php










namespace Symfony\Component\Process\Exception;

use Symfony\Component\Process\Process;






final class ProcessSignaledException extends RuntimeException
{
private $process;

public function __construct(Process $process)
{
$this->process = $process;

parent::__construct(sprintf('The process has been signaled with signal "%s".', $process->getTermSignal()));
}

public function getProcess(): Process
{
return $this->process;
}

public function getSignal(): int
{
return $this->getProcess()->getTermSignal();
}
}
<?php










use Symfony\Polyfill\Mbstring as p;

if (!defined('MB_CASE_UPPER')) {
define('MB_CASE_UPPER', 0);
define('MB_CASE_LOWER', 1);
define('MB_CASE_TITLE', 2);
}

if (!function_exists('mb_strlen')) {
function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
}
if (!function_exists('mb_chr')) {
function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
}

if (!function_exists('mb_str_split')) {
function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
}
<?php

return array(
'A' => 'a',
'B' => 'b',
'C' => 'c',
'D' => 'd',
'E' => 'e',
'F' => 'f',
'G' => 'g',
'H' => 'h',
'I' => 'i',
'J' => 'j',
'K' => 'k',
'L' => 'l',
'M' => 'm',
'N' => 'n',
'O' => 'o',
'P' => 'p',
'Q' => 'q',
'R' => 'r',
'S' => 's',
'T' => 't',
'U' => 'u',
'V' => 'v',
'W' => 'w',
'X' => 'x',
'Y' => 'y',
'Z' => 'z',
'À' => 'à',
'Á' => 'á',
'Â' => 'â',
'Ã' => 'ã',
'Ä' => 'ä',
'Å' => 'å',
'Æ' => 'æ',
'Ç' => 'ç',
'È' => 'è',
'É' => 'é',
'Ê' => 'ê',
'Ë' => 'ë',
'Ì' => 'ì',
'Í' => 'í',
'Î' => 'î',
'Ï' => 'ï',
'Ð' => 'ð',
'Ñ' => 'ñ',
'Ò' => 'ò',
'Ó' => 'ó',
'Ô' => 'ô',
'Õ' => 'õ',
'Ö' => 'ö',
'Ø' => 'ø',
'Ù' => 'ù',
'Ú' => 'ú',
'Û' => 'û',
'Ü' => 'ü',
'Ý' => 'ý',
'Þ' => 'þ',
'Ā' => 'ā',
'Ă' => 'ă',
'Ą' => 'ą',
'Ć' => 'ć',
'Ĉ' => 'ĉ',
'Ċ' => 'ċ',
'Č' => 'č',
'Ď' => 'ď',
'Đ' => 'đ',
'Ē' => 'ē',
'Ĕ' => 'ĕ',
'Ė' => 'ė',
'Ę' => 'ę',
'Ě' => 'ě',
'Ĝ' => 'ĝ',
'Ğ' => 'ğ',
'Ġ' => 'ġ',
'Ģ' => 'ģ',
'Ĥ' => 'ĥ',
'Ħ' => 'ħ',
'Ĩ' => 'ĩ',
'Ī' => 'ī',
'Ĭ' => 'ĭ',
'Į' => 'į',
'İ' => 'i',
'IJ' => 'ij',
'Ĵ' => 'ĵ',
'Ķ' => 'ķ',
'Ĺ' => 'ĺ',
'Ļ' => 'ļ',
'Ľ' => 'ľ',
'Ŀ' => 'ŀ',
'Ł' => 'ł',
'Ń' => 'ń',
'Ņ' => 'ņ',
'Ň' => 'ň',
'Ŋ' => 'ŋ',
'Ō' => 'ō',
'Ŏ' => 'ŏ',
'Ő' => 'ő',
'Œ' => 'œ',
'Ŕ' => 'ŕ',
'Ŗ' => 'ŗ',
'Ř' => 'ř',
'Ś' => 'ś',
'Ŝ' => 'ŝ',
'Ş' => 'ş',
'Š' => 'š',
'Ţ' => 'ţ',
'Ť' => 'ť',
'Ŧ' => 'ŧ',
'Ũ' => 'ũ',
'Ū' => 'ū',
'Ŭ' => 'ŭ',
'Ů' => 'ů',
'Ű' => 'ű',
'Ų' => 'ų',
'Ŵ' => 'ŵ',
'Ŷ' => 'ŷ',
'Ÿ' => 'ÿ',
'Ź' => 'ź',
'Ż' => 'ż',
'Ž' => 'ž',
'Ɓ' => 'ɓ',
'Ƃ' => 'ƃ',
'Ƅ' => 'ƅ',
'Ɔ' => 'ɔ',
'Ƈ' => 'ƈ',
'Ɖ' => 'ɖ',
'Ɗ' => 'ɗ',
'Ƌ' => 'ƌ',
'Ǝ' => 'ǝ',
'Ə' => 'ə',
'Ɛ' => 'ɛ',
'Ƒ' => 'ƒ',
'Ɠ' => 'ɠ',
'Ɣ' => 'ɣ',
'Ɩ' => 'ɩ',
'Ɨ' => 'ɨ',
'Ƙ' => 'ƙ',
'Ɯ' => 'ɯ',
'Ɲ' => 'ɲ',
'Ɵ' => 'ɵ',
'Ơ' => 'ơ',
'Ƣ' => 'ƣ',
'Ƥ' => 'ƥ',
'Ʀ' => 'ʀ',
'Ƨ' => 'ƨ',
'Ʃ' => 'ʃ',
'Ƭ' => 'ƭ',
'Ʈ' => 'ʈ',
'Ư' => 'ư',
'Ʊ' => 'ʊ',
'Ʋ' => 'ʋ',
'Ƴ' => 'ƴ',
'Ƶ' => 'ƶ',
'Ʒ' => 'ʒ',
'Ƹ' => 'ƹ',
'Ƽ' => 'ƽ',
'DŽ' => 'dž',
'Dž' => 'dž',
'LJ' => 'lj',
'Lj' => 'lj',
'NJ' => 'nj',
'Nj' => 'nj',
'Ǎ' => 'ǎ',
'Ǐ' => 'ǐ',
'Ǒ' => 'ǒ',
'Ǔ' => 'ǔ',
'Ǖ' => 'ǖ',
'Ǘ' => 'ǘ',
'Ǚ' => 'ǚ',
'Ǜ' => 'ǜ',
'Ǟ' => 'ǟ',
'Ǡ' => 'ǡ',
'Ǣ' => 'ǣ',
'Ǥ' => 'ǥ',
'Ǧ' => 'ǧ',
'Ǩ' => 'ǩ',
'Ǫ' => 'ǫ',
'Ǭ' => 'ǭ',
'Ǯ' => 'ǯ',
'DZ' => 'dz',
'Dz' => 'dz',
'Ǵ' => 'ǵ',
'Ƕ' => 'ƕ',
'Ƿ' => 'ƿ',
'Ǹ' => 'ǹ',
'Ǻ' => 'ǻ',
'Ǽ' => 'ǽ',
'Ǿ' => 'ǿ',
'Ȁ' => 'ȁ',
'Ȃ' => 'ȃ',
'Ȅ' => 'ȅ',
'Ȇ' => 'ȇ',
'Ȉ' => 'ȉ',
'Ȋ' => 'ȋ',
'Ȍ' => 'ȍ',
'Ȏ' => 'ȏ',
'Ȑ' => 'ȑ',
'Ȓ' => 'ȓ',
'Ȕ' => 'ȕ',
'Ȗ' => 'ȗ',
'Ș' => 'ș',
'Ț' => 'ț',
'Ȝ' => 'ȝ',
'Ȟ' => 'ȟ',
'Ƞ' => 'ƞ',
'Ȣ' => 'ȣ',
'Ȥ' => 'ȥ',
'Ȧ' => 'ȧ',
'Ȩ' => 'ȩ',
'Ȫ' => 'ȫ',
'Ȭ' => 'ȭ',
'Ȯ' => 'ȯ',
'Ȱ' => 'ȱ',
'Ȳ' => 'ȳ',
'Ⱥ' => 'ⱥ',
'Ȼ' => 'ȼ',
'Ƚ' => 'ƚ',
'Ⱦ' => 'ⱦ',
'Ɂ' => 'ɂ',
'Ƀ' => 'ƀ',
'Ʉ' => 'ʉ',
'Ʌ' => 'ʌ',
'Ɇ' => 'ɇ',
'Ɉ' => 'ɉ',
'Ɋ' => 'ɋ',
'Ɍ' => 'ɍ',
'Ɏ' => 'ɏ',
'Ͱ' => 'ͱ',
'Ͳ' => 'ͳ',
'Ͷ' => 'ͷ',
'Ϳ' => 'ϳ',
'Ά' => 'ά',
'Έ' => 'έ',
'Ή' => 'ή',
'Ί' => 'ί',
'Ό' => 'ό',
'Ύ' => 'ύ',
'Ώ' => 'ώ',
'Α' => 'α',
'Β' => 'β',
'Γ' => 'γ',
'Δ' => 'δ',
'Ε' => 'ε',
'Ζ' => 'ζ',
'Η' => 'η',
'Θ' => 'θ',
'Ι' => 'ι',
'Κ' => 'κ',
'Λ' => 'λ',
'Μ' => 'μ',
'Ν' => 'ν',
'Ξ' => 'ξ',
'Ο' => 'ο',
'Π' => 'π',
'Ρ' => 'ρ',
'Σ' => 'σ',
'Τ' => 'τ',
'Υ' => 'υ',
'Φ' => 'φ',
'Χ' => 'χ',
'Ψ' => 'ψ',
'Ω' => 'ω',
'Ϊ' => 'ϊ',
'Ϋ' => 'ϋ',
'Ϗ' => 'ϗ',
'Ϙ' => 'ϙ',
'Ϛ' => 'ϛ',
'Ϝ' => 'ϝ',
'Ϟ' => 'ϟ',
'Ϡ' => 'ϡ',
'Ϣ' => 'ϣ',
'Ϥ' => 'ϥ',
'Ϧ' => 'ϧ',
'Ϩ' => 'ϩ',
'Ϫ' => 'ϫ',
'Ϭ' => 'ϭ',
'Ϯ' => 'ϯ',
'ϴ' => 'θ',
'Ϸ' => 'ϸ',
'Ϲ' => 'ϲ',
'Ϻ' => 'ϻ',
'Ͻ' => 'ͻ',
'Ͼ' => 'ͼ',
'Ͽ' => 'ͽ',
'Ѐ' => 'ѐ',
'Ё' => 'ё',
'Ђ' => 'ђ',
'Ѓ' => 'ѓ',
'Є' => 'є',
'Ѕ' => 'ѕ',
'І' => 'і',
'Ї' => 'ї',
'Ј' => 'ј',
'Љ' => 'љ',
'Њ' => 'њ',
'Ћ' => 'ћ',
'Ќ' => 'ќ',
'Ѝ' => 'ѝ',
'Ў' => 'ў',
'Џ' => 'џ',
'А' => 'а',
'Б' => 'б',
'В' => 'в',
'Г' => 'г',
'Д' => 'д',
'Е' => 'е',
'Ж' => 'ж',
'З' => 'з',
'И' => 'и',
'Й' => 'й',
'К' => 'к',
'Л' => 'л',
'М' => 'м',
'Н' => 'н',
'О' => 'о',
'П' => 'п',
'Р' => 'р',
'С' => 'с',
'Т' => 'т',
'У' => 'у',
'Ф' => 'ф',
'Х' => 'х',
'Ц' => 'ц',
'Ч' => 'ч',
'Ш' => 'ш',
'Щ' => 'щ',
'Ъ' => 'ъ',
'Ы' => 'ы',
'Ь' => 'ь',
'Э' => 'э',
'Ю' => 'ю',
'Я' => 'я',
'Ѡ' => 'ѡ',
'Ѣ' => 'ѣ',
'Ѥ' => 'ѥ',
'Ѧ' => 'ѧ',
'Ѩ' => 'ѩ',
'Ѫ' => 'ѫ',
'Ѭ' => 'ѭ',
'Ѯ' => 'ѯ',
'Ѱ' => 'ѱ',
'Ѳ' => 'ѳ',
'Ѵ' => 'ѵ',
'Ѷ' => 'ѷ',
'Ѹ' => 'ѹ',
'Ѻ' => 'ѻ',
'Ѽ' => 'ѽ',
'Ѿ' => 'ѿ',
'Ҁ' => 'ҁ',
'Ҋ' => 'ҋ',
'Ҍ' => 'ҍ',
'Ҏ' => 'ҏ',
'Ґ' => 'ґ',
'Ғ' => 'ғ',
'Ҕ' => 'ҕ',
'Җ' => 'җ',
'Ҙ' => 'ҙ',
'Қ' => 'қ',
'Ҝ' => 'ҝ',
'Ҟ' => 'ҟ',
'Ҡ' => 'ҡ',
'Ң' => 'ң',
'Ҥ' => 'ҥ',
'Ҧ' => 'ҧ',
'Ҩ' => 'ҩ',
'Ҫ' => 'ҫ',
'Ҭ' => 'ҭ',
'Ү' => 'ү',
'Ұ' => 'ұ',
'Ҳ' => 'ҳ',
'Ҵ' => 'ҵ',
'Ҷ' => 'ҷ',
'Ҹ' => 'ҹ',
'Һ' => 'һ',
'Ҽ' => 'ҽ',
'Ҿ' => 'ҿ',
'Ӏ' => 'ӏ',
'Ӂ' => 'ӂ',
'Ӄ' => 'ӄ',
'Ӆ' => 'ӆ',
'Ӈ' => 'ӈ',
'Ӊ' => 'ӊ',
'Ӌ' => 'ӌ',
'Ӎ' => 'ӎ',
'Ӑ' => 'ӑ',
'Ӓ' => 'ӓ',
'Ӕ' => 'ӕ',
'Ӗ' => 'ӗ',
'Ә' => 'ә',
'Ӛ' => 'ӛ',
'Ӝ' => 'ӝ',
'Ӟ' => 'ӟ',
'Ӡ' => 'ӡ',
'Ӣ' => 'ӣ',
'Ӥ' => 'ӥ',
'Ӧ' => 'ӧ',
'Ө' => 'ө',
'Ӫ' => 'ӫ',
'Ӭ' => 'ӭ',
'Ӯ' => 'ӯ',
'Ӱ' => 'ӱ',
'Ӳ' => 'ӳ',
'Ӵ' => 'ӵ',
'Ӷ' => 'ӷ',
'Ӹ' => 'ӹ',
'Ӻ' => 'ӻ',
'Ӽ' => 'ӽ',
'Ӿ' => 'ӿ',
'Ԁ' => 'ԁ',
'Ԃ' => 'ԃ',
'Ԅ' => 'ԅ',
'Ԇ' => 'ԇ',
'Ԉ' => 'ԉ',
'Ԋ' => 'ԋ',
'Ԍ' => 'ԍ',
'Ԏ' => 'ԏ',
'Ԑ' => 'ԑ',
'Ԓ' => 'ԓ',
'Ԕ' => 'ԕ',
'Ԗ' => 'ԗ',
'Ԙ' => 'ԙ',
'Ԛ' => 'ԛ',
'Ԝ' => 'ԝ',
'Ԟ' => 'ԟ',
'Ԡ' => 'ԡ',
'Ԣ' => 'ԣ',
'Ԥ' => 'ԥ',
'Ԧ' => 'ԧ',
'Ԩ' => 'ԩ',
'Ԫ' => 'ԫ',
'Ԭ' => 'ԭ',
'Ԯ' => 'ԯ',
'Ա' => 'ա',
'Բ' => 'բ',
'Գ' => 'գ',
'Դ' => 'դ',
'Ե' => 'ե',
'Զ' => 'զ',
'Է' => 'է',
'Ը' => 'ը',
'Թ' => 'թ',
'Ժ' => 'ժ',
'Ի' => 'ի',
'Լ' => 'լ',
'Խ' => 'խ',
'Ծ' => 'ծ',
'Կ' => 'կ',
'Հ' => 'հ',
'Ձ' => 'ձ',
'Ղ' => 'ղ',
'Ճ' => 'ճ',
'Մ' => 'մ',
'Յ' => 'յ',
'Ն' => 'ն',
'Շ' => 'շ',
'Ո' => 'ո',
'Չ' => 'չ',
'Պ' => 'պ',
'Ջ' => 'ջ',
'Ռ' => 'ռ',
'Ս' => 'ս',
'Վ' => 'վ',
'Տ' => 'տ',
'Ր' => 'ր',
'Ց' => 'ց',
'Ւ' => 'ւ',
'Փ' => 'փ',
'Ք' => 'ք',
'Օ' => 'օ',
'Ֆ' => 'ֆ',
'Ⴀ' => 'ⴀ',
'Ⴁ' => 'ⴁ',
'Ⴂ' => 'ⴂ',
'Ⴃ' => 'ⴃ',
'Ⴄ' => 'ⴄ',
'Ⴅ' => 'ⴅ',
'Ⴆ' => 'ⴆ',
'Ⴇ' => 'ⴇ',
'Ⴈ' => 'ⴈ',
'Ⴉ' => 'ⴉ',
'Ⴊ' => 'ⴊ',
'Ⴋ' => 'ⴋ',
'Ⴌ' => 'ⴌ',
'Ⴍ' => 'ⴍ',
'Ⴎ' => 'ⴎ',
'Ⴏ' => 'ⴏ',
'Ⴐ' => 'ⴐ',
'Ⴑ' => 'ⴑ',
'Ⴒ' => 'ⴒ',
'Ⴓ' => 'ⴓ',
'Ⴔ' => 'ⴔ',
'Ⴕ' => 'ⴕ',
'Ⴖ' => 'ⴖ',
'Ⴗ' => 'ⴗ',
'Ⴘ' => 'ⴘ',
'Ⴙ' => 'ⴙ',
'Ⴚ' => 'ⴚ',
'Ⴛ' => 'ⴛ',
'Ⴜ' => 'ⴜ',
'Ⴝ' => 'ⴝ',
'Ⴞ' => 'ⴞ',
'Ⴟ' => 'ⴟ',
'Ⴠ' => 'ⴠ',
'Ⴡ' => 'ⴡ',
'Ⴢ' => 'ⴢ',
'Ⴣ' => 'ⴣ',
'Ⴤ' => 'ⴤ',
'Ⴥ' => 'ⴥ',
'Ⴧ' => 'ⴧ',
'Ⴭ' => 'ⴭ',
'Ḁ' => 'ḁ',
'Ḃ' => 'ḃ',
'Ḅ' => 'ḅ',
'Ḇ' => 'ḇ',
'Ḉ' => 'ḉ',
'Ḋ' => 'ḋ',
'Ḍ' => 'ḍ',
'Ḏ' => 'ḏ',
'Ḑ' => 'ḑ',
'Ḓ' => 'ḓ',
'Ḕ' => 'ḕ',
'Ḗ' => 'ḗ',
'Ḙ' => 'ḙ',
'Ḛ' => 'ḛ',
'Ḝ' => 'ḝ',
'Ḟ' => 'ḟ',
'Ḡ' => 'ḡ',
'Ḣ' => 'ḣ',
'Ḥ' => 'ḥ',
'Ḧ' => 'ḧ',
'Ḩ' => 'ḩ',
'Ḫ' => 'ḫ',
'Ḭ' => 'ḭ',
'Ḯ' => 'ḯ',
'Ḱ' => 'ḱ',
'Ḳ' => 'ḳ',
'Ḵ' => 'ḵ',
'Ḷ' => 'ḷ',
'Ḹ' => 'ḹ',
'Ḻ' => 'ḻ',
'Ḽ' => 'ḽ',
'Ḿ' => 'ḿ',
'Ṁ' => 'ṁ',
'Ṃ' => 'ṃ',
'Ṅ' => 'ṅ',
'Ṇ' => 'ṇ',
'Ṉ' => 'ṉ',
'Ṋ' => 'ṋ',
'Ṍ' => 'ṍ',
'Ṏ' => 'ṏ',
'Ṑ' => 'ṑ',
'Ṓ' => 'ṓ',
'Ṕ' => 'ṕ',
'Ṗ' => 'ṗ',
'Ṙ' => 'ṙ',
'Ṛ' => 'ṛ',
'Ṝ' => 'ṝ',
'Ṟ' => 'ṟ',
'Ṡ' => 'ṡ',
'Ṣ' => 'ṣ',
'Ṥ' => 'ṥ',
'Ṧ' => 'ṧ',
'Ṩ' => 'ṩ',
'Ṫ' => 'ṫ',
'Ṭ' => 'ṭ',
'Ṯ' => 'ṯ',
'Ṱ' => 'ṱ',
'Ṳ' => 'ṳ',
'Ṵ' => 'ṵ',
'Ṷ' => 'ṷ',
'Ṹ' => 'ṹ',
'Ṻ' => 'ṻ',
'Ṽ' => 'ṽ',
'Ṿ' => 'ṿ',
'Ẁ' => 'ẁ',
'Ẃ' => 'ẃ',
'Ẅ' => 'ẅ',
'Ẇ' => 'ẇ',
'Ẉ' => 'ẉ',
'Ẋ' => 'ẋ',
'Ẍ' => 'ẍ',
'Ẏ' => 'ẏ',
'Ẑ' => 'ẑ',
'Ẓ' => 'ẓ',
'Ẕ' => 'ẕ',
'ẞ' => 'ß',
'Ạ' => 'ạ',
'Ả' => 'ả',
'Ấ' => 'ấ',
'Ầ' => 'ầ',
'Ẩ' => 'ẩ',
'Ẫ' => 'ẫ',
'Ậ' => 'ậ',
'Ắ' => 'ắ',
'Ằ' => 'ằ',
'Ẳ' => 'ẳ',
'Ẵ' => 'ẵ',
'Ặ' => 'ặ',
'Ẹ' => 'ẹ',
'Ẻ' => 'ẻ',
'Ẽ' => 'ẽ',
'Ế' => 'ế',
'Ề' => 'ề',
'Ể' => 'ể',
'Ễ' => 'ễ',
'Ệ' => 'ệ',
'Ỉ' => 'ỉ',
'Ị' => 'ị',
'Ọ' => 'ọ',
'Ỏ' => 'ỏ',
'Ố' => 'ố',
'Ồ' => 'ồ',
'Ổ' => 'ổ',
'Ỗ' => 'ỗ',
'Ộ' => 'ộ',
'Ớ' => 'ớ',
'Ờ' => 'ờ',
'Ở' => 'ở',
'Ỡ' => 'ỡ',
'Ợ' => 'ợ',
'Ụ' => 'ụ',
'Ủ' => 'ủ',
'Ứ' => 'ứ',
'Ừ' => 'ừ',
'Ử' => 'ử',
'Ữ' => 'ữ',
'Ự' => 'ự',
'Ỳ' => 'ỳ',
'Ỵ' => 'ỵ',
'Ỷ' => 'ỷ',
'Ỹ' => 'ỹ',
'Ỻ' => 'ỻ',
'Ỽ' => 'ỽ',
'Ỿ' => 'ỿ',
'Ἀ' => 'ἀ',
'Ἁ' => 'ἁ',
'Ἂ' => 'ἂ',
'Ἃ' => 'ἃ',
'Ἄ' => 'ἄ',
'Ἅ' => 'ἅ',
'Ἆ' => 'ἆ',
'Ἇ' => 'ἇ',
'Ἐ' => 'ἐ',
'Ἑ' => 'ἑ',
'Ἒ' => 'ἒ',
'Ἓ' => 'ἓ',
'Ἔ' => 'ἔ',
'Ἕ' => 'ἕ',
'Ἠ' => 'ἠ',
'Ἡ' => 'ἡ',
'Ἢ' => 'ἢ',
'Ἣ' => 'ἣ',
'Ἤ' => 'ἤ',
'Ἥ' => 'ἥ',
'Ἦ' => 'ἦ',
'Ἧ' => 'ἧ',
'Ἰ' => 'ἰ',
'Ἱ' => 'ἱ',
'Ἲ' => 'ἲ',
'Ἳ' => 'ἳ',
'Ἴ' => 'ἴ',
'Ἵ' => 'ἵ',
'Ἶ' => 'ἶ',
'Ἷ' => 'ἷ',
'Ὀ' => 'ὀ',
'Ὁ' => 'ὁ',
'Ὂ' => 'ὂ',
'Ὃ' => 'ὃ',
'Ὄ' => 'ὄ',
'Ὅ' => 'ὅ',
'Ὑ' => 'ὑ',
'Ὓ' => 'ὓ',
'Ὕ' => 'ὕ',
'Ὗ' => 'ὗ',
'Ὠ' => 'ὠ',
'Ὡ' => 'ὡ',
'Ὢ' => 'ὢ',
'Ὣ' => 'ὣ',
'Ὤ' => 'ὤ',
'Ὥ' => 'ὥ',
'Ὦ' => 'ὦ',
'Ὧ' => 'ὧ',
'ᾈ' => 'ᾀ',
'ᾉ' => 'ᾁ',
'ᾊ' => 'ᾂ',
'ᾋ' => 'ᾃ',
'ᾌ' => 'ᾄ',
'ᾍ' => 'ᾅ',
'ᾎ' => 'ᾆ',
'ᾏ' => 'ᾇ',
'ᾘ' => 'ᾐ',
'ᾙ' => 'ᾑ',
'ᾚ' => 'ᾒ',
'ᾛ' => 'ᾓ',
'ᾜ' => 'ᾔ',
'ᾝ' => 'ᾕ',
'ᾞ' => 'ᾖ',
'ᾟ' => 'ᾗ',
'ᾨ' => 'ᾠ',
'ᾩ' => 'ᾡ',
'ᾪ' => 'ᾢ',
'ᾫ' => 'ᾣ',
'ᾬ' => 'ᾤ',
'ᾭ' => 'ᾥ',
'ᾮ' => 'ᾦ',
'ᾯ' => 'ᾧ',
'Ᾰ' => 'ᾰ',
'Ᾱ' => 'ᾱ',
'Ὰ' => 'ὰ',
'Ά' => 'ά',
'ᾼ' => 'ᾳ',
'Ὲ' => 'ὲ',
'Έ' => 'έ',
'Ὴ' => 'ὴ',
'Ή' => 'ή',
'ῌ' => 'ῃ',
'Ῐ' => 'ῐ',
'Ῑ' => 'ῑ',
'Ὶ' => 'ὶ',
'Ί' => 'ί',
'Ῠ' => 'ῠ',
'Ῡ' => 'ῡ',
'Ὺ' => 'ὺ',
'Ύ' => 'ύ',
'Ῥ' => 'ῥ',
'Ὸ' => 'ὸ',
'Ό' => 'ό',
'Ὼ' => 'ὼ',
'Ώ' => 'ώ',
'ῼ' => 'ῳ',
'Ω' => 'ω',
'K' => 'k',
'Å' => 'å',
'Ⅎ' => 'ⅎ',
'Ⅰ' => 'ⅰ',
'Ⅱ' => 'ⅱ',
'Ⅲ' => 'ⅲ',
'Ⅳ' => 'ⅳ',
'Ⅴ' => 'ⅴ',
'Ⅵ' => 'ⅵ',
'Ⅶ' => 'ⅶ',
'Ⅷ' => 'ⅷ',
'Ⅸ' => 'ⅸ',
'Ⅹ' => 'ⅹ',
'Ⅺ' => 'ⅺ',
'Ⅻ' => 'ⅻ',
'Ⅼ' => 'ⅼ',
'Ⅽ' => 'ⅽ',
'Ⅾ' => 'ⅾ',
'Ⅿ' => 'ⅿ',
'Ↄ' => 'ↄ',
'Ⓐ' => 'ⓐ',
'Ⓑ' => 'ⓑ',
'Ⓒ' => 'ⓒ',
'Ⓓ' => 'ⓓ',
'Ⓔ' => 'ⓔ',
'Ⓕ' => 'ⓕ',
'Ⓖ' => 'ⓖ',
'Ⓗ' => 'ⓗ',
'Ⓘ' => 'ⓘ',
'Ⓙ' => 'ⓙ',
'Ⓚ' => 'ⓚ',
'Ⓛ' => 'ⓛ',
'Ⓜ' => 'ⓜ',
'Ⓝ' => 'ⓝ',
'Ⓞ' => 'ⓞ',
'Ⓟ' => 'ⓟ',
'Ⓠ' => 'ⓠ',
'Ⓡ' => 'ⓡ',
'Ⓢ' => 'ⓢ',
'Ⓣ' => 'ⓣ',
'Ⓤ' => 'ⓤ',
'Ⓥ' => 'ⓥ',
'Ⓦ' => 'ⓦ',
'Ⓧ' => 'ⓧ',
'Ⓨ' => 'ⓨ',
'Ⓩ' => 'ⓩ',
'Ⰰ' => 'ⰰ',
'Ⰱ' => 'ⰱ',
'Ⰲ' => 'ⰲ',
'Ⰳ' => 'ⰳ',
'Ⰴ' => 'ⰴ',
'Ⰵ' => 'ⰵ',
'Ⰶ' => 'ⰶ',
'Ⰷ' => 'ⰷ',
'Ⰸ' => 'ⰸ',
'Ⰹ' => 'ⰹ',
'Ⰺ' => 'ⰺ',
'Ⰻ' => 'ⰻ',
'Ⰼ' => 'ⰼ',
'Ⰽ' => 'ⰽ',
'Ⰾ' => 'ⰾ',
'Ⰿ' => 'ⰿ',
'Ⱀ' => 'ⱀ',
'Ⱁ' => 'ⱁ',
'Ⱂ' => 'ⱂ',
'Ⱃ' => 'ⱃ',
'Ⱄ' => 'ⱄ',
'Ⱅ' => 'ⱅ',
'Ⱆ' => 'ⱆ',
'Ⱇ' => 'ⱇ',
'Ⱈ' => 'ⱈ',
'Ⱉ' => 'ⱉ',
'Ⱊ' => 'ⱊ',
'Ⱋ' => 'ⱋ',
'Ⱌ' => 'ⱌ',
'Ⱍ' => 'ⱍ',
'Ⱎ' => 'ⱎ',
'Ⱏ' => 'ⱏ',
'Ⱐ' => 'ⱐ',
'Ⱑ' => 'ⱑ',
'Ⱒ' => 'ⱒ',
'Ⱓ' => 'ⱓ',
'Ⱔ' => 'ⱔ',
'Ⱕ' => 'ⱕ',
'Ⱖ' => 'ⱖ',
'Ⱗ' => 'ⱗ',
'Ⱘ' => 'ⱘ',
'Ⱙ' => 'ⱙ',
'Ⱚ' => 'ⱚ',
'Ⱛ' => 'ⱛ',
'Ⱜ' => 'ⱜ',
'Ⱝ' => 'ⱝ',
'Ⱞ' => 'ⱞ',
'Ⱡ' => 'ⱡ',
'Ɫ' => 'ɫ',
'Ᵽ' => 'ᵽ',
'Ɽ' => 'ɽ',
'Ⱨ' => 'ⱨ',
'Ⱪ' => 'ⱪ',
'Ⱬ' => 'ⱬ',
'Ɑ' => 'ɑ',
'Ɱ' => 'ɱ',
'Ɐ' => 'ɐ',
'Ɒ' => 'ɒ',
'Ⱳ' => 'ⱳ',
'Ⱶ' => 'ⱶ',
'Ȿ' => 'ȿ',
'Ɀ' => 'ɀ',
'Ⲁ' => 'ⲁ',
'Ⲃ' => 'ⲃ',
'Ⲅ' => 'ⲅ',
'Ⲇ' => 'ⲇ',
'Ⲉ' => 'ⲉ',
'Ⲋ' => 'ⲋ',
'Ⲍ' => 'ⲍ',
'Ⲏ' => 'ⲏ',
'Ⲑ' => 'ⲑ',
'Ⲓ' => 'ⲓ',
'Ⲕ' => 'ⲕ',
'Ⲗ' => 'ⲗ',
'Ⲙ' => 'ⲙ',
'Ⲛ' => 'ⲛ',
'Ⲝ' => 'ⲝ',
'Ⲟ' => 'ⲟ',
'Ⲡ' => 'ⲡ',
'Ⲣ' => 'ⲣ',
'Ⲥ' => 'ⲥ',
'Ⲧ' => 'ⲧ',
'Ⲩ' => 'ⲩ',
'Ⲫ' => 'ⲫ',
'Ⲭ' => 'ⲭ',
'Ⲯ' => 'ⲯ',
'Ⲱ' => 'ⲱ',
'Ⲳ' => 'ⲳ',
'Ⲵ' => 'ⲵ',
'Ⲷ' => 'ⲷ',
'Ⲹ' => 'ⲹ',
'Ⲻ' => 'ⲻ',
'Ⲽ' => 'ⲽ',
'Ⲿ' => 'ⲿ',
'Ⳁ' => 'ⳁ',
'Ⳃ' => 'ⳃ',
'Ⳅ' => 'ⳅ',
'Ⳇ' => 'ⳇ',
'Ⳉ' => 'ⳉ',
'Ⳋ' => 'ⳋ',
'Ⳍ' => 'ⳍ',
'Ⳏ' => 'ⳏ',
'Ⳑ' => 'ⳑ',
'Ⳓ' => 'ⳓ',
'Ⳕ' => 'ⳕ',
'Ⳗ' => 'ⳗ',
'Ⳙ' => 'ⳙ',
'Ⳛ' => 'ⳛ',
'Ⳝ' => 'ⳝ',
'Ⳟ' => 'ⳟ',
'Ⳡ' => 'ⳡ',
'Ⳣ' => 'ⳣ',
'Ⳬ' => 'ⳬ',
'Ⳮ' => 'ⳮ',
'Ⳳ' => 'ⳳ',
'Ꙁ' => 'ꙁ',
'Ꙃ' => 'ꙃ',
'Ꙅ' => 'ꙅ',
'Ꙇ' => 'ꙇ',
'Ꙉ' => 'ꙉ',
'Ꙋ' => 'ꙋ',
'Ꙍ' => 'ꙍ',
'Ꙏ' => 'ꙏ',
'Ꙑ' => 'ꙑ',
'Ꙓ' => 'ꙓ',
'Ꙕ' => 'ꙕ',
'Ꙗ' => 'ꙗ',
'Ꙙ' => 'ꙙ',
'Ꙛ' => 'ꙛ',
'Ꙝ' => 'ꙝ',
'Ꙟ' => 'ꙟ',
'Ꙡ' => 'ꙡ',
'Ꙣ' => 'ꙣ',
'Ꙥ' => 'ꙥ',
'Ꙧ' => 'ꙧ',
'Ꙩ' => 'ꙩ',
'Ꙫ' => 'ꙫ',
'Ꙭ' => 'ꙭ',
'Ꚁ' => 'ꚁ',
'Ꚃ' => 'ꚃ',
'Ꚅ' => 'ꚅ',
'Ꚇ' => 'ꚇ',
'Ꚉ' => 'ꚉ',
'Ꚋ' => 'ꚋ',
'Ꚍ' => 'ꚍ',
'Ꚏ' => 'ꚏ',
'Ꚑ' => 'ꚑ',
'Ꚓ' => 'ꚓ',
'Ꚕ' => 'ꚕ',
'Ꚗ' => 'ꚗ',
'Ꚙ' => 'ꚙ',
'Ꚛ' => 'ꚛ',
'Ꜣ' => 'ꜣ',
'Ꜥ' => 'ꜥ',
'Ꜧ' => 'ꜧ',
'Ꜩ' => 'ꜩ',
'Ꜫ' => 'ꜫ',
'Ꜭ' => 'ꜭ',
'Ꜯ' => 'ꜯ',
'Ꜳ' => 'ꜳ',
'Ꜵ' => 'ꜵ',
'Ꜷ' => 'ꜷ',
'Ꜹ' => 'ꜹ',
'Ꜻ' => 'ꜻ',
'Ꜽ' => 'ꜽ',
'Ꜿ' => 'ꜿ',
'Ꝁ' => 'ꝁ',
'Ꝃ' => 'ꝃ',
'Ꝅ' => 'ꝅ',
'Ꝇ' => 'ꝇ',
'Ꝉ' => 'ꝉ',
'Ꝋ' => 'ꝋ',
'Ꝍ' => 'ꝍ',
'Ꝏ' => 'ꝏ',
'Ꝑ' => 'ꝑ',
'Ꝓ' => 'ꝓ',
'Ꝕ' => 'ꝕ',
'Ꝗ' => 'ꝗ',
'Ꝙ' => 'ꝙ',
'Ꝛ' => 'ꝛ',
'Ꝝ' => 'ꝝ',
'Ꝟ' => 'ꝟ',
'Ꝡ' => 'ꝡ',
'Ꝣ' => 'ꝣ',
'Ꝥ' => 'ꝥ',
'Ꝧ' => 'ꝧ',
'Ꝩ' => 'ꝩ',
'Ꝫ' => 'ꝫ',
'Ꝭ' => 'ꝭ',
'Ꝯ' => 'ꝯ',
'Ꝺ' => 'ꝺ',
'Ꝼ' => 'ꝼ',
'Ᵹ' => 'ᵹ',
'Ꝿ' => 'ꝿ',
'Ꞁ' => 'ꞁ',
'Ꞃ' => 'ꞃ',
'Ꞅ' => 'ꞅ',
'Ꞇ' => 'ꞇ',
'Ꞌ' => 'ꞌ',
'Ɥ' => 'ɥ',
'Ꞑ' => 'ꞑ',
'Ꞓ' => 'ꞓ',
'Ꞗ' => 'ꞗ',
'Ꞙ' => 'ꞙ',
'Ꞛ' => 'ꞛ',
'Ꞝ' => 'ꞝ',
'Ꞟ' => 'ꞟ',
'Ꞡ' => 'ꞡ',
'Ꞣ' => 'ꞣ',
'Ꞥ' => 'ꞥ',
'Ꞧ' => 'ꞧ',
'Ꞩ' => 'ꞩ',
'Ɦ' => 'ɦ',
'Ɜ' => 'ɜ',
'Ɡ' => 'ɡ',
'Ɬ' => 'ɬ',
'Ʞ' => 'ʞ',
'Ʇ' => 'ʇ',
'A' => 'a',
'B' => 'b',
'C' => 'c',
'D' => 'd',
'E' => 'e',
'F' => 'f',
'G' => 'g',
'H' => 'h',
'I' => 'i',
'J' => 'j',
'K' => 'k',
'L' => 'l',
'M' => 'm',
'N' => 'n',
'O' => 'o',
'P' => 'p',
'Q' => 'q',
'R' => 'r',
'S' => 's',
'T' => 't',
'U' => 'u',
'V' => 'v',
'W' => 'w',
'X' => 'x',
'Y' => 'y',
'Z' => 'z',
'𐐀' => '𐐨',
'𐐁' => '𐐩',
'𐐂' => '𐐪',
'𐐃' => '𐐫',
'𐐄' => '𐐬',
'𐐅' => '𐐭',
'𐐆' => '𐐮',
'𐐇' => '𐐯',
'𐐈' => '𐐰',
'𐐉' => '𐐱',
'𐐊' => '𐐲',
'𐐋' => '𐐳',
'𐐌' => '𐐴',
'𐐍' => '𐐵',
'𐐎' => '𐐶',
'𐐏' => '𐐷',
'𐐐' => '𐐸',
'𐐑' => '𐐹',
'𐐒' => '𐐺',
'𐐓' => '𐐻',
'𐐔' => '𐐼',
'𐐕' => '𐐽',
'𐐖' => '𐐾',
'𐐗' => '𐐿',
'𐐘' => '𐑀',
'𐐙' => '𐑁',
'𐐚' => '𐑂',
'𐐛' => '𐑃',
'𐐜' => '𐑄',
'𐐝' => '𐑅',
'𐐞' => '𐑆',
'𐐟' => '𐑇',
'𐐠' => '𐑈',
'𐐡' => '𐑉',
'𐐢' => '𐑊',
'𐐣' => '𐑋',
'𐐤' => '𐑌',
'𐐥' => '𐑍',
'𐐦' => '𐑎',
'𐐧' => '𐑏',
'𑢠' => '𑣀',
'𑢡' => '𑣁',
'𑢢' => '𑣂',
'𑢣' => '𑣃',
'𑢤' => '𑣄',
'𑢥' => '𑣅',
'𑢦' => '𑣆',
'𑢧' => '𑣇',
'𑢨' => '𑣈',
'𑢩' => '𑣉',
'𑢪' => '𑣊',
'𑢫' => '𑣋',
'𑢬' => '𑣌',
'𑢭' => '𑣍',
'𑢮' => '𑣎',
'𑢯' => '𑣏',
'𑢰' => '𑣐',
'𑢱' => '𑣑',
'𑢲' => '𑣒',
'𑢳' => '𑣓',
'𑢴' => '𑣔',
'𑢵' => '𑣕',
'𑢶' => '𑣖',
'𑢷' => '𑣗',
'𑢸' => '𑣘',
'𑢹' => '𑣙',
'𑢺' => '𑣚',
'𑢻' => '𑣛',
'𑢼' => '𑣜',
'𑢽' => '𑣝',
'𑢾' => '𑣞',
'𑢿' => '𑣟',
);
<?php

return array(
'a' => 'A',
'b' => 'B',
'c' => 'C',
'd' => 'D',
'e' => 'E',
'f' => 'F',
'g' => 'G',
'h' => 'H',
'i' => 'I',
'j' => 'J',
'k' => 'K',
'l' => 'L',
'm' => 'M',
'n' => 'N',
'o' => 'O',
'p' => 'P',
'q' => 'Q',
'r' => 'R',
's' => 'S',
't' => 'T',
'u' => 'U',
'v' => 'V',
'w' => 'W',
'x' => 'X',
'y' => 'Y',
'z' => 'Z',
'µ' => 'Μ',
'à' => 'À',
'á' => 'Á',
'â' => 'Â',
'ã' => 'Ã',
'ä' => 'Ä',
'å' => 'Å',
'æ' => 'Æ',
'ç' => 'Ç',
'è' => 'È',
'é' => 'É',
'ê' => 'Ê',
'ë' => 'Ë',
'ì' => 'Ì',
'í' => 'Í',
'î' => 'Î',
'ï' => 'Ï',
'ð' => 'Ð',
'ñ' => 'Ñ',
'ò' => 'Ò',
'ó' => 'Ó',
'ô' => 'Ô',
'õ' => 'Õ',
'ö' => 'Ö',
'ø' => 'Ø',
'ù' => 'Ù',
'ú' => 'Ú',
'û' => 'Û',
'ü' => 'Ü',
'ý' => 'Ý',
'þ' => 'Þ',
'ÿ' => 'Ÿ',
'ā' => 'Ā',
'ă' => 'Ă',
'ą' => 'Ą',
'ć' => 'Ć',
'ĉ' => 'Ĉ',
'ċ' => 'Ċ',
'č' => 'Č',
'ď' => 'Ď',
'đ' => 'Đ',
'ē' => 'Ē',
'ĕ' => 'Ĕ',
'ė' => 'Ė',
'ę' => 'Ę',
'ě' => 'Ě',
'ĝ' => 'Ĝ',
'ğ' => 'Ğ',
'ġ' => 'Ġ',
'ģ' => 'Ģ',
'ĥ' => 'Ĥ',
'ħ' => 'Ħ',
'ĩ' => 'Ĩ',
'ī' => 'Ī',
'ĭ' => 'Ĭ',
'į' => 'Į',
'ı' => 'I',
'ij' => 'IJ',
'ĵ' => 'Ĵ',
'ķ' => 'Ķ',
'ĺ' => 'Ĺ',
'ļ' => 'Ļ',
'ľ' => 'Ľ',
'ŀ' => 'Ŀ',
'ł' => 'Ł',
'ń' => 'Ń',
'ņ' => 'Ņ',
'ň' => 'Ň',
'ŋ' => 'Ŋ',
'ō' => 'Ō',
'ŏ' => 'Ŏ',
'ő' => 'Ő',
'œ' => 'Œ',
'ŕ' => 'Ŕ',
'ŗ' => 'Ŗ',
'ř' => 'Ř',
'ś' => 'Ś',
'ŝ' => 'Ŝ',
'ş' => 'Ş',
'š' => 'Š',
'ţ' => 'Ţ',
'ť' => 'Ť',
'ŧ' => 'Ŧ',
'ũ' => 'Ũ',
'ū' => 'Ū',
'ŭ' => 'Ŭ',
'ů' => 'Ů',
'ű' => 'Ű',
'ų' => 'Ų',
'ŵ' => 'Ŵ',
'ŷ' => 'Ŷ',
'ź' => 'Ź',
'ż' => 'Ż',
'ž' => 'Ž',
'ſ' => 'S',
'ƀ' => 'Ƀ',
'ƃ' => 'Ƃ',
'ƅ' => 'Ƅ',
'ƈ' => 'Ƈ',
'ƌ' => 'Ƌ',
'ƒ' => 'Ƒ',
'ƕ' => 'Ƕ',
'ƙ' => 'Ƙ',
'ƚ' => 'Ƚ',
'ƞ' => 'Ƞ',
'ơ' => 'Ơ',
'ƣ' => 'Ƣ',
'ƥ' => 'Ƥ',
'ƨ' => 'Ƨ',
'ƭ' => 'Ƭ',
'ư' => 'Ư',
'ƴ' => 'Ƴ',
'ƶ' => 'Ƶ',
'ƹ' => 'Ƹ',
'ƽ' => 'Ƽ',
'ƿ' => 'Ƿ',
'Dž' => 'DŽ',
'dž' => 'DŽ',
'Lj' => 'LJ',
'lj' => 'LJ',
'Nj' => 'NJ',
'nj' => 'NJ',
'ǎ' => 'Ǎ',
'ǐ' => 'Ǐ',
'ǒ' => 'Ǒ',
'ǔ' => 'Ǔ',
'ǖ' => 'Ǖ',
'ǘ' => 'Ǘ',
'ǚ' => 'Ǚ',
'ǜ' => 'Ǜ',
'ǝ' => 'Ǝ',
'ǟ' => 'Ǟ',
'ǡ' => 'Ǡ',
'ǣ' => 'Ǣ',
'ǥ' => 'Ǥ',
'ǧ' => 'Ǧ',
'ǩ' => 'Ǩ',
'ǫ' => 'Ǫ',
'ǭ' => 'Ǭ',
'ǯ' => 'Ǯ',
'Dz' => 'DZ',
'dz' => 'DZ',
'ǵ' => 'Ǵ',
'ǹ' => 'Ǹ',
'ǻ' => 'Ǻ',
'ǽ' => 'Ǽ',
'ǿ' => 'Ǿ',
'ȁ' => 'Ȁ',
'ȃ' => 'Ȃ',
'ȅ' => 'Ȅ',
'ȇ' => 'Ȇ',
'ȉ' => 'Ȉ',
'ȋ' => 'Ȋ',
'ȍ' => 'Ȍ',
'ȏ' => 'Ȏ',
'ȑ' => 'Ȑ',
'ȓ' => 'Ȓ',
'ȕ' => 'Ȕ',
'ȗ' => 'Ȗ',
'ș' => 'Ș',
'ț' => 'Ț',
'ȝ' => 'Ȝ',
'ȟ' => 'Ȟ',
'ȣ' => 'Ȣ',
'ȥ' => 'Ȥ',
'ȧ' => 'Ȧ',
'ȩ' => 'Ȩ',
'ȫ' => 'Ȫ',
'ȭ' => 'Ȭ',
'ȯ' => 'Ȯ',
'ȱ' => 'Ȱ',
'ȳ' => 'Ȳ',
'ȼ' => 'Ȼ',
'ȿ' => 'Ȿ',
'ɀ' => 'Ɀ',
'ɂ' => 'Ɂ',
'ɇ' => 'Ɇ',
'ɉ' => 'Ɉ',
'ɋ' => 'Ɋ',
'ɍ' => 'Ɍ',
'ɏ' => 'Ɏ',
'ɐ' => 'Ɐ',
'ɑ' => 'Ɑ',
'ɒ' => 'Ɒ',
'ɓ' => 'Ɓ',
'ɔ' => 'Ɔ',
'ɖ' => 'Ɖ',
'ɗ' => 'Ɗ',
'ə' => 'Ə',
'ɛ' => 'Ɛ',
'ɜ' => 'Ɜ',
'ɠ' => 'Ɠ',
'ɡ' => 'Ɡ',
'ɣ' => 'Ɣ',
'ɥ' => 'Ɥ',
'ɦ' => 'Ɦ',
'ɨ' => 'Ɨ',
'ɩ' => 'Ɩ',
'ɫ' => 'Ɫ',
'ɬ' => 'Ɬ',
'ɯ' => 'Ɯ',
'ɱ' => 'Ɱ',
'ɲ' => 'Ɲ',
'ɵ' => 'Ɵ',
'ɽ' => 'Ɽ',
'ʀ' => 'Ʀ',
'ʃ' => 'Ʃ',
'ʇ' => 'Ʇ',
'ʈ' => 'Ʈ',
'ʉ' => 'Ʉ',
'ʊ' => 'Ʊ',
'ʋ' => 'Ʋ',
'ʌ' => 'Ʌ',
'ʒ' => 'Ʒ',
'ʞ' => 'Ʞ',
'ͅ' => 'Ι',
'ͱ' => 'Ͱ',
'ͳ' => 'Ͳ',
'ͷ' => 'Ͷ',
'ͻ' => 'Ͻ',
'ͼ' => 'Ͼ',
'ͽ' => 'Ͽ',
'ά' => 'Ά',
'έ' => 'Έ',
'ή' => 'Ή',
'ί' => 'Ί',
'α' => 'Α',
'β' => 'Β',
'γ' => 'Γ',
'δ' => 'Δ',
'ε' => 'Ε',
'ζ' => 'Ζ',
'η' => 'Η',
'θ' => 'Θ',
'ι' => 'Ι',
'κ' => 'Κ',
'λ' => 'Λ',
'μ' => 'Μ',
'ν' => 'Ν',
'ξ' => 'Ξ',
'ο' => 'Ο',
'π' => 'Π',
'ρ' => 'Ρ',
'ς' => 'Σ',
'σ' => 'Σ',
'τ' => 'Τ',
'υ' => 'Υ',
'φ' => 'Φ',
'χ' => 'Χ',
'ψ' => 'Ψ',
'ω' => 'Ω',
'ϊ' => 'Ϊ',
'ϋ' => 'Ϋ',
'ό' => 'Ό',
'ύ' => 'Ύ',
'ώ' => 'Ώ',
'ϐ' => 'Β',
'ϑ' => 'Θ',
'ϕ' => 'Φ',
'ϖ' => 'Π',
'ϗ' => 'Ϗ',
'ϙ' => 'Ϙ',
'ϛ' => 'Ϛ',
'ϝ' => 'Ϝ',
'ϟ' => 'Ϟ',
'ϡ' => 'Ϡ',
'ϣ' => 'Ϣ',
'ϥ' => 'Ϥ',
'ϧ' => 'Ϧ',
'ϩ' => 'Ϩ',
'ϫ' => 'Ϫ',
'ϭ' => 'Ϭ',
'ϯ' => 'Ϯ',
'ϰ' => 'Κ',
'ϱ' => 'Ρ',
'ϲ' => 'Ϲ',
'ϳ' => 'Ϳ',
'ϵ' => 'Ε',
'ϸ' => 'Ϸ',
'ϻ' => 'Ϻ',
'а' => 'А',
'б' => 'Б',
'в' => 'В',
'г' => 'Г',
'д' => 'Д',
'е' => 'Е',
'ж' => 'Ж',
'з' => 'З',
'и' => 'И',
'й' => 'Й',
'к' => 'К',
'л' => 'Л',
'м' => 'М',
'н' => 'Н',
'о' => 'О',
'п' => 'П',
'р' => 'Р',
'с' => 'С',
'т' => 'Т',
'у' => 'У',
'ф' => 'Ф',
'х' => 'Х',
'ц' => 'Ц',
'ч' => 'Ч',
'ш' => 'Ш',
'щ' => 'Щ',
'ъ' => 'Ъ',
'ы' => 'Ы',
'ь' => 'Ь',
'э' => 'Э',
'ю' => 'Ю',
'я' => 'Я',
'ѐ' => 'Ѐ',
'ё' => 'Ё',
'ђ' => 'Ђ',
'ѓ' => 'Ѓ',
'є' => 'Є',
'ѕ' => 'Ѕ',
'і' => 'І',
'ї' => 'Ї',
'ј' => 'Ј',
'љ' => 'Љ',
'њ' => 'Њ',
'ћ' => 'Ћ',
'ќ' => 'Ќ',
'ѝ' => 'Ѝ',
'ў' => 'Ў',
'џ' => 'Џ',
'ѡ' => 'Ѡ',
'ѣ' => 'Ѣ',
'ѥ' => 'Ѥ',
'ѧ' => 'Ѧ',
'ѩ' => 'Ѩ',
'ѫ' => 'Ѫ',
'ѭ' => 'Ѭ',
'ѯ' => 'Ѯ',
'ѱ' => 'Ѱ',
'ѳ' => 'Ѳ',
'ѵ' => 'Ѵ',
'ѷ' => 'Ѷ',
'ѹ' => 'Ѹ',
'ѻ' => 'Ѻ',
'ѽ' => 'Ѽ',
'ѿ' => 'Ѿ',
'ҁ' => 'Ҁ',
'ҋ' => 'Ҋ',
'ҍ' => 'Ҍ',
'ҏ' => 'Ҏ',
'ґ' => 'Ґ',
'ғ' => 'Ғ',
'ҕ' => 'Ҕ',
'җ' => 'Җ',
'ҙ' => 'Ҙ',
'қ' => 'Қ',
'ҝ' => 'Ҝ',
'ҟ' => 'Ҟ',
'ҡ' => 'Ҡ',
'ң' => 'Ң',
'ҥ' => 'Ҥ',
'ҧ' => 'Ҧ',
'ҩ' => 'Ҩ',
'ҫ' => 'Ҫ',
'ҭ' => 'Ҭ',
'ү' => 'Ү',
'ұ' => 'Ұ',
'ҳ' => 'Ҳ',
'ҵ' => 'Ҵ',
'ҷ' => 'Ҷ',
'ҹ' => 'Ҹ',
'һ' => 'Һ',
'ҽ' => 'Ҽ',
'ҿ' => 'Ҿ',
'ӂ' => 'Ӂ',
'ӄ' => 'Ӄ',
'ӆ' => 'Ӆ',
'ӈ' => 'Ӈ',
'ӊ' => 'Ӊ',
'ӌ' => 'Ӌ',
'ӎ' => 'Ӎ',
'ӏ' => 'Ӏ',
'ӑ' => 'Ӑ',
'ӓ' => 'Ӓ',
'ӕ' => 'Ӕ',
'ӗ' => 'Ӗ',
'ә' => 'Ә',
'ӛ' => 'Ӛ',
'ӝ' => 'Ӝ',
'ӟ' => 'Ӟ',
'ӡ' => 'Ӡ',
'ӣ' => 'Ӣ',
'ӥ' => 'Ӥ',
'ӧ' => 'Ӧ',
'ө' => 'Ө',
'ӫ' => 'Ӫ',
'ӭ' => 'Ӭ',
'ӯ' => 'Ӯ',
'ӱ' => 'Ӱ',
'ӳ' => 'Ӳ',
'ӵ' => 'Ӵ',
'ӷ' => 'Ӷ',
'ӹ' => 'Ӹ',
'ӻ' => 'Ӻ',
'ӽ' => 'Ӽ',
'ӿ' => 'Ӿ',
'ԁ' => 'Ԁ',
'ԃ' => 'Ԃ',
'ԅ' => 'Ԅ',
'ԇ' => 'Ԇ',
'ԉ' => 'Ԉ',
'ԋ' => 'Ԋ',
'ԍ' => 'Ԍ',
'ԏ' => 'Ԏ',
'ԑ' => 'Ԑ',
'ԓ' => 'Ԓ',
'ԕ' => 'Ԕ',
'ԗ' => 'Ԗ',
'ԙ' => 'Ԙ',
'ԛ' => 'Ԛ',
'ԝ' => 'Ԝ',
'ԟ' => 'Ԟ',
'ԡ' => 'Ԡ',
'ԣ' => 'Ԣ',
'ԥ' => 'Ԥ',
'ԧ' => 'Ԧ',
'ԩ' => 'Ԩ',
'ԫ' => 'Ԫ',
'ԭ' => 'Ԭ',
'ԯ' => 'Ԯ',
'ա' => 'Ա',
'բ' => 'Բ',
'գ' => 'Գ',
'դ' => 'Դ',
'ե' => 'Ե',
'զ' => 'Զ',
'է' => 'Է',
'ը' => 'Ը',
'թ' => 'Թ',
'ժ' => 'Ժ',
'ի' => 'Ի',
'լ' => 'Լ',
'խ' => 'Խ',
'ծ' => 'Ծ',
'կ' => 'Կ',
'հ' => 'Հ',
'ձ' => 'Ձ',
'ղ' => 'Ղ',
'ճ' => 'Ճ',
'մ' => 'Մ',
'յ' => 'Յ',
'ն' => 'Ն',
'շ' => 'Շ',
'ո' => 'Ո',
'չ' => 'Չ',
'պ' => 'Պ',
'ջ' => 'Ջ',
'ռ' => 'Ռ',
'ս' => 'Ս',
'վ' => 'Վ',
'տ' => 'Տ',
'ր' => 'Ր',
'ց' => 'Ց',
'ւ' => 'Ւ',
'փ' => 'Փ',
'ք' => 'Ք',
'օ' => 'Օ',
'ֆ' => 'Ֆ',
'ᵹ' => 'Ᵹ',
'ᵽ' => 'Ᵽ',
'ḁ' => 'Ḁ',
'ḃ' => 'Ḃ',
'ḅ' => 'Ḅ',
'ḇ' => 'Ḇ',
'ḉ' => 'Ḉ',
'ḋ' => 'Ḋ',
'ḍ' => 'Ḍ',
'ḏ' => 'Ḏ',
'ḑ' => 'Ḑ',
'ḓ' => 'Ḓ',
'ḕ' => 'Ḕ',
'ḗ' => 'Ḗ',
'ḙ' => 'Ḙ',
'ḛ' => 'Ḛ',
'ḝ' => 'Ḝ',
'ḟ' => 'Ḟ',
'ḡ' => 'Ḡ',
'ḣ' => 'Ḣ',
'ḥ' => 'Ḥ',
'ḧ' => 'Ḧ',
'ḩ' => 'Ḩ',
'ḫ' => 'Ḫ',
'ḭ' => 'Ḭ',
'ḯ' => 'Ḯ',
'ḱ' => 'Ḱ',
'ḳ' => 'Ḳ',
'ḵ' => 'Ḵ',
'ḷ' => 'Ḷ',
'ḹ' => 'Ḹ',
'ḻ' => 'Ḻ',
'ḽ' => 'Ḽ',
'ḿ' => 'Ḿ',
'ṁ' => 'Ṁ',
'ṃ' => 'Ṃ',
'ṅ' => 'Ṅ',
'ṇ' => 'Ṇ',
'ṉ' => 'Ṉ',
'ṋ' => 'Ṋ',
'ṍ' => 'Ṍ',
'ṏ' => 'Ṏ',
'ṑ' => 'Ṑ',
'ṓ' => 'Ṓ',
'ṕ' => 'Ṕ',
'ṗ' => 'Ṗ',
'ṙ' => 'Ṙ',
'ṛ' => 'Ṛ',
'ṝ' => 'Ṝ',
'ṟ' => 'Ṟ',
'ṡ' => 'Ṡ',
'ṣ' => 'Ṣ',
'ṥ' => 'Ṥ',
'ṧ' => 'Ṧ',
'ṩ' => 'Ṩ',
'ṫ' => 'Ṫ',
'ṭ' => 'Ṭ',
'ṯ' => 'Ṯ',
'ṱ' => 'Ṱ',
'ṳ' => 'Ṳ',
'ṵ' => 'Ṵ',
'ṷ' => 'Ṷ',
'ṹ' => 'Ṹ',
'ṻ' => 'Ṻ',
'ṽ' => 'Ṽ',
'ṿ' => 'Ṿ',
'ẁ' => 'Ẁ',
'ẃ' => 'Ẃ',
'ẅ' => 'Ẅ',
'ẇ' => 'Ẇ',
'ẉ' => 'Ẉ',
'ẋ' => 'Ẋ',
'ẍ' => 'Ẍ',
'ẏ' => 'Ẏ',
'ẑ' => 'Ẑ',
'ẓ' => 'Ẓ',
'ẕ' => 'Ẕ',
'ẛ' => 'Ṡ',
'ạ' => 'Ạ',
'ả' => 'Ả',
'ấ' => 'Ấ',
'ầ' => 'Ầ',
'ẩ' => 'Ẩ',
'ẫ' => 'Ẫ',
'ậ' => 'Ậ',
'ắ' => 'Ắ',
'ằ' => 'Ằ',
'ẳ' => 'Ẳ',
'ẵ' => 'Ẵ',
'ặ' => 'Ặ',
'ẹ' => 'Ẹ',
'ẻ' => 'Ẻ',
'ẽ' => 'Ẽ',
'ế' => 'Ế',
'ề' => 'Ề',
'ể' => 'Ể',
'ễ' => 'Ễ',
'ệ' => 'Ệ',
'ỉ' => 'Ỉ',
'ị' => 'Ị',
'ọ' => 'Ọ',
'ỏ' => 'Ỏ',
'ố' => 'Ố',
'ồ' => 'Ồ',
'ổ' => 'Ổ',
'ỗ' => 'Ỗ',
'ộ' => 'Ộ',
'ớ' => 'Ớ',
'ờ' => 'Ờ',
'ở' => 'Ở',
'ỡ' => 'Ỡ',
'ợ' => 'Ợ',
'ụ' => 'Ụ',
'ủ' => 'Ủ',
'ứ' => 'Ứ',
'ừ' => 'Ừ',
'ử' => 'Ử',
'ữ' => 'Ữ',
'ự' => 'Ự',
'ỳ' => 'Ỳ',
'ỵ' => 'Ỵ',
'ỷ' => 'Ỷ',
'ỹ' => 'Ỹ',
'ỻ' => 'Ỻ',
'ỽ' => 'Ỽ',
'ỿ' => 'Ỿ',
'ἀ' => 'Ἀ',
'ἁ' => 'Ἁ',
'ἂ' => 'Ἂ',
'ἃ' => 'Ἃ',
'ἄ' => 'Ἄ',
'ἅ' => 'Ἅ',
'ἆ' => 'Ἆ',
'ἇ' => 'Ἇ',
'ἐ' => 'Ἐ',
'ἑ' => 'Ἑ',
'ἒ' => 'Ἒ',
'ἓ' => 'Ἓ',
'ἔ' => 'Ἔ',
'ἕ' => 'Ἕ',
'ἠ' => 'Ἠ',
'ἡ' => 'Ἡ',
'ἢ' => 'Ἢ',
'ἣ' => 'Ἣ',
'ἤ' => 'Ἤ',
'ἥ' => 'Ἥ',
'ἦ' => 'Ἦ',
'ἧ' => 'Ἧ',
'ἰ' => 'Ἰ',
'ἱ' => 'Ἱ',
'ἲ' => 'Ἲ',
'ἳ' => 'Ἳ',
'ἴ' => 'Ἴ',
'ἵ' => 'Ἵ',
'ἶ' => 'Ἶ',
'ἷ' => 'Ἷ',
'ὀ' => 'Ὀ',
'ὁ' => 'Ὁ',
'ὂ' => 'Ὂ',
'ὃ' => 'Ὃ',
'ὄ' => 'Ὄ',
'ὅ' => 'Ὅ',
'ὑ' => 'Ὑ',
'ὓ' => 'Ὓ',
'ὕ' => 'Ὕ',
'ὗ' => 'Ὗ',
'ὠ' => 'Ὠ',
'ὡ' => 'Ὡ',
'ὢ' => 'Ὢ',
'ὣ' => 'Ὣ',
'ὤ' => 'Ὤ',
'ὥ' => 'Ὥ',
'ὦ' => 'Ὦ',
'ὧ' => 'Ὧ',
'ὰ' => 'Ὰ',
'ά' => 'Ά',
'ὲ' => 'Ὲ',
'έ' => 'Έ',
'ὴ' => 'Ὴ',
'ή' => 'Ή',
'ὶ' => 'Ὶ',
'ί' => 'Ί',
'ὸ' => 'Ὸ',
'ό' => 'Ό',
'ὺ' => 'Ὺ',
'ύ' => 'Ύ',
'ὼ' => 'Ὼ',
'ώ' => 'Ώ',
'ᾀ' => 'ᾈ',
'ᾁ' => 'ᾉ',
'ᾂ' => 'ᾊ',
'ᾃ' => 'ᾋ',
'ᾄ' => 'ᾌ',
'ᾅ' => 'ᾍ',
'ᾆ' => 'ᾎ',
'ᾇ' => 'ᾏ',
'ᾐ' => 'ᾘ',
'ᾑ' => 'ᾙ',
'ᾒ' => 'ᾚ',
'ᾓ' => 'ᾛ',
'ᾔ' => 'ᾜ',
'ᾕ' => 'ᾝ',
'ᾖ' => 'ᾞ',
'ᾗ' => 'ᾟ',
'ᾠ' => 'ᾨ',
'ᾡ' => 'ᾩ',
'ᾢ' => 'ᾪ',
'ᾣ' => 'ᾫ',
'ᾤ' => 'ᾬ',
'ᾥ' => 'ᾭ',
'ᾦ' => 'ᾮ',
'ᾧ' => 'ᾯ',
'ᾰ' => 'Ᾰ',
'ᾱ' => 'Ᾱ',
'ᾳ' => 'ᾼ',
'ι' => 'Ι',
'ῃ' => 'ῌ',
'ῐ' => 'Ῐ',
'ῑ' => 'Ῑ',
'ῠ' => 'Ῠ',
'ῡ' => 'Ῡ',
'ῥ' => 'Ῥ',
'ῳ' => 'ῼ',
'ⅎ' => 'Ⅎ',
'ⅰ' => 'Ⅰ',
'ⅱ' => 'Ⅱ',
'ⅲ' => 'Ⅲ',
'ⅳ' => 'Ⅳ',
'ⅴ' => 'Ⅴ',
'ⅵ' => 'Ⅵ',
'ⅶ' => 'Ⅶ',
'ⅷ' => 'Ⅷ',
'ⅸ' => 'Ⅸ',
'ⅹ' => 'Ⅹ',
'ⅺ' => 'Ⅺ',
'ⅻ' => 'Ⅻ',
'ⅼ' => 'Ⅼ',
'ⅽ' => 'Ⅽ',
'ⅾ' => 'Ⅾ',
'ⅿ' => 'Ⅿ',
'ↄ' => 'Ↄ',
'ⓐ' => 'Ⓐ',
'ⓑ' => 'Ⓑ',
'ⓒ' => 'Ⓒ',
'ⓓ' => 'Ⓓ',
'ⓔ' => 'Ⓔ',
'ⓕ' => 'Ⓕ',
'ⓖ' => 'Ⓖ',
'ⓗ' => 'Ⓗ',
'ⓘ' => 'Ⓘ',
'ⓙ' => 'Ⓙ',
'ⓚ' => 'Ⓚ',
'ⓛ' => 'Ⓛ',
'ⓜ' => 'Ⓜ',
'ⓝ' => 'Ⓝ',
'ⓞ' => 'Ⓞ',
'ⓟ' => 'Ⓟ',
'ⓠ' => 'Ⓠ',
'ⓡ' => 'Ⓡ',
'ⓢ' => 'Ⓢ',
'ⓣ' => 'Ⓣ',
'ⓤ' => 'Ⓤ',
'ⓥ' => 'Ⓥ',
'ⓦ' => 'Ⓦ',
'ⓧ' => 'Ⓧ',
'ⓨ' => 'Ⓨ',
'ⓩ' => 'Ⓩ',
'ⰰ' => 'Ⰰ',
'ⰱ' => 'Ⰱ',
'ⰲ' => 'Ⰲ',
'ⰳ' => 'Ⰳ',
'ⰴ' => 'Ⰴ',
'ⰵ' => 'Ⰵ',
'ⰶ' => 'Ⰶ',
'ⰷ' => 'Ⰷ',
'ⰸ' => 'Ⰸ',
'ⰹ' => 'Ⰹ',
'ⰺ' => 'Ⰺ',
'ⰻ' => 'Ⰻ',
'ⰼ' => 'Ⰼ',
'ⰽ' => 'Ⰽ',
'ⰾ' => 'Ⰾ',
'ⰿ' => 'Ⰿ',
'ⱀ' => 'Ⱀ',
'ⱁ' => 'Ⱁ',
'ⱂ' => 'Ⱂ',
'ⱃ' => 'Ⱃ',
'ⱄ' => 'Ⱄ',
'ⱅ' => 'Ⱅ',
'ⱆ' => 'Ⱆ',
'ⱇ' => 'Ⱇ',
'ⱈ' => 'Ⱈ',
'ⱉ' => 'Ⱉ',
'ⱊ' => 'Ⱊ',
'ⱋ' => 'Ⱋ',
'ⱌ' => 'Ⱌ',
'ⱍ' => 'Ⱍ',
'ⱎ' => 'Ⱎ',
'ⱏ' => 'Ⱏ',
'ⱐ' => 'Ⱐ',
'ⱑ' => 'Ⱑ',
'ⱒ' => 'Ⱒ',
'ⱓ' => 'Ⱓ',
'ⱔ' => 'Ⱔ',
'ⱕ' => 'Ⱕ',
'ⱖ' => 'Ⱖ',
'ⱗ' => 'Ⱗ',
'ⱘ' => 'Ⱘ',
'ⱙ' => 'Ⱙ',
'ⱚ' => 'Ⱚ',
'ⱛ' => 'Ⱛ',
'ⱜ' => 'Ⱜ',
'ⱝ' => 'Ⱝ',
'ⱞ' => 'Ⱞ',
'ⱡ' => 'Ⱡ',
'ⱥ' => 'Ⱥ',
'ⱦ' => 'Ⱦ',
'ⱨ' => 'Ⱨ',
'ⱪ' => 'Ⱪ',
'ⱬ' => 'Ⱬ',
'ⱳ' => 'Ⱳ',
'ⱶ' => 'Ⱶ',
'ⲁ' => 'Ⲁ',
'ⲃ' => 'Ⲃ',
'ⲅ' => 'Ⲅ',
'ⲇ' => 'Ⲇ',
'ⲉ' => 'Ⲉ',
'ⲋ' => 'Ⲋ',
'ⲍ' => 'Ⲍ',
'ⲏ' => 'Ⲏ',
'ⲑ' => 'Ⲑ',
'ⲓ' => 'Ⲓ',
'ⲕ' => 'Ⲕ',
'ⲗ' => 'Ⲗ',
'ⲙ' => 'Ⲙ',
'ⲛ' => 'Ⲛ',
'ⲝ' => 'Ⲝ',
'ⲟ' => 'Ⲟ',
'ⲡ' => 'Ⲡ',
'ⲣ' => 'Ⲣ',
'ⲥ' => 'Ⲥ',
'ⲧ' => 'Ⲧ',
'ⲩ' => 'Ⲩ',
'ⲫ' => 'Ⲫ',
'ⲭ' => 'Ⲭ',
'ⲯ' => 'Ⲯ',
'ⲱ' => 'Ⲱ',
'ⲳ' => 'Ⲳ',
'ⲵ' => 'Ⲵ',
'ⲷ' => 'Ⲷ',
'ⲹ' => 'Ⲹ',
'ⲻ' => 'Ⲻ',
'ⲽ' => 'Ⲽ',
'ⲿ' => 'Ⲿ',
'ⳁ' => 'Ⳁ',
'ⳃ' => 'Ⳃ',
'ⳅ' => 'Ⳅ',
'ⳇ' => 'Ⳇ',
'ⳉ' => 'Ⳉ',
'ⳋ' => 'Ⳋ',
'ⳍ' => 'Ⳍ',
'ⳏ' => 'Ⳏ',
'ⳑ' => 'Ⳑ',
'ⳓ' => 'Ⳓ',
'ⳕ' => 'Ⳕ',
'ⳗ' => 'Ⳗ',
'ⳙ' => 'Ⳙ',
'ⳛ' => 'Ⳛ',
'ⳝ' => 'Ⳝ',
'ⳟ' => 'Ⳟ',
'ⳡ' => 'Ⳡ',
'ⳣ' => 'Ⳣ',
'ⳬ' => 'Ⳬ',
'ⳮ' => 'Ⳮ',
'ⳳ' => 'Ⳳ',
'ⴀ' => 'Ⴀ',
'ⴁ' => 'Ⴁ',
'ⴂ' => 'Ⴂ',
'ⴃ' => 'Ⴃ',
'ⴄ' => 'Ⴄ',
'ⴅ' => 'Ⴅ',
'ⴆ' => 'Ⴆ',
'ⴇ' => 'Ⴇ',
'ⴈ' => 'Ⴈ',
'ⴉ' => 'Ⴉ',
'ⴊ' => 'Ⴊ',
'ⴋ' => 'Ⴋ',
'ⴌ' => 'Ⴌ',
'ⴍ' => 'Ⴍ',
'ⴎ' => 'Ⴎ',
'ⴏ' => 'Ⴏ',
'ⴐ' => 'Ⴐ',
'ⴑ' => 'Ⴑ',
'ⴒ' => 'Ⴒ',
'ⴓ' => 'Ⴓ',
'ⴔ' => 'Ⴔ',
'ⴕ' => 'Ⴕ',
'ⴖ' => 'Ⴖ',
'ⴗ' => 'Ⴗ',
'ⴘ' => 'Ⴘ',
'ⴙ' => 'Ⴙ',
'ⴚ' => 'Ⴚ',
'ⴛ' => 'Ⴛ',
'ⴜ' => 'Ⴜ',
'ⴝ' => 'Ⴝ',
'ⴞ' => 'Ⴞ',
'ⴟ' => 'Ⴟ',
'ⴠ' => 'Ⴠ',
'ⴡ' => 'Ⴡ',
'ⴢ' => 'Ⴢ',
'ⴣ' => 'Ⴣ',
'ⴤ' => 'Ⴤ',
'ⴥ' => 'Ⴥ',
'ⴧ' => 'Ⴧ',
'ⴭ' => 'Ⴭ',
'ꙁ' => 'Ꙁ',
'ꙃ' => 'Ꙃ',
'ꙅ' => 'Ꙅ',
'ꙇ' => 'Ꙇ',
'ꙉ' => 'Ꙉ',
'ꙋ' => 'Ꙋ',
'ꙍ' => 'Ꙍ',
'ꙏ' => 'Ꙏ',
'ꙑ' => 'Ꙑ',
'ꙓ' => 'Ꙓ',
'ꙕ' => 'Ꙕ',
'ꙗ' => 'Ꙗ',
'ꙙ' => 'Ꙙ',
'ꙛ' => 'Ꙛ',
'ꙝ' => 'Ꙝ',
'ꙟ' => 'Ꙟ',
'ꙡ' => 'Ꙡ',
'ꙣ' => 'Ꙣ',
'ꙥ' => 'Ꙥ',
'ꙧ' => 'Ꙧ',
'ꙩ' => 'Ꙩ',
'ꙫ' => 'Ꙫ',
'ꙭ' => 'Ꙭ',
'ꚁ' => 'Ꚁ',
'ꚃ' => 'Ꚃ',
'ꚅ' => 'Ꚅ',
'ꚇ' => 'Ꚇ',
'ꚉ' => 'Ꚉ',
'ꚋ' => 'Ꚋ',
'ꚍ' => 'Ꚍ',
'ꚏ' => 'Ꚏ',
'ꚑ' => 'Ꚑ',
'ꚓ' => 'Ꚓ',
'ꚕ' => 'Ꚕ',
'ꚗ' => 'Ꚗ',
'ꚙ' => 'Ꚙ',
'ꚛ' => 'Ꚛ',
'ꜣ' => 'Ꜣ',
'ꜥ' => 'Ꜥ',
'ꜧ' => 'Ꜧ',
'ꜩ' => 'Ꜩ',
'ꜫ' => 'Ꜫ',
'ꜭ' => 'Ꜭ',
'ꜯ' => 'Ꜯ',
'ꜳ' => 'Ꜳ',
'ꜵ' => 'Ꜵ',
'ꜷ' => 'Ꜷ',
'ꜹ' => 'Ꜹ',
'ꜻ' => 'Ꜻ',
'ꜽ' => 'Ꜽ',
'ꜿ' => 'Ꜿ',
'ꝁ' => 'Ꝁ',
'ꝃ' => 'Ꝃ',
'ꝅ' => 'Ꝅ',
'ꝇ' => 'Ꝇ',
'ꝉ' => 'Ꝉ',
'ꝋ' => 'Ꝋ',
'ꝍ' => 'Ꝍ',
'ꝏ' => 'Ꝏ',
'ꝑ' => 'Ꝑ',
'ꝓ' => 'Ꝓ',
'ꝕ' => 'Ꝕ',
'ꝗ' => 'Ꝗ',
'ꝙ' => 'Ꝙ',
'ꝛ' => 'Ꝛ',
'ꝝ' => 'Ꝝ',
'ꝟ' => 'Ꝟ',
'ꝡ' => 'Ꝡ',
'ꝣ' => 'Ꝣ',
'ꝥ' => 'Ꝥ',
'ꝧ' => 'Ꝧ',
'ꝩ' => 'Ꝩ',
'ꝫ' => 'Ꝫ',
'ꝭ' => 'Ꝭ',
'ꝯ' => 'Ꝯ',
'ꝺ' => 'Ꝺ',
'ꝼ' => 'Ꝼ',
'ꝿ' => 'Ꝿ',
'ꞁ' => 'Ꞁ',
'ꞃ' => 'Ꞃ',
'ꞅ' => 'Ꞅ',
'ꞇ' => 'Ꞇ',
'ꞌ' => 'Ꞌ',
'ꞑ' => 'Ꞑ',
'ꞓ' => 'Ꞓ',
'ꞗ' => 'Ꞗ',
'ꞙ' => 'Ꞙ',
'ꞛ' => 'Ꞛ',
'ꞝ' => 'Ꞝ',
'ꞟ' => 'Ꞟ',
'ꞡ' => 'Ꞡ',
'ꞣ' => 'Ꞣ',
'ꞥ' => 'Ꞥ',
'ꞧ' => 'Ꞧ',
'ꞩ' => 'Ꞩ',
'a' => 'A',
'b' => 'B',
'c' => 'C',
'd' => 'D',
'e' => 'E',
'f' => 'F',
'g' => 'G',
'h' => 'H',
'i' => 'I',
'j' => 'J',
'k' => 'K',
'l' => 'L',
'm' => 'M',
'n' => 'N',
'o' => 'O',
'p' => 'P',
'q' => 'Q',
'r' => 'R',
's' => 'S',
't' => 'T',
'u' => 'U',
'v' => 'V',
'w' => 'W',
'x' => 'X',
'y' => 'Y',
'z' => 'Z',
'𐐨' => '𐐀',
'𐐩' => '𐐁',
'𐐪' => '𐐂',
'𐐫' => '𐐃',
'𐐬' => '𐐄',
'𐐭' => '𐐅',
'𐐮' => '𐐆',
'𐐯' => '𐐇',
'𐐰' => '𐐈',
'𐐱' => '𐐉',
'𐐲' => '𐐊',
'𐐳' => '𐐋',
'𐐴' => '𐐌',
'𐐵' => '𐐍',
'𐐶' => '𐐎',
'𐐷' => '𐐏',
'𐐸' => '𐐐',
'𐐹' => '𐐑',
'𐐺' => '𐐒',
'𐐻' => '𐐓',
'𐐼' => '𐐔',
'𐐽' => '𐐕',
'𐐾' => '𐐖',
'𐐿' => '𐐗',
'𐑀' => '𐐘',
'𐑁' => '𐐙',
'𐑂' => '𐐚',
'𐑃' => '𐐛',
'𐑄' => '𐐜',
'𐑅' => '𐐝',
'𐑆' => '𐐞',
'𐑇' => '𐐟',
'𐑈' => '𐐠',
'𐑉' => '𐐡',
'𐑊' => '𐐢',
'𐑋' => '𐐣',
'𐑌' => '𐐤',
'𐑍' => '𐐥',
'𐑎' => '𐐦',
'𐑏' => '𐐧',
'𑣀' => '𑢠',
'𑣁' => '𑢡',
'𑣂' => '𑢢',
'𑣃' => '𑢣',
'𑣄' => '𑢤',
'𑣅' => '𑢥',
'𑣆' => '𑢦',
'𑣇' => '𑢧',
'𑣈' => '𑢨',
'𑣉' => '𑢩',
'𑣊' => '𑢪',
'𑣋' => '𑢫',
'𑣌' => '𑢬',
'𑣍' => '𑢭',
'𑣎' => '𑢮',
'𑣏' => '𑢯',
'𑣐' => '𑢰',
'𑣑' => '𑢱',
'𑣒' => '𑢲',
'𑣓' => '𑢳',
'𑣔' => '𑢴',
'𑣕' => '𑢵',
'𑣖' => '𑢶',
'𑣗' => '𑢷',
'𑣘' => '𑢸',
'𑣙' => '𑢹',
'𑣚' => '𑢺',
'𑣛' => '𑢻',
'𑣜' => '𑢼',
'𑣝' => '𑢽',
'𑣞' => '𑢾',
'𑣟' => '𑢿',
);
<?php



return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
<?php










namespace Symfony\Polyfill\Mbstring;























































final class Mbstring
{
const MB_CASE_FOLD = PHP_INT_MAX;

private static $encodingList = array('ASCII', 'UTF-8');
private static $language = 'neutral';
private static $internalEncoding = 'UTF-8';
private static $caseFold = array(
array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'),
);

public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
{
if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
$fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
} else {
$fromEncoding = self::getEncoding($fromEncoding);
}

$toEncoding = self::getEncoding($toEncoding);

if ('BASE64' === $fromEncoding) {
$s = base64_decode($s);
$fromEncoding = $toEncoding;
}

if ('BASE64' === $toEncoding) {
return base64_encode($s);
}

if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
$fromEncoding = 'Windows-1252';
}
if ('UTF-8' !== $fromEncoding) {
$s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
}

return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
}

if ('HTML-ENTITIES' === $fromEncoding) {
$s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
$fromEncoding = 'UTF-8';
}

return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
}

public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
{
$vars = array(&$a, &$b, &$c, &$d, &$e, &$f);

$ok = true;
array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
$ok = false;
}
});

return $ok ? $fromEncoding : false;
}

public static function mb_decode_mimeheader($s)
{
return iconv_mime_decode($s, 2, self::$internalEncoding);
}

public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
{
trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
}

public static function mb_decode_numericentity($s, $convmap, $encoding = null)
{
if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);

return null;
}

if (!\is_array($convmap) || !$convmap) {
return false;
}

if (null !== $encoding && !\is_scalar($encoding)) {
trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);

return ''; 
 }

$s = (string) $s;
if ('' === $s) {
return '';
}

$encoding = self::getEncoding($encoding);

if ('UTF-8' === $encoding) {
$encoding = null;
if (!preg_match('//u', $s)) {
$s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
}
} else {
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
}

$cnt = floor(\count($convmap) / 4) * 4;

for ($i = 0; $i < $cnt; $i += 4) {

 $convmap[$i] += $convmap[$i + 2];
$convmap[$i + 1] += $convmap[$i + 2];
}

$s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
$c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
for ($i = 0; $i < $cnt; $i += 4) {
if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
return Mbstring::mb_chr($c - $convmap[$i + 2]);
}
}

return $m[0];
}, $s);

if (null === $encoding) {
return $s;
}

return iconv('UTF-8', $encoding.'//IGNORE', $s);
}

public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
{
if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);

return null;
}

if (!\is_array($convmap) || !$convmap) {
return false;
}

if (null !== $encoding && !\is_scalar($encoding)) {
trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);

return null; 
 }

if (null !== $is_hex && !\is_scalar($is_hex)) {
trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);

return null;
}

$s = (string) $s;
if ('' === $s) {
return '';
}

$encoding = self::getEncoding($encoding);

if ('UTF-8' === $encoding) {
$encoding = null;
if (!preg_match('//u', $s)) {
$s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
}
} else {
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
}

static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);

$cnt = floor(\count($convmap) / 4) * 4;
$i = 0;
$len = \strlen($s);
$result = '';

while ($i < $len) {
$ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
$uchr = substr($s, $i, $ulen);
$i += $ulen;
$c = self::mb_ord($uchr);

for ($j = 0; $j < $cnt; $j += 4) {
if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
$cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
$result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
continue 2;
}
}
$result .= $uchr;
}

if (null === $encoding) {
return $result;
}

return iconv('UTF-8', $encoding.'//IGNORE', $result);
}

public static function mb_convert_case($s, $mode, $encoding = null)
{
$s = (string) $s;
if ('' === $s) {
return '';
}

$encoding = self::getEncoding($encoding);

if ('UTF-8' === $encoding) {
$encoding = null;
if (!preg_match('//u', $s)) {
$s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
}
} else {
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
}

if (MB_CASE_TITLE == $mode) {
static $titleRegexp = null;
if (null === $titleRegexp) {
$titleRegexp = self::getData('titleCaseRegexp');
}
$s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
} else {
if (MB_CASE_UPPER == $mode) {
static $upper = null;
if (null === $upper) {
$upper = self::getData('upperCase');
}
$map = $upper;
} else {
if (self::MB_CASE_FOLD === $mode) {
$s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
}

static $lower = null;
if (null === $lower) {
$lower = self::getData('lowerCase');
}
$map = $lower;
}

static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);

$i = 0;
$len = \strlen($s);

while ($i < $len) {
$ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
$uchr = substr($s, $i, $ulen);
$i += $ulen;

if (isset($map[$uchr])) {
$uchr = $map[$uchr];
$nlen = \strlen($uchr);

if ($nlen == $ulen) {
$nlen = $i;
do {
$s[--$nlen] = $uchr[--$ulen];
} while ($ulen);
} else {
$s = substr_replace($s, $uchr, $i - $ulen, $ulen);
$len += $nlen - $ulen;
$i += $nlen - $ulen;
}
}
}
}

if (null === $encoding) {
return $s;
}

return iconv('UTF-8', $encoding.'//IGNORE', $s);
}

public static function mb_internal_encoding($encoding = null)
{
if (null === $encoding) {
return self::$internalEncoding;
}

$encoding = self::getEncoding($encoding);

if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
self::$internalEncoding = $encoding;

return true;
}

return false;
}

public static function mb_language($lang = null)
{
if (null === $lang) {
return self::$language;
}

switch ($lang = strtolower($lang)) {
case 'uni':
case 'neutral':
self::$language = $lang;

return true;
}

return false;
}

public static function mb_list_encodings()
{
return array('UTF-8');
}

public static function mb_encoding_aliases($encoding)
{
switch (strtoupper($encoding)) {
case 'UTF8':
case 'UTF-8':
return array('utf8');
}

return false;
}

public static function mb_check_encoding($var = null, $encoding = null)
{
if (null === $encoding) {
if (null === $var) {
return false;
}
$encoding = self::$internalEncoding;
}

return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
}

public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
{
if (null === $encodingList) {
$encodingList = self::$encodingList;
} else {
if (!\is_array($encodingList)) {
$encodingList = array_map('trim', explode(',', $encodingList));
}
$encodingList = array_map('strtoupper', $encodingList);
}

foreach ($encodingList as $enc) {
switch ($enc) {
case 'ASCII':
if (!preg_match('/[\x80-\xFF]/', $str)) {
return $enc;
}
break;

case 'UTF8':
case 'UTF-8':
if (preg_match('//u', $str)) {
return 'UTF-8';
}
break;

default:
if (0 === strncmp($enc, 'ISO-8859-', 9)) {
return $enc;
}
}
}

return false;
}

public static function mb_detect_order($encodingList = null)
{
if (null === $encodingList) {
return self::$encodingList;
}

if (!\is_array($encodingList)) {
$encodingList = array_map('trim', explode(',', $encodingList));
}
$encodingList = array_map('strtoupper', $encodingList);

foreach ($encodingList as $enc) {
switch ($enc) {
default:
if (strncmp($enc, 'ISO-8859-', 9)) {
return false;
}

 case 'ASCII':
case 'UTF8':
case 'UTF-8':
}
}

self::$encodingList = $encodingList;

return true;
}

public static function mb_strlen($s, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return \strlen($s);
}

return @iconv_strlen($s, $encoding);
}

public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return strpos($haystack, $needle, $offset);
}

$needle = (string) $needle;
if ('' === $needle) {
trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);

return false;
}

return iconv_strpos($haystack, $needle, $offset, $encoding);
}

public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return strrpos($haystack, $needle, $offset);
}

if ($offset != (int) $offset) {
$offset = 0;
} elseif ($offset = (int) $offset) {
if ($offset < 0) {
if (0 > $offset += self::mb_strlen($needle)) {
$haystack = self::mb_substr($haystack, 0, $offset, $encoding);
}
$offset = 0;
} else {
$haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
}
}

$pos = iconv_strrpos($haystack, $needle, $encoding);

return false !== $pos ? $offset + $pos : false;
}

public static function mb_str_split($string, $split_length = 1, $encoding = null)
{
if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);

return null;
}

if (1 > $split_length = (int) $split_length) {
trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);

return false;
}

if (null === $encoding) {
$encoding = mb_internal_encoding();
}

if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
$rx = '/(';
while (65535 < $split_length) {
$rx .= '.{65535}';
$split_length -= 65535;
}
$rx .= '.{'.$split_length.'})/us';

return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
}

$result = array();
$length = mb_strlen($string, $encoding);

for ($i = 0; $i < $length; $i += $split_length) {
$result[] = mb_substr($string, $i, $split_length, $encoding);
}

return $result;
}

public static function mb_strtolower($s, $encoding = null)
{
return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
}

public static function mb_strtoupper($s, $encoding = null)
{
return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
}

public static function mb_substitute_character($c = null)
{
if (0 === strcasecmp($c, 'none')) {
return true;
}

return null !== $c ? false : 'none';
}

public static function mb_substr($s, $start, $length = null, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return (string) substr($s, $start, null === $length ? 2147483647 : $length);
}

if ($start < 0) {
$start = iconv_strlen($s, $encoding) + $start;
if ($start < 0) {
$start = 0;
}
}

if (null === $length) {
$length = 2147483647;
} elseif ($length < 0) {
$length = iconv_strlen($s, $encoding) + $length - $start;
if ($length < 0) {
return '';
}
}

return (string) iconv_substr($s, $start, $length, $encoding);
}

public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
{
$haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
$needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);

return self::mb_strpos($haystack, $needle, $offset, $encoding);
}

public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
{
$pos = self::mb_stripos($haystack, $needle, 0, $encoding);

return self::getSubpart($pos, $part, $haystack, $encoding);
}

public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
{
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return strrchr($haystack, $needle, $part);
}
$needle = self::mb_substr($needle, 0, 1, $encoding);
$pos = iconv_strrpos($haystack, $needle, $encoding);

return self::getSubpart($pos, $part, $haystack, $encoding);
}

public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
{
$needle = self::mb_substr($needle, 0, 1, $encoding);
$pos = self::mb_strripos($haystack, $needle, $encoding);

return self::getSubpart($pos, $part, $haystack, $encoding);
}

public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
{
$haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
$needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);

return self::mb_strrpos($haystack, $needle, $offset, $encoding);
}

public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
{
$pos = strpos($haystack, $needle);
if (false === $pos) {
return false;
}
if ($part) {
return substr($haystack, 0, $pos);
}

return substr($haystack, $pos);
}

public static function mb_get_info($type = 'all')
{
$info = array(
'internal_encoding' => self::$internalEncoding,
'http_output' => 'pass',
'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
'func_overload' => 0,
'func_overload_list' => 'no overload',
'mail_charset' => 'UTF-8',
'mail_header_encoding' => 'BASE64',
'mail_body_encoding' => 'BASE64',
'illegal_chars' => 0,
'encoding_translation' => 'Off',
'language' => self::$language,
'detect_order' => self::$encodingList,
'substitute_character' => 'none',
'strict_detection' => 'Off',
);

if ('all' === $type) {
return $info;
}
if (isset($info[$type])) {
return $info[$type];
}

return false;
}

public static function mb_http_input($type = '')
{
return false;
}

public static function mb_http_output($encoding = null)
{
return null !== $encoding ? 'pass' === $encoding : 'pass';
}

public static function mb_strwidth($s, $encoding = null)
{
$encoding = self::getEncoding($encoding);

if ('UTF-8' !== $encoding) {
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
}

$s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);

return ($wide << 1) + iconv_strlen($s, 'UTF-8');
}

public static function mb_substr_count($haystack, $needle, $encoding = null)
{
return substr_count($haystack, $needle);
}

public static function mb_output_handler($contents, $status)
{
return $contents;
}

public static function mb_chr($code, $encoding = null)
{
if (0x80 > $code %= 0x200000) {
$s = \chr($code);
} elseif (0x800 > $code) {
$s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
} elseif (0x10000 > $code) {
$s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
} else {
$s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
}

if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
$s = mb_convert_encoding($s, $encoding, 'UTF-8');
}

return $s;
}

public static function mb_ord($s, $encoding = null)
{
if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
$s = mb_convert_encoding($s, 'UTF-8', $encoding);
}

if (1 === \strlen($s)) {
return \ord($s);
}

$code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
if (0xF0 <= $code) {
return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
}
if (0xE0 <= $code) {
return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
}
if (0xC0 <= $code) {
return (($code - 0xC0) << 6) + $s[2] - 0x80;
}

return $code;
}

private static function getSubpart($pos, $part, $haystack, $encoding)
{
if (false === $pos) {
return false;
}
if ($part) {
return self::mb_substr($haystack, 0, $pos, $encoding);
}

return self::mb_substr($haystack, $pos, null, $encoding);
}

private static function html_encoding_callback(array $m)
{
$i = 1;
$entities = '';
$m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));

while (isset($m[$i])) {
if (0x80 > $m[$i]) {
$entities .= \chr($m[$i++]);
continue;
}
if (0xF0 <= $m[$i]) {
$c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} elseif (0xE0 <= $m[$i]) {
$c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
} else {
$c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
}

$entities .= '&#'.$c.';';
}

return $entities;
}

private static function title_case(array $s)
{
return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
}

private static function getData($file)
{
if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
return require $file;
}

return false;
}

private static function getEncoding($encoding)
{
if (null === $encoding) {
return self::$internalEncoding;
}

if ('UTF-8' === $encoding) {
return 'UTF-8';
}

$encoding = strtoupper($encoding);

if ('8BIT' === $encoding || 'BINARY' === $encoding) {
return 'CP850';
}

if ('UTF8' === $encoding) {
return 'UTF-8';
}

return $encoding;
}
}
<?php










namespace Symfony\Component\Filesystem;

use Symfony\Component\Filesystem\Exception\FileNotFoundException;
use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
use Symfony\Component\Filesystem\Exception\IOException;






class Filesystem
{
private static $lastError;















public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
{
$originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
if ($originIsLocal && !is_file($originFile)) {
throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
}

$this->mkdir(\dirname($targetFile));

$doCopy = true;
if (!$overwriteNewerFiles && null === parse_url($originFile, \PHP_URL_HOST) && is_file($targetFile)) {
$doCopy = filemtime($originFile) > filemtime($targetFile);
}

if ($doCopy) {

 if (false === $source = @fopen($originFile, 'r')) {
throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
}


 if (false === $target = @fopen($targetFile, 'w', false, stream_context_create(['ftp' => ['overwrite' => true]]))) {
throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
}

$bytesCopied = stream_copy_to_stream($source, $target);
fclose($source);
fclose($target);
unset($source, $target);

if (!is_file($targetFile)) {
throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
}

if ($originIsLocal) {

 @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));

if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
}
}
}
}









public function mkdir($dirs, $mode = 0777)
{
foreach ($this->toIterable($dirs) as $dir) {
if (is_dir($dir)) {
continue;
}

if (!self::box('mkdir', $dir, $mode, true)) {
if (!is_dir($dir)) {

 if (self::$lastError) {
throw new IOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
}
throw new IOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir);
}
}
}
}








public function exists($files)
{
$maxPathLength = \PHP_MAXPATHLEN - 2;

foreach ($this->toIterable($files) as $file) {
if (\strlen($file) > $maxPathLength) {
throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
}

if (!file_exists($file)) {
return false;
}
}

return true;
}










public function touch($files, $time = null, $atime = null)
{
foreach ($this->toIterable($files) as $file) {
$touch = $time ? @touch($file, $time, $atime) : @touch($file);
if (true !== $touch) {
throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
}
}
}








public function remove($files)
{
if ($files instanceof \Traversable) {
$files = iterator_to_array($files, false);
} elseif (!\is_array($files)) {
$files = [$files];
}
$files = array_reverse($files);
foreach ($files as $file) {
if (is_link($file)) {

 if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
throw new IOException(sprintf('Failed to remove symlink "%s": ', $file).self::$lastError);
}
} elseif (is_dir($file)) {
$this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));

if (!self::box('rmdir', $file) && file_exists($file)) {
throw new IOException(sprintf('Failed to remove directory "%s": ', $file).self::$lastError);
}
} elseif (!self::box('unlink', $file) && (str_contains(self::$lastError, 'Permission denied') || file_exists($file))) {
throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
}
}
}











public function chmod($files, $mode, $umask = 0000, $recursive = false)
{
foreach ($this->toIterable($files) as $file) {
if ((\PHP_VERSION_ID < 80000 || \is_int($mode)) && true !== @chmod($file, $mode & ~$umask)) {
throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
}
if ($recursive && is_dir($file) && !is_link($file)) {
$this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
}
}
}










public function chown($files, $user, $recursive = false)
{
foreach ($this->toIterable($files) as $file) {
if ($recursive && is_dir($file) && !is_link($file)) {
$this->chown(new \FilesystemIterator($file), $user, true);
}
if (is_link($file) && \function_exists('lchown')) {
if (true !== @lchown($file, $user)) {
throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
}
} else {
if (true !== @chown($file, $user)) {
throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
}
}
}
}










public function chgrp($files, $group, $recursive = false)
{
foreach ($this->toIterable($files) as $file) {
if ($recursive && is_dir($file) && !is_link($file)) {
$this->chgrp(new \FilesystemIterator($file), $group, true);
}
if (is_link($file) && \function_exists('lchgrp')) {
if (true !== @lchgrp($file, $group)) {
throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
}
} else {
if (true !== @chgrp($file, $group)) {
throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
}
}
}
}











public function rename($origin, $target, $overwrite = false)
{

 if (!$overwrite && $this->isReadable($target)) {
throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
}

if (true !== @rename($origin, $target)) {
if (is_dir($origin)) {

 $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);
$this->remove($origin);

return;
}
throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
}
}






private function isReadable(string $filename): bool
{
$maxPathLength = \PHP_MAXPATHLEN - 2;

if (\strlen($filename) > $maxPathLength) {
throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
}

return is_readable($filename);
}










public function symlink($originDir, $targetDir, $copyOnWindows = false)
{
if ('\\' === \DIRECTORY_SEPARATOR) {
$originDir = strtr($originDir, '/', '\\');
$targetDir = strtr($targetDir, '/', '\\');

if ($copyOnWindows) {
$this->mirror($originDir, $targetDir);

return;
}
}

$this->mkdir(\dirname($targetDir));

if (is_link($targetDir)) {
if (readlink($targetDir) === $originDir) {
return;
}
$this->remove($targetDir);
}

if (!self::box('symlink', $originDir, $targetDir)) {
$this->linkException($originDir, $targetDir, 'symbolic');
}
}










public function hardlink($originFile, $targetFiles)
{
if (!$this->exists($originFile)) {
throw new FileNotFoundException(null, 0, null, $originFile);
}

if (!is_file($originFile)) {
throw new FileNotFoundException(sprintf('Origin file "%s" is not a file.', $originFile));
}

foreach ($this->toIterable($targetFiles) as $targetFile) {
if (is_file($targetFile)) {
if (fileinode($originFile) === fileinode($targetFile)) {
continue;
}
$this->remove($targetFile);
}

if (!self::box('link', $originFile, $targetFile)) {
$this->linkException($originFile, $targetFile, 'hard');
}
}
}




private function linkException(string $origin, string $target, string $linkType)
{
if (self::$lastError) {
if ('\\' === \DIRECTORY_SEPARATOR && str_contains(self::$lastError, 'error code(1314)')) {
throw new IOException(sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
}
}
throw new IOException(sprintf('Failed to create "%s" link from "%s" to "%s".', $linkType, $origin, $target), 0, null, $target);
}

















public function readlink($path, $canonicalize = false)
{
if (!$canonicalize && !is_link($path)) {
return null;
}

if ($canonicalize) {
if (!$this->exists($path)) {
return null;
}

if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70410) {
$path = readlink($path);
}

return realpath($path);
}

if ('\\' === \DIRECTORY_SEPARATOR && \PHP_VERSION_ID < 70400) {
return realpath($path);
}

return readlink($path);
}









public function makePathRelative($endPath, $startPath)
{
if (!$this->isAbsolutePath($startPath)) {
throw new InvalidArgumentException(sprintf('The start path "%s" is not absolute.', $startPath));
}

if (!$this->isAbsolutePath($endPath)) {
throw new InvalidArgumentException(sprintf('The end path "%s" is not absolute.', $endPath));
}


 if ('\\' === \DIRECTORY_SEPARATOR) {
$endPath = str_replace('\\', '/', $endPath);
$startPath = str_replace('\\', '/', $startPath);
}

$splitDriveLetter = function ($path) {
return (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0]))
? [substr($path, 2), strtoupper($path[0])]
: [$path, null];
};

$splitPath = function ($path) {
$result = [];

foreach (explode('/', trim($path, '/')) as $segment) {
if ('..' === $segment) {
array_pop($result);
} elseif ('.' !== $segment && '' !== $segment) {
$result[] = $segment;
}
}

return $result;
};

[$endPath, $endDriveLetter] = $splitDriveLetter($endPath);
[$startPath, $startDriveLetter] = $splitDriveLetter($startPath);

$startPathArr = $splitPath($startPath);
$endPathArr = $splitPath($endPath);

if ($endDriveLetter && $startDriveLetter && $endDriveLetter != $startDriveLetter) {

 return $endDriveLetter.':/'.($endPathArr ? implode('/', $endPathArr).'/' : '');
}


 $index = 0;
while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
++$index;
}


 if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
$depth = 0;
} else {
$depth = \count($startPathArr) - $index;
}


 $traverser = str_repeat('../', $depth);

$endPathRemainder = implode('/', \array_slice($endPathArr, $index));


 $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');

return '' === $relativePath ? './' : $relativePath;
}




















public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = [])
{
$targetDir = rtrim($targetDir, '/\\');
$originDir = rtrim($originDir, '/\\');
$originDirLen = \strlen($originDir);

if (!$this->exists($originDir)) {
throw new IOException(sprintf('The origin directory specified "%s" was not found.', $originDir), 0, null, $originDir);
}


 if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
$deleteIterator = $iterator;
if (null === $deleteIterator) {
$flags = \FilesystemIterator::SKIP_DOTS;
$deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
}
$targetDirLen = \strlen($targetDir);
foreach ($deleteIterator as $file) {
$origin = $originDir.substr($file->getPathname(), $targetDirLen);
if (!$this->exists($origin)) {
$this->remove($file);
}
}
}

$copyOnWindows = $options['copy_on_windows'] ?? false;

if (null === $iterator) {
$flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
}

$this->mkdir($targetDir);
$filesCreatedWhileMirroring = [];

foreach ($iterator as $file) {
if ($file->getPathname() === $targetDir || $file->getRealPath() === $targetDir || isset($filesCreatedWhileMirroring[$file->getRealPath()])) {
continue;
}

$target = $targetDir.substr($file->getPathname(), $originDirLen);
$filesCreatedWhileMirroring[$target] = true;

if (!$copyOnWindows && is_link($file)) {
$this->symlink($file->getLinkTarget(), $target);
} elseif (is_dir($file)) {
$this->mkdir($target);
} elseif (is_file($file)) {
$this->copy($file, $target, $options['override'] ?? false);
} else {
throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
}
}
}








public function isAbsolutePath($file)
{
if (null === $file) {
@trigger_error(sprintf('Calling "%s()" with a null in the $file argument is deprecated since Symfony 4.4.', __METHOD__), \E_USER_DEPRECATED);
}

return '' !== (string) $file && (strspn($file, '/\\', 0, 1)
|| (\strlen($file) > 3 && ctype_alpha($file[0])
&& ':' === $file[1]
&& strspn($file, '/\\', 2, 1)
)
|| null !== parse_url($file, \PHP_URL_SCHEME)
);
}










public function tempnam($dir, $prefix)
{
[$scheme, $hierarchy] = $this->getSchemeAndHierarchy($dir);


 if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
$tmpFile = @tempnam($hierarchy, $prefix);


 if (false !== $tmpFile) {
if (null !== $scheme && 'gs' !== $scheme) {
return $scheme.'://'.$tmpFile;
}

return $tmpFile;
}

throw new IOException('A temporary file could not be created.');
}


 for ($i = 0; $i < 10; ++$i) {

 $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);


 
 $handle = @fopen($tmpFile, 'x+');


 if (false === $handle) {
continue;
}


 @fclose($handle);

return $tmpFile;
}

throw new IOException('A temporary file could not be created.');
}









public function dumpFile($filename, $content)
{
if (\is_array($content)) {
@trigger_error(sprintf('Calling "%s()" with an array in the $content argument is deprecated since Symfony 4.3.', __METHOD__), \E_USER_DEPRECATED);
}

$dir = \dirname($filename);

if (!is_dir($dir)) {
$this->mkdir($dir);
}


 
 $tmpFile = $this->tempnam($dir, basename($filename));

try {
if (false === @file_put_contents($tmpFile, $content)) {
throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
}

@chmod($tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask());

$this->rename($tmpFile, $filename, true);
} finally {
if (file_exists($tmpFile)) {
@unlink($tmpFile);
}
}
}









public function appendToFile($filename, $content)
{
if (\is_array($content)) {
@trigger_error(sprintf('Calling "%s()" with an array in the $content argument is deprecated since Symfony 4.3.', __METHOD__), \E_USER_DEPRECATED);
}

$dir = \dirname($filename);

if (!is_dir($dir)) {
$this->mkdir($dir);
}

if (false === @file_put_contents($filename, $content, \FILE_APPEND)) {
throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
}
}

private function toIterable($files): iterable
{
return is_iterable($files) ? $files : [$files];
}




private function getSchemeAndHierarchy(string $filename): array
{
$components = explode('://', $filename, 2);

return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]];
}






private static function box(callable $func, ...$args)
{
self::$lastError = null;
set_error_handler(__CLASS__.'::handleError');
try {
$result = $func(...$args);
restore_error_handler();

return $result;
} catch (\Throwable $e) {
}
restore_error_handler();

throw $e;
}




public static function handleError(int $type, string $msg)
{
self::$lastError = $msg;
}
}
<?php










namespace Symfony\Component\Filesystem\Exception;






interface ExceptionInterface extends \Throwable
{
}
<?php










namespace Symfony\Component\Filesystem\Exception;

/**
@googlemail



*/
class FileNotFoundException extends IOException
{
public function __construct(string $message = null, int $code = 0, \Throwable $previous = null, string $path = null)
{
if (null === $message) {
if (null === $path) {
$message = 'File could not be found.';
} else {
$message = sprintf('File "%s" could not be found.', $path);
}
}

parent::__construct($message, $code, $previous, $path);
}
}
<?php










namespace Symfony\Component\Filesystem\Exception;






interface IOExceptionInterface extends ExceptionInterface
{





public function getPath();
}
<?php










namespace Symfony\Component\Filesystem\Exception;




class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}
<?php










namespace Symfony\Component\Filesystem\Exception;

/**
@googlemail
@symfony



*/
class IOException extends \RuntimeException implements IOExceptionInterface
{
private $path;

public function __construct(string $message, int $code = 0, \Throwable $previous = null, string $path = null)
{
$this->path = $path;

parent::__construct($message, $code, $previous);
}




public function getPath()
{
return $this->path;
}
}
<?php










use Symfony\Polyfill\Ctype as p;

if (!function_exists('ctype_alnum')) {
function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
function ctype_print($text) { return p\Ctype::ctype_print($text); }
function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
function ctype_space($text) { return p\Ctype::ctype_space($text); }
function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
}
<?php










namespace Symfony\Polyfill\Ctype;








final class Ctype
{









public static function ctype_alnum($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
}










public static function ctype_alpha($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
}










public static function ctype_cntrl($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
}










public static function ctype_digit($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
}










public static function ctype_graph($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
}










public static function ctype_lower($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
}










public static function ctype_print($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
}










public static function ctype_punct($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
}










public static function ctype_space($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
}










public static function ctype_upper($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
}










public static function ctype_xdigit($text)
{
$text = self::convert_int_to_char_for_ctype($text);

return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
}













private static function convert_int_to_char_for_ctype($int)
{
if (!\is_int($int)) {
return $int;
}

if ($int < -128 || $int > 255) {
return (string) $int;
}

if ($int < 0) {
$int += 256;
}

return \chr($int);
}
}
<?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\Input\InputAwareInterface;
use Symfony\Component\Console\Input\InputInterface;






abstract class InputAwareHelper extends Helper implements InputAwareInterface
{
protected $input;




public function setInput(InputInterface $input)
{
$this->input = $input;
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Output\OutputInterface;




class ProgressIndicator
{
private $output;
private $startTime;
private $format;
private $message;
private $indicatorValues;
private $indicatorCurrent;
private $indicatorChangeInterval;
private $indicatorUpdateTime;
private $started = false;

private static $formatters;
private static $formats;






public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null)
{
$this->output = $output;

if (null === $format) {
$format = $this->determineBestFormat();
}

if (null === $indicatorValues) {
$indicatorValues = ['-', '\\', '|', '/'];
}

$indicatorValues = array_values($indicatorValues);

if (2 > \count($indicatorValues)) {
throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
}

$this->format = self::getFormatDefinition($format);
$this->indicatorChangeInterval = $indicatorChangeInterval;
$this->indicatorValues = $indicatorValues;
$this->startTime = time();
}






public function setMessage($message)
{
$this->message = $message;

$this->display();
}






public function start($message)
{
if ($this->started) {
throw new LogicException('Progress indicator already started.');
}

$this->message = $message;
$this->started = true;
$this->startTime = time();
$this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
$this->indicatorCurrent = 0;

$this->display();
}




public function advance()
{
if (!$this->started) {
throw new LogicException('Progress indicator has not yet been started.');
}

if (!$this->output->isDecorated()) {
return;
}

$currentTime = $this->getCurrentTimeInMilliseconds();

if ($currentTime < $this->indicatorUpdateTime) {
return;
}

$this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
++$this->indicatorCurrent;

$this->display();
}






public function finish($message)
{
if (!$this->started) {
throw new LogicException('Progress indicator has not yet been started.');
}

$this->message = $message;
$this->display();
$this->output->writeln('');
$this->started = false;
}








public static function getFormatDefinition($name)
{
if (!self::$formats) {
self::$formats = self::initFormats();
}

return self::$formats[$name] ?? null;
}









public static function setPlaceholderFormatterDefinition($name, $callable)
{
if (!self::$formatters) {
self::$formatters = self::initPlaceholderFormatters();
}

self::$formatters[$name] = $callable;
}








public static function getPlaceholderFormatterDefinition($name)
{
if (!self::$formatters) {
self::$formatters = self::initPlaceholderFormatters();
}

return self::$formatters[$name] ?? null;
}

private function display()
{
if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
return;
}

$this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) {
if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) {
return $formatter($this);
}

return $matches[0];
}, $this->format ?? ''));
}

private function determineBestFormat(): string
{
switch ($this->output->getVerbosity()) {

 case OutputInterface::VERBOSITY_VERBOSE:
return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
case OutputInterface::VERBOSITY_VERY_VERBOSE:
case OutputInterface::VERBOSITY_DEBUG:
return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
default:
return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
}
}




private function overwrite(string $message)
{
if ($this->output->isDecorated()) {
$this->output->write("\x0D\x1B[2K");
$this->output->write($message);
} else {
$this->output->writeln($message);
}
}

private function getCurrentTimeInMilliseconds(): float
{
return round(microtime(true) * 1000);
}

private static function initPlaceholderFormatters(): array
{
return [
'indicator' => function (self $indicator) {
return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)];
},
'message' => function (self $indicator) {
return $indicator->message;
},
'elapsed' => function (self $indicator) {
return Helper::formatTime(time() - $indicator->startTime);
},
'memory' => function () {
return Helper::formatMemory(memory_get_usage(true));
},
];
}

private static function initFormats(): array
{
return [
'normal' => ' %indicator% %message%',
'normal_no_ansi' => ' %message%',

'verbose' => ' %indicator% %message% (%elapsed:6s%)',
'verbose_no_ansi' => ' %message% (%elapsed:6s%)',

'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
];
}
}
<?php










namespace Symfony\Component\Console\Helper;






class TableSeparator extends TableCell
{
public function __construct(array $options = [])
{
parent::__construct('', $options);
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\InvalidArgumentException;






class HelperSet implements \IteratorAggregate
{



private $helpers = [];
private $command;




public function __construct(array $helpers = [])
{
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;
}





 public function getIterator()
{
return new \ArrayIterator($this->helpers);
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Style\SymfonyStyle;






class SymfonyQuestionHelper extends QuestionHelper
{



protected function writePrompt(OutputInterface $output, Question $question)
{
$text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
$default = $question->getDefault();

switch (true) {
case null === $default:
$text = sprintf(' <info>%s</info>:', $text);

break;

case $question instanceof ConfirmationQuestion:
$text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');

break;

case $question instanceof ChoiceQuestion && $question->isMultiselect():
$choices = $question->getChoices();
$default = explode(',', $default);

foreach ($default as $key => $value) {
$default[$key] = $choices[trim($value)];
}

$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));

break;

case $question instanceof ChoiceQuestion:
$choices = $question->getChoices();
$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default] ?? $default));

break;

default:
$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
}

$output->writeln($text);

$prompt = ' > ';

if ($question instanceof ChoiceQuestion) {
$output->writeln($this->formatChoiceQuestionChoices($question, 'comment'));

$prompt = $question->getPrompt();
}

$output->write($prompt);
}




protected function writeError(OutputInterface $output, \Exception $error)
{
if ($output instanceof SymfonyStyle) {
$output->newLine();
$output->error($error->getMessage());

return;
}

parent::writeError($output, $error);
}
}
<?php










namespace Symfony\Component\Console\Helper;








class DebugFormatterHelper extends Helper
{
private $colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default'];
private $started = [];
private $count = -1;










public function start($id, $message, $prefix = 'RUN')
{
$this->started[$id] = ['border' => ++$this->count % \count($this->colors)];

return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
}












public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
{
$message = '';

if ($error) {
if (isset($this->started[$id]['out'])) {
$message .= "\n";
unset($this->started[$id]['out']);
}
if (!isset($this->started[$id]['err'])) {
$message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
$this->started[$id]['err'] = true;
}

$message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
} else {
if (isset($this->started[$id]['err'])) {
$message .= "\n";
unset($this->started[$id]['err']);
}
if (!isset($this->started[$id]['out'])) {
$message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
$this->started[$id]['out'] = true;
}

$message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
}

return $message;
}











public function stop($id, $message, $successful, $prefix = 'RES')
{
$trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';

if ($successful) {
return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
}

$message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);

unset($this->started[$id]['out'], $this->started[$id]['err']);

return $message;
}

private function getBorder(string $id): string
{
return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
}




public function getName()
{
return 'debug_formatter';
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;






abstract class Helper implements HelperInterface
{
protected $helperSet = null;




public function setHelperSet(HelperSet $helperSet = null)
{
$this->helperSet = $helperSet;
}




public function getHelperSet()
{
return $this->helperSet;
}








public static function strlen($string)
{
$string = (string) $string;

if (false === $encoding = mb_detect_encoding($string, null, true)) {
return \strlen($string);
}

return mb_strwidth($string, $encoding);
}










public static function substr($string, $from, $length = null)
{
$string = (string) $string;

if (false === $encoding = mb_detect_encoding($string, null, true)) {
return substr($string, $from, $length);
}

return mb_substr($string, $from, $length, $encoding);
}

public static function formatTime($secs)
{
static $timeFormats = [
[0, '< 1 sec'],
[1, '1 sec'],
[2, 'secs', 1],
[60, '1 min'],
[120, 'mins', 60],
[3600, '1 hr'],
[7200, 'hrs', 3600],
[86400, '1 day'],
[172800, 'days', 86400],
];

foreach ($timeFormats as $index => $format) {
if ($secs >= $format[0]) {
if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
|| $index == \count($timeFormats) - 1
) {
if (2 == \count($format)) {
return $format[1];
}

return floor($secs / $format[2]).' '.$format[1];
}
}
}
}

public static function formatMemory($memory)
{
if ($memory >= 1024 * 1024 * 1024) {
return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
}

if ($memory >= 1024 * 1024) {
return sprintf('%.1f MiB', $memory / 1024 / 1024);
}

if ($memory >= 1024) {
return sprintf('%d KiB', $memory / 1024);
}

return sprintf('%d B', $memory);
}

public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
{
return self::strlen(self::removeDecoration($formatter, $string));
}

public static function removeDecoration(OutputFormatterInterface $formatter, $string)
{
$isDecorated = $formatter->isDecorated();
$formatter->setDecorated(false);

 $string = $formatter->format($string);

 $string = preg_replace("/\033\[[^m]*m/", '', $string);
$formatter->setDecorated($isDecorated);

return $string;
}
}
<?php










namespace Symfony\Component\Console\Helper;




class TableRows implements \IteratorAggregate
{
private $generator;

public function __construct(callable $generator)
{
$this->generator = $generator;
}

public function getIterator(): \Traversable
{
$g = $this->generator;

return $g();
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\CliDumper;




final class Dumper
{
private $output;
private $dumper;
private $cloner;
private $handler;

public function __construct(OutputInterface $output, CliDumper $dumper = null, ClonerInterface $cloner = null)
{
$this->output = $output;
$this->dumper = $dumper;
$this->cloner = $cloner;

if (class_exists(CliDumper::class)) {
$this->handler = function ($var): string {
$dumper = $this->dumper ?? $this->dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
$dumper->setColors($this->output->isDecorated());

return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true));
};
} else {
$this->handler = function ($var): string {
switch (true) {
case null === $var:
return 'null';
case true === $var:
return 'true';
case false === $var:
return 'false';
case \is_string($var):
return '"'.$var.'"';
default:
return rtrim(print_r($var, true));
}
};
}
}

public function __invoke($var): string
{
return ($this->handler)($var);
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;








class ProcessHelper extends Helper
{











public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
{
if (!class_exists(Process::class)) {
throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
}

if ($output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput();
}

$formatter = $this->getHelperSet()->get('debug_formatter');

if ($cmd instanceof Process) {
$cmd = [$cmd];
}

if (!\is_array($cmd)) {
@trigger_error(sprintf('Passing a command as a string to "%s()" is deprecated since Symfony 4.2, pass it the command as an array of arguments instead.', __METHOD__), \E_USER_DEPRECATED);
$cmd = [method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)];
}

if (\is_string($cmd[0] ?? null)) {
$process = new Process($cmd);
$cmd = [];
} elseif (($cmd[0] ?? null) instanceof Process) {
$process = $cmd[0];
unset($cmd[0]);
} else {
throw new \InvalidArgumentException(sprintf('Invalid command provided to "%s()": the command should be an array whose first element is either the path to the binary to run or a "Process" object.', __METHOD__));
}

if ($verbosity <= $output->getVerbosity()) {
$output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
}

if ($output->isDebug()) {
$callback = $this->wrapCallback($output, $process, $callback);
}

$process->run($callback, $cmd);

if ($verbosity <= $output->getVerbosity()) {
$message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
$output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
}

if (!$process->isSuccessful() && null !== $error) {
$output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
}

return $process;
}


















public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null)
{
$process = $this->run($output, $cmd, $error, $callback);

if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}

return $process;
}






public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null)
{
if ($output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput();
}

$formatter = $this->getHelperSet()->get('debug_formatter');

return function ($type, $buffer) use ($output, $process, $callback, $formatter) {
$output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type));

if (null !== $callback) {
$callback($type, $buffer);
}
};
}

private function escapeString(string $str): string
{
return str_replace('<', '\\<', $str);
}




public function getName()
{
return 'process';
}
}
<?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)
{
if (!\is_array($messages)) {
$messages = [$messages];
}

$len = 0;
$lines = [];
foreach ($messages as $message) {
$message = OutputFormatter::escape($message);
$lines[] = sprintf($large ? '  %s  ' : ' %s ', $message);
$len = max(self::strlen($message) + ($large ? 4 : 2), $len);
}

$messages = $large ? [str_repeat(' ', $len)] : [];
for ($i = 0; isset($lines[$i]); ++$i) {
$messages[] = $lines[$i].str_repeat(' ', $len - self::strlen($lines[$i]));
}
if ($large) {
$messages[] = str_repeat(' ', $len);
}

for ($i = 0; isset($messages[$i]); ++$i) {
$messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
}

return implode("\n", $messages);
}










public function truncate($message, $length, $suffix = '...')
{
$computedLength = $length - self::strlen($suffix);

if ($computedLength > self::strlen($message)) {
return $message;
}

return self::substr($message, 0, $length).$suffix;
}




public function getName()
{
return 'formatter';
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Descriptor\DescriptorInterface;
use Symfony\Component\Console\Descriptor\JsonDescriptor;
use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
use Symfony\Component\Console\Descriptor\TextDescriptor;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Output\OutputInterface;






class DescriptorHelper extends Helper
{



private $descriptors = [];

public function __construct()
{
$this
->register('txt', new TextDescriptor())
->register('xml', new XmlDescriptor())
->register('json', new JsonDescriptor())
->register('md', new MarkdownDescriptor())
;
}












public function describe(OutputInterface $output, $object, array $options = [])
{
$options = array_merge([
'raw_text' => false,
'format' => 'txt',
], $options);

if (!isset($this->descriptors[$options['format']])) {
throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
}

$descriptor = $this->descriptors[$options['format']];
$descriptor->describe($output, $object, $options);
}








public function register($format, DescriptorInterface $descriptor)
{
$this->descriptors[$format] = $descriptor;

return $this;
}




public function getName()
{
return 'descriptor';
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;

/**
@gmail
@gmail



*/
class TableStyle
{
private $paddingChar = ' ';
private $horizontalOutsideBorderChar = '-';
private $horizontalInsideBorderChar = '-';
private $verticalOutsideBorderChar = '|';
private $verticalInsideBorderChar = '|';
private $crossingChar = '+';
private $crossingTopRightChar = '+';
private $crossingTopMidChar = '+';
private $crossingTopLeftChar = '+';
private $crossingMidRightChar = '+';
private $crossingBottomRightChar = '+';
private $crossingBottomMidChar = '+';
private $crossingBottomLeftChar = '+';
private $crossingMidLeftChar = '+';
private $crossingTopLeftBottomChar = '+';
private $crossingTopMidBottomChar = '+';
private $crossingTopRightBottomChar = '+';
private $headerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
private $footerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
private $cellHeaderFormat = '<info>%s</info>';
private $cellRowFormat = '%s';
private $cellRowContentFormat = ' %s ';
private $borderFormat = '%s';
private $padType = \STR_PAD_RIGHT;








public function setPaddingChar($paddingChar)
{
if (!$paddingChar) {
throw new LogicException('The padding char must not be empty.');
}

$this->paddingChar = $paddingChar;

return $this;
}






public function getPaddingChar()
{
return $this->paddingChar;
}


















public function setHorizontalBorderChars(string $outside, string $inside = null): self
{
$this->horizontalOutsideBorderChar = $outside;
$this->horizontalInsideBorderChar = $inside ?? $outside;

return $this;
}










public function setHorizontalBorderChar($horizontalBorderChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), \E_USER_DEPRECATED);

return $this->setHorizontalBorderChars($horizontalBorderChar, $horizontalBorderChar);
}








public function getHorizontalBorderChar()
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), \E_USER_DEPRECATED);

return $this->horizontalOutsideBorderChar;
}



















public function setVerticalBorderChars(string $outside, string $inside = null): self
{
$this->verticalOutsideBorderChar = $outside;
$this->verticalInsideBorderChar = $inside ?? $outside;

return $this;
}










public function setVerticalBorderChar($verticalBorderChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), \E_USER_DEPRECATED);

return $this->setVerticalBorderChars($verticalBorderChar, $verticalBorderChar);
}








public function getVerticalBorderChar()
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), \E_USER_DEPRECATED);

return $this->verticalOutsideBorderChar;
}






public function getBorderChars(): array
{
return [
$this->horizontalOutsideBorderChar,
$this->verticalOutsideBorderChar,
$this->horizontalInsideBorderChar,
$this->verticalInsideBorderChar,
];
}






























public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self
{
$this->crossingChar = $cross;
$this->crossingTopLeftChar = $topLeft;
$this->crossingTopMidChar = $topMid;
$this->crossingTopRightChar = $topRight;
$this->crossingMidRightChar = $midRight;
$this->crossingBottomRightChar = $bottomRight;
$this->crossingBottomMidChar = $bottomMid;
$this->crossingBottomLeftChar = $bottomLeft;
$this->crossingMidLeftChar = $midLeft;
$this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
$this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
$this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;

return $this;
}






public function setDefaultCrossingChar(string $char): self
{
return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
}










public function setCrossingChar($crossingChar)
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use setDefaultCrossingChar() instead.', __METHOD__), \E_USER_DEPRECATED);

return $this->setDefaultCrossingChar($crossingChar);
}






public function getCrossingChar()
{
return $this->crossingChar;
}






public function getCrossingChars(): array
{
return [
$this->crossingChar,
$this->crossingTopLeftChar,
$this->crossingTopMidChar,
$this->crossingTopRightChar,
$this->crossingMidRightChar,
$this->crossingBottomRightChar,
$this->crossingBottomMidChar,
$this->crossingBottomLeftChar,
$this->crossingMidLeftChar,
$this->crossingTopLeftBottomChar,
$this->crossingTopMidBottomChar,
$this->crossingTopRightBottomChar,
];
}








public function setCellHeaderFormat($cellHeaderFormat)
{
$this->cellHeaderFormat = $cellHeaderFormat;

return $this;
}






public function getCellHeaderFormat()
{
return $this->cellHeaderFormat;
}








public function setCellRowFormat($cellRowFormat)
{
$this->cellRowFormat = $cellRowFormat;

return $this;
}






public function getCellRowFormat()
{
return $this->cellRowFormat;
}








public function setCellRowContentFormat($cellRowContentFormat)
{
$this->cellRowContentFormat = $cellRowContentFormat;

return $this;
}






public function getCellRowContentFormat()
{
return $this->cellRowContentFormat;
}








public function setBorderFormat($borderFormat)
{
$this->borderFormat = $borderFormat;

return $this;
}






public function getBorderFormat()
{
return $this->borderFormat;
}








public function setPadType($padType)
{
if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) {
throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
}

$this->padType = $padType;

return $this;
}






public function getPadType()
{
return $this->padType;
}

public function getHeaderTitleFormat(): string
{
return $this->headerTitleFormat;
}

public function setHeaderTitleFormat(string $format): self
{
$this->headerTitleFormat = $format;

return $this;
}

public function getFooterTitleFormat(): string
{
return $this->footerTitleFormat;
}

public function setFooterTitleFormat(string $format): self
{
$this->footerTitleFormat = $format;

return $this;
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Exception\InvalidArgumentException;




class TableCell
{
private $value;
private $options = [
'rowspan' => 1,
'colspan' => 1,
];

public function __construct(string $value = '', array $options = [])
{
$this->value = $value;


 if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
}

$this->options = array_merge($this->options, $options);
}






public function __toString()
{
return $this->value;
}






public function getColspan()
{
return (int) $this->options['colspan'];
}






public function getRowspan()
{
return (int) $this->options['rowspan'];
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\ConsoleSectionOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Terminal;

/**
@gmail



*/
final class ProgressBar
{
private $barWidth = 28;
private $barChar;
private $emptyBarChar = '-';
private $progressChar = '>';
private $format;
private $internalFormat;
private $redrawFreq = 1;
private $writeCount;
private $lastWriteTime;
private $minSecondsBetweenRedraws = 0;
private $maxSecondsBetweenRedraws = 1;
private $output;
private $step = 0;
private $max;
private $startTime;
private $stepWidth;
private $percent = 0.0;
private $formatLineCount;
private $messages = [];
private $overwrite = true;
private $terminal;
private $previousMessage;

private static $formatters;
private static $formats;




public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 0.1)
{
if ($output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput();
}

$this->output = $output;
$this->setMaxSteps($max);
$this->terminal = new Terminal();

if (0 < $minSecondsBetweenRedraws) {
$this->redrawFreq = null;
$this->minSecondsBetweenRedraws = $minSecondsBetweenRedraws;
}

if (!$this->output->isDecorated()) {

 $this->overwrite = false;


 $this->redrawFreq = null;
}

$this->startTime = time();
}









public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void
{
if (!self::$formatters) {
self::$formatters = self::initPlaceholderFormatters();
}

self::$formatters[$name] = $callable;
}








public static function getPlaceholderFormatterDefinition(string $name): ?callable
{
if (!self::$formatters) {
self::$formatters = self::initPlaceholderFormatters();
}

return self::$formatters[$name] ?? null;
}









public static function setFormatDefinition(string $name, string $format): void
{
if (!self::$formats) {
self::$formats = self::initFormats();
}

self::$formats[$name] = $format;
}








public static function getFormatDefinition(string $name): ?string
{
if (!self::$formats) {
self::$formats = self::initFormats();
}

return self::$formats[$name] ?? null;
}











public function setMessage(string $message, string $name = 'message')
{
$this->messages[$name] = $message;
}

public function getMessage(string $name = 'message')
{
return $this->messages[$name];
}

public function getStartTime(): int
{
return $this->startTime;
}

public function getMaxSteps(): int
{
return $this->max;
}

public function getProgress(): int
{
return $this->step;
}

private function getStepWidth(): int
{
return $this->stepWidth;
}

public function getProgressPercent(): float
{
return $this->percent;
}

public function getBarOffset(): int
{
return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth);
}

public function setBarWidth(int $size)
{
$this->barWidth = max(1, $size);
}

public function getBarWidth(): int
{
return $this->barWidth;
}

public function setBarCharacter(string $char)
{
$this->barChar = $char;
}

public function getBarCharacter(): string
{
if (null === $this->barChar) {
return $this->max ? '=' : $this->emptyBarChar;
}

return $this->barChar;
}

public function setEmptyBarCharacter(string $char)
{
$this->emptyBarChar = $char;
}

public function getEmptyBarCharacter(): string
{
return $this->emptyBarChar;
}

public function setProgressCharacter(string $char)
{
$this->progressChar = $char;
}

public function getProgressCharacter(): string
{
return $this->progressChar;
}

public function setFormat(string $format)
{
$this->format = null;
$this->internalFormat = $format;
}






public function setRedrawFrequency(?int $freq)
{
$this->redrawFreq = null !== $freq ? max(1, $freq) : null;
}

public function minSecondsBetweenRedraws(float $seconds): void
{
$this->minSecondsBetweenRedraws = $seconds;
}

public function maxSecondsBetweenRedraws(float $seconds): void
{
$this->maxSecondsBetweenRedraws = $seconds;
}






public function iterate(iterable $iterable, int $max = null): iterable
{
$this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0));

foreach ($iterable as $key => $value) {
yield $key => $value;

$this->advance();
}

$this->finish();
}






public function start(int $max = null)
{
$this->startTime = time();
$this->step = 0;
$this->percent = 0.0;

if (null !== $max) {
$this->setMaxSteps($max);
}

$this->display();
}






public function advance(int $step = 1)
{
$this->setProgress($this->step + $step);
}




public function setOverwrite(bool $overwrite)
{
$this->overwrite = $overwrite;
}

public function setProgress(int $step)
{
if ($this->max && $step > $this->max) {
$this->max = $step;
} elseif ($step < 0) {
$step = 0;
}

$redrawFreq = $this->redrawFreq ?? (($this->max ?: 10) / 10);
$prevPeriod = (int) ($this->step / $redrawFreq);
$currPeriod = (int) ($step / $redrawFreq);
$this->step = $step;
$this->percent = $this->max ? (float) $this->step / $this->max : 0;
$timeInterval = microtime(true) - $this->lastWriteTime;


 if ($this->max === $step) {
$this->display();

return;
}


 if ($timeInterval < $this->minSecondsBetweenRedraws) {
return;
}


 if ($prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws) {
$this->display();
}
}

public function setMaxSteps(int $max)
{
$this->format = null;
$this->max = max(0, $max);
$this->stepWidth = $this->max ? Helper::strlen((string) $this->max) : 4;
}




public function finish(): void
{
if (!$this->max) {
$this->max = $this->step;
}

if ($this->step === $this->max && !$this->overwrite) {

 return;
}

$this->setProgress($this->max);
}




public function display(): void
{
if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
return;
}

if (null === $this->format) {
$this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
}

$this->overwrite($this->buildLine());
}








public function clear(): void
{
if (!$this->overwrite) {
return;
}

if (null === $this->format) {
$this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
}

$this->overwrite('');
}

private function setRealFormat(string $format)
{

 if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
$this->format = self::getFormatDefinition($format.'_nomax');
} elseif (null !== self::getFormatDefinition($format)) {
$this->format = self::getFormatDefinition($format);
} else {
$this->format = $format;
}

$this->formatLineCount = substr_count($this->format, "\n");
}




private function overwrite(string $message): void
{
if ($this->previousMessage === $message) {
return;
}

$originalMessage = $message;

if ($this->overwrite) {
if (null !== $this->previousMessage) {
if ($this->output instanceof ConsoleSectionOutput) {
$messageLines = explode("\n", $message);
$lineCount = \count($messageLines);
foreach ($messageLines as $messageLine) {
$messageLineLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $messageLine);
if ($messageLineLength > $this->terminal->getWidth()) {
$lineCount += floor($messageLineLength / $this->terminal->getWidth());
}
}
$this->output->clear($lineCount);
} else {

 if ($this->formatLineCount > 0) {
$message = str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount).$message;
}


 $message = "\x0D\x1B[2K$message";
}
}
} elseif ($this->step > 0) {
$message = \PHP_EOL.$message;
}

$this->previousMessage = $originalMessage;
$this->lastWriteTime = microtime(true);

$this->output->write($message);
++$this->writeCount;
}

private function determineBestFormat(): string
{
switch ($this->output->getVerbosity()) {

 case OutputInterface::VERBOSITY_VERBOSE:
return $this->max ? 'verbose' : 'verbose_nomax';
case OutputInterface::VERBOSITY_VERY_VERBOSE:
return $this->max ? 'very_verbose' : 'very_verbose_nomax';
case OutputInterface::VERBOSITY_DEBUG:
return $this->max ? 'debug' : 'debug_nomax';
default:
return $this->max ? 'normal' : 'normal_nomax';
}
}

private static function initPlaceholderFormatters(): array
{
return [
'bar' => function (self $bar, OutputInterface $output) {
$completeBars = $bar->getBarOffset();
$display = str_repeat($bar->getBarCharacter(), $completeBars);
if ($completeBars < $bar->getBarWidth()) {
$emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
$display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
}

return $display;
},
'elapsed' => function (self $bar) {
return Helper::formatTime(time() - $bar->getStartTime());
},
'remaining' => function (self $bar) {
if (!$bar->getMaxSteps()) {
throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
}

if (!$bar->getProgress()) {
$remaining = 0;
} else {
$remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
}

return Helper::formatTime($remaining);
},
'estimated' => function (self $bar) {
if (!$bar->getMaxSteps()) {
throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
}

if (!$bar->getProgress()) {
$estimated = 0;
} else {
$estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
}

return Helper::formatTime($estimated);
},
'memory' => function (self $bar) {
return Helper::formatMemory(memory_get_usage(true));
},
'current' => function (self $bar) {
return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT);
},
'max' => function (self $bar) {
return $bar->getMaxSteps();
},
'percent' => function (self $bar) {
return floor($bar->getProgressPercent() * 100);
},
];
}

private static function initFormats(): array
{
return [
'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
'normal_nomax' => ' %current% [%bar%]',

'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',

'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',

'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
];
}

private function buildLine(): string
{
$regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i";
$callback = function ($matches) {
if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
$text = $formatter($this, $this->output);
} elseif (isset($this->messages[$matches[1]])) {
$text = $this->messages[$matches[1]];
} else {
return $matches[0];
}

if (isset($matches[2])) {
$text = sprintf('%'.$matches[2], $text);
}

return $text;
};
$line = preg_replace_callback($regex, $callback, $this->format);


 $linesLength = array_map(function ($subLine) {
return Helper::strlenWithoutDecoration($this->output->getFormatter(), rtrim($subLine, "\r"));
}, explode("\n", $line));

$linesWidth = max($linesLength);

$terminalWidth = $this->terminal->getWidth();
if ($linesWidth <= $terminalWidth) {
return $line;
}

$this->setBarWidth($this->barWidth - $linesWidth + $terminalWidth);

return preg_replace_callback($regex, $callback, $this->format);
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Exception\MissingInputException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\StreamableInputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\ConsoleSectionOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Terminal;






class QuestionHelper extends Helper
{
private $inputStream;
private static $shell;
private static $stty = true;
private static $stdinIsInteractive;








public function ask(InputInterface $input, OutputInterface $output, Question $question)
{
if ($output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput();
}

if (!$input->isInteractive()) {
return $this->getDefaultAnswer($question);
}

if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) {
$this->inputStream = $stream;
}

try {
if (!$question->getValidator()) {
return $this->doAsk($output, $question);
}

$interviewer = function () use ($output, $question) {
return $this->doAsk($output, $question);
};

return $this->validateAttempts($interviewer, $output, $question);
} catch (MissingInputException $exception) {
$input->setInteractive(false);

if (null === $fallbackOutput = $this->getDefaultAnswer($question)) {
throw $exception;
}

return $fallbackOutput;
}
}




public function getName()
{
return 'question';
}




public static function disableStty()
{
self::$stty = false;
}








private function doAsk(OutputInterface $output, Question $question)
{
$this->writePrompt($output, $question);

$inputStream = $this->inputStream ?: \STDIN;
$autocomplete = $question->getAutocompleterCallback();

if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
$ret = false;
if ($question->isHidden()) {
try {
$hiddenResponse = $this->getHiddenResponse($output, $inputStream, $question->isTrimmable());
$ret = $question->isTrimmable() ? trim($hiddenResponse) : $hiddenResponse;
} catch (RuntimeException $e) {
if (!$question->isHiddenFallback()) {
throw $e;
}
}
}

if (false === $ret) {
$cp = $this->setIOCodepage();
$ret = fgets($inputStream, 4096);
$ret = $this->resetIOCodepage($cp, $ret);
if (false === $ret) {
throw new MissingInputException('Aborted.');
}
if ($question->isTrimmable()) {
$ret = trim($ret);
}
}
} else {
$autocomplete = $this->autocomplete($output, $question, $inputStream, $autocomplete);
$ret = $question->isTrimmable() ? trim($autocomplete) : $autocomplete;
}

if ($output instanceof ConsoleSectionOutput) {
$output->addContent($ret);
}

$ret = \strlen($ret) > 0 ? $ret : $question->getDefault();

if ($normalizer = $question->getNormalizer()) {
return $normalizer($ret);
}

return $ret;
}




private function getDefaultAnswer(Question $question)
{
$default = $question->getDefault();

if (null === $default) {
return $default;
}

if ($validator = $question->getValidator()) {
return \call_user_func($question->getValidator(), $default);
} elseif ($question instanceof ChoiceQuestion) {
$choices = $question->getChoices();

if (!$question->isMultiselect()) {
return $choices[$default] ?? $default;
}

$default = explode(',', $default);
foreach ($default as $k => $v) {
$v = $question->isTrimmable() ? trim($v) : $v;
$default[$k] = $choices[$v] ?? $v;
}
}

return $default;
}




protected function writePrompt(OutputInterface $output, Question $question)
{
$message = $question->getQuestion();

if ($question instanceof ChoiceQuestion) {
$output->writeln(array_merge([
$question->getQuestion(),
], $this->formatChoiceQuestionChoices($question, 'info')));

$message = $question->getPrompt();
}

$output->write($message);
}






protected function formatChoiceQuestionChoices(ChoiceQuestion $question, $tag)
{
$messages = [];

$maxWidth = max(array_map([__CLASS__, 'strlen'], array_keys($choices = $question->getChoices())));

foreach ($choices as $key => $value) {
$padding = str_repeat(' ', $maxWidth - self::strlen($key));

$messages[] = sprintf("  [<$tag>%s$padding</$tag>] %s", $key, $value);
}

return $messages;
}




protected function writeError(OutputInterface $output, \Exception $error)
{
if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
$message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
} else {
$message = '<error>'.$error->getMessage().'</error>';
}

$output->writeln($message);
}






private function autocomplete(OutputInterface $output, Question $question, $inputStream, callable $autocomplete): string
{
$fullChoice = '';
$ret = '';

$i = 0;
$ofs = -1;
$matches = $autocomplete($ret);
$numMatches = \count($matches);

$sttyMode = shell_exec('stty -g');


 shell_exec('stty -icanon -echo');


 $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));


 while (!feof($inputStream)) {
$c = fread($inputStream, 1);


 if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
shell_exec(sprintf('stty %s', $sttyMode));
throw new MissingInputException('Aborted.');
} elseif ("\177" === $c) { 
 if (0 === $numMatches && 0 !== $i) {
--$i;
$fullChoice = self::substr($fullChoice, 0, $i);

 $output->write("\033[1D");
}

if (0 === $i) {
$ofs = -1;
$matches = $autocomplete($ret);
$numMatches = \count($matches);
} else {
$numMatches = 0;
}


 $ret = self::substr($ret, 0, $i);
} elseif ("\033" === $c) {

 $c .= fread($inputStream, 2);


 if (isset($c[2]) && ('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 = (string) $matches[$ofs];

 $remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
$output->write($remainingCharacters);
$fullChoice .= $remainingCharacters;
$i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding);

$matches = array_filter(
$autocomplete($ret),
function ($match) use ($ret) {
return '' === $ret || str_starts_with($match, $ret);
}
);
$numMatches = \count($matches);
$ofs = -1;
}

if ("\n" === $c) {
$output->write($c);
break;
}

$numMatches = 0;
}

continue;
} else {
if ("\x80" <= $c) {
$c .= fread($inputStream, ["\xC0" => 1, "\xD0" => 1, "\xE0" => 2, "\xF0" => 3][$c & "\xF0"]);
}

$output->write($c);
$ret .= $c;
$fullChoice .= $c;
++$i;

$tempRet = $ret;

if ($question instanceof ChoiceQuestion && $question->isMultiselect()) {
$tempRet = $this->mostRecentlyEnteredValue($fullChoice);
}

$numMatches = 0;
$ofs = 0;

foreach ($autocomplete($ret) as $value) {

 if (str_starts_with($value, $tempRet)) {
$matches[$numMatches++] = $value;
}
}
}


 $output->write("\033[K");

if ($numMatches > 0 && -1 !== $ofs) {

 $output->write("\0337");

 $charactersEntered = \strlen(trim($this->mostRecentlyEnteredValue($fullChoice)));
$output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)).'</hl>');

 $output->write("\0338");
}
}


 shell_exec(sprintf('stty %s', $sttyMode));

return $fullChoice;
}

private function mostRecentlyEnteredValue(string $entered): string
{

 if (!str_contains($entered, ',')) {
return $entered;
}

$choices = explode(',', $entered);
if ('' !== $lastChoice = trim($choices[\count($choices) - 1])) {
return $lastChoice;
}

return $entered;
}









private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string
{
if ('\\' === \DIRECTORY_SEPARATOR) {
$exe = __DIR__.'/../Resources/bin/hiddeninput.exe';


 if ('phar:' === substr(__FILE__, 0, 5)) {
$tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
copy($exe, $tmpExe);
$exe = $tmpExe;
}

$sExec = shell_exec('"'.$exe.'"');
$value = $trimmable ? rtrim($sExec) : $sExec;
$output->writeln('');

if (isset($tmpExe)) {
unlink($tmpExe);
}

return $value;
}

if (self::$stty && Terminal::hasSttyAvailable()) {
$sttyMode = shell_exec('stty -g');
shell_exec('stty -echo');
} elseif ($this->isInteractiveInput($inputStream)) {
throw new RuntimeException('Unable to hide the response.');
}

$value = fgets($inputStream, 4096);

if (self::$stty && Terminal::hasSttyAvailable()) {
shell_exec(sprintf('stty %s', $sttyMode));
}

if (false === $value) {
throw new MissingInputException('Aborted.');
}
if ($trimmable) {
$value = trim($value);
}
$output->writeln('');

return $value;
}










private function validateAttempts(callable $interviewer, OutputInterface $output, Question $question)
{
$error = null;
$attempts = $question->getMaxAttempts();

while (null === $attempts || $attempts--) {
if (null !== $error) {
$this->writeError($output, $error);
}

try {
return $question->getValidator()($interviewer());
} catch (RuntimeException $e) {
throw $e;
} catch (\Exception $error) {
}
}

throw $error;
}

private function isInteractiveInput($inputStream): bool
{
if ('php://stdin' !== (stream_get_meta_data($inputStream)['uri'] ?? null)) {
return false;
}

if (null !== self::$stdinIsInteractive) {
return self::$stdinIsInteractive;
}

if (\function_exists('stream_isatty')) {
return self::$stdinIsInteractive = stream_isatty(fopen('php://stdin', 'r'));
}

if (\function_exists('posix_isatty')) {
return self::$stdinIsInteractive = posix_isatty(fopen('php://stdin', 'r'));
}

if (!\function_exists('exec')) {
return self::$stdinIsInteractive = true;
}

exec('stty 2> /dev/null', $output, $status);

return self::$stdinIsInteractive = 1 !== $status;
}






private function setIOCodepage(): int
{
if (\function_exists('sapi_windows_cp_set')) {
$cp = sapi_windows_cp_get();
sapi_windows_cp_set(sapi_windows_cp_get('oem'));

return $cp;
}

return 0;
}








private function resetIOCodepage(int $cp, $input)
{
if (0 !== $cp) {
sapi_windows_cp_set($cp);

if (false !== $input && '' !== $input) {
$input = sapi_windows_cp_conv(sapi_windows_cp_get('oem'), $cp, $input);
}
}

return $input;
}
}
<?php










namespace Symfony\Component\Console\Helper;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\WrappableOutputFormatterInterface;
use Symfony\Component\Console\Output\ConsoleSectionOutput;
use Symfony\Component\Console\Output\OutputInterface;

/**
@gmail
@gmail
@gmail
@gmail



*/
class Table
{
private const SEPARATOR_TOP = 0;
private const SEPARATOR_TOP_BOTTOM = 1;
private const SEPARATOR_MID = 2;
private const SEPARATOR_BOTTOM = 3;
private const BORDER_OUTSIDE = 0;
private const BORDER_INSIDE = 1;

private $headerTitle;
private $footerTitle;




private $headers = [];




private $rows = [];
private $horizontal = false;




private $effectiveColumnWidths = [];






private $numberOfColumns;




private $output;




private $style;




private $columnStyles = [];






private $columnWidths = [];
private $columnMaxWidths = [];

private static $styles;

private $rendered = false;

public function __construct(OutputInterface $output)
{
$this->output = $output;

if (!self::$styles) {
self::$styles = self::initStyles();
}

$this->setStyle('default');
}






public static function setStyleDefinition($name, TableStyle $style)
{
if (!self::$styles) {
self::$styles = self::initStyles();
}

self::$styles[$name] = $style;
}








public static function getStyleDefinition($name)
{
if (!self::$styles) {
self::$styles = self::initStyles();
}

if (isset(self::$styles[$name])) {
return self::$styles[$name];
}

throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
}








public function setStyle($name)
{
$this->style = $this->resolveStyle($name);

return $this;
}






public function getStyle()
{
return $this->style;
}









public function setColumnStyle($columnIndex, $name)
{
$columnIndex = (int) $columnIndex;

$this->columnStyles[$columnIndex] = $this->resolveStyle($name);

return $this;
}










public function getColumnStyle($columnIndex)
{
return $this->columnStyles[$columnIndex] ?? $this->getStyle();
}









public function setColumnWidth($columnIndex, $width)
{
$this->columnWidths[(int) $columnIndex] = (int) $width;

return $this;
}






public function setColumnWidths(array $widths)
{
$this->columnWidths = [];
foreach ($widths as $index => $width) {
$this->setColumnWidth($index, $width);
}

return $this;
}









public function setColumnMaxWidth(int $columnIndex, int $width): self
{
if (!$this->output->getFormatter() instanceof WrappableOutputFormatterInterface) {
throw new \LogicException(sprintf('Setting a maximum column width is only supported when using a "%s" formatter, got "%s".', WrappableOutputFormatterInterface::class, \get_class($this->output->getFormatter())));
}

$this->columnMaxWidths[$columnIndex] = $width;

return $this;
}

public function setHeaders(array $headers)
{
$headers = array_values($headers);
if (!empty($headers) && !\is_array($headers[0])) {
$headers = [$headers];
}

$this->headers = $headers;

return $this;
}

public function setRows(array $rows)
{
$this->rows = [];

return $this->addRows($rows);
}

public function addRows(array $rows)
{
foreach ($rows as $row) {
$this->addRow($row);
}

return $this;
}

public function addRow($row)
{
if ($row instanceof TableSeparator) {
$this->rows[] = $row;

return $this;
}

if (!\is_array($row)) {
throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
}

$this->rows[] = array_values($row);

return $this;
}




public function appendRow($row): self
{
if (!$this->output instanceof ConsoleSectionOutput) {
throw new RuntimeException(sprintf('Output should be an instance of "%s" when calling "%s".', ConsoleSectionOutput::class, __METHOD__));
}

if ($this->rendered) {
$this->output->clear($this->calculateRowCount());
}

$this->addRow($row);
$this->render();

return $this;
}

public function setRow($column, array $row)
{
$this->rows[$column] = $row;

return $this;
}

public function setHeaderTitle(?string $title): self
{
$this->headerTitle = $title;

return $this;
}

public function setFooterTitle(?string $title): self
{
$this->footerTitle = $title;

return $this;
}

public function setHorizontal(bool $horizontal = true): self
{
$this->horizontal = $horizontal;

return $this;
}














public function render()
{
$divider = new TableSeparator();
if ($this->horizontal) {
$rows = [];
foreach ($this->headers[0] ?? [] as $i => $header) {
$rows[$i] = [$header];
foreach ($this->rows as $row) {
if ($row instanceof TableSeparator) {
continue;
}
if (isset($row[$i])) {
$rows[$i][] = $row[$i];
} elseif ($rows[$i][0] instanceof TableCell && $rows[$i][0]->getColspan() >= 2) {

 } else {
$rows[$i][] = null;
}
}
}
} else {
$rows = array_merge($this->headers, [$divider], $this->rows);
}

$this->calculateNumberOfColumns($rows);

$rows = $this->buildTableRows($rows);
$this->calculateColumnsWidth($rows);

$isHeader = !$this->horizontal;
$isFirstRow = $this->horizontal;
$hasTitle = (bool) $this->headerTitle;
foreach ($rows as $row) {
if ($divider === $row) {
$isHeader = false;
$isFirstRow = true;

continue;
}
if ($row instanceof TableSeparator) {
$this->renderRowSeparator();

continue;
}
if (!$row) {
continue;
}

if ($isHeader || $isFirstRow) {
$this->renderRowSeparator(
$isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
$hasTitle ? $this->headerTitle : null,
$hasTitle ? $this->style->getHeaderTitleFormat() : null
);
$isFirstRow = false;
$hasTitle = false;
}
if ($this->horizontal) {
$this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
} else {
$this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
}
}
$this->renderRowSeparator(self::SEPARATOR_BOTTOM, $this->footerTitle, $this->style->getFooterTitleFormat());

$this->cleanup();
$this->rendered = true;
}








private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null)
{
if (0 === $count = $this->numberOfColumns) {
return;
}

$borders = $this->style->getBorderChars();
if (!$borders[0] && !$borders[2] && !$this->style->getCrossingChar()) {
return;
}

$crossings = $this->style->getCrossingChars();
if (self::SEPARATOR_MID === $type) {
[$horizontal, $leftChar, $midChar, $rightChar] = [$borders[2], $crossings[8], $crossings[0], $crossings[4]];
} elseif (self::SEPARATOR_TOP === $type) {
[$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[1], $crossings[2], $crossings[3]];
} elseif (self::SEPARATOR_TOP_BOTTOM === $type) {
[$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[9], $crossings[10], $crossings[11]];
} else {
[$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[7], $crossings[6], $crossings[5]];
}

$markup = $leftChar;
for ($column = 0; $column < $count; ++$column) {
$markup .= str_repeat($horizontal, $this->effectiveColumnWidths[$column]);
$markup .= $column === $count - 1 ? $rightChar : $midChar;
}

if (null !== $title) {
$titleLength = Helper::strlenWithoutDecoration($formatter = $this->output->getFormatter(), $formattedTitle = sprintf($titleFormat, $title));
$markupLength = Helper::strlen($markup);
if ($titleLength > $limit = $markupLength - 4) {
$titleLength = $limit;
$formatLength = Helper::strlenWithoutDecoration($formatter, sprintf($titleFormat, ''));
$formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...');
}

$titleStart = intdiv($markupLength - $titleLength, 2);
if (false === mb_detect_encoding($markup, null, true)) {
$markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
} else {
$markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength);
}
}

$this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
}




private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string
{
$borders = $this->style->getBorderChars();

return sprintf($this->style->getBorderFormat(), self::BORDER_OUTSIDE === $type ? $borders[1] : $borders[3]);
}








private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null)
{
$rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
$columns = $this->getRowColumns($row);
$last = \count($columns) - 1;
foreach ($columns as $i => $column) {
if ($firstCellFormat && 0 === $i) {
$rowContent .= $this->renderCell($row, $column, $firstCellFormat);
} else {
$rowContent .= $this->renderCell($row, $column, $cellFormat);
}
$rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
}
$this->output->writeln($rowContent);
}




private function renderCell(array $row, int $column, string $cellFormat): string
{
$cell = $row[$column] ?? '';
$width = $this->effectiveColumnWidths[$column];
if ($cell instanceof TableCell && $cell->getColspan() > 1) {

 foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
$width += $this->getColumnSeparatorWidth() + $this->effectiveColumnWidths[$nextColumn];
}
}


 if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
$width += \strlen($cell) - mb_strwidth($cell, $encoding);
}

$style = $this->getColumnStyle($column);

if ($cell instanceof TableSeparator) {
return sprintf($style->getBorderFormat(), str_repeat($style->getBorderChars()[2], $width));
}

$width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
$content = sprintf($style->getCellRowContentFormat(), $cell);

return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
}




private function calculateNumberOfColumns(array $rows)
{
$columns = [0];
foreach ($rows as $row) {
if ($row instanceof TableSeparator) {
continue;
}

$columns[] = $this->getNumberOfColumns($row);
}

$this->numberOfColumns = max($columns);
}

private function buildTableRows(array $rows): TableRows
{

$formatter = $this->output->getFormatter();
$unmergedRows = [];
for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
$rows = $this->fillNextRows($rows, $rowKey);


 foreach ($rows[$rowKey] as $column => $cell) {
$colspan = $cell instanceof TableCell ? $cell->getColspan() : 1;

if (isset($this->columnMaxWidths[$column]) && Helper::strlenWithoutDecoration($formatter, $cell) > $this->columnMaxWidths[$column]) {
$cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
}
if (!strstr($cell ?? '', "\n")) {
continue;
}
$escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));
$cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
$lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
foreach ($lines as $lineKey => $line) {
if ($colspan > 1) {
$line = new TableCell($line, ['colspan' => $colspan]);
}
if (0 === $lineKey) {
$rows[$rowKey][$column] = $line;
} else {
if (!\array_key_exists($rowKey, $unmergedRows) || !\array_key_exists($lineKey, $unmergedRows[$rowKey])) {
$unmergedRows[$rowKey][$lineKey] = $this->copyRow($rows, $rowKey);
}
$unmergedRows[$rowKey][$lineKey][$column] = $line;
}
}
}
}

return new TableRows(function () use ($rows, $unmergedRows): \Traversable {
foreach ($rows as $rowKey => $row) {
yield $row instanceof TableSeparator ? $row : $this->fillCells($row);

if (isset($unmergedRows[$rowKey])) {
foreach ($unmergedRows[$rowKey] as $row) {
yield $row instanceof TableSeparator ? $row : $this->fillCells($row);
}
}
}
});
}

private function calculateRowCount(): int
{
$numberOfRows = \count(iterator_to_array($this->buildTableRows(array_merge($this->headers, [new TableSeparator()], $this->rows))));

if ($this->headers) {
++$numberOfRows; 
 }

if (\count($this->rows) > 0) {
++$numberOfRows; 
 }

return $numberOfRows;
}






private function fillNextRows(array $rows, int $line): array
{
$unmergedRows = [];
foreach ($rows[$line] as $column => $cell) {
if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) {
throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', \gettype($cell)));
}
if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
$nbLines = $cell->getRowspan() - 1;
$lines = [$cell];
if (strstr($cell, "\n")) {
$lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
$nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;

$rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan()]);
unset($lines[0]);
}


 $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
$value = $lines[$unmergedRowKey - $line] ?? '';
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan()]);
if ($nbLines === $unmergedRowKey - $line) {
break;
}
}
}
}

foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {

 if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
foreach ($unmergedRow as $cellKey => $cell) {

 array_splice($rows[$unmergedRowKey], $cellKey, 0, [$cell]);
}
} else {
$row = $this->copyRow($rows, $unmergedRowKey - 1);
foreach ($unmergedRow as $column => $cell) {
if (!empty($cell)) {
$row[$column] = $unmergedRow[$column];
}
}
array_splice($rows, $unmergedRowKey, 0, [$row]);
}
}

return $rows;
}




private function fillCells(iterable $row)
{
$newRow = [];

foreach ($row as $column => $cell) {
$newRow[] = $cell;
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {

 $newRow[] = '';
}
}
}

return $newRow ?: $row;
}

private function copyRow(array $rows, int $line): array
{
$row = $rows[$line];
foreach ($row as $cellKey => $cellValue) {
$row[$cellKey] = '';
if ($cellValue instanceof TableCell) {
$row[$cellKey] = new TableCell('', ['colspan' => $cellValue->getColspan()]);
}
}

return $row;
}




private function getNumberOfColumns(array $row): int
{
$columns = \count($row);
foreach ($row as $column) {
$columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
}

return $columns;
}




private function getRowColumns(array $row): array
{
$columns = range(0, $this->numberOfColumns - 1);
foreach ($row as $cellKey => $cell) {
if ($cell instanceof TableCell && $cell->getColspan() > 1) {

 $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
}
}

return $columns;
}




private function calculateColumnsWidth(iterable $rows)
{
for ($column = 0; $column < $this->numberOfColumns; ++$column) {
$lengths = [];
foreach ($rows as $row) {
if ($row instanceof TableSeparator) {
continue;
}

foreach ($row as $i => $cell) {
if ($cell instanceof TableCell) {
$textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
$textLength = Helper::strlen($textContent);
if ($textLength > 0) {
$contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
foreach ($contentColumns as $position => $content) {
$row[$i + $position] = $content;
}
}
}
}

$lengths[] = $this->getCellWidth($row, $column);
}

$this->effectiveColumnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
}
}

private function getColumnSeparatorWidth(): int
{
return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getBorderChars()[3]));
}

private function getCellWidth(array $row, int $column): int
{
$cellWidth = 0;

if (isset($row[$column])) {
$cell = $row[$column];
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
}

$columnWidth = $this->columnWidths[$column] ?? 0;
$cellWidth = max($cellWidth, $columnWidth);

return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
}




private function cleanup()
{
$this->effectiveColumnWidths = [];
$this->numberOfColumns = null;
}

private static function initStyles(): array
{
$borderless = new TableStyle();
$borderless
->setHorizontalBorderChars('=')
->setVerticalBorderChars(' ')
->setDefaultCrossingChar(' ')
;

$compact = new TableStyle();
$compact
->setHorizontalBorderChars('')
->setVerticalBorderChars(' ')
->setDefaultCrossingChar('')
->setCellRowContentFormat('%s')
;

$styleGuide = new TableStyle();
$styleGuide
->setHorizontalBorderChars('-')
->setVerticalBorderChars(' ')
->setDefaultCrossingChar(' ')
->setCellHeaderFormat('%s')
;

$box = (new TableStyle())
->setHorizontalBorderChars('─')
->setVerticalBorderChars('│')
->setCrossingChars('┼', '┌', '┬', '┐', '┤', '┘', '┴', '└', '├')
;

$boxDouble = (new TableStyle())
->setHorizontalBorderChars('═', '─')
->setVerticalBorderChars('║', '│')
->setCrossingChars('┼', '╔', '╤', '╗', '╢', '╝', '╧', '╚', '╟', '╠', '╪', '╣')
;

return [
'default' => new TableStyle(),
'borderless' => $borderless,
'compact' => $compact,
'symfony-style-guide' => $styleGuide,
'box' => $box,
'box-double' => $boxDouble,
];
}

private function resolveStyle($name): TableStyle
{
if ($name instanceof TableStyle) {
return $name;
}

if (isset(self::$styles[$name])) {
return self::$styles[$name];
}

throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
}
}
<?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\Formatter;

use Symfony\Component\Console\Exception\InvalidArgumentException;

/**
@gmail



*/
class OutputFormatter implements WrappableOutputFormatterInterface
{
private $decorated;
private $styles = [];
private $styleStack;

public function __clone()
{
$this->styleStack = clone $this->styleStack;
foreach ($this->styles as $key => $value) {
$this->styles[$key] = clone $value;
}
}








public static function escape($text)
{
$text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);

return self::escapeTrailingBackslash($text);
}






public static function escapeTrailingBackslash(string $text): string
{
if (str_ends_with($text, '\\')) {
$len = \strlen($text);
$text = rtrim($text, '\\');
$text = str_replace("\0", '', $text);
$text .= str_repeat("\0", $len - \strlen($text));
}

return $text;
}






public function __construct(bool $decorated = false, array $styles = [])
{
$this->decorated = $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 = (bool) $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(sprintf('Undefined style: "%s".', $name));
}

return $this->styles[strtolower($name)];
}




public function format($message)
{
return $this->formatAndWrap((string) $message, 0);
}




public function formatAndWrap(string $message, int $width)
{
$offset = 0;
$output = '';
$tagRegex = '[a-z][^<>]*+';
$currentLineLength = 0;
preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
foreach ($matches[0] as $i => $match) {
$pos = $match[1];
$text = $match[0];

if (0 != $pos && '\\' == $message[$pos - 1]) {
continue;
}


 $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset), $output, $width, $currentLineLength);
$offset = $pos + \strlen($text);


 if ($open = '/' != $text[1]) {
$tag = $matches[1][$i][0];
} else {
$tag = $matches[3][$i][0] ?? '';
}

if (!$open && !$tag) {

 $this->styleStack->pop();
} elseif (null === $style = $this->createStyleFromString($tag)) {
$output .= $this->applyCurrentStyle($text, $output, $width, $currentLineLength);
} elseif ($open) {
$this->styleStack->push($style);
} else {
$this->styleStack->pop($style);
}
}

$output .= $this->applyCurrentStyle(substr($message, $offset), $output, $width, $currentLineLength);

if (str_contains($output, "\0")) {
return strtr($output, ["\0" => '\\', '\\<' => '<']);
}

return str_replace('\\<', '<', $output);
}




public function getStyleStack()
{
return $this->styleStack;
}




private function createStyleFromString(string $string): ?OutputFormatterStyleInterface
{
if (isset($this->styles[$string])) {
return $this->styles[$string];
}

if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) {
return null;
}

$style = new OutputFormatterStyle();
foreach ($matches as $match) {
array_shift($match);
$match[0] = strtolower($match[0]);

if ('fg' == $match[0]) {
$style->setForeground(strtolower($match[1]));
} elseif ('bg' == $match[0]) {
$style->setBackground(strtolower($match[1]));
} elseif ('href' === $match[0]) {
$style->setHref($match[1]);
} elseif ('options' === $match[0]) {
preg_match_all('([^,;]+)', strtolower($match[1]), $options);
$options = array_shift($options);
foreach ($options as $option) {
$style->setOption($option);
}
} else {
return null;
}
}

return $style;
}




private function applyCurrentStyle(string $text, string $current, int $width, int &$currentLineLength): string
{
if ('' === $text) {
return '';
}

if (!$width) {
return $this->isDecorated() ? $this->styleStack->getCurrent()->apply($text) : $text;
}

if (!$currentLineLength && '' !== $current) {
$text = ltrim($text);
}

if ($currentLineLength) {
$prefix = substr($text, 0, $i = $width - $currentLineLength)."\n";
$text = substr($text, $i);
} else {
$prefix = '';
}

preg_match('~(\\n)$~', $text, $matches);
$text = $prefix.preg_replace('~([^\\n]{'.$width.'})\\ *~', "\$1\n", $text);
$text = rtrim($text, "\n").($matches[1] ?? '');

if (!$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) {
$text = "\n".$text;
}

$lines = explode("\n", $text);

foreach ($lines as $line) {
$currentLineLength += \strlen($line);
if ($width <= $currentLineLength) {
$currentLineLength = 0;
}
}

if ($this->isDecorated()) {
foreach ($lines as $i => $line) {
$lines[$i] = $this->styleStack->getCurrent()->apply($line);
}
}

return implode("\n", $lines);
}
}
<?php










namespace Symfony\Component\Console\Formatter;






interface WrappableOutputFormatterInterface extends OutputFormatterInterface
{



public function formatAndWrap(string $message, int $width);
}
<?php










namespace Symfony\Component\Console\Formatter;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Contracts\Service\ResetInterface;




class OutputFormatterStyleStack implements ResetInterface
{



private $styles;

private $emptyStyle;

public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
{
$this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
$this->reset();
}




public function reset()
{
$this->styles = [];
}




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;






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;

use Symfony\Component\Console\Exception\InvalidArgumentException;






class OutputFormatterStyle implements OutputFormatterStyleInterface
{
private static $availableForegroundColors = [
'black' => ['set' => 30, 'unset' => 39],
'red' => ['set' => 31, 'unset' => 39],
'green' => ['set' => 32, 'unset' => 39],
'yellow' => ['set' => 33, 'unset' => 39],
'blue' => ['set' => 34, 'unset' => 39],
'magenta' => ['set' => 35, 'unset' => 39],
'cyan' => ['set' => 36, 'unset' => 39],
'white' => ['set' => 37, 'unset' => 39],
'default' => ['set' => 39, 'unset' => 39],
];
private static $availableBackgroundColors = [
'black' => ['set' => 40, 'unset' => 49],
'red' => ['set' => 41, 'unset' => 49],
'green' => ['set' => 42, 'unset' => 49],
'yellow' => ['set' => 43, 'unset' => 49],
'blue' => ['set' => 44, 'unset' => 49],
'magenta' => ['set' => 45, 'unset' => 49],
'cyan' => ['set' => 46, 'unset' => 49],
'white' => ['set' => 47, 'unset' => 49],
'default' => ['set' => 49, 'unset' => 49],
];
private static $availableOptions = [
'bold' => ['set' => 1, 'unset' => 22],
'underscore' => ['set' => 4, 'unset' => 24],
'blink' => ['set' => 5, 'unset' => 25],
'reverse' => ['set' => 7, 'unset' => 27],
'conceal' => ['set' => 8, 'unset' => 28],
];

private $foreground;
private $background;
private $href;
private $options = [];
private $handlesHrefGracefully;







public function __construct(string $foreground = null, string $background = null, array $options = [])
{
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 setHref(string $url): void
{
$this->href = $url;
}




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 (!\in_array(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 = [];

foreach ($options as $option) {
$this->setOption($option);
}
}




public function apply($text)
{
$setCodes = [];
$unsetCodes = [];

if (null === $this->handlesHrefGracefully) {
$this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
}

if (null !== $this->foreground) {
$setCodes[] = $this->foreground['set'];
$unsetCodes[] = $this->foreground['unset'];
}
if (null !== $this->background) {
$setCodes[] = $this->background['set'];
$unsetCodes[] = $this->background['unset'];
}

foreach ($this->options as $option) {
$setCodes[] = $option['set'];
$unsetCodes[] = $option['unset'];
}

if (null !== $this->href && $this->handlesHrefGracefully) {
$text = "\033]8;;$this->href\033\\$text\033]8;;\033\\";
}

if (0 === \count($setCodes)) {
return $text;
}

return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
}
}
<?php










namespace Symfony\Component\Console\Command;

use Symfony\Component\Console\Helper\DescriptorHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;






class ListCommand extends Command
{



protected function configure()
{
$this
->setName('list')
->setDefinition($this->createDefinition())
->setDescription('List 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 in other formats by using the <comment>--format</comment> option:

  <info>php %command.full_name% --format=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
)
;
}




public function getNativeDefinition()
{
return $this->createDefinition();
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = new DescriptorHelper();
$helper->describe($output, $this->getApplication(), [
'format' => $input->getOption('format'),
'raw_text' => $input->getOption('raw'),
'namespace' => $input->getArgument('namespace'),
]);

return 0;
}

private function createDefinition(): InputDefinition
{
return new InputDefinition([
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
]);
}
}
<?php










namespace Symfony\Component\Console\Command;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;






class Command
{



protected static $defaultName;

private $application;
private $name;
private $processTitle;
private $aliases = [];
private $definition;
private $hidden = false;
private $help = '';
private $description = '';
private $ignoreValidationErrors = false;
private $applicationDefinitionMerged = false;
private $applicationDefinitionMergedWithArgs = false;
private $code;
private $synopsis = [];
private $usages = [];
private $helperSet;




public static function getDefaultName()
{
$class = static::class;
$r = new \ReflectionProperty($class, 'defaultName');

return $class === $r->class ? static::$defaultName : null;
}






public function __construct(string $name = null)
{
$this->definition = new InputDefinition();

if (null !== $name || null !== $name = static::getDefaultName()) {
$this->setName($name);
}

$this->configure();
}






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(true);
$this->getSynopsis(false);


 $this->mergeApplicationDefinition();


 try {
$input->bind($this->definition);
} catch (ExceptionInterface $e) {
if (!$this->ignoreValidationErrors) {
throw $e;
}
}

$this->initialize($input, $output);

if (null !== $this->processTitle) {
if (\function_exists('cli_set_process_title')) {
if (!@cli_set_process_title($this->processTitle)) {
if ('Darwin' === \PHP_OS) {
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
} else {
cli_set_process_title($this->processTitle);
}
}
} elseif (\function_exists('setproctitle')) {
setproctitle($this->processTitle);
} elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
$output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
}
}

if ($input->isInteractive()) {
$this->interact($input, $output);
}


 
 
 if ($input->hasArgument('command') && null === $input->getArgument('command')) {
$input->setArgument('command', $this->getName());
}

$input->validate();

if ($this->code) {
$statusCode = ($this->code)($input, $output);
} else {
$statusCode = $this->execute($input, $output);

if (!\is_int($statusCode)) {
@trigger_error(sprintf('Return value of "%s::execute()" should always be of the type int since Symfony 4.4, %s returned.', static::class, \gettype($statusCode)), \E_USER_DEPRECATED);
}
}

return is_numeric($statusCode) ? (int) $statusCode : 0;
}















public function setCode(callable $code)
{
if ($code instanceof \Closure) {
$r = new \ReflectionFunction($code);
if (null === $r->getClosureThis()) {
set_error_handler(static function () {});
try {
if ($c = \Closure::bind($code, $this)) {
$code = $c;
}
} finally {
restore_error_handler();
}
}
}

$this->code = $code;

return $this;
}








public function mergeApplicationDefinition($mergeArgs = true)
{
if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
return;
}

$this->definition->addOptions($this->application->getDefinition()->getOptions());

$this->applicationDefinitionMerged = true;

if ($mergeArgs) {
$currentArguments = $this->definition->getArguments();
$this->definition->setArguments($this->application->getDefinition()->getArguments());
$this->definition->addArguments($currentArguments);

$this->applicationDefinitionMergedWithArgs = 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()
{
if (null === $this->definition) {
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
}

return $this->definition;
}











public 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 setProcessTitle($title)
{
$this->processTitle = $title;

return $this;
}






public function getName()
{
return $this->name;
}






public function setHidden($hidden)
{
$this->hidden = (bool) $hidden;

return $this;
}




public function isHidden()
{
return $this->hidden;
}








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;
$isSingleCommand = $this->application && $this->application->isSingleCommand();

$placeholders = [
'%command.name%',
'%command.full_name%',
];
$replacements = [
$name,
$isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
];

return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
}










public function setAliases($aliases)
{
if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable.');
}

foreach ($aliases as $alias) {
$this->validateName($alias);
}

$this->aliases = $aliases;

return $this;
}






public function getAliases()
{
return $this->aliases;
}








public function getSynopsis($short = false)
{
$key = $short ? 'short' : 'long';

if (!isset($this->synopsis[$key])) {
$this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
}

return $this->synopsis[$key];
}








public function addUsage($usage)
{
if (!str_starts_with($usage, $this->name)) {
$usage = sprintf('%s %s', $this->name, $usage);
}

$this->usages[] = $usage;

return $this;
}






public function getUsages()
{
return $this->usages;
}











public function getHelper($name)
{
if (null === $this->helperSet) {
throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
}

return $this->helperSet->get($name);
}








private function validateName(string $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\Helper\DescriptorHelper;
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 HelpCommand extends Command
{
private $command;




protected function configure()
{
$this->ignoreValidationErrors();

$this
->setName('help')
->setDefinition([
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
])
->setDescription('Display 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 in other formats by using the <comment>--format</comment> option:

  <info>php %command.full_name% --format=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'));
}

$helper = new DescriptorHelper();
$helper->describe($output, $this->command, [
'format' => $input->getOption('format'),
'raw_text' => $input->getOption('raw'),
]);

$this->command = null;

return 0;
}
}
<?php










namespace Symfony\Component\Console\Command;

use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Lock\Lock;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\Store\FlockStore;
use Symfony\Component\Lock\Store\SemaphoreStore;






trait LockableTrait
{

private $lock;




private function lock(string $name = null, bool $blocking = false): bool
{
if (!class_exists(SemaphoreStore::class)) {
throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
}

if (null !== $this->lock) {
throw new LogicException('A lock is already in place.');
}

if (SemaphoreStore::isSupported()) {
$store = new SemaphoreStore();
} else {
$store = new FlockStore();
}

$this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
if (!$this->lock->acquire($blocking)) {
$this->lock = null;

return false;
}

return true;
}




private function release()
{
if ($this->lock) {
$this->lock->release();
$this->lock = null;
}
}
}
<?php










namespace Symfony\Component\Console\Logger;

use Psr\Log\AbstractLogger;
use Psr\Log\InvalidArgumentException;
use Psr\Log\LogLevel;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;








class ConsoleLogger extends AbstractLogger
{
public const INFO = 'info';
public const ERROR = 'error';

private $output;
private $verbosityLevelMap = [
LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
];
private $formatLevelMap = [
LogLevel::EMERGENCY => self::ERROR,
LogLevel::ALERT => self::ERROR,
LogLevel::CRITICAL => self::ERROR,
LogLevel::ERROR => self::ERROR,
LogLevel::WARNING => self::INFO,
LogLevel::NOTICE => self::INFO,
LogLevel::INFO => self::INFO,
LogLevel::DEBUG => self::INFO,
];
private $errored = false;

public function __construct(OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = [])
{
$this->output = $output;
$this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
$this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
}






public function log($level, $message, array $context = [])
{
if (!isset($this->verbosityLevelMap[$level])) {
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
}

$output = $this->output;


 if (self::ERROR === $this->formatLevelMap[$level]) {
if ($this->output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput();
}
$this->errored = true;
}


 
 if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
$output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)), $this->verbosityLevelMap[$level]);
}
}






public function hasErrored()
{
return $this->errored;
}






private function interpolate(string $message, array $context): string
{
if (!str_contains($message, '{')) {
return $message;
}

$replacements = [];
foreach ($context as $key => $val) {
if (null === $val || is_scalar($val) || (\is_object($val) && method_exists($val, '__toString'))) {
$replacements["{{$key}}"] = $val;
} elseif ($val instanceof \DateTimeInterface) {
$replacements["{{$key}}"] = $val->format(\DateTime::RFC3339);
} elseif (\is_object($val)) {
$replacements["{{$key}}"] = '[object '.\get_class($val).']';
} else {
$replacements["{{$key}}"] = '['.\gettype($val).']';
}
}

return strtr($message, $replacements);
}
}
<?php










namespace Symfony\Component\Console\Input;

use Symfony\Component\Console\Exception\RuntimeException;


























class ArgvInput extends Input
{
private $tokens;
private $parsed;




public function __construct(array $argv = null, InputDefinition $definition = 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 && str_starts_with($token, '--')) {
$this->parseLongOption($token);
} elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
$this->parseShortOption($token);
} else {
$this->parseArgument($token);
}
}
}




private function parseShortOption(string $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(string $name)
{
$len = \strlen($name);
for ($i = 0; $i < $len; ++$i) {
if (!$this->definition->hasShortcut($name[$i])) {
$encoding = mb_detect_encoding($name, null, true);
throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
}

$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(), null);
}
}
}




private function parseLongOption(string $token)
{
$name = substr($token, 2);

if (false !== $pos = strpos($name, '=')) {
if ('' === $value = substr($name, $pos + 1)) {
array_unshift($this->parsed, $value);
}
$this->addLongOption(substr($name, 0, $pos), $value);
} else {
$this->addLongOption($name, null);
}
}






private function parseArgument(string $token)
{
$c = \count($this->arguments);


 if ($this->definition->hasArgument($c)) {
$arg = $this->definition->getArgument($c);
$this->arguments[$arg->getName()] = $arg->isArray() ? [$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 {
$all = $this->definition->getArguments();
if (\count($all)) {
throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
}

throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
}
}






private function addShortOption(string $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(string $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()) {
throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
}

if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) {

 
 $next = array_shift($this->parsed);
if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, ['', null], true)) {
$value = $next;
} else {
array_unshift($this->parsed, $next);
}
}

if (null === $value) {
if ($option->isValueRequired()) {
throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
}

if (!$option->isArray() && !$option->isValueOptional()) {
$value = true;
}
}

if ($option->isArray()) {
$this->options[$name][] = $value;
} else {
$this->options[$name] = $value;
}
}




public function getFirstArgument()
{
$isOption = false;
foreach ($this->tokens as $i => $token) {
if ($token && '-' === $token[0]) {
if (str_contains($token, '=') || !isset($this->tokens[$i + 1])) {
continue;
}


 
 $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1);
if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) {

 } elseif ((isset($this->options[$name]) || isset($this->options[$name = $this->definition->shortcutToName($name)])) && $this->tokens[$i + 1] === $this->options[$name]) {
$isOption = true;
}

continue;
}

if ($isOption) {
$isOption = false;
continue;
}

return $token;
}

return null;
}




public function hasParameterOption($values, $onlyParams = false)
{
$values = (array) $values;

foreach ($this->tokens as $token) {
if ($onlyParams && '--' === $token) {
return false;
}
foreach ($values as $value) {

 
 
 $leading = str_starts_with($value, '--') ? $value.'=' : $value;
if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) {
return true;
}
}
}

return false;
}




public function getParameterOption($values, $default = false, $onlyParams = false)
{
$values = (array) $values;
$tokens = $this->tokens;

while (0 < \count($tokens)) {
$token = array_shift($tokens);
if ($onlyParams && '--' === $token) {
return $default;
}

foreach ($values as $value) {
if ($token === $value) {
return array_shift($tokens);
}

 
 
 $leading = str_starts_with($value, '--') ? $value.'=' : $value;
if ('' !== $leading && str_starts_with($token, $leading)) {
return substr($token, \strlen($leading));
}
}
}

return $default;
}






public function __toString()
{
$tokens = array_map(function ($token) {
if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
return $match[1].$this->escapeToken($match[2]);
}

if ($token && '-' !== $token[0]) {
return $this->escapeToken($token);
}

return $token;
}, $this->tokens);

return implode(' ', $tokens);
}
}
<?php










namespace Symfony\Component\Console\Input;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;













class InputDefinition
{
private $arguments;
private $requiredCount;
private $hasAnArrayArgument = false;
private $hasOptional;
private $options;
private $shortcuts;




public function __construct(array $definition = [])
{
$this->setDefinition($definition);
}




public function setDefinition(array $definition)
{
$arguments = [];
$options = [];
foreach ($definition as $item) {
if ($item instanceof InputOption) {
$options[] = $item;
} else {
$arguments[] = $item;
}
}

$this->setArguments($arguments);
$this->setOptions($options);
}






public function setArguments($arguments = [])
{
$this->arguments = [];
$this->requiredCount = 0;
$this->hasOptional = false;
$this->hasAnArrayArgument = false;
$this->addArguments($arguments);
}






public function addArguments($arguments = [])
{
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)
{
if (!$this->hasArgument($name)) {
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}

$arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;

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 = [];
foreach ($this->arguments as $argument) {
$values[$argument->getName()] = $argument->getDefault();
}

return $values;
}






public function setOptions($options = [])
{
$this->options = [];
$this->shortcuts = [];
$this->addOptions($options);
}






public function addOptions($options = [])
{
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()));
}

if ($option->getShortcut()) {
foreach (explode('|', $option->getShortcut()) as $shortcut) {
if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
}
}
}

$this->options[$option->getName()] = $option;
if ($option->getShortcut()) {
foreach (explode('|', $option->getShortcut()) as $shortcut) {
$this->shortcuts[$shortcut] = $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 = [];
foreach ($this->options as $option) {
$values[$option->getName()] = $option->getDefault();
}

return $values;
}








public function shortcutToName(string $shortcut): string
{
if (!isset($this->shortcuts[$shortcut])) {
throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
}

return $this->shortcuts[$shortcut];
}








public function getSynopsis($short = false)
{
$elements = [];

if ($short && $this->getOptions()) {
$elements[] = '[options]';
} elseif (!$short) {
foreach ($this->getOptions() as $option) {
$value = '';
if ($option->acceptValue()) {
$value = sprintf(
' %s%s%s',
$option->isValueOptional() ? '[' : '',
strtoupper($option->getName()),
$option->isValueOptional() ? ']' : ''
);
}

$shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
$elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
}
}

if (\count($elements) && $this->getArguments()) {
$elements[] = '[--]';
}

$tail = '';
foreach ($this->getArguments() as $argument) {
$element = '<'.$argument->getName().'>';
if ($argument->isArray()) {
$element .= '...';
}

if (!$argument->isRequired()) {
$element = '['.$element;
$tail .= ']';
}

$elements[] = $element;
}

return implode(' ', $elements).$tail;
}
}
<?php










namespace Symfony\Component\Console\Input;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;












abstract class Input implements InputInterface, StreamableInputInterface
{
protected $definition;
protected $stream;
protected $options = [];
protected $arguments = [];
protected $interactive = true;

public function __construct(InputDefinition $definition = null)
{
if (null === $definition) {
$this->definition = new InputDefinition();
} else {
$this->bind($definition);
$this->validate();
}
}




public function bind(InputDefinition $definition)
{
$this->arguments = [];
$this->options = [];
$this->definition = $definition;

$this->parse();
}




abstract protected function parse();




public function validate()
{
$definition = $this->definition;
$givenArguments = $this->arguments;

$missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
});

if (\count($missingArguments) > 0) {
throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
}
}




public function isInteractive()
{
return $this->interactive;
}




public function setInteractive($interactive)
{
$this->interactive = (bool) $interactive;
}




public function getArguments()
{
return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
}




public function getArgument($name)
{
if (!$this->definition->hasArgument((string) $name)) {
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}

return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault();
}




public function setArgument($name, $value)
{
if (!$this->definition->hasArgument((string) $name)) {
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}

$this->arguments[$name] = $value;
}




public function hasArgument($name)
{
return $this->definition->hasArgument((string) $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 \array_key_exists($name, $this->options) ? $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);
}








public function escapeToken($token)
{
return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
}




public function setStream($stream)
{
$this->stream = $stream;
}




public function getStream()
{
return $this->stream;
}
}
<?php










namespace Symfony\Component\Console\Input;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;






class InputArgument
{
public const REQUIRED = 1;
public const OPTIONAL = 2;
public const IS_ARRAY = 4;

private $name;
private $mode;
private $default;
private $description;









public function __construct(string $name, int $mode = null, string $description = '', $default = null)
{
if (null === $mode) {
$mode = self::OPTIONAL;
} elseif ($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 = [];
} 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;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\InvalidOptionException;










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 $param => $value) {
if ($param && \is_string($param) && '-' === $param[0]) {
continue;
}

return $value;
}

return null;
}




public function hasParameterOption($values, $onlyParams = false)
{
$values = (array) $values;

foreach ($this->parameters as $k => $v) {
if (!\is_int($k)) {
$v = $k;
}

if ($onlyParams && '--' === $v) {
return false;
}

if (\in_array($v, $values)) {
return true;
}
}

return false;
}




public function getParameterOption($values, $default = false, $onlyParams = false)
{
$values = (array) $values;

foreach ($this->parameters as $k => $v) {
if ($onlyParams && ('--' === $k || (\is_int($k) && '--' === $v))) {
return $default;
}

if (\is_int($k)) {
if (\in_array($v, $values)) {
return true;
}
} elseif (\in_array($k, $values)) {
return $v;
}
}

return $default;
}






public function __toString()
{
$params = [];
foreach ($this->parameters as $param => $val) {
if ($param && \is_string($param) && '-' === $param[0]) {
$glue = ('-' === $param[1]) ? '=' : ' ';
if (\is_array($val)) {
foreach ($val as $v) {
$params[] = $param.('' != $v ? $glue.$this->escapeToken($v) : '');
}
} else {
$params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : '');
}
} else {
$params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val);
}
}

return implode(' ', $params);
}




protected function parse()
{
foreach ($this->parameters as $key => $value) {
if ('--' === $key) {
return;
}
if (str_starts_with($key, '--')) {
$this->addLongOption(substr($key, 2), $value);
} elseif (str_starts_with($key, '-')) {
$this->addShortOption(substr($key, 1), $value);
} else {
$this->addArgument($key, $value);
}
}
}






private function addShortOption(string $shortcut, $value)
{
if (!$this->definition->hasShortcut($shortcut)) {
throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
}

$this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
}







private function addLongOption(string $name, $value)
{
if (!$this->definition->hasOption($name)) {
throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
}

$option = $this->definition->getOption($name);

if (null === $value) {
if ($option->isValueRequired()) {
throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
}

if (!$option->isValueOptional()) {
$value = 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;

use Symfony\Component\Console\Exception\InvalidArgumentException;










class StringInput extends ArgvInput
{
public const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';




public function __construct(string $input)
{
parent::__construct([]);

$this->setTokens($this->tokenize($input));
}






private function tokenize(string $input): array
{
$tokens = [];
$length = \strlen($input);
$cursor = 0;
while ($cursor < $length) {
if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
} elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
$tokens[] = $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
$tokens[] = stripcslashes(substr($match[0], 1, -1));
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, 0, $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;







interface InputAwareInterface
{



public function setInput(InputInterface $input);
}
<?php










namespace Symfony\Component\Console\Input;







interface StreamableInputInterface extends InputInterface
{







public function setStream($stream);






public function getStream();
}
<?php










namespace Symfony\Component\Console\Input;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;






class InputOption
{



public const VALUE_NONE = 1;




public const VALUE_REQUIRED = 2;




public const VALUE_OPTIONAL = 4;




public const VALUE_IS_ARRAY = 8;

private $name;
private $shortcut;
private $mode;
private $default;
private $description;










public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
{
if (str_starts_with($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 (\is_array($shortcut)) {
$shortcut = implode('|', $shortcut);
}
$shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
$shortcuts = array_filter($shortcuts);
$shortcut = implode('|', $shortcuts);

if (empty($shortcut)) {
throw new InvalidArgumentException('An option shortcut cannot be empty.');
}
}

if (null === $mode) {
$mode = self::VALUE_NONE;
} elseif ($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 = [];
} 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(self $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;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;






interface InputInterface
{





public function getFirstArgument();














public function hasParameterOption($values, $onlyParams = false);















public function getParameterOption($values, $default = false, $onlyParams = 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\DependencyInjection;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\TypedReference;






class AddConsoleCommandPass implements CompilerPassInterface
{
private $commandLoaderServiceId;
private $commandTag;

public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command')
{
$this->commandLoaderServiceId = $commandLoaderServiceId;
$this->commandTag = $commandTag;
}

public function process(ContainerBuilder $container)
{
$commandServices = $container->findTaggedServiceIds($this->commandTag, true);
$lazyCommandMap = [];
$lazyCommandRefs = [];
$serviceIds = [];

foreach ($commandServices as $id => $tags) {
$definition = $container->getDefinition($id);
$class = $container->getParameterBag()->resolveValue($definition->getClass());

if (isset($tags[0]['command'])) {
$commandName = $tags[0]['command'];
} else {
if (!$r = $container->getReflectionClass($class)) {
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id));
}
if (!$r->isSubclassOf(Command::class)) {
throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must be a subclass of "%s".', $id, $this->commandTag, Command::class));
}
$commandName = $class::getDefaultName();
}

if (null === $commandName) {
if (!$definition->isPublic() || $definition->isPrivate()) {
$commandId = 'console.command.public_alias.'.$id;
$container->setAlias($commandId, $id)->setPublic(true);
$id = $commandId;
}
$serviceIds[] = $id;

continue;
}

unset($tags[0]);
$lazyCommandMap[$commandName] = $id;
$lazyCommandRefs[$id] = new TypedReference($id, $class);
$aliases = [];

foreach ($tags as $tag) {
if (isset($tag['command'])) {
$aliases[] = $tag['command'];
$lazyCommandMap[$tag['command']] = $id;
}
}

$definition->addMethodCall('setName', [$commandName]);

if ($aliases) {
$definition->addMethodCall('setAliases', [$aliases]);
}
}

$container
->register($this->commandLoaderServiceId, ContainerCommandLoader::class)
->setPublic(true)
->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]);

$container->setParameter('console.command.ids', $serviceIds);
}
}
<?php










namespace Symfony\Component\Console\Tester;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\StreamOutput;




trait TesterTrait
{

private $output;
private $inputs = [];
private $captureStreamsIndependently = false;








public function getDisplay($normalize = false)
{
if (null === $this->output) {
throw new \RuntimeException('Output not initialized, did you execute the command before requesting the display?');
}

rewind($this->output->getStream());

$display = stream_get_contents($this->output->getStream());

if ($normalize) {
$display = str_replace(\PHP_EOL, "\n", $display);
}

return $display;
}








public function getErrorOutput($normalize = false)
{
if (!$this->captureStreamsIndependently) {
throw new \LogicException('The error output is not available when the tester is run without "capture_stderr_separately" option set.');
}

rewind($this->output->getErrorOutput()->getStream());

$display = stream_get_contents($this->output->getErrorOutput()->getStream());

if ($normalize) {
$display = str_replace(\PHP_EOL, "\n", $display);
}

return $display;
}






public function getInput()
{
return $this->input;
}






public function getOutput()
{
return $this->output;
}






public function getStatusCode()
{
return $this->statusCode;
}









public function setInputs(array $inputs)
{
$this->inputs = $inputs;

return $this;
}










private function initOutput(array $options)
{
$this->captureStreamsIndependently = \array_key_exists('capture_stderr_separately', $options) && $options['capture_stderr_separately'];
if (!$this->captureStreamsIndependently) {
$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']);
}
} else {
$this->output = new ConsoleOutput(
$options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
$options['decorated'] ?? null
);

$errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
$errorOutput->setFormatter($this->output->getFormatter());
$errorOutput->setVerbosity($this->output->getVerbosity());
$errorOutput->setDecorated($this->output->isDecorated());

$reflectedOutput = new \ReflectionObject($this->output);
$strErrProperty = $reflectedOutput->getProperty('stderr');
$strErrProperty->setAccessible(true);
$strErrProperty->setValue($this->output, $errorOutput);

$reflectedParent = $reflectedOutput->getParentClass();
$streamProperty = $reflectedParent->getProperty('stream');
$streamProperty->setAccessible(true);
$streamProperty->setValue($this->output, fopen('php://memory', 'w', false));
}
}




private static function createStream(array $inputs)
{
$stream = fopen('php://memory', 'r+', false);

foreach ($inputs as $input) {
fwrite($stream, $input.\PHP_EOL);
}

rewind($stream);

return $stream;
}
}
<?php










namespace Symfony\Component\Console\Tester;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;











class ApplicationTester
{
use TesterTrait;

private $application;
private $input;
private $statusCode;

public function __construct(Application $application)
{
$this->application = $application;
}
















public function run(array $input, $options = [])
{
$this->input = new ArrayInput($input);
if (isset($options['interactive'])) {
$this->input->setInteractive($options['interactive']);
}

if ($this->inputs) {
$this->input->setStream(self::createStream($this->inputs));
}

$this->initOutput($options);

return $this->statusCode = $this->application->run($this->input, $this->output);
}
}
<?php










namespace Symfony\Component\Console\Tester;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;

/**
@gmail



*/
class CommandTester
{
use TesterTrait;

private $command;
private $input;
private $statusCode;

public function __construct(Command $command)
{
$this->command = $command;
}
















public function execute(array $input, array $options = [])
{

 
 if (!isset($input['command'])
&& (null !== $application = $this->command->getApplication())
&& $application->getDefinition()->hasArgument('command')
) {
$input = array_merge(['command' => $this->command->getName()], $input);
}

$this->input = new ArrayInput($input);

 $this->input->setStream(self::createStream($this->inputs));

if (isset($options['interactive'])) {
$this->input->setInteractive($options['interactive']);
}

if (!isset($options['decorated'])) {
$options['decorated'] = false;
}

$this->initOutput($options);

return $this->statusCode = $this->command->run($this->input, $this->output);
}
}
<?php










namespace Symfony\Component\Console\Event;








class ConsoleCommandEvent extends ConsoleEvent
{



public const RETURN_CODE_DISABLED = 113;




private $commandShouldRun = true;






public function disableCommand()
{
return $this->commandShouldRun = false;
}






public function enableCommand()
{
return $this->commandShouldRun = true;
}






public function commandShouldRun()
{
return $this->commandShouldRun;
}
}
<?php










namespace Symfony\Component\Console\Event;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;








class ConsoleTerminateEvent extends ConsoleEvent
{
private $exitCode;

public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
{
parent::__construct($command, $input, $output);

$this->setExitCode($exitCode);
}






public function setExitCode($exitCode)
{
$this->exitCode = (int) $exitCode;
}






public function getExitCode()
{
return $this->exitCode;
}
}
<?php










namespace Symfony\Component\Console\Event;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;






final class ConsoleErrorEvent extends ConsoleEvent
{
private $error;
private $exitCode;

public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
{
parent::__construct($command, $input, $output);

$this->error = $error;
}

public function getError(): \Throwable
{
return $this->error;
}

public function setError(\Throwable $error): void
{
$this->error = $error;
}

public function setExitCode(int $exitCode): void
{
$this->exitCode = $exitCode;

$r = new \ReflectionProperty($this->error, 'code');
$r->setAccessible(true);
$r->setValue($this->error, $this->exitCode);
}

public function getExitCode(): int
{
return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
}
}
<?php










namespace Symfony\Component\Console\Event;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\Event;






class ConsoleEvent extends Event
{
protected $command;

private $input;
private $output;

public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
{
$this->command = $command;
$this->input = $input;
$this->output = $output;
}






public function getCommand()
{
return $this->command;
}






public function getInput()
{
return $this->input;
}






public function getOutput()
{
return $this->output;
}
}
<?php










namespace Symfony\Component\Console\Question;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;






class Question
{
private $question;
private $attempts;
private $hidden = false;
private $hiddenFallback = true;
private $autocompleterCallback;
private $validator;
private $default;
private $normalizer;
private $trimmable = true;





public function __construct(string $question, $default = null)
{
$this->question = $question;
$this->default = $default;
}






public function getQuestion()
{
return $this->question;
}






public function getDefault()
{
return $this->default;
}






public function isHidden()
{
return $this->hidden;
}










public function setHidden($hidden)
{
if ($this->autocompleterCallback) {
throw new LogicException('A hidden question cannot use the autocompleter.');
}

$this->hidden = (bool) $hidden;

return $this;
}






public function isHiddenFallback()
{
return $this->hiddenFallback;
}








public function setHiddenFallback($fallback)
{
$this->hiddenFallback = (bool) $fallback;

return $this;
}






public function getAutocompleterValues()
{
$callback = $this->getAutocompleterCallback();

return $callback ? $callback('') : null;
}











public function setAutocompleterValues($values)
{
if (\is_array($values)) {
$values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);

$callback = static function () use ($values) {
return $values;
};
} elseif ($values instanceof \Traversable) {
$valueCache = null;
$callback = static function () use ($values, &$valueCache) {
return $valueCache ?? $valueCache = iterator_to_array($values, false);
};
} elseif (null === $values) {
$callback = null;
} else {
throw new InvalidArgumentException('Autocompleter values can be either an array, "null" or a "Traversable" object.');
}

return $this->setAutocompleterCallback($callback);
}




public function getAutocompleterCallback(): ?callable
{
return $this->autocompleterCallback;
}








public function setAutocompleterCallback(callable $callback = null): self
{
if ($this->hidden && null !== $callback) {
throw new LogicException('A hidden question cannot use the autocompleter.');
}

$this->autocompleterCallback = $callback;

return $this;
}






public function setValidator(callable $validator = null)
{
$this->validator = $validator;

return $this;
}






public function getValidator()
{
return $this->validator;
}












public function setMaxAttempts($attempts)
{
if (null !== $attempts) {
$attempts = (int) $attempts;
if ($attempts < 1) {
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
}
}

$this->attempts = $attempts;

return $this;
}








public function getMaxAttempts()
{
return $this->attempts;
}








public function setNormalizer(callable $normalizer)
{
$this->normalizer = $normalizer;

return $this;
}








public function getNormalizer()
{
return $this->normalizer;
}

protected function isAssoc($array)
{
return (bool) \count(array_filter(array_keys($array), 'is_string'));
}

public function isTrimmable(): bool
{
return $this->trimmable;
}




public function setTrimmable(bool $trimmable): self
{
$this->trimmable = $trimmable;

return $this;
}
}
<?php










namespace Symfony\Component\Console\Question;






class ConfirmationQuestion extends Question
{
private $trueAnswerRegex;






public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i')
{
parent::__construct($question, $default);

$this->trueAnswerRegex = $trueAnswerRegex;
$this->setNormalizer($this->getDefaultNormalizer());
}




private function getDefaultNormalizer(): callable
{
$default = $this->getDefault();
$regex = $this->trueAnswerRegex;

return function ($answer) use ($default, $regex) {
if (\is_bool($answer)) {
return $answer;
}

$answerIsTrue = (bool) preg_match($regex, $answer);
if (false === $default) {
return $answer && $answerIsTrue;
}

return '' === $answer || $answerIsTrue;
};
}
}
<?php










namespace Symfony\Component\Console\Question;

use Symfony\Component\Console\Exception\InvalidArgumentException;






class ChoiceQuestion extends Question
{
private $choices;
private $multiselect = false;
private $prompt = ' > ';
private $errorMessage = 'Value "%s" is invalid';






public function __construct(string $question, array $choices, $default = null)
{
if (!$choices) {
throw new \LogicException('Choice question must have at least 1 choice available.');
}

parent::__construct($question, $default);

$this->choices = $choices;
$this->setValidator($this->getDefaultValidator());
$this->setAutocompleterValues($choices);
}






public function getChoices()
{
return $this->choices;
}










public function setMultiselect($multiselect)
{
$this->multiselect = $multiselect;
$this->setValidator($this->getDefaultValidator());

return $this;
}






public function isMultiselect()
{
return $this->multiselect;
}






public function getPrompt()
{
return $this->prompt;
}








public function setPrompt($prompt)
{
$this->prompt = $prompt;

return $this;
}










public function setErrorMessage($errorMessage)
{
$this->errorMessage = $errorMessage;
$this->setValidator($this->getDefaultValidator());

return $this;
}

private function getDefaultValidator(): callable
{
$choices = $this->choices;
$errorMessage = $this->errorMessage;
$multiselect = $this->multiselect;
$isAssoc = $this->isAssoc($choices);

return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
if ($multiselect) {

 if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selected, $matches)) {
throw new InvalidArgumentException(sprintf($errorMessage, $selected));
}

$selectedChoices = explode(',', $selected);
} else {
$selectedChoices = [$selected];
}

if ($this->isTrimmable()) {
foreach ($selectedChoices as $k => $v) {
$selectedChoices[$k] = trim($v);
}
}

$multiselectChoices = [];
foreach ($selectedChoices as $value) {
$results = [];
foreach ($choices as $key => $choice) {
if ($choice === $value) {
$results[] = $key;
}
}

if (\count($results) > 1) {
throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
}

$result = array_search($value, $choices);

if (!$isAssoc) {
if (false !== $result) {
$result = $choices[$result];
} elseif (isset($choices[$value])) {
$result = $choices[$value];
}
} elseif (false === $result && isset($choices[$value])) {
$result = $value;
}

if (false === $result) {
throw new InvalidArgumentException(sprintf($errorMessage, $value));
}

$multiselectChoices[] = (string) $result;
}

if ($multiselect) {
return $multiselectChoices;
}

return current($multiselectChoices);
};
}
}
<?php










namespace Symfony\Component\Console\Style;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableCell;
use Symfony\Component\Console\Helper\TableSeparator;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\TrimmedBufferOutput;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Terminal;






class SymfonyStyle extends OutputStyle
{
public const MAX_LINE_LENGTH = 120;

private $input;
private $questionHelper;
private $progressBar;
private $lineLength;
private $bufferedOutput;

public function __construct(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->bufferedOutput = new TrimmedBufferOutput(\DIRECTORY_SEPARATOR === '\\' ? 4 : 2, $output->getVerbosity(), false, clone $output->getFormatter());

 $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH;
$this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);

parent::__construct($output);
}











public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true)
{
$messages = \is_array($messages) ? array_values($messages) : [$messages];

$this->autoPrependBlock();
$this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
$this->newLine();
}




public function title($message)
{
$this->autoPrependBlock();
$this->writeln([
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
]);
$this->newLine();
}




public function section($message)
{
$this->autoPrependBlock();
$this->writeln([
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
]);
$this->newLine();
}




public function listing(array $elements)
{
$this->autoPrependText();
$elements = array_map(function ($element) {
return sprintf(' * %s', $element);
}, $elements);

$this->writeln($elements);
$this->newLine();
}




public function text($message)
{
$this->autoPrependText();

$messages = \is_array($message) ? array_values($message) : [$message];
foreach ($messages as $message) {
$this->writeln(sprintf(' %s', $message));
}
}






public function comment($message)
{
$this->block($message, null, null, '<fg=default;bg=default> // </>', false, false);
}




public function success($message)
{
$this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
}




public function error($message)
{
$this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
}




public function warning($message)
{
$this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true);
}




public function note($message)
{
$this->block($message, 'NOTE', 'fg=yellow', ' ! ');
}




public function caution($message)
{
$this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
}




public function table(array $headers, array $rows)
{
$style = clone Table::getStyleDefinition('symfony-style-guide');
$style->setCellHeaderFormat('<info>%s</info>');

$table = new Table($this);
$table->setHeaders($headers);
$table->setRows($rows);
$table->setStyle($style);

$table->render();
$this->newLine();
}




public function horizontalTable(array $headers, array $rows)
{
$style = clone Table::getStyleDefinition('symfony-style-guide');
$style->setCellHeaderFormat('<info>%s</info>');

$table = new Table($this);
$table->setHeaders($headers);
$table->setRows($rows);
$table->setStyle($style);
$table->setHorizontal(true);

$table->render();
$this->newLine();
}











public function definitionList(...$list)
{
$style = clone Table::getStyleDefinition('symfony-style-guide');
$style->setCellHeaderFormat('<info>%s</info>');

$table = new Table($this);
$headers = [];
$row = [];
foreach ($list as $value) {
if ($value instanceof TableSeparator) {
$headers[] = $value;
$row[] = $value;
continue;
}
if (\is_string($value)) {
$headers[] = new TableCell($value, ['colspan' => 2]);
$row[] = null;
continue;
}
if (!\is_array($value)) {
throw new InvalidArgumentException('Value should be an array, string, or an instance of TableSeparator.');
}
$headers[] = key($value);
$row[] = current($value);
}

$table->setHeaders($headers);
$table->setRows([$row]);
$table->setHorizontal();
$table->setStyle($style);

$table->render();
$this->newLine();
}




public function ask($question, $default = null, $validator = null)
{
$question = new Question($question, $default);
$question->setValidator($validator);

return $this->askQuestion($question);
}




public function askHidden($question, $validator = null)
{
$question = new Question($question);

$question->setHidden(true);
$question->setValidator($validator);

return $this->askQuestion($question);
}




public function confirm($question, $default = true)
{
return $this->askQuestion(new ConfirmationQuestion($question, $default));
}




public function choice($question, array $choices, $default = null)
{
if (null !== $default) {
$values = array_flip($choices);
$default = $values[$default] ?? $default;
}

return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
}




public function progressStart($max = 0)
{
$this->progressBar = $this->createProgressBar($max);
$this->progressBar->start();
}




public function progressAdvance($step = 1)
{
$this->getProgressBar()->advance($step);
}




public function progressFinish()
{
$this->getProgressBar()->finish();
$this->newLine(2);
$this->progressBar = null;
}




public function createProgressBar($max = 0)
{
$progressBar = parent::createProgressBar($max);

if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
$progressBar->setEmptyBarCharacter('░'); 
 $progressBar->setProgressCharacter('');
$progressBar->setBarCharacter('▓'); 
 }

return $progressBar;
}




public function askQuestion(Question $question)
{
if ($this->input->isInteractive()) {
$this->autoPrependBlock();
}

if (!$this->questionHelper) {
$this->questionHelper = new SymfonyQuestionHelper();
}

$answer = $this->questionHelper->ask($this->input, $this, $question);

if ($this->input->isInteractive()) {
$this->newLine();
$this->bufferedOutput->write("\n");
}

return $answer;
}




public function writeln($messages, $type = self::OUTPUT_NORMAL)
{
if (!is_iterable($messages)) {
$messages = [$messages];
}

foreach ($messages as $message) {
parent::writeln($message, $type);
$this->writeBuffer($message, true, $type);
}
}




public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
if (!is_iterable($messages)) {
$messages = [$messages];
}

foreach ($messages as $message) {
parent::write($message, $newline, $type);
$this->writeBuffer($message, $newline, $type);
}
}




public function newLine($count = 1)
{
parent::newLine($count);
$this->bufferedOutput->write(str_repeat("\n", $count));
}






public function getErrorStyle()
{
return new self($this->input, $this->getErrorOutput());
}

private function getProgressBar(): ProgressBar
{
if (!$this->progressBar) {
throw new RuntimeException('The ProgressBar is not started.');
}

return $this->progressBar;
}

private function autoPrependBlock(): void
{
$chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);

if (!isset($chars[0])) {
$this->newLine(); 

return;
}

 $this->newLine(2 - substr_count($chars, "\n"));
}

private function autoPrependText(): void
{
$fetched = $this->bufferedOutput->fetch();

 if (!str_ends_with($fetched, "\n")) {
$this->newLine();
}
}

private function writeBuffer(string $message, bool $newLine, int $type): void
{

 $this->bufferedOutput->write($message, $newLine, $type);
}

private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
{
$indentLength = 0;
$prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
$lines = [];

if (null !== $type) {
$type = sprintf('[%s] ', $type);
$indentLength = \strlen($type);
$lineIndentation = str_repeat(' ', $indentLength);
}


 foreach ($messages as $key => $message) {
if ($escape) {
$message = OutputFormatter::escape($message);
}

$decorationLength = Helper::strlen($message) - Helper::strlenWithoutDecoration($this->getFormatter(), $message);
$messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength);
$messageLines = explode(\PHP_EOL, wordwrap($message, $messageLineLength, \PHP_EOL, true));
foreach ($messageLines as $messageLine) {
$lines[] = $messageLine;
}

if (\count($messages) > 1 && $key < \count($messages) - 1) {
$lines[] = '';
}
}

$firstLineIndex = 0;
if ($padding && $this->isDecorated()) {
$firstLineIndex = 1;
array_unshift($lines, '');
$lines[] = '';
}

foreach ($lines as $i => &$line) {
if (null !== $type) {
$line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
}

$line = $prefix.$line;
$line .= str_repeat(' ', max($this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line), 0));

if ($style) {
$line = sprintf('<%s>%s</>', $style, $line);
}
}

return $lines;
}
}
<?php










namespace Symfony\Component\Console\Style;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;






abstract class OutputStyle implements OutputInterface, StyleInterface
{
private $output;

public function __construct(OutputInterface $output)
{
$this->output = $output;
}




public function newLine($count = 1)
{
$this->output->write(str_repeat(\PHP_EOL, $count));
}






public function createProgressBar($max = 0)
{
return new ProgressBar($this->output, $max);
}




public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
{
$this->output->write($messages, $newline, $type);
}




public function writeln($messages, $type = self::OUTPUT_NORMAL)
{
$this->output->writeln($messages, $type);
}




public function setVerbosity($level)
{
$this->output->setVerbosity($level);
}




public function getVerbosity()
{
return $this->output->getVerbosity();
}




public function setDecorated($decorated)
{
$this->output->setDecorated($decorated);
}




public function isDecorated()
{
return $this->output->isDecorated();
}




public function setFormatter(OutputFormatterInterface $formatter)
{
$this->output->setFormatter($formatter);
}




public function getFormatter()
{
return $this->output->getFormatter();
}




public function isQuiet()
{
return $this->output->isQuiet();
}




public function isVerbose()
{
return $this->output->isVerbose();
}




public function isVeryVerbose()
{
return $this->output->isVeryVerbose();
}




public function isDebug()
{
return $this->output->isDebug();
}

protected function getErrorOutput()
{
if (!$this->output instanceof ConsoleOutputInterface) {
return $this->output;
}

return $this->output->getErrorOutput();
}
}
<?php










namespace Symfony\Component\Console\Style;






interface StyleInterface
{





public function title($message);






public function section($message);




public function listing(array $elements);






public function text($message);






public function success($message);






public function error($message);






public function warning($message);






public function note($message);






public function caution($message);




public function table(array $headers, array $rows);










public function ask($question, $default = null, $validator = null);









public function askHidden($question, $validator = null);









public function confirm($question, $default = true);









public function choice($question, array $choices, $default = null);






public function newLine($count = 1);






public function progressStart($max = 0);






public function progressAdvance($step = 1);




public function progressFinish();
}
<?php










namespace Symfony\Component\Console;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\HelpCommand;
use Symfony\Component\Console\Command\ListCommand;
use Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
use Symfony\Component\Console\Event\ConsoleCommandEvent;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Console\Exception\NamespaceNotFoundException;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\DebugFormatterHelper;
use Symfony\Component\Console\Helper\FormatterHelper;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\ProcessHelper;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputAwareInterface;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Debug\ErrorHandler as LegacyErrorHandler;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
use Symfony\Contracts\Service\ResetInterface;
















class Application implements ResetInterface
{
private $commands = [];
private $wantHelps = false;
private $runningCommand;
private $name;
private $version;
private $commandLoader;
private $catchExceptions = true;
private $autoExit = true;
private $definition;
private $helperSet;
private $dispatcher;
private $terminal;
private $defaultCommand;
private $singleCommand = false;
private $initialized;





public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
{
$this->name = $name;
$this->version = $version;
$this->terminal = new Terminal();
$this->defaultCommand = 'list';
}




public function setDispatcher(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
}

public function setCommandLoader(CommandLoaderInterface $commandLoader)
{
$this->commandLoader = $commandLoader;
}








public function run(InputInterface $input = null, OutputInterface $output = null)
{
if (\function_exists('putenv')) {
@putenv('LINES='.$this->terminal->getHeight());
@putenv('COLUMNS='.$this->terminal->getWidth());
}

if (null === $input) {
$input = new ArgvInput();
}

if (null === $output) {
$output = new ConsoleOutput();
}

$renderException = function (\Throwable $e) use ($output) {
if ($output instanceof ConsoleOutputInterface) {
$this->renderThrowable($e, $output->getErrorOutput());
} else {
$this->renderThrowable($e, $output);
}
};
if ($phpHandler = set_exception_handler($renderException)) {
restore_exception_handler();
if (!\is_array($phpHandler) || (!$phpHandler[0] instanceof ErrorHandler && !$phpHandler[0] instanceof LegacyErrorHandler)) {
$errorHandler = true;
} elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
$phpHandler[0]->setExceptionHandler($errorHandler);
}
}

$this->configureIO($input, $output);

try {
$exitCode = $this->doRun($input, $output);
} catch (\Exception $e) {
if (!$this->catchExceptions) {
throw $e;
}

$renderException($e);

$exitCode = $e->getCode();
if (is_numeric($exitCode)) {
$exitCode = (int) $exitCode;
if (0 === $exitCode) {
$exitCode = 1;
}
} else {
$exitCode = 1;
}
} finally {

 
 if (!$phpHandler) {
if (set_exception_handler($renderException) === $renderException) {
restore_exception_handler();
}
restore_exception_handler();
} elseif (!$errorHandler) {
$finalHandler = $phpHandler[0]->setExceptionHandler(null);
if ($finalHandler !== $renderException) {
$phpHandler[0]->setExceptionHandler($finalHandler);
}
}
}

if ($this->autoExit) {
if ($exitCode > 255) {
$exitCode = 255;
}

exit($exitCode);
}

return $exitCode;
}






public function doRun(InputInterface $input, OutputInterface $output)
{
if (true === $input->hasParameterOption(['--version', '-V'], true)) {
$output->writeln($this->getLongVersion());

return 0;
}

try {

 $input->bind($this->getDefinition());
} catch (ExceptionInterface $e) {

 }

$name = $this->getCommandName($input);
if (true === $input->hasParameterOption(['--help', '-h'], true)) {
if (!$name) {
$name = 'help';
$input = new ArrayInput(['command_name' => $this->defaultCommand]);
} else {
$this->wantHelps = true;
}
}

if (!$name) {
$name = $this->defaultCommand;
$definition = $this->getDefinition();
$definition->setArguments(array_merge(
$definition->getArguments(),
[
'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
]
));
}

try {
$this->runningCommand = null;

 $command = $this->find($name);
} catch (\Throwable $e) {
if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
if (null !== $this->dispatcher) {
$event = new ConsoleErrorEvent($input, $output, $e);
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);

if (0 === $event->getExitCode()) {
return 0;
}

$e = $event->getError();
}

throw $e;
}

$alternative = $alternatives[0];

$style = new SymfonyStyle($input, $output);
$style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error');
if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
if (null !== $this->dispatcher) {
$event = new ConsoleErrorEvent($input, $output, $e);
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);

return $event->getExitCode();
}

return 1;
}

$command = $this->find($alternative);
}

$this->runningCommand = $command;
$exitCode = $this->doRunCommand($command, $input, $output);
$this->runningCommand = null;

return $exitCode;
}




public function reset()
{
}

public function setHelperSet(HelperSet $helperSet)
{
$this->helperSet = $helperSet;
}






public function getHelperSet()
{
if (!$this->helperSet) {
$this->helperSet = $this->getDefaultHelperSet();
}

return $this->helperSet;
}

public function setDefinition(InputDefinition $definition)
{
$this->definition = $definition;
}






public function getDefinition()
{
if (!$this->definition) {
$this->definition = $this->getDefaultInputDefinition();
}

if ($this->singleCommand) {
$inputDefinition = $this->definition;
$inputDefinition->setArguments();

return $inputDefinition;
}

return $this->definition;
}






public function getHelp()
{
return $this->getLongVersion();
}






public function areExceptionsCaught()
{
return $this->catchExceptions;
}






public function setCatchExceptions($boolean)
{
$this->catchExceptions = (bool) $boolean;
}






public function isAutoExitEnabled()
{
return $this->autoExit;
}






public function setAutoExit($boolean)
{
$this->autoExit = (bool) $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()) {
if ('UNKNOWN' !== $this->getVersion()) {
return sprintf('%s <info>%s</info>', $this->getName(), $this->getVersion());
}

return $this->getName();
}

return 'Console Tool';
}








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)
{
$this->init();

$command->setApplication($this);

if (!$command->isEnabled()) {
$command->setApplication(null);

return null;
}


 $command->getDefinition();

if (!$command->getName()) {
throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($command)));
}

$this->commands[$command->getName()] = $command;

foreach ($command->getAliases() as $alias) {
$this->commands[$alias] = $command;
}

return $command;
}










public function get($name)
{
$this->init();

if (!$this->has($name)) {
throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
}


 if (!isset($this->commands[$name])) {
throw new CommandNotFoundException(sprintf('The "%s" command cannot be found because it is registered under multiple names. Make sure you don\'t set a different name via constructor or "setName()".', $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)
{
$this->init();

return isset($this->commands[$name]) || ($this->commandLoader && $this->commandLoader->has($name) && $this->add($this->commandLoader->get($name)));
}








public function getNamespaces()
{
$namespaces = [];
foreach ($this->all() as $command) {
if ($command->isHidden()) {
continue;
}

$namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));

foreach ($command->getAliases() as $alias) {
$namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
}
}

return array_values(array_unique(array_filter($namespaces)));
}










public function findNamespace($namespace)
{
$allNamespaces = $this->getNamespaces();
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
$namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);

if (empty($namespaces)) {
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);

if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
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 NamespaceNotFoundException($message, $alternatives);
}

$exact = \in_array($namespace, $namespaces, true);
if (\count($namespaces) > 1 && !$exact) {
throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
}

return $exact ? $namespace : reset($namespaces);
}













public function find($name)
{
$this->init();

$aliases = [];

foreach ($this->commands as $command) {
foreach ($command->getAliases() as $alias) {
if (!$this->has($alias)) {
$this->commands[$alias] = $command;
}
}
}

if ($this->has($name)) {
return $this->get($name);
}

$allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
$commands = preg_grep('{^'.$expr.'}', $allCommands);

if (empty($commands)) {
$commands = preg_grep('{^'.$expr.'}i', $allCommands);
}


 if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) {
if (false !== $pos = strrpos($name, ':')) {

 $this->findNamespace(substr($name, 0, $pos));
}

$message = sprintf('Command "%s" is not defined.', $name);

if ($alternatives = $this->findAlternatives($name, $allCommands)) {

 $alternatives = array_filter($alternatives, function ($name) {
return !$this->get($name)->isHidden();
});

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 CommandNotFoundException($message, array_values($alternatives));
}


 if (\count($commands) > 1) {
$commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
$commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
if (!$commandList[$nameOrAlias] instanceof Command) {
$commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
}

$commandName = $commandList[$nameOrAlias]->getName();

$aliases[$nameOrAlias] = $commandName;

return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
}));
}

if (\count($commands) > 1) {
$usableWidth = $this->terminal->getWidth() - 10;
$abbrevs = array_values($commands);
$maxLen = 0;
foreach ($abbrevs as $abbrev) {
$maxLen = max(Helper::strlen($abbrev), $maxLen);
}
$abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) {
if ($commandList[$cmd]->isHidden()) {
unset($commands[array_search($cmd, $commands)]);

return false;
}

$abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription();

return Helper::strlen($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev;
}, array_values($commands));

if (\count($commands) > 1) {
$suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));

throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
}
}

$command = $this->get(reset($commands));

if ($command->isHidden()) {
@trigger_error(sprintf('Command "%s" is hidden, finding it using an abbreviation is deprecated since Symfony 4.4, use its full name instead.', $command->getName()), \E_USER_DEPRECATED);
}

return $command;
}










public function all($namespace = null)
{
$this->init();

if (null === $namespace) {
if (!$this->commandLoader) {
return $this->commands;
}

$commands = $this->commands;
foreach ($this->commandLoader->getNames() as $name) {
if (!isset($commands[$name]) && $this->has($name)) {
$commands[$name] = $this->get($name);
}
}

return $commands;
}

$commands = [];
foreach ($this->commands as $name => $command) {
if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
$commands[$name] = $command;
}
}

if ($this->commandLoader) {
foreach ($this->commandLoader->getNames() as $name) {
if (!isset($commands[$name]) && $namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1) && $this->has($name)) {
$commands[$name] = $this->get($name);
}
}
}

return $commands;
}








public static function getAbbreviations($names)
{
$abbrevs = [];
foreach ($names as $name) {
for ($len = \strlen($name); $len > 0; --$len) {
$abbrev = substr($name, 0, $len);
$abbrevs[$abbrev][] = $name;
}
}

return $abbrevs;
}






public function renderException(\Exception $e, OutputInterface $output)
{
@trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), \E_USER_DEPRECATED);

$output->writeln('', OutputInterface::VERBOSITY_QUIET);

$this->doRenderException($e, $output);

$this->finishRenderThrowableOrException($output);
}

public function renderThrowable(\Throwable $e, OutputInterface $output): void
{
if (__CLASS__ !== static::class && __CLASS__ === (new \ReflectionMethod($this, 'renderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'renderException'))->getDeclaringClass()->getName()) {
@trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), \E_USER_DEPRECATED);

if (!$e instanceof \Exception) {
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
}

$this->renderException($e, $output);

return;
}

$output->writeln('', OutputInterface::VERBOSITY_QUIET);

$this->doRenderThrowable($e, $output);

$this->finishRenderThrowableOrException($output);
}

private function finishRenderThrowableOrException(OutputInterface $output): void
{
if (null !== $this->runningCommand) {
$output->writeln(sprintf('<info>%s</info>', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
}
}




protected function doRenderException(\Exception $e, OutputInterface $output)
{
@trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), \E_USER_DEPRECATED);

$this->doActuallyRenderThrowable($e, $output);
}

protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void
{
if (__CLASS__ !== static::class && __CLASS__ === (new \ReflectionMethod($this, 'doRenderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'doRenderException'))->getDeclaringClass()->getName()) {
@trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), \E_USER_DEPRECATED);

if (!$e instanceof \Exception) {
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
}

$this->doRenderException($e, $output);

return;
}

$this->doActuallyRenderThrowable($e, $output);
}

private function doActuallyRenderThrowable(\Throwable $e, OutputInterface $output): void
{
do {
$message = trim($e->getMessage());
if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$class = get_debug_type($e);
$title = sprintf('  [%s%s]  ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
$len = Helper::strlen($title);
} else {
$len = 0;
}

if (str_contains($message, "@anonymous\0")) {
$message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
}, $message);
}

$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX;
$lines = [];
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {

 $lineLength = Helper::strlen($line) + 4;
$lines[] = [$line, $lineLength];

$len = max($lineLength, $len);
}
}

$messages = [];
if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$messages[] = sprintf('<comment>%s</comment>', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a')));
}
$messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
}
foreach ($lines as $line) {
$messages[] = sprintf('<error>  %s  %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
}
$messages[] = $emptyLine;
$messages[] = '';

$output->writeln($messages, OutputInterface::VERBOSITY_QUIET);

if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);


 $trace = $e->getTrace();

array_unshift($trace, [
'function' => '',
'file' => $e->getFile() ?: 'n/a',
'line' => $e->getLine() ?: 'n/a',
'args' => [],
]);

for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
$class = $trace[$i]['class'] ?? '';
$type = $trace[$i]['type'] ?? '';
$function = $trace[$i]['function'] ?? '';
$file = $trace[$i]['file'] ?? 'n/a';
$line = $trace[$i]['line'] ?? 'n/a';

$output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
}

$output->writeln('', OutputInterface::VERBOSITY_QUIET);
}
} while ($e = $e->getPrevious());
}




protected function configureIO(InputInterface $input, OutputInterface $output)
{
if (true === $input->hasParameterOption(['--ansi'], true)) {
$output->setDecorated(true);
} elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
$output->setDecorated(false);
}

if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
$input->setInteractive(false);
}

switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
case -1: $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); break;
case 1: $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); break;
case 2: $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); break;
case 3: $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG); break;
default: $shellVerbosity = 0; break;
}

if (true === $input->hasParameterOption(['--quiet', '-q'], true)) {
$output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
$shellVerbosity = -1;
} else {
if ($input->hasParameterOption('-vvv', true) || $input->hasParameterOption('--verbose=3', true) || 3 === $input->getParameterOption('--verbose', false, true)) {
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
$shellVerbosity = 3;
} elseif ($input->hasParameterOption('-vv', true) || $input->hasParameterOption('--verbose=2', true) || 2 === $input->getParameterOption('--verbose', false, true)) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
$shellVerbosity = 2;
} elseif ($input->hasParameterOption('-v', true) || $input->hasParameterOption('--verbose=1', true) || $input->hasParameterOption('--verbose', true) || $input->getParameterOption('--verbose', false, true)) {
$output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
$shellVerbosity = 1;
}
}

if (-1 === $shellVerbosity) {
$input->setInteractive(false);
}

if (\function_exists('putenv')) {
@putenv('SHELL_VERBOSITY='.$shellVerbosity);
}
$_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
$_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
}









protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
foreach ($command->getHelperSet() as $helper) {
if ($helper instanceof InputAwareInterface) {
$helper->setInput($input);
}
}

if (null === $this->dispatcher) {
return $command->run($input, $output);
}


 try {
$command->mergeApplicationDefinition();
$input->bind($command->getDefinition());
} catch (ExceptionInterface $e) {

 }

$event = new ConsoleCommandEvent($command, $input, $output);
$e = null;

try {
$this->dispatcher->dispatch($event, ConsoleEvents::COMMAND);

if ($event->commandShouldRun()) {
$exitCode = $command->run($input, $output);
} else {
$exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
}
} catch (\Throwable $e) {
$event = new ConsoleErrorEvent($input, $output, $e, $command);
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
$e = $event->getError();

if (0 === $exitCode = $event->getExitCode()) {
$e = null;
}
}

$event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
$this->dispatcher->dispatch($event, ConsoleEvents::TERMINATE);

if (null !== $e) {
throw $e;
}

return $event->getExitCode();
}






protected function getCommandName(InputInterface $input)
{
return $this->singleCommand ? $this->defaultCommand : $input->getFirstArgument();
}






protected function getDefaultInputDefinition()
{
return new InputDefinition([
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|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
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 [new HelpCommand(), new ListCommand()];
}






protected function getDefaultHelperSet()
{
return new HelperSet([
new FormatterHelper(),
new DebugFormatterHelper(),
new ProcessHelper(),
new QuestionHelper(),
]);
}




private function getAbbreviationSuggestions(array $abbrevs): string
{
return '    '.implode("\n    ", $abbrevs);
}











public function extractNamespace($name, $limit = null)
{
$parts = explode(':', $name, -1);

return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
}







private function findAlternatives(string $name, iterable $collection): array
{
$threshold = 1e3;
$alternatives = [];

$collectionParts = [];
foreach ($collection as $item) {
$collectionParts[$item] = explode(':', $item);
}

foreach (explode(':', $name) as $i => $subname) {
foreach ($collectionParts as $collectionName => $parts) {
$exists = isset($alternatives[$collectionName]);
if (!isset($parts[$i]) && $exists) {
$alternatives[$collectionName] += $threshold;
continue;
} elseif (!isset($parts[$i])) {
continue;
}

$lev = levenshtein($subname, $parts[$i]);
if ($lev <= \strlen($subname) / 3 || '' !== $subname && str_contains($parts[$i], $subname)) {
$alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
} elseif ($exists) {
$alternatives[$collectionName] += $threshold;
}
}
}

foreach ($collection as $item) {
$lev = levenshtein($name, $item);
if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) {
$alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
}
}

$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);

return array_keys($alternatives);
}









public function setDefaultCommand($commandName, $isSingleCommand = false)
{
$this->defaultCommand = $commandName;

if ($isSingleCommand) {

 $this->find($commandName);

$this->singleCommand = true;
}

return $this;
}




public function isSingleCommand(): bool
{
return $this->singleCommand;
}

private function splitStringByWidth(string $string, int $width): array
{

 
 
 if (false === $encoding = mb_detect_encoding($string, null, true)) {
return str_split($string, $width);
}

$utf8String = mb_convert_encoding($string, 'utf8', $encoding);
$lines = [];
$line = '';

$offset = 0;
while (preg_match('/.{1,10000}/u', $utf8String, $m, 0, $offset)) {
$offset += \strlen($m[0]);

foreach (preg_split('//u', $m[0]) as $char) {

 if (mb_strwidth($line.$char, 'utf8') <= $width) {
$line .= $char;
continue;
}

 $lines[] = str_pad($line, $width);
$line = $char;
}
}

$lines[] = \count($lines) ? str_pad($line, $width) : $line;

mb_convert_variables($encoding, 'utf8', $lines);

return $lines;
}






private function extractAllNamespaces(string $name): array
{

 $parts = explode(':', $name, -1);
$namespaces = [];

foreach ($parts as $part) {
if (\count($namespaces)) {
$namespaces[] = end($namespaces).':'.$part;
} else {
$namespaces[] = $part;
}
}

return $namespaces;
}

private function init()
{
if ($this->initialized) {
return;
}
$this->initialized = true;

foreach ($this->getDefaultCommands() as $command) {
$this->add($command);
}
}
}
<?php










namespace Symfony\Component\Console\EventListener;

use Psr\Log\LoggerInterface;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Console\Event\ConsoleEvent;
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
@gmail

*/
class ErrorListener implements EventSubscriberInterface
{
private $logger;

public function __construct(LoggerInterface $logger = null)
{
$this->logger = $logger;
}

public function onConsoleError(ConsoleErrorEvent $event)
{
if (null === $this->logger) {
return;
}

$error = $event->getError();

if (!$inputString = $this->getInputString($event)) {
$this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);

return;
}

$this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
}

public function onConsoleTerminate(ConsoleTerminateEvent $event)
{
if (null === $this->logger) {
return;
}

$exitCode = $event->getExitCode();

if (0 === $exitCode) {
return;
}

if (!$inputString = $this->getInputString($event)) {
$this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);

return;
}

$this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
}

public static function getSubscribedEvents()
{
return [
ConsoleEvents::ERROR => ['onConsoleError', -128],
ConsoleEvents::TERMINATE => ['onConsoleTerminate', -128],
];
}

private static function getInputString(ConsoleEvent $event): ?string
{
$commandName = $event->getCommand() ? $event->getCommand()->getName() : null;
$input = $event->getInput();

if (method_exists($input, '__toString')) {
if ($commandName) {
return str_replace(["'$commandName'", "\"$commandName\""], $commandName, (string) $input);
}

return (string) $input;
}

return $commandName;
}
}
<?php










namespace Symfony\Component\Console\Output;









interface ConsoleOutputInterface extends OutputInterface
{





public function getErrorOutput();

public function setErrorOutput(OutputInterface $error);
}
<?php










namespace Symfony\Component\Console\Output;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;






class TrimmedBufferOutput extends Output
{
private $maxLength;
private $buffer = '';

public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
{
if ($maxLength <= 0) {
throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
}

parent::__construct($verbosity, $decorated, $formatter);
$this->maxLength = $maxLength;
}






public function fetch()
{
$content = $this->buffer;
$this->buffer = '';

return $content;
}




protected function doWrite($message, $newline)
{
$this->buffer .= $message;

if ($newline) {
$this->buffer .= \PHP_EOL;
}

$this->buffer = substr($this->buffer, 0 - $this->maxLength);
}
}
<?php










namespace Symfony\Component\Console\Output;

use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;














class StreamOutput extends Output
{
private $stream;









public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, bool $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 ($newline) {
$message .= \PHP_EOL;
}

@fwrite($this->stream, $message);

fflush($this->stream);
}














protected function hasColorSupport()
{

 if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
return false;
}

if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}

if (\DIRECTORY_SEPARATOR === '\\') {
return (\function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($this->stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
}

if (\function_exists('stream_isatty')) {
return @stream_isatty($this->stream);
}

if (\function_exists('posix_isatty')) {
return @posix_isatty($this->stream);
}

$stat = @fstat($this->stream);

 return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
}
}
<?php










namespace Symfony\Component\Console\Output;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Terminal;

/**
@gmail

*/
class ConsoleSectionOutput extends StreamOutput
{
private $content = [];
private $lines = 0;
private $sections;
private $terminal;





public function __construct($stream, array &$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter)
{
parent::__construct($stream, $verbosity, $decorated, $formatter);
array_unshift($sections, $this);
$this->sections = &$sections;
$this->terminal = new Terminal();
}






public function clear(int $lines = null)
{
if (empty($this->content) || !$this->isDecorated()) {
return;
}

if ($lines) {
array_splice($this->content, -($lines * 2)); 
 } else {
$lines = $this->lines;
$this->content = [];
}

$this->lines -= $lines;

parent::doWrite($this->popStreamContentUntilCurrentSection($lines), false);
}






public function overwrite($message)
{
$this->clear();
$this->writeln($message);
}

public function getContent(): string
{
return implode('', $this->content);
}




public function addContent(string $input)
{
foreach (explode(\PHP_EOL, $input) as $lineContent) {
$this->lines += ceil($this->getDisplayLength($lineContent) / $this->terminal->getWidth()) ?: 1;
$this->content[] = $lineContent;
$this->content[] = \PHP_EOL;
}
}




protected function doWrite($message, $newline)
{
if (!$this->isDecorated()) {
parent::doWrite($message, $newline);

return;
}

$erasedContent = $this->popStreamContentUntilCurrentSection();

$this->addContent($message);

parent::doWrite($message, true);
parent::doWrite($erasedContent, false);
}





private function popStreamContentUntilCurrentSection(int $numberOfLinesToClearFromCurrentSection = 0): string
{
$numberOfLinesToClear = $numberOfLinesToClearFromCurrentSection;
$erasedContent = [];

foreach ($this->sections as $section) {
if ($section === $this) {
break;
}

$numberOfLinesToClear += $section->lines;
$erasedContent[] = $section->getContent();
}

if ($numberOfLinesToClear > 0) {

 parent::doWrite(sprintf("\x1b[%dA", $numberOfLinesToClear), false);

 parent::doWrite("\x1b[0J", false);
}

return implode('', array_reverse($erasedContent));
}

private function getDisplayLength(string $text): string
{
return Helper::strlenWithoutDecoration($this->getFormatter(), str_replace("\t", '        ', $text));
}
}
<?php










namespace Symfony\Component\Console\Output;

use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;














abstract class Output implements OutputInterface
{
private $verbosity;
private $formatter;






public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
{
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
$this->formatter = $formatter ?? new OutputFormatter();
$this->formatter->setDecorated($decorated);
}




public function setFormatter(OutputFormatterInterface $formatter)
{
$this->formatter = $formatter;
}




public function getFormatter()
{
return $this->formatter;
}




public function setDecorated($decorated)
{
$this->formatter->setDecorated($decorated);
}




public function isDecorated()
{
return $this->formatter->isDecorated();
}




public function setVerbosity($level)
{
$this->verbosity = (int) $level;
}




public function getVerbosity()
{
return $this->verbosity;
}




public function isQuiet()
{
return self::VERBOSITY_QUIET === $this->verbosity;
}




public function isVerbose()
{
return self::VERBOSITY_VERBOSE <= $this->verbosity;
}




public function isVeryVerbose()
{
return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
}




public function isDebug()
{
return self::VERBOSITY_DEBUG <= $this->verbosity;
}




public function writeln($messages, $options = self::OUTPUT_NORMAL)
{
$this->write($messages, true, $options);
}




public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
{
if (!is_iterable($messages)) {
$messages = [$messages];
}

$types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
$type = $types & $options ?: self::OUTPUT_NORMAL;

$verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
$verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;

if ($verbosity > $this->getVerbosity()) {
return;
}

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;
}

$this->doWrite($message ?? '', $newline);
}
}







abstract protected function doWrite($message, $newline);
}
<?php










namespace Symfony\Component\Console\Output;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;






interface OutputInterface
{
public const VERBOSITY_QUIET = 16;
public const VERBOSITY_NORMAL = 32;
public const VERBOSITY_VERBOSE = 64;
public const VERBOSITY_VERY_VERBOSE = 128;
public const VERBOSITY_DEBUG = 256;

public const OUTPUT_NORMAL = 1;
public const OUTPUT_RAW = 2;
public const OUTPUT_PLAIN = 4;








public function write($messages, $newline = false, $options = 0);







public function writeln($messages, $options = 0);






public function setVerbosity($level);






public function getVerbosity();






public function isQuiet();






public function isVerbose();






public function isVeryVerbose();






public function isDebug();






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\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;









class NullOutput implements OutputInterface
{



public function setFormatter(OutputFormatterInterface $formatter)
{

 }




public function getFormatter()
{

 return new OutputFormatter();
}




public function setDecorated($decorated)
{

 }




public function isDecorated()
{
return false;
}




public function setVerbosity($level)
{

 }




public function getVerbosity()
{
return self::VERBOSITY_QUIET;
}




public function isQuiet()
{
return true;
}




public function isVerbose()
{
return false;
}




public function isVeryVerbose()
{
return false;
}




public function isDebug()
{
return false;
}




public function writeln($messages, $options = self::OUTPUT_NORMAL)
{

 }




public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
{

 }
}
<?php










namespace Symfony\Component\Console\Output;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;















class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
{
private $stderr;
private $consoleSectionOutputs = [];






public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
{
parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);

if (null === $formatter) {

 $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);

return;
}

$actualDecorated = $this->isDecorated();
$this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());

if (null === $decorated) {
$this->setDecorated($actualDecorated && $this->stderr->isDecorated());
}
}




public function section(): ConsoleSectionOutput
{
return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
}




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 false === $this->isRunningOS400();
}







protected function hasStderrSupport()
{
return false === $this->isRunningOS400();
}





private function isRunningOS400(): bool
{
$checks = [
\function_exists('php_uname') ? php_uname('s') : '',
getenv('OSTYPE'),
\PHP_OS,
];

return false !== stripos(implode(';', $checks), 'OS400');
}




private function openOutputStream()
{
if (!$this->hasStdoutSupport()) {
return fopen('php://output', 'w');
}

return @fopen('php://stdout', 'w') ?: fopen('php://output', 'w');
}




private function openErrorStream()
{
return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w');
}
}
<?php










namespace Symfony\Component\Console\Output;




class BufferedOutput extends Output
{
private $buffer = '';






public function fetch()
{
$content = $this->buffer;
$this->buffer = '';

return $content;
}




protected function doWrite($message, $newline)
{
$this->buffer .= $message;

if ($newline) {
$this->buffer .= \PHP_EOL;
}
}
}
<?php










namespace Symfony\Component\Console\CommandLoader;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\CommandNotFoundException;




interface CommandLoaderInterface
{









public function get($name);








public function has($name);




public function getNames();
}
<?php










namespace Symfony\Component\Console\CommandLoader;

use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Exception\CommandNotFoundException;






class ContainerCommandLoader implements CommandLoaderInterface
{
private $container;
private $commandMap;




public function __construct(ContainerInterface $container, array $commandMap)
{
$this->container = $container;
$this->commandMap = $commandMap;
}




public function get($name)
{
if (!$this->has($name)) {
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
}

return $this->container->get($this->commandMap[$name]);
}




public function has($name)
{
return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]);
}




public function getNames()
{
return array_keys($this->commandMap);
}
}
<?php










namespace Symfony\Component\Console\CommandLoader;

use Symfony\Component\Console\Exception\CommandNotFoundException;






class FactoryCommandLoader implements CommandLoaderInterface
{
private $factories;




public function __construct(array $factories)
{
$this->factories = $factories;
}




public function has($name)
{
return isset($this->factories[$name]);
}




public function get($name)
{
if (!isset($this->factories[$name])) {
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
}

$factory = $this->factories[$name];

return $factory();
}




public function getNames()
{
return array_keys($this->factories);
}
}
<?php










namespace Symfony\Component\Console;






final class ConsoleEvents
{
/**
@Event("Symfony\Component\Console\Event\ConsoleCommandEvent")




*/
public const COMMAND = 'console.command';

/**
@Event("Symfony\Component\Console\Event\ConsoleTerminateEvent")



*/
public const TERMINATE = 'console.terminate';

/**
@Event("Symfony\Component\Console\Event\ConsoleErrorEvent")





*/
public const ERROR = 'console.error';
}
<?php










namespace Symfony\Component\Console\Descriptor;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;








class MarkdownDescriptor extends Descriptor
{



public function describe(OutputInterface $output, $object, array $options = [])
{
$decorated = $output->isDecorated();
$output->setDecorated(false);

parent::describe($output, $object, $options);

$output->setDecorated($decorated);
}




protected function write($content, $decorated = true)
{
parent::write($content, $decorated);
}




protected function describeInputArgument(InputArgument $argument, array $options = [])
{
$this->write(
'#### `'.($argument->getName() ?: '<none>')."`\n\n"
.($argument->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $argument->getDescription())."\n\n" : '')
.'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
.'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
.'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
);
}




protected function describeInputOption(InputOption $option, array $options = [])
{
$name = '--'.$option->getName();
if ($option->getShortcut()) {
$name .= '|-'.str_replace('|', '|-', $option->getShortcut()).'';
}

$this->write(
'#### `'.$name.'`'."\n\n"
.($option->getDescription() ? preg_replace('/\s*[\r\n]\s*/', "\n", $option->getDescription())."\n\n" : '')
.'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
.'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
.'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
.'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
);
}




protected function describeInputDefinition(InputDefinition $definition, array $options = [])
{
if ($showArguments = \count($definition->getArguments()) > 0) {
$this->write('### Arguments');
foreach ($definition->getArguments() as $argument) {
$this->write("\n\n");
$this->write($this->describeInputArgument($argument));
}
}

if (\count($definition->getOptions()) > 0) {
if ($showArguments) {
$this->write("\n\n");
}

$this->write('### Options');
foreach ($definition->getOptions() as $option) {
$this->write("\n\n");
$this->write($this->describeInputOption($option));
}
}
}




protected function describeCommand(Command $command, array $options = [])
{
$command->getSynopsis();
$command->mergeApplicationDefinition(false);

$this->write(
'`'.$command->getName()."`\n"
.str_repeat('-', Helper::strlen($command->getName()) + 2)."\n\n"
.($command->getDescription() ? $command->getDescription()."\n\n" : '')
.'### Usage'."\n\n"
.array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
return $carry.'* `'.$usage.'`'."\n";
})
);

if ($help = $command->getProcessedHelp()) {
$this->write("\n");
$this->write($help);
}

if ($command->getNativeDefinition()) {
$this->write("\n\n");
$this->describeInputDefinition($command->getNativeDefinition());
}
}




protected function describeApplication(Application $application, array $options = [])
{
$describedNamespace = $options['namespace'] ?? null;
$description = new ApplicationDescription($application, $describedNamespace);
$title = $this->getApplicationTitle($application);

$this->write($title."\n".str_repeat('=', Helper::strlen($title)));

foreach ($description->getNamespaces() as $namespace) {
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
$this->write("\n\n");
$this->write('**'.$namespace['id'].':**');
}

$this->write("\n\n");
$this->write(implode("\n", array_map(function ($commandName) use ($description) {
return sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName()));
}, $namespace['commands'])));
}

foreach ($description->getCommands() as $command) {
$this->write("\n\n");
$this->write($this->describeCommand($command));
}
}

private function getApplicationTitle(Application $application): string
{
if ('UNKNOWN' !== $application->getName()) {
if ('UNKNOWN' !== $application->getVersion()) {
return sprintf('%s %s', $application->getName(), $application->getVersion());
}

return $application->getName();
}

return 'Console Tool';
}
}
<?php










namespace Symfony\Component\Console\Descriptor;

use Symfony\Component\Console\Output\OutputInterface;






interface DescriptorInterface
{





public function describe(OutputInterface $output, $object, array $options = []);
}
<?php










namespace Symfony\Component\Console\Descriptor;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;








class JsonDescriptor extends Descriptor
{



protected function describeInputArgument(InputArgument $argument, array $options = [])
{
$this->writeData($this->getInputArgumentData($argument), $options);
}




protected function describeInputOption(InputOption $option, array $options = [])
{
$this->writeData($this->getInputOptionData($option), $options);
}




protected function describeInputDefinition(InputDefinition $definition, array $options = [])
{
$this->writeData($this->getInputDefinitionData($definition), $options);
}




protected function describeCommand(Command $command, array $options = [])
{
$this->writeData($this->getCommandData($command), $options);
}




protected function describeApplication(Application $application, array $options = [])
{
$describedNamespace = $options['namespace'] ?? null;
$description = new ApplicationDescription($application, $describedNamespace, true);
$commands = [];

foreach ($description->getCommands() as $command) {
$commands[] = $this->getCommandData($command);
}

$data = [];
if ('UNKNOWN' !== $application->getName()) {
$data['application']['name'] = $application->getName();
if ('UNKNOWN' !== $application->getVersion()) {
$data['application']['version'] = $application->getVersion();
}
}

$data['commands'] = $commands;

if ($describedNamespace) {
$data['namespace'] = $describedNamespace;
} else {
$data['namespaces'] = array_values($description->getNamespaces());
}

$this->writeData($data, $options);
}




private function writeData(array $data, array $options)
{
$flags = $options['json_encoding'] ?? 0;

$this->write(json_encode($data, $flags));
}

private function getInputArgumentData(InputArgument $argument): array
{
return [
'name' => $argument->getName(),
'is_required' => $argument->isRequired(),
'is_array' => $argument->isArray(),
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
];
}

private function getInputOptionData(InputOption $option): array
{
return [
'name' => '--'.$option->getName(),
'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
'accept_value' => $option->acceptValue(),
'is_value_required' => $option->isValueRequired(),
'is_multiple' => $option->isArray(),
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
];
}

private function getInputDefinitionData(InputDefinition $definition): array
{
$inputArguments = [];
foreach ($definition->getArguments() as $name => $argument) {
$inputArguments[$name] = $this->getInputArgumentData($argument);
}

$inputOptions = [];
foreach ($definition->getOptions() as $name => $option) {
$inputOptions[$name] = $this->getInputOptionData($option);
}

return ['arguments' => $inputArguments, 'options' => $inputOptions];
}

private function getCommandData(Command $command): array
{
$command->getSynopsis();
$command->mergeApplicationDefinition(false);

return [
'name' => $command->getName(),
'usage' => array_merge([$command->getSynopsis()], $command->getUsages(), $command->getAliases()),
'description' => $command->getDescription(),
'help' => $command->getProcessedHelp(),
'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
'hidden' => $command->isHidden(),
];
}
}
<?php










namespace Symfony\Component\Console\Descriptor;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;








class XmlDescriptor extends Descriptor
{
public function getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($definitionXML = $dom->createElement('definition'));

$definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
foreach ($definition->getArguments() as $argument) {
$this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
}

$definitionXML->appendChild($optionsXML = $dom->createElement('options'));
foreach ($definition->getOptions() as $option) {
$this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
}

return $dom;
}

public function getCommandDocument(Command $command): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($commandXML = $dom->createElement('command'));

$command->getSynopsis();
$command->mergeApplicationDefinition(false);

$commandXML->setAttribute('id', $command->getName());
$commandXML->setAttribute('name', $command->getName());
$commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0);

$commandXML->appendChild($usagesXML = $dom->createElement('usages'));

foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) {
$usagesXML->appendChild($dom->createElement('usage', $usage));
}

$commandXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));

$commandXML->appendChild($helpXML = $dom->createElement('help'));
$helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));

$definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
$this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));

return $dom;
}

public function getApplicationDocument(Application $application, string $namespace = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($rootXml = $dom->createElement('symfony'));

if ('UNKNOWN' !== $application->getName()) {
$rootXml->setAttribute('name', $application->getName());
if ('UNKNOWN' !== $application->getVersion()) {
$rootXml->setAttribute('version', $application->getVersion());
}
}

$rootXml->appendChild($commandsXML = $dom->createElement('commands'));

$description = new ApplicationDescription($application, $namespace, true);

if ($namespace) {
$commandsXML->setAttribute('namespace', $namespace);
}

foreach ($description->getCommands() as $command) {
$this->appendDocument($commandsXML, $this->getCommandDocument($command));
}

if (!$namespace) {
$rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));

foreach ($description->getNamespaces() as $namespaceDescription) {
$namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
$namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);

foreach ($namespaceDescription['commands'] as $name) {
$namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
$commandXML->appendChild($dom->createTextNode($name));
}
}
}

return $dom;
}




protected function describeInputArgument(InputArgument $argument, array $options = [])
{
$this->writeDocument($this->getInputArgumentDocument($argument));
}




protected function describeInputOption(InputOption $option, array $options = [])
{
$this->writeDocument($this->getInputOptionDocument($option));
}




protected function describeInputDefinition(InputDefinition $definition, array $options = [])
{
$this->writeDocument($this->getInputDefinitionDocument($definition));
}




protected function describeCommand(Command $command, array $options = [])
{
$this->writeDocument($this->getCommandDocument($command));
}




protected function describeApplication(Application $application, array $options = [])
{
$this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null));
}




private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
{
foreach ($importedParent->childNodes as $childNode) {
$parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
}
}




private function writeDocument(\DOMDocument $dom)
{
$dom->formatOutput = true;
$this->write($dom->saveXML());
}

private function getInputArgumentDocument(InputArgument $argument): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');

$dom->appendChild($objectXML = $dom->createElement('argument'));
$objectXML->setAttribute('name', $argument->getName());
$objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
$objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
$objectXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));

$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
$defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? [var_export($argument->getDefault(), true)] : ($argument->getDefault() ? [$argument->getDefault()] : []));
foreach ($defaults as $default) {
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
$defaultXML->appendChild($dom->createTextNode($default));
}

return $dom;
}

private function getInputOptionDocument(InputOption $option): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');

$dom->appendChild($objectXML = $dom->createElement('option'));
$objectXML->setAttribute('name', '--'.$option->getName());
$pos = strpos($option->getShortcut() ?? '', '|');
if (false !== $pos) {
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
$objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
} else {
$objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
}
$objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
$objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
$objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
$objectXML->appendChild($descriptionXML = $dom->createElement('description'));
$descriptionXML->appendChild($dom->createTextNode($option->getDescription()));

if ($option->acceptValue()) {
$defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? [var_export($option->getDefault(), true)] : ($option->getDefault() ? [$option->getDefault()] : []));
$objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));

if (!empty($defaults)) {
foreach ($defaults as $default) {
$defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
$defaultXML->appendChild($dom->createTextNode($default));
}
}
}

return $dom;
}
}
<?php










namespace Symfony\Component\Console\Descriptor;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\Helper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;








class TextDescriptor extends Descriptor
{



protected function describeInputArgument(InputArgument $argument, array $options = [])
{
if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
$default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
} else {
$default = '';
}

$totalWidth = $options['total_width'] ?? Helper::strlen($argument->getName());
$spacingWidth = $totalWidth - \strlen($argument->getName());

$this->writeText(sprintf('  <info>%s</info>  %s%s%s',
$argument->getName(),
str_repeat(' ', $spacingWidth),

 preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
$default
), $options);
}




protected function describeInputOption(InputOption $option, array $options = [])
{
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 = '';
}

$value = '';
if ($option->acceptValue()) {
$value = '='.strtoupper($option->getName());

if ($option->isValueOptional()) {
$value = '['.$value.']';
}
}

$totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
$synopsis = sprintf('%s%s',
$option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : '    ',
sprintf('--%s%s', $option->getName(), $value)
);

$spacingWidth = $totalWidth - Helper::strlen($synopsis);

$this->writeText(sprintf('  <info>%s</info>  %s%s%s%s',
$synopsis,
str_repeat(' ', $spacingWidth),

 preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
$default,
$option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
), $options);
}




protected function describeInputDefinition(InputDefinition $definition, array $options = [])
{
$totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
foreach ($definition->getArguments() as $argument) {
$totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
}

if ($definition->getArguments()) {
$this->writeText('<comment>Arguments:</comment>', $options);
$this->writeText("\n");
foreach ($definition->getArguments() as $argument) {
$this->describeInputArgument($argument, array_merge($options, ['total_width' => $totalWidth]));
$this->writeText("\n");
}
}

if ($definition->getArguments() && $definition->getOptions()) {
$this->writeText("\n");
}

if ($definition->getOptions()) {
$laterOptions = [];

$this->writeText('<comment>Options:</comment>', $options);
foreach ($definition->getOptions() as $option) {
if (\strlen($option->getShortcut() ?? '') > 1) {
$laterOptions[] = $option;
continue;
}
$this->writeText("\n");
$this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
}
foreach ($laterOptions as $option) {
$this->writeText("\n");
$this->describeInputOption($option, array_merge($options, ['total_width' => $totalWidth]));
}
}
}




protected function describeCommand(Command $command, array $options = [])
{
$command->getSynopsis(true);
$command->getSynopsis(false);
$command->mergeApplicationDefinition(false);

if ($description = $command->getDescription()) {
$this->writeText('<comment>Description:</comment>', $options);
$this->writeText("\n");
$this->writeText('  '.$description);
$this->writeText("\n\n");
}

$this->writeText('<comment>Usage:</comment>', $options);
foreach (array_merge([$command->getSynopsis(true)], $command->getAliases(), $command->getUsages()) as $usage) {
$this->writeText("\n");
$this->writeText('  '.OutputFormatter::escape($usage), $options);
}
$this->writeText("\n");

$definition = $command->getNativeDefinition();
if ($definition->getOptions() || $definition->getArguments()) {
$this->writeText("\n");
$this->describeInputDefinition($definition, $options);
$this->writeText("\n");
}

$help = $command->getProcessedHelp();
if ($help && $help !== $description) {
$this->writeText("\n");
$this->writeText('<comment>Help:</comment>', $options);
$this->writeText("\n");
$this->writeText('  '.str_replace("\n", "\n  ", $help), $options);
$this->writeText("\n");
}
}




protected function describeApplication(Application $application, array $options = [])
{
$describedNamespace = $options['namespace'] ?? null;
$description = new ApplicationDescription($application, $describedNamespace);

if (isset($options['raw_text']) && $options['raw_text']) {
$width = $this->getColumnWidth($description->getCommands());

foreach ($description->getCommands() as $command) {
$this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
$this->writeText("\n");
}
} else {
if ('' != $help = $application->getHelp()) {
$this->writeText("$help\n\n", $options);
}

$this->writeText("<comment>Usage:</comment>\n", $options);
$this->writeText("  command [options] [arguments]\n\n", $options);

$this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);

$this->writeText("\n");
$this->writeText("\n");

$commands = $description->getCommands();
$namespaces = $description->getNamespaces();
if ($describedNamespace && $namespaces) {

 $describedNamespaceInfo = reset($namespaces);
foreach ($describedNamespaceInfo['commands'] as $name) {
$commands[$name] = $description->getCommand($name);
}
}


 $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
return array_intersect($namespace['commands'], array_keys($commands));
}, array_values($namespaces)))));

if ($describedNamespace) {
$this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
} else {
$this->writeText('<comment>Available commands:</comment>', $options);
}

foreach ($namespaces as $namespace) {
$namespace['commands'] = array_filter($namespace['commands'], function ($name) use ($commands) {
return isset($commands[$name]);
});

if (!$namespace['commands']) {
continue;
}

if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
$this->writeText("\n");
$this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
}

foreach ($namespace['commands'] as $name) {
$this->writeText("\n");
$spacingWidth = $width - Helper::strlen($name);
$command = $commands[$name];
$commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : '';
$this->writeText(sprintf('  <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options);
}
}

$this->writeText("\n");
}
}




private function writeText(string $content, array $options = [])
{
$this->write(
isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
isset($options['raw_output']) ? !$options['raw_output'] : true
);
}




private function getCommandAliasesText(Command $command): string
{
$text = '';
$aliases = $command->getAliases();

if ($aliases) {
$text = '['.implode('|', $aliases).'] ';
}

return $text;
}






private function formatDefaultValue($default): string
{
if (\INF === $default) {
return 'INF';
}

if (\is_string($default)) {
$default = OutputFormatter::escape($default);
} elseif (\is_array($default)) {
foreach ($default as $key => $value) {
if (\is_string($value)) {
$default[$key] = OutputFormatter::escape($value);
}
}
}

return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
}




private function getColumnWidth(array $commands): int
{
$widths = [];

foreach ($commands as $command) {
if ($command instanceof Command) {
$widths[] = Helper::strlen($command->getName());
foreach ($command->getAliases() as $alias) {
$widths[] = Helper::strlen($alias);
}
} else {
$widths[] = Helper::strlen($command);
}
}

return $widths ? max($widths) + 2 : 0;
}




private function calculateTotalWidthForOptions(array $options): int
{
$totalWidth = 0;
foreach ($options as $option) {

 $nameLength = 1 + max(Helper::strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());

if ($option->acceptValue()) {
$valueLength = 1 + Helper::strlen($option->getName()); 
 $valueLength += $option->isValueOptional() ? 2 : 0; 

$nameLength += $valueLength;
}
$totalWidth = max($totalWidth, $nameLength);
}

return $totalWidth;
}
}
<?php










namespace Symfony\Component\Console\Descriptor;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\CommandNotFoundException;






class ApplicationDescription
{
public const GLOBAL_NAMESPACE = '_global';

private $application;
private $namespace;
private $showHidden;




private $namespaces;




private $commands;




private $aliases;

public function __construct(Application $application, string $namespace = null, bool $showHidden = false)
{
$this->application = $application;
$this->namespace = $namespace;
$this->showHidden = $showHidden;
}

public function getNamespaces(): array
{
if (null === $this->namespaces) {
$this->inspectApplication();
}

return $this->namespaces;
}




public function getCommands(): array
{
if (null === $this->commands) {
$this->inspectApplication();
}

return $this->commands;
}




public function getCommand(string $name): Command
{
if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
}

return $this->commands[$name] ?? $this->aliases[$name];
}

private function inspectApplication()
{
$this->commands = [];
$this->namespaces = [];

$all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
foreach ($this->sortCommands($all) as $namespace => $commands) {
$names = [];


foreach ($commands as $name => $command) {
if (!$command->getName() || (!$this->showHidden && $command->isHidden())) {
continue;
}

if ($command->getName() === $name) {
$this->commands[$name] = $command;
} else {
$this->aliases[$name] = $command;
}

$names[] = $name;
}

$this->namespaces[$namespace] = ['id' => $namespace, 'commands' => $names];
}
}

private function sortCommands(array $commands): array
{
$namespacedCommands = [];
$globalCommands = [];
$sortedCommands = [];
foreach ($commands as $name => $command) {
$key = $this->application->extractNamespace($name, 1);
if (\in_array($key, ['', self::GLOBAL_NAMESPACE], true)) {
$globalCommands[$name] = $command;
} else {
$namespacedCommands[$key][$name] = $command;
}
}

if ($globalCommands) {
ksort($globalCommands);
$sortedCommands[self::GLOBAL_NAMESPACE] = $globalCommands;
}

if ($namespacedCommands) {
ksort($namespacedCommands);
foreach ($namespacedCommands as $key => $commandsSet) {
ksort($commandsSet);
$sortedCommands[$key] = $commandsSet;
}
}

return $sortedCommands;
}
}
<?php










namespace Symfony\Component\Console\Descriptor;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;






abstract class Descriptor implements DescriptorInterface
{



protected $output;




public function describe(OutputInterface $output, $object, array $options = [])
{
$this->output = $output;

switch (true) {
case $object instanceof InputArgument:
$this->describeInputArgument($object, $options);
break;
case $object instanceof InputOption:
$this->describeInputOption($object, $options);
break;
case $object instanceof InputDefinition:
$this->describeInputDefinition($object, $options);
break;
case $object instanceof Command:
$this->describeCommand($object, $options);
break;
case $object instanceof Application:
$this->describeApplication($object, $options);
break;
default:
throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
}
}







protected function write($content, $decorated = false)
{
$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
}




abstract protected function describeInputArgument(InputArgument $argument, array $options = []);




abstract protected function describeInputOption(InputOption $option, array $options = []);




abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);




abstract protected function describeCommand(Command $command, array $options = []);




abstract protected function describeApplication(Application $application, array $options = []);
}
<?php










namespace Symfony\Component\Console\Exception;






class NamespaceNotFoundException extends CommandNotFoundException
{
}
<?php










namespace Symfony\Component\Console\Exception;






interface ExceptionInterface extends \Throwable
{
}
<?php










namespace Symfony\Component\Console\Exception;






class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
{
}
<?php










namespace Symfony\Component\Console\Exception;




class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
<?php










namespace Symfony\Component\Console\Exception;






class MissingInputException extends RuntimeException implements ExceptionInterface
{
}
<?php










namespace Symfony\Component\Console\Exception;






class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
{
private $alternatives;







public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);

$this->alternatives = $alternatives;
}




public function getAlternatives()
{
return $this->alternatives;
}
}
<?php










namespace Symfony\Component\Console\Exception;




class LogicException extends \LogicException implements ExceptionInterface
{
}
<?php










namespace Symfony\Component\Console\Exception;




class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}
<?php










namespace Symfony\Component\Console;

class Terminal
{
private static $width;
private static $height;
private static $stty;






public function getWidth()
{
$width = getenv('COLUMNS');
if (false !== $width) {
return (int) trim($width);
}

if (null === self::$width) {
self::initDimensions();
}

return self::$width ?: 80;
}






public function getHeight()
{
$height = getenv('LINES');
if (false !== $height) {
return (int) trim($height);
}

if (null === self::$height) {
self::initDimensions();
}

return self::$height ?: 50;
}






public static function hasSttyAvailable()
{
if (null !== self::$stty) {
return self::$stty;
}


 if (!\function_exists('exec')) {
return false;
}

exec('stty 2>&1', $output, $exitcode);

return self::$stty = 0 === $exitcode;
}

private static function initDimensions()
{
if ('\\' === \DIRECTORY_SEPARATOR) {
if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {

 
 self::$width = (int) $matches[1];
self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
} elseif (!self::hasVt100Support() && self::hasSttyAvailable()) {

 
 self::initDimensionsUsingStty();
} elseif (null !== $dimensions = self::getConsoleMode()) {

 self::$width = (int) $dimensions[0];
self::$height = (int) $dimensions[1];
}
} else {
self::initDimensionsUsingStty();
}
}




private static function hasVt100Support(): bool
{
return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w'));
}




private static function initDimensionsUsingStty()
{
if ($sttyString = self::getSttyColumns()) {
if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {

 self::$width = (int) $matches[2];
self::$height = (int) $matches[1];
} elseif (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {

 self::$width = (int) $matches[2];
self::$height = (int) $matches[1];
}
}
}






private static function getConsoleMode(): ?array
{
$info = self::readFromProcess('mode CON');

if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
return null;
}

return [(int) $matches[2], (int) $matches[1]];
}




private static function getSttyColumns(): ?string
{
return self::readFromProcess('stty -a | grep columns');
}

private static function readFromProcess(string $command): ?string
{
if (!\function_exists('proc_open')) {
return null;
}

$descriptorspec = [
1 => ['pipe', 'w'],
2 => ['pipe', 'w'],
];

$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
if (!\is_resource($process)) {
return null;
}

$info = stream_get_contents($pipes[1]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);

return $info;
}
}
<?php










namespace Symfony\Polyfill\Php73;

/**
@gmail



*/
final class Php73
{
public static $startAt = 1533462603;






public static function hrtime($asNum = false)
{
$ns = microtime(false);
$s = substr($ns, 11) - self::$startAt;
$ns = 1E9 * (float) $ns;

if ($asNum) {
$ns += $s * 1E9;

return \PHP_INT_SIZE === 4 ? $ns : (int) $ns;
}

return [$s, (int) $ns];
}
}
<?php










use Symfony\Polyfill\Php73 as p;

if (\PHP_VERSION_ID >= 70300) {
return;
}

if (!function_exists('is_countable')) {
function is_countable($value) { return is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXmlElement; }
}
if (!function_exists('hrtime')) {
require_once __DIR__.'/Php73.php';
p\Php73::$startAt = (int) microtime(true);
function hrtime($as_number = false) { return p\Php73::hrtime($as_number); }
}
if (!function_exists('array_key_first')) {
function array_key_first(array $array) { foreach ($array as $key => $value) { return $key; } }
}
if (!function_exists('array_key_last')) {
function array_key_last(array $array) { return key(array_slice($array, -1, 1, true)); }
}
<?php










class JsonException extends Exception
{
}
<?php










use Symfony\Polyfill\Php80 as p;

if (\PHP_VERSION_ID >= 80000) {
return;
}

if (!defined('FILTER_VALIDATE_BOOL') && defined('FILTER_VALIDATE_BOOLEAN')) {
define('FILTER_VALIDATE_BOOL', \FILTER_VALIDATE_BOOLEAN);
}

if (!function_exists('fdiv')) {
function fdiv(float $num1, float $num2): float { return p\Php80::fdiv($num1, $num2); }
}
if (!function_exists('preg_last_error_msg')) {
function preg_last_error_msg(): string { return p\Php80::preg_last_error_msg(); }
}
if (!function_exists('str_contains')) {
function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('str_starts_with')) {
function str_starts_with(?string $haystack, ?string $needle): bool { return p\Php80::str_starts_with($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('str_ends_with')) {
function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? '', $needle ?? ''); }
}
if (!function_exists('get_debug_type')) {
function get_debug_type($value): string { return p\Php80::get_debug_type($value); }
}
if (!function_exists('get_resource_id')) {
function get_resource_id($resource): int { return p\Php80::get_resource_id($resource); }
}
<?php


final class Attribute
{
public const TARGET_CLASS = 1;
public const TARGET_FUNCTION = 2;
public const TARGET_METHOD = 4;
public const TARGET_PROPERTY = 8;
public const TARGET_CLASS_CONSTANT = 16;
public const TARGET_PARAMETER = 32;
public const TARGET_ALL = 63;
public const IS_REPEATABLE = 64;


public $flags;

public function __construct(int $flags = self::TARGET_ALL)
{
$this->flags = $flags;
}
}
<?php

class UnhandledMatchError extends Error
{
}
<?php

class ValueError extends Error
{
}
<?php

if (\PHP_VERSION_ID < 80000) {
interface Stringable
{



public function __toString();
}
}
<?php










namespace Symfony\Polyfill\Php80;

/**
@gmail
@tchwork



*/
final class Php80
{
public static function fdiv(float $dividend, float $divisor): float
{
return @($dividend / $divisor);
}

public static function get_debug_type($value): string
{
switch (true) {
case null === $value: return 'null';
case \is_bool($value): return 'bool';
case \is_string($value): return 'string';
case \is_array($value): return 'array';
case \is_int($value): return 'int';
case \is_float($value): return 'float';
case \is_object($value): break;
case $value instanceof \__PHP_Incomplete_Class: return '__PHP_Incomplete_Class';
default:
if (null === $type = @get_resource_type($value)) {
return 'unknown';
}

if ('Unknown' === $type) {
$type = 'closed';
}

return "resource ($type)";
}

$class = \get_class($value);

if (false === strpos($class, '@')) {
return $class;
}

return (get_parent_class($class) ?: key(class_implements($class)) ?: 'class').'@anonymous';
}

public static function get_resource_id($res): int
{
if (!\is_resource($res) && null === @get_resource_type($res)) {
throw new \TypeError(sprintf('Argument 1 passed to get_resource_id() must be of the type resource, %s given', get_debug_type($res)));
}

return (int) $res;
}

public static function preg_last_error_msg(): string
{
switch (preg_last_error()) {
case \PREG_INTERNAL_ERROR:
return 'Internal error';
case \PREG_BAD_UTF8_ERROR:
return 'Malformed UTF-8 characters, possibly incorrectly encoded';
case \PREG_BAD_UTF8_OFFSET_ERROR:
return 'The offset did not correspond to the beginning of a valid UTF-8 code point';
case \PREG_BACKTRACK_LIMIT_ERROR:
return 'Backtrack limit exhausted';
case \PREG_RECURSION_LIMIT_ERROR:
return 'Recursion limit exhausted';
case \PREG_JIT_STACKLIMIT_ERROR:
return 'JIT stack limit exhausted';
case \PREG_NO_ERROR:
return 'No error';
default:
return 'Unknown error';
}
}

public static function str_contains(string $haystack, string $needle): bool
{
return '' === $needle || false !== strpos($haystack, $needle);
}

public static function str_starts_with(string $haystack, string $needle): bool
{
return 0 === strncmp($haystack, $needle, \strlen($needle));
}

public static function str_ends_with(string $haystack, string $needle): bool
{
return '' === $needle || ('' !== $haystack && 0 === substr_compare($haystack, $needle, -\strlen($needle)));
}
}
<?php










use Symfony\Component\VarDumper\VarDumper;

if (!function_exists('dump')) {



function dump($var)
{
foreach (func_get_args() as $v) {
VarDumper::dump($v);
}

if (1 < func_num_args()) {
return func_get_args();
}

return $var;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class TraceStub extends Stub
{
public $keepArgs;
public $sliceOffset;
public $sliceLength;
public $numberingOffset;

public function __construct(array $trace, $keepArgs = true, $sliceOffset = 0, $sliceLength = null, $numberingOffset = 0)
{
$this->value = $trace;
$this->keepArgs = $keepArgs;
$this->sliceOffset = $sliceOffset;
$this->sliceLength = $sliceLength;
$this->numberingOffset = $numberingOffset;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class SplCaster
{
private static $splFileObjectFlags = [
\SplFileObject::DROP_NEW_LINE => 'DROP_NEW_LINE',
\SplFileObject::READ_AHEAD => 'READ_AHEAD',
\SplFileObject::SKIP_EMPTY => 'SKIP_EMPTY',
\SplFileObject::READ_CSV => 'READ_CSV',
];

public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, $isNested)
{
return self::castSplArray($c, $a, $stub, $isNested);
}

public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, $isNested)
{
return self::castSplArray($c, $a, $stub, $isNested);
}

public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),
];

return $a;
}

public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$mode = $c->getIteratorMode();
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);

$a += [
$prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_DELETE) ? 'IT_MODE_DELETE' : 'IT_MODE_KEEP'), $mode),
$prefix.'dllist' => iterator_to_array($c),
];
$c->setIteratorMode($mode);

return $a;
}

public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNested)
{
static $map = [
'path' => 'getPath',
'filename' => 'getFilename',
'basename' => 'getBasename',
'pathname' => 'getPathname',
'extension' => 'getExtension',
'realPath' => 'getRealPath',
'aTime' => 'getATime',
'mTime' => 'getMTime',
'cTime' => 'getCTime',
'inode' => 'getInode',
'size' => 'getSize',
'perms' => 'getPerms',
'owner' => 'getOwner',
'group' => 'getGroup',
'type' => 'getType',
'writable' => 'isWritable',
'readable' => 'isReadable',
'executable' => 'isExecutable',
'file' => 'isFile',
'dir' => 'isDir',
'link' => 'isLink',
'linkTarget' => 'getLinkTarget',
];

$prefix = Caster::PREFIX_VIRTUAL;

if (false === $c->getPathname()) {
$a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';

return $a;
}

foreach ($map as $key => $accessor) {
try {
$a[$prefix.$key] = $c->$accessor();
} catch (\Exception $e) {
}
}

if (isset($a[$prefix.'realPath'])) {
$a[$prefix.'realPath'] = new LinkStub($a[$prefix.'realPath']);
}

if (isset($a[$prefix.'perms'])) {
$a[$prefix.'perms'] = new ConstStub(sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
}

static $mapDate = ['aTime', 'mTime', 'cTime'];
foreach ($mapDate as $key) {
if (isset($a[$prefix.$key])) {
$a[$prefix.$key] = new ConstStub(date('Y-m-d H:i:s', $a[$prefix.$key]), $a[$prefix.$key]);
}
}

return $a;
}

public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, $isNested)
{
static $map = [
'csvControl' => 'getCsvControl',
'flags' => 'getFlags',
'maxLineLen' => 'getMaxLineLen',
'fstat' => 'fstat',
'eof' => 'eof',
'key' => 'key',
];

$prefix = Caster::PREFIX_VIRTUAL;

foreach ($map as $key => $accessor) {
try {
$a[$prefix.$key] = $c->$accessor();
} catch (\Exception $e) {
}
}

if (isset($a[$prefix.'flags'])) {
$flagsArray = [];
foreach (self::$splFileObjectFlags as $value => $name) {
if ($a[$prefix.'flags'] & $value) {
$flagsArray[] = $name;
}
}
$a[$prefix.'flags'] = new ConstStub(implode('|', $flagsArray), $a[$prefix.'flags']);
}

if (isset($a[$prefix.'fstat'])) {
$a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], ['dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks']);
}

return $a;
}

public static function castFixedArray(\SplFixedArray $c, array $a, Stub $stub, $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'storage' => $c->toArray(),
];

return $a;
}

public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, $isNested)
{
$storage = [];
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); 

$clone = clone $c;
foreach ($clone as $obj) {
$storage[] = [
'object' => $obj,
'info' => $clone->getInfo(),
];
}

$a += [
Caster::PREFIX_VIRTUAL.'storage' => $storage,
];

return $a;
}

public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();

return $a;
}

private static function castSplArray($c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$class = $stub->class;
$flags = $c->getFlags();

if (!($flags & \ArrayObject::STD_PROP_LIST)) {
$c->setFlags(\ArrayObject::STD_PROP_LIST);
$a = Caster::castObject($c, $class);
$c->setFlags($flags);
}
$a += [
$prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
$prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
];
if ($c instanceof \ArrayObject) {
$a[$prefix.'iteratorClass'] = new ClassStub($c->getIteratorClass());
}
$a[$prefix.'storage'] = $c->getArrayCopy();

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\VarDumper\Cloner\Stub;

class SymfonyCaster
{
private static $requestGetters = [
'pathInfo' => 'getPathInfo',
'requestUri' => 'getRequestUri',
'baseUrl' => 'getBaseUrl',
'basePath' => 'getBasePath',
'method' => 'getMethod',
'format' => 'getRequestFormat',
];

public static function castRequest(Request $request, array $a, Stub $stub, $isNested)
{
$clone = null;

foreach (self::$requestGetters as $prop => $getter) {
if (null === $a[Caster::PREFIX_PROTECTED.$prop]) {
if (null === $clone) {
$clone = clone $request;
}
$a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}();
}
}

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class ArgsStub extends EnumStub
{
private static $parameters = [];

public function __construct(array $args, $function, $class)
{
list($variadic, $params) = self::getParameters($function, $class);

$values = [];
foreach ($args as $k => $v) {
$values[$k] = !is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v;
}
if (null === $params) {
parent::__construct($values, false);

return;
}
if (\count($values) < \count($params)) {
$params = \array_slice($params, 0, \count($values));
} elseif (\count($values) > \count($params)) {
$values[] = new EnumStub(array_splice($values, \count($params)), false);
$params[] = $variadic;
}
if (['...'] === $params) {
$this->dumpKeys = false;
$this->value = $values[0]->value;
} else {
$this->value = array_combine($params, $values);
}
}

private static function getParameters($function, $class)
{
if (isset(self::$parameters[$k = $class.'::'.$function])) {
return self::$parameters[$k];
}

try {
$r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function);
} catch (\ReflectionException $e) {
return [null, null];
}

$variadic = '...';
$params = [];
foreach ($r->getParameters() as $v) {
$k = '$'.$v->name;
if ($v->isPassedByReference()) {
$k = '&'.$k;
}
if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
$variadic .= $k;
} else {
$params[] = $k;
}
}

return self::$parameters[$k] = [$variadic, $params];
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;






class ClassStub extends ConstStub
{




public function __construct($identifier, $callable = null)
{
$this->value = $identifier;

if (0 < $i = strrpos($identifier, '\\')) {
$this->attr['ellipsis'] = \strlen($identifier) - $i;
$this->attr['ellipsis-type'] = 'class';
$this->attr['ellipsis-tail'] = 1;
}

try {
if (null !== $callable) {
if ($callable instanceof \Closure) {
$r = new \ReflectionFunction($callable);
} elseif (\is_object($callable)) {
$r = [$callable, '__invoke'];
} elseif (\is_array($callable)) {
$r = $callable;
} elseif (false !== $i = strpos($callable, '::')) {
$r = [substr($callable, 0, $i), substr($callable, 2 + $i)];
} else {
$r = new \ReflectionFunction($callable);
}
} elseif (0 < $i = strpos($identifier, '::') ?: strpos($identifier, '->')) {
$r = [substr($identifier, 0, $i), substr($identifier, 2 + $i)];
} else {
$r = new \ReflectionClass($identifier);
}

if (\is_array($r)) {
try {
$r = new \ReflectionMethod($r[0], $r[1]);
} catch (\ReflectionException $e) {
$r = new \ReflectionClass($r[0]);
}
}
} catch (\ReflectionException $e) {
return;
}

if ($f = $r->getFileName()) {
$this->attr['file'] = $f;
$this->attr['line'] = $r->getStartLine();
}
}

public static function wrapCallable($callable)
{
if (\is_object($callable) || !\is_callable($callable)) {
return $callable;
}

if (!\is_array($callable)) {
$callable = new static($callable);
} elseif (\is_string($callable[0])) {
$callable[0] = new static($callable[0]);
} else {
$callable[1] = new static($callable[1], $callable);
}

return $callable;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class ResourceCaster
{
public static function castCurl($h, array $a, Stub $stub, $isNested)
{
return curl_getinfo($h);
}

public static function castDba($dba, array $a, Stub $stub, $isNested)
{
$list = dba_list();
$a['file'] = $list[(int) $dba];

return $a;
}

public static function castProcess($process, array $a, Stub $stub, $isNested)
{
return proc_get_status($process);
}

public static function castStream($stream, array $a, Stub $stub, $isNested)
{
$a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
if (isset($a['uri'])) {
$a['uri'] = new LinkStub($a['uri']);
}

return $a;
}

public static function castStreamContext($stream, array $a, Stub $stub, $isNested)
{
return @stream_context_get_params($stream) ?: $a;
}

public static function castGd($gd, array $a, Stub $stub, $isNested)
{
$a['size'] = imagesx($gd).'x'.imagesy($gd);
$a['trueColor'] = imageistruecolor($gd);

return $a;
}

public static function castMysqlLink($h, array $a, Stub $stub, $isNested)
{
$a['host'] = mysql_get_host_info($h);
$a['protocol'] = mysql_get_proto_info($h);
$a['server'] = mysql_get_server_info($h);

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\Debug\Exception\SilencedErrorContext;
use Symfony\Component\VarDumper\Cloner\Stub;
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;






class ExceptionCaster
{
public static $srcContext = 1;
public static $traceArgs = true;
public static $errorTypes = [
E_DEPRECATED => 'E_DEPRECATED',
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
E_ERROR => 'E_ERROR',
E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE',
E_NOTICE => 'E_NOTICE',
E_CORE_ERROR => 'E_CORE_ERROR',
E_CORE_WARNING => 'E_CORE_WARNING',
E_COMPILE_ERROR => 'E_COMPILE_ERROR',
E_COMPILE_WARNING => 'E_COMPILE_WARNING',
E_USER_ERROR => 'E_USER_ERROR',
E_USER_WARNING => 'E_USER_WARNING',
E_USER_NOTICE => 'E_USER_NOTICE',
E_STRICT => 'E_STRICT',
];

private static $framesCache = [];

public static function castError(\Error $e, array $a, Stub $stub, $isNested, $filter = 0)
{
return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter);
}

public static function castException(\Exception $e, array $a, Stub $stub, $isNested, $filter = 0)
{
return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter);
}

public static function castErrorException(\ErrorException $e, array $a, Stub $stub, $isNested)
{
if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) {
$a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
}

return $a;
}

public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, $isNested)
{
$trace = Caster::PREFIX_VIRTUAL.'trace';
$prefix = Caster::PREFIX_PROTECTED;
$xPrefix = "\0Exception\0";

if (isset($a[$xPrefix.'previous'], $a[$trace]) && $a[$xPrefix.'previous'] instanceof \Exception) {
$b = (array) $a[$xPrefix.'previous'];
self::traceUnshift($b[$xPrefix.'trace'], \get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']);
$a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -\count($a[$trace]->value));
}

unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);

return $a;
}

public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, $isNested)
{
$sPrefix = "\0".SilencedErrorContext::class."\0";

if (!isset($a[$s = $sPrefix.'severity'])) {
return $a;
}

if (isset(self::$errorTypes[$a[$s]])) {
$a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
}

$trace = [[
'file' => $a[$sPrefix.'file'],
'line' => $a[$sPrefix.'line'],
]];

if (isset($a[$sPrefix.'trace'])) {
$trace = array_merge($trace, $a[$sPrefix.'trace']);
}

unset($a[$sPrefix.'file'], $a[$sPrefix.'line'], $a[$sPrefix.'trace']);
$a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);

return $a;
}

public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, $isNested)
{
if (!$isNested) {
return $a;
}
$stub->class = '';
$stub->handle = 0;
$frames = $trace->value;
$prefix = Caster::PREFIX_VIRTUAL;

$a = [];
$j = \count($frames);
if (0 > $i = $trace->sliceOffset) {
$i = max(0, $j + $i);
}
if (!isset($trace->value[$i])) {
return [];
}
$lastCall = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '';
$frames[] = ['function' => ''];
$collapse = false;

for ($j += $trace->numberingOffset - $i++; isset($frames[$i]); ++$i, --$j) {
$f = $frames[$i];
$call = isset($f['function']) ? (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'] : '???';

$frame = new FrameStub(
[
'object' => isset($f['object']) ? $f['object'] : null,
'class' => isset($f['class']) ? $f['class'] : null,
'type' => isset($f['type']) ? $f['type'] : null,
'function' => isset($f['function']) ? $f['function'] : null,
] + $frames[$i - 1],
false,
true
);
$f = self::castFrameStub($frame, [], $frame, true);
if (isset($f[$prefix.'src'])) {
foreach ($f[$prefix.'src']->value as $label => $frame) {
if (0 === strpos($label, "\0~collapse=0")) {
if ($collapse) {
$label = substr_replace($label, '1', 11, 1);
} else {
$collapse = true;
}
}
$label = substr_replace($label, "title=Stack level $j.&", 2, 0);
}
$f = $frames[$i - 1];
if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) {
$frame->value['arguments'] = new ArgsStub($f['args'], isset($f['function']) ? $f['function'] : null, isset($f['class']) ? $f['class'] : null);
}
} elseif ('???' !== $lastCall) {
$label = new ClassStub($lastCall);
if (isset($label->attr['ellipsis'])) {
$label->attr['ellipsis'] += 2;
$label = substr_replace($prefix, "ellipsis-type=class&ellipsis={$label->attr['ellipsis']}&ellipsis-tail=1&title=Stack level $j.", 2, 0).$label->value.'()';
} else {
$label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$label->value.'()';
}
} else {
$label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$lastCall;
}
$a[substr_replace($label, sprintf('separator=%s&', $frame instanceof EnumStub ? ' ' : ':'), 2, 0)] = $frame;

$lastCall = $call;
}
if (null !== $trace->sliceLength) {
$a = \array_slice($a, 0, $trace->sliceLength, true);
}

return $a;
}

public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $isNested)
{
if (!$isNested) {
return $a;
}
$f = $frame->value;
$prefix = Caster::PREFIX_VIRTUAL;

if (isset($f['file'], $f['line'])) {
$cacheKey = $f;
unset($cacheKey['object'], $cacheKey['args']);
$cacheKey[] = self::$srcContext;
$cacheKey = implode('-', $cacheKey);

if (isset(self::$framesCache[$cacheKey])) {
$a[$prefix.'src'] = self::$framesCache[$cacheKey];
} else {
if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
$f['file'] = substr($f['file'], 0, -\strlen($match[0]));
$f['line'] = (int) $match[1];
}
$caller = isset($f['function']) ? sprintf('in %s() on line %d', (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'], $f['line']) : null;
$src = $f['line'];
$srcKey = $f['file'];
$ellipsis = new LinkStub($srcKey, 0);
$srcAttr = 'collapse='.(int) $ellipsis->inVendor;
$ellipsisTail = isset($ellipsis->attr['ellipsis-tail']) ? $ellipsis->attr['ellipsis-tail'] : 0;
$ellipsis = isset($ellipsis->attr['ellipsis']) ? $ellipsis->attr['ellipsis'] : 0;

if (file_exists($f['file']) && 0 <= self::$srcContext) {
if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
$template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class']));

$ellipsis = 0;
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
$templateInfo = $template->getDebugInfo();
if (isset($templateInfo[$f['line']])) {
if (!method_exists($template, 'getSourceContext') || !file_exists($templatePath = $template->getSourceContext()->getPath())) {
$templatePath = null;
}
if ($templateSrc) {
$src = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext, $caller, 'twig', $templatePath);
$srcKey = ($templatePath ?: $template->getTemplateName()).':'.$templateInfo[$f['line']];
}
}
}
if ($srcKey == $f['file']) {
$src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, $caller, 'php', $f['file']);
$srcKey .= ':'.$f['line'];
if ($ellipsis) {
$ellipsis += 1 + \strlen($f['line']);
}
}
$srcAttr .= '&separator= ';
} else {
$srcAttr .= '&separator=:';
}
$srcAttr .= $ellipsis ? '&ellipsis-type=path&ellipsis='.$ellipsis.'&ellipsis-tail='.$ellipsisTail : '';
self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(["\0~$srcAttr\0$srcKey" => $src]);
}
}

unset($a[$prefix.'args'], $a[$prefix.'line'], $a[$prefix.'file']);
if ($frame->inTraceStub) {
unset($a[$prefix.'class'], $a[$prefix.'type'], $a[$prefix.'function']);
}
foreach ($a as $k => $v) {
if (!$v) {
unset($a[$k]);
}
}
if ($frame->keepArgs && !empty($f['args'])) {
$a[$prefix.'arguments'] = new ArgsStub($f['args'], $f['function'], $f['class']);
}

return $a;
}

private static function filterExceptionArray($xClass, array $a, $xPrefix, $filter)
{
if (isset($a[$xPrefix.'trace'])) {
$trace = $a[$xPrefix.'trace'];
unset($a[$xPrefix.'trace']); 
 } else {
$trace = [];
}

if (!($filter & Caster::EXCLUDE_VERBOSE) && $trace) {
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
self::traceUnshift($trace, $xClass, $a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
}
$a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);
}
if (empty($a[$xPrefix.'previous'])) {
unset($a[$xPrefix.'previous']);
}
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);

if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
$a[Caster::PREFIX_PROTECTED.'file'] = new LinkStub($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
}

return $a;
}

private static function traceUnshift(&$trace, $class, $file, $line)
{
if (isset($trace[0]['file'], $trace[0]['line']) && $trace[0]['file'] === $file && $trace[0]['line'] === $line) {
return;
}
array_unshift($trace, [
'function' => $class ? 'new '.$class : null,
'file' => $file,
'line' => $line,
]);
}

private static function extractSource($srcLines, $line, $srcContext, $title, $lang, $file = null)
{
$srcLines = explode("\n", $srcLines);
$src = [];

for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
$src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
}

$srcLines = [];
$ltrim = 0;
do {
$pad = null;
for ($i = $srcContext << 1; $i >= 0; --$i) {
if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) {
if (null === $pad) {
$pad = $c;
}
if ((' ' !== $c && "\t" !== $c) || $pad !== $c) {
break;
}
}
}
++$ltrim;
} while (0 > $i && null !== $pad);

--$ltrim;

foreach ($src as $i => $c) {
if ($ltrim) {
$c = isset($c[$ltrim]) && "\r" !== $c[$ltrim] ? substr($c, $ltrim) : ltrim($c, " \t");
}
$c = substr($c, 0, -1);
if ($i !== $srcContext) {
$c = new ConstStub('default', $c);
} else {
$c = new ConstStub($c, $title);
if (null !== $file) {
$c->attr['file'] = $file;
$c->attr['line'] = $line;
}
}
$c->attr['lang'] = $lang;
$srcLines[sprintf("\0~separator=› &%d\0", $i + $line - $srcContext)] = $c;
}

return new EnumStub($srcLines);
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Doctrine\Common\Proxy\Proxy as CommonProxy;
use Doctrine\ORM\PersistentCollection;
use Doctrine\ORM\Proxy\Proxy as OrmProxy;
use Symfony\Component\VarDumper\Cloner\Stub;






class DoctrineCaster
{
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)
{
foreach (['__cloner__', '__initializer__'] as $k) {
if (\array_key_exists($k, $a)) {
unset($a[$k]);
++$stub->cut;
}
}

return $a;
}

public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)
{
foreach (['_entityPersister', '_identifier'] as $k) {
if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
unset($a[$k]);
++$stub->cut;
}
}

return $a;
}

public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)
{
foreach (['snapshot', 'association', 'typeClass'] as $k) {
if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
$a[$k] = new CutStub($a[$k]);
}
}

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;








class Caster
{
const EXCLUDE_VERBOSE = 1;
const EXCLUDE_VIRTUAL = 2;
const EXCLUDE_DYNAMIC = 4;
const EXCLUDE_PUBLIC = 8;
const EXCLUDE_PROTECTED = 16;
const EXCLUDE_PRIVATE = 32;
const EXCLUDE_NULL = 64;
const EXCLUDE_EMPTY = 128;
const EXCLUDE_NOT_IMPORTANT = 256;
const EXCLUDE_STRICT = 512;

const PREFIX_VIRTUAL = "\0~\0";
const PREFIX_DYNAMIC = "\0+\0";
const PREFIX_PROTECTED = "\0*\0";










public static function castObject($obj, $class, $hasDebugInfo = false)
{
if ($class instanceof \ReflectionClass) {
@trigger_error(sprintf('Passing a ReflectionClass to "%s()" is deprecated since Symfony 3.3 and will be unsupported in 4.0. Pass the class name as string instead.', __METHOD__), E_USER_DEPRECATED);
$hasDebugInfo = $class->hasMethod('__debugInfo');
$class = $class->name;
}

if ($hasDebugInfo) {
try {
$debugInfo = $obj->__debugInfo();
} catch (\Exception $e) {

 $hasDebugInfo = false;
}
}

$a = $obj instanceof \Closure ? [] : (array) $obj;

if ($obj instanceof \__PHP_Incomplete_Class) {
return $a;
}

if ($a) {
static $publicProperties = [];

$i = 0;
$prefixedKeys = [];
foreach ($a as $k => $v) {
if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) {
if (!isset($publicProperties[$class])) {
foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) {
$publicProperties[$class][$prop->name] = true;
}
}
if (!isset($publicProperties[$class][$k])) {
$prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k;
}
} elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) {
$prefixedKeys[$i] = "\0".get_parent_class($class).'@anonymous'.strrchr($k, "\0");
}
++$i;
}
if ($prefixedKeys) {
$keys = array_keys($a);
foreach ($prefixedKeys as $i => $k) {
$keys[$i] = $k;
}
$a = array_combine($keys, $a);
}
}

if ($hasDebugInfo && \is_array($debugInfo)) {
foreach ($debugInfo as $k => $v) {
if (!isset($k[0]) || "\0" !== $k[0]) {
$k = self::PREFIX_VIRTUAL.$k;
}

unset($a[$k]);
$a[$k] = $v;
}
}

return $a;
}














public static function filter(array $a, $filter, array $listedProperties = [], &$count = 0)
{
$count = 0;

foreach ($a as $k => $v) {
$type = self::EXCLUDE_STRICT & $filter;

if (null === $v) {
$type |= self::EXCLUDE_NULL & $filter;
$type |= self::EXCLUDE_EMPTY & $filter;
} elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || [] === $v) {
$type |= self::EXCLUDE_EMPTY & $filter;
}
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) {
$type |= self::EXCLUDE_NOT_IMPORTANT;
}
if ((self::EXCLUDE_VERBOSE & $filter) && \in_array($k, $listedProperties, true)) {
$type |= self::EXCLUDE_VERBOSE;
}

if (!isset($k[1]) || "\0" !== $k[0]) {
$type |= self::EXCLUDE_PUBLIC & $filter;
} elseif ('~' === $k[1]) {
$type |= self::EXCLUDE_VIRTUAL & $filter;
} elseif ('+' === $k[1]) {
$type |= self::EXCLUDE_DYNAMIC & $filter;
} elseif ('*' === $k[1]) {
$type |= self::EXCLUDE_PROTECTED & $filter;
} else {
$type |= self::EXCLUDE_PRIVATE & $filter;
}

if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) {
unset($a[$k]);
++$count;
}
}

return $a;
}

public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, $isNested)
{
if (isset($a['__PHP_Incomplete_Class_Name'])) {
$stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')';
unset($a['__PHP_Incomplete_Class_Name']);
}

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class PgSqlCaster
{
private static $paramCodes = [
'server_encoding',
'client_encoding',
'is_superuser',
'session_authorization',
'DateStyle',
'TimeZone',
'IntervalStyle',
'integer_datetimes',
'application_name',
'standard_conforming_strings',
];

private static $transactionStatus = [
PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
];

private static $resultStatus = [
PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
PGSQL_COPY_OUT => 'PGSQL_COPY_OUT',
PGSQL_COPY_IN => 'PGSQL_COPY_IN',
PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
];

private static $diagCodes = [
'severity' => PGSQL_DIAG_SEVERITY,
'sqlstate' => PGSQL_DIAG_SQLSTATE,
'message' => PGSQL_DIAG_MESSAGE_PRIMARY,
'detail' => PGSQL_DIAG_MESSAGE_DETAIL,
'hint' => PGSQL_DIAG_MESSAGE_HINT,
'statement position' => PGSQL_DIAG_STATEMENT_POSITION,
'internal position' => PGSQL_DIAG_INTERNAL_POSITION,
'internal query' => PGSQL_DIAG_INTERNAL_QUERY,
'context' => PGSQL_DIAG_CONTEXT,
'file' => PGSQL_DIAG_SOURCE_FILE,
'line' => PGSQL_DIAG_SOURCE_LINE,
'function' => PGSQL_DIAG_SOURCE_FUNCTION,
];

public static function castLargeObject($lo, array $a, Stub $stub, $isNested)
{
$a['seek position'] = pg_lo_tell($lo);

return $a;
}

public static function castLink($link, array $a, Stub $stub, $isNested)
{
$a['status'] = pg_connection_status($link);
$a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
$a['busy'] = pg_connection_busy($link);

$a['transaction'] = pg_transaction_status($link);
if (isset(self::$transactionStatus[$a['transaction']])) {
$a['transaction'] = new ConstStub(self::$transactionStatus[$a['transaction']], $a['transaction']);
}

$a['pid'] = pg_get_pid($link);
$a['last error'] = pg_last_error($link);
$a['last notice'] = pg_last_notice($link);
$a['host'] = pg_host($link);
$a['port'] = pg_port($link);
$a['dbname'] = pg_dbname($link);
$a['options'] = pg_options($link);
$a['version'] = pg_version($link);

foreach (self::$paramCodes as $v) {
if (false !== $s = pg_parameter_status($link, $v)) {
$a['param'][$v] = $s;
}
}

$a['param']['client_encoding'] = pg_client_encoding($link);
$a['param'] = new EnumStub($a['param']);

return $a;
}

public static function castResult($result, array $a, Stub $stub, $isNested)
{
$a['num rows'] = pg_num_rows($result);
$a['status'] = pg_result_status($result);
if (isset(self::$resultStatus[$a['status']])) {
$a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']);
}
$a['command-completion tag'] = pg_result_status($result, PGSQL_STATUS_STRING);

if (-1 === $a['num rows']) {
foreach (self::$diagCodes as $k => $v) {
$a['error'][$k] = pg_result_error_field($result, $v);
}
}

$a['affected rows'] = pg_affected_rows($result);
$a['last OID'] = pg_last_oid($result);

$fields = pg_num_fields($result);

for ($i = 0; $i < $fields; ++$i) {
$field = [
'name' => pg_field_name($result, $i),
'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
'nullable' => (bool) pg_field_is_null($result, $i),
'storage' => pg_field_size($result, $i).' bytes',
'display' => pg_field_prtlen($result, $i).' chars',
];
if (' (OID: )' === $field['table']) {
$field['table'] = null;
}
if ('-1 bytes' === $field['storage']) {
$field['storage'] = 'variable size';
} elseif ('1 bytes' === $field['storage']) {
$field['storage'] = '1 byte';
}
if ('1 chars' === $field['display']) {
$field['display'] = '1 char';
}
$a['fields'][] = new EnumStub($field);
}

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class AmqpCaster
{
private static $flags = [
AMQP_DURABLE => 'AMQP_DURABLE',
AMQP_PASSIVE => 'AMQP_PASSIVE',
AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE',
AMQP_AUTODELETE => 'AMQP_AUTODELETE',
AMQP_INTERNAL => 'AMQP_INTERNAL',
AMQP_NOLOCAL => 'AMQP_NOLOCAL',
AMQP_AUTOACK => 'AMQP_AUTOACK',
AMQP_IFEMPTY => 'AMQP_IFEMPTY',
AMQP_IFUNUSED => 'AMQP_IFUNUSED',
AMQP_MANDATORY => 'AMQP_MANDATORY',
AMQP_IMMEDIATE => 'AMQP_IMMEDIATE',
AMQP_MULTIPLE => 'AMQP_MULTIPLE',
AMQP_NOWAIT => 'AMQP_NOWAIT',
AMQP_REQUEUE => 'AMQP_REQUEUE',
];

private static $exchangeTypes = [
AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT',
AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT',
AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC',
AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS',
];

public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

$a += [
$prefix.'is_connected' => $c->isConnected(),
];


 if (isset($a["\x00AMQPConnection\x00login"])) {
return $a;
}


 if (method_exists($c, 'getReadTimeout')) {
$timeout = $c->getReadTimeout();
} else {
$timeout = $c->getTimeout();
}

$a += [
$prefix.'is_connected' => $c->isConnected(),
$prefix.'login' => $c->getLogin(),
$prefix.'password' => $c->getPassword(),
$prefix.'host' => $c->getHost(),
$prefix.'vhost' => $c->getVhost(),
$prefix.'port' => $c->getPort(),
$prefix.'read_timeout' => $timeout,
];

return $a;
}

public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

$a += [
$prefix.'is_connected' => $c->isConnected(),
$prefix.'channel_id' => $c->getChannelId(),
];


 if (isset($a["\x00AMQPChannel\x00connection"])) {
return $a;
}

$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'prefetch_size' => $c->getPrefetchSize(),
$prefix.'prefetch_count' => $c->getPrefetchCount(),
];

return $a;
}

public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

$a += [
$prefix.'flags' => self::extractFlags($c->getFlags()),
];


 if (isset($a["\x00AMQPQueue\x00name"])) {
return $a;
}

$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'channel' => $c->getChannel(),
$prefix.'name' => $c->getName(),
$prefix.'arguments' => $c->getArguments(),
];

return $a;
}

public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

$a += [
$prefix.'flags' => self::extractFlags($c->getFlags()),
];

$type = isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType();


 if (isset($a["\x00AMQPExchange\x00name"])) {
$a["\x00AMQPExchange\x00type"] = $type;

return $a;
}

$a += [
$prefix.'connection' => $c->getConnection(),
$prefix.'channel' => $c->getChannel(),
$prefix.'name' => $c->getName(),
$prefix.'type' => $type,
$prefix.'arguments' => $c->getArguments(),
];

return $a;
}

public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, $isNested, $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;

$deliveryMode = new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode());


 if (isset($a["\x00AMQPEnvelope\x00body"])) {
$a["\0AMQPEnvelope\0delivery_mode"] = $deliveryMode;

return $a;
}

if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$a += [$prefix.'body' => $c->getBody()];
}

$a += [
$prefix.'delivery_tag' => $c->getDeliveryTag(),
$prefix.'is_redelivery' => $c->isRedelivery(),
$prefix.'exchange_name' => $c->getExchangeName(),
$prefix.'routing_key' => $c->getRoutingKey(),
$prefix.'content_type' => $c->getContentType(),
$prefix.'content_encoding' => $c->getContentEncoding(),
$prefix.'headers' => $c->getHeaders(),
$prefix.'delivery_mode' => $deliveryMode,
$prefix.'priority' => $c->getPriority(),
$prefix.'correlation_id' => $c->getCorrelationId(),
$prefix.'reply_to' => $c->getReplyTo(),
$prefix.'expiration' => $c->getExpiration(),
$prefix.'message_id' => $c->getMessageId(),
$prefix.'timestamp' => $c->getTimeStamp(),
$prefix.'type' => $c->getType(),
$prefix.'user_id' => $c->getUserId(),
$prefix.'app_id' => $c->getAppId(),
];

return $a;
}

private static function extractFlags($flags)
{
$flagsArray = [];

foreach (self::$flags as $value => $name) {
if ($flags & $value) {
$flagsArray[] = $name;
}
}

if (!$flagsArray) {
$flagsArray = ['AMQP_NOPARAM'];
}

return new ConstStub(implode('|', $flagsArray), $flags);
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class CutStub extends Stub
{
public function __construct($value)
{
$this->value = $value;

switch (\gettype($value)) {
case 'object':
$this->type = self::TYPE_OBJECT;
$this->class = \get_class($value);
$this->cut = -1;
break;

case 'array':
$this->type = self::TYPE_ARRAY;
$this->class = self::ARRAY_ASSOC;
$this->cut = $this->value = \count($value);
break;

case 'resource':
case 'unknown type':
case 'resource (closed)':
$this->type = self::TYPE_RESOURCE;
$this->handle = (int) $value;
if ('Unknown' === $this->class = @get_resource_type($value)) {
$this->class = 'Closed';
}
$this->cut = -1;
break;

case 'string':
$this->type = self::TYPE_STRING;
$this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY;
$this->cut = self::STRING_BINARY === $this->class ? \strlen($value) : mb_strlen($value, 'UTF-8');
$this->value = '';
break;
}
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;






class FrameStub extends EnumStub
{
public $keepArgs;
public $inTraceStub;

public function __construct(array $frame, $keepArgs = true, $inTraceStub = false)
{
$this->value = $frame;
$this->keepArgs = $keepArgs;
$this->inTraceStub = $inTraceStub;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;






class LinkStub extends ConstStub
{
public $inVendor = false;

private static $vendorRoots;
private static $composerRoots;

public function __construct($label, $line = 0, $href = null)
{
$this->value = $label;

if (null === $href) {
$href = $label;
}
if (!\is_string($href)) {
return;
}
if (0 === strpos($href, 'file://')) {
if ($href === $label) {
$label = substr($label, 7);
}
$href = substr($href, 7);
} elseif (false !== strpos($href, '://')) {
$this->attr['href'] = $href;

return;
}
if (!file_exists($href)) {
return;
}
if ($line) {
$this->attr['line'] = $line;
}
if ($label !== $this->attr['file'] = realpath($href) ?: $href) {
return;
}
if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) {
$this->attr['ellipsis'] = \strlen($href) - \strlen($composerRoot) + 1;
$this->attr['ellipsis-type'] = 'path';
$this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode('', \array_slice(explode(\DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
} elseif (3 < \count($ellipsis = explode(\DIRECTORY_SEPARATOR, $href))) {
$this->attr['ellipsis'] = 2 + \strlen(implode('', \array_slice($ellipsis, -2)));
$this->attr['ellipsis-type'] = 'path';
$this->attr['ellipsis-tail'] = 1;
}
}

private function getComposerRoot($file, &$inVendor)
{
if (null === self::$vendorRoots) {
self::$vendorRoots = [];

foreach (get_declared_classes() as $class) {
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
$r = new \ReflectionClass($class);
$v = \dirname(\dirname($r->getFileName()));
if (file_exists($v.'/composer/installed.json')) {
self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
}
}
}
}
$inVendor = false;

if (isset(self::$composerRoots[$dir = \dirname($file)])) {
return self::$composerRoots[$dir];
}

foreach (self::$vendorRoots as $root) {
if ($inVendor = 0 === strpos($file, $root)) {
return $root;
}
}

$parent = $dir;
while (!@file_exists($parent.'/composer.json')) {
if (!@file_exists($parent)) {

 break;
}
if ($parent === \dirname($parent)) {
return self::$composerRoots[$dir] = false;
}

$parent = \dirname($parent);
}

return self::$composerRoots[$dir] = $parent.\DIRECTORY_SEPARATOR;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class PdoCaster
{
private static $pdoAttributes = [
'CASE' => [
\PDO::CASE_LOWER => 'LOWER',
\PDO::CASE_NATURAL => 'NATURAL',
\PDO::CASE_UPPER => 'UPPER',
],
'ERRMODE' => [
\PDO::ERRMODE_SILENT => 'SILENT',
\PDO::ERRMODE_WARNING => 'WARNING',
\PDO::ERRMODE_EXCEPTION => 'EXCEPTION',
],
'TIMEOUT',
'PREFETCH',
'AUTOCOMMIT',
'PERSISTENT',
'DRIVER_NAME',
'SERVER_INFO',
'ORACLE_NULLS' => [
\PDO::NULL_NATURAL => 'NATURAL',
\PDO::NULL_EMPTY_STRING => 'EMPTY_STRING',
\PDO::NULL_TO_STRING => 'TO_STRING',
],
'CLIENT_VERSION',
'SERVER_VERSION',
'STATEMENT_CLASS',
'EMULATE_PREPARES',
'CONNECTION_STATUS',
'STRINGIFY_FETCHES',
'DEFAULT_FETCH_MODE' => [
\PDO::FETCH_ASSOC => 'ASSOC',
\PDO::FETCH_BOTH => 'BOTH',
\PDO::FETCH_LAZY => 'LAZY',
\PDO::FETCH_NUM => 'NUM',
\PDO::FETCH_OBJ => 'OBJ',
],
];

public static function castPdo(\PDO $c, array $a, Stub $stub, $isNested)
{
$attr = [];
$errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
$c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

foreach (self::$pdoAttributes as $k => $v) {
if (!isset($k[0])) {
$k = $v;
$v = [];
}

try {
$attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(\constant('PDO::ATTR_'.$k));
if ($v && isset($v[$attr[$k]])) {
$attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
}
} catch (\Exception $e) {
}
}
if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
if ($attr[$k][1]) {
$attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]);
}
$attr[$k][0] = new ClassStub($attr[$k][0]);
}

$prefix = Caster::PREFIX_VIRTUAL;
$a += [
$prefix.'inTransaction' => method_exists($c, 'inTransaction'),
$prefix.'errorInfo' => $c->errorInfo(),
$prefix.'attributes' => new EnumStub($attr),
];

if ($a[$prefix.'inTransaction']) {
$a[$prefix.'inTransaction'] = $c->inTransaction();
} else {
unset($a[$prefix.'inTransaction']);
}

if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
unset($a[$prefix.'errorInfo']);
}

$c->setAttribute(\PDO::ATTR_ERRMODE, $errmode);

return $a;
}

public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;
$a[$prefix.'errorInfo'] = $c->errorInfo();

if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
unset($a[$prefix.'errorInfo']);
}

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class ConstStub extends Stub
{
public function __construct($name, $value)
{
$this->class = $name;
$this->value = $value;
}

public function __toString()
{
return (string) $this->value;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;






class CutArrayStub extends CutStub
{
public $preservedSubset;

public function __construct(array $value, array $preservedKeys)
{
parent::__construct($value);

$this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys));
$this->cut -= \count($this->preservedSubset);
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class EnumStub extends Stub
{
public $dumpKeys = true;

public function __construct(array $values, $dumpKeys = true)
{
$this->value = $values;
$this->dumpKeys = $dumpKeys;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class RedisCaster
{
private static $serializer = [
\Redis::SERIALIZER_NONE => 'NONE',
\Redis::SERIALIZER_PHP => 'PHP',
2 => 'IGBINARY', 
 ];

public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

if (\defined('HHVM_VERSION_ID')) {
if (isset($a[Caster::PREFIX_PROTECTED.'serializer'])) {
$ser = $a[Caster::PREFIX_PROTECTED.'serializer'];
$a[Caster::PREFIX_PROTECTED.'serializer'] = isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser;
}

return $a;
}

if (!$connected = $c->isConnected()) {
return $a + [
$prefix.'isConnected' => $connected,
];
}

$ser = $c->getOption(\Redis::OPT_SERIALIZER);
$retry = \defined('Redis::OPT_SCAN') ? $c->getOption(\Redis::OPT_SCAN) : 0;

return $a + [
$prefix.'isConnected' => $connected,
$prefix.'host' => $c->getHost(),
$prefix.'port' => $c->getPort(),
$prefix.'auth' => $c->getAuth(),
$prefix.'dbNum' => $c->getDbNum(),
$prefix.'timeout' => $c->getTimeout(),
$prefix.'persistentId' => $c->getPersistentID(),
$prefix.'options' => new EnumStub([
'READ_TIMEOUT' => $c->getOption(\Redis::OPT_READ_TIMEOUT),
'SERIALIZER' => isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser,
'PREFIX' => $c->getOption(\Redis::OPT_PREFIX),
'SCAN' => new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry),
]),
];
}

public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

return $a + [
$prefix.'hosts' => $c->_hosts(),
$prefix.'function' => ClassStub::wrapCallable($c->_function()),
];
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class DOMCaster
{
private static $errorCodes = [
DOM_PHP_ERR => 'DOM_PHP_ERR',
DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR',
DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR',
DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR',
DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR',
DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR',
DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR',
DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR',
DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR',
DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR',
DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR',
DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR',
DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR',
DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR',
DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR',
];

private static $nodeTypes = [
XML_ELEMENT_NODE => 'XML_ELEMENT_NODE',
XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE',
XML_TEXT_NODE => 'XML_TEXT_NODE',
XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE',
XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE',
XML_ENTITY_NODE => 'XML_ENTITY_NODE',
XML_PI_NODE => 'XML_PI_NODE',
XML_COMMENT_NODE => 'XML_COMMENT_NODE',
XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE',
XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE',
XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE',
XML_NOTATION_NODE => 'XML_NOTATION_NODE',
XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE',
XML_DTD_NODE => 'XML_DTD_NODE',
XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE',
XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE',
XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE',
XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
];

public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)
{
$k = Caster::PREFIX_PROTECTED.'code';
if (isset($a[$k], self::$errorCodes[$a[$k]])) {
$a[$k] = new ConstStub(self::$errorCodes[$a[$k]], $a[$k]);
}

return $a;
}

public static function castLength($dom, array $a, Stub $stub, $isNested)
{
$a += [
'length' => $dom->length,
];

return $a;
}

public static function castImplementation($dom, array $a, Stub $stub, $isNested)
{
$a += [
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
Caster::PREFIX_VIRTUAL.'XML' => '2.0',
];

return $a;
}

public static function castNode(\DOMNode $dom, array $a, Stub $stub, $isNested)
{
$a += [
'nodeName' => $dom->nodeName,
'nodeValue' => new CutStub($dom->nodeValue),
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
'parentNode' => new CutStub($dom->parentNode),
'childNodes' => $dom->childNodes,
'firstChild' => new CutStub($dom->firstChild),
'lastChild' => new CutStub($dom->lastChild),
'previousSibling' => new CutStub($dom->previousSibling),
'nextSibling' => new CutStub($dom->nextSibling),
'attributes' => $dom->attributes,
'ownerDocument' => new CutStub($dom->ownerDocument),
'namespaceURI' => $dom->namespaceURI,
'prefix' => $dom->prefix,
'localName' => $dom->localName,
'baseURI' => $dom->baseURI ? new LinkStub($dom->baseURI) : $dom->baseURI,
'textContent' => new CutStub($dom->textContent),
];

return $a;
}

public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, $isNested)
{
$a += [
'nodeName' => $dom->nodeName,
'nodeValue' => new CutStub($dom->nodeValue),
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
'prefix' => $dom->prefix,
'localName' => $dom->localName,
'namespaceURI' => $dom->namespaceURI,
'ownerDocument' => new CutStub($dom->ownerDocument),
'parentNode' => new CutStub($dom->parentNode),
];

return $a;
}

public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, $isNested, $filter = 0)
{
$a += [
'doctype' => $dom->doctype,
'implementation' => $dom->implementation,
'documentElement' => new CutStub($dom->documentElement),
'actualEncoding' => $dom->actualEncoding,
'encoding' => $dom->encoding,
'xmlEncoding' => $dom->xmlEncoding,
'standalone' => $dom->standalone,
'xmlStandalone' => $dom->xmlStandalone,
'version' => $dom->version,
'xmlVersion' => $dom->xmlVersion,
'strictErrorChecking' => $dom->strictErrorChecking,
'documentURI' => $dom->documentURI ? new LinkStub($dom->documentURI) : $dom->documentURI,
'config' => $dom->config,
'formatOutput' => $dom->formatOutput,
'validateOnParse' => $dom->validateOnParse,
'resolveExternals' => $dom->resolveExternals,
'preserveWhiteSpace' => $dom->preserveWhiteSpace,
'recover' => $dom->recover,
'substituteEntities' => $dom->substituteEntities,
];

if (!($filter & Caster::EXCLUDE_VERBOSE)) {
$formatOutput = $dom->formatOutput;
$dom->formatOutput = true;
$a += [Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML()];
$dom->formatOutput = $formatOutput;
}

return $a;
}

public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, $isNested)
{
$a += [
'data' => $dom->data,
'length' => $dom->length,
];

return $a;
}

public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, $isNested)
{
$a += [
'name' => $dom->name,
'specified' => $dom->specified,
'value' => $dom->value,
'ownerElement' => $dom->ownerElement,
'schemaTypeInfo' => $dom->schemaTypeInfo,
];

return $a;
}

public static function castElement(\DOMElement $dom, array $a, Stub $stub, $isNested)
{
$a += [
'tagName' => $dom->tagName,
'schemaTypeInfo' => $dom->schemaTypeInfo,
];

return $a;
}

public static function castText(\DOMText $dom, array $a, Stub $stub, $isNested)
{
$a += [
'wholeText' => $dom->wholeText,
];

return $a;
}

public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, $isNested)
{
$a += [
'typeName' => $dom->typeName,
'typeNamespace' => $dom->typeNamespace,
];

return $a;
}

public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, $isNested)
{
$a += [
'severity' => $dom->severity,
'message' => $dom->message,
'type' => $dom->type,
'relatedException' => $dom->relatedException,
'related_data' => $dom->related_data,
'location' => $dom->location,
];

return $a;
}

public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, $isNested)
{
$a += [
'lineNumber' => $dom->lineNumber,
'columnNumber' => $dom->columnNumber,
'offset' => $dom->offset,
'relatedNode' => $dom->relatedNode,
'uri' => $dom->uri ? new LinkStub($dom->uri, $dom->lineNumber) : $dom->uri,
];

return $a;
}

public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, $isNested)
{
$a += [
'name' => $dom->name,
'entities' => $dom->entities,
'notations' => $dom->notations,
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
'internalSubset' => $dom->internalSubset,
];

return $a;
}

public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, $isNested)
{
$a += [
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
];

return $a;
}

public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, $isNested)
{
$a += [
'publicId' => $dom->publicId,
'systemId' => $dom->systemId,
'notationName' => $dom->notationName,
'actualEncoding' => $dom->actualEncoding,
'encoding' => $dom->encoding,
'version' => $dom->version,
];

return $a;
}

public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, $isNested)
{
$a += [
'target' => $dom->target,
'data' => $dom->data,
];

return $a;
}

public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, $isNested)
{
$a += [
'document' => $dom->document,
];

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;

@trigger_error('The '.__NAMESPACE__.'\MongoCaster class is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);








class MongoCaster
{
public static function castCursor(\MongoCursorInterface $cursor, array $a, Stub $stub, $isNested)
{
if ($info = $cursor->info()) {
foreach ($info as $k => $v) {
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
}
}
$a[Caster::PREFIX_VIRTUAL.'dead'] = $cursor->dead();

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class DateCaster
{
public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, $isNested, $filter)
{
$prefix = Caster::PREFIX_VIRTUAL;
$location = $d->getTimezone()->getLocation();
$fromNow = (new \DateTime())->diff($d);

$title = $d->format('l, F j, Y')
."\n".self::formatInterval($fromNow).' from now'
.($location ? ($d->format('I') ? "\nDST On" : "\nDST Off") : '')
;

unset(
$a[Caster::PREFIX_DYNAMIC.'date'],
$a[Caster::PREFIX_DYNAMIC.'timezone'],
$a[Caster::PREFIX_DYNAMIC.'timezone_type']
);
$a[$prefix.'date'] = new ConstStub(self::formatDateTime($d, $location ? ' e (P)' : ' P'), $title);

$stub->class .= $d->format(' @U');

return $a;
}

public static function castInterval(\DateInterval $interval, array $a, Stub $stub, $isNested, $filter)
{
$now = new \DateTimeImmutable();
$numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp();
$title = number_format($numberOfSeconds, 0, '.', ' ').'s';

$i = [Caster::PREFIX_VIRTUAL.'interval' => new ConstStub(self::formatInterval($interval), $title)];

return $filter & Caster::EXCLUDE_VERBOSE ? $i : $i + $a;
}

private static function formatInterval(\DateInterval $i)
{
$format = '%R ';

if (0 === $i->y && 0 === $i->m && ($i->h >= 24 || $i->i >= 60 || $i->s >= 60)) {
$i = date_diff($d = new \DateTime(), date_add(clone $d, $i)); 
 $format .= 0 < $i->days ? '%ad ' : '';
} else {
$format .= ($i->y ? '%yy ' : '').($i->m ? '%mm ' : '').($i->d ? '%dd ' : '');
}

if (\PHP_VERSION_ID >= 70100 && isset($i->f)) {
$format .= $i->h || $i->i || $i->s || $i->f ? '%H:%I:'.self::formatSeconds($i->s, substr($i->f, 2)) : '';
} else {
$format .= $i->h || $i->i || $i->s ? '%H:%I:%S' : '';
}

$format = '%R ' === $format ? '0s' : $format;

return $i->format(rtrim($format));
}

public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, $isNested, $filter)
{
$location = $timeZone->getLocation();
$formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
$title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code'], \Locale::getDefault()) : '';

$z = [Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)];

return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a;
}

public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, $isNested, $filter)
{
if (\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { 
 return $a;
}

$dates = [];
if (\PHP_VERSION_ID >= 70107) { 
 foreach (clone $p as $i => $d) {
if (3 === $i) {
$now = new \DateTimeImmutable();
$dates[] = sprintf('%s more', ($end = $p->getEndDate())
? ceil(($end->format('U.u') - $d->format('U.u')) / ((int) $now->add($p->getDateInterval())->format('U.u') - (int) $now->format('U.u')))
: $p->recurrences - $i
);
break;
}
$dates[] = sprintf('%s) %s', $i + 1, self::formatDateTime($d));
}
}

$period = sprintf(
'every %s, from %s (%s) %s',
self::formatInterval($p->getDateInterval()),
self::formatDateTime($p->getStartDate()),
$p->include_start_date ? 'included' : 'excluded',
($end = $p->getEndDate()) ? 'to '.self::formatDateTime($end) : 'recurring '.$p->recurrences.' time/s'
);

$p = [Caster::PREFIX_VIRTUAL.'period' => new ConstStub($period, implode("\n", $dates))];

return $filter & Caster::EXCLUDE_VERBOSE ? $p : $p + $a;
}

private static function formatDateTime(\DateTimeInterface $d, $extra = '')
{
return $d->format('Y-m-d H:i:'.self::formatSeconds($d->format('s'), $d->format('u')).$extra);
}

private static function formatSeconds($s, $us)
{
return sprintf('%02d.%s', $s, 0 === ($len = \strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us));
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class ReflectionCaster
{
private static $extraMap = [
'docComment' => 'getDocComment',
'extension' => 'getExtensionName',
'isDisabled' => 'isDisabled',
'isDeprecated' => 'isDeprecated',
'isInternal' => 'isInternal',
'isUserDefined' => 'isUserDefined',
'isGenerator' => 'isGenerator',
'isVariadic' => 'isVariadic',
];

public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested, $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;
$c = new \ReflectionFunction($c);

$stub->class = 'Closure'; 
 $a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter);

if (false === strpos($c->name, '{closure}')) {
$stub->class = isset($a[$prefix.'class']) ? $a[$prefix.'class']->value.'::'.$c->name : $c->name;
unset($a[$prefix.'class']);
}

if (isset($a[$prefix.'parameters'])) {
foreach ($a[$prefix.'parameters']->value as &$v) {
$param = $v;
$v = new EnumStub([]);
foreach (static::castParameter($param, [], $stub, true) as $k => $param) {
if ("\0" === $k[0]) {
$v->value[substr($k, 3)] = $param;
}
}
unset($v->value['position'], $v->value['isVariadic'], $v->value['byReference'], $v);
}
}

if (!($filter & Caster::EXCLUDE_VERBOSE) && $f = $c->getFileName()) {
$a[$prefix.'file'] = new LinkStub($f, $c->getStartLine());
$a[$prefix.'line'] = $c->getStartLine().' to '.$c->getEndLine();
}

$prefix = Caster::PREFIX_DYNAMIC;
unset($a['name'], $a[$prefix.'this'], $a[$prefix.'parameter'], $a[Caster::PREFIX_VIRTUAL.'extra']);

return $a;
}

public static function castGenerator(\Generator $c, array $a, Stub $stub, $isNested)
{
if (!class_exists('ReflectionGenerator', false)) {
return $a;
}


 try {
$reflectionGenerator = new \ReflectionGenerator($c);
} catch (\Exception $e) {
$a[Caster::PREFIX_VIRTUAL.'closed'] = true;

return $a;
}

return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested);
}

public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

$a += [
$prefix.'name' => $c instanceof \ReflectionNamedType ? $c->getName() : $c->__toString(),
$prefix.'allowsNull' => $c->allowsNull(),
$prefix.'isBuiltin' => $c->isBuiltin(),
];

return $a;
}

public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;

if ($c->getThis()) {
$a[$prefix.'this'] = new CutStub($c->getThis());
}
$function = $c->getFunction();
$frame = [
'class' => isset($function->class) ? $function->class : null,
'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null,
'function' => $function->name,
'file' => $c->getExecutingFile(),
'line' => $c->getExecutingLine(),
];
if ($trace = $c->getTrace(DEBUG_BACKTRACE_IGNORE_ARGS)) {
$function = new \ReflectionGenerator($c->getExecutingGenerator());
array_unshift($trace, [
'function' => 'yield',
'file' => $function->getExecutingFile(),
'line' => $function->getExecutingLine() - 1,
]);
$trace[] = $frame;
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
} else {
$function = new FrameStub($frame, false, true);
$function = ExceptionCaster::castFrameStub($function, [], $function, true);
$a[$prefix.'executing'] = new EnumStub([
"\0~separator= \0".$frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'],
]);
}

$a[Caster::PREFIX_VIRTUAL.'closed'] = false;

return $a;
}

public static function castClass(\ReflectionClass $c, array $a, Stub $stub, $isNested, $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;

if ($n = \Reflection::getModifierNames($c->getModifiers())) {
$a[$prefix.'modifiers'] = implode(' ', $n);
}

self::addMap($a, $c, [
'extends' => 'getParentClass',
'implements' => 'getInterfaceNames',
'constants' => 'getConstants',
]);

foreach ($c->getProperties() as $n) {
$a[$prefix.'properties'][$n->name] = $n;
}

foreach ($c->getMethods() as $n) {
$a[$prefix.'methods'][$n->name] = $n;
}

if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) {
self::addExtra($a, $c);
}

return $a;
}

public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, $isNested, $filter = 0)
{
$prefix = Caster::PREFIX_VIRTUAL;

self::addMap($a, $c, [
'returnsReference' => 'returnsReference',
'returnType' => 'getReturnType',
'class' => 'getClosureScopeClass',
'this' => 'getClosureThis',
]);

if (isset($a[$prefix.'returnType'])) {
$v = $a[$prefix.'returnType'];
$v = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
}
if (isset($a[$prefix.'class'])) {
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
}
if (isset($a[$prefix.'this'])) {
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
}

foreach ($c->getParameters() as $v) {
$k = '$'.$v->name;
if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
$k = '...'.$k;
}
if ($v->isPassedByReference()) {
$k = '&'.$k;
}
$a[$prefix.'parameters'][$k] = $v;
}
if (isset($a[$prefix.'parameters'])) {
$a[$prefix.'parameters'] = new EnumStub($a[$prefix.'parameters']);
}

if ($v = $c->getStaticVariables()) {
foreach ($v as $k => &$v) {
if (\is_object($v)) {
$a[$prefix.'use']['$'.$k] = new CutStub($v);
} else {
$a[$prefix.'use']['$'.$k] = &$v;
}
}
unset($v);
$a[$prefix.'use'] = new EnumStub($a[$prefix.'use']);
}

if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) {
self::addExtra($a, $c);
}


 unset($a[Caster::PREFIX_DYNAMIC.'static']);

return $a;
}

public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));

return $a;
}

public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, $isNested)
{
$prefix = Caster::PREFIX_VIRTUAL;


 unset($a['info']);

self::addMap($a, $c, [
'position' => 'getPosition',
'isVariadic' => 'isVariadic',
'byReference' => 'isPassedByReference',
'allowsNull' => 'allowsNull',
]);

if (method_exists($c, 'getType')) {
if ($v = $c->getType()) {
$a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
}
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $c, $v)) {
$a[$prefix.'typeHint'] = $v[1];
}

if (isset($a[$prefix.'typeHint'])) {
$v = $a[$prefix.'typeHint'];
$a[$prefix.'typeHint'] = new ClassStub($v, [class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', '']);
} else {
unset($a[$prefix.'allowsNull']);
}

try {
$a[$prefix.'default'] = $v = $c->getDefaultValue();
if (method_exists($c, 'isDefaultValueConstant') && $c->isDefaultValueConstant()) {
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
}
if (null === $v) {
unset($a[$prefix.'allowsNull']);
}
} catch (\ReflectionException $e) {
if (isset($a[$prefix.'typeHint']) && $c->allowsNull() && !class_exists('ReflectionNamedType', false)) {
$a[$prefix.'default'] = null;
unset($a[$prefix.'allowsNull']);
}
}

return $a;
}

public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, $isNested)
{
$a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
self::addExtra($a, $c);

return $a;
}

public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, $isNested)
{
self::addMap($a, $c, [
'version' => 'getVersion',
'dependencies' => 'getDependencies',
'iniEntries' => 'getIniEntries',
'isPersistent' => 'isPersistent',
'isTemporary' => 'isTemporary',
'constants' => 'getConstants',
'functions' => 'getFunctions',
'classes' => 'getClasses',
]);

return $a;
}

public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, $isNested)
{
self::addMap($a, $c, [
'version' => 'getVersion',
'author' => 'getAuthor',
'copyright' => 'getCopyright',
'url' => 'getURL',
]);

return $a;
}

private static function addExtra(&$a, \Reflector $c)
{
$x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : [];

if (method_exists($c, 'getFileName') && $m = $c->getFileName()) {
$x['file'] = new LinkStub($m, $c->getStartLine());
$x['line'] = $c->getStartLine().' to '.$c->getEndLine();
}

self::addMap($x, $c, self::$extraMap, '');

if ($x) {
$a[Caster::PREFIX_VIRTUAL.'extra'] = new EnumStub($x);
}
}

private static function addMap(&$a, \Reflector $c, $map, $prefix = Caster::PREFIX_VIRTUAL)
{
foreach ($map as $k => $m) {
if (method_exists($c, $m) && false !== ($m = $c->$m()) && null !== $m) {
$a[$prefix.$k] = $m instanceof \Reflector ? $m->name : $m;
}
}
}
}
<?php









namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class XmlReaderCaster
{
private static $nodeTypes = [
\XMLReader::NONE => 'NONE',
\XMLReader::ELEMENT => 'ELEMENT',
\XMLReader::ATTRIBUTE => 'ATTRIBUTE',
\XMLReader::TEXT => 'TEXT',
\XMLReader::CDATA => 'CDATA',
\XMLReader::ENTITY_REF => 'ENTITY_REF',
\XMLReader::ENTITY => 'ENTITY',
\XMLReader::PI => 'PI (Processing Instruction)',
\XMLReader::COMMENT => 'COMMENT',
\XMLReader::DOC => 'DOC',
\XMLReader::DOC_TYPE => 'DOC_TYPE',
\XMLReader::DOC_FRAGMENT => 'DOC_FRAGMENT',
\XMLReader::NOTATION => 'NOTATION',
\XMLReader::WHITESPACE => 'WHITESPACE',
\XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE',
\XMLReader::END_ELEMENT => 'END_ELEMENT',
\XMLReader::END_ENTITY => 'END_ENTITY',
\XMLReader::XML_DECLARATION => 'XML_DECLARATION',
];

public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested)
{
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
$info = [
'localName' => $reader->localName,
'prefix' => $reader->prefix,
'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType),
'depth' => $reader->depth,
'isDefault' => $reader->isDefault,
'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
'xmlLang' => $reader->xmlLang,
'attributeCount' => $reader->attributeCount,
'value' => $reader->value,
'namespaceURI' => $reader->namespaceURI,
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
$props => [
'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD),
'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS),
'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE),
'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
],
];

if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, [], $count)) {
$info[$props] = new EnumStub($info[$props]);
$info[$props]->cut = $count;
}

$info = Caster::filter($info, Caster::EXCLUDE_EMPTY, [], $count);

 $stub->cut += $count + 2;

return $a + $info;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class XmlResourceCaster
{
private static $xmlErrors = [
XML_ERROR_NONE => 'XML_ERROR_NONE',
XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY',
XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX',
XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS',
XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN',
XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN',
XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR',
XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH',
XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE',
XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT',
XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF',
XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY',
XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF',
XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY',
XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF',
XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF',
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF',
XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI',
XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING',
XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING',
XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION',
XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
];

public static function castXml($h, array $a, Stub $stub, $isNested)
{
$a['current_byte_index'] = xml_get_current_byte_index($h);
$a['current_column_number'] = xml_get_current_column_number($h);
$a['current_line_number'] = xml_get_current_line_number($h);
$a['error_code'] = xml_get_error_code($h);

if (isset(self::$xmlErrors[$a['error_code']])) {
$a['error_code'] = new ConstStub(self::$xmlErrors[$a['error_code']], $a['error_code']);
}

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Caster;

use Symfony\Component\VarDumper\Cloner\Stub;






class StubCaster
{
public static function castStub(Stub $c, array $a, Stub $stub, $isNested)
{
if ($isNested) {
$stub->type = $c->type;
$stub->class = $c->class;
$stub->value = $c->value;
$stub->handle = $c->handle;
$stub->cut = $c->cut;
$stub->attr = $c->attr;

if (Stub::TYPE_REF === $c->type && !$c->class && \is_string($c->value) && !preg_match('//u', $c->value)) {
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_BINARY;
}

$a = [];
}

return $a;
}

public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested)
{
return $isNested ? $c->preservedSubset : $a;
}

public static function cutInternals($obj, array $a, Stub $stub, $isNested)
{
if ($isNested) {
$stub->cut += \count($a);

return [];
}

return $a;
}

public static function castEnum(EnumStub $c, array $a, Stub $stub, $isNested)
{
if ($isNested) {
$stub->class = $c->dumpKeys ? '' : null;
$stub->handle = 0;
$stub->value = null;
$stub->cut = $c->cut;
$stub->attr = $c->attr;

$a = [];

if ($c->value) {
foreach (array_keys($c->value) as $k) {
$keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k;
}

 $a = array_combine($keys, $c->value);
}
}

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper\Cloner;

use Symfony\Component\VarDumper\Caster\Caster;




class Data implements \ArrayAccess, \Countable, \IteratorAggregate
{
private $data;
private $position = 0;
private $key = 0;
private $maxDepth = 20;
private $maxItemsPerDepth = -1;
private $useRefHandles = -1;




public function __construct(array $data)
{
$this->data = $data;
}




public function getType()
{
$item = $this->data[$this->position][$this->key];

if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
$item = $item->value;
}
if (!$item instanceof Stub) {
return \gettype($item);
}
if (Stub::TYPE_STRING === $item->type) {
return 'string';
}
if (Stub::TYPE_ARRAY === $item->type) {
return 'array';
}
if (Stub::TYPE_OBJECT === $item->type) {
return $item->class;
}
if (Stub::TYPE_RESOURCE === $item->type) {
return $item->class.' resource';
}

return null;
}






public function getValue($recursive = false)
{
$item = $this->data[$this->position][$this->key];

if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
$item = $item->value;
}
if (!($item = $this->getStub($item)) instanceof Stub) {
return $item;
}
if (Stub::TYPE_STRING === $item->type) {
return $item->value;
}

$children = $item->position ? $this->data[$item->position] : [];

foreach ($children as $k => $v) {
if ($recursive && !($v = $this->getStub($v)) instanceof Stub) {
continue;
}
$children[$k] = clone $this;
$children[$k]->key = $k;
$children[$k]->position = $item->position;

if ($recursive) {
if (Stub::TYPE_REF === $v->type && ($v = $this->getStub($v->value)) instanceof Stub) {
$recursive = (array) $recursive;
if (isset($recursive[$v->position])) {
continue;
}
$recursive[$v->position] = true;
}
$children[$k] = $children[$k]->getValue($recursive);
}
}

return $children;
}

public function count()
{
return \count($this->getValue());
}

public function getIterator()
{
if (!\is_array($value = $this->getValue())) {
throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, \gettype($value)));
}

foreach ($value as $k => $v) {
yield $k => $v;
}
}

public function __get($key)
{
if (null !== $data = $this->seek($key)) {
$item = $this->getStub($data->data[$data->position][$data->key]);

return $item instanceof Stub || [] === $item ? $data : $item;
}

return null;
}

public function __isset($key)
{
return null !== $this->seek($key);
}

public function offsetExists($key)
{
return $this->__isset($key);
}

public function offsetGet($key)
{
return $this->__get($key);
}

public function offsetSet($key, $value)
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}

public function offsetUnset($key)
{
throw new \BadMethodCallException(self::class.' objects are immutable.');
}

public function __toString()
{
$value = $this->getValue();

if (!\is_array($value)) {
return (string) $value;
}

return sprintf('%s (count=%d)', $this->getType(), \count($value));
}






public function getRawData()
{
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the array or object access instead.', __METHOD__));

return $this->data;
}








public function withMaxDepth($maxDepth)
{
$data = clone $this;
$data->maxDepth = (int) $maxDepth;

return $data;
}








public function withMaxItemsPerDepth($maxItemsPerDepth)
{
$data = clone $this;
$data->maxItemsPerDepth = (int) $maxItemsPerDepth;

return $data;
}








public function withRefHandles($useRefHandles)
{
$data = clone $this;
$data->useRefHandles = $useRefHandles ? -1 : 0;

return $data;
}








public function seek($key)
{
$item = $this->data[$this->position][$this->key];

if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
$item = $item->value;
}
if (!($item = $this->getStub($item)) instanceof Stub || !$item->position) {
return null;
}
$keys = [$key];

switch ($item->type) {
case Stub::TYPE_OBJECT:
$keys[] = Caster::PREFIX_DYNAMIC.$key;
$keys[] = Caster::PREFIX_PROTECTED.$key;
$keys[] = Caster::PREFIX_VIRTUAL.$key;
$keys[] = "\0$item->class\0$key";

 case Stub::TYPE_ARRAY:
case Stub::TYPE_RESOURCE:
break;
default:
return null;
}

$data = null;
$children = $this->data[$item->position];

foreach ($keys as $key) {
if (isset($children[$key]) || \array_key_exists($key, $children)) {
$data = clone $this;
$data->key = $key;
$data->position = $item->position;
break;
}
}

return $data;
}




public function dump(DumperInterface $dumper)
{
$refs = [0];
$this->dumpItem($dumper, new Cursor(), $refs, $this->data[$this->position][$this->key]);
}









private function dumpItem($dumper, $cursor, &$refs, $item)
{
$cursor->refIndex = 0;
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
$cursor->hardRefTo = $cursor->hardRefHandle = $cursor->hardRefCount = 0;
$firstSeen = true;

if (!$item instanceof Stub) {
$cursor->attr = [];
$type = \gettype($item);
if ($item && 'array' === $type) {
$item = $this->getStub($item);
}
} elseif (Stub::TYPE_REF === $item->type) {
if ($item->handle) {
if (!isset($refs[$r = $item->handle - (PHP_INT_MAX >> 1)])) {
$cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0];
} else {
$firstSeen = false;
}
$cursor->hardRefTo = $refs[$r];
$cursor->hardRefHandle = $this->useRefHandles & $item->handle;
$cursor->hardRefCount = $item->refCount;
}
$cursor->attr = $item->attr;
$type = $item->class ?: \gettype($item->value);
$item = $this->getStub($item->value);
}
if ($item instanceof Stub) {
if ($item->refCount) {
if (!isset($refs[$r = $item->handle])) {
$cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0];
} else {
$firstSeen = false;
}
$cursor->softRefTo = $refs[$r];
}
$cursor->softRefHandle = $this->useRefHandles & $item->handle;
$cursor->softRefCount = $item->refCount;
$cursor->attr = $item->attr;
$cut = $item->cut;

if ($item->position && $firstSeen) {
$children = $this->data[$item->position];

if ($cursor->stop) {
if ($cut >= 0) {
$cut += \count($children);
}
$children = [];
}
} else {
$children = [];
}
switch ($item->type) {
case Stub::TYPE_STRING:
$dumper->dumpString($cursor, $item->value, Stub::STRING_BINARY === $item->class, $cut);
break;

case Stub::TYPE_ARRAY:
$item = clone $item;
$item->type = $item->class;
$item->class = $item->value;

 case Stub::TYPE_OBJECT:
case Stub::TYPE_RESOURCE:
$withChildren = $children && $cursor->depth !== $this->maxDepth && $this->maxItemsPerDepth;
$dumper->enterHash($cursor, $item->type, $item->class, $withChildren);
if ($withChildren) {
if ($cursor->skipChildren) {
$withChildren = false;
$cut = -1;
} else {
$cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type, null !== $item->class);
}
} elseif ($children && 0 <= $cut) {
$cut += \count($children);
}
$cursor->skipChildren = false;
$dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut);
break;

default:
throw new \RuntimeException(sprintf('Unexpected Stub type: %s', $item->type));
}
} elseif ('array' === $type) {
$dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false);
$dumper->leaveHash($cursor, Cursor::HASH_INDEXED, 0, false, 0);
} elseif ('string' === $type) {
$dumper->dumpString($cursor, $item, false, 0);
} else {
$dumper->dumpScalar($cursor, $type, $item);
}
}














private function dumpChildren($dumper, $parentCursor, &$refs, $children, $hashCut, $hashType, $dumpKeys)
{
$cursor = clone $parentCursor;
++$cursor->depth;
$cursor->hashType = $hashType;
$cursor->hashIndex = 0;
$cursor->hashLength = \count($children);
$cursor->hashCut = $hashCut;
foreach ($children as $key => $child) {
$cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key);
$cursor->hashKey = $dumpKeys ? $key : null;
$this->dumpItem($dumper, $cursor, $refs, $child);
if (++$cursor->hashIndex === $this->maxItemsPerDepth || $cursor->stop) {
$parentCursor->stop = true;

return $hashCut >= 0 ? $hashCut + $cursor->hashLength - $cursor->hashIndex : $hashCut;
}
}

return $hashCut;
}

private function getStub($item)
{
if (!$item || !\is_array($item)) {
return $item;
}

$stub = new Stub();
$stub->type = Stub::TYPE_ARRAY;
foreach ($item as $stub->class => $stub->position) {
}
if (isset($item[0])) {
$stub->cut = $item[0];
}
$stub->value = $stub->cut + ($stub->position ? \count($this->data[$stub->position]) : 0);

return $stub;
}
}
<?php










namespace Symfony\Component\VarDumper\Cloner;






class Stub
{
const TYPE_REF = 1;
const TYPE_STRING = 2;
const TYPE_ARRAY = 3;
const TYPE_OBJECT = 4;
const TYPE_RESOURCE = 5;

const STRING_BINARY = 1;
const STRING_UTF8 = 2;

const ARRAY_ASSOC = 1;
const ARRAY_INDEXED = 2;

public $type = self::TYPE_REF;
public $class = '';
public $value;
public $cut = 0;
public $handle = 0;
public $refCount = 0;
public $position = 0;
public $attr = [];

private static $defaultProperties = [];




public function __sleep()
{
$properties = [];

if (!isset(self::$defaultProperties[$c = static::class])) {
self::$defaultProperties[$c] = get_class_vars($c);

foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) {
unset(self::$defaultProperties[$c][$k]);
}
}

foreach (self::$defaultProperties[$c] as $k => $v) {
if ($this->$k !== $v) {
$properties[] = $k;
}
}

return $properties;
}
}
<?php










namespace Symfony\Component\VarDumper\Cloner;






interface DumperInterface
{







public function dumpScalar(Cursor $cursor, $type, $value);









public function dumpString(Cursor $cursor, $str, $bin, $cut);









public function enterHash(Cursor $cursor, $type, $class, $hasChild);










public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut);
}
<?php










namespace Symfony\Component\VarDumper\Cloner;




class VarCloner extends AbstractCloner
{
private static $gid;
private static $hashMask = 0;
private static $hashOffset = 0;
private static $arrayCache = [];




protected function doClone($var)
{
$len = 1; 
 $pos = 0; 
 $refsCounter = 0; 
 $queue = [[$var]]; 
 $indexedArrays = []; 
 $hardRefs = []; 
 $objRefs = []; 
 $objects = []; 
 $resRefs = []; 
 $values = []; 
 $maxItems = $this->maxItems;
$maxString = $this->maxString;
$minDepth = $this->minDepth;
$currentDepth = 0; 
 $currentDepthFinalIndex = 0; 
 $minimumDepthReached = 0 === $minDepth; 
 $cookie = (object) []; 
 $a = null; 
 $stub = null; 
 

if (!self::$hashMask) {
self::$gid = uniqid(mt_rand(), true); 
 self::initHashMask();
}
$gid = self::$gid;
$hashMask = self::$hashMask;
$hashOffset = self::$hashOffset;
$arrayStub = new Stub();
$arrayStub->type = Stub::TYPE_ARRAY;
$fromObjCast = false;

for ($i = 0; $i < $len; ++$i) {

 if ($i > $currentDepthFinalIndex) {
++$currentDepth;
$currentDepthFinalIndex = $len - 1;
if ($currentDepth >= $minDepth) {
$minimumDepthReached = true;
}
}

$refs = $vals = $queue[$i];
if (\PHP_VERSION_ID < 70200 && empty($indexedArrays[$i])) {

 foreach ($vals as $k => $v) {
if (\is_int($k)) {
continue;
}
foreach ([$k => true] as $gk => $gv) {
}
if ($gk !== $k) {
$fromObjCast = true;
$refs = $vals = array_values($queue[$i]);
break;
}
}
}
foreach ($vals as $k => $v) {


if (\PHP_VERSION_ID >= 70400) {
$zvalIsRef = null !== \ReflectionReference::fromArrayElement($vals, $k);
} else {
$refs[$k] = $cookie;
$zvalIsRef = $vals[$k] === $cookie;
}

if ($zvalIsRef) {
$vals[$k] = &$stub; 
 unset($stub); 
 if ($v instanceof Stub && isset($hardRefs[spl_object_hash($v)])) {
$vals[$k] = $refs[$k] = $v;
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
++$v->value->refCount;
}
++$v->refCount;
continue;
}
$refs[$k] = $vals[$k] = new Stub();
$refs[$k]->value = $v;
$h = spl_object_hash($refs[$k]);
$hardRefs[$h] = &$refs[$k];
$values[$h] = $v;
$vals[$k]->handle = ++$refsCounter;
}

 
 switch (true) {
case null === $v:
case \is_bool($v):
case \is_int($v):
case \is_float($v):
continue 2;

case \is_string($v):
if ('' === $v) {
continue 2;
}
if (!preg_match('//u', $v)) {
$stub = new Stub();
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_BINARY;
if (0 <= $maxString && 0 < $cut = \strlen($v) - $maxString) {
$stub->cut = $cut;
$stub->value = substr($v, 0, -$cut);
} else {
$stub->value = $v;
}
} elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = mb_strlen($v, 'UTF-8') - $maxString) {
$stub = new Stub();
$stub->type = Stub::TYPE_STRING;
$stub->class = Stub::STRING_UTF8;
$stub->cut = $cut;
$stub->value = mb_substr($v, 0, $maxString, 'UTF-8');
} else {
continue 2;
}
$a = null;
break;

case \is_array($v):
if (!$v) {
continue 2;
}
$stub = $arrayStub;
$stub->class = Stub::ARRAY_INDEXED;

$j = -1;
foreach ($v as $gk => $gv) {
if ($gk !== ++$j) {
$stub->class = Stub::ARRAY_ASSOC;
break;
}
}
$a = $v;

if (Stub::ARRAY_ASSOC === $stub->class) {

 
 $a[$gid] = true;


 if (isset($v[$gid])) {
unset($v[$gid]);
$a = [];
foreach ($v as $gk => &$gv) {
$a[$gk] = &$gv;
}
unset($gv);
} else {
$a = $v;
}
} elseif (\PHP_VERSION_ID < 70200) {
$indexedArrays[$len] = true;
}
break;

case \is_object($v):
case $v instanceof \__PHP_Incomplete_Class:
if (empty($objRefs[$h = $hashMask ^ hexdec(substr(spl_object_hash($v), $hashOffset, \PHP_INT_SIZE))])) {
$stub = new Stub();
$stub->type = Stub::TYPE_OBJECT;
$stub->class = \get_class($v);
$stub->value = $v;
$stub->handle = $h;
$a = $this->castObject($stub, 0 < $i);
if ($v !== $stub->value) {
if (Stub::TYPE_OBJECT !== $stub->type || null === $stub->value) {
break;
}
$h = $hashMask ^ hexdec(substr(spl_object_hash($stub->value), $hashOffset, \PHP_INT_SIZE));
$stub->handle = $h;
}
$stub->value = null;
if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) {
$stub->cut = \count($a);
$a = null;
}
}
if (empty($objRefs[$h])) {
$objRefs[$h] = $stub;
$objects[] = $v;
} else {
$stub = $objRefs[$h];
++$stub->refCount;
$a = null;
}
break;

default: 
 if (empty($resRefs[$h = (int) $v])) {
$stub = new Stub();
$stub->type = Stub::TYPE_RESOURCE;
if ('Unknown' === $stub->class = @get_resource_type($v)) {
$stub->class = 'Closed';
}
$stub->value = $v;
$stub->handle = $h;
$a = $this->castResource($stub, 0 < $i);
$stub->value = null;
if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) {
$stub->cut = \count($a);
$a = null;
}
}
if (empty($resRefs[$h])) {
$resRefs[$h] = $stub;
} else {
$stub = $resRefs[$h];
++$stub->refCount;
$a = null;
}
break;
}

if ($a) {
if (!$minimumDepthReached || 0 > $maxItems) {
$queue[$len] = $a;
$stub->position = $len++;
} elseif ($pos < $maxItems) {
if ($maxItems < $pos += \count($a)) {
$a = \array_slice($a, 0, $maxItems - $pos);
if ($stub->cut >= 0) {
$stub->cut += $pos - $maxItems;
}
}
$queue[$len] = $a;
$stub->position = $len++;
} elseif ($stub->cut >= 0) {
$stub->cut += \count($a);
$stub->position = 0;
}
}

if ($arrayStub === $stub) {
if ($arrayStub->cut) {
$stub = [$arrayStub->cut, $arrayStub->class => $arrayStub->position];
$arrayStub->cut = 0;
} elseif (isset(self::$arrayCache[$arrayStub->class][$arrayStub->position])) {
$stub = self::$arrayCache[$arrayStub->class][$arrayStub->position];
} else {
self::$arrayCache[$arrayStub->class][$arrayStub->position] = $stub = [$arrayStub->class => $arrayStub->position];
}
}

if ($zvalIsRef) {
$refs[$k]->value = $stub;
} else {
$vals[$k] = $stub;
}
}

if ($fromObjCast) {
$fromObjCast = false;
$refs = $vals;
$vals = [];
$j = -1;
foreach ($queue[$i] as $k => $v) {
foreach ([$k => true] as $gk => $gv) {
}
if ($gk !== $k) {
$vals = (object) $vals;
$vals->{$k} = $refs[++$j];
$vals = (array) $vals;
} else {
$vals[$k] = $refs[++$j];
}
}
}

$queue[$i] = $vals;
}

foreach ($values as $h => $v) {
$hardRefs[$h] = $v;
}

return $queue;
}

private static function initHashMask()
{
$obj = (object) [];
self::$hashOffset = 16 - PHP_INT_SIZE;
self::$hashMask = -1;

if (\defined('HHVM_VERSION')) {
self::$hashOffset += 16;
} else {

 $obFuncs = ['ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush'];
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && \in_array($frame['function'], $obFuncs)) {
$frame['line'] = 0;
break;
}
}
if (!empty($frame['line'])) {
ob_start();
debug_zval_dump($obj);
self::$hashMask = (int) substr(ob_get_clean(), 17);
}
}

self::$hashMask ^= hexdec(substr(spl_object_hash($obj), self::$hashOffset, PHP_INT_SIZE));
}
}
<?php










namespace Symfony\Component\VarDumper\Cloner;






class Cursor
{
const HASH_INDEXED = Stub::ARRAY_INDEXED;
const HASH_ASSOC = Stub::ARRAY_ASSOC;
const HASH_OBJECT = Stub::TYPE_OBJECT;
const HASH_RESOURCE = Stub::TYPE_RESOURCE;

public $depth = 0;
public $refIndex = 0;
public $softRefTo = 0;
public $softRefCount = 0;
public $softRefHandle = 0;
public $hardRefTo = 0;
public $hardRefCount = 0;
public $hardRefHandle = 0;
public $hashType;
public $hashKey;
public $hashKeyIsBinary;
public $hashIndex = 0;
public $hashLength = 0;
public $hashCut = 0;
public $stop = false;
public $attr = [];
public $skipChildren = false;
}
<?php










namespace Symfony\Component\VarDumper\Cloner;




interface ClonerInterface
{







public function cloneVar($var);
}
<?php










namespace Symfony\Component\VarDumper\Cloner;

use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;






abstract class AbstractCloner implements ClonerInterface
{
public static $defaultCasters = [
'__PHP_Incomplete_Class' => ['Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'],

'Symfony\Component\VarDumper\Caster\CutStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'],
'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'],
'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'],

'Closure' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'],
'Generator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'],
'ReflectionType' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'],
'ReflectionGenerator' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'],
'ReflectionClass' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'],
'ReflectionFunctionAbstract' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'],
'ReflectionMethod' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'],
'ReflectionParameter' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'],
'ReflectionProperty' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'],
'ReflectionExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'],
'ReflectionZendExtension' => ['Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'],

'Doctrine\Common\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Doctrine\Common\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'],
'Doctrine\ORM\Proxy\Proxy' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'],
'Doctrine\ORM\PersistentCollection' => ['Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'],
'Doctrine\Persistence\ObjectManager' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],

'DOMException' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'],
'DOMStringList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMNameList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMImplementation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'],
'DOMImplementationList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'],
'DOMNameSpaceNode' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNameSpaceNode'],
'DOMDocument' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'],
'DOMNodeList' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMNamedNodeMap' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'],
'DOMCharacterData' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'],
'DOMAttr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'],
'DOMElement' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'],
'DOMText' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'],
'DOMTypeinfo' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'],
'DOMDomError' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'],
'DOMLocator' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'],
'DOMDocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'],
'DOMNotation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'],
'DOMEntity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'],
'DOMProcessingInstruction' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'],
'DOMXPath' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castXPath'],

'XmlReader' => ['Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'],

'ErrorException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'],
'Exception' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'],
'Error' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'],
'Symfony\Component\DependencyInjection\ContainerInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'],
'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'],
'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],
'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'],
'Symfony\Component\Debug\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'],

'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'PHPUnit\Framework\MockObject\MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'PHPUnit\Framework\MockObject\Stub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Prophecy\Prophecy\ProphecySubjectInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
'Mockery\MockInterface' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],

'PDO' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'],
'PDOStatement' => ['Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'],

'AMQPConnection' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'],
'AMQPChannel' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'],
'AMQPQueue' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'],
'AMQPExchange' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'],
'AMQPEnvelope' => ['Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'],

'ArrayObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'],
'ArrayIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'],
'SplDoublyLinkedList' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'],
'SplFileInfo' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'],
'SplFileObject' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'],
'SplFixedArray' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castFixedArray'],
'SplHeap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'],
'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'],
'OuterIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'],

'MongoCursorInterface' => ['Symfony\Component\VarDumper\Caster\MongoCaster', 'castCursor'],

'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'],
'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'],

'DateTimeInterface' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'],
'DateInterval' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'],
'DateTimeZone' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'],
'DatePeriod' => ['Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'],

':curl' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'],
':dba' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
':dba persistent' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'],
':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'],
':mysql link' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'],
':pgsql large object' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'],
':pgsql link' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
':pgsql link persistent' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'],
':pgsql result' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'],
':process' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'],
':stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'],
':persistent stream' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'],
':stream-context' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'],
':xml' => ['Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'],
];

protected $maxItems = 2500;
protected $maxString = -1;
protected $minDepth = 1;
protected $useExt;

private $casters = [];
private $prevErrorHandler;
private $classInfo = [];
private $filter = 0;






public function __construct(array $casters = null)
{
if (null === $casters) {
$casters = static::$defaultCasters;
}
$this->addCasters($casters);
$this->useExt = \extension_loaded('symfony_debug');
}











public function addCasters(array $casters)
{
foreach ($casters as $type => $callback) {
$this->casters[strtolower($type)][] = \is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback;
}
}






public function setMaxItems($maxItems)
{
$this->maxItems = (int) $maxItems;
}






public function setMaxString($maxString)
{
$this->maxString = (int) $maxString;
}







public function setMinDepth($minDepth)
{
$this->minDepth = (int) $minDepth;
}









public function cloneVar($var, $filter = 0)
{
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {

 throw new \ErrorException($msg, 0, $type, $file, $line);
}

if ($this->prevErrorHandler) {
return \call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context);
}

return false;
});
$this->filter = $filter;

if ($gc = gc_enabled()) {
gc_disable();
}
try {
return new Data($this->doClone($var));
} finally {
if ($gc) {
gc_enable();
}
restore_error_handler();
$this->prevErrorHandler = null;
}
}








abstract protected function doClone($var);









protected function castObject(Stub $stub, $isNested)
{
$obj = $stub->value;
$class = $stub->class;

if (isset($class[15]) && "\0" === $class[15] && 0 === strpos($class, "class@anonymous\x00")) {
$stub->class = get_parent_class($class).'@anonymous';
}
if (isset($this->classInfo[$class])) {
list($i, $parents, $hasDebugInfo) = $this->classInfo[$class];
} else {
$i = 2;
$parents = [strtolower($class)];
$hasDebugInfo = method_exists($class, '__debugInfo');

foreach (class_parents($class) as $p) {
$parents[] = strtolower($p);
++$i;
}
foreach (class_implements($class) as $p) {
$parents[] = strtolower($p);
++$i;
}
$parents[] = '*';

$this->classInfo[$class] = [$i, $parents, $hasDebugInfo];
}

$a = Caster::castObject($obj, $class, $hasDebugInfo);

try {
while ($i--) {
if (!empty($this->casters[$p = $parents[$i]])) {
foreach ($this->casters[$p] as $callback) {
$a = $callback($obj, $a, $stub, $isNested, $this->filter);
}
}
}
} catch (\Exception $e) {
$a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}

return $a;
}









protected function castResource(Stub $stub, $isNested)
{
$a = [];
$res = $stub->value;
$type = $stub->class;

try {
if (!empty($this->casters[':'.$type])) {
foreach ($this->casters[':'.$type] as $callback) {
$a = $callback($res, $a, $stub, $isNested, $this->filter);
}
}
} catch (\Exception $e) {
$a = [(Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)] + $a;
}

return $a;
}
}
<?php










namespace Symfony\Component\VarDumper;

use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;


require_once __DIR__.'/Resources/functions/dump.php';




class VarDumper
{
private static $handler;

public static function dump($var)
{
if (null === self::$handler) {
$cloner = new VarCloner();
$dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? new CliDumper() : new HtmlDumper();
self::$handler = function ($var) use ($cloner, $dumper) {
$dumper->dump($cloner->cloneVar($var));
};
}

return \call_user_func(self::$handler, $var);
}

public static function setHandler(callable $callable = null)
{
$prevHandler = self::$handler;
self::$handler = $callable;

return $prevHandler;
}
}
<?php










namespace Symfony\Component\VarDumper\Exception;




class ThrowingCasterException extends \Exception
{



public function __construct(\Exception $prev)
{
parent::__construct('Unexpected '.\get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev);
}
}
<?php










namespace Symfony\Component\VarDumper\Dumper;

use Symfony\Component\VarDumper\Cloner\Data;






interface DataDumperInterface
{
public function dump(Data $data);
}
<?php










namespace Symfony\Component\VarDumper\Dumper;

use Symfony\Component\VarDumper\Cloner\Cursor;
use Symfony\Component\VarDumper\Cloner\Data;






class HtmlDumper extends CliDumper
{
public static $defaultOutput = 'php://output';

protected $dumpHeader;
protected $dumpPrefix = '<pre class=sf-dump id=%s data-indent-pad="%s">';
protected $dumpSuffix = '</pre><script>Sfdump(%s)</script>';
protected $dumpId = 'sf-dump';
protected $colors = true;
protected $headerIsDumped = false;
protected $lastDepth = -1;
protected $styles = [
'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all',
'num' => 'font-weight:bold; color:#1299DA',
'const' => 'font-weight:bold',
'str' => 'font-weight:bold; color:#56DB3A',
'note' => 'color:#1299DA',
'ref' => 'color:#A0A0A0',
'public' => 'color:#FFFFFF',
'protected' => 'color:#FFFFFF',
'private' => 'color:#FFFFFF',
'meta' => 'color:#B729D9',
'key' => 'color:#56DB3A',
'index' => 'color:#1299DA',
'ellipsis' => 'color:#FF8400',
];

private $displayOptions = [
'maxDepth' => 1,
'maxStringLength' => 160,
'fileLinkFormat' => null,
];
private $extraDisplayOptions = [];




public function __construct($output = null, $charset = null, $flags = 0)
{
AbstractDumper::__construct($output, $charset, $flags);
$this->dumpId = 'sf-dump-'.mt_rand();
$this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
}




public function setStyles(array $styles)
{
$this->headerIsDumped = false;
$this->styles = $styles + $this->styles;
}






public function setDisplayOptions(array $displayOptions)
{
$this->headerIsDumped = false;
$this->displayOptions = $displayOptions + $this->displayOptions;
}






public function setDumpHeader($header)
{
$this->dumpHeader = $header;
}







public function setDumpBoundaries($prefix, $suffix)
{
$this->dumpPrefix = $prefix;
$this->dumpSuffix = $suffix;
}




public function dump(Data $data, $output = null, array $extraDisplayOptions = [])
{
$this->extraDisplayOptions = $extraDisplayOptions;
$result = parent::dump($data, $output);
$this->dumpId = 'sf-dump-'.mt_rand();

return $result;
}




protected function getDumpHeader()
{
$this->headerIsDumped = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;

if (null !== $this->dumpHeader) {
return $this->dumpHeader;
}

$line = str_replace('{$options}', json_encode($this->displayOptions, JSON_FORCE_OBJECT), <<<'EOHTML'
<script>
Sfdump = window.Sfdump || (function (doc) {

var refStyle = doc.createElement('style'),
    rxEsc = /([.*+?^${}()|\[\]\/\\])/g,
    idRx = /\bsf-dump-\d+-ref[012]\w+\b/,
    keyHint = 0 <= navigator.platform.toUpperCase().indexOf('MAC') ? 'Cmd' : 'Ctrl',
    addEventListener = function (e, n, cb) {
        e.addEventListener(n, cb, false);
    };

(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);

if (!doc.addEventListener) {
    addEventListener = function (element, eventName, callback) {
        element.attachEvent('on' + eventName, function (e) {
            e.preventDefault = function () {e.returnValue = false;};
            e.target = e.srcElement;
            callback(e);
        });
    };
}

function toggle(a, recursive) {
    var s = a.nextSibling || {}, oldClass = s.className, arrow, newClass;

    if (/\bsf-dump-compact\b/.test(oldClass)) {
        arrow = '▼';
        newClass = 'sf-dump-expanded';
    } else if (/\bsf-dump-expanded\b/.test(oldClass)) {
        arrow = '▶';
        newClass = 'sf-dump-compact';
    } else {
        return false;
    }

    if (doc.createEvent && s.dispatchEvent) {
        var event = doc.createEvent('Event');
        event.initEvent('sf-dump-expanded' === newClass ? 'sfbeforedumpexpand' : 'sfbeforedumpcollapse', true, false);

        s.dispatchEvent(event);
    }

    a.lastChild.innerHTML = arrow;
    s.className = s.className.replace(/\bsf-dump-(compact|expanded)\b/, newClass);

    if (recursive) {
        try {
            a = s.querySelectorAll('.'+oldClass);
            for (s = 0; s < a.length; ++s) {
                if (-1 == a[s].className.indexOf(newClass)) {
                    a[s].className = newClass;
                    a[s].previousSibling.lastChild.innerHTML = arrow;
                }
            }
        } catch (e) {
        }
    }

    return true;
};

function collapse(a, recursive) {
    var s = a.nextSibling || {}, oldClass = s.className;

    if (/\bsf-dump-expanded\b/.test(oldClass)) {
        toggle(a, recursive);

        return true;
    }

    return false;
};

function expand(a, recursive) {
    var s = a.nextSibling || {}, oldClass = s.className;

    if (/\bsf-dump-compact\b/.test(oldClass)) {
        toggle(a, recursive);

        return true;
    }

    return false;
};

function collapseAll(root) {
    var a = root.querySelector('a.sf-dump-toggle');
    if (a) {
        collapse(a, true);
        expand(a);

        return true;
    }

    return false;
}

function reveal(node) {
    var previous, parents = [];

    while ((node = node.parentNode || {}) && (previous = node.previousSibling) && 'A' === previous.tagName) {
        parents.push(previous);
    }

    if (0 !== parents.length) {
        parents.forEach(function (parent) {
            expand(parent);
        });

        return true;
    }

    return false;
}

function highlight(root, activeNode, nodes) {
    resetHighlightedNodes(root);

    Array.from(nodes||[]).forEach(function (node) {
        if (!/\bsf-dump-highlight\b/.test(node.className)) {
            node.className = node.className + ' sf-dump-highlight';
        }
    });

    if (!/\bsf-dump-highlight-active\b/.test(activeNode.className)) {
        activeNode.className = activeNode.className + ' sf-dump-highlight-active';
    }
}

function resetHighlightedNodes(root) {
    Array.from(root.querySelectorAll('.sf-dump-str, .sf-dump-key, .sf-dump-public, .sf-dump-protected, .sf-dump-private')).forEach(function (strNode) {
        strNode.className = strNode.className.replace(/\bsf-dump-highlight\b/, '');
        strNode.className = strNode.className.replace(/\bsf-dump-highlight-active\b/, '');
    });
}

return function (root, x) {
    root = doc.getElementById(root);

    var indentRx = new RegExp('^('+(root.getAttribute('data-indent-pad') || '  ').replace(rxEsc, '\\$1')+')+', 'm'),
        options = {$options},
        elt = root.getElementsByTagName('A'),
        len = elt.length,
        i = 0, s, h,
        t = [];

    while (i < len) t.push(elt[i++]);

    for (i in x) {
        options[i] = x[i];
    }

    function a(e, f) {
        addEventListener(root, e, function (e) {
            if ('A' == e.target.tagName) {
                f(e.target, e);
            } else if ('A' == e.target.parentNode.tagName) {
                f(e.target.parentNode, e);
            } else if (e.target.nextElementSibling && 'A' == e.target.nextElementSibling.tagName) {
                f(e.target.nextElementSibling, e, true);
            }
        });
    };
    function isCtrlKey(e) {
        return e.ctrlKey || e.metaKey;
    }
    function xpathString(str) {
        var parts = str.match(/[^'"]+|['"]/g).map(function (part) {
            if ("'" == part)  {
                return '"\'"';
            }
            if ('"' == part) {
                return "'\"'";
            }

            return "'" + part + "'";
        });

        return "concat(" + parts.join(",") + ", '')";
    }
    function xpathHasClass(className) {
        return "contains(concat(' ', normalize-space(@class), ' '), ' " + className +" ')";
    }
    addEventListener(root, 'mouseover', function (e) {
        if ('' != refStyle.innerHTML) {
            refStyle.innerHTML = '';
        }
    });
    a('mouseover', function (a, e, c) {
        if (c) {
            e.target.style.cursor = "pointer";
        } else if (a = idRx.exec(a.className)) {
            try {
                refStyle.innerHTML = 'pre.sf-dump .'+a[0]+'{background-color: #B729D9; color: #FFF !important; border-radius: 2px}';
            } catch (e) {
            }
        }
    });
    a('click', function (a, e, c) {
        if (/\bsf-dump-toggle\b/.test(a.className)) {
            e.preventDefault();
            if (!toggle(a, isCtrlKey(e))) {
                var r = doc.getElementById(a.getAttribute('href').substr(1)),
                    s = r.previousSibling,
                    f = r.parentNode,
                    t = a.parentNode;
                t.replaceChild(r, a);
                f.replaceChild(a, s);
                t.insertBefore(s, r);
                f = f.firstChild.nodeValue.match(indentRx);
                t = t.firstChild.nodeValue.match(indentRx);
                if (f && t && f[0] !== t[0]) {
                    r.innerHTML = r.innerHTML.replace(new RegExp('^'+f[0].replace(rxEsc, '\\$1'), 'mg'), t[0]);
                }
                if (/\bsf-dump-compact\b/.test(r.className)) {
                    toggle(s, isCtrlKey(e));
                }
            }

            if (c) {
            } else if (doc.getSelection) {
                try {
                    doc.getSelection().removeAllRanges();
                } catch (e) {
                    doc.getSelection().empty();
                }
            } else {
                doc.selection.empty();
            }
        } else if (/\bsf-dump-str-toggle\b/.test(a.className)) {
            e.preventDefault();
            e = a.parentNode.parentNode;
            e.className = e.className.replace(/\bsf-dump-str-(expand|collapse)\b/, a.parentNode.className);
        }
    });

    elt = root.getElementsByTagName('SAMP');
    len = elt.length;
    i = 0;

    while (i < len) t.push(elt[i++]);
    len = t.length;

    for (i = 0; i < len; ++i) {
        elt = t[i];
        if ('SAMP' == elt.tagName) {
            a = elt.previousSibling || {};
            if ('A' != a.tagName) {
                a = doc.createElement('A');
                a.className = 'sf-dump-ref';
                elt.parentNode.insertBefore(a, elt);
            } else {
                a.innerHTML += ' ';
            }
            a.title = (a.title ? a.title+'\n[' : '[')+keyHint+'+click] Expand all children';
            a.innerHTML += '<span>▼</span>';
            a.className += ' sf-dump-toggle';

            x = 1;
            if ('sf-dump' != elt.parentNode.className) {
                x += elt.parentNode.getAttribute('data-depth')/1;
            }
            elt.setAttribute('data-depth', x);
            var className = elt.className;
            elt.className = 'sf-dump-expanded';
            if (className ? 'sf-dump-expanded' !== className : (x > options.maxDepth)) {
                toggle(a);
            }
        } else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) {
            a = a.substr(1);
            elt.className += ' '+a;

            if (/[\[{]$/.test(elt.previousSibling.nodeValue)) {
                a = a != elt.nextSibling.id && doc.getElementById(a);
                try {
                    s = a.nextSibling;
                    elt.appendChild(a);
                    s.parentNode.insertBefore(a, s);
                    if (/^[@#]/.test(elt.innerHTML)) {
                        elt.innerHTML += ' <span>▶</span>';
                    } else {
                        elt.innerHTML = '<span>▶</span>';
                        elt.className = 'sf-dump-ref';
                    }
                    elt.className += ' sf-dump-toggle';
                } catch (e) {
                    if ('&' == elt.innerHTML.charAt(0)) {
                        elt.innerHTML = '…';
                        elt.className = 'sf-dump-ref';
                    }
                }
            }
        }
    }

    if (doc.evaluate && Array.from && root.children.length > 1) {
        root.setAttribute('tabindex', 0);

        SearchState = function () {
            this.nodes = [];
            this.idx = 0;
        };
        SearchState.prototype = {
            next: function () {
                if (this.isEmpty()) {
                    return this.current();
                }
                this.idx = this.idx < (this.nodes.length - 1) ? this.idx + 1 : 0;

                return this.current();
            },
            previous: function () {
                if (this.isEmpty()) {
                    return this.current();
                }
                this.idx = this.idx > 0 ? this.idx - 1 : (this.nodes.length - 1);

                return this.current();
            },
            isEmpty: function () {
                return 0 === this.count();
            },
            current: function () {
                if (this.isEmpty()) {
                    return null;
                }
                return this.nodes[this.idx];
            },
            reset: function () {
                this.nodes = [];
                this.idx = 0;
            },
            count: function () {
                return this.nodes.length;
            },
        };

        function showCurrent(state)
        {
            var currentNode = state.current();
            if (currentNode) {
                reveal(currentNode);
                highlight(root, currentNode, state.nodes);
            }
            counter.textContent = (state.isEmpty() ? 0 : state.idx + 1) + ' of ' + state.count();
        }

        var search = doc.createElement('div');
        search.className = 'sf-dump-search-wrapper sf-dump-search-hidden';
        search.innerHTML = '
            <input type="text" class="sf-dump-search-input">
            <span class="sf-dump-search-count">0 of 0<\/span>
            <button type="button" class="sf-dump-search-input-previous" tabindex="-1">
                <svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1683 1331l-166 165q-19 19-45 19t-45-19L896 965l-531 531q-19 19-45 19t-45-19l-166-165q-19-19-19-45.5t19-45.5l742-741q19-19 45-19t45 19l742 741q19 19 19 45.5t-19 45.5z"\/><\/svg>
            <\/button>
            <button type="button" class="sf-dump-search-input-next" tabindex="-1">
                <svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1683 808l-742 741q-19 19-45 19t-45-19L109 808q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z"\/><\/svg>
            <\/button>
        ';
        root.insertBefore(search, root.firstChild);

        var state = new SearchState();
        var searchInput = search.querySelector('.sf-dump-search-input');
        var counter = search.querySelector('.sf-dump-search-count');
        var searchInputTimer = 0;
        var previousSearchQuery = '';

        addEventListener(searchInput, 'keyup', function (e) {
            var searchQuery = e.target.value;
            /* Don't perform anything if the pressed key didn't change the query */
            if (searchQuery === previousSearchQuery) {
                return;
            }
            previousSearchQuery = searchQuery;
            clearTimeout(searchInputTimer);
            searchInputTimer = setTimeout(function () {
                state.reset();
                collapseAll(root);
                resetHighlightedNodes(root);
                if ('' === searchQuery) {
                    counter.textContent = '0 of 0';

                    return;
                }

                var classMatches = [
                    "sf-dump-str",
                    "sf-dump-key",
                    "sf-dump-public",
                    "sf-dump-protected",
                    "sf-dump-private",
                ].map(xpathHasClass).join(' or ');

                var xpathResult = doc.evaluate('.//span[' + classMatches + '][contains(translate(child::text(), ' + xpathString(searchQuery.toUpperCase()) + ', ' + xpathString(searchQuery.toLowerCase()) + '), ' + xpathString(searchQuery.toLowerCase()) + ')]', root, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);

                while (node = xpathResult.iterateNext()) state.nodes.push(node);

                showCurrent(state);
            }, 400);
        });

        Array.from(search.querySelectorAll('.sf-dump-search-input-next, .sf-dump-search-input-previous')).forEach(function (btn) {
            addEventListener(btn, 'click', function (e) {
                e.preventDefault();
                -1 !== e.target.className.indexOf('next') ? state.next() : state.previous();
                searchInput.focus();
                collapseAll(root);
                showCurrent(state);
            })
        });

        addEventListener(root, 'keydown', function (e) {
            var isSearchActive = !/\bsf-dump-search-hidden\b/.test(search.className);
            if ((114 === e.keyCode && !isSearchActive) || (isCtrlKey(e) && 70 === e.keyCode)) {
                /* F3 or CMD/CTRL + F */
                e.preventDefault();
                search.className = search.className.replace(/\bsf-dump-search-hidden\b/, '');
                searchInput.focus();
            } else if (isSearchActive) {
                if (27 === e.keyCode) {
                    /* ESC key */
                    search.className += ' sf-dump-search-hidden';
                    e.preventDefault();
                    resetHighlightedNodes(root);
                    searchInput.value = '';
                } else if (
                    (isCtrlKey(e) && 71 === e.keyCode) /* CMD/CTRL + G */
                    || 13 === e.keyCode /* Enter */
                    || 114 === e.keyCode /* F3 */
                ) {
                    e.preventDefault();
                    e.shiftKey ? state.previous() : state.next();
                    collapseAll(root);
                    showCurrent(state);
                }
            }
        });
    }

    if (0 >= options.maxStringLength) {
        return;
    }
    try {
        elt = root.querySelectorAll('.sf-dump-str');
        len = elt.length;
        i = 0;
        t = [];

        while (i < len) t.push(elt[i++]);
        len = t.length;

        for (i = 0; i < len; ++i) {
            elt = t[i];
            s = elt.innerText || elt.textContent;
            x = s.length - options.maxStringLength;
            if (0 < x) {
                h = elt.innerHTML;
                elt[elt.innerText ? 'innerText' : 'textContent'] = s.substring(0, options.maxStringLength);
                elt.className += ' sf-dump-str-collapse';
                elt.innerHTML = '<span class=sf-dump-str-collapse>'+h+'<a class="sf-dump-ref sf-dump-str-toggle" title="Collapse"> ◀</a></span>'+
                    '<span class=sf-dump-str-expand>'+elt.innerHTML+'<a class="sf-dump-ref sf-dump-str-toggle" title="'+x+' remaining characters"> ▶</a></span>';
            }
        }
    } catch (e) {
    }
};

})(document);
</script><style>
pre.sf-dump {
    display: block;
    white-space: pre;
    padding: 5px;
}
pre.sf-dump:after {
   content: "";
   visibility: hidden;
   display: block;
   height: 0;
   clear: both;
}
pre.sf-dump span {
    display: inline;
}
pre.sf-dump .sf-dump-compact {
    display: none;
}
pre.sf-dump abbr {
    text-decoration: none;
    border: none;
    cursor: help;
}
pre.sf-dump a {
    text-decoration: none;
    cursor: pointer;
    border: 0;
    outline: none;
    color: inherit;
}
pre.sf-dump .sf-dump-ellipsis {
    display: inline-block;
    overflow: visible;
    text-overflow: ellipsis;
    max-width: 5em;
    white-space: nowrap;
    overflow: hidden;
    vertical-align: top;
}
pre.sf-dump .sf-dump-ellipsis+.sf-dump-ellipsis {
    max-width: none;
}
pre.sf-dump code {
    display:inline;
    padding:0;
    background:none;
}
.sf-dump-str-collapse .sf-dump-str-collapse {
    display: none;
}
.sf-dump-str-expand .sf-dump-str-expand {
    display: none;
}
.sf-dump-public.sf-dump-highlight,
.sf-dump-protected.sf-dump-highlight,
.sf-dump-private.sf-dump-highlight,
.sf-dump-str.sf-dump-highlight,
.sf-dump-key.sf-dump-highlight {
    background: rgba(111, 172, 204, 0.3);
    border: 1px solid #7DA0B1;
    border-radius: 3px;
}
.sf-dump-public.sf-dump-highlight-active,
.sf-dump-protected.sf-dump-highlight-active,
.sf-dump-private.sf-dump-highlight-active,
.sf-dump-str.sf-dump-highlight-active,
.sf-dump-key.sf-dump-highlight-active {
    background: rgba(253, 175, 0, 0.4);
    border: 1px solid #ffa500;
    border-radius: 3px;
}
pre.sf-dump .sf-dump-search-hidden {
    display: none;
}
pre.sf-dump .sf-dump-search-wrapper {
    float: right;
    font-size: 0;
    white-space: nowrap;
    max-width: 100%;
    text-align: right;
}
pre.sf-dump .sf-dump-search-wrapper > * {
    vertical-align: top;
    box-sizing: border-box;
    height: 21px;
    font-weight: normal;
    border-radius: 0;
    background: #FFF;
    color: #757575;
    border: 1px solid #BBB;
}
pre.sf-dump .sf-dump-search-wrapper > input.sf-dump-search-input {
    padding: 3px;
    height: 21px;
    font-size: 12px;
    border-right: none;
    width: 140px;
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
    color: #000;
}
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next,
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-previous {
    background: #F2F2F2;
    outline: none;
    border-left: none;
    font-size: 0;
    line-height: 0;
}
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next {
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
}
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next > svg,
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-previous > svg {
    pointer-events: none;
    width: 12px;
    height: 12px;
}
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-count {
    display: inline-block;
    padding: 0 5px;
    margin: 0;
    border-left: none;
    line-height: 21px;
    font-size: 12px;
}
EOHTML
);

foreach ($this->styles as $class => $style) {
$line .= 'pre.sf-dump'.('default' === $class ? ', pre.sf-dump' : '').' .sf-dump-'.$class.'{'.$style.'}';
}

return $this->dumpHeader = preg_replace('/\s+/', ' ', $line).'</style>'.$this->dumpHeader;
}




public function enterHash(Cursor $cursor, $type, $class, $hasChild)
{
parent::enterHash($cursor, $type, $class, false);

if ($cursor->skipChildren) {
$cursor->skipChildren = false;
$eol = ' class=sf-dump-compact>';
} elseif ($this->expandNextHash) {
$this->expandNextHash = false;
$eol = ' class=sf-dump-expanded>';
} else {
$eol = '>';
}

if ($hasChild) {
$this->line .= '<samp';
if ($cursor->refIndex) {
$r = Cursor::HASH_OBJECT !== $type ? 1 - (Cursor::HASH_RESOURCE !== $type) : 2;
$r .= $r && 0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->refIndex;

$this->line .= sprintf(' id=%s-ref%s', $this->dumpId, $r);
}
$this->line .= $eol;
$this->dumpLine($cursor->depth);
}
}




public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
{
$this->dumpEllipsis($cursor, $hasChild, $cut);
if ($hasChild) {
$this->line .= '</samp>';
}
parent::leaveHash($cursor, $type, $class, $hasChild, 0);
}




protected function style($style, $value, $attr = [])
{
if ('' === $value) {
return '';
}

$v = esc($value);

if ('ref' === $style) {
if (empty($attr['count'])) {
return sprintf('<a class=sf-dump-ref>%s</a>', $v);
}
$r = ('#' !== $v[0] ? 1 - ('@' !== $v[0]) : 2).substr($value, 1);

return sprintf('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a>', $this->dumpId, $r, 1 + $attr['count'], $v);
}

if ('const' === $style && isset($attr['value'])) {
$style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
} elseif ('public' === $style) {
$style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property');
} elseif ('str' === $style && 1 < $attr['length']) {
$style .= sprintf(' title="%d%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
} elseif ('note' === $style && false !== $c = strrpos($v, '\\')) {
return sprintf('<abbr title="%s" class=sf-dump-%s>%s</abbr>', $v, $style, substr($v, $c + 1));
} elseif ('protected' === $style) {
$style .= ' title="Protected property"';
} elseif ('meta' === $style && isset($attr['title'])) {
$style .= sprintf(' title="%s"', esc($this->utf8Encode($attr['title'])));
} elseif ('private' === $style) {
$style .= sprintf(' title="Private property defined in class:&#10;`%s`"', esc($this->utf8Encode($attr['class'])));
}
$map = static::$controlCharsMap;

if (isset($attr['ellipsis'])) {
$class = 'sf-dump-ellipsis';
if (isset($attr['ellipsis-type'])) {
$class = sprintf('"%s sf-dump-ellipsis-%s"', $class, $attr['ellipsis-type']);
}
$label = esc(substr($value, -$attr['ellipsis']));
$style = str_replace(' title="', " title=\"$v\n", $style);
$v = sprintf('<span class=%s>%s</span>', $class, substr($v, 0, -\strlen($label)));

if (!empty($attr['ellipsis-tail'])) {
$tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail'])));
$v .= sprintf('<span class=sf-dump-ellipsis>%s</span>%s', substr($label, 0, $tail), substr($label, $tail));
} else {
$v .= $label;
}
}

$v = "<span class=sf-dump-{$style}>".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) {
$s = '<span class=sf-dump-default>';
$c = $c[$i = 0];
do {
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));

return $s.'</span>';
}, $v).'</span>';

if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
$attr['href'] = $href;
}
if (isset($attr['href'])) {
$target = isset($attr['file']) ? '' : ' target="_blank"';
$v = sprintf('<a href="%s"%s rel="noopener noreferrer">%s</a>', esc($this->utf8Encode($attr['href'])), $target, $v);
}
if (isset($attr['lang'])) {
$v = sprintf('<code class="%s">%s</code>', esc($attr['lang']), $v);
}

return $v;
}




protected function dumpLine($depth, $endOfValue = false)
{
if (-1 === $this->lastDepth) {
$this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line;
}
if ($this->headerIsDumped !== (null !== $this->outputStream ? $this->outputStream : $this->lineDumper)) {
$this->line = $this->getDumpHeader().$this->line;
}

if (-1 === $depth) {
$args = ['"'.$this->dumpId.'"'];
if ($this->extraDisplayOptions) {
$args[] = json_encode($this->extraDisplayOptions, JSON_FORCE_OBJECT);
}

 $this->line .= sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args));
}
$this->lastDepth = $depth;

$this->line = mb_convert_encoding($this->line, 'HTML-ENTITIES', 'UTF-8');

if (-1 === $depth) {
AbstractDumper::dumpLine(0);
}
AbstractDumper::dumpLine($depth);
}

private function getSourceLink($file, $line)
{
$options = $this->extraDisplayOptions + $this->displayOptions;

if ($fmt = $options['fileLinkFormat']) {
return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : $fmt->format($file, $line);
}

return false;
}
}

function esc($str)
{
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
}
<?php










namespace Symfony\Component\VarDumper\Dumper;

use Symfony\Component\VarDumper\Cloner\Data;
use Symfony\Component\VarDumper\Cloner\DumperInterface;






abstract class AbstractDumper implements DataDumperInterface, DumperInterface
{
const DUMP_LIGHT_ARRAY = 1;
const DUMP_STRING_LENGTH = 2;
const DUMP_COMMA_SEPARATOR = 4;
const DUMP_TRAILING_COMMA = 8;

public static $defaultOutput = 'php://output';

protected $line = '';
protected $lineDumper;
protected $outputStream;
protected $decimalPoint; 
 protected $indentPad = '  ';
protected $flags;

private $charset = '';






public function __construct($output = null, $charset = null, $flags = 0)
{
$this->flags = (int) $flags;
$this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8');
$this->decimalPoint = localeconv();
$this->decimalPoint = $this->decimalPoint['decimal_point'];
$this->setOutput($output ?: static::$defaultOutput);
if (!$output && \is_string(static::$defaultOutput)) {
static::$defaultOutput = $this->outputStream;
}
}








public function setOutput($output)
{
$prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;

if (\is_callable($output)) {
$this->outputStream = null;
$this->lineDumper = $output;
} else {
if (\is_string($output)) {
$output = fopen($output, 'wb');
}
$this->outputStream = $output;
$this->lineDumper = [$this, 'echoLine'];
}

return $prev;
}








public function setCharset($charset)
{
$prev = $this->charset;

$charset = strtoupper($charset);
$charset = null === $charset || 'UTF-8' === $charset || 'UTF8' === $charset ? 'CP1252' : $charset;

$this->charset = $charset;

return $prev;
}








public function setIndentPad($pad)
{
$prev = $this->indentPad;
$this->indentPad = $pad;

return $prev;
}









public function dump(Data $data, $output = null)
{
$this->decimalPoint = localeconv();
$this->decimalPoint = $this->decimalPoint['decimal_point'];

if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(LC_NUMERIC, 0) : null) {
setlocale(LC_NUMERIC, 'C');
}

if ($returnDump = true === $output) {
$output = fopen('php://memory', 'r+b');
}
if ($output) {
$prevOutput = $this->setOutput($output);
}
try {
$data->dump($this);
$this->dumpLine(-1);

if ($returnDump) {
$result = stream_get_contents($output, -1, 0);
fclose($output);

return $result;
}
} finally {
if ($output) {
$this->setOutput($prevOutput);
}
if ($locale) {
setlocale(LC_NUMERIC, $locale);
}
}

return null;
}







protected function dumpLine($depth)
{
\call_user_func($this->lineDumper, $this->line, $depth, $this->indentPad);
$this->line = '';
}








protected function echoLine($line, $depth, $indentPad)
{
if (-1 !== $depth) {
fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n");
}
}








protected function utf8Encode($s)
{
if (null === $s || preg_match('//u', $s)) {
return $s;
}

if (!\function_exists('iconv')) {
throw new \RuntimeException('Unable to convert a non-UTF-8 string to UTF-8: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.');
}

if (false !== $c = @iconv($this->charset, 'UTF-8', $s)) {
return $c;
}
if ('CP1252' !== $this->charset && false !== $c = @iconv('CP1252', 'UTF-8', $s)) {
return $c;
}

return iconv('CP850', 'UTF-8', $s);
}
}
<?php










namespace Symfony\Component\VarDumper\Dumper;

use Symfony\Component\VarDumper\Cloner\Cursor;
use Symfony\Component\VarDumper\Cloner\Stub;






class CliDumper extends AbstractDumper
{
public static $defaultColors;
public static $defaultOutput = 'php://stdout';

protected $colors;
protected $maxStringWidth = 0;
protected $styles = [

 'default' => '0;38;5;208',
'num' => '1;38;5;38',
'const' => '1;38;5;208',
'str' => '1;38;5;113',
'note' => '38;5;38',
'ref' => '38;5;247',
'public' => '',
'protected' => '',
'private' => '',
'meta' => '38;5;170',
'key' => '38;5;113',
'index' => '38;5;38',
];

protected static $controlCharsRx = '/[\x00-\x1F\x7F]+/';
protected static $controlCharsMap = [
"\t" => '\t',
"\n" => '\n',
"\v" => '\v',
"\f" => '\f',
"\r" => '\r',
"\033" => '\e',
];

protected $collapseNextHash = false;
protected $expandNextHash = false;




public function __construct($output = null, $charset = null, $flags = 0)
{
parent::__construct($output, $charset, $flags);

if ('\\' === \DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) {

 $this->setStyles([
'default' => '31',
'num' => '1;34',
'const' => '1;31',
'str' => '1;32',
'note' => '34',
'ref' => '1;30',
'meta' => '35',
'key' => '32',
'index' => '34',
]);
}
}






public function setColors($colors)
{
$this->colors = (bool) $colors;
}






public function setMaxStringWidth($maxStringWidth)
{
$this->maxStringWidth = (int) $maxStringWidth;
}






public function setStyles(array $styles)
{
$this->styles = $styles + $this->styles;
}




public function dumpScalar(Cursor $cursor, $type, $value)
{
$this->dumpKey($cursor);

$style = 'const';
$attr = $cursor->attr;

switch ($type) {
case 'default':
$style = 'default';
break;

case 'integer':
$style = 'num';
break;

case 'double':
$style = 'num';

switch (true) {
case INF === $value: $value = 'INF'; break;
case -INF === $value: $value = '-INF'; break;
case is_nan($value): $value = 'NAN'; break;
default:
$value = (string) $value;
if (false === strpos($value, $this->decimalPoint)) {
$value .= $this->decimalPoint.'0';
}
break;
}
break;

case 'NULL':
$value = 'null';
break;

case 'boolean':
$value = $value ? 'true' : 'false';
break;

default:
$attr += ['value' => $this->utf8Encode($value)];
$value = $this->utf8Encode($type);
break;
}

$this->line .= $this->style($style, $value, $attr);

$this->endValue($cursor);
}




public function dumpString(Cursor $cursor, $str, $bin, $cut)
{
$this->dumpKey($cursor);
$attr = $cursor->attr;

if ($bin) {
$str = $this->utf8Encode($str);
}
if ('' === $str) {
$this->line .= '""';
$this->endValue($cursor);
} else {
$attr += [
'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0,
'binary' => $bin,
];
$str = explode("\n", $str);
if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) {
unset($str[1]);
$str[0] .= "\n";
}
$m = \count($str) - 1;
$i = $lineCut = 0;

if (self::DUMP_STRING_LENGTH & $this->flags) {
$this->line .= '('.$attr['length'].') ';
}
if ($bin) {
$this->line .= 'b';
}

if ($m) {
$this->line .= '"""';
$this->dumpLine($cursor->depth);
} else {
$this->line .= '"';
}

foreach ($str as $str) {
if ($i < $m) {
$str .= "\n";
}
if (0 < $this->maxStringWidth && $this->maxStringWidth < $len = mb_strlen($str, 'UTF-8')) {
$str = mb_substr($str, 0, $this->maxStringWidth, 'UTF-8');
$lineCut = $len - $this->maxStringWidth;
}
if ($m && 0 < $cursor->depth) {
$this->line .= $this->indentPad;
}
if ('' !== $str) {
$this->line .= $this->style('str', $str, $attr);
}
if ($i++ == $m) {
if ($m) {
if ('' !== $str) {
$this->dumpLine($cursor->depth);
if (0 < $cursor->depth) {
$this->line .= $this->indentPad;
}
}
$this->line .= '"""';
} else {
$this->line .= '"';
}
if ($cut < 0) {
$this->line .= '…';
$lineCut = 0;
} elseif ($cut) {
$lineCut += $cut;
}
}
if ($lineCut) {
$this->line .= '…'.$lineCut;
$lineCut = 0;
}

if ($i > $m) {
$this->endValue($cursor);
} else {
$this->dumpLine($cursor->depth);
}
}
}
}




public function enterHash(Cursor $cursor, $type, $class, $hasChild)
{
$this->dumpKey($cursor);

if ($this->collapseNextHash) {
$cursor->skipChildren = true;
$this->collapseNextHash = $hasChild = false;
}

$class = $this->utf8Encode($class);
if (Cursor::HASH_OBJECT === $type) {
$prefix = $class && 'stdClass' !== $class ? $this->style('note', $class).' {' : '{';
} elseif (Cursor::HASH_RESOURCE === $type) {
$prefix = $this->style('note', $class.' resource').($hasChild ? ' {' : ' ');
} else {
$prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class).' [' : '[';
}

if ($cursor->softRefCount || 0 < $cursor->softRefHandle) {
$prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#').(0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), ['count' => $cursor->softRefCount]);
} elseif ($cursor->hardRefTo && !$cursor->refIndex && $class) {
$prefix .= $this->style('ref', '&'.$cursor->hardRefTo, ['count' => $cursor->hardRefCount]);
} elseif (!$hasChild && Cursor::HASH_RESOURCE === $type) {
$prefix = substr($prefix, 0, -1);
}

$this->line .= $prefix;

if ($hasChild) {
$this->dumpLine($cursor->depth);
}
}




public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
{
$this->dumpEllipsis($cursor, $hasChild, $cut);
$this->line .= Cursor::HASH_OBJECT === $type ? '}' : (Cursor::HASH_RESOURCE !== $type ? ']' : ($hasChild ? '}' : ''));
$this->endValue($cursor);
}








protected function dumpEllipsis(Cursor $cursor, $hasChild, $cut)
{
if ($cut) {
$this->line .= ' …';
if (0 < $cut) {
$this->line .= $cut;
}
if ($hasChild) {
$this->dumpLine($cursor->depth + 1);
}
}
}






protected function dumpKey(Cursor $cursor)
{
if (null !== $key = $cursor->hashKey) {
if ($cursor->hashKeyIsBinary) {
$key = $this->utf8Encode($key);
}
$attr = ['binary' => $cursor->hashKeyIsBinary];
$bin = $cursor->hashKeyIsBinary ? 'b' : '';
$style = 'key';
switch ($cursor->hashType) {
default:
case Cursor::HASH_INDEXED:
if (self::DUMP_LIGHT_ARRAY & $this->flags) {
break;
}
$style = 'index';

 case Cursor::HASH_ASSOC:
if (\is_int($key)) {
$this->line .= $this->style($style, $key).' => ';
} else {
$this->line .= $bin.'"'.$this->style($style, $key).'" => ';
}
break;

case Cursor::HASH_RESOURCE:
$key = "\0~\0".$key;

 case Cursor::HASH_OBJECT:
if (!isset($key[0]) || "\0" !== $key[0]) {
$this->line .= '+'.$bin.$this->style('public', $key).': ';
} elseif (0 < strpos($key, "\0", 1)) {
$key = explode("\0", substr($key, 1), 2);

switch ($key[0][0]) {
case '+': 
 $attr['dynamic'] = true;
$this->line .= '+'.$bin.'"'.$this->style('public', $key[1], $attr).'": ';
break 2;
case '~':
$style = 'meta';
if (isset($key[0][1])) {
parse_str(substr($key[0], 1), $attr);
$attr += ['binary' => $cursor->hashKeyIsBinary];
}
break;
case '*':
$style = 'protected';
$bin = '#'.$bin;
break;
default:
$attr['class'] = $key[0];
$style = 'private';
$bin = '-'.$bin;
break;
}

if (isset($attr['collapse'])) {
if ($attr['collapse']) {
$this->collapseNextHash = true;
} else {
$this->expandNextHash = true;
}
}

$this->line .= $bin.$this->style($style, $key[1], $attr).(isset($attr['separator']) ? $attr['separator'] : ': ');
} else {

 $this->line .= '-'.$bin.'"'.$this->style('private', $key, ['class' => '']).'": ';
}
break;
}

if ($cursor->hardRefTo) {
$this->line .= $this->style('ref', '&'.($cursor->hardRefCount ? $cursor->hardRefTo : ''), ['count' => $cursor->hardRefCount]).' ';
}
}
}










protected function style($style, $value, $attr = [])
{
if (null === $this->colors) {
$this->colors = $this->supportsColors();
}

if (isset($attr['ellipsis'], $attr['ellipsis-type'])) {
$prefix = substr($value, 0, -$attr['ellipsis']);
if ('cli' === \PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === \DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) {
$prefix = '.'.substr($prefix, \strlen($_SERVER[$pwd]));
}
if (!empty($attr['ellipsis-tail'])) {
$prefix .= substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']);
$value = substr($value, -$attr['ellipsis'] + $attr['ellipsis-tail']);
} else {
$value = substr($value, -$attr['ellipsis']);
}

return $this->style('default', $prefix).$this->style($style, $value);
}

$style = $this->styles[$style];

$map = static::$controlCharsMap;
$startCchr = $this->colors ? "\033[m\033[{$this->styles['default']}m" : '';
$endCchr = $this->colors ? "\033[m\033[{$style}m" : '';
$value = preg_replace_callback(static::$controlCharsRx, function ($c) use ($map, $startCchr, $endCchr) {
$s = $startCchr;
$c = $c[$i = 0];
do {
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i]));
} while (isset($c[++$i]));

return $s.$endCchr;
}, $value, -1, $cchrCount);

if ($this->colors) {
if ($cchrCount && "\033" === $value[0]) {
$value = substr($value, \strlen($startCchr));
} else {
$value = "\033[{$style}m".$value;
}
if ($cchrCount && $endCchr === substr($value, -\strlen($endCchr))) {
$value = substr($value, 0, -\strlen($endCchr));
} else {
$value .= "\033[{$this->styles['default']}m";
}
}

return $value;
}




protected function supportsColors()
{
if ($this->outputStream !== static::$defaultOutput) {
return $this->hasColorSupport($this->outputStream);
}
if (null !== static::$defaultColors) {
return static::$defaultColors;
}
if (isset($_SERVER['argv'][1])) {
$colors = $_SERVER['argv'];
$i = \count($colors);
while (--$i > 0) {
if (isset($colors[$i][5])) {
switch ($colors[$i]) {
case '--ansi':
case '--color':
case '--color=yes':
case '--color=force':
case '--color=always':
return static::$defaultColors = true;

case '--no-ansi':
case '--color=no':
case '--color=none':
case '--color=never':
return static::$defaultColors = false;
}
}
}
}

$h = stream_get_meta_data($this->outputStream) + ['wrapper_type' => null];
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;

return static::$defaultColors = $this->hasColorSupport($h);
}




protected function dumpLine($depth, $endOfValue = false)
{
if ($this->colors) {
$this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line);
}
parent::dumpLine($depth);
}

protected function endValue(Cursor $cursor)
{
if (Stub::ARRAY_INDEXED === $cursor->hashType || Stub::ARRAY_ASSOC === $cursor->hashType) {
if (self::DUMP_TRAILING_COMMA & $this->flags && 0 < $cursor->depth) {
$this->line .= ',';
} elseif (self::DUMP_COMMA_SEPARATOR & $this->flags && 1 < $cursor->hashLength - $cursor->hashIndex) {
$this->line .= ',';
}
}

$this->dumpLine($cursor->depth, true);
}











private function hasColorSupport($stream)
{
if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
return false;
}

if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}

if (\DIRECTORY_SEPARATOR === '\\') {
return (\function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
}

if (\function_exists('stream_isatty')) {
return @stream_isatty($stream);
}

if (\function_exists('posix_isatty')) {
return @posix_isatty($stream);
}

$stat = @fstat($stream);

 return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
}










private function isWindowsTrueColor()
{
$result = 183 <= getenv('ANSICON_VER')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM')
|| 'Hyper' === getenv('TERM_PROGRAM');

if (!$result && \PHP_VERSION_ID >= 70200) {
$version = sprintf(
'%s.%s.%s',
PHP_WINDOWS_VERSION_MAJOR,
PHP_WINDOWS_VERSION_MINOR,
PHP_WINDOWS_VERSION_BUILD
);
$result = $version >= '10.0.15063';
}

return $result;
}
}
<?php










namespace Symfony\Component\Debug;

use Psr\Log\LogLevel;
use Psr\Log\LoggerInterface;
use Symfony\Component\Debug\Exception\ContextErrorException;
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\Debug\Exception\OutOfMemoryException;
use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;

/**
 * A generic ErrorHandler for the PHP engine.
 *
 * Provides five bit fields that control how errors are handled:
 * - thrownErrors: errors thrown as \ErrorException
 * - loggedErrors: logged errors, when not @-silenced
 * - scopedErrors: errors thrown or logged with their local context
 * - tracedErrors: errors logged with their stack trace, only once for repeated errors
 * - screamedErrors: never @-silenced errors
 *
 * Each error level can be logged by a dedicated PSR-3 logger object.
 * Screaming only applies to logging.
 * Throwing takes precedence over logging.
 * Uncaught exceptions are logged as E_ERROR.
 * E_DEPRECATED and E_USER_DEPRECATED levels never throw.
 * E_RECOVERABLE_ERROR and E_USER_ERROR levels always throw.
 * Non catchable errors that can be detected at shutdown time are logged when the scream bit field allows so.
 * As errors have a performance cost, repeated errors are all logged, so that the developer
 * can see them and weight them as more important to fix than others of the same level.
 *
 * @author Nicolas Grekas <[email protected]>
 */
class ErrorHandler
{



const TYPE_DEPRECATION = -100;

private $levels = array(
E_DEPRECATED => 'Deprecated',
E_USER_DEPRECATED => 'User Deprecated',
E_NOTICE => 'Notice',
E_USER_NOTICE => 'User Notice',
E_STRICT => 'Runtime Notice',
E_WARNING => 'Warning',
E_USER_WARNING => 'User Warning',
E_COMPILE_WARNING => 'Compile Warning',
E_CORE_WARNING => 'Core Warning',
E_USER_ERROR => 'User Error',
E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
E_COMPILE_ERROR => 'Compile Error',
E_PARSE => 'Parse Error',
E_ERROR => 'Error',
E_CORE_ERROR => 'Core Error',
);

private $loggers = array(
E_DEPRECATED => array(null, LogLevel::INFO),
E_USER_DEPRECATED => array(null, LogLevel::INFO),
E_NOTICE => array(null, LogLevel::WARNING),
E_USER_NOTICE => array(null, LogLevel::WARNING),
E_STRICT => array(null, LogLevel::WARNING),
E_WARNING => array(null, LogLevel::WARNING),
E_USER_WARNING => array(null, LogLevel::WARNING),
E_COMPILE_WARNING => array(null, LogLevel::WARNING),
E_CORE_WARNING => array(null, LogLevel::WARNING),
E_USER_ERROR => array(null, LogLevel::CRITICAL),
E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
E_PARSE => array(null, LogLevel::CRITICAL),
E_ERROR => array(null, LogLevel::CRITICAL),
E_CORE_ERROR => array(null, LogLevel::CRITICAL),
);

private $thrownErrors = 0x1FFF; 
 private $scopedErrors = 0x1FFF; 
 private $tracedErrors = 0x77FB; 
 private $screamedErrors = 0x55; 
 private $loggedErrors = 0;

private $loggedTraces = array();
private $isRecursive = 0;
private $isRoot = false;
private $exceptionHandler;
private $bootstrappingLogger;

private static $reservedMemory;
private static $stackedErrors = array();
private static $stackedErrorLevels = array();
private static $toStringException = null;






private $displayErrors = 0x1FFF;









public static function register($handler = null, $replace = true)
{
if (null === self::$reservedMemory) {
self::$reservedMemory = str_repeat('x', 10240);
register_shutdown_function(__CLASS__.'::handleFatalError');
}

$levels = -1;

if ($handlerIsNew = !$handler instanceof self) {

 if (null !== $handler) {
$levels = $replace ? $handler : 0;
$replace = true;
}
$handler = new static();
}

if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
restore_error_handler();

 set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
$handler->isRoot = true;
}

if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) {
$handler = $prev[0];
$replace = false;
}
if ($replace || !$prev) {
$handler->setExceptionHandler(set_exception_handler(array($handler, 'handleException')));
} else {
restore_error_handler();
}

$handler->throwAt($levels & $handler->thrownErrors, true);

return $handler;
}

public function __construct(BufferingLogger $bootstrappingLogger = null)
{
if ($bootstrappingLogger) {
$this->bootstrappingLogger = $bootstrappingLogger;
$this->setDefaultLogger($bootstrappingLogger);
}
}








public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
{
$loggers = array();

if (is_array($levels)) {
foreach ($levels as $type => $logLevel) {
if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
$loggers[$type] = array($logger, $logLevel);
}
}
} else {
if (null === $levels) {
$levels = E_ALL | E_STRICT;
}
foreach ($this->loggers as $type => $log) {
if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
$log[0] = $logger;
$loggers[$type] = $log;
}
}
}

$this->setLoggers($loggers);
}










public function setLoggers(array $loggers)
{
$prevLogged = $this->loggedErrors;
$prev = $this->loggers;
$flush = array();

foreach ($loggers as $type => $log) {
if (!isset($prev[$type])) {
throw new \InvalidArgumentException('Unknown error type: '.$type);
}
if (!is_array($log)) {
$log = array($log);
} elseif (!array_key_exists(0, $log)) {
throw new \InvalidArgumentException('No logger provided');
}
if (null === $log[0]) {
$this->loggedErrors &= ~$type;
} elseif ($log[0] instanceof LoggerInterface) {
$this->loggedErrors |= $type;
} else {
throw new \InvalidArgumentException('Invalid logger provided');
}
$this->loggers[$type] = $log + $prev[$type];

if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
$flush[$type] = $type;
}
}
$this->reRegister($prevLogged | $this->thrownErrors);

if ($flush) {
foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
$type = $log[2]['type'];
if (!isset($flush[$type])) {
$this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
} elseif ($this->loggers[$type][0]) {
$this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
}
}
}

return $prev;
}










public function setExceptionHandler($handler)
{
if (null !== $handler && !is_callable($handler)) {
throw new \LogicException('The exception handler must be a valid PHP callable.');
}
$prev = $this->exceptionHandler;
$this->exceptionHandler = $handler;

return $prev;
}









public function throwAt($levels, $replace = false)
{
$prev = $this->thrownErrors;
$this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
if (!$replace) {
$this->thrownErrors |= $prev;
}
$this->reRegister($prev | $this->loggedErrors);


 $this->displayErrors = $this->thrownErrors;

return $prev;
}









public function scopeAt($levels, $replace = false)
{
$prev = $this->scopedErrors;
$this->scopedErrors = (int) $levels;
if (!$replace) {
$this->scopedErrors |= $prev;
}

return $prev;
}









public function traceAt($levels, $replace = false)
{
$prev = $this->tracedErrors;
$this->tracedErrors = (int) $levels;
if (!$replace) {
$this->tracedErrors |= $prev;
}

return $prev;
}

/**
     * Sets the error levels where the @-operator is ignored.
     *
     * @param int  $levels  A bit field of E_* constants for screamed errors
     * @param bool $replace Replace or amend the previous value
     *
     * @return int The previous value
     */
public function screamAt($levels, $replace = false)
{
$prev = $this->screamedErrors;
$this->screamedErrors = (int) $levels;
if (!$replace) {
$this->screamedErrors |= $prev;
}

return $prev;
}




private function reRegister($prev)
{
if ($prev !== $this->thrownErrors | $this->loggedErrors) {
$handler = set_error_handler('var_dump');
$handler = is_array($handler) ? $handler[0] : null;
restore_error_handler();
if ($handler === $this) {
restore_error_handler();
if ($this->isRoot) {
set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
} else {
set_error_handler(array($this, 'handleError'));
}
}
}
}

















public function handleError($type, $message, $file, $line, array $context, array $backtrace = null)
{
$level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
$log = $this->loggedErrors & $type;
$throw = $this->thrownErrors & $type & $level;
$type &= $level | $this->screamedErrors;

if (!$type || (!$log && !$throw)) {
return $type && $log;
}

if (isset($context['GLOBALS']) && ($this->scopedErrors & $type)) {
$e = $context; 
 unset($e['GLOBALS'], $context); 
 $context = $e;
}

if (null !== $backtrace && $type & E_ERROR) {

 
 
 $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));

return true;
}

if ($throw) {
if (null !== self::$toStringException) {
$throw = self::$toStringException;
self::$toStringException = null;
} elseif (($this->scopedErrors & $type) && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {

 $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
} else {
$throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
}

if (PHP_VERSION_ID <= 50407 && (PHP_VERSION_ID >= 50400 || PHP_VERSION_ID <= 50317)) {

 
 

$throw->errorHandlerCanary = new ErrorHandlerCanary();
}

if (E_USER_ERROR & $type) {
$backtrace = $backtrace ?: $throw->getTrace();

for ($i = 1; isset($backtrace[$i]); ++$i) {
if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
&& '__toString' === $backtrace[$i]['function']
&& '->' === $backtrace[$i]['type']
&& !isset($backtrace[$i - 1]['class'])
&& ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
) {

 
 
 
 
 

foreach ($context as $e) {
if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
if (1 === $i) {

 $throw = $e;
break;
}
self::$toStringException = $e;

return true;
}
}

if (1 < $i) {

 $this->handleException($throw);


 return false;
}
}
}
}

throw $throw;
}


 $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
$trace = true;

if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
$trace = false;
} else {
$this->loggedTraces[$e] = 1;
}

$e = compact('type', 'file', 'line', 'level');

if ($type & $level) {
if ($this->scopedErrors & $type) {
$e['scope_vars'] = $context;
if ($trace) {
$e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
}
} elseif ($trace) {
if (null === $backtrace) {
$e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
} else {
foreach ($backtrace as &$frame) {
unset($frame['args'], $frame);
}
$e['stack'] = $backtrace;
}
}
}

if ($this->isRecursive) {
$log = 0;
} elseif (self::$stackedErrorLevels) {
self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
} else {
try {
$this->isRecursive = true;
$this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
$this->isRecursive = false;
} catch (\Exception $e) {
$this->isRecursive = false;

throw $e;
} catch (\Throwable $e) {
$this->isRecursive = false;

throw $e;
}
}

return $type && $log;
}









public function handleException($exception, array $error = null)
{
if (!$exception instanceof \Exception) {
$exception = new FatalThrowableError($exception);
}
$type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;

if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
$e = array(
'type' => $type,
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'level' => error_reporting(),
'stack' => $exception->getTrace(),
);
if ($exception instanceof FatalErrorException) {
if ($exception instanceof FatalThrowableError) {
$error = array(
'type' => $type,
'message' => $message = $exception->getMessage(),
'file' => $e['file'],
'line' => $e['line'],
);
} else {
$message = 'Fatal '.$exception->getMessage();
}
} elseif ($exception instanceof \ErrorException) {
$message = 'Uncaught '.$exception->getMessage();
if ($exception instanceof ContextErrorException) {
$e['context'] = $exception->getContext();
}
} else {
$message = 'Uncaught Exception: '.$exception->getMessage();
}
}
if ($this->loggedErrors & $type) {
$this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
}
if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
foreach ($this->getFatalErrorHandlers() as $handler) {
if ($e = $handler->handleError($error, $exception)) {
$exception = $e;
break;
}
}
}
if (empty($this->exceptionHandler)) {
throw $exception; 
 }
try {
call_user_func($this->exceptionHandler, $exception);
} catch (\Exception $handlerException) {
} catch (\Throwable $handlerException) {
}
if (isset($handlerException)) {
$this->exceptionHandler = null;
$this->handleException($handlerException);
}
}








public static function handleFatalError(array $error = null)
{
if (null === self::$reservedMemory) {
return;
}

self::$reservedMemory = null;

$handler = set_error_handler('var_dump');
$handler = is_array($handler) ? $handler[0] : null;
restore_error_handler();

if (!$handler instanceof self) {
return;
}

if (null === $error) {
$error = error_get_last();
}

try {
while (self::$stackedErrorLevels) {
static::unstackErrors();
}
} catch (\Exception $exception) {

 } catch (\Throwable $exception) {

 }

if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {

 $handler->throwAt(0, true);
$trace = isset($error['backtrace']) ? $error['backtrace'] : null;

if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
$exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
} else {
$exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
}
} elseif (!isset($exception)) {
return;
}

try {
$handler->handleException($exception, $error);
} catch (FatalErrorException $e) {

 }
}












public static function stackErrors()
{
self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
}




public static function unstackErrors()
{
$level = array_pop(self::$stackedErrorLevels);

if (null !== $level) {
$e = error_reporting($level);
if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {

 error_reporting($e);
}
}

if (empty(self::$stackedErrorLevels)) {
$errors = self::$stackedErrors;
self::$stackedErrors = array();

foreach ($errors as $e) {
$e[0]->log($e[1], $e[2], $e[3]);
}
}
}








protected function getFatalErrorHandlers()
{
return array(
new UndefinedFunctionFatalErrorHandler(),
new UndefinedMethodFatalErrorHandler(),
new ClassNotFoundFatalErrorHandler(),
);
}








public function setLevel($level)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);

$level = null === $level ? error_reporting() : $level;
$this->throwAt($level, true);
}








public function setDisplayErrors($displayErrors)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);

if ($displayErrors) {
$this->throwAt($this->displayErrors, true);
} else {
$displayErrors = $this->displayErrors;
$this->throwAt(0, true);
$this->displayErrors = $displayErrors;
}
}









public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
{
@trigger_error('The '.__METHOD__.' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);

$handler = set_error_handler('var_dump');
$handler = is_array($handler) ? $handler[0] : null;
restore_error_handler();
if (!$handler instanceof self) {
return;
}
if ('deprecation' === $channel) {
$handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
$handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
} elseif ('scream' === $channel) {
$handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
$handler->screamAt(E_ALL | E_STRICT);
} elseif ('emergency' === $channel) {
$handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
$handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
}
}




public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
{
$this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());

return $this->handleError($level, $message, $file, $line, (array) $context);
}






public function handleFatal()
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);

static::handleFatalError();
}
}








class ErrorHandlerCanary
{
private static $displayErrors = null;

public function __construct()
{
if (null === self::$displayErrors) {
self::$displayErrors = ini_set('display_errors', 1);
}
}

public function __destruct()
{
if (null !== self::$displayErrors) {
ini_set('display_errors', self::$displayErrors);
self::$displayErrors = null;
}
}
}
<?php










namespace Symfony\Component\Debug;

/**
@notk
@tchwork







*/
class DebugClassLoader
{
private $classLoader;
private $isFinder;
private $wasFinder;
private static $caseCheck;
private static $deprecated = array();
private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
private static $darwinCache = array('/' => array('/', array()));






public function __construct($classLoader)
{
$this->wasFinder = is_object($classLoader) && method_exists($classLoader, 'findFile');

if ($this->wasFinder) {
@trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
$this->classLoader = array($classLoader, 'loadClass');
$this->isFinder = true;
} else {
$this->classLoader = $classLoader;
$this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile');
}

if (!isset(self::$caseCheck)) {
$file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
$i = strrpos($file, DIRECTORY_SEPARATOR);
$dir = substr($file, 0, 1 + $i);
$file = substr($file, 1 + $i);
$test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
$test = realpath($dir.$test);

if (false === $test || false === $i) {

 self::$caseCheck = 0;
} elseif (substr($test, -strlen($file)) === $file) {

 self::$caseCheck = 1;
} elseif (false !== stripos(PHP_OS, 'darwin')) {

 self::$caseCheck = 2;
} else {

 self::$caseCheck = 0;
}
}
}






public function getClassLoader()
{
return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
}




public static function enable()
{

 class_exists('Symfony\Component\Debug\ErrorHandler');
class_exists('Psr\Log\LogLevel');

if (!is_array($functions = spl_autoload_functions())) {
return;
}

foreach ($functions as $function) {
spl_autoload_unregister($function);
}

foreach ($functions as $function) {
if (!is_array($function) || !$function[0] instanceof self) {
$function = array(new static($function), 'loadClass');
}

spl_autoload_register($function);
}
}




public static function disable()
{
if (!is_array($functions = spl_autoload_functions())) {
return;
}

foreach ($functions as $function) {
spl_autoload_unregister($function);
}

foreach ($functions as $function) {
if (is_array($function) && $function[0] instanceof self) {
$function = $function[0]->getClassLoader();
}

spl_autoload_register($function);
}
}










public function findFile($class)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);

if ($this->wasFinder) {
return $this->classLoader[0]->findFile($class);
}
}










public function loadClass($class)
{
ErrorHandler::stackErrors();

try {
if ($this->isFinder) {
if ($file = $this->classLoader[0]->findFile($class)) {
require_once $file;
}
} else {
call_user_func($this->classLoader, $class);
$file = false;
}
} catch (\Exception $e) {
ErrorHandler::unstackErrors();

throw $e;
} catch (\Throwable $e) {
ErrorHandler::unstackErrors();

throw $e;
}

ErrorHandler::unstackErrors();

$exists = class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));

if ('\\' === $class[0]) {
$class = substr($class, 1);
}

if ($exists) {
$refl = new \ReflectionClass($class);
$name = $refl->getName();

if ($name !== $class && 0 === strcasecmp($name, $class)) {
throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
}

if (in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
@trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
} elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
} else {
if (2 > $len = 1 + (strpos($name, '\\', 1 + strpos($name, '\\')) ?: strpos($name, '_'))) {
$len = 0;
$ns = '';
} else {
switch ($ns = substr($name, 0, $len)) {
case 'Symfony\Bridge\\':
case 'Symfony\Bundle\\':
case 'Symfony\Component\\':
$ns = 'Symfony\\';
$len = strlen($ns);
break;
}
}
$parent = get_parent_class($class);

if (!$parent || strncmp($ns, $parent, $len)) {
if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
@trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
}

$parentInterfaces = array();
$deprecatedInterfaces = array();
if ($parent) {
foreach (class_implements($parent) as $interface) {
$parentInterfaces[$interface] = 1;
}
}

foreach ($refl->getInterfaceNames() as $interface) {
if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
$deprecatedInterfaces[] = $interface;
}
foreach (class_implements($interface) as $interface) {
$parentInterfaces[$interface] = 1;
}
}

foreach ($deprecatedInterfaces as $interface) {
if (!isset($parentInterfaces[$interface])) {
@trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
}
}
}
}
}

if ($file) {
if (!$exists) {
if (false !== strpos($class, '/')) {
throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
}

throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
}
if (self::$caseCheck) {
$real = explode('\\', $class.strrchr($file, '.'));
$tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));

$i = count($tail) - 1;
$j = count($real) - 1;

while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
--$i;
--$j;
}

array_splice($tail, 0, $i + 1);
}
if (self::$caseCheck && $tail) {
$tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
$tailLen = strlen($tail);
$real = $refl->getFileName();

if (2 === self::$caseCheck) {


$i = 1 + strrpos($real, '/');
$file = substr($real, $i);
$real = substr($real, 0, $i);

if (isset(self::$darwinCache[$real])) {
$kDir = $real;
} else {
$kDir = strtolower($real);

if (isset(self::$darwinCache[$kDir])) {
$real = self::$darwinCache[$kDir][0];
} else {
$dir = getcwd();
chdir($real);
$real = getcwd().'/';
chdir($dir);

$dir = $real;
$k = $kDir;
$i = strlen($dir) - 1;
while (!isset(self::$darwinCache[$k])) {
self::$darwinCache[$k] = array($dir, array());
self::$darwinCache[$dir] = &self::$darwinCache[$k];

while ('/' !== $dir[--$i]) {
}
$k = substr($k, 0, ++$i);
$dir = substr($dir, 0, $i--);
}
}
}

$dirFiles = self::$darwinCache[$kDir][1];

if (isset($dirFiles[$file])) {
$kFile = $file;
} else {
$kFile = strtolower($file);

if (!isset($dirFiles[$kFile])) {
foreach (scandir($real, 2) as $f) {
if ('.' !== $f[0]) {
$dirFiles[$f] = $f;
if ($f === $file) {
$kFile = $k = $file;
} elseif ($f !== $k = strtolower($f)) {
$dirFiles[$k] = $f;
}
}
}
self::$darwinCache[$kDir][1] = $dirFiles;
}
}

$real .= $dirFiles[$kFile];
}

if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
&& 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
) {
throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
}
}

return true;
}
}
}
<?php










namespace Symfony\Component\Debug;

use Psr\Log\AbstractLogger;






class BufferingLogger extends AbstractLogger
{
private $logs = array();

public function log($level, $message, array $context = array())
{
$this->logs[] = array($level, $message, $context);
}

public function cleanLogs()
{
$logs = $this->logs;
$this->logs = array();

return $logs;
}
}
<?php










namespace Symfony\Component\Debug;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\Debug\Exception\OutOfMemoryException;

/**
@tchwork









*/
class ExceptionHandler
{
private $debug;
private $charset;
private $handler;
private $caughtBuffer;
private $caughtLength;
private $fileLinkFormat;

public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
{
if (false !== strpos($charset, '%')) {
@trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since version 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);


 $pivot = $fileLinkFormat;
$fileLinkFormat = $charset;
$charset = $pivot;
}
$this->debug = $debug;
$this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
}










public static function register($debug = true, $charset = null, $fileLinkFormat = null)
{
$handler = new static($debug, $charset, $fileLinkFormat);

$prev = set_exception_handler(array($handler, 'handle'));
if (is_array($prev) && $prev[0] instanceof ErrorHandler) {
restore_exception_handler();
$prev[0]->setExceptionHandler(array($handler, 'handle'));
}

return $handler;
}








public function setHandler($handler)
{
if (null !== $handler && !is_callable($handler)) {
throw new \LogicException('The exception handler must be a valid PHP callable.');
}
$old = $this->handler;
$this->handler = $handler;

return $old;
}








public function setFileLinkFormat($format)
{
$old = $this->fileLinkFormat;
$this->fileLinkFormat = $format;

return $old;
}









public function handle(\Exception $exception)
{
if (null === $this->handler || $exception instanceof OutOfMemoryException) {
$this->failSafeHandle($exception);

return;
}

$caughtLength = $this->caughtLength = 0;

ob_start(array($this, 'catchOutput'));
$this->failSafeHandle($exception);
while (null === $this->caughtBuffer && ob_end_flush()) {

 }
if (isset($this->caughtBuffer[0])) {
ob_start(array($this, 'cleanOutput'));
echo $this->caughtBuffer;
$caughtLength = ob_get_length();
}
$this->caughtBuffer = null;

try {
call_user_func($this->handler, $exception);
$this->caughtLength = $caughtLength;
} catch (\Exception $e) {
if (!$caughtLength) {

 throw $exception;
}
}
}










private function failSafeHandle(\Exception $exception)
{
if (class_exists('Symfony\Component\HttpFoundation\Response', false)
&& __CLASS__ !== get_class($this)
&& ($reflector = new \ReflectionMethod($this, 'createResponse'))
&& __CLASS__ !== $reflector->class
) {
$response = $this->createResponse($exception);
$response->sendHeaders();
$response->sendContent();
@trigger_error(sprintf("The %s::createResponse method is deprecated since 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);

return;
}

$this->sendPhpResponse($exception);
}









public function sendPhpResponse($exception)
{
if (!$exception instanceof FlattenException) {
$exception = FlattenException::create($exception);
}

if (!headers_sent()) {
header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
foreach ($exception->getHeaders() as $name => $value) {
header($name.': '.$value, false);
}
header('Content-Type: text/html; charset='.$this->charset);
}

echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
}










public function createResponse($exception)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);

if (!$exception instanceof FlattenException) {
$exception = FlattenException::create($exception);
}

return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
}








public function getHtml($exception)
{
if (!$exception instanceof FlattenException) {
$exception = FlattenException::create($exception);
}

return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
}








public function getContent(FlattenException $exception)
{
switch ($exception->getStatusCode()) {
case 404:
$title = 'Sorry, the page you are looking for could not be found.';
break;
default:
$title = 'Whoops, looks like something went wrong.';
}

$content = '';
if ($this->debug) {
try {
$count = count($exception->getAllPrevious());
$total = $count + 1;
foreach ($exception->toArray() as $position => $e) {
$ind = $count - $position + 1;
$class = $this->formatClass($e['class']);
$message = nl2br($this->escapeHtml($e['message']));
$content .= sprintf(<<<'EOF'
                        <h2 class="block_exception clear_fix">
                            <span class="exception_counter">%d/%d</span>
                            <span class="exception_title">%s%s:</span>
                            <span class="exception_message">%s</span>
                        </h2>
                        <div class="block">
                            <ol class="traces list_exception">

EOF
, $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
foreach ($e['trace'] as $trace) {
$content .= '       <li>';
if ($trace['function']) {
$content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
}
if (isset($trace['file']) && isset($trace['line'])) {
$content .= $this->formatPath($trace['file'], $trace['line']);
}
$content .= "</li>\n";
}

$content .= "    </ol>\n</div>\n";
}
} catch (\Exception $e) {

 if ($this->debug) {
$title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage()));
} else {
$title = 'Whoops, looks like something went wrong.';
}
}
}

return <<<EOF
            <div id="sf-resetcontent" class="sf-reset">
                <h1>$title</h1>
                $content
            </div>
EOF;
}








public function getStylesheet(FlattenException $exception)
{
return <<<'EOF'
            .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
            .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
            .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
            .sf-reset .clear_fix { display:inline-block; }
            .sf-reset * html .clear_fix { height:1%; }
            .sf-reset .clear_fix { display:block; }
            .sf-reset, .sf-reset .block { margin: auto }
            .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
            .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
            .sf-reset strong { font-weight:bold; }
            .sf-reset a { color:#6c6159; cursor: default; }
            .sf-reset a img { border:none; }
            .sf-reset a:hover { text-decoration:underline; }
            .sf-reset em { font-style:italic; }
            .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
            .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
            .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
            .sf-reset .exception_message { margin-left: 3em; display: block; }
            .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
            .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
                -webkit-border-bottom-right-radius: 16px;
                -webkit-border-bottom-left-radius: 16px;
                -moz-border-radius-bottomright: 16px;
                -moz-border-radius-bottomleft: 16px;
                border-bottom-right-radius: 16px;
                border-bottom-left-radius: 16px;
                border-bottom:1px solid #ccc;
                border-right:1px solid #ccc;
                border-left:1px solid #ccc;
                word-wrap: break-word;
            }
            .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
                -webkit-border-top-left-radius: 16px;
                -webkit-border-top-right-radius: 16px;
                -moz-border-radius-topleft: 16px;
                -moz-border-radius-topright: 16px;
                border-top-left-radius: 16px;
                border-top-right-radius: 16px;
                border-top:1px solid #ccc;
                border-right:1px solid #ccc;
                border-left:1px solid #ccc;
                overflow: hidden;
                word-wrap: break-word;
            }
            .sf-reset a { background:none; color:#868686; text-decoration:none; }
            .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
            .sf-reset ol { padding: 10px 0; }
            .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
                -webkit-border-radius: 10px;
                -moz-border-radius: 10px;
                border-radius: 10px;
                border: 1px solid #ccc;
            }
EOF;
}

private function decorate($content, $css)
{
return <<<EOF
<!DOCTYPE html>
<html>
    <head>
        <meta charset="{$this->charset}" />
        <meta name="robots" content="noindex,nofollow" />
        <style>
            /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
            html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}

            html { background: #eee; padding: 10px }
            img { border: 0; }
            #sf-resetcontent { width:970px; margin:0 auto; }
            $css
        </style>
    </head>
    <body>
        $content
    </body>
</html>
EOF;
}

private function formatClass($class)
{
$parts = explode('\\', $class);

return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
}

private function formatPath($path, $line)
{
$path = $this->escapeHtml($path);
$file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;

if ($linkFormat = $this->fileLinkFormat) {
$link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));

return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
}

return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
}








private function formatArgs(array $args)
{
$result = array();
foreach ($args as $key => $item) {
if ('object' === $item[0]) {
$formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
} elseif ('array' === $item[0]) {
$formattedValue = sprintf('<em>array</em>(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
} elseif ('null' === $item[0]) {
$formattedValue = '<em>null</em>';
} elseif ('boolean' === $item[0]) {
$formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
} elseif ('resource' === $item[0]) {
$formattedValue = '<em>resource</em>';
} else {
$formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
}

$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
}

return implode(', ', $result);
}






protected static function utf8Htmlize($str)
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);

return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
}




private function escapeHtml($str)
{
return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
}




public function catchOutput($buffer)
{
$this->caughtBuffer = $buffer;

return '';
}




public function cleanOutput($buffer)
{
if ($this->caughtLength) {

 $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
if (isset($cleanBuffer[0])) {
$buffer = $cleanBuffer;
}
}

return $buffer;
}
}
<?php










namespace Symfony\Component\Debug;






class Debug
{
private static $enabled = false;












public static function enable($errorReportingLevel = null, $displayErrors = true)
{
if (static::$enabled) {
return;
}

static::$enabled = true;

if (null !== $errorReportingLevel) {
error_reporting($errorReportingLevel);
} else {
error_reporting(-1);
}

if ('cli' !== PHP_SAPI) {
ini_set('display_errors', 0);
ExceptionHandler::register();
} elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {

 ini_set('display_errors', 1);
}
if ($displayErrors) {
ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
} else {
ErrorHandler::register()->throwAt(0, true);
}

DebugClassLoader::enable();
}
}
<?php










namespace Symfony\Component\Debug\Exception;






class FatalThrowableError extends FatalErrorException
{
public function __construct(\Throwable $e)
{
if ($e instanceof \ParseError) {
$message = 'Parse error: '.$e->getMessage();
$severity = E_PARSE;
} elseif ($e instanceof \TypeError) {
$message = 'Type error: '.$e->getMessage();
$severity = E_RECOVERABLE_ERROR;
} else {
$message = $e->getMessage();
$severity = E_ERROR;
}

\ErrorException::__construct(
$message,
$e->getCode(),
$severity,
$e->getFile(),
$e->getLine()
);

$this->setTrace($e->getTrace());
}
}
<?php










namespace Symfony\Component\Debug\Exception;






class ContextErrorException extends \ErrorException
{
private $context = array();

public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
{
parent::__construct($message, $code, $severity, $filename, $lineno);
$this->context = $context;
}




public function getContext()
{
return $this->context;
}
}
<?php










namespace Symfony\Component\Debug\Exception;






class UndefinedFunctionException extends FatalErrorException
{
public function __construct($message, \ErrorException $previous)
{
parent::__construct(
$message,
$previous->getCode(),
$previous->getSeverity(),
$previous->getFile(),
$previous->getLine(),
$previous->getPrevious()
);
$this->setTrace($previous->getTrace());
}
}
<?php










namespace Symfony\Component\Debug\Exception;






class UndefinedMethodException extends FatalErrorException
{
public function __construct($message, \ErrorException $previous)
{
parent::__construct(
$message,
$previous->getCode(),
$previous->getSeverity(),
$previous->getFile(),
$previous->getLine(),
$previous->getPrevious()
);
$this->setTrace($previous->getTrace());
}
}
<?php










namespace Symfony\Component\Debug\Exception;

@trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);






class DummyException extends \ErrorException
{
}
<?php










namespace Symfony\Component\HttpKernel\Exception;

use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;










class FlattenException
{
private $handler;

public static function __callStatic($method, $args)
{
if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_called_class(), $method));
}

return call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
}

public function __call($method, $args)
{
if (!isset($this->handler)) {
$this->handler = new DebugFlattenException();
}

if (!method_exists($this->handler, $method)) {
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method));
}

return call_user_func_array(array($this->handler, $method), $args);
}
}

namespace Symfony\Component\Debug\Exception;

use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;








class FlattenException extends LegacyFlattenException
{
private $message;
private $code;
private $previous;
private $trace;
private $class;
private $statusCode;
private $headers;
private $file;
private $line;

public static function create(\Exception $exception, $statusCode = null, array $headers = array())
{
$e = new static();
$e->setMessage($exception->getMessage());
$e->setCode($exception->getCode());

if ($exception instanceof HttpExceptionInterface) {
$statusCode = $exception->getStatusCode();
$headers = array_merge($headers, $exception->getHeaders());
}

if (null === $statusCode) {
$statusCode = 500;
}

$e->setStatusCode($statusCode);
$e->setHeaders($headers);
$e->setTraceFromException($exception);
$e->setClass(get_class($exception));
$e->setFile($exception->getFile());
$e->setLine($exception->getLine());

$previous = $exception->getPrevious();

if ($previous instanceof \Exception) {
$e->setPrevious(static::create($previous));
} elseif ($previous instanceof \Throwable) {
$e->setPrevious(static::create(new FatalThrowableError($previous)));
}

return $e;
}

public function toArray()
{
$exceptions = array();
foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
$exceptions[] = array(
'message' => $exception->getMessage(),
'class' => $exception->getClass(),
'trace' => $exception->getTrace(),
);
}

return $exceptions;
}

public function getStatusCode()
{
return $this->statusCode;
}

public function setStatusCode($code)
{
$this->statusCode = $code;
}

public function getHeaders()
{
return $this->headers;
}

public function setHeaders(array $headers)
{
$this->headers = $headers;
}

public function getClass()
{
return $this->class;
}

public function setClass($class)
{
$this->class = $class;
}

public function getFile()
{
return $this->file;
}

public function setFile($file)
{
$this->file = $file;
}

public function getLine()
{
return $this->line;
}

public function setLine($line)
{
$this->line = $line;
}

public function getMessage()
{
return $this->message;
}

public function setMessage($message)
{
$this->message = $message;
}

public function getCode()
{
return $this->code;
}

public function setCode($code)
{
$this->code = $code;
}

public function getPrevious()
{
return $this->previous;
}

public function setPrevious(FlattenException $previous)
{
$this->previous = $previous;
}

public function getAllPrevious()
{
$exceptions = array();
$e = $this;
while ($e = $e->getPrevious()) {
$exceptions[] = $e;
}

return $exceptions;
}

public function getTrace()
{
return $this->trace;
}

public function setTraceFromException(\Exception $exception)
{
$this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
}

public function setTrace($trace, $file, $line)
{
$this->trace = array();
$this->trace[] = array(
'namespace' => '',
'short_class' => '',
'class' => '',
'type' => '',
'function' => '',
'file' => $file,
'line' => $line,
'args' => array(),
);
foreach ($trace as $entry) {
$class = '';
$namespace = '';
if (isset($entry['class'])) {
$parts = explode('\\', $entry['class']);
$class = array_pop($parts);
$namespace = implode('\\', $parts);
}

$this->trace[] = array(
'namespace' => $namespace,
'short_class' => $class,
'class' => isset($entry['class']) ? $entry['class'] : '',
'type' => isset($entry['type']) ? $entry['type'] : '',
'function' => isset($entry['function']) ? $entry['function'] : null,
'file' => isset($entry['file']) ? $entry['file'] : null,
'line' => isset($entry['line']) ? $entry['line'] : null,
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
);
}
}

private function flattenArgs($args, $level = 0, &$count = 0)
{
$result = array();
foreach ($args as $key => $value) {
if (++$count > 1e4) {
return array('array', '*SKIPPED over 10000 entries*');
}
if ($value instanceof \__PHP_Incomplete_Class) {

 $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
} elseif (is_object($value)) {
$result[$key] = array('object', get_class($value));
} elseif (is_array($value)) {
if ($level > 10) {
$result[$key] = array('array', '*DEEP NESTED ARRAY*');
} else {
$result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
}
} elseif (null === $value) {
$result[$key] = array('null', null);
} elseif (is_bool($value)) {
$result[$key] = array('boolean', $value);
} elseif (is_resource($value)) {
$result[$key] = array('resource', get_resource_type($value));
} else {
$result[$key] = array('string', (string) $value);
}
}

return $result;
}

private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
{
$array = new \ArrayObject($value);

return $array['__PHP_Incomplete_Class_Name'];
}
}
<?php










namespace Symfony\Component\Debug\Exception;






class ClassNotFoundException extends FatalErrorException
{
public function __construct($message, \ErrorException $previous)
{
parent::__construct(
$message,
$previous->getCode(),
$previous->getSeverity(),
$previous->getFile(),
$previous->getLine(),
$previous->getPrevious()
);
$this->setTrace($previous->getTrace());
}
}
<?php










namespace Symfony\Component\HttpKernel\Exception;

/**
@yandex
@tchwork





*/
class FatalErrorException extends \ErrorException
{
}

namespace Symfony\Component\Debug\Exception;

use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;






class FatalErrorException extends LegacyFatalErrorException
{
public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null)
{
parent::__construct($message, $code, $severity, $filename, $lineno);

if (null !== $trace) {
if (!$traceArgs) {
foreach ($trace as &$frame) {
unset($frame['args'], $frame['this'], $frame);
}
}

$this->setTrace($trace);
} elseif (null !== $traceOffset) {
if (function_exists('xdebug_get_function_stack')) {
$trace = xdebug_get_function_stack();
if (0 < $traceOffset) {
array_splice($trace, -$traceOffset);
}

foreach ($trace as &$frame) {
if (!isset($frame['type'])) {

 if (isset($frame['class'])) {
$frame['type'] = '::';
}
} elseif ('dynamic' === $frame['type']) {
$frame['type'] = '->';
} elseif ('static' === $frame['type']) {
$frame['type'] = '::';
}


 if (!$traceArgs) {
unset($frame['params'], $frame['args']);
} elseif (isset($frame['params']) && !isset($frame['args'])) {
$frame['args'] = $frame['params'];
unset($frame['params']);
}
}

unset($frame);
$trace = array_reverse($trace);
} elseif (function_exists('symfony_debug_backtrace')) {
$trace = symfony_debug_backtrace();
if (0 < $traceOffset) {
array_splice($trace, 0, $traceOffset);
}
} else {
$trace = array();
}

$this->setTrace($trace);
}
}

protected function setTrace($trace)
{
$traceReflector = new \ReflectionProperty('Exception', 'trace');
$traceReflector->setAccessible(true);
$traceReflector->setValue($this, $trace);
}
}
<?php










namespace Symfony\Component\Debug\Exception;






class OutOfMemoryException extends FatalErrorException
{
}
<?php










namespace Symfony\Component\Debug\FatalErrorHandler;

use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\Exception\UndefinedMethodException;






class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
{



public function handleError(array $error, FatalErrorException $exception)
{
preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
if (!$matches) {
return;
}

$className = $matches[1];
$methodName = $matches[2];

$message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);

$candidates = array();
foreach (get_class_methods($className) as $definedMethodName) {
$lev = levenshtein($methodName, $definedMethodName);
if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
$candidates[] = $definedMethodName;
}
}

if ($candidates) {
sort($candidates);
$last = array_pop($candidates).'"?';
if ($candidates) {
$candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
} else {
$candidates = '"'.$last;
}
$message .= "\nDid you mean to call ".$candidates;
}

return new UndefinedMethodException($message, $exception);
}
}
<?php










namespace Symfony\Component\Debug\FatalErrorHandler;

use Symfony\Component\Debug\Exception\ClassNotFoundException;
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\DebugClassLoader;
use Composer\Autoload\ClassLoader as ComposerClassLoader;
use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;






class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
{



public function handleError(array $error, FatalErrorException $exception)
{
$messageLen = strlen($error['message']);
$notFoundSuffix = '\' not found';
$notFoundSuffixLen = strlen($notFoundSuffix);
if ($notFoundSuffixLen > $messageLen) {
return;
}

if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
return;
}

foreach (array('class', 'interface', 'trait') as $typeName) {
$prefix = ucfirst($typeName).' \'';
$prefixLen = strlen($prefix);
if (0 !== strpos($error['message'], $prefix)) {
continue;
}

$fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
$className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
$namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
$message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
$tail = ' for another namespace?';
} else {
$className = $fullyQualifiedClassName;
$message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
$tail = '?';
}

if ($candidates = $this->getClassCandidates($className)) {
$tail = array_pop($candidates).'"?';
if ($candidates) {
$tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
} else {
$tail = ' for "'.$tail;
}
}
$message .= "\nDid you forget a \"use\" statement".$tail;

return new ClassNotFoundException($message, $exception);
}
}











private function getClassCandidates($class)
{
if (!is_array($functions = spl_autoload_functions())) {
return array();
}


 $classes = array();

foreach ($functions as $function) {
if (!is_array($function)) {
continue;
}

 if ($function[0] instanceof DebugClassLoader) {
$function = $function[0]->getClassLoader();


 if (is_object($function)) {
$function = array($function);
}

if (!is_array($function)) {
continue;
}
}

if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
foreach ($function[0]->getPrefixes() as $prefix => $paths) {
foreach ($paths as $path) {
$classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
}
}
}
if ($function[0] instanceof ComposerClassLoader) {
foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
foreach ($paths as $path) {
$classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
}
}
}
}

return array_unique($classes);
}








private function findClassInPath($path, $class, $prefix)
{
if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
return array();
}

$classes = array();
$filename = $class.'.php';
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
$classes[] = $class;
}
}

return $classes;
}








private function convertFileToClass($path, $file, $prefix)
{
$candidates = array(

 $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),

 $prefix.$namespacedClass,

 $prefix.'\\'.$namespacedClass,

 str_replace('\\', '_', $namespacedClass),

 str_replace('\\', '_', $prefix.$namespacedClass),

 str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
);

if ($prefix) {
$candidates = array_filter($candidates, function ($candidate) use ($prefix) {return 0 === strpos($candidate, $prefix);});
}


 
 
 foreach ($candidates as $candidate) {
if ($this->classExists($candidate)) {
return $candidate;
}
}

require_once $file;

foreach ($candidates as $candidate) {
if ($this->classExists($candidate)) {
return $candidate;
}
}
}






private function classExists($class)
{
return class_exists($class, false) || interface_exists($class, false) || (function_exists('trait_exists') && trait_exists($class, false));
}
}
<?php










namespace Symfony\Component\Debug\FatalErrorHandler;

use Symfony\Component\Debug\Exception\UndefinedFunctionException;
use Symfony\Component\Debug\Exception\FatalErrorException;






class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
{



public function handleError(array $error, FatalErrorException $exception)
{
$messageLen = strlen($error['message']);
$notFoundSuffix = '()';
$notFoundSuffixLen = strlen($notFoundSuffix);
if ($notFoundSuffixLen > $messageLen) {
return;
}

if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
return;
}

$prefix = 'Call to undefined function ';
$prefixLen = strlen($prefix);
if (0 !== strpos($error['message'], $prefix)) {
return;
}

$fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
$functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
$namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
$message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
} else {
$functionName = $fullyQualifiedFunctionName;
$message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
}

$candidates = array();
foreach (get_defined_functions() as $type => $definedFunctionNames) {
foreach ($definedFunctionNames as $definedFunctionName) {
if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
$definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
} else {
$definedFunctionNameBasename = $definedFunctionName;
}

if ($definedFunctionNameBasename === $functionName) {
$candidates[] = '\\'.$definedFunctionName;
}
}
}

if ($candidates) {
sort($candidates);
$last = array_pop($candidates).'"?';
if ($candidates) {
$candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
} else {
$candidates = '"'.$last;
}
$message .= "\nDid you mean to call ".$candidates;
}

return new UndefinedFunctionException($message, $exception);
}
}
<?php










namespace Symfony\Component\Debug\FatalErrorHandler;

use Symfony\Component\Debug\Exception\FatalErrorException;






interface FatalErrorHandlerInterface
{








public function handleError(array $error, FatalErrorException $exception);
}
<?php










namespace Symfony\Contracts\Service;

use Psr\Container\ContainerInterface;

/**
@gmail



*/
interface ServiceProviderInterface extends ContainerInterface
{











public function getProvidedServices(): array;
}
<?php










namespace Symfony\Contracts\Service;

use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;


class_exists(ContainerExceptionInterface::class);
class_exists(NotFoundExceptionInterface::class);

/**
@tchwork



*/
trait ServiceLocatorTrait
{
private $factories;
private $loading = [];
private $providedTypes;




public function __construct(array $factories)
{
$this->factories = $factories;
}






public function has($id)
{
return isset($this->factories[$id]);
}






public function get($id)
{
if (!isset($this->factories[$id])) {
throw $this->createNotFoundException($id);
}

if (isset($this->loading[$id])) {
$ids = array_values($this->loading);
$ids = \array_slice($this->loading, array_search($id, $ids));
$ids[] = $id;

throw $this->createCircularReferenceException($id, $ids);
}

$this->loading[$id] = $id;
try {
return $this->factories[$id]($this);
} finally {
unset($this->loading[$id]);
}
}




public function getProvidedServices(): array
{
if (null === $this->providedTypes) {
$this->providedTypes = [];

foreach ($this->factories as $name => $factory) {
if (!\is_callable($factory)) {
$this->providedTypes[$name] = '?';
} else {
$type = (new \ReflectionFunction($factory))->getReturnType();

$this->providedTypes[$name] = $type ? ($type->allowsNull() ? '?' : '').($type instanceof \ReflectionNamedType ? $type->getName() : $type) : '?';
}
}
}

return $this->providedTypes;
}

private function createNotFoundException(string $id): NotFoundExceptionInterface
{
if (!$alternatives = array_keys($this->factories)) {
$message = 'is empty...';
} else {
$last = array_pop($alternatives);
if ($alternatives) {
$message = sprintf('only knows about the "%s" and "%s" services.', implode('", "', $alternatives), $last);
} else {
$message = sprintf('only knows about the "%s" service.', $last);
}
}

if ($this->loading) {
$message = sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $message);
} else {
$message = sprintf('Service "%s" not found: the current service locator %s', $id, $message);
}

return new class($message) extends \InvalidArgumentException implements NotFoundExceptionInterface {
};
}

private function createCircularReferenceException(string $id, array $path): ContainerExceptionInterface
{
return new class(sprintf('Circular reference detected for service "%s", path: "%s".', $id, implode(' -> ', $path))) extends \RuntimeException implements ContainerExceptionInterface {
};
}
}
<?php










namespace Symfony\Contracts\Service;














interface ResetInterface
{
public function reset();
}
<?php










namespace Symfony\Contracts\Service;
















interface ServiceSubscriberInterface
{





















public static function getSubscribedServices();
}
<?php










namespace Symfony\Contracts\Service;

use Psr\Container\ContainerInterface;







trait ServiceSubscriberTrait
{

protected $container;




public static function getSubscribedServices(): array
{
static $services;

if (null !== $services) {
return $services;
}

$services = \is_callable(['parent', __FUNCTION__]) ? parent::getSubscribedServices() : [];

foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
continue;
}

if (self::class !== $method->getDeclaringClass()->name) {
continue;
}

if (!($returnType = $method->getReturnType()) instanceof \ReflectionNamedType) {
continue;
}

if ($returnType->isBuiltin()) {
continue;
}

$services[self::class.'::'.$method->name] = '?'.$returnType->getName();
}

return $services;
}






public function setContainer(ContainerInterface $container)
{
$this->container = $container;

if (\is_callable(['parent', __FUNCTION__])) {
return parent::setContainer($container);
}

return null;
}
}
<?php

// autoload_static.php @generated by Composer

namespace Composer\Autoload;

class ComposerStaticInit7147d1bba87fa1560cd1235a618ce161
{
    public static $files = array (
        '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
        'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
        '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
        '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
        '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
        '801c31d8ed748cfa537fa45402288c95' => __DIR__ . '/..' . '/psy/psysh/src/functions.php',
    );

    public static $prefixLengthsPsr4 = array (
        'X' => 
        array (
            'XdgBaseDir\\' => 11,
        ),
        'S' => 
        array (
            'Symfony\\Polyfill\\Php80\\' => 23,
            'Symfony\\Polyfill\\Php73\\' => 23,
            'Symfony\\Polyfill\\Mbstring\\' => 26,
            'Symfony\\Polyfill\\Ctype\\' => 23,
            'Symfony\\Contracts\\Service\\' => 26,
            'Symfony\\Component\\VarDumper\\' => 28,
            'Symfony\\Component\\Process\\' => 26,
            'Symfony\\Component\\Filesystem\\' => 29,
            'Symfony\\Component\\Console\\' => 26,
        ),
        'P' => 
        array (
            'Psy\\' => 4,
            'Psr\\Container\\' => 14,
            'PhpParser\\' => 10,
        ),
        'L' => 
        array (
            'LastCall\\DownloadsPlugin\\' => 25,
        ),
        'J' => 
        array (
            'JakubOnderka\\PhpConsoleHighlighter\\' => 35,
            'JakubOnderka\\PhpConsoleColor\\' => 29,
        ),
        'C' => 
        array (
            'Civi\\Cv\\' => 8,
        ),
    );

    public static $prefixDirsPsr4 = array (
        'XdgBaseDir\\' => 
        array (
            0 => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src',
        ),
        'Symfony\\Polyfill\\Php80\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
        ),
        'Symfony\\Polyfill\\Php73\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
        ),
        'Symfony\\Polyfill\\Mbstring\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
        ),
        'Symfony\\Polyfill\\Ctype\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
        ),
        'Symfony\\Contracts\\Service\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/service-contracts',
        ),
        'Symfony\\Component\\VarDumper\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/var-dumper',
        ),
        'Symfony\\Component\\Process\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/process',
        ),
        'Symfony\\Component\\Filesystem\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/filesystem',
        ),
        'Symfony\\Component\\Console\\' => 
        array (
            0 => __DIR__ . '/..' . '/symfony/console',
        ),
        'Psy\\' => 
        array (
            0 => __DIR__ . '/..' . '/psy/psysh/src',
        ),
        'Psr\\Container\\' => 
        array (
            0 => __DIR__ . '/..' . '/psr/container/src',
        ),
        'PhpParser\\' => 
        array (
            0 => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser',
        ),
        'LastCall\\DownloadsPlugin\\' => 
        array (
            0 => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src',
        ),
        'JakubOnderka\\PhpConsoleHighlighter\\' => 
        array (
            0 => __DIR__ . '/..' . '/jakub-onderka/php-console-highlighter/src',
        ),
        'JakubOnderka\\PhpConsoleColor\\' => 
        array (
            0 => __DIR__ . '/..' . '/jakub-onderka/php-console-color/src',
        ),
        'Civi\\Cv\\' => 
        array (
            0 => __DIR__ . '/../..' . '/src',
        ),
    );

    public static $prefixesPsr0 = array (
        'T' => 
        array (
            'TOGoS_GitIgnore_' => 
            array (
                0 => __DIR__ . '/..' . '/togos/gitignore/src/main/php',
            ),
        ),
    );

    public static $classMap = array (
        'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
        'Civi\\Cv\\Application' => __DIR__ . '/../..' . '/src/Application.php',
        'Civi\\Cv\\Bootstrap' => __DIR__ . '/../..' . '/src/Bootstrap.php',
        'Civi\\Cv\\BuildkitReader' => __DIR__ . '/../..' . '/src/BuildkitReader.php',
        'Civi\\Cv\\CmsBootstrap' => __DIR__ . '/../..' . '/src/CmsBootstrap.php',
        'Civi\\Cv\\Command\\AngularHtmlListCommand' => __DIR__ . '/../..' . '/src/Command/AngularHtmlListCommand.php',
        'Civi\\Cv\\Command\\AngularHtmlShowCommand' => __DIR__ . '/../..' . '/src/Command/AngularHtmlShowCommand.php',
        'Civi\\Cv\\Command\\AngularModuleListCommand' => __DIR__ . '/../..' . '/src/Command/AngularModuleListCommand.php',
        'Civi\\Cv\\Command\\Api4Command' => __DIR__ . '/../..' . '/src/Command/Api4Command.php',
        'Civi\\Cv\\Command\\ApiBatchCommand' => __DIR__ . '/../..' . '/src/Command/ApiBatchCommand.php',
        'Civi\\Cv\\Command\\ApiCommand' => __DIR__ . '/../..' . '/src/Command/ApiCommand.php',
        'Civi\\Cv\\Command\\BaseCommand' => __DIR__ . '/../..' . '/src/Command/BaseCommand.php',
        'Civi\\Cv\\Command\\BaseExtensionCommand' => __DIR__ . '/../..' . '/src/Command/BaseExtensionCommand.php',
        'Civi\\Cv\\Command\\BootCommand' => __DIR__ . '/../..' . '/src/Command/BootCommand.php',
        'Civi\\Cv\\Command\\CliCommand' => __DIR__ . '/../..' . '/src/Command/CliCommand.php',
        'Civi\\Cv\\Command\\CoreCheckReqCommand' => __DIR__ . '/../..' . '/src/Command/CoreCheckReqCommand.php',
        'Civi\\Cv\\Command\\CoreInstallCommand' => __DIR__ . '/../..' . '/src/Command/CoreInstallCommand.php',
        'Civi\\Cv\\Command\\CoreUninstallCommand' => __DIR__ . '/../..' . '/src/Command/CoreUninstallCommand.php',
        'Civi\\Cv\\Command\\DebugContainerCommand' => __DIR__ . '/../..' . '/src/Command/DebugContainerCommand.php',
        'Civi\\Cv\\Command\\DebugDispatcherCommand' => __DIR__ . '/../..' . '/src/Command/DebugDispatcherCommand.php',
        'Civi\\Cv\\Command\\EditCommand' => __DIR__ . '/../..' . '/src/Command/EditCommand.php',
        'Civi\\Cv\\Command\\EvalCommand' => __DIR__ . '/../..' . '/src/Command/EvalCommand.php',
        'Civi\\Cv\\Command\\ExtensionDisableCommand' => __DIR__ . '/../..' . '/src/Command/ExtensionDisableCommand.php',
        'Civi\\Cv\\Command\\ExtensionDownloadCommand' => __DIR__ . '/../..' . '/src/Command/ExtensionDownloadCommand.php',
        'Civi\\Cv\\Command\\ExtensionEnableCommand' => __DIR__ . '/../..' . '/src/Command/ExtensionEnableCommand.php',
        'Civi\\Cv\\Command\\ExtensionListCommand' => __DIR__ . '/../..' . '/src/Command/ExtensionListCommand.php',
        'Civi\\Cv\\Command\\ExtensionUninstallCommand' => __DIR__ . '/../..' . '/src/Command/ExtensionUninstallCommand.php',
        'Civi\\Cv\\Command\\ExtensionUpgradeDbCommand' => __DIR__ . '/../..' . '/src/Command/ExtensionUpgradeDbCommand.php',
        'Civi\\Cv\\Command\\FillCommand' => __DIR__ . '/../..' . '/src/Command/FillCommand.php',
        'Civi\\Cv\\Command\\FlushCommand' => __DIR__ . '/../..' . '/src/Command/FlushCommand.php',
        'Civi\\Cv\\Command\\PathCommand' => __DIR__ . '/../..' . '/src/Command/PathCommand.php',
        'Civi\\Cv\\Command\\PipeCommand' => __DIR__ . '/../..' . '/src/Command/PipeCommand.php',
        'Civi\\Cv\\Command\\ScriptCommand' => __DIR__ . '/../..' . '/src/Command/ScriptCommand.php',
        'Civi\\Cv\\Command\\ShowCommand' => __DIR__ . '/../..' . '/src/Command/ShowCommand.php',
        'Civi\\Cv\\Command\\SqlCliCommand' => __DIR__ . '/../..' . '/src/Command/SqlCliCommand.php',
        'Civi\\Cv\\Command\\UpgradeCommand' => __DIR__ . '/../..' . '/src/Command/UpgradeCommand.php',
        'Civi\\Cv\\Command\\UpgradeDbCommand' => __DIR__ . '/../..' . '/src/Command/UpgradeDbCommand.php',
        'Civi\\Cv\\Command\\UpgradeDlCommand' => __DIR__ . '/../..' . '/src/Command/UpgradeDlCommand.php',
        'Civi\\Cv\\Command\\UpgradeGetCommand' => __DIR__ . '/../..' . '/src/Command/UpgradeGetCommand.php',
        'Civi\\Cv\\Command\\UpgradeReportCommand' => __DIR__ . '/../..' . '/src/Command/UpgradeReportCommand.php',
        'Civi\\Cv\\Command\\UrlCommand' => __DIR__ . '/../..' . '/src/Command/UrlCommand.php',
        'Civi\\Cv\\Config' => __DIR__ . '/../..' . '/src/Config.php',
        'Civi\\Cv\\Encoder' => __DIR__ . '/../..' . '/src/Encoder.php',
        'Civi\\Cv\\Exception\\ProcessErrorException' => __DIR__ . '/../..' . '/src/Exception/ProcessErrorException.php',
        'Civi\\Cv\\SiteConfigReader' => __DIR__ . '/../..' . '/src/SiteConfigReader.php',
        'Civi\\Cv\\Util\\Api4ArgParser' => __DIR__ . '/../..' . '/src/Util/Api4ArgParser.php',
        'Civi\\Cv\\Util\\ArrayUtil' => __DIR__ . '/../..' . '/src/Util/ArrayUtil.php',
        'Civi\\Cv\\Util\\BootTrait' => __DIR__ . '/../..' . '/src/Util/BootTrait.php',
        'Civi\\Cv\\Util\\CliEditor' => __DIR__ . '/../..' . '/src/Util/CliEditor.php',
        'Civi\\Cv\\Util\\ConsoleQueueRunner' => __DIR__ . '/../..' . '/src/Util/ConsoleQueueRunner.php',
        'Civi\\Cv\\Util\\Cv' => __DIR__ . '/../..' . '/src/Util/Cv.php',
        'Civi\\Cv\\Util\\Datasource' => __DIR__ . '/../..' . '/src/Util/Datasource.php',
        'Civi\\Cv\\Util\\DebugDispatcherTrait' => __DIR__ . '/../..' . '/src/Util/DebugDispatcherTrait.php',
        'Civi\\Cv\\Util\\Filesystem' => __DIR__ . '/../..' . '/src/Util/Filesystem.php',
        'Civi\\Cv\\Util\\HeadlessDownloader' => __DIR__ . '/../..' . '/src/Util/HeadlessDownloader.php',
        'Civi\\Cv\\Util\\OptionCallbackTrait' => __DIR__ . '/../..' . '/src/Util/OptionCallbackTrait.php',
        'Civi\\Cv\\Util\\Process' => __DIR__ . '/../..' . '/src/Util/Process.php',
        'Civi\\Cv\\Util\\Rand' => __DIR__ . '/../..' . '/src/Util/Rand.php',
        'Civi\\Cv\\Util\\SetupCommandTrait' => __DIR__ . '/../..' . '/src/Util/SetupCommandTrait.php',
        'Civi\\Cv\\Util\\StructuredOutputTrait' => __DIR__ . '/../..' . '/src/Util/StructuredOutputTrait.php',
        'JakubOnderka\\PhpConsoleColor\\ConsoleColor' => __DIR__ . '/..' . '/jakub-onderka/php-console-color/src/ConsoleColor.php',
        'JakubOnderka\\PhpConsoleColor\\InvalidStyleException' => __DIR__ . '/..' . '/jakub-onderka/php-console-color/src/InvalidStyleException.php',
        'JakubOnderka\\PhpConsoleHighlighter\\Highlighter' => __DIR__ . '/..' . '/jakub-onderka/php-console-highlighter/src/Highlighter.php',
        'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
        'LastCall\\DownloadsPlugin\\DownloadsParser' => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src/DownloadsParser.php',
        'LastCall\\DownloadsPlugin\\GlobCleaner' => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src/GlobCleaner.php',
        'LastCall\\DownloadsPlugin\\Handler\\ArchiveHandler' => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php',
        'LastCall\\DownloadsPlugin\\Handler\\BaseHandler' => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php',
        'LastCall\\DownloadsPlugin\\Handler\\FileHandler' => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php',
        'LastCall\\DownloadsPlugin\\Handler\\PharHandler' => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php',
        'LastCall\\DownloadsPlugin\\Plugin' => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src/Plugin.php',
        'LastCall\\DownloadsPlugin\\Subpackage' => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src/Subpackage.php',
        'PhpParser\\Autoloader' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Autoloader.php',
        'PhpParser\\Builder' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder.php',
        'PhpParser\\BuilderAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderAbstract.php',
        'PhpParser\\BuilderFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php',
        'PhpParser\\Builder\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Class_.php',
        'PhpParser\\Builder\\Declaration' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Declaration.php',
        'PhpParser\\Builder\\FunctionLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php',
        'PhpParser\\Builder\\Function_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Function_.php',
        'PhpParser\\Builder\\Interface_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Interface_.php',
        'PhpParser\\Builder\\Method' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Method.php',
        'PhpParser\\Builder\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php',
        'PhpParser\\Builder\\Param' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Param.php',
        'PhpParser\\Builder\\Property' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Property.php',
        'PhpParser\\Builder\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Trait_.php',
        'PhpParser\\Builder\\Use_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Builder/Use_.php',
        'PhpParser\\Comment' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Comment.php',
        'PhpParser\\Comment\\Doc' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Comment/Doc.php',
        'PhpParser\\Error' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Error.php',
        'PhpParser\\ErrorHandler' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ErrorHandler.php',
        'PhpParser\\ErrorHandler\\Collecting' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php',
        'PhpParser\\ErrorHandler\\Throwing' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php',
        'PhpParser\\Lexer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer.php',
        'PhpParser\\Lexer\\Emulative' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php',
        'PhpParser\\Node' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node.php',
        'PhpParser\\NodeAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeAbstract.php',
        'PhpParser\\NodeDumper' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeDumper.php',
        'PhpParser\\NodeTraverser' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeTraverser.php',
        'PhpParser\\NodeTraverserInterface' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php',
        'PhpParser\\NodeVisitor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor.php',
        'PhpParser\\NodeVisitorAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php',
        'PhpParser\\NodeVisitor\\NameResolver' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php',
        'PhpParser\\Node\\Arg' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Arg.php',
        'PhpParser\\Node\\Const_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Const_.php',
        'PhpParser\\Node\\Expr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr.php',
        'PhpParser\\Node\\Expr\\ArrayDimFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php',
        'PhpParser\\Node\\Expr\\ArrayItem' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php',
        'PhpParser\\Node\\Expr\\Array_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php',
        'PhpParser\\Node\\Expr\\Assign' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php',
        'PhpParser\\Node\\Expr\\AssignOp' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php',
        'PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php',
        'PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php',
        'PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php',
        'PhpParser\\Node\\Expr\\AssignOp\\Concat' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php',
        'PhpParser\\Node\\Expr\\AssignOp\\Div' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php',
        'PhpParser\\Node\\Expr\\AssignOp\\Minus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php',
        'PhpParser\\Node\\Expr\\AssignOp\\Mod' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php',
        'PhpParser\\Node\\Expr\\AssignOp\\Mul' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php',
        'PhpParser\\Node\\Expr\\AssignOp\\Plus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php',
        'PhpParser\\Node\\Expr\\AssignOp\\Pow' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php',
        'PhpParser\\Node\\Expr\\AssignOp\\ShiftLeft' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php',
        'PhpParser\\Node\\Expr\\AssignOp\\ShiftRight' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php',
        'PhpParser\\Node\\Expr\\AssignRef' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php',
        'PhpParser\\Node\\Expr\\BinaryOp' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseXor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\BooleanAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\BooleanOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Coalesce' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Concat' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Div' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Equal' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Greater' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\GreaterOrEqual' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Identical' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\LogicalAnd' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\LogicalOr' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\LogicalXor' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Minus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Mod' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Mul' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\NotEqual' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\NotIdentical' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Plus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Pow' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\ShiftLeft' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\ShiftRight' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Smaller' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\SmallerOrEqual' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php',
        'PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php',
        'PhpParser\\Node\\Expr\\BitwiseNot' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php',
        'PhpParser\\Node\\Expr\\BooleanNot' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php',
        'PhpParser\\Node\\Expr\\Cast' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php',
        'PhpParser\\Node\\Expr\\Cast\\Array_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php',
        'PhpParser\\Node\\Expr\\Cast\\Bool_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php',
        'PhpParser\\Node\\Expr\\Cast\\Double' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php',
        'PhpParser\\Node\\Expr\\Cast\\Int_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php',
        'PhpParser\\Node\\Expr\\Cast\\Object_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php',
        'PhpParser\\Node\\Expr\\Cast\\String_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php',
        'PhpParser\\Node\\Expr\\Cast\\Unset_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php',
        'PhpParser\\Node\\Expr\\ClassConstFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php',
        'PhpParser\\Node\\Expr\\Clone_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php',
        'PhpParser\\Node\\Expr\\Closure' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php',
        'PhpParser\\Node\\Expr\\ClosureUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php',
        'PhpParser\\Node\\Expr\\ConstFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php',
        'PhpParser\\Node\\Expr\\Empty_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php',
        'PhpParser\\Node\\Expr\\Error' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php',
        'PhpParser\\Node\\Expr\\ErrorSuppress' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php',
        'PhpParser\\Node\\Expr\\Eval_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php',
        'PhpParser\\Node\\Expr\\Exit_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php',
        'PhpParser\\Node\\Expr\\FuncCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php',
        'PhpParser\\Node\\Expr\\Include_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php',
        'PhpParser\\Node\\Expr\\Instanceof_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php',
        'PhpParser\\Node\\Expr\\Isset_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php',
        'PhpParser\\Node\\Expr\\List_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php',
        'PhpParser\\Node\\Expr\\MethodCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php',
        'PhpParser\\Node\\Expr\\New_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php',
        'PhpParser\\Node\\Expr\\PostDec' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php',
        'PhpParser\\Node\\Expr\\PostInc' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php',
        'PhpParser\\Node\\Expr\\PreDec' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php',
        'PhpParser\\Node\\Expr\\PreInc' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php',
        'PhpParser\\Node\\Expr\\Print_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php',
        'PhpParser\\Node\\Expr\\PropertyFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php',
        'PhpParser\\Node\\Expr\\ShellExec' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php',
        'PhpParser\\Node\\Expr\\StaticCall' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php',
        'PhpParser\\Node\\Expr\\StaticPropertyFetch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php',
        'PhpParser\\Node\\Expr\\Ternary' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php',
        'PhpParser\\Node\\Expr\\UnaryMinus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php',
        'PhpParser\\Node\\Expr\\UnaryPlus' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php',
        'PhpParser\\Node\\Expr\\Variable' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php',
        'PhpParser\\Node\\Expr\\YieldFrom' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php',
        'PhpParser\\Node\\Expr\\Yield_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php',
        'PhpParser\\Node\\FunctionLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php',
        'PhpParser\\Node\\Name' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name.php',
        'PhpParser\\Node\\Name\\FullyQualified' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php',
        'PhpParser\\Node\\Name\\Relative' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php',
        'PhpParser\\Node\\NullableType' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/NullableType.php',
        'PhpParser\\Node\\Param' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Param.php',
        'PhpParser\\Node\\Scalar' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar.php',
        'PhpParser\\Node\\Scalar\\DNumber' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php',
        'PhpParser\\Node\\Scalar\\Encapsed' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php',
        'PhpParser\\Node\\Scalar\\EncapsedStringPart' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php',
        'PhpParser\\Node\\Scalar\\LNumber' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php',
        'PhpParser\\Node\\Scalar\\MagicConst' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php',
        'PhpParser\\Node\\Scalar\\MagicConst\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php',
        'PhpParser\\Node\\Scalar\\MagicConst\\Dir' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php',
        'PhpParser\\Node\\Scalar\\MagicConst\\File' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php',
        'PhpParser\\Node\\Scalar\\MagicConst\\Function_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php',
        'PhpParser\\Node\\Scalar\\MagicConst\\Line' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php',
        'PhpParser\\Node\\Scalar\\MagicConst\\Method' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php',
        'PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php',
        'PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php',
        'PhpParser\\Node\\Scalar\\String_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php',
        'PhpParser\\Node\\Stmt' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt.php',
        'PhpParser\\Node\\Stmt\\Break_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php',
        'PhpParser\\Node\\Stmt\\Case_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php',
        'PhpParser\\Node\\Stmt\\Catch_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php',
        'PhpParser\\Node\\Stmt\\ClassConst' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php',
        'PhpParser\\Node\\Stmt\\ClassLike' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php',
        'PhpParser\\Node\\Stmt\\ClassMethod' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php',
        'PhpParser\\Node\\Stmt\\Class_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php',
        'PhpParser\\Node\\Stmt\\Const_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php',
        'PhpParser\\Node\\Stmt\\Continue_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php',
        'PhpParser\\Node\\Stmt\\DeclareDeclare' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php',
        'PhpParser\\Node\\Stmt\\Declare_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php',
        'PhpParser\\Node\\Stmt\\Do_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php',
        'PhpParser\\Node\\Stmt\\Echo_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php',
        'PhpParser\\Node\\Stmt\\ElseIf_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php',
        'PhpParser\\Node\\Stmt\\Else_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php',
        'PhpParser\\Node\\Stmt\\Finally_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php',
        'PhpParser\\Node\\Stmt\\For_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php',
        'PhpParser\\Node\\Stmt\\Foreach_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php',
        'PhpParser\\Node\\Stmt\\Function_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php',
        'PhpParser\\Node\\Stmt\\Global_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php',
        'PhpParser\\Node\\Stmt\\Goto_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php',
        'PhpParser\\Node\\Stmt\\GroupUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php',
        'PhpParser\\Node\\Stmt\\HaltCompiler' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php',
        'PhpParser\\Node\\Stmt\\If_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php',
        'PhpParser\\Node\\Stmt\\InlineHTML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php',
        'PhpParser\\Node\\Stmt\\Interface_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php',
        'PhpParser\\Node\\Stmt\\Label' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php',
        'PhpParser\\Node\\Stmt\\Namespace_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php',
        'PhpParser\\Node\\Stmt\\Nop' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php',
        'PhpParser\\Node\\Stmt\\Property' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php',
        'PhpParser\\Node\\Stmt\\PropertyProperty' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php',
        'PhpParser\\Node\\Stmt\\Return_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php',
        'PhpParser\\Node\\Stmt\\StaticVar' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php',
        'PhpParser\\Node\\Stmt\\Static_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php',
        'PhpParser\\Node\\Stmt\\Switch_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php',
        'PhpParser\\Node\\Stmt\\Throw_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php',
        'PhpParser\\Node\\Stmt\\TraitUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php',
        'PhpParser\\Node\\Stmt\\TraitUseAdaptation' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php',
        'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php',
        'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Precedence' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php',
        'PhpParser\\Node\\Stmt\\Trait_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php',
        'PhpParser\\Node\\Stmt\\TryCatch' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php',
        'PhpParser\\Node\\Stmt\\Unset_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php',
        'PhpParser\\Node\\Stmt\\UseUse' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php',
        'PhpParser\\Node\\Stmt\\Use_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php',
        'PhpParser\\Node\\Stmt\\While_' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php',
        'PhpParser\\Parser' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser.php',
        'PhpParser\\ParserAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ParserAbstract.php',
        'PhpParser\\ParserFactory' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/ParserFactory.php',
        'PhpParser\\Parser\\Multiple' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Multiple.php',
        'PhpParser\\Parser\\Php5' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Php5.php',
        'PhpParser\\Parser\\Php7' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Php7.php',
        'PhpParser\\Parser\\Tokens' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Parser/Tokens.php',
        'PhpParser\\PrettyPrinterAbstract' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php',
        'PhpParser\\PrettyPrinter\\Standard' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php',
        'PhpParser\\Serializer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Serializer.php',
        'PhpParser\\Serializer\\XML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Serializer/XML.php',
        'PhpParser\\Unserializer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Unserializer.php',
        'PhpParser\\Unserializer\\XML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Unserializer/XML.php',
        'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php',
        'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php',
        'Psr\\Container\\NotFoundExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/NotFoundExceptionInterface.php',
        'Psy\\CodeCleaner' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner.php',
        'Psy\\CodeCleaner\\AbstractClassPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/AbstractClassPass.php',
        'Psy\\CodeCleaner\\AssignThisVariablePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php',
        'Psy\\CodeCleaner\\CallTimePassByReferencePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php',
        'Psy\\CodeCleaner\\CalledClassPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/CalledClassPass.php',
        'Psy\\CodeCleaner\\CodeCleanerPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/CodeCleanerPass.php',
        'Psy\\CodeCleaner\\EmptyArrayDimFetchPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/EmptyArrayDimFetchPass.php',
        'Psy\\CodeCleaner\\ExitPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/ExitPass.php',
        'Psy\\CodeCleaner\\FinalClassPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/FinalClassPass.php',
        'Psy\\CodeCleaner\\FunctionContextPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/FunctionContextPass.php',
        'Psy\\CodeCleaner\\FunctionReturnInWriteContextPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php',
        'Psy\\CodeCleaner\\ImplicitReturnPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php',
        'Psy\\CodeCleaner\\InstanceOfPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/InstanceOfPass.php',
        'Psy\\CodeCleaner\\LabelContextPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/LabelContextPass.php',
        'Psy\\CodeCleaner\\LeavePsyshAlonePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php',
        'Psy\\CodeCleaner\\ListPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/ListPass.php',
        'Psy\\CodeCleaner\\LoopContextPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/LoopContextPass.php',
        'Psy\\CodeCleaner\\MagicConstantsPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/MagicConstantsPass.php',
        'Psy\\CodeCleaner\\NamespaceAwarePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php',
        'Psy\\CodeCleaner\\NamespacePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/NamespacePass.php',
        'Psy\\CodeCleaner\\NoReturnValue' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/NoReturnValue.php',
        'Psy\\CodeCleaner\\PassableByReferencePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/PassableByReferencePass.php',
        'Psy\\CodeCleaner\\RequirePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/RequirePass.php',
        'Psy\\CodeCleaner\\StrictTypesPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/StrictTypesPass.php',
        'Psy\\CodeCleaner\\UseStatementPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/UseStatementPass.php',
        'Psy\\CodeCleaner\\ValidClassNamePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/ValidClassNamePass.php',
        'Psy\\CodeCleaner\\ValidConstantPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/ValidConstantPass.php',
        'Psy\\CodeCleaner\\ValidConstructorPass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/ValidConstructorPass.php',
        'Psy\\CodeCleaner\\ValidFunctionNamePass' => __DIR__ . '/..' . '/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php',
        'Psy\\Command\\BufferCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/BufferCommand.php',
        'Psy\\Command\\ClearCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/ClearCommand.php',
        'Psy\\Command\\Command' => __DIR__ . '/..' . '/psy/psysh/src/Command/Command.php',
        'Psy\\Command\\DocCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/DocCommand.php',
        'Psy\\Command\\DumpCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/DumpCommand.php',
        'Psy\\Command\\EditCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/EditCommand.php',
        'Psy\\Command\\ExitCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/ExitCommand.php',
        'Psy\\Command\\HelpCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/HelpCommand.php',
        'Psy\\Command\\HistoryCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/HistoryCommand.php',
        'Psy\\Command\\ListCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand.php',
        'Psy\\Command\\ListCommand\\ClassConstantEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php',
        'Psy\\Command\\ListCommand\\ClassEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/ClassEnumerator.php',
        'Psy\\Command\\ListCommand\\ConstantEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php',
        'Psy\\Command\\ListCommand\\Enumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/Enumerator.php',
        'Psy\\Command\\ListCommand\\FunctionEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php',
        'Psy\\Command\\ListCommand\\GlobalVariableEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php',
        'Psy\\Command\\ListCommand\\MethodEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/MethodEnumerator.php',
        'Psy\\Command\\ListCommand\\PropertyEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php',
        'Psy\\Command\\ListCommand\\VariableEnumerator' => __DIR__ . '/..' . '/psy/psysh/src/Command/ListCommand/VariableEnumerator.php',
        'Psy\\Command\\ParseCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/ParseCommand.php',
        'Psy\\Command\\PsyVersionCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/PsyVersionCommand.php',
        'Psy\\Command\\ReflectingCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/ReflectingCommand.php',
        'Psy\\Command\\ShowCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/ShowCommand.php',
        'Psy\\Command\\SudoCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/SudoCommand.php',
        'Psy\\Command\\ThrowUpCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/ThrowUpCommand.php',
        'Psy\\Command\\TimeitCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/TimeitCommand.php',
        'Psy\\Command\\TimeitCommand\\TimeitVisitor' => __DIR__ . '/..' . '/psy/psysh/src/Command/TimeitCommand/TimeitVisitor.php',
        'Psy\\Command\\TraceCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/TraceCommand.php',
        'Psy\\Command\\WhereamiCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/WhereamiCommand.php',
        'Psy\\Command\\WtfCommand' => __DIR__ . '/..' . '/psy/psysh/src/Command/WtfCommand.php',
        'Psy\\ConfigPaths' => __DIR__ . '/..' . '/psy/psysh/src/ConfigPaths.php',
        'Psy\\Configuration' => __DIR__ . '/..' . '/psy/psysh/src/Configuration.php',
        'Psy\\ConsoleColorFactory' => __DIR__ . '/..' . '/psy/psysh/src/ConsoleColorFactory.php',
        'Psy\\Context' => __DIR__ . '/..' . '/psy/psysh/src/Context.php',
        'Psy\\ContextAware' => __DIR__ . '/..' . '/psy/psysh/src/ContextAware.php',
        'Psy\\Exception\\BreakException' => __DIR__ . '/..' . '/psy/psysh/src/Exception/BreakException.php',
        'Psy\\Exception\\DeprecatedException' => __DIR__ . '/..' . '/psy/psysh/src/Exception/DeprecatedException.php',
        'Psy\\Exception\\ErrorException' => __DIR__ . '/..' . '/psy/psysh/src/Exception/ErrorException.php',
        'Psy\\Exception\\Exception' => __DIR__ . '/..' . '/psy/psysh/src/Exception/Exception.php',
        'Psy\\Exception\\FatalErrorException' => __DIR__ . '/..' . '/psy/psysh/src/Exception/FatalErrorException.php',
        'Psy\\Exception\\ParseErrorException' => __DIR__ . '/..' . '/psy/psysh/src/Exception/ParseErrorException.php',
        'Psy\\Exception\\RuntimeException' => __DIR__ . '/..' . '/psy/psysh/src/Exception/RuntimeException.php',
        'Psy\\Exception\\ThrowUpException' => __DIR__ . '/..' . '/psy/psysh/src/Exception/ThrowUpException.php',
        'Psy\\Exception\\TypeErrorException' => __DIR__ . '/..' . '/psy/psysh/src/Exception/TypeErrorException.php',
        'Psy\\ExecutionClosure' => __DIR__ . '/..' . '/psy/psysh/src/ExecutionClosure.php',
        'Psy\\ExecutionLoopClosure' => __DIR__ . '/..' . '/psy/psysh/src/ExecutionLoopClosure.php',
        'Psy\\ExecutionLoop\\AbstractListener' => __DIR__ . '/..' . '/psy/psysh/src/ExecutionLoop/AbstractListener.php',
        'Psy\\ExecutionLoop\\Listener' => __DIR__ . '/..' . '/psy/psysh/src/ExecutionLoop/Listener.php',
        'Psy\\ExecutionLoop\\ProcessForker' => __DIR__ . '/..' . '/psy/psysh/src/ExecutionLoop/ProcessForker.php',
        'Psy\\ExecutionLoop\\RunkitReloader' => __DIR__ . '/..' . '/psy/psysh/src/ExecutionLoop/RunkitReloader.php',
        'Psy\\Formatter\\CodeFormatter' => __DIR__ . '/..' . '/psy/psysh/src/Formatter/CodeFormatter.php',
        'Psy\\Formatter\\DocblockFormatter' => __DIR__ . '/..' . '/psy/psysh/src/Formatter/DocblockFormatter.php',
        'Psy\\Formatter\\Formatter' => __DIR__ . '/..' . '/psy/psysh/src/Formatter/Formatter.php',
        'Psy\\Formatter\\SignatureFormatter' => __DIR__ . '/..' . '/psy/psysh/src/Formatter/SignatureFormatter.php',
        'Psy\\Input\\CodeArgument' => __DIR__ . '/..' . '/psy/psysh/src/Input/CodeArgument.php',
        'Psy\\Input\\FilterOptions' => __DIR__ . '/..' . '/psy/psysh/src/Input/FilterOptions.php',
        'Psy\\Input\\ShellInput' => __DIR__ . '/..' . '/psy/psysh/src/Input/ShellInput.php',
        'Psy\\Input\\SilentInput' => __DIR__ . '/..' . '/psy/psysh/src/Input/SilentInput.php',
        'Psy\\Output\\OutputPager' => __DIR__ . '/..' . '/psy/psysh/src/Output/OutputPager.php',
        'Psy\\Output\\PassthruPager' => __DIR__ . '/..' . '/psy/psysh/src/Output/PassthruPager.php',
        'Psy\\Output\\ProcOutputPager' => __DIR__ . '/..' . '/psy/psysh/src/Output/ProcOutputPager.php',
        'Psy\\Output\\ShellOutput' => __DIR__ . '/..' . '/psy/psysh/src/Output/ShellOutput.php',
        'Psy\\ParserFactory' => __DIR__ . '/..' . '/psy/psysh/src/ParserFactory.php',
        'Psy\\Readline\\GNUReadline' => __DIR__ . '/..' . '/psy/psysh/src/Readline/GNUReadline.php',
        'Psy\\Readline\\HoaConsole' => __DIR__ . '/..' . '/psy/psysh/src/Readline/HoaConsole.php',
        'Psy\\Readline\\Libedit' => __DIR__ . '/..' . '/psy/psysh/src/Readline/Libedit.php',
        'Psy\\Readline\\Readline' => __DIR__ . '/..' . '/psy/psysh/src/Readline/Readline.php',
        'Psy\\Readline\\Transient' => __DIR__ . '/..' . '/psy/psysh/src/Readline/Transient.php',
        'Psy\\Reflection\\ReflectionClassConstant' => __DIR__ . '/..' . '/psy/psysh/src/Reflection/ReflectionClassConstant.php',
        'Psy\\Reflection\\ReflectionConstant' => __DIR__ . '/..' . '/psy/psysh/src/Reflection/ReflectionConstant.php',
        'Psy\\Reflection\\ReflectionConstant_' => __DIR__ . '/..' . '/psy/psysh/src/Reflection/ReflectionConstant_.php',
        'Psy\\Reflection\\ReflectionLanguageConstruct' => __DIR__ . '/..' . '/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php',
        'Psy\\Reflection\\ReflectionLanguageConstructParameter' => __DIR__ . '/..' . '/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php',
        'Psy\\Shell' => __DIR__ . '/..' . '/psy/psysh/src/Shell.php',
        'Psy\\Sudo' => __DIR__ . '/..' . '/psy/psysh/src/Sudo.php',
        'Psy\\Sudo\\SudoVisitor' => __DIR__ . '/..' . '/psy/psysh/src/Sudo/SudoVisitor.php',
        'Psy\\TabCompletion\\AutoCompleter' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/AutoCompleter.php',
        'Psy\\TabCompletion\\Matcher\\AbstractContextAwareMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php',
        'Psy\\TabCompletion\\Matcher\\AbstractDefaultParametersMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php',
        'Psy\\TabCompletion\\Matcher\\AbstractMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php',
        'Psy\\TabCompletion\\Matcher\\ClassAttributesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php',
        'Psy\\TabCompletion\\Matcher\\ClassMethodDefaultParametersMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php',
        'Psy\\TabCompletion\\Matcher\\ClassMethodsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php',
        'Psy\\TabCompletion\\Matcher\\ClassNamesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php',
        'Psy\\TabCompletion\\Matcher\\CommandsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php',
        'Psy\\TabCompletion\\Matcher\\ConstantsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php',
        'Psy\\TabCompletion\\Matcher\\FunctionDefaultParametersMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php',
        'Psy\\TabCompletion\\Matcher\\FunctionsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php',
        'Psy\\TabCompletion\\Matcher\\KeywordsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php',
        'Psy\\TabCompletion\\Matcher\\MongoClientMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php',
        'Psy\\TabCompletion\\Matcher\\MongoDatabaseMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php',
        'Psy\\TabCompletion\\Matcher\\ObjectAttributesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php',
        'Psy\\TabCompletion\\Matcher\\ObjectMethodDefaultParametersMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php',
        'Psy\\TabCompletion\\Matcher\\ObjectMethodsMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php',
        'Psy\\TabCompletion\\Matcher\\VariablesMatcher' => __DIR__ . '/..' . '/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php',
        'Psy\\Util\\Docblock' => __DIR__ . '/..' . '/psy/psysh/src/Util/Docblock.php',
        'Psy\\Util\\Json' => __DIR__ . '/..' . '/psy/psysh/src/Util/Json.php',
        'Psy\\Util\\Mirror' => __DIR__ . '/..' . '/psy/psysh/src/Util/Mirror.php',
        'Psy\\Util\\Str' => __DIR__ . '/..' . '/psy/psysh/src/Util/Str.php',
        'Psy\\VarDumper\\Cloner' => __DIR__ . '/..' . '/psy/psysh/src/VarDumper/Cloner.php',
        'Psy\\VarDumper\\Dumper' => __DIR__ . '/..' . '/psy/psysh/src/VarDumper/Dumper.php',
        'Psy\\VarDumper\\Presenter' => __DIR__ . '/..' . '/psy/psysh/src/VarDumper/Presenter.php',
        'Psy\\VarDumper\\PresenterAware' => __DIR__ . '/..' . '/psy/psysh/src/VarDumper/PresenterAware.php',
        'Psy\\VersionUpdater\\Checker' => __DIR__ . '/..' . '/psy/psysh/src/VersionUpdater/Checker.php',
        'Psy\\VersionUpdater\\GitHubChecker' => __DIR__ . '/..' . '/psy/psysh/src/VersionUpdater/GitHubChecker.php',
        'Psy\\VersionUpdater\\IntervalChecker' => __DIR__ . '/..' . '/psy/psysh/src/VersionUpdater/IntervalChecker.php',
        'Psy\\VersionUpdater\\NoopChecker' => __DIR__ . '/..' . '/psy/psysh/src/VersionUpdater/NoopChecker.php',
        'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
        'Symfony\\Component\\Console\\Application' => __DIR__ . '/..' . '/symfony/console/Application.php',
        'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => __DIR__ . '/..' . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
        'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/ContainerCommandLoader.php',
        'Symfony\\Component\\Console\\CommandLoader\\FactoryCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/FactoryCommandLoader.php',
        'Symfony\\Component\\Console\\Command\\Command' => __DIR__ . '/..' . '/symfony/console/Command/Command.php',
        'Symfony\\Component\\Console\\Command\\HelpCommand' => __DIR__ . '/..' . '/symfony/console/Command/HelpCommand.php',
        'Symfony\\Component\\Console\\Command\\ListCommand' => __DIR__ . '/..' . '/symfony/console/Command/ListCommand.php',
        'Symfony\\Component\\Console\\Command\\LockableTrait' => __DIR__ . '/..' . '/symfony/console/Command/LockableTrait.php',
        'Symfony\\Component\\Console\\ConsoleEvents' => __DIR__ . '/..' . '/symfony/console/ConsoleEvents.php',
        'Symfony\\Component\\Console\\DependencyInjection\\AddConsoleCommandPass' => __DIR__ . '/..' . '/symfony/console/DependencyInjection/AddConsoleCommandPass.php',
        'Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => __DIR__ . '/..' . '/symfony/console/Descriptor/ApplicationDescription.php',
        'Symfony\\Component\\Console\\Descriptor\\Descriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/Descriptor.php',
        'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => __DIR__ . '/..' . '/symfony/console/Descriptor/DescriptorInterface.php',
        'Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/JsonDescriptor.php',
        'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/MarkdownDescriptor.php',
        'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/TextDescriptor.php',
        'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/XmlDescriptor.php',
        'Symfony\\Component\\Console\\EventListener\\ErrorListener' => __DIR__ . '/..' . '/symfony/console/EventListener/ErrorListener.php',
        'Symfony\\Component\\Console\\Event\\ConsoleCommandEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleCommandEvent.php',
        'Symfony\\Component\\Console\\Event\\ConsoleErrorEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleErrorEvent.php',
        'Symfony\\Component\\Console\\Event\\ConsoleEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleEvent.php',
        'Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleTerminateEvent.php',
        'Symfony\\Component\\Console\\Exception\\CommandNotFoundException' => __DIR__ . '/..' . '/symfony/console/Exception/CommandNotFoundException.php',
        'Symfony\\Component\\Console\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/console/Exception/ExceptionInterface.php',
        'Symfony\\Component\\Console\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/console/Exception/InvalidArgumentException.php',
        'Symfony\\Component\\Console\\Exception\\InvalidOptionException' => __DIR__ . '/..' . '/symfony/console/Exception/InvalidOptionException.php',
        'Symfony\\Component\\Console\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/console/Exception/LogicException.php',
        'Symfony\\Component\\Console\\Exception\\MissingInputException' => __DIR__ . '/..' . '/symfony/console/Exception/MissingInputException.php',
        'Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException' => __DIR__ . '/..' . '/symfony/console/Exception/NamespaceNotFoundException.php',
        'Symfony\\Component\\Console\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/console/Exception/RuntimeException.php',
        'Symfony\\Component\\Console\\Formatter\\OutputFormatter' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatter.php',
        'Symfony\\Component\\Console\\Formatter\\OutputFormatterInterface' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterInterface.php',
        'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterStyle.php',
        'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleInterface' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterStyleInterface.php',
        'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleStack' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterStyleStack.php',
        'Symfony\\Component\\Console\\Formatter\\WrappableOutputFormatterInterface' => __DIR__ . '/..' . '/symfony/console/Formatter/WrappableOutputFormatterInterface.php',
        'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DebugFormatterHelper.php',
        'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DescriptorHelper.php',
        'Symfony\\Component\\Console\\Helper\\Dumper' => __DIR__ . '/..' . '/symfony/console/Helper/Dumper.php',
        'Symfony\\Component\\Console\\Helper\\FormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/FormatterHelper.php',
        'Symfony\\Component\\Console\\Helper\\Helper' => __DIR__ . '/..' . '/symfony/console/Helper/Helper.php',
        'Symfony\\Component\\Console\\Helper\\HelperInterface' => __DIR__ . '/..' . '/symfony/console/Helper/HelperInterface.php',
        'Symfony\\Component\\Console\\Helper\\HelperSet' => __DIR__ . '/..' . '/symfony/console/Helper/HelperSet.php',
        'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => __DIR__ . '/..' . '/symfony/console/Helper/InputAwareHelper.php',
        'Symfony\\Component\\Console\\Helper\\ProcessHelper' => __DIR__ . '/..' . '/symfony/console/Helper/ProcessHelper.php',
        'Symfony\\Component\\Console\\Helper\\ProgressBar' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressBar.php',
        'Symfony\\Component\\Console\\Helper\\ProgressIndicator' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressIndicator.php',
        'Symfony\\Component\\Console\\Helper\\QuestionHelper' => __DIR__ . '/..' . '/symfony/console/Helper/QuestionHelper.php',
        'Symfony\\Component\\Console\\Helper\\SymfonyQuestionHelper' => __DIR__ . '/..' . '/symfony/console/Helper/SymfonyQuestionHelper.php',
        'Symfony\\Component\\Console\\Helper\\Table' => __DIR__ . '/..' . '/symfony/console/Helper/Table.php',
        'Symfony\\Component\\Console\\Helper\\TableCell' => __DIR__ . '/..' . '/symfony/console/Helper/TableCell.php',
        'Symfony\\Component\\Console\\Helper\\TableRows' => __DIR__ . '/..' . '/symfony/console/Helper/TableRows.php',
        'Symfony\\Component\\Console\\Helper\\TableSeparator' => __DIR__ . '/..' . '/symfony/console/Helper/TableSeparator.php',
        'Symfony\\Component\\Console\\Helper\\TableStyle' => __DIR__ . '/..' . '/symfony/console/Helper/TableStyle.php',
        'Symfony\\Component\\Console\\Input\\ArgvInput' => __DIR__ . '/..' . '/symfony/console/Input/ArgvInput.php',
        'Symfony\\Component\\Console\\Input\\ArrayInput' => __DIR__ . '/..' . '/symfony/console/Input/ArrayInput.php',
        'Symfony\\Component\\Console\\Input\\Input' => __DIR__ . '/..' . '/symfony/console/Input/Input.php',
        'Symfony\\Component\\Console\\Input\\InputArgument' => __DIR__ . '/..' . '/symfony/console/Input/InputArgument.php',
        'Symfony\\Component\\Console\\Input\\InputAwareInterface' => __DIR__ . '/..' . '/symfony/console/Input/InputAwareInterface.php',
        'Symfony\\Component\\Console\\Input\\InputDefinition' => __DIR__ . '/..' . '/symfony/console/Input/InputDefinition.php',
        'Symfony\\Component\\Console\\Input\\InputInterface' => __DIR__ . '/..' . '/symfony/console/Input/InputInterface.php',
        'Symfony\\Component\\Console\\Input\\InputOption' => __DIR__ . '/..' . '/symfony/console/Input/InputOption.php',
        'Symfony\\Component\\Console\\Input\\StreamableInputInterface' => __DIR__ . '/..' . '/symfony/console/Input/StreamableInputInterface.php',
        'Symfony\\Component\\Console\\Input\\StringInput' => __DIR__ . '/..' . '/symfony/console/Input/StringInput.php',
        'Symfony\\Component\\Console\\Logger\\ConsoleLogger' => __DIR__ . '/..' . '/symfony/console/Logger/ConsoleLogger.php',
        'Symfony\\Component\\Console\\Output\\BufferedOutput' => __DIR__ . '/..' . '/symfony/console/Output/BufferedOutput.php',
        'Symfony\\Component\\Console\\Output\\ConsoleOutput' => __DIR__ . '/..' . '/symfony/console/Output/ConsoleOutput.php',
        'Symfony\\Component\\Console\\Output\\ConsoleOutputInterface' => __DIR__ . '/..' . '/symfony/console/Output/ConsoleOutputInterface.php',
        'Symfony\\Component\\Console\\Output\\ConsoleSectionOutput' => __DIR__ . '/..' . '/symfony/console/Output/ConsoleSectionOutput.php',
        'Symfony\\Component\\Console\\Output\\NullOutput' => __DIR__ . '/..' . '/symfony/console/Output/NullOutput.php',
        'Symfony\\Component\\Console\\Output\\Output' => __DIR__ . '/..' . '/symfony/console/Output/Output.php',
        'Symfony\\Component\\Console\\Output\\OutputInterface' => __DIR__ . '/..' . '/symfony/console/Output/OutputInterface.php',
        'Symfony\\Component\\Console\\Output\\StreamOutput' => __DIR__ . '/..' . '/symfony/console/Output/StreamOutput.php',
        'Symfony\\Component\\Console\\Output\\TrimmedBufferOutput' => __DIR__ . '/..' . '/symfony/console/Output/TrimmedBufferOutput.php',
        'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ChoiceQuestion.php',
        'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ConfirmationQuestion.php',
        'Symfony\\Component\\Console\\Question\\Question' => __DIR__ . '/..' . '/symfony/console/Question/Question.php',
        'Symfony\\Component\\Console\\Style\\OutputStyle' => __DIR__ . '/..' . '/symfony/console/Style/OutputStyle.php',
        'Symfony\\Component\\Console\\Style\\StyleInterface' => __DIR__ . '/..' . '/symfony/console/Style/StyleInterface.php',
        'Symfony\\Component\\Console\\Style\\SymfonyStyle' => __DIR__ . '/..' . '/symfony/console/Style/SymfonyStyle.php',
        'Symfony\\Component\\Console\\Terminal' => __DIR__ . '/..' . '/symfony/console/Terminal.php',
        'Symfony\\Component\\Console\\Tester\\ApplicationTester' => __DIR__ . '/..' . '/symfony/console/Tester/ApplicationTester.php',
        'Symfony\\Component\\Console\\Tester\\CommandTester' => __DIR__ . '/..' . '/symfony/console/Tester/CommandTester.php',
        'Symfony\\Component\\Console\\Tester\\TesterTrait' => __DIR__ . '/..' . '/symfony/console/Tester/TesterTrait.php',
        'Symfony\\Component\\Filesystem\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/filesystem/Exception/ExceptionInterface.php',
        'Symfony\\Component\\Filesystem\\Exception\\FileNotFoundException' => __DIR__ . '/..' . '/symfony/filesystem/Exception/FileNotFoundException.php',
        'Symfony\\Component\\Filesystem\\Exception\\IOException' => __DIR__ . '/..' . '/symfony/filesystem/Exception/IOException.php',
        'Symfony\\Component\\Filesystem\\Exception\\IOExceptionInterface' => __DIR__ . '/..' . '/symfony/filesystem/Exception/IOExceptionInterface.php',
        'Symfony\\Component\\Filesystem\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/filesystem/Exception/InvalidArgumentException.php',
        'Symfony\\Component\\Filesystem\\Filesystem' => __DIR__ . '/..' . '/symfony/filesystem/Filesystem.php',
        'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/process/Exception/ExceptionInterface.php',
        'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/process/Exception/InvalidArgumentException.php',
        'Symfony\\Component\\Process\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/process/Exception/LogicException.php',
        'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessFailedException.php',
        'Symfony\\Component\\Process\\Exception\\ProcessSignaledException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessSignaledException.php',
        'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessTimedOutException.php',
        'Symfony\\Component\\Process\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/process/Exception/RuntimeException.php',
        'Symfony\\Component\\Process\\ExecutableFinder' => __DIR__ . '/..' . '/symfony/process/ExecutableFinder.php',
        'Symfony\\Component\\Process\\InputStream' => __DIR__ . '/..' . '/symfony/process/InputStream.php',
        'Symfony\\Component\\Process\\PhpExecutableFinder' => __DIR__ . '/..' . '/symfony/process/PhpExecutableFinder.php',
        'Symfony\\Component\\Process\\PhpProcess' => __DIR__ . '/..' . '/symfony/process/PhpProcess.php',
        'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/AbstractPipes.php',
        'Symfony\\Component\\Process\\Pipes\\PipesInterface' => __DIR__ . '/..' . '/symfony/process/Pipes/PipesInterface.php',
        'Symfony\\Component\\Process\\Pipes\\UnixPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/UnixPipes.php',
        'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/WindowsPipes.php',
        'Symfony\\Component\\Process\\Process' => __DIR__ . '/..' . '/symfony/process/Process.php',
        'Symfony\\Component\\Process\\ProcessUtils' => __DIR__ . '/..' . '/symfony/process/ProcessUtils.php',
        'Symfony\\Component\\VarDumper\\Caster\\AmqpCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/AmqpCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\ArgsStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ArgsStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\Caster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/Caster.php',
        'Symfony\\Component\\VarDumper\\Caster\\ClassStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ClassStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\ConstStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ConstStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\CutArrayStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/CutArrayStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\CutStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/CutStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\DOMCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/DOMCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\DateCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/DateCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\DoctrineCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/DoctrineCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\EnumStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/EnumStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\ExceptionCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ExceptionCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\FrameStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/FrameStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\LinkStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/LinkStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\MongoCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/MongoCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\PdoCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/PdoCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\PgSqlCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/PgSqlCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\RedisCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/RedisCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\ReflectionCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ReflectionCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\ResourceCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/ResourceCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\SplCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/SplCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\StubCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/StubCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\SymfonyCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/SymfonyCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\TraceStub' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/TraceStub.php',
        'Symfony\\Component\\VarDumper\\Caster\\XmlReaderCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/XmlReaderCaster.php',
        'Symfony\\Component\\VarDumper\\Caster\\XmlResourceCaster' => __DIR__ . '/..' . '/symfony/var-dumper/Caster/XmlResourceCaster.php',
        'Symfony\\Component\\VarDumper\\Cloner\\AbstractCloner' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/AbstractCloner.php',
        'Symfony\\Component\\VarDumper\\Cloner\\ClonerInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/ClonerInterface.php',
        'Symfony\\Component\\VarDumper\\Cloner\\Cursor' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/Cursor.php',
        'Symfony\\Component\\VarDumper\\Cloner\\Data' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/Data.php',
        'Symfony\\Component\\VarDumper\\Cloner\\DumperInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/DumperInterface.php',
        'Symfony\\Component\\VarDumper\\Cloner\\Stub' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/Stub.php',
        'Symfony\\Component\\VarDumper\\Cloner\\VarCloner' => __DIR__ . '/..' . '/symfony/var-dumper/Cloner/VarCloner.php',
        'Symfony\\Component\\VarDumper\\Dumper\\AbstractDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/AbstractDumper.php',
        'Symfony\\Component\\VarDumper\\Dumper\\CliDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/CliDumper.php',
        'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/DataDumperInterface.php',
        'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => __DIR__ . '/..' . '/symfony/var-dumper/Dumper/HtmlDumper.php',
        'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => __DIR__ . '/..' . '/symfony/var-dumper/Exception/ThrowingCasterException.php',
        'Symfony\\Component\\VarDumper\\VarDumper' => __DIR__ . '/..' . '/symfony/var-dumper/VarDumper.php',
        'Symfony\\Contracts\\Service\\ResetInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ResetInterface.php',
        'Symfony\\Contracts\\Service\\ServiceLocatorTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceLocatorTrait.php',
        'Symfony\\Contracts\\Service\\ServiceProviderInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceProviderInterface.php',
        'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberInterface.php',
        'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberTrait.php',
        'Symfony\\Polyfill\\Ctype\\Ctype' => __DIR__ . '/..' . '/symfony/polyfill-ctype/Ctype.php',
        'Symfony\\Polyfill\\Mbstring\\Mbstring' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/Mbstring.php',
        'Symfony\\Polyfill\\Php73\\Php73' => __DIR__ . '/..' . '/symfony/polyfill-php73/Php73.php',
        'Symfony\\Polyfill\\Php80\\Php80' => __DIR__ . '/..' . '/symfony/polyfill-php80/Php80.php',
        'TOGoS_GitIgnore_FileFinder' => __DIR__ . '/..' . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php',
        'TOGoS_GitIgnore_Pattern' => __DIR__ . '/..' . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php',
        'TOGoS_GitIgnore_Rule' => __DIR__ . '/..' . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php',
        'TOGoS_GitIgnore_Ruleset' => __DIR__ . '/..' . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php',
        'TOGoS_GitIgnore_Util' => __DIR__ . '/..' . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php',
        'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
        'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
        'XdgBaseDir\\Xdg' => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src/Xdg.php',
    );

    public static function getInitializer(ClassLoader $loader)
    {
        return \Closure::bind(function () use ($loader) {
            $loader->prefixLengthsPsr4 = ComposerStaticInit7147d1bba87fa1560cd1235a618ce161::$prefixLengthsPsr4;
            $loader->prefixDirsPsr4 = ComposerStaticInit7147d1bba87fa1560cd1235a618ce161::$prefixDirsPsr4;
            $loader->prefixesPsr0 = ComposerStaticInit7147d1bba87fa1560cd1235a618ce161::$prefixesPsr0;
            $loader->classMap = ComposerStaticInit7147d1bba87fa1560cd1235a618ce161::$classMap;

        }, null, ClassLoader::class);
    }
}
<?php

/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <[email protected]>
 *     Jordi Boggiano <[email protected]>
 *
 * 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, PSR-4 and classmap class loader.
 *
 *     $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 <[email protected]>
 * @author Jordi Boggiano <[email protected]>
 * @see    http://www.php-fig.org/psr/psr-0/
 * @see    http://www.php-fig.org/psr/psr-4/
 */
class ClassLoader
{
    // PSR-4
    private $prefixLengthsPsr4 = array();
    private $prefixDirsPsr4 = array();
    private $fallbackDirsPsr4 = array();

    // PSR-0
    private $prefixesPsr0 = array();
    private $fallbackDirsPsr0 = array();

    private $useIncludePath = false;
    private $classMap = array();
    private $classMapAuthoritative = false;
    private $missingClasses = array();
    private $apcuPrefix;

    public function getPrefixes()
    {
        if (!empty($this->prefixesPsr0)) {
            return call_user_func_array('array_merge', $this->prefixesPsr0);
        }

        return array();
    }

    public function getPrefixesPsr4()
    {
        return $this->prefixDirsPsr4;
    }

    public function getFallbackDirs()
    {
        return $this->fallbackDirsPsr0;
    }

    public function getFallbackDirsPsr4()
    {
        return $this->fallbackDirsPsr4;
    }

    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 PSR-0 directories for a given prefix, either
     * appending or prepending to the ones previously set for this prefix.
     *
     * @param string       $prefix  The prefix
     * @param array|string $paths   The PSR-0 root directories
     * @param bool         $prepend Whether to prepend the directories
     */
    public function add($prefix, $paths, $prepend = false)
    {
        if (!$prefix) {
            if ($prepend) {
                $this->fallbackDirsPsr0 = array_merge(
                    (array) $paths,
                    $this->fallbackDirsPsr0
                );
            } else {
                $this->fallbackDirsPsr0 = array_merge(
                    $this->fallbackDirsPsr0,
                    (array) $paths
                );
            }

            return;
        }

        $first = $prefix[0];
        if (!isset($this->prefixesPsr0[$first][$prefix])) {
            $this->prefixesPsr0[$first][$prefix] = (array) $paths;

            return;
        }
        if ($prepend) {
            $this->prefixesPsr0[$first][$prefix] = array_merge(
                (array) $paths,
                $this->prefixesPsr0[$first][$prefix]
            );
        } else {
            $this->prefixesPsr0[$first][$prefix] = array_merge(
                $this->prefixesPsr0[$first][$prefix],
                (array) $paths
            );
        }
    }

    /**
     * Registers a set of PSR-4 directories for a given namespace, either
     * appending or prepending to the ones previously set for this namespace.
     *
     * @param string       $prefix  The prefix/namespace, with trailing '\\'
     * @param array|string $paths   The PSR-4 base directories
     * @param bool         $prepend Whether to prepend the directories
     *
     * @throws \InvalidArgumentException
     */
    public function addPsr4($prefix, $paths, $prepend = false)
    {
        if (!$prefix) {
            // Register directories for the root namespace.
            if ($prepend) {
                $this->fallbackDirsPsr4 = array_merge(
                    (array) $paths,
                    $this->fallbackDirsPsr4
                );
            } else {
                $this->fallbackDirsPsr4 = array_merge(
                    $this->fallbackDirsPsr4,
                    (array) $paths
                );
            }
        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
            // Register directories for a new namespace.
            $length = strlen($prefix);
            if ('\\' !== $prefix[$length - 1]) {
                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
            }
            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
            $this->prefixDirsPsr4[$prefix] = (array) $paths;
        } elseif ($prepend) {
            // Prepend directories for an already registered namespace.
            $this->prefixDirsPsr4[$prefix] = array_merge(
                (array) $paths,
                $this->prefixDirsPsr4[$prefix]
            );
        } else {
            // Append directories for an already registered namespace.
            $this->prefixDirsPsr4[$prefix] = array_merge(
                $this->prefixDirsPsr4[$prefix],
                (array) $paths
            );
        }
    }

    /**
     * Registers a set of PSR-0 directories for a given prefix,
     * replacing any others previously set for this prefix.
     *
     * @param string       $prefix The prefix
     * @param array|string $paths  The PSR-0 base directories
     */
    public function set($prefix, $paths)
    {
        if (!$prefix) {
            $this->fallbackDirsPsr0 = (array) $paths;
        } else {
            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
        }
    }

    /**
     * Registers a set of PSR-4 directories for a given namespace,
     * replacing any others previously set for this namespace.
     *
     * @param string       $prefix The prefix/namespace, with trailing '\\'
     * @param array|string $paths  The PSR-4 base directories
     *
     * @throws \InvalidArgumentException
     */
    public function setPsr4($prefix, $paths)
    {
        if (!$prefix) {
            $this->fallbackDirsPsr4 = (array) $paths;
        } else {
            $length = strlen($prefix);
            if ('\\' !== $prefix[$length - 1]) {
                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
            }
            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
            $this->prefixDirsPsr4[$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;
    }

    /**
     * Turns off searching the prefix and fallback directories for classes
     * that have not been registered with the class map.
     *
     * @param bool $classMapAuthoritative
     */
    public function setClassMapAuthoritative($classMapAuthoritative)
    {
        $this->classMapAuthoritative = $classMapAuthoritative;
    }

    /**
     * Should class lookup fail if not found in the current class map?
     *
     * @return bool
     */
    public function isClassMapAuthoritative()
    {
        return $this->classMapAuthoritative;
    }

    /**
     * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
     *
     * @param string|null $apcuPrefix
     */
    public function setApcuPrefix($apcuPrefix)
    {
        $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
    }

    /**
     * The APCu prefix in use, or null if APCu caching is not enabled.
     *
     * @return string|null
     */
    public function getApcuPrefix()
    {
        return $this->apcuPrefix;
    }

    /**
     * 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)) {
            includeFile($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)
    {
        // class map lookup
        if (isset($this->classMap[$class])) {
            return $this->classMap[$class];
        }
        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
            return false;
        }
        if (null !== $this->apcuPrefix) {
            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
            if ($hit) {
                return $file;
            }
        }

        $file = $this->findFileWithExtension($class, '.php');

        // Search for Hack files if we are running on HHVM
        if (false === $file && defined('HHVM_VERSION')) {
            $file = $this->findFileWithExtension($class, '.hh');
        }

        if (null !== $this->apcuPrefix) {
            apcu_add($this->apcuPrefix.$class, $file);
        }

        if (false === $file) {
            // Remember that this class does not exist.
            $this->missingClasses[$class] = true;
        }

        return $file;
    }

    private function findFileWithExtension($class, $ext)
    {
        // PSR-4 lookup
        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;

        $first = $class[0];
        if (isset($this->prefixLengthsPsr4[$first])) {
            $subPath = $class;
            while (false !== $lastPos = strrpos($subPath, '\\')) {
                $subPath = substr($subPath, 0, $lastPos);
                $search = $subPath . '\\';
                if (isset($this->prefixDirsPsr4[$search])) {
                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
                    foreach ($this->prefixDirsPsr4[$search] as $dir) {
                        if (file_exists($file = $dir . $pathEnd)) {
                            return $file;
                        }
                    }
                }
            }
        }

        // PSR-4 fallback dirs
        foreach ($this->fallbackDirsPsr4 as $dir) {
            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
                return $file;
            }
        }

        // PSR-0 lookup
        if (false !== $pos = strrpos($class, '\\')) {
            // namespaced class name
            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
        } else {
            // PEAR-like class name
            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
        }

        if (isset($this->prefixesPsr0[$first])) {
            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
                if (0 === strpos($class, $prefix)) {
                    foreach ($dirs as $dir) {
                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
                            return $file;
                        }
                    }
                }
            }
        }

        // PSR-0 fallback dirs
        foreach ($this->fallbackDirsPsr0 as $dir) {
            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
                return $file;
            }
        }

        // PSR-0 include paths.
        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
            return $file;
        }

        return false;
    }
}

/**
 * Scope isolated include.
 *
 * Prevents access to $this/self from included files.
 */
function includeFile($file)
{
    include $file;
}
<?php

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit7147d1bba87fa1560cd1235a618ce161
{
    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('ComposerAutoloaderInit7147d1bba87fa1560cd1235a618ce161', 'loadClassLoader'), true, true);
        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
        spl_autoload_unregister(array('ComposerAutoloaderInit7147d1bba87fa1560cd1235a618ce161', 'loadClassLoader'));

        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
        if ($useStaticLoader) {
            require_once __DIR__ . '/autoload_static.php';

            call_user_func(\Composer\Autoload\ComposerStaticInit7147d1bba87fa1560cd1235a618ce161::getInitializer($loader));
        } else {
            $classMap = require __DIR__ . '/autoload_classmap.php';
            if ($classMap) {
                $loader->addClassMap($classMap);
            }
        }

        $loader->setClassMapAuthoritative(true);
        $loader->register(true);

        if ($useStaticLoader) {
            $includeFiles = Composer\Autoload\ComposerStaticInit7147d1bba87fa1560cd1235a618ce161::$files;
        } else {
            $includeFiles = require __DIR__ . '/autoload_files.php';
        }
        foreach ($includeFiles as $fileIdentifier => $file) {
            composerRequire7147d1bba87fa1560cd1235a618ce161($fileIdentifier, $file);
        }

        return $loader;
    }
}

function composerRequire7147d1bba87fa1560cd1235a618ce161($fileIdentifier, $file)
{
    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
        require $file;

        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    }
}
<?php

// autoload_classmap.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
    'Civi\\Cv\\Application' => $baseDir . '/src/Application.php',
    'Civi\\Cv\\Bootstrap' => $baseDir . '/src/Bootstrap.php',
    'Civi\\Cv\\BuildkitReader' => $baseDir . '/src/BuildkitReader.php',
    'Civi\\Cv\\CmsBootstrap' => $baseDir . '/src/CmsBootstrap.php',
    'Civi\\Cv\\Command\\AngularHtmlListCommand' => $baseDir . '/src/Command/AngularHtmlListCommand.php',
    'Civi\\Cv\\Command\\AngularHtmlShowCommand' => $baseDir . '/src/Command/AngularHtmlShowCommand.php',
    'Civi\\Cv\\Command\\AngularModuleListCommand' => $baseDir . '/src/Command/AngularModuleListCommand.php',
    'Civi\\Cv\\Command\\Api4Command' => $baseDir . '/src/Command/Api4Command.php',
    'Civi\\Cv\\Command\\ApiBatchCommand' => $baseDir . '/src/Command/ApiBatchCommand.php',
    'Civi\\Cv\\Command\\ApiCommand' => $baseDir . '/src/Command/ApiCommand.php',
    'Civi\\Cv\\Command\\BaseCommand' => $baseDir . '/src/Command/BaseCommand.php',
    'Civi\\Cv\\Command\\BaseExtensionCommand' => $baseDir . '/src/Command/BaseExtensionCommand.php',
    'Civi\\Cv\\Command\\BootCommand' => $baseDir . '/src/Command/BootCommand.php',
    'Civi\\Cv\\Command\\CliCommand' => $baseDir . '/src/Command/CliCommand.php',
    'Civi\\Cv\\Command\\CoreCheckReqCommand' => $baseDir . '/src/Command/CoreCheckReqCommand.php',
    'Civi\\Cv\\Command\\CoreInstallCommand' => $baseDir . '/src/Command/CoreInstallCommand.php',
    'Civi\\Cv\\Command\\CoreUninstallCommand' => $baseDir . '/src/Command/CoreUninstallCommand.php',
    'Civi\\Cv\\Command\\DebugContainerCommand' => $baseDir . '/src/Command/DebugContainerCommand.php',
    'Civi\\Cv\\Command\\DebugDispatcherCommand' => $baseDir . '/src/Command/DebugDispatcherCommand.php',
    'Civi\\Cv\\Command\\EditCommand' => $baseDir . '/src/Command/EditCommand.php',
    'Civi\\Cv\\Command\\EvalCommand' => $baseDir . '/src/Command/EvalCommand.php',
    'Civi\\Cv\\Command\\ExtensionDisableCommand' => $baseDir . '/src/Command/ExtensionDisableCommand.php',
    'Civi\\Cv\\Command\\ExtensionDownloadCommand' => $baseDir . '/src/Command/ExtensionDownloadCommand.php',
    'Civi\\Cv\\Command\\ExtensionEnableCommand' => $baseDir . '/src/Command/ExtensionEnableCommand.php',
    'Civi\\Cv\\Command\\ExtensionListCommand' => $baseDir . '/src/Command/ExtensionListCommand.php',
    'Civi\\Cv\\Command\\ExtensionUninstallCommand' => $baseDir . '/src/Command/ExtensionUninstallCommand.php',
    'Civi\\Cv\\Command\\ExtensionUpgradeDbCommand' => $baseDir . '/src/Command/ExtensionUpgradeDbCommand.php',
    'Civi\\Cv\\Command\\FillCommand' => $baseDir . '/src/Command/FillCommand.php',
    'Civi\\Cv\\Command\\FlushCommand' => $baseDir . '/src/Command/FlushCommand.php',
    'Civi\\Cv\\Command\\PathCommand' => $baseDir . '/src/Command/PathCommand.php',
    'Civi\\Cv\\Command\\PipeCommand' => $baseDir . '/src/Command/PipeCommand.php',
    'Civi\\Cv\\Command\\ScriptCommand' => $baseDir . '/src/Command/ScriptCommand.php',
    'Civi\\Cv\\Command\\ShowCommand' => $baseDir . '/src/Command/ShowCommand.php',
    'Civi\\Cv\\Command\\SqlCliCommand' => $baseDir . '/src/Command/SqlCliCommand.php',
    'Civi\\Cv\\Command\\UpgradeCommand' => $baseDir . '/src/Command/UpgradeCommand.php',
    'Civi\\Cv\\Command\\UpgradeDbCommand' => $baseDir . '/src/Command/UpgradeDbCommand.php',
    'Civi\\Cv\\Command\\UpgradeDlCommand' => $baseDir . '/src/Command/UpgradeDlCommand.php',
    'Civi\\Cv\\Command\\UpgradeGetCommand' => $baseDir . '/src/Command/UpgradeGetCommand.php',
    'Civi\\Cv\\Command\\UpgradeReportCommand' => $baseDir . '/src/Command/UpgradeReportCommand.php',
    'Civi\\Cv\\Command\\UrlCommand' => $baseDir . '/src/Command/UrlCommand.php',
    'Civi\\Cv\\Config' => $baseDir . '/src/Config.php',
    'Civi\\Cv\\Encoder' => $baseDir . '/src/Encoder.php',
    'Civi\\Cv\\Exception\\ProcessErrorException' => $baseDir . '/src/Exception/ProcessErrorException.php',
    'Civi\\Cv\\SiteConfigReader' => $baseDir . '/src/SiteConfigReader.php',
    'Civi\\Cv\\Util\\Api4ArgParser' => $baseDir . '/src/Util/Api4ArgParser.php',
    'Civi\\Cv\\Util\\ArrayUtil' => $baseDir . '/src/Util/ArrayUtil.php',
    'Civi\\Cv\\Util\\BootTrait' => $baseDir . '/src/Util/BootTrait.php',
    'Civi\\Cv\\Util\\CliEditor' => $baseDir . '/src/Util/CliEditor.php',
    'Civi\\Cv\\Util\\ConsoleQueueRunner' => $baseDir . '/src/Util/ConsoleQueueRunner.php',
    'Civi\\Cv\\Util\\Cv' => $baseDir . '/src/Util/Cv.php',
    'Civi\\Cv\\Util\\Datasource' => $baseDir . '/src/Util/Datasource.php',
    'Civi\\Cv\\Util\\DebugDispatcherTrait' => $baseDir . '/src/Util/DebugDispatcherTrait.php',
    'Civi\\Cv\\Util\\Filesystem' => $baseDir . '/src/Util/Filesystem.php',
    'Civi\\Cv\\Util\\HeadlessDownloader' => $baseDir . '/src/Util/HeadlessDownloader.php',
    'Civi\\Cv\\Util\\OptionCallbackTrait' => $baseDir . '/src/Util/OptionCallbackTrait.php',
    'Civi\\Cv\\Util\\Process' => $baseDir . '/src/Util/Process.php',
    'Civi\\Cv\\Util\\Rand' => $baseDir . '/src/Util/Rand.php',
    'Civi\\Cv\\Util\\SetupCommandTrait' => $baseDir . '/src/Util/SetupCommandTrait.php',
    'Civi\\Cv\\Util\\StructuredOutputTrait' => $baseDir . '/src/Util/StructuredOutputTrait.php',
    'JakubOnderka\\PhpConsoleColor\\ConsoleColor' => $vendorDir . '/jakub-onderka/php-console-color/src/ConsoleColor.php',
    'JakubOnderka\\PhpConsoleColor\\InvalidStyleException' => $vendorDir . '/jakub-onderka/php-console-color/src/InvalidStyleException.php',
    'JakubOnderka\\PhpConsoleHighlighter\\Highlighter' => $vendorDir . '/jakub-onderka/php-console-highlighter/src/Highlighter.php',
    'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
    'LastCall\\DownloadsPlugin\\DownloadsParser' => $vendorDir . '/civicrm/composer-downloads-plugin/src/DownloadsParser.php',
    'LastCall\\DownloadsPlugin\\GlobCleaner' => $vendorDir . '/civicrm/composer-downloads-plugin/src/GlobCleaner.php',
    'LastCall\\DownloadsPlugin\\Handler\\ArchiveHandler' => $vendorDir . '/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php',
    'LastCall\\DownloadsPlugin\\Handler\\BaseHandler' => $vendorDir . '/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php',
    'LastCall\\DownloadsPlugin\\Handler\\FileHandler' => $vendorDir . '/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php',
    'LastCall\\DownloadsPlugin\\Handler\\PharHandler' => $vendorDir . '/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php',
    'LastCall\\DownloadsPlugin\\Plugin' => $vendorDir . '/civicrm/composer-downloads-plugin/src/Plugin.php',
    'LastCall\\DownloadsPlugin\\Subpackage' => $vendorDir . '/civicrm/composer-downloads-plugin/src/Subpackage.php',
    'PhpParser\\Autoloader' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Autoloader.php',
    'PhpParser\\Builder' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder.php',
    'PhpParser\\BuilderAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderAbstract.php',
    'PhpParser\\BuilderFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/BuilderFactory.php',
    'PhpParser\\Builder\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Class_.php',
    'PhpParser\\Builder\\Declaration' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Declaration.php',
    'PhpParser\\Builder\\FunctionLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php',
    'PhpParser\\Builder\\Function_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Function_.php',
    'PhpParser\\Builder\\Interface_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Interface_.php',
    'PhpParser\\Builder\\Method' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Method.php',
    'PhpParser\\Builder\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php',
    'PhpParser\\Builder\\Param' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Param.php',
    'PhpParser\\Builder\\Property' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Property.php',
    'PhpParser\\Builder\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Trait_.php',
    'PhpParser\\Builder\\Use_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Builder/Use_.php',
    'PhpParser\\Comment' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Comment.php',
    'PhpParser\\Comment\\Doc' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Comment/Doc.php',
    'PhpParser\\Error' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Error.php',
    'PhpParser\\ErrorHandler' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ErrorHandler.php',
    'PhpParser\\ErrorHandler\\Collecting' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ErrorHandler/Collecting.php',
    'PhpParser\\ErrorHandler\\Throwing' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ErrorHandler/Throwing.php',
    'PhpParser\\Lexer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer.php',
    'PhpParser\\Lexer\\Emulative' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Lexer/Emulative.php',
    'PhpParser\\Node' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node.php',
    'PhpParser\\NodeAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeAbstract.php',
    'PhpParser\\NodeDumper' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeDumper.php',
    'PhpParser\\NodeTraverser' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeTraverser.php',
    'PhpParser\\NodeTraverserInterface' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeTraverserInterface.php',
    'PhpParser\\NodeVisitor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor.php',
    'PhpParser\\NodeVisitorAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitorAbstract.php',
    'PhpParser\\NodeVisitor\\NameResolver' => $vendorDir . '/nikic/php-parser/lib/PhpParser/NodeVisitor/NameResolver.php',
    'PhpParser\\Node\\Arg' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Arg.php',
    'PhpParser\\Node\\Const_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Const_.php',
    'PhpParser\\Node\\Expr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr.php',
    'PhpParser\\Node\\Expr\\ArrayDimFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayDimFetch.php',
    'PhpParser\\Node\\Expr\\ArrayItem' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ArrayItem.php',
    'PhpParser\\Node\\Expr\\Array_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Array_.php',
    'PhpParser\\Node\\Expr\\Assign' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Assign.php',
    'PhpParser\\Node\\Expr\\AssignOp' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp.php',
    'PhpParser\\Node\\Expr\\AssignOp\\BitwiseAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseAnd.php',
    'PhpParser\\Node\\Expr\\AssignOp\\BitwiseOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseOr.php',
    'PhpParser\\Node\\Expr\\AssignOp\\BitwiseXor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/BitwiseXor.php',
    'PhpParser\\Node\\Expr\\AssignOp\\Concat' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Concat.php',
    'PhpParser\\Node\\Expr\\AssignOp\\Div' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Div.php',
    'PhpParser\\Node\\Expr\\AssignOp\\Minus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Minus.php',
    'PhpParser\\Node\\Expr\\AssignOp\\Mod' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mod.php',
    'PhpParser\\Node\\Expr\\AssignOp\\Mul' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Mul.php',
    'PhpParser\\Node\\Expr\\AssignOp\\Plus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Plus.php',
    'PhpParser\\Node\\Expr\\AssignOp\\Pow' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/Pow.php',
    'PhpParser\\Node\\Expr\\AssignOp\\ShiftLeft' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftLeft.php',
    'PhpParser\\Node\\Expr\\AssignOp\\ShiftRight' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignOp/ShiftRight.php',
    'PhpParser\\Node\\Expr\\AssignRef' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/AssignRef.php',
    'PhpParser\\Node\\Expr\\BinaryOp' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseAnd.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseOr.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\BitwiseXor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BitwiseXor.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\BooleanAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanAnd.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\BooleanOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/BooleanOr.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Coalesce' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Coalesce.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Concat' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Concat.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Div' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Div.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Equal' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Equal.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Greater' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Greater.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\GreaterOrEqual' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/GreaterOrEqual.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Identical' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Identical.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\LogicalAnd' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalAnd.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\LogicalOr' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalOr.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\LogicalXor' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/LogicalXor.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Minus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Minus.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Mod' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mod.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Mul' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Mul.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\NotEqual' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotEqual.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\NotIdentical' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/NotIdentical.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Plus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Plus.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Pow' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Pow.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\ShiftLeft' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftLeft.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\ShiftRight' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/ShiftRight.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Smaller' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Smaller.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\SmallerOrEqual' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/SmallerOrEqual.php',
    'PhpParser\\Node\\Expr\\BinaryOp\\Spaceship' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BinaryOp/Spaceship.php',
    'PhpParser\\Node\\Expr\\BitwiseNot' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BitwiseNot.php',
    'PhpParser\\Node\\Expr\\BooleanNot' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/BooleanNot.php',
    'PhpParser\\Node\\Expr\\Cast' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast.php',
    'PhpParser\\Node\\Expr\\Cast\\Array_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Array_.php',
    'PhpParser\\Node\\Expr\\Cast\\Bool_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Bool_.php',
    'PhpParser\\Node\\Expr\\Cast\\Double' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Double.php',
    'PhpParser\\Node\\Expr\\Cast\\Int_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Int_.php',
    'PhpParser\\Node\\Expr\\Cast\\Object_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Object_.php',
    'PhpParser\\Node\\Expr\\Cast\\String_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/String_.php',
    'PhpParser\\Node\\Expr\\Cast\\Unset_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Cast/Unset_.php',
    'PhpParser\\Node\\Expr\\ClassConstFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClassConstFetch.php',
    'PhpParser\\Node\\Expr\\Clone_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Clone_.php',
    'PhpParser\\Node\\Expr\\Closure' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Closure.php',
    'PhpParser\\Node\\Expr\\ClosureUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ClosureUse.php',
    'PhpParser\\Node\\Expr\\ConstFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ConstFetch.php',
    'PhpParser\\Node\\Expr\\Empty_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Empty_.php',
    'PhpParser\\Node\\Expr\\Error' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Error.php',
    'PhpParser\\Node\\Expr\\ErrorSuppress' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ErrorSuppress.php',
    'PhpParser\\Node\\Expr\\Eval_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Eval_.php',
    'PhpParser\\Node\\Expr\\Exit_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Exit_.php',
    'PhpParser\\Node\\Expr\\FuncCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/FuncCall.php',
    'PhpParser\\Node\\Expr\\Include_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Include_.php',
    'PhpParser\\Node\\Expr\\Instanceof_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Instanceof_.php',
    'PhpParser\\Node\\Expr\\Isset_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Isset_.php',
    'PhpParser\\Node\\Expr\\List_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/List_.php',
    'PhpParser\\Node\\Expr\\MethodCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/MethodCall.php',
    'PhpParser\\Node\\Expr\\New_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/New_.php',
    'PhpParser\\Node\\Expr\\PostDec' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostDec.php',
    'PhpParser\\Node\\Expr\\PostInc' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PostInc.php',
    'PhpParser\\Node\\Expr\\PreDec' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreDec.php',
    'PhpParser\\Node\\Expr\\PreInc' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PreInc.php',
    'PhpParser\\Node\\Expr\\Print_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Print_.php',
    'PhpParser\\Node\\Expr\\PropertyFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/PropertyFetch.php',
    'PhpParser\\Node\\Expr\\ShellExec' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/ShellExec.php',
    'PhpParser\\Node\\Expr\\StaticCall' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticCall.php',
    'PhpParser\\Node\\Expr\\StaticPropertyFetch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/StaticPropertyFetch.php',
    'PhpParser\\Node\\Expr\\Ternary' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Ternary.php',
    'PhpParser\\Node\\Expr\\UnaryMinus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryMinus.php',
    'PhpParser\\Node\\Expr\\UnaryPlus' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/UnaryPlus.php',
    'PhpParser\\Node\\Expr\\Variable' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Variable.php',
    'PhpParser\\Node\\Expr\\YieldFrom' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/YieldFrom.php',
    'PhpParser\\Node\\Expr\\Yield_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Expr/Yield_.php',
    'PhpParser\\Node\\FunctionLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/FunctionLike.php',
    'PhpParser\\Node\\Name' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name.php',
    'PhpParser\\Node\\Name\\FullyQualified' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name/FullyQualified.php',
    'PhpParser\\Node\\Name\\Relative' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Name/Relative.php',
    'PhpParser\\Node\\NullableType' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/NullableType.php',
    'PhpParser\\Node\\Param' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Param.php',
    'PhpParser\\Node\\Scalar' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar.php',
    'PhpParser\\Node\\Scalar\\DNumber' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/DNumber.php',
    'PhpParser\\Node\\Scalar\\Encapsed' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/Encapsed.php',
    'PhpParser\\Node\\Scalar\\EncapsedStringPart' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/EncapsedStringPart.php',
    'PhpParser\\Node\\Scalar\\LNumber' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/LNumber.php',
    'PhpParser\\Node\\Scalar\\MagicConst' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst.php',
    'PhpParser\\Node\\Scalar\\MagicConst\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php',
    'PhpParser\\Node\\Scalar\\MagicConst\\Dir' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Dir.php',
    'PhpParser\\Node\\Scalar\\MagicConst\\File' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/File.php',
    'PhpParser\\Node\\Scalar\\MagicConst\\Function_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Function_.php',
    'PhpParser\\Node\\Scalar\\MagicConst\\Line' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Line.php',
    'PhpParser\\Node\\Scalar\\MagicConst\\Method' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Method.php',
    'PhpParser\\Node\\Scalar\\MagicConst\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Namespace_.php',
    'PhpParser\\Node\\Scalar\\MagicConst\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php',
    'PhpParser\\Node\\Scalar\\String_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Scalar/String_.php',
    'PhpParser\\Node\\Stmt' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt.php',
    'PhpParser\\Node\\Stmt\\Break_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Break_.php',
    'PhpParser\\Node\\Stmt\\Case_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Case_.php',
    'PhpParser\\Node\\Stmt\\Catch_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Catch_.php',
    'PhpParser\\Node\\Stmt\\ClassConst' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassConst.php',
    'PhpParser\\Node\\Stmt\\ClassLike' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php',
    'PhpParser\\Node\\Stmt\\ClassMethod' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassMethod.php',
    'PhpParser\\Node\\Stmt\\Class_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Class_.php',
    'PhpParser\\Node\\Stmt\\Const_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Const_.php',
    'PhpParser\\Node\\Stmt\\Continue_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Continue_.php',
    'PhpParser\\Node\\Stmt\\DeclareDeclare' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/DeclareDeclare.php',
    'PhpParser\\Node\\Stmt\\Declare_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Declare_.php',
    'PhpParser\\Node\\Stmt\\Do_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Do_.php',
    'PhpParser\\Node\\Stmt\\Echo_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Echo_.php',
    'PhpParser\\Node\\Stmt\\ElseIf_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/ElseIf_.php',
    'PhpParser\\Node\\Stmt\\Else_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Else_.php',
    'PhpParser\\Node\\Stmt\\Finally_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Finally_.php',
    'PhpParser\\Node\\Stmt\\For_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/For_.php',
    'PhpParser\\Node\\Stmt\\Foreach_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Foreach_.php',
    'PhpParser\\Node\\Stmt\\Function_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Function_.php',
    'PhpParser\\Node\\Stmt\\Global_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Global_.php',
    'PhpParser\\Node\\Stmt\\Goto_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Goto_.php',
    'PhpParser\\Node\\Stmt\\GroupUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/GroupUse.php',
    'PhpParser\\Node\\Stmt\\HaltCompiler' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/HaltCompiler.php',
    'PhpParser\\Node\\Stmt\\If_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/If_.php',
    'PhpParser\\Node\\Stmt\\InlineHTML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/InlineHTML.php',
    'PhpParser\\Node\\Stmt\\Interface_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Interface_.php',
    'PhpParser\\Node\\Stmt\\Label' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Label.php',
    'PhpParser\\Node\\Stmt\\Namespace_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php',
    'PhpParser\\Node\\Stmt\\Nop' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Nop.php',
    'PhpParser\\Node\\Stmt\\Property' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Property.php',
    'PhpParser\\Node\\Stmt\\PropertyProperty' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/PropertyProperty.php',
    'PhpParser\\Node\\Stmt\\Return_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Return_.php',
    'PhpParser\\Node\\Stmt\\StaticVar' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/StaticVar.php',
    'PhpParser\\Node\\Stmt\\Static_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Static_.php',
    'PhpParser\\Node\\Stmt\\Switch_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Switch_.php',
    'PhpParser\\Node\\Stmt\\Throw_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Throw_.php',
    'PhpParser\\Node\\Stmt\\TraitUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUse.php',
    'PhpParser\\Node\\Stmt\\TraitUseAdaptation' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation.php',
    'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Alias' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Alias.php',
    'PhpParser\\Node\\Stmt\\TraitUseAdaptation\\Precedence' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TraitUseAdaptation/Precedence.php',
    'PhpParser\\Node\\Stmt\\Trait_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Trait_.php',
    'PhpParser\\Node\\Stmt\\TryCatch' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/TryCatch.php',
    'PhpParser\\Node\\Stmt\\Unset_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Unset_.php',
    'PhpParser\\Node\\Stmt\\UseUse' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/UseUse.php',
    'PhpParser\\Node\\Stmt\\Use_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/Use_.php',
    'PhpParser\\Node\\Stmt\\While_' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Node/Stmt/While_.php',
    'PhpParser\\Parser' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser.php',
    'PhpParser\\ParserAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ParserAbstract.php',
    'PhpParser\\ParserFactory' => $vendorDir . '/nikic/php-parser/lib/PhpParser/ParserFactory.php',
    'PhpParser\\Parser\\Multiple' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Multiple.php',
    'PhpParser\\Parser\\Php5' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Php5.php',
    'PhpParser\\Parser\\Php7' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Php7.php',
    'PhpParser\\Parser\\Tokens' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Parser/Tokens.php',
    'PhpParser\\PrettyPrinterAbstract' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php',
    'PhpParser\\PrettyPrinter\\Standard' => $vendorDir . '/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php',
    'PhpParser\\Serializer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Serializer.php',
    'PhpParser\\Serializer\\XML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Serializer/XML.php',
    'PhpParser\\Unserializer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Unserializer.php',
    'PhpParser\\Unserializer\\XML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Unserializer/XML.php',
    'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php',
    'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php',
    'Psr\\Container\\NotFoundExceptionInterface' => $vendorDir . '/psr/container/src/NotFoundExceptionInterface.php',
    'Psy\\CodeCleaner' => $vendorDir . '/psy/psysh/src/CodeCleaner.php',
    'Psy\\CodeCleaner\\AbstractClassPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/AbstractClassPass.php',
    'Psy\\CodeCleaner\\AssignThisVariablePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/AssignThisVariablePass.php',
    'Psy\\CodeCleaner\\CallTimePassByReferencePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/CallTimePassByReferencePass.php',
    'Psy\\CodeCleaner\\CalledClassPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/CalledClassPass.php',
    'Psy\\CodeCleaner\\CodeCleanerPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/CodeCleanerPass.php',
    'Psy\\CodeCleaner\\EmptyArrayDimFetchPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/EmptyArrayDimFetchPass.php',
    'Psy\\CodeCleaner\\ExitPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/ExitPass.php',
    'Psy\\CodeCleaner\\FinalClassPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/FinalClassPass.php',
    'Psy\\CodeCleaner\\FunctionContextPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/FunctionContextPass.php',
    'Psy\\CodeCleaner\\FunctionReturnInWriteContextPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/FunctionReturnInWriteContextPass.php',
    'Psy\\CodeCleaner\\ImplicitReturnPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/ImplicitReturnPass.php',
    'Psy\\CodeCleaner\\InstanceOfPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/InstanceOfPass.php',
    'Psy\\CodeCleaner\\LabelContextPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/LabelContextPass.php',
    'Psy\\CodeCleaner\\LeavePsyshAlonePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/LeavePsyshAlonePass.php',
    'Psy\\CodeCleaner\\ListPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/ListPass.php',
    'Psy\\CodeCleaner\\LoopContextPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/LoopContextPass.php',
    'Psy\\CodeCleaner\\MagicConstantsPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/MagicConstantsPass.php',
    'Psy\\CodeCleaner\\NamespaceAwarePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/NamespaceAwarePass.php',
    'Psy\\CodeCleaner\\NamespacePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/NamespacePass.php',
    'Psy\\CodeCleaner\\NoReturnValue' => $vendorDir . '/psy/psysh/src/CodeCleaner/NoReturnValue.php',
    'Psy\\CodeCleaner\\PassableByReferencePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/PassableByReferencePass.php',
    'Psy\\CodeCleaner\\RequirePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/RequirePass.php',
    'Psy\\CodeCleaner\\StrictTypesPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/StrictTypesPass.php',
    'Psy\\CodeCleaner\\UseStatementPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/UseStatementPass.php',
    'Psy\\CodeCleaner\\ValidClassNamePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/ValidClassNamePass.php',
    'Psy\\CodeCleaner\\ValidConstantPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/ValidConstantPass.php',
    'Psy\\CodeCleaner\\ValidConstructorPass' => $vendorDir . '/psy/psysh/src/CodeCleaner/ValidConstructorPass.php',
    'Psy\\CodeCleaner\\ValidFunctionNamePass' => $vendorDir . '/psy/psysh/src/CodeCleaner/ValidFunctionNamePass.php',
    'Psy\\Command\\BufferCommand' => $vendorDir . '/psy/psysh/src/Command/BufferCommand.php',
    'Psy\\Command\\ClearCommand' => $vendorDir . '/psy/psysh/src/Command/ClearCommand.php',
    'Psy\\Command\\Command' => $vendorDir . '/psy/psysh/src/Command/Command.php',
    'Psy\\Command\\DocCommand' => $vendorDir . '/psy/psysh/src/Command/DocCommand.php',
    'Psy\\Command\\DumpCommand' => $vendorDir . '/psy/psysh/src/Command/DumpCommand.php',
    'Psy\\Command\\EditCommand' => $vendorDir . '/psy/psysh/src/Command/EditCommand.php',
    'Psy\\Command\\ExitCommand' => $vendorDir . '/psy/psysh/src/Command/ExitCommand.php',
    'Psy\\Command\\HelpCommand' => $vendorDir . '/psy/psysh/src/Command/HelpCommand.php',
    'Psy\\Command\\HistoryCommand' => $vendorDir . '/psy/psysh/src/Command/HistoryCommand.php',
    'Psy\\Command\\ListCommand' => $vendorDir . '/psy/psysh/src/Command/ListCommand.php',
    'Psy\\Command\\ListCommand\\ClassConstantEnumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/ClassConstantEnumerator.php',
    'Psy\\Command\\ListCommand\\ClassEnumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/ClassEnumerator.php',
    'Psy\\Command\\ListCommand\\ConstantEnumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/ConstantEnumerator.php',
    'Psy\\Command\\ListCommand\\Enumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/Enumerator.php',
    'Psy\\Command\\ListCommand\\FunctionEnumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/FunctionEnumerator.php',
    'Psy\\Command\\ListCommand\\GlobalVariableEnumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/GlobalVariableEnumerator.php',
    'Psy\\Command\\ListCommand\\MethodEnumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/MethodEnumerator.php',
    'Psy\\Command\\ListCommand\\PropertyEnumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/PropertyEnumerator.php',
    'Psy\\Command\\ListCommand\\VariableEnumerator' => $vendorDir . '/psy/psysh/src/Command/ListCommand/VariableEnumerator.php',
    'Psy\\Command\\ParseCommand' => $vendorDir . '/psy/psysh/src/Command/ParseCommand.php',
    'Psy\\Command\\PsyVersionCommand' => $vendorDir . '/psy/psysh/src/Command/PsyVersionCommand.php',
    'Psy\\Command\\ReflectingCommand' => $vendorDir . '/psy/psysh/src/Command/ReflectingCommand.php',
    'Psy\\Command\\ShowCommand' => $vendorDir . '/psy/psysh/src/Command/ShowCommand.php',
    'Psy\\Command\\SudoCommand' => $vendorDir . '/psy/psysh/src/Command/SudoCommand.php',
    'Psy\\Command\\ThrowUpCommand' => $vendorDir . '/psy/psysh/src/Command/ThrowUpCommand.php',
    'Psy\\Command\\TimeitCommand' => $vendorDir . '/psy/psysh/src/Command/TimeitCommand.php',
    'Psy\\Command\\TimeitCommand\\TimeitVisitor' => $vendorDir . '/psy/psysh/src/Command/TimeitCommand/TimeitVisitor.php',
    'Psy\\Command\\TraceCommand' => $vendorDir . '/psy/psysh/src/Command/TraceCommand.php',
    'Psy\\Command\\WhereamiCommand' => $vendorDir . '/psy/psysh/src/Command/WhereamiCommand.php',
    'Psy\\Command\\WtfCommand' => $vendorDir . '/psy/psysh/src/Command/WtfCommand.php',
    'Psy\\ConfigPaths' => $vendorDir . '/psy/psysh/src/ConfigPaths.php',
    'Psy\\Configuration' => $vendorDir . '/psy/psysh/src/Configuration.php',
    'Psy\\ConsoleColorFactory' => $vendorDir . '/psy/psysh/src/ConsoleColorFactory.php',
    'Psy\\Context' => $vendorDir . '/psy/psysh/src/Context.php',
    'Psy\\ContextAware' => $vendorDir . '/psy/psysh/src/ContextAware.php',
    'Psy\\Exception\\BreakException' => $vendorDir . '/psy/psysh/src/Exception/BreakException.php',
    'Psy\\Exception\\DeprecatedException' => $vendorDir . '/psy/psysh/src/Exception/DeprecatedException.php',
    'Psy\\Exception\\ErrorException' => $vendorDir . '/psy/psysh/src/Exception/ErrorException.php',
    'Psy\\Exception\\Exception' => $vendorDir . '/psy/psysh/src/Exception/Exception.php',
    'Psy\\Exception\\FatalErrorException' => $vendorDir . '/psy/psysh/src/Exception/FatalErrorException.php',
    'Psy\\Exception\\ParseErrorException' => $vendorDir . '/psy/psysh/src/Exception/ParseErrorException.php',
    'Psy\\Exception\\RuntimeException' => $vendorDir . '/psy/psysh/src/Exception/RuntimeException.php',
    'Psy\\Exception\\ThrowUpException' => $vendorDir . '/psy/psysh/src/Exception/ThrowUpException.php',
    'Psy\\Exception\\TypeErrorException' => $vendorDir . '/psy/psysh/src/Exception/TypeErrorException.php',
    'Psy\\ExecutionClosure' => $vendorDir . '/psy/psysh/src/ExecutionClosure.php',
    'Psy\\ExecutionLoopClosure' => $vendorDir . '/psy/psysh/src/ExecutionLoopClosure.php',
    'Psy\\ExecutionLoop\\AbstractListener' => $vendorDir . '/psy/psysh/src/ExecutionLoop/AbstractListener.php',
    'Psy\\ExecutionLoop\\Listener' => $vendorDir . '/psy/psysh/src/ExecutionLoop/Listener.php',
    'Psy\\ExecutionLoop\\ProcessForker' => $vendorDir . '/psy/psysh/src/ExecutionLoop/ProcessForker.php',
    'Psy\\ExecutionLoop\\RunkitReloader' => $vendorDir . '/psy/psysh/src/ExecutionLoop/RunkitReloader.php',
    'Psy\\Formatter\\CodeFormatter' => $vendorDir . '/psy/psysh/src/Formatter/CodeFormatter.php',
    'Psy\\Formatter\\DocblockFormatter' => $vendorDir . '/psy/psysh/src/Formatter/DocblockFormatter.php',
    'Psy\\Formatter\\Formatter' => $vendorDir . '/psy/psysh/src/Formatter/Formatter.php',
    'Psy\\Formatter\\SignatureFormatter' => $vendorDir . '/psy/psysh/src/Formatter/SignatureFormatter.php',
    'Psy\\Input\\CodeArgument' => $vendorDir . '/psy/psysh/src/Input/CodeArgument.php',
    'Psy\\Input\\FilterOptions' => $vendorDir . '/psy/psysh/src/Input/FilterOptions.php',
    'Psy\\Input\\ShellInput' => $vendorDir . '/psy/psysh/src/Input/ShellInput.php',
    'Psy\\Input\\SilentInput' => $vendorDir . '/psy/psysh/src/Input/SilentInput.php',
    'Psy\\Output\\OutputPager' => $vendorDir . '/psy/psysh/src/Output/OutputPager.php',
    'Psy\\Output\\PassthruPager' => $vendorDir . '/psy/psysh/src/Output/PassthruPager.php',
    'Psy\\Output\\ProcOutputPager' => $vendorDir . '/psy/psysh/src/Output/ProcOutputPager.php',
    'Psy\\Output\\ShellOutput' => $vendorDir . '/psy/psysh/src/Output/ShellOutput.php',
    'Psy\\ParserFactory' => $vendorDir . '/psy/psysh/src/ParserFactory.php',
    'Psy\\Readline\\GNUReadline' => $vendorDir . '/psy/psysh/src/Readline/GNUReadline.php',
    'Psy\\Readline\\HoaConsole' => $vendorDir . '/psy/psysh/src/Readline/HoaConsole.php',
    'Psy\\Readline\\Libedit' => $vendorDir . '/psy/psysh/src/Readline/Libedit.php',
    'Psy\\Readline\\Readline' => $vendorDir . '/psy/psysh/src/Readline/Readline.php',
    'Psy\\Readline\\Transient' => $vendorDir . '/psy/psysh/src/Readline/Transient.php',
    'Psy\\Reflection\\ReflectionClassConstant' => $vendorDir . '/psy/psysh/src/Reflection/ReflectionClassConstant.php',
    'Psy\\Reflection\\ReflectionConstant' => $vendorDir . '/psy/psysh/src/Reflection/ReflectionConstant.php',
    'Psy\\Reflection\\ReflectionConstant_' => $vendorDir . '/psy/psysh/src/Reflection/ReflectionConstant_.php',
    'Psy\\Reflection\\ReflectionLanguageConstruct' => $vendorDir . '/psy/psysh/src/Reflection/ReflectionLanguageConstruct.php',
    'Psy\\Reflection\\ReflectionLanguageConstructParameter' => $vendorDir . '/psy/psysh/src/Reflection/ReflectionLanguageConstructParameter.php',
    'Psy\\Shell' => $vendorDir . '/psy/psysh/src/Shell.php',
    'Psy\\Sudo' => $vendorDir . '/psy/psysh/src/Sudo.php',
    'Psy\\Sudo\\SudoVisitor' => $vendorDir . '/psy/psysh/src/Sudo/SudoVisitor.php',
    'Psy\\TabCompletion\\AutoCompleter' => $vendorDir . '/psy/psysh/src/TabCompletion/AutoCompleter.php',
    'Psy\\TabCompletion\\Matcher\\AbstractContextAwareMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/AbstractContextAwareMatcher.php',
    'Psy\\TabCompletion\\Matcher\\AbstractDefaultParametersMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/AbstractDefaultParametersMatcher.php',
    'Psy\\TabCompletion\\Matcher\\AbstractMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/AbstractMatcher.php',
    'Psy\\TabCompletion\\Matcher\\ClassAttributesMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/ClassAttributesMatcher.php',
    'Psy\\TabCompletion\\Matcher\\ClassMethodDefaultParametersMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/ClassMethodDefaultParametersMatcher.php',
    'Psy\\TabCompletion\\Matcher\\ClassMethodsMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/ClassMethodsMatcher.php',
    'Psy\\TabCompletion\\Matcher\\ClassNamesMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/ClassNamesMatcher.php',
    'Psy\\TabCompletion\\Matcher\\CommandsMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/CommandsMatcher.php',
    'Psy\\TabCompletion\\Matcher\\ConstantsMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/ConstantsMatcher.php',
    'Psy\\TabCompletion\\Matcher\\FunctionDefaultParametersMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/FunctionDefaultParametersMatcher.php',
    'Psy\\TabCompletion\\Matcher\\FunctionsMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/FunctionsMatcher.php',
    'Psy\\TabCompletion\\Matcher\\KeywordsMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/KeywordsMatcher.php',
    'Psy\\TabCompletion\\Matcher\\MongoClientMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/MongoClientMatcher.php',
    'Psy\\TabCompletion\\Matcher\\MongoDatabaseMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/MongoDatabaseMatcher.php',
    'Psy\\TabCompletion\\Matcher\\ObjectAttributesMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/ObjectAttributesMatcher.php',
    'Psy\\TabCompletion\\Matcher\\ObjectMethodDefaultParametersMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/ObjectMethodDefaultParametersMatcher.php',
    'Psy\\TabCompletion\\Matcher\\ObjectMethodsMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/ObjectMethodsMatcher.php',
    'Psy\\TabCompletion\\Matcher\\VariablesMatcher' => $vendorDir . '/psy/psysh/src/TabCompletion/Matcher/VariablesMatcher.php',
    'Psy\\Util\\Docblock' => $vendorDir . '/psy/psysh/src/Util/Docblock.php',
    'Psy\\Util\\Json' => $vendorDir . '/psy/psysh/src/Util/Json.php',
    'Psy\\Util\\Mirror' => $vendorDir . '/psy/psysh/src/Util/Mirror.php',
    'Psy\\Util\\Str' => $vendorDir . '/psy/psysh/src/Util/Str.php',
    'Psy\\VarDumper\\Cloner' => $vendorDir . '/psy/psysh/src/VarDumper/Cloner.php',
    'Psy\\VarDumper\\Dumper' => $vendorDir . '/psy/psysh/src/VarDumper/Dumper.php',
    'Psy\\VarDumper\\Presenter' => $vendorDir . '/psy/psysh/src/VarDumper/Presenter.php',
    'Psy\\VarDumper\\PresenterAware' => $vendorDir . '/psy/psysh/src/VarDumper/PresenterAware.php',
    'Psy\\VersionUpdater\\Checker' => $vendorDir . '/psy/psysh/src/VersionUpdater/Checker.php',
    'Psy\\VersionUpdater\\GitHubChecker' => $vendorDir . '/psy/psysh/src/VersionUpdater/GitHubChecker.php',
    'Psy\\VersionUpdater\\IntervalChecker' => $vendorDir . '/psy/psysh/src/VersionUpdater/IntervalChecker.php',
    'Psy\\VersionUpdater\\NoopChecker' => $vendorDir . '/psy/psysh/src/VersionUpdater/NoopChecker.php',
    'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
    'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Application.php',
    'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => $vendorDir . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
    'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/ContainerCommandLoader.php',
    'Symfony\\Component\\Console\\CommandLoader\\FactoryCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/FactoryCommandLoader.php',
    'Symfony\\Component\\Console\\Command\\Command' => $vendorDir . '/symfony/console/Command/Command.php',
    'Symfony\\Component\\Console\\Command\\HelpCommand' => $vendorDir . '/symfony/console/Command/HelpCommand.php',
    'Symfony\\Component\\Console\\Command\\ListCommand' => $vendorDir . '/symfony/console/Command/ListCommand.php',
    'Symfony\\Component\\Console\\Command\\LockableTrait' => $vendorDir . '/symfony/console/Command/LockableTrait.php',
    'Symfony\\Component\\Console\\ConsoleEvents' => $vendorDir . '/symfony/console/ConsoleEvents.php',
    'Symfony\\Component\\Console\\DependencyInjection\\AddConsoleCommandPass' => $vendorDir . '/symfony/console/DependencyInjection/AddConsoleCommandPass.php',
    'Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => $vendorDir . '/symfony/console/Descriptor/ApplicationDescription.php',
    'Symfony\\Component\\Console\\Descriptor\\Descriptor' => $vendorDir . '/symfony/console/Descriptor/Descriptor.php',
    'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => $vendorDir . '/symfony/console/Descriptor/DescriptorInterface.php',
    'Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => $vendorDir . '/symfony/console/Descriptor/JsonDescriptor.php',
    'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => $vendorDir . '/symfony/console/Descriptor/MarkdownDescriptor.php',
    'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => $vendorDir . '/symfony/console/Descriptor/TextDescriptor.php',
    'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => $vendorDir . '/symfony/console/Descriptor/XmlDescriptor.php',
    'Symfony\\Component\\Console\\EventListener\\ErrorListener' => $vendorDir . '/symfony/console/EventListener/ErrorListener.php',
    'Symfony\\Component\\Console\\Event\\ConsoleCommandEvent' => $vendorDir . '/symfony/console/Event/ConsoleCommandEvent.php',
    'Symfony\\Component\\Console\\Event\\ConsoleErrorEvent' => $vendorDir . '/symfony/console/Event/ConsoleErrorEvent.php',
    'Symfony\\Component\\Console\\Event\\ConsoleEvent' => $vendorDir . '/symfony/console/Event/ConsoleEvent.php',
    'Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent' => $vendorDir . '/symfony/console/Event/ConsoleTerminateEvent.php',
    'Symfony\\Component\\Console\\Exception\\CommandNotFoundException' => $vendorDir . '/symfony/console/Exception/CommandNotFoundException.php',
    'Symfony\\Component\\Console\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/console/Exception/ExceptionInterface.php',
    'Symfony\\Component\\Console\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/console/Exception/InvalidArgumentException.php',
    'Symfony\\Component\\Console\\Exception\\InvalidOptionException' => $vendorDir . '/symfony/console/Exception/InvalidOptionException.php',
    'Symfony\\Component\\Console\\Exception\\LogicException' => $vendorDir . '/symfony/console/Exception/LogicException.php',
    'Symfony\\Component\\Console\\Exception\\MissingInputException' => $vendorDir . '/symfony/console/Exception/MissingInputException.php',
    'Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException' => $vendorDir . '/symfony/console/Exception/NamespaceNotFoundException.php',
    'Symfony\\Component\\Console\\Exception\\RuntimeException' => $vendorDir . '/symfony/console/Exception/RuntimeException.php',
    'Symfony\\Component\\Console\\Formatter\\OutputFormatter' => $vendorDir . '/symfony/console/Formatter/OutputFormatter.php',
    'Symfony\\Component\\Console\\Formatter\\OutputFormatterInterface' => $vendorDir . '/symfony/console/Formatter/OutputFormatterInterface.php',
    'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyle' => $vendorDir . '/symfony/console/Formatter/OutputFormatterStyle.php',
    'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleInterface' => $vendorDir . '/symfony/console/Formatter/OutputFormatterStyleInterface.php',
    'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleStack' => $vendorDir . '/symfony/console/Formatter/OutputFormatterStyleStack.php',
    'Symfony\\Component\\Console\\Formatter\\WrappableOutputFormatterInterface' => $vendorDir . '/symfony/console/Formatter/WrappableOutputFormatterInterface.php',
    'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => $vendorDir . '/symfony/console/Helper/DebugFormatterHelper.php',
    'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => $vendorDir . '/symfony/console/Helper/DescriptorHelper.php',
    'Symfony\\Component\\Console\\Helper\\Dumper' => $vendorDir . '/symfony/console/Helper/Dumper.php',
    'Symfony\\Component\\Console\\Helper\\FormatterHelper' => $vendorDir . '/symfony/console/Helper/FormatterHelper.php',
    'Symfony\\Component\\Console\\Helper\\Helper' => $vendorDir . '/symfony/console/Helper/Helper.php',
    'Symfony\\Component\\Console\\Helper\\HelperInterface' => $vendorDir . '/symfony/console/Helper/HelperInterface.php',
    'Symfony\\Component\\Console\\Helper\\HelperSet' => $vendorDir . '/symfony/console/Helper/HelperSet.php',
    'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => $vendorDir . '/symfony/console/Helper/InputAwareHelper.php',
    'Symfony\\Component\\Console\\Helper\\ProcessHelper' => $vendorDir . '/symfony/console/Helper/ProcessHelper.php',
    'Symfony\\Component\\Console\\Helper\\ProgressBar' => $vendorDir . '/symfony/console/Helper/ProgressBar.php',
    'Symfony\\Component\\Console\\Helper\\ProgressIndicator' => $vendorDir . '/symfony/console/Helper/ProgressIndicator.php',
    'Symfony\\Component\\Console\\Helper\\QuestionHelper' => $vendorDir . '/symfony/console/Helper/QuestionHelper.php',
    'Symfony\\Component\\Console\\Helper\\SymfonyQuestionHelper' => $vendorDir . '/symfony/console/Helper/SymfonyQuestionHelper.php',
    'Symfony\\Component\\Console\\Helper\\Table' => $vendorDir . '/symfony/console/Helper/Table.php',
    'Symfony\\Component\\Console\\Helper\\TableCell' => $vendorDir . '/symfony/console/Helper/TableCell.php',
    'Symfony\\Component\\Console\\Helper\\TableRows' => $vendorDir . '/symfony/console/Helper/TableRows.php',
    'Symfony\\Component\\Console\\Helper\\TableSeparator' => $vendorDir . '/symfony/console/Helper/TableSeparator.php',
    'Symfony\\Component\\Console\\Helper\\TableStyle' => $vendorDir . '/symfony/console/Helper/TableStyle.php',
    'Symfony\\Component\\Console\\Input\\ArgvInput' => $vendorDir . '/symfony/console/Input/ArgvInput.php',
    'Symfony\\Component\\Console\\Input\\ArrayInput' => $vendorDir . '/symfony/console/Input/ArrayInput.php',
    'Symfony\\Component\\Console\\Input\\Input' => $vendorDir . '/symfony/console/Input/Input.php',
    'Symfony\\Component\\Console\\Input\\InputArgument' => $vendorDir . '/symfony/console/Input/InputArgument.php',
    'Symfony\\Component\\Console\\Input\\InputAwareInterface' => $vendorDir . '/symfony/console/Input/InputAwareInterface.php',
    'Symfony\\Component\\Console\\Input\\InputDefinition' => $vendorDir . '/symfony/console/Input/InputDefinition.php',
    'Symfony\\Component\\Console\\Input\\InputInterface' => $vendorDir . '/symfony/console/Input/InputInterface.php',
    'Symfony\\Component\\Console\\Input\\InputOption' => $vendorDir . '/symfony/console/Input/InputOption.php',
    'Symfony\\Component\\Console\\Input\\StreamableInputInterface' => $vendorDir . '/symfony/console/Input/StreamableInputInterface.php',
    'Symfony\\Component\\Console\\Input\\StringInput' => $vendorDir . '/symfony/console/Input/StringInput.php',
    'Symfony\\Component\\Console\\Logger\\ConsoleLogger' => $vendorDir . '/symfony/console/Logger/ConsoleLogger.php',
    'Symfony\\Component\\Console\\Output\\BufferedOutput' => $vendorDir . '/symfony/console/Output/BufferedOutput.php',
    'Symfony\\Component\\Console\\Output\\ConsoleOutput' => $vendorDir . '/symfony/console/Output/ConsoleOutput.php',
    'Symfony\\Component\\Console\\Output\\ConsoleOutputInterface' => $vendorDir . '/symfony/console/Output/ConsoleOutputInterface.php',
    'Symfony\\Component\\Console\\Output\\ConsoleSectionOutput' => $vendorDir . '/symfony/console/Output/ConsoleSectionOutput.php',
    'Symfony\\Component\\Console\\Output\\NullOutput' => $vendorDir . '/symfony/console/Output/NullOutput.php',
    'Symfony\\Component\\Console\\Output\\Output' => $vendorDir . '/symfony/console/Output/Output.php',
    'Symfony\\Component\\Console\\Output\\OutputInterface' => $vendorDir . '/symfony/console/Output/OutputInterface.php',
    'Symfony\\Component\\Console\\Output\\StreamOutput' => $vendorDir . '/symfony/console/Output/StreamOutput.php',
    'Symfony\\Component\\Console\\Output\\TrimmedBufferOutput' => $vendorDir . '/symfony/console/Output/TrimmedBufferOutput.php',
    'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => $vendorDir . '/symfony/console/Question/ChoiceQuestion.php',
    'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => $vendorDir . '/symfony/console/Question/ConfirmationQuestion.php',
    'Symfony\\Component\\Console\\Question\\Question' => $vendorDir . '/symfony/console/Question/Question.php',
    'Symfony\\Component\\Console\\Style\\OutputStyle' => $vendorDir . '/symfony/console/Style/OutputStyle.php',
    'Symfony\\Component\\Console\\Style\\StyleInterface' => $vendorDir . '/symfony/console/Style/StyleInterface.php',
    'Symfony\\Component\\Console\\Style\\SymfonyStyle' => $vendorDir . '/symfony/console/Style/SymfonyStyle.php',
    'Symfony\\Component\\Console\\Terminal' => $vendorDir . '/symfony/console/Terminal.php',
    'Symfony\\Component\\Console\\Tester\\ApplicationTester' => $vendorDir . '/symfony/console/Tester/ApplicationTester.php',
    'Symfony\\Component\\Console\\Tester\\CommandTester' => $vendorDir . '/symfony/console/Tester/CommandTester.php',
    'Symfony\\Component\\Console\\Tester\\TesterTrait' => $vendorDir . '/symfony/console/Tester/TesterTrait.php',
    'Symfony\\Component\\Filesystem\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/filesystem/Exception/ExceptionInterface.php',
    'Symfony\\Component\\Filesystem\\Exception\\FileNotFoundException' => $vendorDir . '/symfony/filesystem/Exception/FileNotFoundException.php',
    'Symfony\\Component\\Filesystem\\Exception\\IOException' => $vendorDir . '/symfony/filesystem/Exception/IOException.php',
    'Symfony\\Component\\Filesystem\\Exception\\IOExceptionInterface' => $vendorDir . '/symfony/filesystem/Exception/IOExceptionInterface.php',
    'Symfony\\Component\\Filesystem\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/filesystem/Exception/InvalidArgumentException.php',
    'Symfony\\Component\\Filesystem\\Filesystem' => $vendorDir . '/symfony/filesystem/Filesystem.php',
    'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/process/Exception/ExceptionInterface.php',
    'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/process/Exception/InvalidArgumentException.php',
    'Symfony\\Component\\Process\\Exception\\LogicException' => $vendorDir . '/symfony/process/Exception/LogicException.php',
    'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => $vendorDir . '/symfony/process/Exception/ProcessFailedException.php',
    'Symfony\\Component\\Process\\Exception\\ProcessSignaledException' => $vendorDir . '/symfony/process/Exception/ProcessSignaledException.php',
    'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => $vendorDir . '/symfony/process/Exception/ProcessTimedOutException.php',
    'Symfony\\Component\\Process\\Exception\\RuntimeException' => $vendorDir . '/symfony/process/Exception/RuntimeException.php',
    'Symfony\\Component\\Process\\ExecutableFinder' => $vendorDir . '/symfony/process/ExecutableFinder.php',
    'Symfony\\Component\\Process\\InputStream' => $vendorDir . '/symfony/process/InputStream.php',
    'Symfony\\Component\\Process\\PhpExecutableFinder' => $vendorDir . '/symfony/process/PhpExecutableFinder.php',
    'Symfony\\Component\\Process\\PhpProcess' => $vendorDir . '/symfony/process/PhpProcess.php',
    'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => $vendorDir . '/symfony/process/Pipes/AbstractPipes.php',
    'Symfony\\Component\\Process\\Pipes\\PipesInterface' => $vendorDir . '/symfony/process/Pipes/PipesInterface.php',
    'Symfony\\Component\\Process\\Pipes\\UnixPipes' => $vendorDir . '/symfony/process/Pipes/UnixPipes.php',
    'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => $vendorDir . '/symfony/process/Pipes/WindowsPipes.php',
    'Symfony\\Component\\Process\\Process' => $vendorDir . '/symfony/process/Process.php',
    'Symfony\\Component\\Process\\ProcessUtils' => $vendorDir . '/symfony/process/ProcessUtils.php',
    'Symfony\\Component\\VarDumper\\Caster\\AmqpCaster' => $vendorDir . '/symfony/var-dumper/Caster/AmqpCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\ArgsStub' => $vendorDir . '/symfony/var-dumper/Caster/ArgsStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\Caster' => $vendorDir . '/symfony/var-dumper/Caster/Caster.php',
    'Symfony\\Component\\VarDumper\\Caster\\ClassStub' => $vendorDir . '/symfony/var-dumper/Caster/ClassStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\ConstStub' => $vendorDir . '/symfony/var-dumper/Caster/ConstStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\CutArrayStub' => $vendorDir . '/symfony/var-dumper/Caster/CutArrayStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\CutStub' => $vendorDir . '/symfony/var-dumper/Caster/CutStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\DOMCaster' => $vendorDir . '/symfony/var-dumper/Caster/DOMCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\DateCaster' => $vendorDir . '/symfony/var-dumper/Caster/DateCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\DoctrineCaster' => $vendorDir . '/symfony/var-dumper/Caster/DoctrineCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\EnumStub' => $vendorDir . '/symfony/var-dumper/Caster/EnumStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\ExceptionCaster' => $vendorDir . '/symfony/var-dumper/Caster/ExceptionCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\FrameStub' => $vendorDir . '/symfony/var-dumper/Caster/FrameStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\LinkStub' => $vendorDir . '/symfony/var-dumper/Caster/LinkStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\MongoCaster' => $vendorDir . '/symfony/var-dumper/Caster/MongoCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\PdoCaster' => $vendorDir . '/symfony/var-dumper/Caster/PdoCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\PgSqlCaster' => $vendorDir . '/symfony/var-dumper/Caster/PgSqlCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\RedisCaster' => $vendorDir . '/symfony/var-dumper/Caster/RedisCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\ReflectionCaster' => $vendorDir . '/symfony/var-dumper/Caster/ReflectionCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\ResourceCaster' => $vendorDir . '/symfony/var-dumper/Caster/ResourceCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\SplCaster' => $vendorDir . '/symfony/var-dumper/Caster/SplCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\StubCaster' => $vendorDir . '/symfony/var-dumper/Caster/StubCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\SymfonyCaster' => $vendorDir . '/symfony/var-dumper/Caster/SymfonyCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\TraceStub' => $vendorDir . '/symfony/var-dumper/Caster/TraceStub.php',
    'Symfony\\Component\\VarDumper\\Caster\\XmlReaderCaster' => $vendorDir . '/symfony/var-dumper/Caster/XmlReaderCaster.php',
    'Symfony\\Component\\VarDumper\\Caster\\XmlResourceCaster' => $vendorDir . '/symfony/var-dumper/Caster/XmlResourceCaster.php',
    'Symfony\\Component\\VarDumper\\Cloner\\AbstractCloner' => $vendorDir . '/symfony/var-dumper/Cloner/AbstractCloner.php',
    'Symfony\\Component\\VarDumper\\Cloner\\ClonerInterface' => $vendorDir . '/symfony/var-dumper/Cloner/ClonerInterface.php',
    'Symfony\\Component\\VarDumper\\Cloner\\Cursor' => $vendorDir . '/symfony/var-dumper/Cloner/Cursor.php',
    'Symfony\\Component\\VarDumper\\Cloner\\Data' => $vendorDir . '/symfony/var-dumper/Cloner/Data.php',
    'Symfony\\Component\\VarDumper\\Cloner\\DumperInterface' => $vendorDir . '/symfony/var-dumper/Cloner/DumperInterface.php',
    'Symfony\\Component\\VarDumper\\Cloner\\Stub' => $vendorDir . '/symfony/var-dumper/Cloner/Stub.php',
    'Symfony\\Component\\VarDumper\\Cloner\\VarCloner' => $vendorDir . '/symfony/var-dumper/Cloner/VarCloner.php',
    'Symfony\\Component\\VarDumper\\Dumper\\AbstractDumper' => $vendorDir . '/symfony/var-dumper/Dumper/AbstractDumper.php',
    'Symfony\\Component\\VarDumper\\Dumper\\CliDumper' => $vendorDir . '/symfony/var-dumper/Dumper/CliDumper.php',
    'Symfony\\Component\\VarDumper\\Dumper\\DataDumperInterface' => $vendorDir . '/symfony/var-dumper/Dumper/DataDumperInterface.php',
    'Symfony\\Component\\VarDumper\\Dumper\\HtmlDumper' => $vendorDir . '/symfony/var-dumper/Dumper/HtmlDumper.php',
    'Symfony\\Component\\VarDumper\\Exception\\ThrowingCasterException' => $vendorDir . '/symfony/var-dumper/Exception/ThrowingCasterException.php',
    'Symfony\\Component\\VarDumper\\VarDumper' => $vendorDir . '/symfony/var-dumper/VarDumper.php',
    'Symfony\\Contracts\\Service\\ResetInterface' => $vendorDir . '/symfony/service-contracts/ResetInterface.php',
    'Symfony\\Contracts\\Service\\ServiceLocatorTrait' => $vendorDir . '/symfony/service-contracts/ServiceLocatorTrait.php',
    'Symfony\\Contracts\\Service\\ServiceProviderInterface' => $vendorDir . '/symfony/service-contracts/ServiceProviderInterface.php',
    'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberInterface.php',
    'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberTrait.php',
    'Symfony\\Polyfill\\Ctype\\Ctype' => $vendorDir . '/symfony/polyfill-ctype/Ctype.php',
    'Symfony\\Polyfill\\Mbstring\\Mbstring' => $vendorDir . '/symfony/polyfill-mbstring/Mbstring.php',
    'Symfony\\Polyfill\\Php73\\Php73' => $vendorDir . '/symfony/polyfill-php73/Php73.php',
    'Symfony\\Polyfill\\Php80\\Php80' => $vendorDir . '/symfony/polyfill-php80/Php80.php',
    'TOGoS_GitIgnore_FileFinder' => $vendorDir . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php',
    'TOGoS_GitIgnore_Pattern' => $vendorDir . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php',
    'TOGoS_GitIgnore_Rule' => $vendorDir . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php',
    'TOGoS_GitIgnore_Ruleset' => $vendorDir . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php',
    'TOGoS_GitIgnore_Util' => $vendorDir . '/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php',
    'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
    'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
    'XdgBaseDir\\Xdg' => $vendorDir . '/dnoegel/php-xdg-base-dir/src/Xdg.php',
);
<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'XdgBaseDir\\' => array($vendorDir . '/dnoegel/php-xdg-base-dir/src'),
    'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
    'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
    'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
    'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
    'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
    'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'),
    'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
    'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
    'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
    'Psy\\' => array($vendorDir . '/psy/psysh/src'),
    'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
    'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
    'LastCall\\DownloadsPlugin\\' => array($vendorDir . '/civicrm/composer-downloads-plugin/src'),
    'JakubOnderka\\PhpConsoleHighlighter\\' => array($vendorDir . '/jakub-onderka/php-console-highlighter/src'),
    'JakubOnderka\\PhpConsoleColor\\' => array($vendorDir . '/jakub-onderka/php-console-color/src'),
    'Civi\\Cv\\' => array($baseDir . '/src'),
);

Copyright (c) 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.

<?php

// autoload_files.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
    'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
    '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
    '0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
    '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
    '801c31d8ed748cfa537fa45402288c95' => $vendorDir . '/psy/psysh/src/functions.php',
);
<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'TOGoS_GitIgnore_' => array($vendorDir . '/togos/gitignore/src/main/php'),
);
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit7147d1bba87fa1560cd1235a618ce161::getLoader();
<?php
namespace LastCall\DownloadsPlugin;

use Composer\IO\IOInterface;

class GlobCleaner
{







public static function clean(IOInterface $io, $baseDir, $ignores)
{
if (empty($ignores)) {
return;
}

$dirs = [];

$finder = new \TOGoS_GitIgnore_FileFinder(array(
'ruleset' => \TOGoS_GitIgnore_Ruleset::loadFromStrings($ignores),
'invertRulesetResult' => false,
'defaultResult' => false,
'includeDirectories' => false,
'callback' => function($file, $match) use ($baseDir, &$dirs) {
if ($match) {
unlink("$baseDir/$file");
$dir = dirname($file);
if ($dir !== '.') {
$dirs[dirname($file)] = 1;
}
}
}
));
$finder->findFiles($baseDir);


 $dirNames = array_keys($dirs);
$byLength = function ($a, $b) {
return strlen($b) - strlen($a);
};
usort($dirNames, $byLength);

while ($dirName = array_shift($dirNames)) {
if (!glob("$baseDir/$dirName/*")) {
@rmdir("$baseDir/$dirName");
$dirNames[] = dirname($dirName);
usort($dirNames, $byLength);
}
}
}


}<?php










namespace LastCall\DownloadsPlugin;

use Composer\Package\PackageInterface;
use LastCall\DownloadsPlugin\Handler\ArchiveHandler;
use LastCall\DownloadsPlugin\Handler\BaseHandler;
use LastCall\DownloadsPlugin\Handler\FileHandler;
use LastCall\DownloadsPlugin\Handler\PharHandler;

class DownloadsParser
{







public function parse(PackageInterface $package, $basePath)
{
$extraFiles = [];
$extra = $package->getExtra();

$defaults = isset($extra['downloads']['*']) ? $extra['downloads']['*'] : [];

if (!empty($extra['downloads'])) {
foreach ((array) $extra['downloads'] as $id => $extraFile) {
if ($id === '*') continue;

$extraFile = array_merge($defaults, $extraFile);
$extraFile['id'] = $id;
foreach (['url', 'path'] as $prop) {
if (isset($extraFile[$prop])) {
$extraFile[$prop] = strtr($extraFile[$prop], [
'{$id}' => $extraFile['id'],
'{$version}' => isset($extraFile['version']) ? $extraFile['version'] : '',
]);
}
}

$class = $this->pickClass($extraFile);
$extraFiles[] = new $class($package, $basePath, $extraFile);
}
}

return $extraFiles;
}

public function pickClass($extraFile)
{
$types = [
'archive' => ArchiveHandler::CLASS,
'file' => FileHandler::CLASS,
'phar' => PharHandler::CLASS,
];
if (isset($extraFile['type'], $types[$extraFile['type']])) {
return $types[$extraFile['type']];
}

$parts = parse_url($extraFile['url']);
$filename = pathinfo($parts['path'], PATHINFO_BASENAME);
if (preg_match('/\.(zip|tar\.gz|tgz)$/', $filename)) {
return $types['archive'];
}

return $types['file'];
}
}
<?php










namespace LastCall\DownloadsPlugin;

use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\Installer\PackageEvent;
use Composer\Installer\PackageEvents;
use Composer\IO\IOInterface;
use Composer\Package\Package;
use Composer\Package\PackageInterface;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use LastCall\DownloadsPlugin\Handler\BaseHandler;

class Plugin implements PluginInterface, EventSubscriberInterface
{


private $composer;

private $io;

private $parser;

public function __construct()
{
$this->parser = new DownloadsParser();
}

public static function getSubscribedEvents()
{
return [
PackageEvents::POST_PACKAGE_INSTALL => ['installDownloads', 10],
PackageEvents::POST_PACKAGE_UPDATE => ['updateDownloads', 10],
ScriptEvents::POST_INSTALL_CMD => ['installDownloadsRoot', 10],
ScriptEvents::POST_UPDATE_CMD => ['installDownloadsRoot', 10],
];
}

public function installDownloadsRoot(Event $event) {
$rootPackage = $this->composer->getPackage();
$this->installUpdateDownloads(getcwd(), $rootPackage);


 $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
$installationManager = $this->composer->getInstallationManager();
foreach ($localRepo->getCanonicalPackages() as $package) {

if (!empty($package->getExtra()['downloads'])) {
$this->installUpdateDownloads($installationManager->getInstallPath($package), $package);
}
}
}
public function installDownloads(PackageEvent $event)
{

$package = $event->getOperation()->getPackage();
$installationManager = $event->getComposer()->getInstallationManager();
$this->installUpdateDownloads($installationManager->getInstallPath($package), $package);
}

public function updateDownloads(PackageEvent $event)
{

$package = $event->getOperation()->getTargetPackage();
$installationManager = $event->getComposer()->getInstallationManager();
$this->installUpdateDownloads($installationManager->getInstallPath($package), $package);
}

public function activate(Composer $composer, IOInterface $io)
{
$this->composer = $composer;
$this->io = $io;
}

public function deactivate(Composer $composer, IOInterface $io)
{

 }

public function uninstall(Composer $composer, IOInterface $io)
{

 }





protected function installUpdateDownloads($basePath, $package)
{
$first = TRUE;
foreach ($this->parser->parse($package, $basePath) as $extraFileHandler) {

$extraFilePkg = $extraFileHandler->getSubpackage();
$targetPath = $extraFileHandler->getTargetPath();
$trackingFile = $extraFileHandler->getTrackingFile();

if (file_exists($targetPath) && !file_exists($trackingFile)) {
$this->io->write(sprintf("<info>Extra file <comment>%s</comment> has been locally overriden in <comment>%s</comment>. To reset it, delete and reinstall.</info>", $extraFilePkg->getName(), $extraFilePkg->getTargetDir()), TRUE);
continue;
}

if (file_exists($targetPath) && file_exists($trackingFile)) {
$meta = @json_decode(file_get_contents($trackingFile), 1);
if (isset($meta['checksum']) && $meta['checksum'] === $extraFileHandler->getChecksum()) {
$this->io->write(sprintf("<info>Skip extra file <comment>%s</comment></info>", $extraFilePkg->getName()), TRUE, IOInterface::VERY_VERBOSE);
continue;
}
}

if ($first) {
$this->io->write(sprintf("<info>Download extra files for <comment>%s</comment></info>", $package->getName()));
$first = FALSE;
}

$this->io->write(sprintf("<info>Download extra file <comment>%s</comment></info>", $extraFilePkg->getName()), TRUE, IOInterface::VERBOSE);
$extraFileHandler->download($this->composer, $this->io);

if (!file_exists(dirname($trackingFile))) {
mkdir(dirname($trackingFile), 0777, TRUE);
}
file_put_contents($trackingFile, json_encode(
$extraFileHandler->createTrackingData(),
JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES
));
}
}

}
<?php










namespace LastCall\DownloadsPlugin;

use Composer\IO\IOInterface;
use Composer\Package\Package;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface;







class Subpackage extends Package
{




private $parent;

public function __construct(PackageInterface $parent, $id, $url, $type, $path, $version = NULL, $prettyVersion = NULL)
{
parent::__construct(
sprintf('%s:%s', $parent->getName(), $id),
$version ? $version : $parent->getVersion(),
$prettyVersion ? $prettyVersion : $parent->getPrettyVersion()
);
$this->parent = $parent;
$this->id = $id;
$this->setDistUrl($url);
$this->setDistType($type);
$this->setTargetDir($path);
$this->setInstallationSource('dist');
}

}
<?php

namespace LastCall\DownloadsPlugin\Handler;

use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
use React\Promise\PromiseInterface;

class FileHandler extends BaseHandler
{
const TMP_PREFIX = '.composer-extra-tmp-';

public function createSubpackage()
{
$pkg = parent::createSubpackage();
$pkg->setDistType('file');
return $pkg;
}

public function getTrackingFile()
{
$file = basename($this->extraFile['id']) . '-' . md5($this->extraFile['id']) . '.json';
return
dirname($this->getTargetPath()) .
DIRECTORY_SEPARATOR . self::DOT_DIR .
DIRECTORY_SEPARATOR . $file;
}





public function download(Composer $composer, IOInterface $io) {

 

$cfs = new Filesystem();
$target = $this->getTargetPath();
$tmpDir = dirname($target) . DIRECTORY_SEPARATOR . self::TMP_PREFIX . basename($target);

if (file_exists($tmpDir)) {
$cfs->remove($tmpDir);
}
if (file_exists($target)) {
$cfs->remove($target);
}

$pkg = clone $this->getSubpackage();
$pkg->setTargetDir($tmpDir);
$downloadManager = $composer->getDownloadManager();

 $version = method_exists(Composer::class, 'getVersion') ? Composer::getVersion() : Composer::VERSION;
if (version_compare($version, '2.0.0') >= 0) {
$file = '';
$promise = $downloadManager->download($pkg, $tmpDir);
$promise->then(static function($res) use (&$file) {
$file = $res;
});
$composer->getLoop()->wait([$promise]);
$cfs->rename($file, $target);
$cfs->remove($tmpDir);
}

 else {
$downloadManager->download($pkg, $tmpDir);
foreach ((array)glob("$tmpDir/*") as $file) {
if (is_file($file)) {
$cfs->rename($file, $target);
$cfs->remove($tmpDir);
break;
}
}
}
}

}
<?php

namespace LastCall\DownloadsPlugin\Handler;

use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Util\Platform;


class PharHandler extends FileHandler
{





public function download(Composer $composer, IOInterface $io) {
parent::download($composer, $io);

if (Platform::isWindows()) {

 } else {
chmod($this->getTargetPath(), 0777 ^ umask());
}
}


}
<?php







namespace LastCall\DownloadsPlugin\Handler;

use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
use Composer\Package\RootPackageInterface;
use Composer\Package\Version\VersionParser;
use LastCall\DownloadsPlugin\Subpackage;


abstract class BaseHandler
{
const FAKE_VERSION = 'dev-master';
const DOT_DIR = '.composer-downloads';





protected $extraFile;




protected $parent;





protected $parentPath;




protected $subpackage;







public function __construct(PackageInterface $parent, $parentPath, $extraFile)
{
$this->parent = $parent;
$this->parentPath = $parentPath;
$this->extraFile = $extraFile;
}

public function getSubpackage() {
if ($this->subpackage === NULL) {
$this->subpackage = $this->createSubpackage();
}
return $this->subpackage;
}




public function createSubpackage()
{
$versionParser = new VersionParser();
$extraFile = $this->extraFile;
$parent = $this->parent;

if (isset($extraFile['version'])) {

 $version = $versionParser->normalize(self::FAKE_VERSION);
$prettyVersion = $extraFile['version'];
}
elseif ($parent instanceof RootPackageInterface) {
$version = $versionParser->normalize(self::FAKE_VERSION);
$prettyVersion = self::FAKE_VERSION;
}
else {
$version = $parent->getVersion();
$prettyVersion = $parent->getPrettyVersion();
}

$package = new Subpackage(
$parent,
$extraFile['id'],
$extraFile['url'],
NULL,
$extraFile['path'],
$version,
$prettyVersion
);

return $package;
}

public function createTrackingData() {
return [
'name' => $this->getSubpackage()->getName(),
'url' => $this->getSubpackage()->getDistUrl(),
'checksum' => $this->getChecksum(),
];
}







public function getChecksum() {
$extraFile = $this->extraFile;
return hash('sha256', serialize([
get_class($this),
$extraFile['id'],
$extraFile['url'],
$extraFile['path'],
]));
}




public function getTargetPath()
{
return $this->parentPath . '/' . $this->extraFile['path'];
}





abstract public function download(Composer $composer, IOInterface $io);




abstract public function getTrackingFile();

}<?php

namespace LastCall\DownloadsPlugin\Handler;

use Composer\Composer;
use Composer\IO\IOInterface;
use LastCall\DownloadsPlugin\GlobCleaner;

class ArchiveHandler extends BaseHandler
{

public function createSubpackage()
{
$pkg = parent::createSubpackage();
$pkg->setDistType($this->parseDistType($this->extraFile['url']));
return $pkg;
}

protected function parseDistType($url)
{
$parts = parse_url($url);
$filename = pathinfo($parts['path'], PATHINFO_BASENAME);
if (preg_match('/\.zip$/', $filename)) {
return 'zip';
} elseif (preg_match('/\.(tar\.gz|tgz)$/', $filename)) {
return 'tar';
} else {
throw new \RuntimeException("Failed to determine archive type for $filename");
}
}

public function getTrackingFile()
{
$file = basename($this->extraFile['id']) . '-' . md5($this->extraFile['id']) . '.json';
return
$this->getTargetPath() .
DIRECTORY_SEPARATOR . self::DOT_DIR .
DIRECTORY_SEPARATOR . $file;
}

public function createTrackingData()
{
$meta = parent::createTrackingData();
$meta['ignore'] = $this->findIgnores();
return $meta;
}


public function getChecksum() {
$ignore = empty($this->extraFile['ignore']) ? [] : array_values($this->extraFile['ignore']);
sort($ignore);
return hash('sha256', parent::getChecksum() . serialize($ignore));
}






public function findIgnores()
{
return isset($this->extraFile['ignore'])
? $this->extraFile['ignore']
: NULL;
}





public function download(Composer $composer, IOInterface $io)
{
$targetPath = $this->getTargetPath();
$downloadManager = $composer->getDownloadManager();


 $version = method_exists(Composer::class, 'getVersion') ? Composer::getVersion() : Composer::VERSION;
if (version_compare($version, '2.0.0') >= 0) {
$promise = $downloadManager->download($this->getSubpackage(), $targetPath);
$composer->getLoop()->wait([$promise]);
$promise = $downloadManager->install($this->getSubpackage(), $targetPath);
$composer->getLoop()->wait([$promise]);
} else {
$downloadManager->download($this->getSubpackage(), $targetPath);
}
GlobCleaner::clean($io, $targetPath, $this->findIgnores());
}

}
<?php










namespace Psy;

use JakubOnderka\PhpConsoleColor\ConsoleColor;
use JakubOnderka\PhpConsoleHighlighter\Highlighter;




class ConsoleColorFactory
{
private $colorMode;




public function __construct($colorMode)
{
$this->colorMode = $colorMode;
}







public function getConsoleColor()
{
if ($this->colorMode === Configuration::COLOR_MODE_AUTO) {
return $this->getDefaultConsoleColor();
} elseif ($this->colorMode === Configuration::COLOR_MODE_FORCED) {
return $this->getForcedConsoleColor();
} elseif ($this->colorMode === Configuration::COLOR_MODE_DISABLED) {
return $this->getDisabledConsoleColor();
}
}

private function getDefaultConsoleColor()
{
$color = new ConsoleColor();
$color->addTheme(Highlighter::LINE_NUMBER, ['blue']);
$color->addTheme(Highlighter::TOKEN_KEYWORD, ['yellow']);
$color->addTheme(Highlighter::TOKEN_STRING, ['green']);
$color->addTheme(Highlighter::TOKEN_COMMENT, ['dark_gray']);

return $color;
}

private function getForcedConsoleColor()
{
$color = $this->getDefaultConsoleColor();
$color->setForceStyle(true);

return $color;
}

private function getDisabledConsoleColor()
{
$color = new ConsoleColor();

$color->addTheme(Highlighter::TOKEN_STRING, ['none']);
$color->addTheme(Highlighter::TOKEN_COMMENT, ['none']);
$color->addTheme(Highlighter::TOKEN_KEYWORD, ['none']);
$color->addTheme(Highlighter::TOKEN_DEFAULT, ['none']);
$color->addTheme(Highlighter::TOKEN_HTML, ['none']);
$color->addTheme(Highlighter::ACTUAL_LINE_MARK, ['none']);
$color->addTheme(Highlighter::LINE_NUMBER, ['none']);

return $color;
}
}
<?php










namespace Psy\Formatter;

use JakubOnderka\PhpConsoleHighlighter\Highlighter;
use Psy\Configuration;
use Psy\ConsoleColorFactory;
use Psy\Exception\RuntimeException;




class CodeFormatter implements Formatter
{








public static function format(\Reflector $reflector, $colorMode = null)
{
if (!self::isReflectable($reflector)) {
throw new RuntimeException('Source code unavailable');
}

$colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO;

if ($fileName = $reflector->getFileName()) {
if (!\is_file($fileName)) {
throw new RuntimeException('Source code unavailable');
}

$file = \file_get_contents($fileName);
$start = $reflector->getStartLine();
$end = $reflector->getEndLine() - $start;

$factory = new ConsoleColorFactory($colorMode);
$colors = $factory->getConsoleColor();
$highlighter = new Highlighter($colors);

return $highlighter->getCodeSnippet($file, $start, 0, $end);
} else {
throw new RuntimeException('Source code unavailable');
}
}








private static function isReflectable(\Reflector $reflector)
{
return $reflector instanceof \ReflectionClass ||
$reflector instanceof \ReflectionFunctionAbstract;
}
}
<?php










namespace Psy\Formatter;




interface Formatter
{





public static function format(\Reflector $reflector);
}
<?php










namespace Psy\Formatter;

use Psy\Util\Docblock;
use Symfony\Component\Console\Formatter\OutputFormatter;




class DocblockFormatter implements Formatter
{
private static $vectorParamTemplates = [
'type' => 'info',
'var' => 'strong',
];








public static function format(\Reflector $reflector)
{
$docblock = new Docblock($reflector);
$chunks = [];

if (!empty($docblock->desc)) {
$chunks[] = '<comment>Description:</comment>';
$chunks[] = self::indent(OutputFormatter::escape($docblock->desc), '  ');
$chunks[] = '';
}

if (!empty($docblock->tags)) {
foreach ($docblock::$vectors as $name => $vector) {
if (isset($docblock->tags[$name])) {
$chunks[] = \sprintf('<comment>%s:</comment>', self::inflect($name));
$chunks[] = self::formatVector($vector, $docblock->tags[$name]);
$chunks[] = '';
}
}

$tags = self::formatTags(\array_keys($docblock::$vectors), $docblock->tags);
if (!empty($tags)) {
$chunks[] = $tags;
$chunks[] = '';
}
}

return \rtrim(\implode("\n", $chunks));
}











private static function formatVector(array $vector, array $lines)
{
$template = [' '];
foreach ($vector as $type) {
$max = 0;
foreach ($lines as $line) {
$chunk = $line[$type];
$cur = empty($chunk) ? 0 : \strlen($chunk) + 1;
if ($cur > $max) {
$max = $cur;
}
}

$template[] = self::getVectorParamTemplate($type, $max);
}
$template = \implode(' ', $template);

return \implode("\n", \array_map(function ($line) use ($template) {
$escaped = \array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $line);

return \rtrim(\vsprintf($template, $escaped));
}, $lines));
}









private static function formatTags(array $skip, array $tags)
{
$chunks = [];

foreach ($tags as $name => $values) {
if (\in_array($name, $skip)) {
continue;
}

foreach ($values as $value) {
$chunks[] = \sprintf('<comment>%s%s</comment> %s', self::inflect($name), empty($value) ? '' : ':', OutputFormatter::escape($value));
}

$chunks[] = '';
}

return \implode("\n", $chunks);
}









private static function getVectorParamTemplate($type, $max)
{
if (!isset(self::$vectorParamTemplates[$type])) {
return \sprintf('%%-%ds', $max);
}

return \sprintf('<%s>%%-%ds</%s>', self::$vectorParamTemplates[$type], $max, self::$vectorParamTemplates[$type]);
}









private static function indent($text, $indent = '  ')
{
return $indent . \str_replace("\n", "\n" . $indent, $text);
}








private static function inflect($text)
{
$words = \trim(\preg_replace('/[\s_-]+/', ' ', \preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));

return \implode(' ', \array_map('ucfirst', \explode(' ', $words)));
}
}
<?php










namespace Psy\Formatter;

use Psy\Reflection\ReflectionClassConstant;
use Psy\Reflection\ReflectionConstant_;
use Psy\Reflection\ReflectionLanguageConstruct;
use Psy\Util\Json;
use Symfony\Component\Console\Formatter\OutputFormatter;




class SignatureFormatter implements Formatter
{









public static function format(\Reflector $reflector)
{
switch (true) {
case $reflector instanceof \ReflectionFunction:
case $reflector instanceof ReflectionLanguageConstruct:
return self::formatFunction($reflector);


 case $reflector instanceof \ReflectionClass:
return self::formatClass($reflector);

case $reflector instanceof ReflectionClassConstant:
case $reflector instanceof \ReflectionClassConstant:
return self::formatClassConstant($reflector);

case $reflector instanceof \ReflectionMethod:
return self::formatMethod($reflector);

case $reflector instanceof \ReflectionProperty:
return self::formatProperty($reflector);

case $reflector instanceof ReflectionConstant_:
return self::formatConstant($reflector);

default:
throw new \InvalidArgumentException('Unexpected Reflector class: ' . \get_class($reflector));
}
}








public static function formatName(\Reflector $reflector)
{
return $reflector->getName();
}








private static function formatModifiers(\Reflector $reflector)
{
if ($reflector instanceof \ReflectionClass && $reflector->isTrait()) {

 
 if (\version_compare(PHP_VERSION, '7.0.0', '<')) {
return [];
}
}

return \implode(' ', \array_map(function ($modifier) {
return \sprintf('<keyword>%s</keyword>', $modifier);
}, \Reflection::getModifierNames($reflector->getModifiers())));
}








private static function formatClass(\ReflectionClass $reflector)
{
$chunks = [];

if ($modifiers = self::formatModifiers($reflector)) {
$chunks[] = $modifiers;
}

if ($reflector->isTrait()) {
$chunks[] = 'trait';
} else {
$chunks[] = $reflector->isInterface() ? 'interface' : 'class';
}

$chunks[] = \sprintf('<class>%s</class>', self::formatName($reflector));

if ($parent = $reflector->getParentClass()) {
$chunks[] = 'extends';
$chunks[] = \sprintf('<class>%s</class>', $parent->getName());
}

$interfaces = $reflector->getInterfaceNames();
if (!empty($interfaces)) {
\sort($interfaces);

$chunks[] = $reflector->isInterface() ? 'extends' : 'implements';
$chunks[] = \implode(', ', \array_map(function ($name) {
return \sprintf('<class>%s</class>', $name);
}, $interfaces));
}

return \implode(' ', $chunks);
}








private static function formatClassConstant($reflector)
{
$value = $reflector->getValue();
$style = self::getTypeStyle($value);

return \sprintf(
'<keyword>const</keyword> <const>%s</const> = <%s>%s</%s>',
self::formatName($reflector),
$style,
OutputFormatter::escape(Json::encode($value)),
$style
);
}








private static function formatConstant($reflector)
{
$value = $reflector->getValue();
$style = self::getTypeStyle($value);

return \sprintf(
'<keyword>define</keyword>(<string>%s</string>, <%s>%s</%s>)',
OutputFormatter::escape(Json::encode($reflector->getName())),
$style,
OutputFormatter::escape(Json::encode($value)),
$style
);
}








private static function getTypeStyle($value)
{
if (\is_int($value) || \is_float($value)) {
return 'number';
} elseif (\is_string($value)) {
return 'string';
} elseif (\is_bool($value) || \is_null($value)) {
return 'bool';
} else {
return 'strong'; 
 }
}








private static function formatProperty(\ReflectionProperty $reflector)
{
return \sprintf(
'%s <strong>$%s</strong>',
self::formatModifiers($reflector),
$reflector->getName()
);
}








private static function formatFunction(\ReflectionFunctionAbstract $reflector)
{
return \sprintf(
'<keyword>function</keyword> %s<function>%s</function>(%s)',
$reflector->returnsReference() ? '&' : '',
self::formatName($reflector),
\implode(', ', self::formatFunctionParams($reflector))
);
}








private static function formatMethod(\ReflectionMethod $reflector)
{
return \sprintf(
'%s %s',
self::formatModifiers($reflector),
self::formatFunction($reflector)
);
}








private static function formatFunctionParams(\ReflectionFunctionAbstract $reflector)
{
$params = [];
foreach ($reflector->getParameters() as $param) {
$hint = '';
try {
if ($param->isArray()) {
$hint = '<keyword>array</keyword> ';
} elseif ($class = $param->getClass()) {
$hint = \sprintf('<class>%s</class> ', $class->getName());
}
} catch (\Exception $e) {

 
 




 $chunks = \explode('$' . $param->getName(), (string) $param);
$chunks = \explode(' ', \trim($chunks[0]));
$guess = \end($chunks);

$hint = \sprintf('<urgent>%s</urgent> ', $guess);

 }

if ($param->isOptional()) {
if (!$param->isDefaultValueAvailable()) {
$value = 'unknown';
$typeStyle = 'urgent';
} else {
$value = $param->getDefaultValue();
$typeStyle = self::getTypeStyle($value);
$value = \is_array($value) ? '[]' : (\is_null($value) ? 'null' : \var_export($value, true));
}
$default = \sprintf(' = <%s>%s</%s>', $typeStyle, OutputFormatter::escape($value), $typeStyle);
} else {
$default = '';
}

$params[] = \sprintf(
'%s%s<strong>$%s</strong>%s',
$param->isPassedByReference() ? '&' : '',
$hint,
$param->getName(),
$default
);
}

return $params;
}
}
<?php










namespace Psy\Readline;




interface Readline
{





public static function isSupported();








public function addHistory($line);






public function clearHistory();






public function listHistory();






public function readHistory();








public function readline($prompt = null);




public function redisplay();






public function writeHistory();
}
<?php










namespace Psy\Readline;

use Hoa\Console\Readline\Readline as HoaReadline;
use Psy\Exception\BreakException;




class HoaConsole implements Readline
{

private $hoaReadline;




public static function isSupported()
{
return \class_exists('\Hoa\Console\Console', true);
}

public function __construct()
{
$this->hoaReadline = new HoaReadline();
}




public function addHistory($line)
{
$this->hoaReadline->addHistory($line);

return true;
}




public function clearHistory()
{
$this->hoaReadline->clearHistory();

return true;
}




public function listHistory()
{
$i = 0;
$list = [];
while (($item = $this->hoaReadline->getHistory($i++)) !== null) {
$list[] = $item;
}

return $list;
}




public function readHistory()
{
return true;
}








public function readline($prompt = null)
{
return $this->hoaReadline->readLine($prompt);
}




public function redisplay()
{

 }




public function writeHistory()
{
return true;
}
}
<?php










namespace Psy\Readline;

use Psy\Util\Str;








class Libedit extends GNUReadline
{
private $hasWarnedOwnership = false;






public static function isSupported()
{
return \function_exists('readline') && !\function_exists('readline_list_history');
}




public function listHistory()
{
$history = \file_get_contents($this->historyFile);
if (!$history) {
return [];
}


 $history = \explode("\n", $history);


 if (\array_shift($history) !== '_HiStOrY_V2_') {
return [];
}


 $history = \array_map([$this, 'parseHistoryLine'], $history);

 return \array_values(\array_filter($history));
}




public function writeHistory()
{
$res = parent::writeHistory();


 
 
 
 if ($res === false && !$this->hasWarnedOwnership) {
if (\is_file($this->historyFile) && \is_writable($this->historyFile)) {
$this->hasWarnedOwnership = true;
$msg = \sprintf('Error writing history file, check file ownership: %s', $this->historyFile);
\trigger_error($msg, E_USER_NOTICE);
}
}

return $res;
}











protected function parseHistoryLine($line)
{

 if (!$line || $line[0] === "\0") {
return;
}

 
 if (($pos = \strpos($line, "\0")) !== false) {
$line = \substr($line, 0, $pos);
}

return ($line !== '') ? Str::unvis($line) : null;
}
}
<?php










namespace Psy\Readline;

use Psy\Exception\BreakException;




class Transient implements Readline
{
private $history;
private $historySize;
private $eraseDups;
private $stdin;






public static function isSupported()
{
return true;
}




public function __construct($historyFile = null, $historySize = 0, $eraseDups = false)
{

 $this->history = [];
$this->historySize = $historySize;
$this->eraseDups = $eraseDups;
}




public function addHistory($line)
{
if ($this->eraseDups) {
if (($key = \array_search($line, $this->history)) !== false) {
unset($this->history[$key]);
}
}

$this->history[] = $line;

if ($this->historySize > 0) {
$histsize = \count($this->history);
if ($histsize > $this->historySize) {
$this->history = \array_slice($this->history, $histsize - $this->historySize);
}
}

$this->history = \array_values($this->history);

return true;
}




public function clearHistory()
{
$this->history = [];

return true;
}




public function listHistory()
{
return $this->history;
}




public function readHistory()
{
return true;
}








public function readline($prompt = null)
{
echo $prompt;

return \rtrim(\fgets($this->getStdin()), "\n\r");
}




public function redisplay()
{

 }




public function writeHistory()
{
return true;
}








private function getStdin()
{
if (!isset($this->stdin)) {
$this->stdin = \fopen('php://stdin', 'r');
}

if (\feof($this->stdin)) {
throw new BreakException('Ctrl+D');
}

return $this->stdin;
}
}
<?php










namespace Psy\Readline;








class GNUReadline implements Readline
{

protected $historyFile;

protected $historySize;

protected $eraseDups;








public static function isSupported()
{
return \function_exists('readline_list_history');
}








public function __construct($historyFile = null, $historySize = 0, $eraseDups = false)
{
$this->historyFile = ($historyFile !== null) ? $historyFile : false;
$this->historySize = $historySize;
$this->eraseDups = $eraseDups;


 if (!\defined('HHVM_VERSION')) {
\readline_info('readline_name', 'psysh');
}
}




public function addHistory($line)
{
if ($res = \readline_add_history($line)) {
$this->writeHistory();
}

return $res;
}




public function clearHistory()
{
if ($res = \readline_clear_history()) {
$this->writeHistory();
}

return $res;
}




public function listHistory()
{
return readline_list_history();
}




public function readHistory()
{

 
 
 
 
 
 if (\version_compare(PHP_VERSION, '5.6.7', '>=') || !\ini_get('open_basedir')) {
\readline_read_history();
}
\readline_clear_history();

return \readline_read_history($this->historyFile);
}




public function readline($prompt = null)
{
return \readline($prompt);
}




public function redisplay()
{
\readline_redisplay();
}




public function writeHistory()
{

 
 if ($this->historyFile !== false) {
$res = \readline_write_history($this->historyFile);
} else {
$res = true;
}

if (!$res || !$this->eraseDups && !$this->historySize > 0) {
return $res;
}

$hist = $this->listHistory();
if (!$hist) {
return true;
}

if ($this->eraseDups) {

 $hist = \array_flip(\array_flip($hist));

 \ksort($hist);
}

if ($this->historySize > 0) {
$histsize = \count($hist);
if ($histsize > $this->historySize) {
$hist = \array_slice($hist, $histsize - $this->historySize);
}
}

\readline_clear_history();
foreach ($hist as $line) {
\readline_add_history($line);
}

if ($this->historyFile !== false) {
return \readline_write_history($this->historyFile);
}

return true;
}
}
<?php










namespace Psy;







class Context
{
private static $specialNames = ['_', '_e', '__out', '__psysh__', 'this'];


 
 private static $commandScopeNames = [
'__function', '__method', '__class', '__namespace', '__file', '__line', '__dir',
];

private $scopeVariables = [];
private $commandScopeVariables = [];
private $returnValue;
private $lastException;
private $lastStdout;
private $boundObject;
private $boundClass;










public function get($name)
{
switch ($name) {
case '_':
return $this->returnValue;

case '_e':
if (isset($this->lastException)) {
return $this->lastException;
}
break;

case '__out':
if (isset($this->lastStdout)) {
return $this->lastStdout;
}
break;

case 'this':
if (isset($this->boundObject)) {
return $this->boundObject;
}
break;

case '__function':
case '__method':
case '__class':
case '__namespace':
case '__file':
case '__line':
case '__dir':
if (\array_key_exists($name, $this->commandScopeVariables)) {
return $this->commandScopeVariables[$name];
}
break;

default:
if (\array_key_exists($name, $this->scopeVariables)) {
return $this->scopeVariables[$name];
}
break;
}

throw new \InvalidArgumentException('Unknown variable: $' . $name);
}






public function getAll()
{
return \array_merge($this->scopeVariables, $this->getSpecialVariables());
}






public function getSpecialVariables()
{
$vars = [
'_' => $this->returnValue,
];

if (isset($this->lastException)) {
$vars['_e'] = $this->lastException;
}

if (isset($this->lastStdout)) {
$vars['__out'] = $this->lastStdout;
}

if (isset($this->boundObject)) {
$vars['this'] = $this->boundObject;
}

return \array_merge($vars, $this->commandScopeVariables);
}









public function setAll(array $vars)
{
foreach (self::$specialNames as $key) {
unset($vars[$key]);
}

foreach (self::$commandScopeNames as $key) {
unset($vars[$key]);
}

$this->scopeVariables = $vars;
}






public function setReturnValue($value)
{
$this->returnValue = $value;
}






public function getReturnValue()
{
return $this->returnValue;
}






public function setLastException(\Exception $e)
{
$this->lastException = $e;
}








public function getLastException()
{
if (!isset($this->lastException)) {
throw new \InvalidArgumentException('No most-recent exception');
}

return $this->lastException;
}






public function setLastStdout($lastStdout)
{
$this->lastStdout = $lastStdout;
}








public function getLastStdout()
{
if (!isset($this->lastStdout)) {
throw new \InvalidArgumentException('No most-recent output');
}

return $this->lastStdout;
}








public function setBoundObject($boundObject)
{
$this->boundObject = \is_object($boundObject) ? $boundObject : null;
$this->boundClass = null;
}






public function getBoundObject()
{
return $this->boundObject;
}








public function setBoundClass($boundClass)
{
$this->boundClass = (\is_string($boundClass) && $boundClass !== '') ? $boundClass : null;
$this->boundObject = null;
}






public function getBoundClass()
{
return $this->boundClass;
}






public function setCommandScopeVariables(array $commandScopeVariables)
{
$vars = [];
foreach ($commandScopeVariables as $key => $value) {

 if (\is_scalar($value) && \in_array($key, self::$commandScopeNames)) {
$vars[$key] = $value;
}
}

$this->commandScopeVariables = $vars;
}






public function getCommandScopeVariables()
{
return $this->commandScopeVariables;
}









public function getUnusedCommandScopeVariableNames()
{
return \array_diff(self::$commandScopeNames, \array_keys($this->commandScopeVariables));
}








public static function isSpecialVariableName($name)
{
return \in_array($name, self::$specialNames) || \in_array($name, self::$commandScopeNames);
}
}
<?php










namespace Psy\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;






class ClearCommand extends Command
{



protected function configure()
{
$this
->setName('clear')
->setDefinition([])
->setDescription('Clear the Psy Shell screen.')
->setHelp(
<<<'HELP'
Clear the Psy Shell screen.

Pro Tip: If your PHP has readline support, you should be able to use ctrl+l too!
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$output->write(\sprintf('%c[2J%c[0;0f', 27, 27));

return 0;
}
}
<?php










namespace Psy\Command;

use JakubOnderka\PhpConsoleHighlighter\Highlighter;
use Psy\Configuration;
use Psy\ConsoleColorFactory;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;




class WhereamiCommand extends Command
{
private $colorMode;
private $backtrace;




public function __construct($colorMode = null)
{
$this->colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO;
$this->backtrace = \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);

parent::__construct();
}




protected function configure()
{
$this
->setName('whereami')
->setDefinition([
new InputOption('num', 'n', InputOption::VALUE_OPTIONAL, 'Number of lines before and after.', '5'),
])
->setDescription('Show where you are in the code.')
->setHelp(
<<<'HELP'
Show where you are in the code.

Optionally, include how many lines before and after you want to display.

e.g.
<return>> whereami </return>
<return>> whereami -n10</return>
HELP
);
}






protected function trace()
{
foreach (\array_reverse($this->backtrace) as $stackFrame) {
if ($this->isDebugCall($stackFrame)) {
return $stackFrame;
}
}

return \end($this->backtrace);
}

private static function isDebugCall(array $stackFrame)
{
$class = isset($stackFrame['class']) ? $stackFrame['class'] : null;
$function = isset($stackFrame['function']) ? $stackFrame['function'] : null;

return ($class === null && $function === 'Psy\debug') ||
($class === 'Psy\Shell' && \in_array($function, ['__construct', 'debug']));
}






protected function fileInfo()
{
$stackFrame = $this->trace();
if (\preg_match('/eval\(/', $stackFrame['file'])) {
\preg_match_all('/([^\(]+)\((\d+)/', $stackFrame['file'], $matches);
$file = $matches[1][0];
$line = (int) $matches[2][0];
} else {
$file = $stackFrame['file'];
$line = $stackFrame['line'];
}

return \compact('file', 'line');
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$info = $this->fileInfo();
$num = $input->getOption('num');
$factory = new ConsoleColorFactory($this->colorMode);
$colors = $factory->getConsoleColor();
$highlighter = new Highlighter($colors);
$contents = \file_get_contents($info['file']);

if ($output instanceof ShellOutput) {
$output->startPaging();
}

$output->writeln('');
$output->writeln(\sprintf('From <info>%s:%s</info>:', $this->replaceCwd($info['file']), $info['line']));
$output->writeln('');
$output->write($highlighter->getCodeSnippet($contents, $info['line'], $num, $num), false, OutputInterface::OUTPUT_RAW);

if ($output instanceof ShellOutput) {
$output->stopPaging();
}

return 0;
}








private function replaceCwd($file)
{
$cwd = \getcwd();
if ($cwd === false) {
return $file;
}

$cwd = \rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

return \preg_replace('/^' . \preg_quote($cwd, '/') . '/', '', $file);
}
}
<?php










namespace Psy\Command;

use Psy\Context;
use Psy\ContextAware;
use Psy\Input\FilterOptions;
use Psy\Output\ShellOutput;
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 WtfCommand extends TraceCommand implements ContextAware
{





protected $context;






public function setContext(Context $context)
{
$this->context = $context;
}




protected function configure()
{
list($grep, $insensitive, $invert) = FilterOptions::getOptions();

$this
->setName('wtf')
->setAliases(['last-exception', 'wtf?'])
->setDefinition([
new InputArgument('incredulity', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Number of lines to show.'),
new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show entire backtrace.'),

$grep,
$insensitive,
$invert,
])
->setDescription('Show the backtrace of the most recent exception.')
->setHelp(
<<<'HELP'
Shows a few lines of the backtrace of the most recent exception.

If you want to see more lines, add more question marks or exclamation marks:

e.g.
<return>>>> wtf ?</return>
<return>>>> wtf ?!???!?!?</return>

To see the entire backtrace, pass the -a/--all flag:

e.g.
<return>>>> wtf -a</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$this->filter->bind($input);

$incredulity = \implode('', $input->getArgument('incredulity'));
if (\strlen(\preg_replace('/[\\?!]/', '', $incredulity))) {
throw new \InvalidArgumentException('Incredulity must include only "?" and "!"');
}

$exception = $this->context->getLastException();
$count = $input->getOption('all') ? PHP_INT_MAX : \max(3, \pow(2, \strlen($incredulity) + 1));

$shell = $this->getApplication();

if ($output instanceof ShellOutput) {
$output->startPaging();
}

do {
$traceCount = \count($exception->getTrace());
$showLines = $count;

 if ($traceCount < \max($count * 1.2, $count + 2)) {
$showLines = PHP_INT_MAX;
}

$trace = $this->getBacktrace($exception, $showLines);
$moreLines = $traceCount - \count($trace);

$output->writeln($shell->formatException($exception));
$output->writeln('--');
$output->write($trace, true, ShellOutput::NUMBER_LINES);
$output->writeln('');

if ($moreLines > 0) {
$output->writeln(\sprintf(
'<aside>Use <return>wtf -a</return> to see %d more lines</aside>',
$moreLines
));
$output->writeln('');
}
} while ($exception = $exception->getPrevious());

if ($output instanceof ShellOutput) {
$output->stopPaging();
}

return 0;
}
}
<?php










namespace Psy\Command;

use Psy\Command\ListCommand\ClassConstantEnumerator;
use Psy\Command\ListCommand\ClassEnumerator;
use Psy\Command\ListCommand\ConstantEnumerator;
use Psy\Command\ListCommand\FunctionEnumerator;
use Psy\Command\ListCommand\GlobalVariableEnumerator;
use Psy\Command\ListCommand\MethodEnumerator;
use Psy\Command\ListCommand\PropertyEnumerator;
use Psy\Command\ListCommand\VariableEnumerator;
use Psy\Exception\RuntimeException;
use Psy\Input\CodeArgument;
use Psy\Input\FilterOptions;
use Psy\Output\ShellOutput;
use Psy\VarDumper\Presenter;
use Psy\VarDumper\PresenterAware;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;




class ListCommand extends ReflectingCommand implements PresenterAware
{
protected $presenter;
protected $enumerators;






public function setPresenter(Presenter $presenter)
{
$this->presenter = $presenter;
}




protected function configure()
{
list($grep, $insensitive, $invert) = FilterOptions::getOptions();

$this
->setName('ls')
->setAliases(['dir'])
->setDefinition([
new CodeArgument('target', CodeArgument::OPTIONAL, 'A target class or object to list.'),

new InputOption('vars', '', InputOption::VALUE_NONE, 'Display variables.'),
new InputOption('constants', 'c', InputOption::VALUE_NONE, 'Display defined constants.'),
new InputOption('functions', 'f', InputOption::VALUE_NONE, 'Display defined functions.'),
new InputOption('classes', 'k', InputOption::VALUE_NONE, 'Display declared classes.'),
new InputOption('interfaces', 'I', InputOption::VALUE_NONE, 'Display declared interfaces.'),
new InputOption('traits', 't', InputOption::VALUE_NONE, 'Display declared traits.'),

new InputOption('no-inherit', '', InputOption::VALUE_NONE, 'Exclude inherited methods, properties and constants.'),

new InputOption('properties', 'p', InputOption::VALUE_NONE, 'Display class or object properties (public properties by default).'),
new InputOption('methods', 'm', InputOption::VALUE_NONE, 'Display class or object methods (public methods by default).'),

$grep,
$insensitive,
$invert,

new InputOption('globals', 'g', InputOption::VALUE_NONE, 'Include global variables.'),
new InputOption('internal', 'n', InputOption::VALUE_NONE, 'Limit to internal functions and classes.'),
new InputOption('user', 'u', InputOption::VALUE_NONE, 'Limit to user-defined constants, functions and classes.'),
new InputOption('category', 'C', InputOption::VALUE_REQUIRED, 'Limit to constants in a specific category (e.g. "date").'),

new InputOption('all', 'a', InputOption::VALUE_NONE, 'Include private and protected methods and properties.'),
new InputOption('long', 'l', InputOption::VALUE_NONE, 'List in long format: includes class names and method signatures.'),
])
->setDescription('List local, instance or class variables, methods and constants.')
->setHelp(
<<<'HELP'
List variables, constants, classes, interfaces, traits, functions, methods,
and properties.

Called without options, this will return a list of variables currently in scope.

If a target object is provided, list properties, constants and methods of that
target. If a class, interface or trait name is passed instead, list constants
and methods on that class.

e.g.
<return>>>> ls</return>
<return>>>> ls $foo</return>
<return>>>> ls -k --grep mongo -i</return>
<return>>>> ls -al ReflectionClass</return>
<return>>>> ls --constants --category date</return>
<return>>>> ls -l --functions --grep /^array_.*/</return>
<return>>>> ls -l --properties new DateTime()</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$this->validateInput($input);
$this->initEnumerators();

$method = $input->getOption('long') ? 'writeLong' : 'write';

if ($target = $input->getArgument('target')) {
list($target, $reflector) = $this->getTargetAndReflector($target);
} else {
$reflector = null;
}


 if ($output instanceof ShellOutput && $input->getOption('long')) {
$output->startPaging();
}

foreach ($this->enumerators as $enumerator) {
$this->$method($output, $enumerator->enumerate($input, $reflector, $target));
}

if ($output instanceof ShellOutput && $input->getOption('long')) {
$output->stopPaging();
}


 if ($reflector !== null) {
$this->setCommandScopeVariables($reflector);
}

return 0;
}




protected function initEnumerators()
{
if (!isset($this->enumerators)) {
$mgr = $this->presenter;

$this->enumerators = [
new ClassConstantEnumerator($mgr),
new ClassEnumerator($mgr),
new ConstantEnumerator($mgr),
new FunctionEnumerator($mgr),
new GlobalVariableEnumerator($mgr),
new PropertyEnumerator($mgr),
new MethodEnumerator($mgr),
new VariableEnumerator($mgr, $this->context),
];
}
}







protected function write(OutputInterface $output, array $result)
{
if (\count($result) === 0) {
return;
}

foreach ($result as $label => $items) {
$names = \array_map([$this, 'formatItemName'], $items);
$output->writeln(\sprintf('<strong>%s</strong>: %s', $label, \implode(', ', $names)));
}
}









protected function writeLong(OutputInterface $output, array $result)
{
if (\count($result) === 0) {
return;
}

$table = $this->getTable($output);

foreach ($result as $label => $items) {
$output->writeln('');
$output->writeln(\sprintf('<strong>%s:</strong>', $label));

$table->setRows([]);
foreach ($items as $item) {
$table->addRow([$this->formatItemName($item), $item['value']]);
}

if ($table instanceof TableHelper) {
$table->render($output);
} else {
$table->render();
}
}
}








private function formatItemName($item)
{
return \sprintf('<%s>%s</%s>', $item['style'], OutputFormatter::escape($item['name']), $item['style']);
}








private function validateInput(InputInterface $input)
{
if (!$input->getArgument('target')) {

 foreach (['properties', 'methods', 'no-inherit'] as $option) {
if ($input->getOption($option)) {
throw new RuntimeException('--' . $option . ' does not make sense without a specified target');
}
}

foreach (['globals', 'vars', 'constants', 'functions', 'classes', 'interfaces', 'traits'] as $option) {
if ($input->getOption($option)) {
return;
}
}


 $input->setOption('vars', true);
} else {

 foreach (['vars', 'globals', 'functions', 'classes', 'interfaces', 'traits'] as $option) {
if ($input->getOption($option)) {
throw new RuntimeException('--' . $option . ' does not make sense with a specified target');
}
}

foreach (['constants', 'properties', 'methods'] as $option) {
if ($input->getOption($option)) {
return;
}
}


 $input->setOption('constants', true);
$input->setOption('properties', true);
$input->setOption('methods', true);
}
}
}
<?php










namespace Psy\Command\TimeitCommand;

use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Return_;
use PhpParser\NodeVisitorAbstract;
use Psy\CodeCleaner\NoReturnValue;







class TimeitVisitor extends NodeVisitorAbstract
{
private $functionDepth;




public function beforeTraverse(array $nodes)
{
$this->functionDepth = 0;
}




public function enterNode(Node $node)
{

 
 if ($node instanceof FunctionLike) {
$this->functionDepth++;

return;
}


 if ($this->functionDepth === 0 && $node instanceof Return_) {
return new Return_($this->getEndCall($node->expr), $node->getAttributes());
}
}




public function leaveNode(Node $node)
{
if ($node instanceof FunctionLike) {
$this->functionDepth--;
}
}




public function afterTraverse(array $nodes)
{

 \array_unshift($nodes, $this->maybeExpression($this->getStartCall()));


 $last = $nodes[\count($nodes) - 1];
if ($last instanceof Expr) {
\array_pop($nodes);
$nodes[] = $this->getEndCall($last);
} elseif ($last instanceof Expression) {
\array_pop($nodes);
$nodes[] = new Expression($this->getEndCall($last->expr), $last->getAttributes());
} elseif ($last instanceof Return_) {

 } else {
$nodes[] = $this->maybeExpression($this->getEndCall());
}

return $nodes;
}






private function getStartCall()
{
return new StaticCall(new FullyQualifiedName('Psy\Command\TimeitCommand'), 'markStart');
}










private function getEndCall(Expr $arg = null)
{
if ($arg === null) {
$arg = NoReturnValue::create();
}

return new StaticCall(new FullyQualifiedName('Psy\Command\TimeitCommand'), 'markEnd', [new Arg($arg)]);
}











private function maybeExpression($expr, $attrs = [])
{
return \class_exists('PhpParser\Node\Stmt\Expression') ? new Expression($expr, $attrs) : $expr;
}
}
<?php










namespace Psy\Command;

use PhpParser\Node\Arg;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Throw_;
use PhpParser\PrettyPrinter\Standard as Printer;
use Psy\Context;
use Psy\ContextAware;
use Psy\Input\CodeArgument;
use Psy\ParserFactory;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;




class ThrowUpCommand extends Command implements ContextAware
{
const THROW_CLASS = 'Psy\Exception\ThrowUpException';

private $parser;
private $printer;






protected $context;




public function __construct($name = null)
{
$parserFactory = new ParserFactory();

$this->parser = $parserFactory->createParser();
$this->printer = new Printer();

parent::__construct($name);
}






public function setContext(Context $context)
{
$this->context = $context;
}




protected function configure()
{
$this
->setName('throw-up')
->setDefinition([
new CodeArgument('exception', CodeArgument::OPTIONAL, 'Exception or Error to throw.'),
])
->setDescription('Throw an exception or error out of the Psy Shell.')
->setHelp(
<<<'HELP'
Throws an exception or error out of the current the Psy Shell instance.

By default it throws the most recent exception.

e.g.
<return>>>> throw-up</return>
<return>>>> throw-up $e</return>
<return>>>> throw-up new Exception('WHEEEEEE!')</return>
<return>>>> throw-up "bye!"</return>
HELP
);
}






protected function execute(InputInterface $input, OutputInterface $output)
{
$args = $this->prepareArgs($input->getArgument('exception'));
$throwStmt = new Throw_(new StaticCall(new FullyQualifiedName(self::THROW_CLASS), 'fromThrowable', $args));
$throwCode = $this->printer->prettyPrint([$throwStmt]);

$shell = $this->getApplication();
$shell->addCode($throwCode, !$shell->hasCode());

return 0;
}












private function prepareArgs($code = null)
{
if (!$code) {

 return [new Arg(new Variable('_e'))];
}

if (\strpos('<?', $code) === false) {
$code = '<?php ' . $code;
}

$nodes = $this->parse($code);
if (\count($nodes) !== 1) {
throw new \InvalidArgumentException('No idea how to throw this');
}

$node = $nodes[0];


 $expr = isset($node->expr) ? $node->expr : $node;

$args = [new Arg($expr, false, false, $node->getAttributes())];


 if ($expr instanceof String_) {
return [new New_(new FullyQualifiedName('Exception'), $args)];
}

return $args;
}








private function parse($code)
{
try {
return $this->parser->parse($code);
} catch (\PhpParser\Error $e) {
if (\strpos($e->getMessage(), 'unexpected EOF') === false) {
throw $e;
}


 return $this->parser->parse($code . ';');
}
}
}
<?php










namespace Psy\Command;

use Psy\Input\FilterOptions;
use Psy\Output\ShellOutput;
use Psy\Readline\Readline;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;






class HistoryCommand extends Command
{
private $filter;
private $readline;




public function __construct($name = null)
{
$this->filter = new FilterOptions();

parent::__construct($name);
}






public function setReadline(Readline $readline)
{
$this->readline = $readline;
}




protected function configure()
{
list($grep, $insensitive, $invert) = FilterOptions::getOptions();

$this
->setName('history')
->setAliases(['hist'])
->setDefinition([
new InputOption('show', 's', InputOption::VALUE_REQUIRED, 'Show the given range of lines.'),
new InputOption('head', 'H', InputOption::VALUE_REQUIRED, 'Display the first N items.'),
new InputOption('tail', 'T', InputOption::VALUE_REQUIRED, 'Display the last N items.'),

$grep,
$insensitive,
$invert,

new InputOption('no-numbers', 'N', InputOption::VALUE_NONE, 'Omit line numbers.'),

new InputOption('save', '', InputOption::VALUE_REQUIRED, 'Save history to a file.'),
new InputOption('replay', '', InputOption::VALUE_NONE, 'Replay.'),
new InputOption('clear', '', InputOption::VALUE_NONE, 'Clear the history.'),
])
->setDescription('Show the Psy Shell history.')
->setHelp(
<<<'HELP'
Show, search, save or replay the Psy Shell history.

e.g.
<return>>>> history --grep /[bB]acon/</return>
<return>>>> history --show 0..10 --replay</return>
<return>>>> history --clear</return>
<return>>>> history --tail 1000 --save somefile.txt</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$this->validateOnlyOne($input, ['show', 'head', 'tail']);
$this->validateOnlyOne($input, ['save', 'replay', 'clear']);

$history = $this->getHistorySlice(
$input->getOption('show'),
$input->getOption('head'),
$input->getOption('tail')
);
$highlighted = false;

$this->filter->bind($input);
if ($this->filter->hasFilter()) {
$matches = [];
$highlighted = [];
foreach ($history as $i => $line) {
if ($this->filter->match($line, $matches)) {
if (isset($matches[0])) {
$chunks = \explode($matches[0], $history[$i]);
$chunks = \array_map([__CLASS__, 'escape'], $chunks);
$glue = \sprintf('<urgent>%s</urgent>', self::escape($matches[0]));

$highlighted[$i] = \implode($glue, $chunks);
}
} else {
unset($history[$i]);
}
}
}

if ($save = $input->getOption('save')) {
$output->writeln(\sprintf('Saving history in %s...', $save));
\file_put_contents($save, \implode(PHP_EOL, $history) . PHP_EOL);
$output->writeln('<info>History saved.</info>');
} elseif ($input->getOption('replay')) {
if (!($input->getOption('show') || $input->getOption('head') || $input->getOption('tail'))) {
throw new \InvalidArgumentException('You must limit history via --head, --tail or --show before replaying');
}

$count = \count($history);
$output->writeln(\sprintf('Replaying %d line%s of history', $count, ($count !== 1) ? 's' : ''));
$this->getApplication()->addInput($history);
} elseif ($input->getOption('clear')) {
$this->clearHistory();
$output->writeln('<info>History cleared.</info>');
} else {
$type = $input->getOption('no-numbers') ? 0 : ShellOutput::NUMBER_LINES;
if (!$highlighted) {
$type = $type | OutputInterface::OUTPUT_RAW;
}

$output->page($highlighted ?: $history, $type);
}

return 0;
}








private function extractRange($range)
{
if (\preg_match('/^\d+$/', $range)) {
return [$range, $range + 1];
}

$matches = [];
if ($range !== '..' && \preg_match('/^(\d*)\.\.(\d*)$/', $range, $matches)) {
$start = $matches[1] ? \intval($matches[1]) : 0;
$end = $matches[2] ? \intval($matches[2]) + 1 : PHP_INT_MAX;

return [$start, $end];
}

throw new \InvalidArgumentException('Unexpected range: ' . $range);
}










private function getHistorySlice($show, $head, $tail)
{
$history = $this->readline->listHistory();


 \array_pop($history);

if ($show) {
list($start, $end) = $this->extractRange($show);
$length = $end - $start;
} elseif ($head) {
if (!\preg_match('/^\d+$/', $head)) {
throw new \InvalidArgumentException('Please specify an integer argument for --head');
}

$start = 0;
$length = \intval($head);
} elseif ($tail) {
if (!\preg_match('/^\d+$/', $tail)) {
throw new \InvalidArgumentException('Please specify an integer argument for --tail');
}

$start = \count($history) - $tail;
$length = \intval($tail) + 1;
} else {
return $history;
}

return \array_slice($history, $start, $length, true);
}







private function validateOnlyOne(InputInterface $input, array $options)
{
$count = 0;
foreach ($options as $opt) {
if ($input->getOption($opt)) {
$count++;
}
}

if ($count > 1) {
throw new \InvalidArgumentException('Please specify only one of --' . \implode(', --', $options));
}
}




private function clearHistory()
{
$this->readline->clearHistory();
}

public static function escape($string)
{
return OutputFormatter::escape($string);
}
}
<?php










namespace Psy\Command;

use Psy\Shell;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command as BaseCommand;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Helper\TableStyle;
use Symfony\Component\Console\Output\OutputInterface;




abstract class Command extends BaseCommand
{







public function setApplication(Application $application = null)
{
if ($application !== null && !$application instanceof Shell) {
throw new \InvalidArgumentException('PsySH Commands require an instance of Psy\Shell');
}

return parent::setApplication($application);
}




public function asText()
{
$messages = [
'<comment>Usage:</comment>',
' ' . $this->getSynopsis(),
'',
];

if ($this->getAliases()) {
$messages[] = $this->aliasesAsText();
}

if ($this->getArguments()) {
$messages[] = $this->argumentsAsText();
}

if ($this->getOptions()) {
$messages[] = $this->optionsAsText();
}

if ($help = $this->getProcessedHelp()) {
$messages[] = '<comment>Help:</comment>';
$messages[] = ' ' . \str_replace("\n", "\n ", $help) . "\n";
}

return \implode("\n", $messages);
}




private function getArguments()
{
$hidden = $this->getHiddenArguments();

return \array_filter($this->getNativeDefinition()->getArguments(), function ($argument) use ($hidden) {
return !\in_array($argument->getName(), $hidden);
});
}






protected function getHiddenArguments()
{
return ['command'];
}




private function getOptions()
{
$hidden = $this->getHiddenOptions();

return \array_filter($this->getNativeDefinition()->getOptions(), function ($option) use ($hidden) {
return !\in_array($option->getName(), $hidden);
});
}






protected function getHiddenOptions()
{
return ['verbose'];
}






private function aliasesAsText()
{
return '<comment>Aliases:</comment> <info>' . \implode(', ', $this->getAliases()) . '</info>' . PHP_EOL;
}






private function argumentsAsText()
{
$max = $this->getMaxWidth();
$messages = [];

$arguments = $this->getArguments();
if (!empty($arguments)) {
$messages[] = '<comment>Arguments:</comment>';
foreach ($arguments 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_pad('', $max + 2, ' '), $argument->getDescription());

$messages[] = \sprintf(" <info>%-${max}s</info> %s%s", $argument->getName(), $description, $default);
}

$messages[] = '';
}

return \implode(PHP_EOL, $messages);
}






private function optionsAsText()
{
$max = $this->getMaxWidth();
$messages = [];

$options = $this->getOptions();
if ($options) {
$messages[] = '<comment>Options:</comment>';

foreach ($options 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_pad('', $max + 2, ' '), $option->getDescription());

$optionMax = $max - \strlen($option->getName()) - 2;
$messages[] = \sprintf(
" <info>%s</info> %-${optionMax}s%s%s%s",
'--' . $option->getName(),
$option->getShortcut() ? \sprintf('(-%s) ', $option->getShortcut()) : '',
$description,
$default,
$multiple
);
}

$messages[] = '';
}

return \implode(PHP_EOL, $messages);
}






private function getMaxWidth()
{
$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()));
}

return ++$max;
}








private function formatDefaultValue($default)
{
if (\is_array($default) && $default === \array_values($default)) {
return \sprintf("['%s']", \implode("', '", $default));
}

return \str_replace("\n", '', \var_export($default, true));
}








protected function getTable(OutputInterface $output)
{
if (!\class_exists('Symfony\Component\Console\Helper\Table')) {
return $this->getTableHelper();
}

$style = new TableStyle();


 if (\method_exists($style, 'setVerticalBorderChars')) {
$style->setVerticalBorderChars(' ');
$style->setHorizontalBorderChars('');
$style->setCrossingChars('', '', '', '', '', '', '', '', '');
} else {
$style->setVerticalBorderChar(' ');
$style->setHorizontalBorderChar('');
$style->setCrossingChar('');
}

$table = new Table($output);

return $table
->setRows([])
->setStyle($style);
}






protected function getTableHelper()
{
$table = $this->getApplication()->getHelperSet()->get('table');

return $table
->setRows([])
->setLayout(TableHelper::LAYOUT_BORDERLESS)
->setHorizontalBorderChar('')
->setCrossingChar('');
}
}
<?php










namespace Psy\Command;

use Psy\Input\FilterOptions;
use Psy\Output\ShellOutput;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;




class TraceCommand extends Command
{
protected $filter;




public function __construct($name = null)
{
$this->filter = new FilterOptions();

parent::__construct($name);
}




protected function configure()
{
list($grep, $insensitive, $invert) = FilterOptions::getOptions();

$this
->setName('trace')
->setDefinition([
new InputOption('include-psy', 'p', InputOption::VALUE_NONE, 'Include Psy in the call stack.'),
new InputOption('num', 'n', InputOption::VALUE_REQUIRED, 'Only include NUM lines.'),

$grep,
$insensitive,
$invert,
])
->setDescription('Show the current call stack.')
->setHelp(
<<<'HELP'
Show the current call stack.

Optionally, include PsySH in the call stack by passing the <info>--include-psy</info> option.

e.g.
<return>> trace -n10</return>
<return>> trace --include-psy</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$this->filter->bind($input);
$trace = $this->getBacktrace(new \Exception(), $input->getOption('num'), $input->getOption('include-psy'));
$output->page($trace, ShellOutput::NUMBER_LINES);

return 0;
}













protected function getBacktrace(\Exception $e, $count = null, $includePsy = true)
{
if ($cwd = \getcwd()) {
$cwd = \rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}

if ($count === null) {
$count = PHP_INT_MAX;
}

$lines = [];

$trace = $e->getTrace();
\array_unshift($trace, [
'function' => '',
'file' => $e->getFile() !== null ? $e->getFile() : 'n/a',
'line' => $e->getLine() !== null ? $e->getLine() : 'n/a',
'args' => [],
]);

if (!$includePsy) {
for ($i = \count($trace) - 1; $i >= 0; $i--) {
$thing = isset($trace[$i]['class']) ? $trace[$i]['class'] : $trace[$i]['function'];
if (\preg_match('/\\\\?Psy\\\\/', $thing)) {
$trace = \array_slice($trace, $i + 1);
break;
}
}
}

for ($i = 0, $count = \min($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']) ? $this->replaceCwd($cwd, $trace[$i]['file']) : 'n/a';
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';


 if (\preg_match("#/src/Execution(?:Loop)?Closure.php\(\d+\) : eval\(\)'d code$#", \str_replace('\\', '/', $file))) {
$file = "eval()'d code";
}


 if (!$this->filter->match(\sprintf('%s%s%s() at %s:%s', $class, $type, $function, $file, $line))) {
continue;
}

$lines[] = \sprintf(
' <class>%s</class>%s%s() at <info>%s:%s</info>',
OutputFormatter::escape($class),
OutputFormatter::escape($type),
OutputFormatter::escape($function),
OutputFormatter::escape($file),
OutputFormatter::escape($line)
);
}

return $lines;
}









private function replaceCwd($cwd, $file)
{
if ($cwd === false) {
return $file;
} else {
return \preg_replace('/^' . \preg_quote($cwd, '/') . '/', '', $file);
}
}
}
<?php










namespace Psy\Command\ListCommand;

use Psy\Reflection\ReflectionClassConstant;
use Symfony\Component\Console\Input\InputInterface;




class ClassConstantEnumerator extends Enumerator
{



protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{

 if ($reflector === null) {
return [];
}


 if (!$reflector instanceof \ReflectionClass) {

 return [];
}


 if (!$input->getOption('constants')) {
return [];
}

$noInherit = $input->getOption('no-inherit');
$constants = $this->prepareConstants($this->getConstants($reflector, $noInherit));

if (empty($constants)) {
return [];
}

$ret = [];
$ret[$this->getKindLabel($reflector)] = $constants;

return $ret;
}









protected function getConstants(\Reflector $reflector, $noInherit = false)
{
$className = $reflector->getName();

$constants = [];
foreach ($reflector->getConstants() as $name => $constant) {
$constReflector = ReflectionClassConstant::create($reflector->name, $name);

if ($noInherit && $constReflector->getDeclaringClass()->getName() !== $className) {
continue;
}

$constants[$name] = $constReflector;
}

\ksort($constants, SORT_NATURAL | SORT_FLAG_CASE);

return $constants;
}








protected function prepareConstants(array $constants)
{

 $ret = [];

foreach ($constants as $name => $constant) {
if ($this->showItem($name)) {
$ret[$name] = [
'name' => $name,
'style' => self::IS_CONSTANT,
'value' => $this->presentRef($constant->getValue()),
];
}
}

return $ret;
}








protected function getKindLabel(\ReflectionClass $reflector)
{
if ($reflector->isInterface()) {
return 'Interface Constants';
} else {
return 'Class Constants';
}
}
}
<?php










namespace Psy\Command\ListCommand;

use Symfony\Component\Console\Input\InputInterface;




class MethodEnumerator extends Enumerator
{



protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{

 if ($reflector === null) {
return [];
}


 if (!$reflector instanceof \ReflectionClass) {
return [];
}


 if (!$input->getOption('methods')) {
return [];
}

$showAll = $input->getOption('all');
$noInherit = $input->getOption('no-inherit');
$methods = $this->prepareMethods($this->getMethods($showAll, $reflector, $noInherit));

if (empty($methods)) {
return [];
}

$ret = [];
$ret[$this->getKindLabel($reflector)] = $methods;

return $ret;
}










protected function getMethods($showAll, \Reflector $reflector, $noInherit = false)
{
$className = $reflector->getName();

$methods = [];
foreach ($reflector->getMethods() as $name => $method) {

 
 if (($noInherit || $method->isPrivate()) && $method->getDeclaringClass()->getName() !== $className) {
continue;
}

if ($showAll || $method->isPublic()) {
$methods[$method->getName()] = $method;
}
}

\ksort($methods, SORT_NATURAL | SORT_FLAG_CASE);

return $methods;
}








protected function prepareMethods(array $methods)
{

 $ret = [];

foreach ($methods as $name => $method) {
if ($this->showItem($name)) {
$ret[$name] = [
'name' => $name,
'style' => $this->getVisibilityStyle($method),
'value' => $this->presentSignature($method),
];
}
}

return $ret;
}








protected function getKindLabel(\ReflectionClass $reflector)
{
if ($reflector->isInterface()) {
return 'Interface Methods';
} elseif (\method_exists($reflector, 'isTrait') && $reflector->isTrait()) {
return 'Trait Methods';
} else {
return 'Class Methods';
}
}








private function getVisibilityStyle(\ReflectionMethod $method)
{
if ($method->isPublic()) {
return self::IS_PUBLIC;
} elseif ($method->isProtected()) {
return self::IS_PROTECTED;
} else {
return self::IS_PRIVATE;
}
}
}
<?php










namespace Psy\Command\ListCommand;

use Symfony\Component\Console\Input\InputInterface;




class ClassEnumerator extends Enumerator
{



protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{

 
 
 
 
 
 
 if ($reflector !== null || $target !== null) {
return [];
}

$user = $input->getOption('user');
$internal = $input->getOption('internal');

$ret = [];



if ($input->getOption('classes')) {
$ret = \array_merge($ret, $this->filterClasses('Classes', \get_declared_classes(), $internal, $user));
}

if ($input->getOption('interfaces')) {
$ret = \array_merge($ret, $this->filterClasses('Interfaces', \get_declared_interfaces(), $internal, $user));
}

if ($input->getOption('traits')) {
$ret = \array_merge($ret, $this->filterClasses('Traits', \get_declared_traits(), $internal, $user));
}

return \array_map([$this, 'prepareClasses'], \array_filter($ret));
}














protected function filterClasses($key, $classes, $internal, $user)
{
$ret = [];

if ($internal) {
$ret['Internal ' . $key] = \array_filter($classes, function ($class) {
$refl = new \ReflectionClass($class);

return $refl->isInternal();
});
}

if ($user) {
$ret['User ' . $key] = \array_filter($classes, function ($class) {
$refl = new \ReflectionClass($class);

return !$refl->isInternal();
});
}

if (!$user && !$internal) {
$ret[$key] = $classes;
}

return $ret;
}








protected function prepareClasses(array $classes)
{
\natcasesort($classes);


 $ret = [];

foreach ($classes as $name) {
if ($this->showItem($name)) {
$ret[$name] = [
'name' => $name,
'style' => self::IS_CLASS,
'value' => $this->presentSignature($name),
];
}
}

return $ret;
}
}
<?php










namespace Psy\Command\ListCommand;

use Psy\Context;
use Psy\VarDumper\Presenter;
use Symfony\Component\Console\Input\InputInterface;




class VariableEnumerator extends Enumerator
{

 private static $specialNames = [
'_', '_e', '__out', '__function', '__method', '__class', '__namespace', '__file', '__line', '__dir',
];

private $context;










public function __construct(Presenter $presenter, Context $context)
{
$this->context = $context;
parent::__construct($presenter);
}




protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{

 if ($reflector !== null || $target !== null) {
return [];
}


 if (!$input->getOption('vars')) {
return [];
}

$showAll = $input->getOption('all');
$variables = $this->prepareVariables($this->getVariables($showAll));

if (empty($variables)) {
return [];
}

return [
'Variables' => $variables,
];
}








protected function getVariables($showAll)
{
$scopeVars = $this->context->getAll();
\uksort($scopeVars, function ($a, $b) {
$aIndex = \array_search($a, self::$specialNames);
$bIndex = \array_search($b, self::$specialNames);

if ($aIndex !== false) {
if ($bIndex !== false) {
return $aIndex - $bIndex;
}

return 1;
}

if ($bIndex !== false) {
return -1;
}

return \strnatcasecmp($a, $b);
});

$ret = [];
foreach ($scopeVars as $name => $val) {
if (!$showAll && \in_array($name, self::$specialNames)) {
continue;
}

$ret[$name] = $val;
}

return $ret;
}








protected function prepareVariables(array $variables)
{

 $ret = [];
foreach ($variables as $name => $val) {
if ($this->showItem($name)) {
$fname = '$' . $name;
$ret[$fname] = [
'name' => $fname,
'style' => \in_array($name, self::$specialNames) ? self::IS_PRIVATE : self::IS_PUBLIC,
'value' => $this->presentRef($val),
];
}
}

return $ret;
}
}
<?php










namespace Psy\Command\ListCommand;

use Symfony\Component\Console\Input\InputInterface;




class PropertyEnumerator extends Enumerator
{



protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{


if ($reflector === null) {
return [];
}


 if (!$reflector instanceof \ReflectionClass) {
return [];
}


 if (!$input->getOption('properties')) {
return [];
}

$showAll = $input->getOption('all');
$noInherit = $input->getOption('no-inherit');
$properties = $this->prepareProperties($this->getProperties($showAll, $reflector, $noInherit), $target);

if (empty($properties)) {
return [];
}

$ret = [];
$ret[$this->getKindLabel($reflector)] = $properties;

return $ret;
}










protected function getProperties($showAll, \Reflector $reflector, $noInherit = false)
{
$className = $reflector->getName();

$properties = [];
foreach ($reflector->getProperties() as $property) {
if ($noInherit && $property->getDeclaringClass()->getName() !== $className) {
continue;
}

if ($showAll || $property->isPublic()) {
$properties[$property->getName()] = $property;
}
}

\ksort($properties, SORT_NATURAL | SORT_FLAG_CASE);

return $properties;
}








protected function prepareProperties(array $properties, $target = null)
{

 $ret = [];

foreach ($properties as $name => $property) {
if ($this->showItem($name)) {
$fname = '$' . $name;
$ret[$fname] = [
'name' => $fname,
'style' => $this->getVisibilityStyle($property),
'value' => $this->presentValue($property, $target),
];
}
}

return $ret;
}








protected function getKindLabel(\ReflectionClass $reflector)
{
if (\method_exists($reflector, 'isTrait') && $reflector->isTrait()) {
return 'Trait Properties';
} else {
return 'Class Properties';
}
}








private function getVisibilityStyle(\ReflectionProperty $property)
{
if ($property->isPublic()) {
return self::IS_PUBLIC;
} elseif ($property->isProtected()) {
return self::IS_PROTECTED;
} else {
return self::IS_PRIVATE;
}
}









protected function presentValue(\ReflectionProperty $property, $target)
{

 
 if (!\is_object($target)) {
try {
$refl = new \ReflectionClass($target);
$props = $refl->getDefaultProperties();
if (\array_key_exists($property->name, $props)) {
$suffix = $property->isStatic() ? '' : ' <aside>(default)</aside>';

return $this->presentRef($props[$property->name]) . $suffix;
}
} catch (\Exception $e) {

 }

return '';
}

$property->setAccessible(true);
$value = $property->getValue($target);

return $this->presentRef($value);
}
}
<?php










namespace Psy\Command\ListCommand;

use Symfony\Component\Console\Input\InputInterface;




class GlobalVariableEnumerator extends Enumerator
{



protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{

 if ($reflector !== null || $target !== null) {
return [];
}


 if (!$input->getOption('globals')) {
return [];
}

$globals = $this->prepareGlobals($this->getGlobals());

if (empty($globals)) {
return [];
}

return [
'Global Variables' => $globals,
];
}






protected function getGlobals()
{
global $GLOBALS;

$names = \array_keys($GLOBALS);
\natcasesort($names);

$ret = [];
foreach ($names as $name) {
$ret[$name] = $GLOBALS[$name];
}

return $ret;
}








protected function prepareGlobals($globals)
{

 $ret = [];

foreach ($globals as $name => $value) {
if ($this->showItem($name)) {
$fname = '$' . $name;
$ret[$fname] = [
'name' => $fname,
'style' => self::IS_GLOBAL,
'value' => $this->presentRef($value),
];
}
}

return $ret;
}
}
<?php










namespace Psy\Command\ListCommand;

use Symfony\Component\Console\Input\InputInterface;




class FunctionEnumerator extends Enumerator
{



protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{

 
 
 
 
 
 
 if ($reflector !== null || $target !== null) {
return [];
}


 if (!$input->getOption('functions')) {
return [];
}

if ($input->getOption('user')) {
$label = 'User Functions';
$functions = $this->getFunctions('user');
} elseif ($input->getOption('internal')) {
$label = 'Internal Functions';
$functions = $this->getFunctions('internal');
} else {
$label = 'Functions';
$functions = $this->getFunctions();
}

$functions = $this->prepareFunctions($functions);

if (empty($functions)) {
return [];
}

$ret = [];
$ret[$label] = $functions;

return $ret;
}










protected function getFunctions($type = null)
{
$funcs = \get_defined_functions();

if ($type) {
return $funcs[$type];
} else {
return \array_merge($funcs['internal'], $funcs['user']);
}
}








protected function prepareFunctions(array $functions)
{
\natcasesort($functions);


 $ret = [];

foreach ($functions as $name) {
if ($this->showItem($name)) {
try {
$ret[$name] = [
'name' => $name,
'style' => self::IS_FUNCTION,
'value' => $this->presentSignature($name),
];
} catch (\Exception $e) {

 }
}
}

return $ret;
}
}
<?php










namespace Psy\Command\ListCommand;

use Psy\Formatter\SignatureFormatter;
use Psy\Input\FilterOptions;
use Psy\Util\Mirror;
use Psy\VarDumper\Presenter;
use Symfony\Component\Console\Input\InputInterface;




abstract class Enumerator
{

 const IS_PUBLIC = 'public';
const IS_PROTECTED = 'protected';
const IS_PRIVATE = 'private';
const IS_GLOBAL = 'global';
const IS_CONSTANT = 'const';
const IS_CLASS = 'class';
const IS_FUNCTION = 'function';

private $filter;
private $presenter;






public function __construct(Presenter $presenter)
{
$this->filter = new FilterOptions();
$this->presenter = $presenter;
}










public function enumerate(InputInterface $input, \Reflector $reflector = null, $target = null)
{
$this->filter->bind($input);

return $this->listItems($input, $reflector, $target);
}






















abstract protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null);

protected function showItem($name)
{
return $this->filter->match($name);
}

protected function presentRef($value)
{
return $this->presenter->presentRef($value);
}

protected function presentSignature($target)
{

 if (!$target instanceof \Reflector) {
$target = Mirror::get($target);
}

return SignatureFormatter::format($target);
}
}
<?php










namespace Psy\Command\ListCommand;

use Symfony\Component\Console\Input\InputInterface;




class ConstantEnumerator extends Enumerator
{

 private static $categoryLabels = [
'libxml' => 'libxml',
'openssl' => 'OpenSSL',
'pcre' => 'PCRE',
'sqlite3' => 'SQLite3',
'curl' => 'cURL',
'dom' => 'DOM',
'ftp' => 'FTP',
'gd' => 'GD',
'gmp' => 'GMP',
'iconv' => 'iconv',
'json' => 'JSON',
'ldap' => 'LDAP',
'mbstring' => 'mbstring',
'odbc' => 'ODBC',
'pcntl' => 'PCNTL',
'pgsql' => 'pgsql',
'posix' => 'POSIX',
'mysqli' => 'mysqli',
'soap' => 'SOAP',
'exif' => 'EXIF',
'sysvmsg' => 'sysvmsg',
'xml' => 'XML',
'xsl' => 'XSL',
];




protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
{

 
 
 
 
 
 
 if ($reflector !== null || $target !== null) {
return [];
}


 if (!$input->getOption('constants')) {
return [];
}

$user = $input->getOption('user');
$internal = $input->getOption('internal');
$category = $input->getOption('category');

if ($category) {
$category = \strtolower($category);

if ($category === 'internal') {
$internal = true;
$category = null;
} elseif ($category === 'user') {
$user = true;
$category = null;
}
}

$ret = [];

if ($user) {
$ret['User Constants'] = $this->getConstants('user');
}

if ($internal) {
$ret['Internal Constants'] = $this->getConstants('internal');
}

if ($category) {
$caseCategory = \array_key_exists($category, self::$categoryLabels) ? self::$categoryLabels[$category] : \ucfirst($category);
$label = $caseCategory . ' Constants';
$ret[$label] = $this->getConstants($category);
}

if (!$user && !$internal && !$category) {
$ret['Constants'] = $this->getConstants();
}

return \array_map([$this, 'prepareConstants'], \array_filter($ret));
}











protected function getConstants($category = null)
{
if (!$category) {
return \get_defined_constants();
}

$consts = \get_defined_constants(true);

if ($category === 'internal') {
unset($consts['user']);

return \call_user_func_array('array_merge', $consts);
}

foreach ($consts as $key => $value) {
if (\strtolower($key) === $category) {
return $value;
}
}

return [];
}








protected function prepareConstants(array $constants)
{

 $ret = [];

$names = \array_keys($constants);
\natcasesort($names);

foreach ($names as $name) {
if ($this->showItem($name)) {
$ret[$name] = [
'name' => $name,
'style' => self::IS_CONSTANT,
'value' => $this->presentRef($constants[$name]),
];
}
}

return $ret;
}
}
<?php










namespace Psy\Command;

use PhpParser\Node;
use PhpParser\Parser;
use Psy\Context;
use Psy\ContextAware;
use Psy\Input\CodeArgument;
use Psy\ParserFactory;
use Psy\VarDumper\Presenter;
use Psy\VarDumper\PresenterAware;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\VarDumper\Caster\Caster;




class ParseCommand extends Command implements ContextAware, PresenterAware
{





protected $context;

private $presenter;
private $parserFactory;
private $parsers;




public function __construct($name = null)
{
$this->parserFactory = new ParserFactory();
$this->parsers = [];

parent::__construct($name);
}






public function setContext(Context $context)
{
$this->context = $context;
}






public function setPresenter(Presenter $presenter)
{
$this->presenter = clone $presenter;
$this->presenter->addCasters([
'PhpParser\Node' => function (Node $node, array $a) {
$a = [
Caster::PREFIX_VIRTUAL . 'type' => $node->getType(),
Caster::PREFIX_VIRTUAL . 'attributes' => $node->getAttributes(),
];

foreach ($node->getSubNodeNames() as $name) {
$a[Caster::PREFIX_VIRTUAL . $name] = $node->$name;
}

return $a;
},
]);
}




protected function configure()
{
$definition = [
new CodeArgument('code', CodeArgument::REQUIRED, 'PHP code to parse.'),
new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse.', 10),
];

if ($this->parserFactory->hasKindsSupport()) {
$msg = 'One of PhpParser\\ParserFactory constants: '
. \implode(', ', ParserFactory::getPossibleKinds())
. " (default is based on current interpreter's version).";
$defaultKind = $this->parserFactory->getDefaultKind();

$definition[] = new InputOption('kind', '', InputOption::VALUE_REQUIRED, $msg, $defaultKind);
}

$this
->setName('parse')
->setDefinition($definition)
->setDescription('Parse PHP code and show the abstract syntax tree.')
->setHelp(
<<<'HELP'
Parse PHP code and show the abstract syntax tree.

This command is used in the development of PsySH. Given a string of PHP code,
it pretty-prints the PHP Parser parse tree.

See https://github.com/nikic/PHP-Parser

It prolly won't be super useful for most of you, but it's here if you want to play.
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$code = $input->getArgument('code');
if (\strpos('<?', $code) === false) {
$code = '<?php ' . $code;
}

$parserKind = $this->parserFactory->hasKindsSupport() ? $input->getOption('kind') : null;
$depth = $input->getOption('depth');
$nodes = $this->parse($this->getParser($parserKind), $code);
$output->page($this->presenter->present($nodes, $depth));

$this->context->setReturnValue($nodes);

return 0;
}









private function parse(Parser $parser, $code)
{
try {
return $parser->parse($code);
} catch (\PhpParser\Error $e) {
if (\strpos($e->getMessage(), 'unexpected EOF') === false) {
throw $e;
}


 return $parser->parse($code . ';');
}
}








private function getParser($kind = null)
{
if (!\array_key_exists($kind, $this->parsers)) {
$this->parsers[$kind] = $this->parserFactory->createParser($kind);
}

return $this->parsers[$kind];
}
}
<?php










namespace Psy\Command;

use Psy\Output\ShellOutput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;






class BufferCommand extends Command
{



protected function configure()
{
$this
->setName('buffer')
->setAliases(['buf'])
->setDefinition([
new InputOption('clear', '', InputOption::VALUE_NONE, 'Clear the current buffer.'),
])
->setDescription('Show (or clear) the contents of the code input buffer.')
->setHelp(
<<<'HELP'
Show the contents of the code buffer for the current multi-line expression.

Optionally, clear the buffer by passing the <info>--clear</info> option.
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$buf = $this->getApplication()->getCodeBuffer();
if ($input->getOption('clear')) {
$this->getApplication()->resetCodeBuffer();
$output->writeln($this->formatLines($buf, 'urgent'), ShellOutput::NUMBER_LINES);
} else {
$output->writeln($this->formatLines($buf), ShellOutput::NUMBER_LINES);
}

return 0;
}









protected function formatLines(array $lines, $type = 'return')
{
$template = \sprintf('<%s>%%s</%s>', $type, $type);

return \array_map(function ($line) use ($template) {
return \sprintf($template, $line);
}, $lines);
}
}
<?php










namespace Psy\Command;

use Psy\Exception\BreakException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;






class ExitCommand extends Command
{



protected function configure()
{
$this
->setName('exit')
->setAliases(['quit', 'q'])
->setDefinition([])
->setDescription('End the current session and return to caller.')
->setHelp(
<<<'HELP'
End the current session and return to caller.

e.g.
<return>>>> exit</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
throw new BreakException('Goodbye');
}
}
<?php










namespace Psy\Command;

use Psy\Context;
use Psy\ContextAware;
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 EditCommand extends Command implements ContextAware
{



private $runtimeDir = '';




private $context;









public function __construct($runtimeDir, $name = null)
{
parent::__construct($name);

$this->runtimeDir = $runtimeDir;
}

protected function configure()
{
$this
->setName('edit')
->setDefinition([
new InputArgument('file', InputArgument::OPTIONAL, 'The file to open for editing. If this is not given, edits a temporary file.', null),
new InputOption(
'exec',
'e',
InputOption::VALUE_NONE,
'Execute the file content after editing. This is the default when a file name argument is not given.',
null
),
new InputOption(
'no-exec',
'E',
InputOption::VALUE_NONE,
'Do not execute the file content after editing. This is the default when a file name argument is given.',
null
),
])
->setDescription('Open an external editor. Afterwards, get produced code in input buffer.')
->setHelp('Set the EDITOR environment variable to something you\'d like to use.');
}








protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('exec') &&
$input->getOption('no-exec')) {
throw new \InvalidArgumentException('The --exec and --no-exec flags are mutually exclusive');
}

$filePath = $this->extractFilePath($input->getArgument('file'));

$execute = $this->shouldExecuteFile(
$input->getOption('exec'),
$input->getOption('no-exec'),
$filePath
);

$shouldRemoveFile = false;

if ($filePath === null) {
$filePath = \tempnam($this->runtimeDir, 'psysh-edit-command');
$shouldRemoveFile = true;
}

$editedContent = $this->editFile($filePath, $shouldRemoveFile);

if ($execute) {
$this->getApplication()->addInput($editedContent);
}

return 0;
}








private function shouldExecuteFile($execOption, $noExecOption, $filePath)
{
if ($execOption) {
return true;
}

if ($noExecOption) {
return false;
}


 return $filePath === null;
}








private function extractFilePath($fileArgument)
{

 if ($fileArgument !== null &&
\strlen($fileArgument) > 0 &&
$fileArgument[0] === '$') {
$fileArgument = $this->context->get(\preg_replace('/^\$/', '', $fileArgument));
}

return $fileArgument;
}









private function editFile($filePath, $shouldRemoveFile)
{
$escapedFilePath = \escapeshellarg($filePath);

$pipes = [];
$proc = \proc_open((\getenv('EDITOR') ?: 'nano') . " {$escapedFilePath}", [STDIN, STDOUT, STDERR], $pipes);
\proc_close($proc);

$editedContent = @\file_get_contents($filePath);

if ($shouldRemoveFile) {
@\unlink($filePath);
}

if ($editedContent === false) {
throw new \UnexpectedValueException("Reading {$filePath} returned false");
}

return $editedContent;
}






public function setContext(Context $context)
{
$this->context = $context;
}
}
<?php










namespace Psy\Command;

use PhpParser\NodeTraverser;
use PhpParser\PrettyPrinter\Standard as Printer;
use Psy\Input\CodeArgument;
use Psy\ParserFactory;
use Psy\Readline\Readline;
use Psy\Sudo\SudoVisitor;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;




class SudoCommand extends Command
{
private $readline;
private $parser;
private $traverser;
private $printer;




public function __construct($name = null)
{
$parserFactory = new ParserFactory();
$this->parser = $parserFactory->createParser();

$this->traverser = new NodeTraverser();
$this->traverser->addVisitor(new SudoVisitor());

$this->printer = new Printer();

parent::__construct($name);
}






public function setReadline(Readline $readline)
{
$this->readline = $readline;
}




protected function configure()
{
$this
->setName('sudo')
->setDefinition([
new CodeArgument('code', CodeArgument::REQUIRED, 'Code to execute.'),
])
->setDescription('Evaluate PHP code, bypassing visibility restrictions.')
->setHelp(
<<<'HELP'
Evaluate PHP code, bypassing visibility restrictions.

e.g.
<return>>>> $sekret->whisper("hi")</return>
<return>PHP error:  Call to private method Sekret::whisper() from context '' on line 1</return>

<return>>>> sudo $sekret->whisper("hi")</return>
<return>=> "hi"</return>

<return>>>> $sekret->word</return>
<return>PHP error:  Cannot access private property Sekret::$word on line 1</return>

<return>>>> sudo $sekret->word</return>
<return>=> "hi"</return>

<return>>>> $sekret->word = "please"</return>
<return>PHP error:  Cannot access private property Sekret::$word on line 1</return>

<return>>>> sudo $sekret->word = "please"</return>
<return>=> "please"</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$code = $input->getArgument('code');


 if ($code === '!!') {
$history = $this->readline->listHistory();
if (\count($history) < 2) {
throw new \InvalidArgumentException('No previous command to replay');
}
$code = $history[\count($history) - 2];
}

if (\strpos('<?', $code) === false) {
$code = '<?php ' . $code;
}

$nodes = $this->traverser->traverse($this->parse($code));

$sudoCode = $this->printer->prettyPrint($nodes);
$shell = $this->getApplication();
$shell->addCode($sudoCode, !$shell->hasCode());

return 0;
}








private function parse($code)
{
try {
return $this->parser->parse($code);
} catch (\PhpParser\Error $e) {
if (\strpos($e->getMessage(), 'unexpected EOF') === false) {
throw $e;
}


 return $this->parser->parse($code . ';');
}
}
}
<?php










namespace Psy\Command;

use Psy\Output\ShellOutput;
use Symfony\Component\Console\Helper\TableHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;






class HelpCommand extends Command
{
private $command;




protected function configure()
{
$this
->setName('help')
->setAliases(['?'])
->setDefinition([
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name.', null),
])
->setDescription('Show a list of commands. Type `help [foo]` for information about [foo].')
->setHelp('My. How meta.');
}






public function setCommand($command)
{
$this->command = $command;
}




protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->command !== null) {

 $output->page($this->command->asText());
$this->command = null;
} elseif ($name = $input->getArgument('command_name')) {

 $output->page($this->getApplication()->get($name)->asText());
} else {

 $commands = $this->getApplication()->all();

$table = $this->getTable($output);

foreach ($commands as $name => $command) {
if ($name !== $command->getName()) {
continue;
}

if ($command->getAliases()) {
$aliases = \sprintf('<comment>Aliases:</comment> %s', \implode(', ', $command->getAliases()));
} else {
$aliases = '';
}

$table->addRow([
\sprintf('<info>%s</info>', $name),
$command->getDescription(),
$aliases,
]);
}

if ($output instanceof ShellOutput) {
$output->startPaging();
}

if ($table instanceof TableHelper) {
$table->render($output);
} else {
$table->render();
}

if ($output instanceof ShellOutput) {
$output->stopPaging();
}
}

return 0;
}
}
<?php










namespace Psy\Command;

use Psy\CodeCleaner\NoReturnValue;
use Psy\Context;
use Psy\ContextAware;
use Psy\Exception\ErrorException;
use Psy\Exception\RuntimeException;
use Psy\Util\Mirror;




abstract class ReflectingCommand extends Command implements ContextAware
{
const CLASS_OR_FUNC = '/^[\\\\\w]+$/';
const CLASS_MEMBER = '/^([\\\\\w]+)::(\w+)$/';
const CLASS_STATIC = '/^([\\\\\w]+)::\$(\w+)$/';
const INSTANCE_MEMBER = '/^(\$\w+)(::|->)(\w+)$/';






protected $context;






public function setContext(Context $context)
{
$this->context = $context;
}










protected function getTarget($valueName)
{
$valueName = \trim($valueName);
$matches = [];
switch (true) {
case \preg_match(self::CLASS_OR_FUNC, $valueName, $matches):
return [$this->resolveName($matches[0], true), null, 0];

case \preg_match(self::CLASS_MEMBER, $valueName, $matches):
return [$this->resolveName($matches[1]), $matches[2], Mirror::CONSTANT | Mirror::METHOD];

case \preg_match(self::CLASS_STATIC, $valueName, $matches):
return [$this->resolveName($matches[1]), $matches[2], Mirror::STATIC_PROPERTY | Mirror::PROPERTY];

case \preg_match(self::INSTANCE_MEMBER, $valueName, $matches):
if ($matches[2] === '->') {
$kind = Mirror::METHOD | Mirror::PROPERTY;
} else {
$kind = Mirror::CONSTANT | Mirror::METHOD;
}

return [$this->resolveObject($matches[1]), $matches[3], $kind];

default:
return [$this->resolveObject($valueName), null, 0];
}
}











protected function resolveName($name, $includeFunctions = false)
{
$shell = $this->getApplication();


 if (\in_array(\strtolower($name), ['self', 'static'])) {
if ($boundClass = $shell->getBoundClass()) {
return $boundClass;
}

if ($boundObject = $shell->getBoundObject()) {
return \get_class($boundObject);
}

$msg = \sprintf('Cannot use "%s" when no class scope is active', \strtolower($name));
throw new ErrorException($msg, 0, E_USER_ERROR, "eval()'d code", 1);
}

if (\substr($name, 0, 1) === '\\') {
return $name;
}


 $maybeAlias = $this->resolveCode($name . '::class');
if ($maybeAlias !== $name) {
return $maybeAlias;
}

if ($namespace = $shell->getNamespace()) {
$fullName = $namespace . '\\' . $name;

if (\class_exists($fullName) || \interface_exists($fullName) || ($includeFunctions && \function_exists($fullName))) {
return $fullName;
}
}

return $name;
}








protected function getTargetAndReflector($valueName)
{
list($value, $member, $kind) = $this->getTarget($valueName);

return [$value, Mirror::get($value, $member, $kind)];
}










protected function resolveCode($code)
{
try {
$value = $this->getApplication()->execute($code, true);
} catch (\Exception $e) {

 }

if (!isset($value) || $value instanceof NoReturnValue) {
throw new RuntimeException('Unknown target: ' . $code);
}

return $value;
}










private function resolveObject($code)
{
$value = $this->resolveCode($code);

if (!\is_object($value)) {
throw new RuntimeException('Unable to inspect a non-object');
}

return $value;
}








protected function resolveInstance($name)
{
@\trigger_error('`resolveInstance` is deprecated; use `resolveCode` instead.', E_USER_DEPRECATED);

return $this->resolveCode($name);
}








protected function getScopeVariable($name)
{
return $this->context->get($name);
}






protected function getScopeVariables()
{
return $this->context->getAll();
}








protected function setCommandScopeVariables(\Reflector $reflector)
{
$vars = [];

switch (\get_class($reflector)) {
case 'ReflectionClass':
case 'ReflectionObject':
$vars['__class'] = $reflector->name;
if ($reflector->inNamespace()) {
$vars['__namespace'] = $reflector->getNamespaceName();
}
break;

case 'ReflectionMethod':
$vars['__method'] = \sprintf('%s::%s', $reflector->class, $reflector->name);
$vars['__class'] = $reflector->class;
$classReflector = $reflector->getDeclaringClass();
if ($classReflector->inNamespace()) {
$vars['__namespace'] = $classReflector->getNamespaceName();
}
break;

case 'ReflectionFunction':
$vars['__function'] = $reflector->name;
if ($reflector->inNamespace()) {
$vars['__namespace'] = $reflector->getNamespaceName();
}
break;

case 'ReflectionGenerator':
$funcReflector = $reflector->getFunction();
$vars['__function'] = $funcReflector->name;
if ($funcReflector->inNamespace()) {
$vars['__namespace'] = $funcReflector->getNamespaceName();
}
if ($fileName = $reflector->getExecutingFile()) {
$vars['__file'] = $fileName;
$vars['__line'] = $reflector->getExecutingLine();
$vars['__dir'] = \dirname($fileName);
}
break;

case 'ReflectionProperty':
case 'ReflectionClassConstant':
case 'Psy\Reflection\ReflectionClassConstant':
$classReflector = $reflector->getDeclaringClass();
$vars['__class'] = $classReflector->name;
if ($classReflector->inNamespace()) {
$vars['__namespace'] = $classReflector->getNamespaceName();
}

 if ($fileName = $reflector->getDeclaringClass()->getFileName()) {
$vars['__file'] = $fileName;
$vars['__dir'] = \dirname($fileName);
}
break;

case 'Psy\Reflection\ReflectionConstant_':
if ($reflector->inNamespace()) {
$vars['__namespace'] = $reflector->getNamespaceName();
}
break;
}

if ($reflector instanceof \ReflectionClass || $reflector instanceof \ReflectionFunctionAbstract) {
if ($fileName = $reflector->getFileName()) {
$vars['__file'] = $fileName;
$vars['__line'] = $reflector->getStartLine();
$vars['__dir'] = \dirname($fileName);
}
}

$this->context->setCommandScopeVariables($vars);
}
}
<?php










namespace Psy\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;




class PsyVersionCommand extends Command
{



protected function configure()
{
$this
->setName('version')
->setDefinition([])
->setDescription('Show Psy Shell version.')
->setHelp('Show Psy Shell version.');
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln($this->getApplication()->getVersion());

return 0;
}
}
<?php










namespace Psy\Command;

use Psy\Formatter\DocblockFormatter;
use Psy\Formatter\SignatureFormatter;
use Psy\Input\CodeArgument;
use Psy\Reflection\ReflectionLanguageConstruct;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;




class DocCommand extends ReflectingCommand
{



protected function configure()
{
$this
->setName('doc')
->setAliases(['rtfm', 'man'])
->setDefinition([
new CodeArgument('target', CodeArgument::REQUIRED, 'Function, class, instance, constant, method or property to document.'),
])
->setDescription('Read the documentation for an object, class, constant, method or property.')
->setHelp(
<<<HELP
Read the documentation for an object, class, constant, method or property.

It's awesome for well-documented code, not quite as awesome for poorly documented code.

e.g.
<return>>>> doc preg_replace</return>
<return>>>> doc Psy\Shell</return>
<return>>>> doc Psy\Shell::debug</return>
<return>>>> \$s = new Psy\Shell</return>
<return>>>> doc \$s->run</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$value = $input->getArgument('target');
if (ReflectionLanguageConstruct::isLanguageConstruct($value)) {
$reflector = new ReflectionLanguageConstruct($value);
$doc = $this->getManualDocById($value);
} else {
list($target, $reflector) = $this->getTargetAndReflector($value);
$doc = $this->getManualDoc($reflector) ?: DocblockFormatter::format($reflector);
}

$db = $this->getApplication()->getManualDb();

$output->page(function ($output) use ($reflector, $doc, $db) {
$output->writeln(SignatureFormatter::format($reflector));
$output->writeln('');

if (empty($doc) && !$db) {
$output->writeln('<warning>PHP manual not found</warning>');
$output->writeln('    To document core PHP functionality, download the PHP reference manual:');
$output->writeln('    https://github.com/bobthecow/psysh/wiki/PHP-manual');
} else {
$output->writeln($doc);
}
});


 $this->setCommandScopeVariables($reflector);

return 0;
}

private function getManualDoc($reflector)
{
switch (\get_class($reflector)) {
case 'ReflectionClass':
case 'ReflectionObject':
case 'ReflectionFunction':
$id = $reflector->name;
break;

case 'ReflectionMethod':
$id = $reflector->class . '::' . $reflector->name;
break;

case 'ReflectionProperty':
$id = $reflector->class . '::$' . $reflector->name;
break;

case 'ReflectionClassConstant':
case 'Psy\Reflection\ReflectionClassConstant':

 
 
 $id = $reflector->class . '::' . $reflector->name;
break;

case 'Psy\Reflection\ReflectionConstant_':
$id = $reflector->name;
break;

default:
return false;
}

return $this->getManualDocById($id);
}

private function getManualDocById($id)
{
if ($db = $this->getApplication()->getManualDb()) {
return $db
->query(\sprintf('SELECT doc FROM php_manual WHERE id = %s', $db->quote($id)))
->fetchColumn(0);
}
}
}
<?php










namespace Psy\Command;

use JakubOnderka\PhpConsoleHighlighter\Highlighter;
use Psy\Configuration;
use Psy\ConsoleColorFactory;
use Psy\Exception\RuntimeException;
use Psy\Formatter\CodeFormatter;
use Psy\Formatter\SignatureFormatter;
use Psy\Input\CodeArgument;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;




class ShowCommand extends ReflectingCommand
{
private $colorMode;
private $highlighter;
private $lastException;
private $lastExceptionIndex;




public function __construct($colorMode = null)
{
$this->colorMode = $colorMode ?: Configuration::COLOR_MODE_AUTO;

parent::__construct();
}




protected function configure()
{
$this
->setName('show')
->setDefinition([
new CodeArgument('target', CodeArgument::OPTIONAL, 'Function, class, instance, constant, method or property to show.'),
new InputOption('ex', null, InputOption::VALUE_OPTIONAL, 'Show last exception context. Optionally specify a stack index.', 1),
])
->setDescription('Show the code for an object, class, constant, method or property.')
->setHelp(
<<<HELP
Show the code for an object, class, constant, method or property, or the context
of the last exception.

<return>cat --ex</return> defaults to showing the lines surrounding the location of the last
exception. Invoking it more than once travels up the exception's stack trace,
and providing a number shows the context of the given index of the trace.

e.g.
<return>>>> show \$myObject</return>
<return>>>> show Psy\Shell::debug</return>
<return>>>> show --ex</return>
<return>>>> show --ex 3</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{

 
 
 
 
 
 
 
 
 $opts = $input->getOptions();


 
 
 
 if ($opts['ex'] !== 1) {
if ($input->getArgument('target')) {
throw new \InvalidArgumentException('Too many arguments (supply either "target" or "--ex")');
}

$this->writeExceptionContext($input, $output);

return 0;
}

if ($input->getArgument('target')) {
$this->writeCodeContext($input, $output);

return 0;
}

throw new RuntimeException('Not enough arguments (missing: "target")');
}

private function writeCodeContext(InputInterface $input, OutputInterface $output)
{
list($target, $reflector) = $this->getTargetAndReflector($input->getArgument('target'));


 $this->setCommandScopeVariables($reflector);

try {
$output->page(CodeFormatter::format($reflector, $this->colorMode), OutputInterface::OUTPUT_RAW);
} catch (RuntimeException $e) {
$output->writeln(SignatureFormatter::format($reflector));
throw $e;
}
}

private function writeExceptionContext(InputInterface $input, OutputInterface $output)
{
$exception = $this->context->getLastException();
if ($exception !== $this->lastException) {
$this->lastException = null;
$this->lastExceptionIndex = null;
}

$opts = $input->getOptions();
if ($opts['ex'] === null) {
if ($this->lastException && $this->lastExceptionIndex !== null) {
$index = $this->lastExceptionIndex + 1;
} else {
$index = 0;
}
} else {
$index = \max(0, \intval($input->getOption('ex')) - 1);
}

$trace = $exception->getTrace();
\array_unshift($trace, [
'file' => $exception->getFile(),
'line' => $exception->getLine(),
]);

if ($index >= \count($trace)) {
$index = 0;
}

$this->lastException = $exception;
$this->lastExceptionIndex = $index;

$output->writeln($this->getApplication()->formatException($exception));
$output->writeln('--');
$this->writeTraceLine($output, $trace, $index);
$this->writeTraceCodeSnippet($output, $trace, $index);

$this->setCommandScopeVariablesFromContext($trace[$index]);
}

private function writeTraceLine(OutputInterface $output, array $trace, $index)
{
$file = isset($trace[$index]['file']) ? $this->replaceCwd($trace[$index]['file']) : 'n/a';
$line = isset($trace[$index]['line']) ? $trace[$index]['line'] : 'n/a';

$output->writeln(\sprintf(
'From <info>%s:%d</info> at <strong>level %d</strong> of backtrace (of %d).',
OutputFormatter::escape($file),
OutputFormatter::escape($line),
$index + 1,
\count($trace)
));
}

private function replaceCwd($file)
{
if ($cwd = \getcwd()) {
$cwd = \rtrim($cwd, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
}

if ($cwd === false) {
return $file;
} else {
return \preg_replace('/^' . \preg_quote($cwd, '/') . '/', '', $file);
}
}

private function writeTraceCodeSnippet(OutputInterface $output, array $trace, $index)
{
if (!isset($trace[$index]['file'])) {
return;
}

$file = $trace[$index]['file'];
if ($fileAndLine = $this->extractEvalFileAndLine($file)) {
list($file, $line) = $fileAndLine;
} else {
if (!isset($trace[$index]['line'])) {
return;
}

$line = $trace[$index]['line'];
}

if (\is_file($file)) {
$code = @\file_get_contents($file);
}

if (empty($code)) {
return;
}

$output->write($this->getHighlighter()->getCodeSnippet($code, $line, 5, 5), false, OutputInterface::OUTPUT_RAW);
}

private function getHighlighter()
{
if (!$this->highlighter) {
$factory = new ConsoleColorFactory($this->colorMode);
$this->highlighter = new Highlighter($factory->getConsoleColor());
}

return $this->highlighter;
}

private function setCommandScopeVariablesFromContext(array $context)
{
$vars = [];

if (isset($context['class'])) {
$vars['__class'] = $context['class'];
if (isset($context['function'])) {
$vars['__method'] = $context['function'];
}

try {
$refl = new \ReflectionClass($context['class']);
if ($namespace = $refl->getNamespaceName()) {
$vars['__namespace'] = $namespace;
}
} catch (\Exception $e) {

 }
} elseif (isset($context['function'])) {
$vars['__function'] = $context['function'];

try {
$refl = new \ReflectionFunction($context['function']);
if ($namespace = $refl->getNamespaceName()) {
$vars['__namespace'] = $namespace;
}
} catch (\Exception $e) {

 }
}

if (isset($context['file'])) {
$file = $context['file'];
if ($fileAndLine = $this->extractEvalFileAndLine($file)) {
list($file, $line) = $fileAndLine;
} elseif (isset($context['line'])) {
$line = $context['line'];
}

if (\is_file($file)) {
$vars['__file'] = $file;
if (isset($line)) {
$vars['__line'] = $line;
}
$vars['__dir'] = \dirname($file);
}
}

$this->context->setCommandScopeVariables($vars);
}

private function extractEvalFileAndLine($file)
{
if (\preg_match('/(.*)\\((\\d+)\\) : eval\\(\\)\'d code$/', $file, $matches)) {
return [$matches[1], $matches[2]];
}
}
}
<?php










namespace Psy\Command;

use Psy\Input\CodeArgument;
use Psy\VarDumper\Presenter;
use Psy\VarDumper\PresenterAware;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;






class DumpCommand extends ReflectingCommand implements PresenterAware
{
private $presenter;






public function setPresenter(Presenter $presenter)
{
$this->presenter = $presenter;
}




protected function configure()
{
$this
->setName('dump')
->setDefinition([
new CodeArgument('target', CodeArgument::REQUIRED, 'A target object or primitive to dump.'),
new InputOption('depth', '', InputOption::VALUE_REQUIRED, 'Depth to parse.', 10),
new InputOption('all', 'a', InputOption::VALUE_NONE, 'Include private and protected methods and properties.'),
])
->setDescription('Dump an object or primitive.')
->setHelp(
<<<'HELP'
Dump an object or primitive.

This is like var_dump but <strong>way</strong> awesomer.

e.g.
<return>>>> dump $_</return>
<return>>>> dump $someVar</return>
<return>>>> dump $stuff->getAll()</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$depth = $input->getOption('depth');
$target = $this->resolveCode($input->getArgument('target'));
$output->page($this->presenter->present($target, $depth, $input->getOption('all') ? Presenter::VERBOSE : 0));

if (\is_object($target)) {
$this->setCommandScopeVariables(new \ReflectionObject($target));
}

return 0;
}








protected function resolveTarget($name)
{
@\trigger_error('`resolveTarget` is deprecated; use `resolveCode` instead.', E_USER_DEPRECATED);

return $this->resolveCode($name);
}
}
<?php










namespace Psy\Command;

use PhpParser\NodeTraverser;
use PhpParser\PrettyPrinter\Standard as Printer;
use Psy\Command\TimeitCommand\TimeitVisitor;
use Psy\Input\CodeArgument;
use Psy\ParserFactory;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;




class TimeitCommand extends Command
{
const RESULT_MSG = '<info>Command took %.6f seconds to complete.</info>';
const AVG_RESULT_MSG = '<info>Command took %.6f seconds on average (%.6f median; %.6f total) to complete.</info>';

private static $start = null;
private static $times = [];

private $parser;
private $traverser;
private $printer;




public function __construct($name = null)
{
$parserFactory = new ParserFactory();
$this->parser = $parserFactory->createParser();

$this->traverser = new NodeTraverser();
$this->traverser->addVisitor(new TimeitVisitor());

$this->printer = new Printer();

parent::__construct($name);
}




protected function configure()
{
$this
->setName('timeit')
->setDefinition([
new InputOption('num', 'n', InputOption::VALUE_REQUIRED, 'Number of iterations.'),
new CodeArgument('code', CodeArgument::REQUIRED, 'Code to execute.'),
])
->setDescription('Profiles with a timer.')
->setHelp(
<<<'HELP'
Time profiling for functions and commands.

e.g.
<return>>>> timeit sleep(1)</return>
<return>>>> timeit -n1000 $closure()</return>
HELP
);
}




protected function execute(InputInterface $input, OutputInterface $output)
{
$code = $input->getArgument('code');
$num = $input->getOption('num') ?: 1;
$shell = $this->getApplication();

$instrumentedCode = $this->instrumentCode($code);

self::$times = [];

for ($i = 0; $i < $num; $i++) {
$_ = $shell->execute($instrumentedCode);
$this->ensureEndMarked();
}

$shell->writeReturnValue($_);

$times = self::$times;
self::$times = [];

if ($num === 1) {
$output->writeln(\sprintf(self::RESULT_MSG, $times[0]));
} else {
$total = \array_sum($times);
\rsort($times);
$median = $times[\round($num / 2)];

$output->writeln(\sprintf(self::AVG_RESULT_MSG, $total / $num, $median, $total));
}

return 0;
}








public static function markStart()
{
self::$start = \microtime(true);
}















public static function markEnd($ret = null)
{
self::$times[] = \microtime(true) - self::$start;
self::$start = null;

return $ret;
}







private function ensureEndMarked()
{
if (self::$start !== null) {
self::markEnd();
}
}











private function instrumentCode($code)
{
return $this->printer->prettyPrint($this->traverser->traverse($this->parse($code)));
}








private function parse($code)
{
$code = '<?php ' . $code;

try {
return $this->parser->parse($code);
} catch (\PhpParser\Error $e) {
if (\strpos($e->getMessage(), 'unexpected EOF') === false) {
throw $e;
}


 return $this->parser->parse($code . ';');
}
}
}
<?php










namespace Psy;

use Psy\ExecutionLoop\ProcessForker;
use Psy\VersionUpdater\GitHubChecker;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;
use XdgBaseDir\Xdg;

if (!\function_exists('Psy\sh')) {







function sh()
{
return 'extract(\Psy\debug(get_defined_vars(), isset($this) ? $this : @get_called_class()));';
}
}

if (!\function_exists('Psy\debug')) {










































function debug(array $vars = [], $bindTo = null)
{
echo PHP_EOL;

$sh = new Shell();
$sh->setScopeVariables($vars);


 
 
 if ($sh->has('whereami')) {
$sh->addInput('whereami -n2', true);
}

if (\is_string($bindTo)) {
$sh->setBoundClass($bindTo);
} elseif ($bindTo !== null) {
$sh->setBoundObject($bindTo);
}

$sh->run();

return $sh->getScopeVariables(false);
}
}

if (!\function_exists('Psy\info')) {











function info(Configuration $config = null)
{
static $lastConfig;
if ($config !== null) {
$lastConfig = $config;

return;
}

$xdg = new Xdg();
$home = \rtrim(\str_replace('\\', '/', $xdg->getHomeDir()), '/');
$homePattern = '#^' . \preg_quote($home, '#') . '/#';

$prettyPath = function ($path) use ($homePattern) {
if (\is_string($path)) {
return \preg_replace($homePattern, '~/', $path);
} else {
return $path;
}
};

$config = $lastConfig ?: new Configuration();

$core = [
'PsySH version' => Shell::VERSION,
'PHP version' => PHP_VERSION,
'OS' => PHP_OS,
'default includes' => $config->getDefaultIncludes(),
'require semicolons' => $config->requireSemicolons(),
'error logging level' => $config->errorLoggingLevel(),
'config file' => [
'default config file' => $prettyPath($config->getConfigFile()),
'local config file' => $prettyPath($config->getLocalConfigFile()),
'PSYSH_CONFIG env' => $prettyPath(\getenv('PSYSH_CONFIG')),
],

 
 
 ];


 $checker = new GitHubChecker();
$updateAvailable = null;
$latest = null;
try {
$updateAvailable = !$checker->isLatest();
$latest = $checker->getLatest();
} catch (\Exception $e) {
}

$updates = [
'update available' => $updateAvailable,
'latest release version' => $latest,
'update check interval' => $config->getUpdateCheck(),
'update cache file' => $prettyPath($config->getUpdateCheckCacheFile()),
];

if ($config->hasReadline()) {
$info = \readline_info();

$readline = [
'readline available' => true,
'readline enabled' => $config->useReadline(),
'readline service' => \get_class($config->getReadline()),
];

if (isset($info['library_version'])) {
$readline['readline library'] = $info['library_version'];
}

if (isset($info['readline_name']) && $info['readline_name'] !== '') {
$readline['readline name'] = $info['readline_name'];
}
} else {
$readline = [
'readline available' => false,
];
}

$pcntl = [
'pcntl available' => ProcessForker::isPcntlSupported(),
'posix available' => ProcessForker::isPosixSupported(),
];

if ($disabledPcntl = ProcessForker::disabledPcntlFunctions()) {
$pcntl['disabled pcntl functions'] = $disabledPcntl;
}

if ($disabledPosix = ProcessForker::disabledPosixFunctions()) {
$pcntl['disabled posix functions'] = $disabledPosix;
}

$pcntl['use pcntl'] = $config->usePcntl();

$history = [
'history file' => $prettyPath($config->getHistoryFile()),
'history size' => $config->getHistorySize(),
'erase duplicates' => $config->getEraseDuplicates(),
];

$docs = [
'manual db file' => $prettyPath($config->getManualDbFile()),
'sqlite available' => true,
];

try {
if ($db = $config->getManualDb()) {
if ($q = $db->query('SELECT * FROM meta;')) {
$q->setFetchMode(\PDO::FETCH_KEY_PAIR);
$meta = $q->fetchAll();

foreach ($meta as $key => $val) {
switch ($key) {
case 'built_at':
$d = new \DateTime('@' . $val);
$val = $d->format(\DateTime::RFC2822);
break;
}
$key = 'db ' . \str_replace('_', ' ', $key);
$docs[$key] = $val;
}
} else {
$docs['db schema'] = '0.1.0';
}
}
} catch (Exception\RuntimeException $e) {
if ($e->getMessage() === 'SQLite PDO driver not found') {
$docs['sqlite available'] = false;
} else {
throw $e;
}
}

$autocomplete = [
'tab completion enabled' => $config->useTabCompletion(),
'custom matchers' => \array_map('get_class', $config->getTabCompletionMatchers()),
'bracketed paste' => $config->useBracketedPaste(),
];


 if ($shell = Sudo::fetchProperty($config, 'shell')) {
$core['loop listeners'] = \array_map('get_class', Sudo::fetchProperty($shell, 'loopListeners'));
$core['commands'] = \array_map('get_class', $shell->all());

$autocomplete['custom matchers'] = \array_map('get_class', Sudo::fetchProperty($shell, 'matchers'));
}



return \array_merge($core, \compact('updates', 'pcntl', 'readline', 'history', 'docs', 'autocomplete'));
}
}

if (!\function_exists('Psy\bin')) {





function bin()
{
return function () {
if (!isset($_SERVER['PSYSH_IGNORE_ENV']) || !$_SERVER['PSYSH_IGNORE_ENV']) {
if (defined('HHVM_VERSION_ID') && \HHVM_VERSION_ID < 31800) {
fwrite(STDERR, 'HHVM 3.18 or higher is required. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.' . PHP_EOL);
exit(1);
}

if (defined('HHVM_VERSION_ID') && \HHVM_VERSION_ID > 39999) {
fwrite(STDERR, 'HHVM 4 or higher is not supported. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.' . PHP_EOL);
exit(1);
}

if (\PHP_VERSION_ID < 50509) {
fwrite(STDERR, 'PHP 5.5.9 or higher is required. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.' . PHP_EOL);
exit(1);
}

if (\PHP_VERSION_ID > 89999) {
fwrite(STDERR, 'PHP 9 or higher is not supported. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.' . PHP_EOL);
exit(1);
}

if (!function_exists('json_encode')) {
fwrite(STDERR, 'The JSON extension is required. Please install it. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.' . PHP_EOL);
exit(1);
}

if (!function_exists('token_get_all')) {
fwrite(STDERR, 'The Tokenizer extension is required. Please install it. You can set the environment variable PSYSH_IGNORE_ENV=1 to override this restriction and proceed anyway.' . PHP_EOL);
exit(1);
}
}

$usageException = null;

$input = new ArgvInput();
try {
$input->bind(new InputDefinition([
new InputOption('help', 'h', InputOption::VALUE_NONE),
new InputOption('config', 'c', InputOption::VALUE_REQUIRED),
new InputOption('version', 'V', InputOption::VALUE_NONE),
new InputOption('cwd', null, InputOption::VALUE_REQUIRED),
new InputOption('color', null, InputOption::VALUE_NONE),
new InputOption('no-color', null, InputOption::VALUE_NONE),

new InputOption('quiet', 'q', InputOption::VALUE_NONE),
new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE),
new InputOption('no-interaction', 'n', InputOption::VALUE_NONE),
new InputOption('raw-output', 'r', InputOption::VALUE_NONE),

new InputArgument('include', InputArgument::IS_ARRAY),
]));
} catch (\RuntimeException $e) {
$usageException = $e;
}

$config = [];


 if ($configFile = $input->getOption('config')) {
$config['configFile'] = $configFile;
}


 if ($input->getOption('color') && $input->getOption('no-color')) {
$usageException = new \RuntimeException('Using both "--color" and "--no-color" options is invalid');
} elseif ($input->getOption('color')) {
$config['colorMode'] = Configuration::COLOR_MODE_FORCED;
} elseif ($input->getOption('no-color')) {
$config['colorMode'] = Configuration::COLOR_MODE_DISABLED;
}


 if ($input->getOption('raw-output')) {
$config['rawOutput'] = true;
}

$shell = new Shell(new Configuration($config));


 if ($usageException !== null || $input->getOption('help')) {
if ($usageException !== null) {
echo $usageException->getMessage() . PHP_EOL . PHP_EOL;
}

$version = $shell->getVersion();
$name = \basename(\reset($_SERVER['argv']));
echo <<<EOL
$version

Usage:
  $name [--version] [--help] [files...]

Options:
  --help     -h Display this help message.
  --config   -c Use an alternate PsySH config file location.
  --cwd         Use an alternate working directory.
  --version  -V Display the PsySH version.
  --color       Force colors in output.
  --no-color    Disable colors in output.

EOL;
exit($usageException === null ? 0 : 1);
}


 if ($input->getOption('version')) {
echo $shell->getVersion() . PHP_EOL;
exit(0);
}


 $shell->setIncludes($input->getArgument('include'));

try {

 $shell->run();
} catch (\Exception $e) {
fwrite(STDERR, $e->getMessage() . PHP_EOL);


 
 


 }
};
}
}
<?php










namespace Psy;

use Psy\Exception\BreakException;
use Psy\Exception\ErrorException;
use Psy\Exception\ThrowUpException;
use Psy\Exception\TypeErrorException;







class ExecutionLoopClosure extends ExecutionClosure
{



public function __construct(Shell $__psysh__)
{
$this->setClosure($__psysh__, function () use ($__psysh__) {

 \extract($__psysh__->getScopeVariables(false));

do {
$__psysh__->beforeLoop();

try {
$__psysh__->getInput();

try {

 if ($__psysh__->getLastExecSuccess()) {
\extract($__psysh__->getScopeVariablesDiff(\get_defined_vars()));
}


 \ob_start([$__psysh__, 'writeStdout'], 1);


 \set_error_handler([$__psysh__, 'handleError']);


 $_ = eval($__psysh__->onExecute($__psysh__->flushCode() ?: ExecutionClosure::NOOP_INPUT));
} catch (\Throwable $_e) {

 \restore_error_handler();
if (\ob_get_level() > 0) {
\ob_end_clean();
}

throw $_e;
} catch (\Exception $_e) {

 \restore_error_handler();
if (\ob_get_level() > 0) {
\ob_end_clean();
}

throw $_e;
}


 \restore_error_handler();


 \ob_end_flush();


 $__psysh__->setScopeVariables(\get_defined_vars());

$__psysh__->writeReturnValue($_);
} catch (BreakException $_e) {
$__psysh__->writeException($_e);

return;
} catch (ThrowUpException $_e) {
$__psysh__->writeException($_e);

throw $_e;
} catch (\TypeError $_e) {
$__psysh__->writeException(TypeErrorException::fromTypeError($_e));
} catch (\Error $_e) {
$__psysh__->writeException(ErrorException::fromError($_e));
} catch (\Exception $_e) {
$__psysh__->writeException($_e);
}

$__psysh__->afterLoop();
} while (true);
});
}
}
<?php










namespace Psy\Input;

use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\StringInput;




class ShellInput extends StringInput
{
private $hasCodeArgument = false;





private $tokenPairs;
private $parsed;






public function __construct($input)
{
parent::__construct($input);

$this->tokenPairs = $this->tokenize($input);
}






public function bind(InputDefinition $definition)
{
$hasCodeArgument = false;

if ($definition->getArgumentCount() > 0) {
$args = $definition->getArguments();
$lastArg = \array_pop($args);
foreach ($args as $arg) {
if ($arg instanceof CodeArgument) {
$msg = \sprintf('Unexpected CodeArgument before the final position: %s', $arg->getName());
throw new \InvalidArgumentException($msg);
}
}

if ($lastArg instanceof CodeArgument) {
$hasCodeArgument = true;
}
}

$this->hasCodeArgument = $hasCodeArgument;

return parent::bind($definition);
}













private function tokenize($input)
{
$tokens = [];
$length = \strlen($input);
$cursor = 0;
while ($cursor < $length) {
if (\preg_match('/\s+/A', $input, $match, null, $cursor)) {
} elseif (\preg_match('/([^="\'\s]+?)(=?)(' . StringInput::REGEX_QUOTED_STRING . '+)/A', $input, $match, null, $cursor)) {
$tokens[] = [
$match[1] . $match[2] . \stripcslashes(\str_replace(['"\'', '\'"', '\'\'', '""'], '', \substr($match[3], 1, \strlen($match[3]) - 2))),
\stripcslashes(\substr($input, $cursor)),
];
} elseif (\preg_match('/' . StringInput::REGEX_QUOTED_STRING . '/A', $input, $match, null, $cursor)) {
$tokens[] = [
\stripcslashes(\substr($match[0], 1, \strlen($match[0]) - 2)),
\stripcslashes(\substr($input, $cursor)),
];
} elseif (\preg_match('/' . StringInput::REGEX_STRING . '/A', $input, $match, null, $cursor)) {
$tokens[] = [
\stripcslashes($match[1]),
\stripcslashes(\substr($input, $cursor)),
];
} else {

 
 throw new \InvalidArgumentException(\sprintf('Unable to parse input near "... %s ..."', \substr($input, $cursor, 10)));

 }

$cursor += \strlen($match[0]);
}

return $tokens;
}




protected function parse()
{
$parseOptions = true;
$this->parsed = $this->tokenPairs;
while (null !== $tokenPair = \array_shift($this->parsed)) {

 
 list($token, $rest) = $tokenPair;

if ($parseOptions && '' === $token) {
$this->parseShellArgument($token, $rest);
} elseif ($parseOptions && '--' === $token) {
$parseOptions = false;
} elseif ($parseOptions && 0 === \strpos($token, '--')) {
$this->parseLongOption($token);
} elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
$this->parseShortOption($token);
} else {
$this->parseShellArgument($token, $rest);
}
}
}









private function parseShellArgument($token, $rest)
{
$c = \count($this->arguments);


 if ($this->definition->hasArgument($c)) {
$arg = $this->definition->getArgument($c);

if ($arg instanceof CodeArgument) {

 
 $this->parsed = [];
$this->arguments[$arg->getName()] = $rest;
} else {
$this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;
}

return;
}


 
 


 if ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
$arg = $this->definition->getArgument($c - 1);
$this->arguments[$arg->getName()][] = $token;

return;
}


 $all = $this->definition->getArguments();
if (\count($all)) {
throw new \RuntimeException(\sprintf('Too many arguments, expected arguments "%s".', \implode('" "', \array_keys($all))));
}

throw new \RuntimeException(\sprintf('No arguments expected, got "%s".', $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(), null);
}
}
}






private function parseLongOption($token)
{
$name = \substr($token, 2);

if (false !== $pos = \strpos($name, '=')) {
if (0 === \strlen($value = \substr($name, $pos + 1))) {

 
 if (PHP_VERSION_ID < 70000 && false === $value) {
$value = '';
}
\array_unshift($this->parsed, [$value, null]);
}
$this->addLongOption(\substr($name, 0, $pos), $value);
} else {
$this->addLongOption($name, null);
}
}









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()) {
throw new \RuntimeException(\sprintf('The "--%s" option does not accept a value.', $name));
}

if (\in_array($value, ['', null], true) && $option->acceptValue() && \count($this->parsed)) {

 
 $next = \array_shift($this->parsed);
$nextToken = $next[0];
if ((isset($nextToken[0]) && '-' !== $nextToken[0]) || \in_array($nextToken, ['', null], true)) {
$value = $nextToken;
} else {
\array_unshift($this->parsed, $next);
}
}

if (null === $value) {
if ($option->isValueRequired()) {
throw new \RuntimeException(\sprintf('The "--%s" option requires a value.', $name));
}

if (!$option->isArray() && !$option->isValueOptional()) {
$value = true;
}
}

if ($option->isArray()) {
$this->options[$name][] = $value;
} else {
$this->options[$name] = $value;
}
}


}
<?php










namespace Psy\Input;








class SilentInput
{
private $inputString;






public function __construct($inputString)
{
$this->inputString = $inputString;
}






public function __toString()
{
return $this->inputString;
}
}
<?php










namespace Psy\Input;

use Symfony\Component\Console\Input\InputArgument;















class CodeArgument extends InputArgument
{










public function __construct($name, $mode = null, $description = '', $default = null)
{
if ($mode & InputArgument::IS_ARRAY) {
throw new \InvalidArgumentException('Argument mode IS_ARRAY is not valid');
}

parent::__construct($name, $mode, $description, $default);
}
}
<?php










namespace Psy\Input;

use Psy\Exception\ErrorException;
use Psy\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;




class FilterOptions
{
private $filter = false;
private $pattern;
private $insensitive;
private $invert;






public static function getOptions()
{
return [
new InputOption('grep', 'G', InputOption::VALUE_REQUIRED, 'Limit to items matching the given pattern (string or regex).'),
new InputOption('insensitive', 'i', InputOption::VALUE_NONE, 'Case-insensitive search (requires --grep).'),
new InputOption('invert', 'v', InputOption::VALUE_NONE, 'Inverted search (requires --grep).'),
];
}






public function bind(InputInterface $input)
{
$this->validateInput($input);

if (!$pattern = $input->getOption('grep')) {
$this->filter = false;

return;
}

if (!$this->stringIsRegex($pattern)) {
$pattern = '/' . \preg_quote($pattern, '/') . '/';
}

if ($insensitive = $input->getOption('insensitive')) {
$pattern .= 'i';
}

$this->validateRegex($pattern);

$this->filter = true;
$this->pattern = $pattern;
$this->insensitive = $insensitive;
$this->invert = $input->getOption('invert');
}






public function hasFilter()
{
return $this->filter;
}









public function match($string, array &$matches = null)
{
return $this->filter === false || (\preg_match($this->pattern, $string, $matches) xor $this->invert);
}








private function validateInput(InputInterface $input)
{
if (!$input->getOption('grep')) {
foreach (['invert', 'insensitive'] as $option) {
if ($input->getOption($option)) {
throw new RuntimeException('--' . $option . ' does not make sense without --grep');
}
}
}
}








private function stringIsRegex($string)
{
return \substr($string, 0, 1) === '/' && \substr($string, -1) === '/' && \strlen($string) >= 3;
}








private function validateRegex($pattern)
{
\set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
try {
\preg_match($pattern, '');
} catch (ErrorException $e) {
\restore_error_handler();
throw new RuntimeException(\str_replace('preg_match(): ', 'Invalid regular expression: ', $e->getRawMessage()));
}
\restore_error_handler();
}
}
<?php










namespace Psy\Reflection;






class ReflectionClassConstant implements \Reflector
{
public $class;
public $name;
private $value;







public function __construct($class, $name)
{
if (!$class instanceof \ReflectionClass) {
$class = new \ReflectionClass($class);
}

$this->class = $class;
$this->name = $name;

$constants = $class->getConstants();
if (!\array_key_exists($name, $constants)) {
throw new \InvalidArgumentException('Unknown constant: ' . $name);
}

$this->value = $constants[$name];
}










public static function export($class, $name, $return = false)
{
$refl = new self($class, $name);
$value = $refl->getValue();

$str = \sprintf('Constant [ public %s %s ] { %s }', \gettype($value), $refl->getName(), $value);

if ($return) {
return $str;
}

echo $str . "\n";
}






public function getDeclaringClass()
{
$parent = $this->class;


 
 
 
 
 do {
$class = $parent;
$parent = $class->getParentClass();
} while ($parent && $parent->hasConstant($this->name) && $parent->getConstant($this->name) === $this->value);

return $class;
}






public function getDocComment()
{
return false;
}










public function getModifiers()
{
return \ReflectionMethod::IS_PUBLIC;
}






public function getName()
{
return $this->name;
}






public function getValue()
{
return $this->value;
}






public function isPrivate()
{
return false;
}






public function isProtected()
{
return false;
}






public function isPublic()
{
return true;
}






public function __toString()
{
return $this->getName();
}







public function getFileName()
{
return;

 }






public function getStartLine()
{
throw new \RuntimeException('Not yet implemented because it\'s unclear what I should do here :)');
}






public function getEndLine()
{
return $this->getStartLine();
}












public static function create($class, $name)
{
if (\class_exists('ReflectionClassConstant')) {
return new \ReflectionClassConstant($class, $name);
}

return new self($class, $name);
}
}
<?php










namespace Psy\Reflection;




class ReflectionLanguageConstruct extends \ReflectionFunctionAbstract
{
public $keyword;




private static $languageConstructs = [
'isset' => [
'var' => [],
'...' => [
'isOptional' => true,
'defaultValue' => null,
],
],

'unset' => [
'var' => [],
'...' => [
'isOptional' => true,
'defaultValue' => null,
],
],

'empty' => [
'var' => [],
],

'echo' => [
'arg1' => [],
'...' => [
'isOptional' => true,
'defaultValue' => null,
],
],

'print' => [
'arg' => [],
],

'die' => [
'status' => [
'isOptional' => true,
'defaultValue' => 0,
],
],

'exit' => [
'status' => [
'isOptional' => true,
'defaultValue' => 0,
],
],
];






public function __construct($keyword)
{
if (!self::isLanguageConstruct($keyword)) {
throw new \InvalidArgumentException('Unknown language construct: ' . $keyword);
}

$this->keyword = $keyword;
}






public static function export($name)
{
throw new \RuntimeException('Not yet implemented because it\'s unclear what I should do here :)');
}






public function getName()
{
return $this->keyword;
}






public function returnsReference()
{
return false;
}






public function getParameters()
{
$params = [];
foreach (self::$languageConstructs[$this->keyword] as $parameter => $opts) {
\array_push($params, new ReflectionLanguageConstructParameter($this->keyword, $parameter, $opts));
}

return $params;
}








public function getFileName()
{
return false;
}






public function __toString()
{
return $this->getName();
}








public static function isLanguageConstruct($keyword)
{
return \array_key_exists($keyword, self::$languageConstructs);
}
}
<?php










namespace Psy\Reflection;






class ReflectionLanguageConstructParameter extends \ReflectionParameter
{
private $function;
private $parameter;
private $opts;

public function __construct($function, $parameter, array $opts)
{
$this->function = $function;
$this->parameter = $parameter;
$this->opts = $opts;
}




public function getClass()
{
return;
}






public function isArray()
{
return \array_key_exists('isArray', $this->opts) && $this->opts['isArray'];
}






public function getDefaultValue()
{
if ($this->isDefaultValueAvailable()) {
return $this->opts['defaultValue'];
}
}






public function getName()
{
return $this->parameter;
}






public function isOptional()
{
return \array_key_exists('isOptional', $this->opts) && $this->opts['isOptional'];
}






public function isDefaultValueAvailable()
{
return \array_key_exists('defaultValue', $this->opts);
}








public function isPassedByReference()
{
return \array_key_exists('isPassedByReference', $this->opts) && $this->opts['isPassedByReference'];
}
}
<?php










namespace Psy\Reflection;










class ReflectionConstant_ implements \Reflector
{
public $name;
private $value;

private static $magicConstants = [
'__LINE__',
'__FILE__',
'__DIR__',
'__FUNCTION__',
'__CLASS__',
'__TRAIT__',
'__METHOD__',
'__NAMESPACE__',
'__COMPILER_HALT_OFFSET__',
];






public function __construct($name)
{
$this->name = $name;

if (!\defined($name) && !self::isMagicConstant($name)) {
throw new \InvalidArgumentException('Unknown constant: ' . $name);
}

if (!self::isMagicConstant($name)) {
$this->value = @\constant($name);
}
}









public static function export($name, $return = false)
{
$refl = new self($name);
$value = $refl->getValue();

$str = \sprintf('Constant [ %s %s ] { %s }', \gettype($value), $refl->getName(), $value);

if ($return) {
return $str;
}

echo $str . "\n";
}

public static function isMagicConstant($name)
{
return \in_array($name, self::$magicConstants);
}






public function getDocComment()
{
return false;
}






public function getName()
{
return $this->name;
}








public function getNamespaceName()
{
if (!$this->inNamespace()) {
return '';
}

return \preg_replace('/\\\\[^\\\\]+$/', '', $this->name);
}






public function getValue()
{
return $this->value;
}






public function inNamespace()
{
return \strpos($this->name, '\\') !== false;
}






public function __toString()
{
return $this->getName();
}







public function getFileName()
{
return;

 }






public function getStartLine()
{
throw new \RuntimeException('Not yet implemented because it\'s unclear what I should do here :)');
}






public function getEndLine()
{
return $this->getStartLine();
}
}
<?php










namespace Psy\Reflection;






class ReflectionConstant extends ReflectionClassConstant
{



public function __construct($class, $name)
{
@\trigger_error('ReflectionConstant is now ReflectionClassConstant', E_USER_DEPRECATED);

parent::__construct($class, $name);
}
}
<?php










namespace Psy\VersionUpdater;

use Psy\Shell;

class GitHubChecker implements Checker
{
const URL = 'https://api.github.com/repos/bobthecow/psysh/releases/latest';

private $latest;




public function isLatest()
{
return \version_compare(Shell::VERSION, $this->getLatest(), '>=');
}




public function getLatest()
{
if (!isset($this->latest)) {
$this->setLatest($this->getVersionFromTag());
}

return $this->latest;
}




public function setLatest($version)
{
$this->latest = $version;
}




private function getVersionFromTag()
{
$contents = $this->fetchLatestRelease();
if (!$contents || !isset($contents->tag_name)) {
throw new \InvalidArgumentException('Unable to check for updates');
}
$this->setLatest($contents->tag_name);

return $this->getLatest();
}






public function fetchLatestRelease()
{
$context = \stream_context_create([
'http' => [
'user_agent' => 'PsySH/' . Shell::VERSION,
'timeout' => 3,
],
]);

\set_error_handler(function () {

 
 });

$result = @\file_get_contents(self::URL, false, $context);

\restore_error_handler();

return \json_decode($result);
}
}
<?php










namespace Psy\VersionUpdater;

use Psy\Shell;




class NoopChecker implements Checker
{



public function isLatest()
{
return true;
}




public function getLatest()
{
return Shell::VERSION;
}
}
<?php










namespace Psy\VersionUpdater;

interface Checker
{
const ALWAYS = 'always';
const DAILY = 'daily';
const WEEKLY = 'weekly';
const MONTHLY = 'monthly';
const NEVER = 'never';




public function isLatest();




public function getLatest();
}
<?php










namespace Psy\VersionUpdater;

class IntervalChecker extends GitHubChecker
{
private $cacheFile;
private $interval;

public function __construct($cacheFile, $interval)
{
$this->cacheFile = $cacheFile;
$this->interval = $interval;
}

public function fetchLatestRelease()
{

 $cached = \json_decode(@\file_get_contents($this->cacheFile, false));
if ($cached && isset($cached->last_check) && isset($cached->release)) {
$now = new \DateTime();
$lastCheck = new \DateTime($cached->last_check);
if ($lastCheck >= $now->sub($this->getDateInterval())) {
return $cached->release;
}
}


 $release = parent::fetchLatestRelease();
if ($release && isset($release->tag_name)) {
$this->updateCache($release);
}

return $release;
}

private function getDateInterval()
{
switch ($this->interval) {
case Checker::DAILY:
return new \DateInterval('P1D');
case Checker::WEEKLY:
return new \DateInterval('P1W');
case Checker::MONTHLY:
return new \DateInterval('P1M');
}
}

private function updateCache($release)
{
$data = [
'last_check' => \date(DATE_ATOM),
'release' => $release,
];

\file_put_contents($this->cacheFile, \json_encode($data));
}
}
<?php










namespace Psy\ExecutionLoop;

use Psy\Context;
use Psy\Exception\BreakException;
use Psy\Shell;







class ProcessForker extends AbstractListener
{
private $savegame;
private $up;

private static $pcntlFunctions = [
'pcntl_fork',
'pcntl_signal_dispatch',
'pcntl_signal',
'pcntl_waitpid',
'pcntl_wexitstatus',
];

private static $posixFunctions = [
'posix_getpid',
'posix_kill',
];






public static function isSupported()
{
return self::isPcntlSupported() && !self::disabledPcntlFunctions() && self::isPosixSupported() && !self::disabledPosixFunctions();
}




public static function isPcntlSupported()
{
foreach (self::$pcntlFunctions as $func) {
if (!\function_exists($func)) {
return false;
}
}

return true;
}




public static function disabledPcntlFunctions()
{
return self::checkDisabledFunctions(self::$pcntlFunctions);
}




public static function isPosixSupported()
{
foreach (self::$posixFunctions as $func) {
if (!\function_exists($func)) {
return false;
}
}

return true;
}




public static function disabledPosixFunctions()
{
return self::checkDisabledFunctions(self::$posixFunctions);
}

private static function checkDisabledFunctions(array $functions)
{
return \array_values(\array_intersect($functions, \array_map('strtolower', \array_map('trim', \explode(',', \ini_get('disable_functions'))))));
}









public function beforeRun(Shell $shell)
{
list($up, $down) = \stream_socket_pair(STREAM_PF_UNIX, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP);

if (!$up) {
throw new \RuntimeException('Unable to create socket pair');
}

$pid = \pcntl_fork();
if ($pid < 0) {
throw new \RuntimeException('Unable to start execution loop');
} elseif ($pid > 0) {



 \fclose($up);


 $read = [$down];
$write = null;
$except = null;

do {
$n = @\stream_select($read, $write, $except, null);

if ($n === 0) {
throw new \RuntimeException('Process timed out waiting for execution loop');
}

if ($n === false) {
$err = \error_get_last();
if (!isset($err['message']) || \stripos($err['message'], 'interrupted system call') === false) {
$msg = $err['message'] ?
\sprintf('Error waiting for execution loop: %s', $err['message']) :
'Error waiting for execution loop';
throw new \RuntimeException($msg);
}
}
} while ($n < 1);

$content = \stream_get_contents($down);
\fclose($down);

if ($content) {
$shell->setScopeVariables(@\unserialize($content));
}

throw new BreakException('Exiting main thread');
}


 if (\function_exists('setproctitle')) {
setproctitle('psysh (loop)');
}


 \fclose($down);


 $this->up = $up;
}






public function beforeLoop(Shell $shell)
{
$this->createSavegame();
}






public function afterLoop(Shell $shell)
{

 if (isset($this->savegame)) {
\posix_kill($this->savegame, SIGKILL);
\pcntl_signal_dispatch();
}
}







public function afterRun(Shell $shell)
{

 if (isset($this->up)) {
\fwrite($this->up, $this->serializeReturn($shell->getScopeVariables(false)));
\fclose($this->up);

\posix_kill(\posix_getpid(), SIGKILL);
}
}








private function createSavegame()
{

 $this->savegame = \posix_getpid();

$pid = \pcntl_fork();
if ($pid < 0) {
throw new \RuntimeException('Unable to create savegame fork');
} elseif ($pid > 0) {

 \pcntl_waitpid($pid, $status);


 if (!\pcntl_wexitstatus($status)) {
\posix_kill(\posix_getpid(), SIGKILL);
}


 $this->createSavegame();
}
}













private function serializeReturn(array $return)
{
$serializable = [];

foreach ($return as $key => $value) {

 if (Context::isSpecialVariableName($key)) {
continue;
}


 if (\is_resource($value) || $value instanceof \Closure) {
continue;
}

try {
@\serialize($value);
$serializable[$key] = $value;
} catch (\Throwable $e) {

 } catch (\Exception $e) {

 
 }
}

return @\serialize($serializable);
}
}
<?php










namespace Psy\ExecutionLoop;

use Psy\Shell;




interface Listener
{





public static function isSupported();






public function beforeRun(Shell $shell);






public function beforeLoop(Shell $shell);











public function onInput(Shell $shell, $input);















public function onExecute(Shell $shell, $code);






public function afterLoop(Shell $shell);






public function afterRun(Shell $shell);
}
<?php










namespace Psy\ExecutionLoop;

use Psy\Shell;




abstract class AbstractListener implements Listener
{



public function beforeRun(Shell $shell)
{
}




public function beforeLoop(Shell $shell)
{
}




public function onInput(Shell $shell, $input)
{
}




public function onExecute(Shell $shell, $code)
{
}




public function afterLoop(Shell $shell)
{
}




public function afterRun(Shell $shell)
{
}
}
<?php










namespace Psy\ExecutionLoop;

use Psy\Exception\ParseErrorException;
use Psy\ParserFactory;
use Psy\Shell;




class RunkitReloader extends AbstractListener
{
private $parser;
private $timestamps = [];






public static function isSupported()
{
return \extension_loaded('runkit');
}






public function __construct()
{
$parserFactory = new ParserFactory();
$this->parser = $parserFactory->createParser();
}







public function onInput(Shell $shell, $input)
{
$this->reload($shell);
}






private function reload(Shell $shell)
{
\clearstatcache();
$modified = [];

foreach (\get_included_files() as $file) {
$timestamp = \filemtime($file);

if (!isset($this->timestamps[$file])) {
$this->timestamps[$file] = $timestamp;
continue;
}

if ($this->timestamps[$file] === $timestamp) {
continue;
}

if (!$this->lintFile($file)) {
$msg = \sprintf('Modified file "%s" could not be reloaded', $file);
$shell->writeException(new ParseErrorException($msg));
continue;
}

$modified[] = $file;
$this->timestamps[$file] = $timestamp;
}


 
 


 
 


 
 
 

foreach ($modified as $file) {
runkit_import($file, (
RUNKIT_IMPORT_FUNCTIONS |
RUNKIT_IMPORT_CLASSES |
RUNKIT_IMPORT_CLASS_METHODS |
RUNKIT_IMPORT_CLASS_CONSTS |
RUNKIT_IMPORT_CLASS_PROPS |
RUNKIT_IMPORT_OVERRIDE
));
}
}










private function lintFile($file)
{

 try {
$this->parser->parse(\file_get_contents($file));
} catch (\Exception $e) {
return false;
}

return true;
}
}
<?php










namespace Psy\Util;

/**
@justinhileman







*/
class Docblock
{







public static $vectors = [
'throws' => ['type', 'desc'],
'param' => ['type', 'var', 'desc'],
'return' => ['type', 'desc'],
];

protected $reflector;






public $desc;

/**
     * The tags defined in the docblock.
     *
     * The array has keys which are the tag names (excluding the @) and values
     * that are arrays, each of which is an entry for the tag.
     *
     * In the case where the tag name is defined in {@see DocBlock::$vectors} the
     * value within the tag-value array is an array in itself with keys as
     * described by {@see DocBlock::$vectors}.
     *
     * @var array
     */
public $tags;






public $comment;






public function __construct(\Reflector $reflector)
{
$this->reflector = $reflector;
$this->setComment($reflector->getDocComment());
}






protected function setComment($comment)
{
$this->desc = '';
$this->tags = [];
$this->comment = $comment;

$this->parseComment($comment);
}








protected static function prefixLength(array $lines)
{

 $lines = \array_filter($lines, function ($line) {
return \substr($line, \strspn($line, "* \t\n\r\0\x0B"));
});


 \sort($lines);

$first = \reset($lines);
$last = \end($lines);


 $count = \min(\strlen($first), \strlen($last));
for ($i = 0; $i < $count; $i++) {
if ($first[$i] !== $last[$i]) {
return $i;
}
}

return $count;
}






protected function parseComment($comment)
{

 $comment = \substr($comment, 3, -2);


 $comment = \array_filter(\preg_split('/\r?\n\r?/', $comment));


 $prefixLength = self::prefixLength($comment);
$comment = \array_map(function ($line) use ($prefixLength) {
return \rtrim(\substr($line, $prefixLength));
}, $comment);


 $blocks = [];
$b = -1;
foreach ($comment as $line) {
if (self::isTagged($line)) {
$b++;
$blocks[] = [];
} elseif ($b === -1) {
$b = 0;
$blocks[] = [];
}
$blocks[$b][] = $line;
}


 foreach ($blocks as $block => $body) {
$body = \trim(\implode("\n", $body));

if ($block === 0 && !self::isTagged($body)) {

 $this->desc = $body;
} else {

 $tag = \substr(self::strTag($body), 1);
$body = \ltrim(\substr($body, \strlen($tag) + 2));

if (isset(self::$vectors[$tag])) {

 $count = \count(self::$vectors[$tag]);
if ($body) {
$parts = \preg_split('/\s+/', $body, $count);
} else {
$parts = [];
}


 $parts = \array_pad($parts, $count, null);


 $this->tags[$tag][] = \array_combine(self::$vectors[$tag], $parts);
} else {

 $this->tags[$tag][] = $body;
}
}
}
}

/**
@tag
@tag



*/
public function hasTag($tag)
{
return \is_array($this->tags) && \array_key_exists($tag, $this->tags);
}








public function tag($tag)
{
return $this->hasTag($tag) ? $this->tags[$tag] : null;
}

/**
@tag




*/
public static function isTagged($str)
{
return isset($str[1]) && $str[0] === '@' && !\preg_match('/[^A-Za-z]/', $str[1]);
}








public static function strTag($str)
{
if (\preg_match('/^@[a-z0-9_]+/', $str, $matches)) {
return $matches[0];
}
}
}
<?php










namespace Psy\Util;

use Psy\Exception\RuntimeException;
use Psy\Reflection\ReflectionClassConstant;
use Psy\Reflection\ReflectionConstant_;




class Mirror
{
const CONSTANT = 1;
const METHOD = 2;
const STATIC_PROPERTY = 4;
const PROPERTY = 8;


















public static function get($value, $member = null, $filter = 15)
{
if ($member === null && \is_string($value)) {
if (\function_exists($value)) {
return new \ReflectionFunction($value);
} elseif (\defined($value) || ReflectionConstant_::isMagicConstant($value)) {
return new ReflectionConstant_($value);
}
}

$class = self::getClass($value);

if ($member === null) {
return $class;
} elseif ($filter & self::CONSTANT && $class->hasConstant($member)) {
return ReflectionClassConstant::create($value, $member);
} elseif ($filter & self::METHOD && $class->hasMethod($member)) {
return $class->getMethod($member);
} elseif ($filter & self::PROPERTY && $class->hasProperty($member)) {
return $class->getProperty($member);
} elseif ($filter & self::STATIC_PROPERTY && $class->hasProperty($member) && $class->getProperty($member)->isStatic()) {
return $class->getProperty($member);
} else {
throw new RuntimeException(\sprintf('Unknown member %s on class %s', $member, \is_object($value) ? \get_class($value) : $value));
}
}










private static function getClass($value)
{
if (\is_object($value)) {
return new \ReflectionObject($value);
}

if (!\is_string($value)) {
throw new \InvalidArgumentException('Mirror expects an object or class');
} elseif (!\class_exists($value) && !\interface_exists($value) && !\trait_exists($value)) {
throw new \InvalidArgumentException('Unknown class or function: ' . $value);
}

return new \ReflectionClass($value);
}
}
<?php










namespace Psy\Util;




class Json
{








public static function encode($val, $opt = 0)
{
$opt |= JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;

return \json_encode($val, $opt);
}
}
<?php










namespace Psy\Util;






class Str
{
const UNVIS_RX = <<<'EOS'
/
    \\(?:
        ((?:040)|s)
        | (240)
        | (?: M-(.) )
        | (?: M\^(.) )
        | (?: \^(.) )
    )
/xS
EOS;






























public static function unvis($input)
{
$output = \preg_replace_callback(self::UNVIS_RX, 'self::unvisReplace', $input);

 return \stripcslashes($output);
}








protected static function unvisReplace($match)
{

 if (!empty($match[1])) {
return "\x20";
}

 if (!empty($match[2])) {
return "\xa0";
}

 if (isset($match[3]) && $match[3] !== '') {
$chr = $match[3];

 $cp = 0200;
$cp |= \ord($chr);

return \chr($cp);
}

 if (isset($match[4]) && $match[4] !== '') {
$chr = $match[4];

 $cp = 0200;
$cp |= ($chr === '?') ? 0177 : \ord($chr) & 037;

return \chr($cp);
}

 if (isset($match[5]) && $match[5] !== '') {
$chr = $match[5];

 $cp = 0;
$cp |= ($chr === '?') ? 0177 : \ord($chr) & 037;

return \chr($cp);
}
}
}
<?php










namespace Psy;

use Psy\CodeCleaner\NoReturnValue;
use Psy\Exception\BreakException;
use Psy\Exception\ErrorException;
use Psy\Exception\Exception as PsyException;
use Psy\Exception\ThrowUpException;
use Psy\Exception\TypeErrorException;
use Psy\ExecutionLoop\ProcessForker;
use Psy\ExecutionLoop\RunkitReloader;
use Psy\Input\ShellInput;
use Psy\Input\SilentInput;
use Psy\TabCompletion\Matcher;
use Psy\VarDumper\PresenterAware;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command as BaseCommand;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\OutputInterface;











class Shell extends Application
{
const VERSION = 'v0.10.2';

const PROMPT = '>>> ';
const BUFF_PROMPT = '... ';
const REPLAY = '--> ';
const RETVAL = '=> ';

private $config;
private $cleaner;
private $output;
private $originalVerbosity;
private $readline;
private $inputBuffer;
private $code;
private $codeBuffer;
private $codeBufferOpen;
private $codeStack;
private $stdoutBuffer;
private $context;
private $includes;
private $outputWantsNewline = false;
private $prompt;
private $loopListeners;
private $autoCompleter;
private $matchers = [];
private $commandsMatcher;
private $lastExecSuccess = true;






public function __construct(Configuration $config = null)
{
$this->config = $config ?: new Configuration();
$this->cleaner = $this->config->getCodeCleaner();
$this->context = new Context();
$this->includes = [];
$this->readline = $this->config->getReadline();
$this->inputBuffer = [];
$this->codeStack = [];
$this->stdoutBuffer = '';
$this->loopListeners = $this->getDefaultLoopListeners();

parent::__construct('Psy Shell', self::VERSION);

$this->config->setShell($this);


 \Psy\info($this->config);
}







public static function isIncluded(array $trace)
{
return isset($trace[0]['function']) &&
\in_array($trace[0]['function'], ['require', 'include', 'require_once', 'include_once']);
}












public static function debug(array $vars = [], $bindTo = null)
{
return \Psy\debug($vars, $bindTo);
}










public function add(BaseCommand $command)
{
if ($ret = parent::add($command)) {
if ($ret instanceof ContextAware) {
$ret->setContext($this->context);
}

if ($ret instanceof PresenterAware) {
$ret->setPresenter($this->config->getPresenter());
}

if (isset($this->commandsMatcher)) {
$this->commandsMatcher->setCommands($this->all());
}
}

return $ret;
}






protected function getDefaultInputDefinition()
{
return new InputDefinition([
new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
]);
}






protected function getDefaultCommands()
{
$sudo = new Command\SudoCommand();
$sudo->setReadline($this->readline);

$hist = new Command\HistoryCommand();
$hist->setReadline($this->readline);

return [
new Command\HelpCommand(),
new Command\ListCommand(),
new Command\DumpCommand(),
new Command\DocCommand(),
new Command\ShowCommand($this->config->colorMode()),
new Command\WtfCommand($this->config->colorMode()),
new Command\WhereamiCommand($this->config->colorMode()),
new Command\ThrowUpCommand(),
new Command\TimeitCommand(),
new Command\TraceCommand(),
new Command\BufferCommand(),
new Command\ClearCommand(),
new Command\EditCommand($this->config->getRuntimeDir()),

 $sudo,
$hist,
new Command\ExitCommand(),
];
}




protected function getDefaultMatchers()
{

 
 $this->commandsMatcher = new Matcher\CommandsMatcher($this->all());

return [
$this->commandsMatcher,
new Matcher\KeywordsMatcher(),
new Matcher\VariablesMatcher(),
new Matcher\ConstantsMatcher(),
new Matcher\FunctionsMatcher(),
new Matcher\ClassNamesMatcher(),
new Matcher\ClassMethodsMatcher(),
new Matcher\ClassAttributesMatcher(),
new Matcher\ObjectMethodsMatcher(),
new Matcher\ObjectAttributesMatcher(),
new Matcher\ClassMethodDefaultParametersMatcher(),
new Matcher\ObjectMethodDefaultParametersMatcher(),
new Matcher\FunctionDefaultParametersMatcher(),
];
}




protected function getTabCompletionMatchers()
{
@\trigger_error('getTabCompletionMatchers is no longer used', E_USER_DEPRECATED);
}






protected function getDefaultLoopListeners()
{
$listeners = [];

if (ProcessForker::isSupported() && $this->config->usePcntl()) {
$listeners[] = new ProcessForker();
}

if (RunkitReloader::isSupported()) {
$listeners[] = new RunkitReloader();
}

return $listeners;
}






public function addMatchers(array $matchers)
{
$this->matchers = \array_merge($this->matchers, $matchers);

if (isset($this->autoCompleter)) {
$this->addMatchersToAutoCompleter($matchers);
}
}






public function addTabCompletionMatchers(array $matchers)
{
$this->addMatchers($matchers);
}






public function setOutput(OutputInterface $output)
{
$this->output = $output;
$this->originalVerbosity = $output->getVerbosity();
}









public function run(InputInterface $input = null, OutputInterface $output = null)
{
if ($input === null && !isset($_SERVER['argv'])) {
$input = new ArgvInput([]);
}

if ($output === null) {
$output = $this->config->getOutput();
}

try {
return parent::run($input, $output);
} catch (\Exception $e) {
$this->writeException($e);
}

return 1;
}











public function doRun(InputInterface $input, OutputInterface $output)
{
$this->setOutput($output);

$this->resetCodeBuffer();
$this->setAutoExit(false);
$this->setCatchExceptions(false);

if ($input->isInteractive()) {
return $this->doInteractiveRun($input);
} else {
return $this->doNonInteractiveRun($input, $this->config->rawOutput());
}
}











private function doInteractiveRun(InputInterface $input)
{
$this->initializeTabCompletion();
$this->readline->readHistory();

$this->output->writeln($this->getHeader());
$this->writeVersionInfo();
$this->writeStartupMessage();

try {
$this->beforeRun();
$this->loadIncludes();
$loop = new ExecutionLoopClosure($this);
$loop->execute();
$this->afterRun();
} catch (ThrowUpException $e) {
throw $e->getPrevious();
} catch (BreakException $e) {

 return;
}
}









private function doNonInteractiveRun(InputInterface $input, $rawOutput)
{

 if (!$rawOutput) {
$this->output->writeln($this->getHeader());
$this->writeVersionInfo();
$this->writeStartupMessage();
}

$this->beforeRun();
$this->loadIncludes();
$this->getInput(false);

if ($this->hasCode()) {
$ret = $this->execute($this->flushCode());
$this->writeReturnValue($ret, $rawOutput);
}

$this->afterRun();
}




private function loadIncludes()
{

 $load = function (self $__psysh__) {
\set_error_handler([$__psysh__, 'handleError']);
foreach ($__psysh__->getIncludes() as $__psysh_include__) {
try {
include $__psysh_include__;
} catch (\Error $_e) {
$__psysh__->writeException(ErrorException::fromError($_e));
} catch (\Exception $_e) {
$__psysh__->writeException($_e);
}
}
\restore_error_handler();
unset($__psysh_include__);


 \extract($__psysh__->getScopeVariables(false));


 $__psysh__->setScopeVariables(\get_defined_vars());
};

$load($this);
}











public function getInput($interactive = true)
{
$this->codeBufferOpen = false;

do {

 $this->output->setVerbosity($this->originalVerbosity);

$input = $this->readline();








if ($input === false) {
if (!$interactive) {
return;
}

$this->output->writeln('');

if ($this->hasCode()) {
$this->resetCodeBuffer();
} else {
throw new BreakException('Ctrl+D');
}
}


 if (\trim($input) === '' && !$this->codeBufferOpen) {
continue;
}

$input = $this->onInput($input);


 if ($this->hasCommand($input) && !$this->inputInOpenStringOrComment($input)) {
$this->addHistory($input);
$this->runCommand($input);

continue;
}

$this->addCode($input);
} while (!$interactive || !$this->hasValidCode());
}








private function inputInOpenStringOrComment($input)
{
if (!$this->hasCode()) {
return;
}

$code = $this->codeBuffer;
\array_push($code, $input);
$tokens = @\token_get_all('<?php ' . \implode("\n", $code));
$last = \array_pop($tokens);

return $last === '"' || $last === '`' ||
(\is_array($last) && \in_array($last[0], [T_ENCAPSED_AND_WHITESPACE, T_START_HEREDOC, T_COMMENT]));
}




protected function beforeRun()
{
foreach ($this->loopListeners as $listener) {
$listener->beforeRun($this);
}
}




public function beforeLoop()
{
foreach ($this->loopListeners as $listener) {
$listener->beforeLoop($this);
}
}








public function onInput($input)
{
foreach ($this->loopListeners as $listeners) {
if (($return = $listeners->onInput($this, $input)) !== null) {
$input = $return;
}
}

return $input;
}








public function onExecute($code)
{
foreach ($this->loopListeners as $listener) {
if (($return = $listener->onExecute($this, $code)) !== null) {
$code = $return;
}
}

return $code;
}




public function afterLoop()
{
foreach ($this->loopListeners as $listener) {
$listener->afterLoop($this);
}
}




protected function afterRun()
{
foreach ($this->loopListeners as $listener) {
$listener->afterRun($this);
}
}






public function setScopeVariables(array $vars)
{
$this->context->setAll($vars);
}










public function getScopeVariables($includeBoundObject = true)
{
$vars = $this->context->getAll();

if (!$includeBoundObject) {
unset($vars['this']);
}

return $vars;
}










public function getSpecialScopeVariables($includeBoundObject = true)
{
$vars = $this->context->getSpecialVariables();

if (!$includeBoundObject) {
unset($vars['this']);
}

return $vars;
}












public function getScopeVariablesDiff(array $currentVars)
{
$newVars = [];

foreach ($this->getScopeVariables(false) as $key => $value) {
if (!array_key_exists($key, $currentVars) || $currentVars[$key] !== $value) {
$newVars[$key] = $value;
}
}

return $newVars;
}






public function getUnusedCommandScopeVariableNames()
{
return $this->context->getUnusedCommandScopeVariableNames();
}






public function getScopeVariableNames()
{
return \array_keys($this->context->getAll());
}








public function getScopeVariable($name)
{
return $this->context->get($name);
}






public function setBoundObject($boundObject)
{
$this->context->setBoundObject($boundObject);
}






public function getBoundObject()
{
return $this->context->getBoundObject();
}






public function setBoundClass($boundClass)
{
$this->context->setBoundClass($boundClass);
}






public function getBoundClass()
{
return $this->context->getBoundClass();
}






public function setIncludes(array $includes = [])
{
$this->includes = $includes;
}






public function getIncludes()
{
return \array_merge($this->config->getDefaultIncludes(), $this->includes);
}






public function hasCode()
{
return !empty($this->codeBuffer);
}








protected function hasValidCode()
{
return !$this->codeBufferOpen && $this->code !== false;
}







public function addCode($code, $silent = false)
{
try {

 if (\substr(\rtrim($code), -1) === '\\') {
$this->codeBufferOpen = true;
$code = \substr(\rtrim($code), 0, -1);
} else {
$this->codeBufferOpen = false;
}

$this->codeBuffer[] = $silent ? new SilentInput($code) : $code;
$this->code = $this->cleaner->clean($this->codeBuffer, $this->config->requireSemicolons());
} catch (\Exception $e) {

 $this->addCodeBufferToHistory();

throw $e;
}
}













private function setCode($code, $silent = false)
{
if ($this->hasCode()) {
$this->codeStack[] = [$this->codeBuffer, $this->codeBufferOpen, $this->code];
}

$this->resetCodeBuffer();
try {
$this->addCode($code, $silent);
} catch (\Throwable $e) {
$this->popCodeStack();

throw $e;
} catch (\Exception $e) {
$this->popCodeStack();

throw $e;
}

if (!$this->hasValidCode()) {
$this->popCodeStack();

throw new \InvalidArgumentException('Unexpected end of input');
}
}








public function getCodeBuffer()
{
return $this->codeBuffer;
}










protected function runCommand($input)
{
$command = $this->getCommand($input);

if (empty($command)) {
throw new \InvalidArgumentException('Command not found: ' . $input);
}

$input = new ShellInput(\str_replace('\\', '\\\\', \rtrim($input, " \t\n\r\0\x0B;")));

if ($input->hasParameterOption(['--help', '-h'])) {
$helpCommand = $this->get('help');
$helpCommand->setCommand($command);

return $helpCommand->run(new StringInput(''), $this->output);
}

return $command->run($input, $this->output);
}







public function resetCodeBuffer()
{
$this->codeBuffer = [];
$this->code = false;
}









public function addInput($input, $silent = false)
{
foreach ((array) $input as $line) {
$this->inputBuffer[] = $silent ? new SilentInput($line) : $line;
}
}









public function flushCode()
{
if ($this->hasValidCode()) {
$this->addCodeBufferToHistory();
$code = $this->code;
$this->popCodeStack();

return $code;
}
}




private function popCodeStack()
{
$this->resetCodeBuffer();

if (empty($this->codeStack)) {
return;
}

list($codeBuffer, $codeBufferOpen, $code) = \array_pop($this->codeStack);

$this->codeBuffer = $codeBuffer;
$this->codeBufferOpen = $codeBufferOpen;
$this->code = $code;
}













private function addHistory($line)
{
if ($line instanceof SilentInput) {
return;
}


 if (\trim($line) !== '' && \substr($line, 0, 1) !== ' ') {
$this->readline->addHistory($line);
}
}




private function addCodeBufferToHistory()
{
$codeBuffer = \array_filter($this->codeBuffer, function ($line) {
return !$line instanceof SilentInput;
});

$this->addHistory(\implode("\n", $codeBuffer));
}








public function getNamespace()
{
if ($namespace = $this->cleaner->getNamespace()) {
return \implode('\\', $namespace);
}
}









public function writeStdout($out, $phase = PHP_OUTPUT_HANDLER_END)
{
$isCleaning = $phase & PHP_OUTPUT_HANDLER_CLEAN;


 if ($out !== '' && !$isCleaning) {
$this->output->write($out, false, OutputInterface::OUTPUT_RAW);
$this->outputWantsNewline = (\substr($out, -1) !== "\n");
$this->stdoutBuffer .= $out;
}


 if ($phase & PHP_OUTPUT_HANDLER_END) {

 if ($this->outputWantsNewline) {
$this->output->writeln(\sprintf('<aside>%s</aside>', $this->config->useUnicode() ? '⏎' : '\\n'));
$this->outputWantsNewline = false;
}


 if ($this->stdoutBuffer !== '') {
$this->context->setLastStdout($this->stdoutBuffer);
$this->stdoutBuffer = '';
}
}
}












public function writeReturnValue($ret, $rawOutput = false)
{
$this->lastExecSuccess = true;

if ($ret instanceof NoReturnValue) {
return;
}

$this->context->setReturnValue($ret);

if ($rawOutput) {
$formatted = \var_export($ret, true);
} else {
$indent = \str_repeat(' ', \strlen(static::RETVAL));
$formatted = $this->presentValue($ret);
$formatted = static::RETVAL . \str_replace(PHP_EOL, PHP_EOL . $indent, $formatted);
}

$this->output->writeln($formatted);
}











public function writeException(\Exception $e)
{
$this->lastExecSuccess = false;
$this->context->setLastException($e);
$this->output->writeln($this->formatException($e));
$this->resetCodeBuffer();
}








public function getLastExecSuccess()
{
return $this->lastExecSuccess;
}










public function formatException(\Exception $e)
{
$message = $e->getMessage();
if (!$e instanceof PsyException) {
if ($message === '') {
$message = \get_class($e);
} else {
$message = \sprintf('%s with message \'%s\'', \get_class($e), $message);
}
}

$message = \preg_replace(
"#(\\w:)?(/\\w+)*/src/Execution(?:Loop)?Closure.php\(\d+\) : eval\(\)'d code#",
"eval()'d code",
\str_replace('\\', '/', $message)
);

$message = \str_replace(" in eval()'d code", ' in Psy Shell code', $message);

$severity = ($e instanceof \ErrorException) ? $this->getSeverity($e) : 'error';

return \sprintf('<%s>%s</%s>', $severity, OutputFormatter::escape($message), $severity);
}








protected function getSeverity(\ErrorException $e)
{
$severity = $e->getSeverity();
if ($severity & \error_reporting()) {
switch ($severity) {
case E_WARNING:
case E_NOTICE:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
case E_USER_NOTICE:
case E_STRICT:
return 'warning';

default:
return 'error';
}
} else {

 return 'warning';
}
}









public function execute($code, $throwExceptions = false)
{
$this->setCode($code, true);
$closure = new ExecutionClosure($this);

if ($throwExceptions) {
return $closure->execute();
}

try {
return $closure->execute();
} catch (\TypeError $_e) {
$this->writeException(TypeErrorException::fromTypeError($_e));
} catch (\Error $_e) {
$this->writeException(ErrorException::fromError($_e));
} catch (\Exception $_e) {
$this->writeException($_e);
}
}


























public function handleError($errno, $errstr, $errfile, $errline)
{

 
 
 
 if ($errno & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR)) {
ErrorException::throwException($errno, $errstr, $errfile, $errline);
}


 if ($errno & \error_reporting() || $errno & $this->config->errorLoggingLevel()) {
$this->writeException(new ErrorException($errstr, 0, $errno, $errfile, $errline));
}
}










protected function presentValue($val)
{
return $this->config->getPresenter()->present($val);
}








protected function getCommand($input)
{
$input = new StringInput($input);
if ($name = $input->getFirstArgument()) {
return $this->get($name);
}
}








protected function hasCommand($input)
{
if (\preg_match('/([^\s]+?)(?:\s|$)/A', \ltrim($input), $match)) {
return $this->has($match[1]);
}

return false;
}






protected function getPrompt()
{
if ($this->output->isQuiet()) {
return null;
}

if ($this->hasCode()) {
return static::BUFF_PROMPT;
}

return $this->config->getPrompt() ?: static::PROMPT;
}














protected function readline($interactive = true)
{
if (!empty($this->inputBuffer)) {
$line = \array_shift($this->inputBuffer);
if (!$line instanceof SilentInput) {
$this->output->writeln(\sprintf('<aside>%s %s</aside>', static::REPLAY, OutputFormatter::escape($line)));
}

return $line;
}

$bracketedPaste = $interactive && $this->config->useBracketedPaste();

if ($bracketedPaste) {
\printf("\e[?2004h"); 
 }

$line = $this->readline->readline($this->getPrompt());

if ($bracketedPaste) {
\printf("\e[?2004l"); 
 }

return $line;
}






protected function getHeader()
{
return \sprintf('<aside>%s by Justin Hileman</aside>', $this->getVersion());
}






public function getVersion()
{
$separator = $this->config->useUnicode() ? '—' : '-';

return \sprintf('Psy Shell %s (PHP %s %s %s)', self::VERSION, PHP_VERSION, $separator, PHP_SAPI);
}






public function getManualDb()
{
return $this->config->getManualDb();
}




protected function autocomplete($text)
{
@\trigger_error('Tab completion is provided by the AutoCompleter service', E_USER_DEPRECATED);
}







protected function initializeTabCompletion()
{
if (!$this->config->useTabCompletion()) {
return;
}

$this->autoCompleter = $this->config->getAutoCompleter();


 
 $this->addMatchersToAutoCompleter($this->getDefaultMatchers());
$this->addMatchersToAutoCompleter($this->matchers);

$this->autoCompleter->activate();
}






private function addMatchersToAutoCompleter(array $matchers)
{
foreach ($matchers as $matcher) {
if ($matcher instanceof ContextAware) {
$matcher->setContext($this->context);
}
$this->autoCompleter->addMatcher($matcher);
}
}







protected function writeVersionInfo()
{
if (PHP_SAPI !== 'cli') {
return;
}

try {
$client = $this->config->getChecker();
if (!$client->isLatest()) {
$this->output->writeln(\sprintf('New version is available (current: %s, latest: %s)', self::VERSION, $client->getLatest()));
}
} catch (\InvalidArgumentException $e) {
$this->output->writeln($e->getMessage());
}
}




protected function writeStartupMessage()
{
$message = $this->config->getStartupMessage();
if ($message !== null && $message !== '') {
$this->output->writeln($message);
}
}
}
<?php










namespace Psy;





class Sudo
{








public static function fetchProperty($object, $property)
{
$refl = new \ReflectionObject($object);
$prop = $refl->getProperty($property);
$prop->setAccessible(true);

return $prop->getValue($object);
}










public static function assignProperty($object, $property, $value)
{
$refl = new \ReflectionObject($object);
$prop = $refl->getProperty($property);
$prop->setAccessible(true);
$prop->setValue($object, $value);

return $value;
}










public static function callMethod($object, $method, $args = null)
{
$args = \func_get_args();
$object = \array_shift($args);
$method = \array_shift($args);

$refl = new \ReflectionObject($object);
$reflMethod = $refl->getMethod($method);
$reflMethod->setAccessible(true);

return $reflMethod->invokeArgs($object, $args);
}









public static function fetchStaticProperty($class, $property)
{
$refl = new \ReflectionClass($class);
$prop = $refl->getProperty($property);
$prop->setAccessible(true);

return $prop->getValue();
}










public static function assignStaticProperty($class, $property, $value)
{
$refl = new \ReflectionClass($class);
$prop = $refl->getProperty($property);
$prop->setAccessible(true);
$prop->setValue($value);

return $value;
}










public static function callStatic($class, $method, $args = null)
{
$args = \func_get_args();
$class = \array_shift($args);
$method = \array_shift($args);

$refl = new \ReflectionClass($class);
$reflMethod = $refl->getMethod($method);
$reflMethod->setAccessible(true);

return $reflMethod->invokeArgs(null, $args);
}









public static function fetchClassConst($class, $const)
{
$refl = new \ReflectionClass($class);

return $refl->getConstant($const);
}
}
<?php










namespace Psy\VarDumper;





interface PresenterAware
{





public function setPresenter(Presenter $presenter);
}
<?php










namespace Psy\VarDumper;

use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\VarDumper\Cloner\Cursor;
use Symfony\Component\VarDumper\Dumper\CliDumper;




class Dumper extends CliDumper
{
private $formatter;
private $forceArrayIndexes;

protected static $onlyControlCharsRx = '/^[\x00-\x1F\x7F]+$/';
protected static $controlCharsRx = '/([\x00-\x1F\x7F]+)/';
protected static $controlCharsMap = [
"\0" => '\0',
"\t" => '\t',
"\n" => '\n',
"\v" => '\v',
"\f" => '\f',
"\r" => '\r',
"\033" => '\e',
];

public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false)
{
$this->formatter = $formatter;
$this->forceArrayIndexes = $forceArrayIndexes;
parent::__construct();
$this->setColors(false);
}




public function enterHash(Cursor $cursor, $type, $class, $hasChild)
{
if (Cursor::HASH_INDEXED === $type || Cursor::HASH_ASSOC === $type) {
$class = 0;
}
parent::enterHash($cursor, $type, $class, $hasChild);
}




protected function dumpKey(Cursor $cursor)
{
if ($this->forceArrayIndexes || Cursor::HASH_INDEXED !== $cursor->hashType) {
parent::dumpKey($cursor);
}
}

protected function style($style, $value, $attr = [])
{
if ('ref' === $style) {
$value = \strtr($value, '@', '#');
}

$styled = '';
$map = self::$controlCharsMap;
$cchr = $this->styles['cchr'];

$chunks = \preg_split(self::$controlCharsRx, $value, null, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
foreach ($chunks as $chunk) {
if (\preg_match(self::$onlyControlCharsRx, $chunk)) {
$chars = '';
$i = 0;
do {
$chars .= isset($map[$chunk[$i]]) ? $map[$chunk[$i]] : \sprintf('\x%02X', \ord($chunk[$i]));
} while (isset($chunk[++$i]));

$chars = $this->formatter->escape($chars);
$styled .= "<{$cchr}>{$chars}</{$cchr}>";
} else {
$styled .= $this->formatter->escape($chunk);
}
}

$style = $this->styles[$style];

return "<{$style}>{$styled}</{$style}>";
}




protected function dumpLine($depth, $endOfValue = false)
{
if ($endOfValue && 0 < $depth) {
$this->line .= ',';
}
$this->line = $this->formatter->format($this->line);
parent::dumpLine($depth, $endOfValue);
}
}
<?php










namespace Psy\VarDumper;

use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;
use Symfony\Component\VarDumper\Cloner\VarCloner;




class Cloner extends VarCloner
{
private $filter = 0;




public function cloneVar($var, $filter = 0)
{
$this->filter = $filter;

return parent::cloneVar($var, $filter);
}




protected function castResource(Stub $stub, $isNested)
{
return Caster::EXCLUDE_VERBOSE & $this->filter ? [] : parent::castResource($stub, $isNested);
}
}
<?php










namespace Psy\VarDumper;

use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Cloner\Stub;




class Presenter
{
const VERBOSE = 1;

private $cloner;
private $dumper;
private $exceptionsImportants = [
"\0*\0message",
"\0*\0code",
"\0*\0file",
"\0*\0line",
"\0Exception\0previous",
];
private $styles = [
'num' => 'number',
'const' => 'const',
'str' => 'string',
'cchr' => 'default',
'note' => 'class',
'ref' => 'default',
'public' => 'public',
'protected' => 'protected',
'private' => 'private',
'meta' => 'comment',
'key' => 'comment',
'index' => 'number',
];

public function __construct(OutputFormatter $formatter, $forceArrayIndexes = false)
{

 $oldLocale = \setlocale(LC_NUMERIC, 0);
\setlocale(LC_NUMERIC, 'C');

$this->dumper = new Dumper($formatter, $forceArrayIndexes);
$this->dumper->setStyles($this->styles);


 \setlocale(LC_NUMERIC, $oldLocale);

$this->cloner = new Cloner();
$this->cloner->addCasters(['*' => function ($obj, array $a, Stub $stub, $isNested, $filter = 0) {
if ($filter || $isNested) {
if ($obj instanceof \Exception) {
$a = Caster::filter($a, Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY, $this->exceptionsImportants);
} else {
$a = Caster::filter($a, Caster::EXCLUDE_PROTECTED | Caster::EXCLUDE_PRIVATE);
}
}

return $a;
}]);
}








public function addCasters(array $casters)
{
$this->cloner->addCasters($casters);
}








public function presentRef($value)
{
return $this->present($value, 0);
}












public function present($value, $depth = null, $options = 0)
{
$data = $this->cloner->cloneVar($value, !($options & self::VERBOSE) ? Caster::EXCLUDE_VERBOSE : 0);

if (null !== $depth) {
$data = $data->withMaxDepth($depth);
}


 $oldLocale = \setlocale(LC_NUMERIC, 0);
\setlocale(LC_NUMERIC, 'C');

$output = '';
$this->dumper->dump($data, function ($line, $depth) use (&$output) {
if ($depth >= 0) {
if ('' !== $output) {
$output .= PHP_EOL;
}
$output .= \str_repeat('  ', $depth) . $line;
}
});


 \setlocale(LC_NUMERIC, $oldLocale);

return OutputFormatter::escape($output);
}
}
<?php










namespace Psy;

use PhpParser\Lexer;
use PhpParser\Parser;
use PhpParser\ParserFactory as OriginalParserFactory;




class ParserFactory
{
const ONLY_PHP5 = 'ONLY_PHP5';
const ONLY_PHP7 = 'ONLY_PHP7';
const PREFER_PHP5 = 'PREFER_PHP5';
const PREFER_PHP7 = 'PREFER_PHP7';






public static function getPossibleKinds()
{
return ['ONLY_PHP5', 'ONLY_PHP7', 'PREFER_PHP5', 'PREFER_PHP7'];
}








public function hasKindsSupport()
{
return \class_exists('PhpParser\ParserFactory');
}






public function getDefaultKind()
{
if ($this->hasKindsSupport()) {
return \version_compare(PHP_VERSION, '7.0', '>=') ? static::ONLY_PHP7 : static::ONLY_PHP5;
}
}








public function createParser($kind = null)
{
if ($this->hasKindsSupport()) {
$originalFactory = new OriginalParserFactory();

$kind = $kind ?: $this->getDefaultKind();

if (!\in_array($kind, static::getPossibleKinds())) {
throw new \InvalidArgumentException('Unknown parser kind');
}

$parserClass = 'PhpParser\ParserFactory';

$parser = $originalFactory->create(\constant($parserClass . '::' . $kind));
} else {
if ($kind !== null) {
throw new \InvalidArgumentException('Install PHP Parser v2.x to specify parser kind');
}

$parser = new Parser(new Lexer());
}

return $parser;
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\Yield_;
use PhpParser\Node\FunctionLike;
use Psy\Exception\FatalErrorException;

class FunctionContextPass extends CodeCleanerPass
{

private $functionDepth;




public function beforeTraverse(array $nodes)
{
$this->functionDepth = 0;
}

public function enterNode(Node $node)
{
if ($node instanceof FunctionLike) {
$this->functionDepth++;

return;
}


 if ($this->functionDepth !== 0) {
return;
}


 if ($node instanceof Yield_) {
$msg = 'The "yield" expression can only be used inside a function';
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
}




public function leaveNode(Node $node)
{
if ($node instanceof FunctionLike) {
$this->functionDepth--;
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Namespace_;
use Psy\Exception\FatalErrorException;














class ValidConstructorPass extends CodeCleanerPass
{
private $namespace;

public function beforeTraverse(array $nodes)
{
$this->namespace = [];
}









public function enterNode(Node $node)
{
if ($node instanceof Namespace_) {
$this->namespace = isset($node->name) ? $node->name->parts : [];
} elseif ($node instanceof Class_) {
$constructor = null;
foreach ($node->stmts as $stmt) {
if ($stmt instanceof ClassMethod) {

 if ('__construct' === \strtolower($stmt->name)) {
$this->validateConstructor($stmt, $node);

return;
}


 if (empty($this->namespace) && \strtolower($node->name) === \strtolower($stmt->name)) {
$constructor = $stmt;
}
}
}

if ($constructor) {
$this->validateConstructor($constructor, $node);
}
}
}








private function validateConstructor(Node $constructor, Node $classNode)
{
if ($constructor->isStatic()) {

 $className = $classNode->name instanceof Identifier ? $classNode->name->toString() : $classNode->name;

$msg = \sprintf(
'Constructor %s::%s() cannot be static',
\implode('\\', \array_merge($this->namespace, (array) $className)),
$constructor->name
);
throw new FatalErrorException($msg, 0, E_ERROR, null, $classNode->getLine());
}

if (\method_exists($constructor, 'getReturnType') && $constructor->getReturnType()) {

 $className = $classNode->name instanceof Identifier ? $classNode->name->toString() : $classNode->name;

$msg = \sprintf(
'Constructor %s::%s() cannot declare a return type',
\implode('\\', \array_merge($this->namespace, (array) $className)),
$constructor->name
);
throw new FatalErrorException($msg, 0, E_ERROR, null, $classNode->getLine());
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\Instanceof_;
use PhpParser\Node\Scalar;
use PhpParser\Node\Scalar\Encapsed;
use Psy\Exception\FatalErrorException;






class InstanceOfPass extends CodeCleanerPass
{
const EXCEPTION_MSG = 'instanceof expects an object instance, constant given';








public function enterNode(Node $node)
{
if (!$node instanceof Instanceof_) {
return;
}

if (($node->expr instanceof Scalar && !$node->expr instanceof Encapsed) ||
$node->expr instanceof BinaryOp ||
$node->expr instanceof Array_ ||
$node->expr instanceof ConstFetch ||
$node->expr instanceof ClassConstFetch
) {
throw new FatalErrorException(self::EXCEPTION_MSG, 0, E_ERROR, null, $node->getLine());
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Isset_;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Stmt\Unset_;
use Psy\Exception\FatalErrorException;






class FunctionReturnInWriteContextPass extends CodeCleanerPass
{
const ISSET_MESSAGE = 'Cannot use isset() on the result of an expression (you can use "null !== expression" instead)';
const EXCEPTION_MESSAGE = "Can't use function return value in write context";










public function enterNode(Node $node)
{
if ($node instanceof Array_ || $this->isCallNode($node)) {
$items = $node instanceof Array_ ? $node->items : $node->args;
foreach ($items as $item) {
if ($item && $item->byRef && $this->isCallNode($item->value)) {
throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
}
}
} elseif ($node instanceof Isset_ || $node instanceof Unset_) {
foreach ($node->vars as $var) {
if (!$this->isCallNode($var)) {
continue;
}

$msg = $node instanceof Isset_ ? self::ISSET_MESSAGE : self::EXCEPTION_MESSAGE;
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
} elseif ($node instanceof Assign && $this->isCallNode($node->var)) {
throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
}
}

private function isCallNode(Node $node)
{
return $node instanceof FuncCall || $node instanceof MethodCall || $node instanceof StaticCall;
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Stmt\GroupUse;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Use_;
use PhpParser\Node\Stmt\UseUse;
use PhpParser\NodeTraverser;











class UseStatementPass extends CodeCleanerPass
{
private $aliases = [];
private $lastAliases = [];
private $lastNamespace = null;










public function enterNode(Node $node)
{
if ($node instanceof Namespace_) {

 
 if (\strtolower($node->name) === \strtolower($this->lastNamespace)) {
$this->aliases = $this->lastAliases;
}
}
}









public function leaveNode(Node $node)
{

 if ($node instanceof Use_) {
foreach ($node->uses as $use) {
$alias = $use->alias ?: \end($use->name->parts);
$this->aliases[\strtolower($alias)] = $use->name;
}

return NodeTraverser::REMOVE_NODE;
}


 if ($node instanceof GroupUse) {
foreach ($node->uses as $use) {
$alias = $use->alias ?: \end($use->name->parts);
$this->aliases[\strtolower($alias)] = Name::concat($node->prefix, $use->name, [
'startLine' => $node->prefix->getAttribute('startLine'),
'endLine' => $use->name->getAttribute('endLine'),
]);
}

return NodeTraverser::REMOVE_NODE;
}


 if ($node instanceof Namespace_) {
$this->lastNamespace = $node->name;
$this->lastAliases = $this->aliases;
$this->aliases = [];

return;
}


 if ($node instanceof UseUse) {
return;
}


 foreach ($node as $name => $subNode) {
if ($subNode instanceof Name) {
if ($replacement = $this->findAlias($subNode)) {
$node->$name = $replacement;
}
}
}

return $node;
}








private function findAlias(Name $name)
{
$that = \strtolower($name);
foreach ($this->aliases as $alias => $prefix) {
if ($that === $alias) {
return new FullyQualifiedName($prefix->toString());
} elseif (\substr($that, 0, \strlen($alias) + 1) === $alias . '\\') {
return new FullyQualifiedName($prefix->toString() . \substr($name, \strlen($alias)));
}
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt\Do_;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Switch_;
use PhpParser\Node\Stmt\While_;
use Psy\Exception\FatalErrorException;







class ValidFunctionNamePass extends NamespaceAwarePass
{
private $conditionalScopes = 0;






public function enterNode(Node $node)
{
parent::enterNode($node);

if (self::isConditional($node)) {
$this->conditionalScopes++;
} elseif ($node instanceof Function_) {
$name = $this->getFullyQualifiedName($node->name);


 
 if ($this->conditionalScopes === 0) {
if (\function_exists($name) ||
isset($this->currentScope[\strtolower($name)])) {
$msg = \sprintf('Cannot redeclare %s()', $name);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
}

$this->currentScope[\strtolower($name)] = true;
}
}









public function leaveNode(Node $node)
{
if (self::isConditional($node)) {
$this->conditionalScopes--;
} elseif ($node instanceof FuncCall) {

 $name = $node->name;
if (!$name instanceof Expr && !$name instanceof Variable) {
$shortName = \implode('\\', $name->parts);
$fullName = $this->getFullyQualifiedName($name);
$inScope = isset($this->currentScope[\strtolower($fullName)]);
if (!$inScope && !\function_exists($shortName) && !\function_exists($fullName)) {
$message = \sprintf('Call to undefined function %s()', $name);
throw new FatalErrorException($message, 0, E_ERROR, null, $node->getLine());
}
}
}
}

private static function isConditional(Node $node)
{
return $node instanceof If_ ||
$node instanceof While_ ||
$node instanceof Do_ ||
$node instanceof Switch_;
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\Assign;
use Psy\Exception\FatalErrorException;




class EmptyArrayDimFetchPass extends CodeCleanerPass
{
const EXCEPTION_MESSAGE = 'Cannot use [] for reading';

private $theseOnesAreFine = [];

public function beforeTraverse(array $nodes)
{
$this->theseOnesAreFine = [];
}






public function enterNode(Node $node)
{
if ($node instanceof Assign && $node->var instanceof ArrayDimFetch) {
$this->theseOnesAreFine[] = $node->var;
}

if ($node instanceof ArrayDimFetch && $node->dim === null) {
if (!\in_array($node, $this->theseOnesAreFine)) {
throw new FatalErrorException(self::EXCEPTION_MESSAGE, $node->getLine());
}
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use Psy\Exception\FatalErrorException;




class FinalClassPass extends CodeCleanerPass
{
private $finalClasses;




public function beforeTraverse(array $nodes)
{
$this->finalClasses = [];
}






public function enterNode(Node $node)
{
if ($node instanceof Class_) {
if ($node->extends) {
$extends = (string) $node->extends;
if ($this->isFinalClass($extends)) {
$msg = \sprintf('Class %s may not inherit from final class (%s)', $node->name, $extends);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
}

if ($node->isFinal()) {
$this->finalClasses[\strtolower($node->name)] = true;
}
}
}






private function isFinalClass($name)
{
if (!\class_exists($name)) {
return isset($this->finalClasses[\strtolower($name)]);
}

$refl = new \ReflectionClass($name);

return $refl->isFinal();
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Stmt\Goto_;
use PhpParser\Node\Stmt\Label;
use Psy\Exception\FatalErrorException;













class LabelContextPass extends CodeCleanerPass
{

private $functionDepth;


private $labelDeclarations;

private $labelGotos;




public function beforeTraverse(array $nodes)
{
$this->functionDepth = 0;
$this->labelDeclarations = [];
$this->labelGotos = [];
}

public function enterNode(Node $node)
{
if ($node instanceof FunctionLike) {
$this->functionDepth++;

return;
}


 if ($this->functionDepth !== 0) {
return;
}

if ($node instanceof Goto_) {
$this->labelGotos[\strtolower($node->name)] = $node->getLine();
} elseif ($node instanceof Label) {
$this->labelDeclarations[\strtolower($node->name)] = $node->getLine();
}
}




public function leaveNode(Node $node)
{
if ($node instanceof FunctionLike) {
$this->functionDepth--;
}
}

public function afterTraverse(array $nodes)
{
foreach ($this->labelGotos as $name => $line) {
if (!isset($this->labelDeclarations[$name])) {
$msg = "'goto' to undefined label '{$name}'";
throw new FatalErrorException($msg, 0, E_ERROR, null, $line);
}
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Scalar\DNumber;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Stmt\Break_;
use PhpParser\Node\Stmt\Continue_;
use PhpParser\Node\Stmt\Do_;
use PhpParser\Node\Stmt\For_;
use PhpParser\Node\Stmt\Foreach_;
use PhpParser\Node\Stmt\Switch_;
use PhpParser\Node\Stmt\While_;
use Psy\Exception\FatalErrorException;




class LoopContextPass extends CodeCleanerPass
{
private $loopDepth;




public function beforeTraverse(array $nodes)
{
$this->loopDepth = 0;
}









public function enterNode(Node $node)
{
switch (true) {
case $node instanceof Do_:
case $node instanceof For_:
case $node instanceof Foreach_:
case $node instanceof Switch_:
case $node instanceof While_:
$this->loopDepth++;
break;

case $node instanceof Break_:
case $node instanceof Continue_:
$operator = $node instanceof Break_ ? 'break' : 'continue';

if ($this->loopDepth === 0) {
$msg = \sprintf("'%s' not in the 'loop' or 'switch' context", $operator);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}

if ($node->num instanceof LNumber || $node->num instanceof DNumber) {
$num = $node->num->value;
if ($node->num instanceof DNumber || $num < 1) {
$msg = \sprintf("'%s' operator accepts only positive numbers", $operator);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}

if ($num > $this->loopDepth) {
$msg = \sprintf("Cannot '%s' %d levels", $operator, $num);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
} elseif ($node->num) {
$msg = \sprintf("'%s' operator with non-constant operand is no longer supported", $operator);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
break;
}
}




public function leaveNode(Node $node)
{
switch (true) {
case $node instanceof Do_:
case $node instanceof For_:
case $node instanceof Foreach_:
case $node instanceof Switch_:
case $node instanceof While_:
$this->loopDepth--;
break;
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\StaticCall;
use Psy\Exception\FatalErrorException;








class CallTimePassByReferencePass extends CodeCleanerPass
{
const EXCEPTION_MESSAGE = 'Call-time pass-by-reference has been removed';








public function enterNode(Node $node)
{
if (!$node instanceof FuncCall && !$node instanceof MethodCall && !$node instanceof StaticCall) {
return;
}

foreach ($node->args as $arg) {
if ($arg->byRef) {
throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
}
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\List_;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\Variable;
use Psy\Exception\ParseErrorException;




class ListPass extends CodeCleanerPass
{
private $atLeastPhp71;

public function __construct()
{
$this->atLeastPhp71 = \version_compare(PHP_VERSION, '7.1', '>=');
}








public function enterNode(Node $node)
{
if (!$node instanceof Assign) {
return;
}

if (!$node->var instanceof Array_ && !$node->var instanceof List_) {
return;
}

if (!$this->atLeastPhp71 && $node->var instanceof Array_) {
$msg = "syntax error, unexpected '='";
throw new ParseErrorException($msg, $node->expr->getLine());
}


 $items = isset($node->var->items) ? $node->var->items : $node->var->vars;

if ($items === [] || $items === [null]) {
throw new ParseErrorException('Cannot use empty list', $node->var->getLine());
}

$itemFound = false;
foreach ($items as $item) {
if ($item === null) {
continue;
}

$itemFound = true;


 if (!$this->atLeastPhp71 && $item instanceof ArrayItem && $item->key !== null) {
$msg = 'Syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting \',\' or \')\'';
throw new ParseErrorException($msg, $item->key->getLine());
}

if (!self::isValidArrayItem($item)) {
$msg = 'Assignments can only happen to writable values';
throw new ParseErrorException($msg, $item->getLine());
}
}

if (!$itemFound) {
throw new ParseErrorException('Cannot use empty list');
}
}








private static function isValidArrayItem(Expr $item)
{
$value = ($item instanceof ArrayItem) ? $item->value : $item;

while ($value instanceof ArrayDimFetch || $value instanceof PropertyFetch) {
$value = $value->var;
}


 
 return $value instanceof Variable || $value instanceof MethodCall || $value instanceof FuncCall;
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Do_;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Interface_;
use PhpParser\Node\Stmt\Switch_;
use PhpParser\Node\Stmt\Trait_;
use PhpParser\Node\Stmt\While_;
use Psy\Exception\FatalErrorException;







class ValidClassNamePass extends NamespaceAwarePass
{
const CLASS_TYPE = 'class';
const INTERFACE_TYPE = 'interface';
const TRAIT_TYPE = 'trait';

private $conditionalScopes = 0;










public function enterNode(Node $node)
{
parent::enterNode($node);

if (self::isConditional($node)) {
$this->conditionalScopes++;
} else {

 
 if ($this->conditionalScopes === 0) {
if ($node instanceof Class_) {
$this->validateClassStatement($node);
} elseif ($node instanceof Interface_) {
$this->validateInterfaceStatement($node);
} elseif ($node instanceof Trait_) {
$this->validateTraitStatement($node);
}
}
}
}












public function leaveNode(Node $node)
{
if (self::isConditional($node)) {
$this->conditionalScopes--;
} elseif ($node instanceof New_) {
$this->validateNewExpression($node);
} elseif ($node instanceof ClassConstFetch) {
$this->validateClassConstFetchExpression($node);
} elseif ($node instanceof StaticCall) {
$this->validateStaticCallExpression($node);
}
}

private static function isConditional(Node $node)
{
return $node instanceof If_ ||
$node instanceof While_ ||
$node instanceof Do_ ||
$node instanceof Switch_;
}






protected function validateClassStatement(Class_ $stmt)
{
$this->ensureCanDefine($stmt, self::CLASS_TYPE);
if (isset($stmt->extends)) {
$this->ensureClassExists($this->getFullyQualifiedName($stmt->extends), $stmt);
}
$this->ensureInterfacesExist($stmt->implements, $stmt);
}






protected function validateInterfaceStatement(Interface_ $stmt)
{
$this->ensureCanDefine($stmt, self::INTERFACE_TYPE);
$this->ensureInterfacesExist($stmt->extends, $stmt);
}






protected function validateTraitStatement(Trait_ $stmt)
{
$this->ensureCanDefine($stmt, self::TRAIT_TYPE);
}






protected function validateNewExpression(New_ $stmt)
{

 if (!$stmt->class instanceof Expr && !$stmt->class instanceof Class_) {
$this->ensureClassExists($this->getFullyQualifiedName($stmt->class), $stmt);
}
}






protected function validateClassConstFetchExpression(ClassConstFetch $stmt)
{

 if (\strtolower($stmt->name) === 'class') {
return;
}


 if (!$stmt->class instanceof Expr) {
$this->ensureClassOrInterfaceExists($this->getFullyQualifiedName($stmt->class), $stmt);
}
}






protected function validateStaticCallExpression(StaticCall $stmt)
{

 if (!$stmt->class instanceof Expr) {
$this->ensureMethodExists($this->getFullyQualifiedName($stmt->class), $stmt->name, $stmt);
}
}









protected function ensureCanDefine(Stmt $stmt, $scopeType = self::CLASS_TYPE)
{
$name = $this->getFullyQualifiedName($stmt->name);


 $errorType = null;
if ($this->classExists($name)) {
$errorType = self::CLASS_TYPE;
} elseif ($this->interfaceExists($name)) {
$errorType = self::INTERFACE_TYPE;
} elseif ($this->traitExists($name)) {
$errorType = self::TRAIT_TYPE;
}

if ($errorType !== null) {
throw $this->createError(\sprintf('%s named %s already exists', \ucfirst($errorType), $name), $stmt);
}


 
 $this->currentScope[\strtolower($name)] = $scopeType;
}









protected function ensureClassExists($name, $stmt)
{
if (!$this->classExists($name)) {
throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt);
}
}









protected function ensureClassOrInterfaceExists($name, $stmt)
{
if (!$this->classExists($name) && !$this->interfaceExists($name)) {
throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt);
}
}









protected function ensureClassOrTraitExists($name, $stmt)
{
if (!$this->classExists($name) && !$this->traitExists($name)) {
throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt);
}
}










protected function ensureMethodExists($class, $name, $stmt)
{
$this->ensureClassOrTraitExists($class, $stmt);


 if (\in_array(\strtolower($class), ['self', 'parent', 'static'])) {
return;
}


 if ($this->findInScope($class) === self::CLASS_TYPE) {
return;
}


 if ($name instanceof Expr) {
return;
}

if (!\method_exists($class, $name) && !\method_exists($class, '__callStatic')) {
throw $this->createError(\sprintf('Call to undefined method %s::%s()', $class, $name), $stmt);
}
}









protected function ensureInterfacesExist($interfaces, $stmt)
{
foreach ($interfaces as $interface) {

$name = $this->getFullyQualifiedName($interface);
if (!$this->interfaceExists($name)) {
throw $this->createError(\sprintf('Interface \'%s\' not found', $name), $stmt);
}
}
}











protected function getScopeType(Stmt $stmt)
{
if ($stmt instanceof Class_) {
return self::CLASS_TYPE;
} elseif ($stmt instanceof Interface_) {
return self::INTERFACE_TYPE;
} elseif ($stmt instanceof Trait_) {
return self::TRAIT_TYPE;
}
}










protected function classExists($name)
{

 
 
 if (\in_array(\strtolower($name), ['self', 'static', 'parent'])) {
return true;
}

return \class_exists($name) || $this->findInScope($name) === self::CLASS_TYPE;
}








protected function interfaceExists($name)
{
return \interface_exists($name) || $this->findInScope($name) === self::INTERFACE_TYPE;
}








protected function traitExists($name)
{
return \trait_exists($name) || $this->findInScope($name) === self::TRAIT_TYPE;
}








protected function findInScope($name)
{
$name = \strtolower($name);
if (isset($this->currentScope[$name])) {
return $this->currentScope[$name];
}
}









protected function createError($msg, $stmt)
{
return new FatalErrorException($msg, 0, E_ERROR, null, $stmt->getLine());
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Namespace_;
use Psy\CodeCleaner;












class NamespacePass extends CodeCleanerPass
{
private $namespace = null;
private $cleaner;




public function __construct(CodeCleaner $cleaner)
{
$this->cleaner = $cleaner;
}









public function beforeTraverse(array $nodes)
{
if (empty($nodes)) {
return $nodes;
}

$last = \end($nodes);

if ($last instanceof Namespace_) {
$kind = $last->getAttribute('kind');


 
 if ($kind === null || $kind === Namespace_::KIND_SEMICOLON) {

 $this->setNamespace($last->name);
} else {

 $this->setNamespace(null);
}

return $nodes;
}

return $this->namespace ? [new Namespace_($this->namespace, $nodes)] : $nodes;
}







private function setNamespace($namespace)
{
$this->namespace = $namespace;
$this->cleaner->setNamespace($namespace === null ? null : $namespace->parts);
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node\Identifier;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Stmt\Declare_;
use PhpParser\Node\Stmt\DeclareDeclare;
use Psy\Exception\FatalErrorException;











class StrictTypesPass extends CodeCleanerPass
{
const EXCEPTION_MESSAGE = 'strict_types declaration must have 0 or 1 as its value';

private $strictTypes = false;
private $atLeastPhp7;

public function __construct()
{
$this->atLeastPhp7 = \version_compare(PHP_VERSION, '7.0', '>=');
}











public function beforeTraverse(array $nodes)
{
if (!$this->atLeastPhp7) {
return; 
 }

$prependStrictTypes = $this->strictTypes;

foreach ($nodes as $key => $node) {
if ($node instanceof Declare_) {
foreach ($node->declares as $declare) {

 $declareKey = $declare->key instanceof Identifier ? $declare->key->toString() : $declare->key;
if ($declareKey === 'strict_types') {
$value = $declare->value;
if (!$value instanceof LNumber || ($value->value !== 0 && $value->value !== 1)) {
throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
}

$this->strictTypes = $value->value === 1;
}
}
}
}

if ($prependStrictTypes) {
$first = \reset($nodes);
if (!$first instanceof Declare_) {
$declare = new Declare_([new DeclareDeclare('strict_types', new LNumber(1))]);
\array_unshift($nodes, $declare);
}
}

return $nodes;
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\Trait_;
use Psy\Exception\ErrorException;





class CalledClassPass extends CodeCleanerPass
{
private $inClass;




public function beforeTraverse(array $nodes)
{
$this->inClass = false;
}






public function enterNode(Node $node)
{
if ($node instanceof Class_ || $node instanceof Trait_) {
$this->inClass = true;
} elseif ($node instanceof FuncCall && !$this->inClass) {

 
 
 
 if (!empty($node->args) && !$this->isNull($node->args[0])) {
return;
}


 if (!($node->name instanceof Name)) {
return;
}

$name = \strtolower($node->name);
if (\in_array($name, ['get_class', 'get_called_class'])) {
$msg = \sprintf('%s() called without object from outside a class', $name);
throw new ErrorException($msg, 0, E_USER_WARNING, null, $node->getLine());
}
}
}




public function leaveNode(Node $node)
{
if ($node instanceof Class_) {
$this->inClass = false;
}
}

private function isNull(Node $node)
{
return $node->value instanceof ConstFetch && \strtolower($node->value->name) === 'null';
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node\Expr\New_;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;








class NoReturnValue
{





public static function create()
{
return new New_(new FullyQualifiedName('Psy\CodeCleaner\NoReturnValue'));
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Name;
use PhpParser\Node\Scalar\MagicConst\Dir;
use PhpParser\Node\Scalar\MagicConst\File;
use PhpParser\Node\Scalar\String_;




class MagicConstantsPass extends CodeCleanerPass
{








public function enterNode(Node $node)
{
if ($node instanceof Dir) {
return new FuncCall(new Name('getcwd'), [], $node->getAttributes());
} elseif ($node instanceof File) {
return new String_('', $node->getAttributes());
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use Psy\Exception\FatalErrorException;




class AbstractClassPass extends CodeCleanerPass
{
private $class;
private $abstractMethods;






public function enterNode(Node $node)
{
if ($node instanceof Class_) {
$this->class = $node;
$this->abstractMethods = [];
} elseif ($node instanceof ClassMethod) {
if ($node->isAbstract()) {
$name = \sprintf('%s::%s', $this->class->name, $node->name);
$this->abstractMethods[] = $name;

if ($node->stmts !== null) {
$msg = \sprintf('Abstract function %s cannot contain body', $name);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
}
}
}






public function leaveNode(Node $node)
{
if ($node instanceof Class_) {
$count = \count($this->abstractMethods);
if ($count > 0 && !$node->isAbstract()) {
$msg = \sprintf(
'Class %s contains %d abstract method%s must therefore be declared abstract or implement the remaining methods (%s)',
$node->name,
$count,
($count === 1) ? '' : 's',
\implode(', ', $this->abstractMethods)
);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\Exit_;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;

class ExitPass extends CodeCleanerPass
{





public function leaveNode(Node $node)
{
if ($node instanceof Exit_) {
return new StaticCall(new FullyQualifiedName('Psy\Exception\BreakException'), 'exitShell');
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\Variable;
use Psy\Exception\FatalErrorException;




class PassableByReferencePass extends CodeCleanerPass
{
const EXCEPTION_MESSAGE = 'Only variables can be passed by reference';






public function enterNode(Node $node)
{

 if ($node instanceof FuncCall) {

 if ($node->name instanceof Expr || $node->name instanceof Variable) {
return;
}

$name = (string) $node->name;

if ($name === 'array_multisort') {
return $this->validateArrayMultisort($node);
}

try {
$refl = new \ReflectionFunction($name);
} catch (\ReflectionException $e) {

 return;
}

foreach ($refl->getParameters() as $key => $param) {
if (\array_key_exists($key, $node->args)) {
$arg = $node->args[$key];
if ($param->isPassedByReference() && !$this->isPassableByReference($arg)) {
throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
}
}
}
}
}

private function isPassableByReference(Node $arg)
{

 if ($arg->value instanceof Array_) {
return $arg->unpack;
}


 
 return $arg->value instanceof ClassConstFetch ||
$arg->value instanceof PropertyFetch ||
$arg->value instanceof Variable ||
$arg->value instanceof FuncCall ||
$arg->value instanceof MethodCall ||
$arg->value instanceof StaticCall;
}
















private function validateArrayMultisort(Node $node)
{
$nonPassable = 2; 
 foreach ($node->args as $arg) {
if ($this->isPassableByReference($arg)) {
$nonPassable = 0;
} elseif (++$nonPassable > 2) {

 
 throw new FatalErrorException(self::EXCEPTION_MESSAGE, 0, E_ERROR, null, $node->getLine());
}
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\Variable;
use Psy\Exception\FatalErrorException;






class AssignThisVariablePass extends CodeCleanerPass
{







public function enterNode(Node $node)
{
if ($node instanceof Assign && $node->var instanceof Variable && $node->var->name === 'this') {
throw new FatalErrorException('Cannot re-assign $this', 0, E_ERROR, null, $node->getLine());
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Stmt\Namespace_;




abstract class NamespaceAwarePass extends CodeCleanerPass
{
protected $namespace;
protected $currentScope;







public function beforeTraverse(array $nodes)
{
$this->namespace = [];
$this->currentScope = [];
}







public function enterNode(Node $node)
{
if ($node instanceof Namespace_) {
$this->namespace = isset($node->name) ? $node->name->parts : [];
}
}








protected function getFullyQualifiedName($name)
{
if ($name instanceof FullyQualifiedName) {
return \implode('\\', $name->parts);
} elseif ($name instanceof Name) {
$name = $name->parts;
} elseif (!\is_array($name)) {
$name = [$name];
}

return \implode('\\', \array_merge($this->namespace, $name));
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\NodeVisitorAbstract;




abstract class CodeCleanerPass extends NodeVisitorAbstract
{

}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr\Variable;
use Psy\Exception\RuntimeException;




class LeavePsyshAlonePass extends CodeCleanerPass
{







public function enterNode(Node $node)
{
if ($node instanceof Variable && $node->name === '__psysh__') {
throw new RuntimeException('Don\'t mess with $__psysh__; bad things will happen');
}
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Exit_;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Break_;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Return_;
use PhpParser\Node\Stmt\Switch_;




class ImplicitReturnPass extends CodeCleanerPass
{





public function beforeTraverse(array $nodes)
{
return $this->addImplicitReturn($nodes);
}






private function addImplicitReturn(array $nodes)
{

 if (empty($nodes)) {
return [new Return_(NoReturnValue::create())];
}

$last = \end($nodes);


 
 
 
 if ($last instanceof If_) {
$last->stmts = $this->addImplicitReturn($last->stmts);

foreach ($last->elseifs as $elseif) {
$elseif->stmts = $this->addImplicitReturn($elseif->stmts);
}

if ($last->else) {
$last->else->stmts = $this->addImplicitReturn($last->else->stmts);
}
} elseif ($last instanceof Switch_) {
foreach ($last->cases as $case) {

 $caseLast = \end($case->stmts);
if ($caseLast instanceof Break_) {
$case->stmts = $this->addImplicitReturn(\array_slice($case->stmts, 0, -1));
$case->stmts[] = $caseLast;
}
}
} elseif ($last instanceof Expr && !($last instanceof Exit_)) {

 $nodes[\count($nodes) - 1] = new Return_($last, [
'startLine' => $last->getLine(),
'endLine' => $last->getLine(),
]);

 } elseif ($last instanceof Expression && !($last->expr instanceof Exit_)) {

 $nodes[\count($nodes) - 1] = new Return_($last->expr, [
'startLine' => $last->getLine(),
'endLine' => $last->getLine(),
]);
} elseif ($last instanceof Namespace_) {
$last->stmts = $this->addImplicitReturn($last->stmts);
}


 
 
 
 
 
 
 
 
 
 if (self::isNonExpressionStmt($last)) {
$nodes[] = new Return_(NoReturnValue::create());
}

return $nodes;
}











private static function isNonExpressionStmt(Node $node)
{
return $node instanceof Stmt &&
!$node instanceof Expression &&
!$node instanceof Return_ &&
!$node instanceof Namespace_;
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\Include_;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Scalar\LNumber;
use Psy\Exception\ErrorException;
use Psy\Exception\FatalErrorException;
use Psy\Shell;




class RequirePass extends CodeCleanerPass
{
private static $requireTypes = [Include_::TYPE_REQUIRE, Include_::TYPE_REQUIRE_ONCE];




public function enterNode(Node $origNode)
{
if (!$this->isRequireNode($origNode)) {
return;
}

$node = clone $origNode;










$node->expr = new StaticCall(
new FullyQualifiedName('Psy\CodeCleaner\RequirePass'),
'resolve',
[new Arg($origNode->expr), new Arg(new LNumber($origNode->getLine()))],
$origNode->getAttributes()
);

return $node;
}














public static function resolve($file, $lineNumber = null)
{
$file = (string) $file;

if ($file === '') {

 
 
 if (E_WARNING & \error_reporting()) {
ErrorException::throwException(E_WARNING, 'Filename cannot be empty', null, $lineNumber);
}

 
 }

if ($file === '' || !\stream_resolve_include_path($file)) {
$msg = \sprintf("Failed opening required '%s'", $file);
throw new FatalErrorException($msg, 0, E_ERROR, null, $lineNumber);
}

return $file;
}

private function isRequireNode(Node $node)
{
return $node instanceof Include_ && \in_array($node->type, self::$requireTypes);
}
}
<?php










namespace Psy\CodeCleaner;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Identifier;
use Psy\Exception\FatalErrorException;












class ValidConstantPass extends NamespaceAwarePass
{










public function leaveNode(Node $node)
{
if ($node instanceof ConstFetch && \count($node->name->parts) > 1) {
$name = $this->getFullyQualifiedName($node->name);
if (!\defined($name)) {
$msg = \sprintf('Undefined constant %s', $name);
throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
}
} elseif ($node instanceof ClassConstFetch) {
$this->validateClassConstFetchExpression($node);
}
}








protected function validateClassConstFetchExpression(ClassConstFetch $stmt)
{

 $constName = $stmt->name instanceof Identifier ? $stmt->name->toString() : $stmt->name;


 if ($constName === 'class') {
return;
}


 if (!$stmt->class instanceof Expr) {
$className = $this->getFullyQualifiedName($stmt->class);


 
 if (\class_exists($className) || \interface_exists($className)) {
$refl = new \ReflectionClass($className);
if (!$refl->hasConstant($constName)) {
$constType = \class_exists($className) ? 'Class' : 'Interface';
$msg = \sprintf('%s constant \'%s::%s\' not found', $constType, $className, $constName);
throw new FatalErrorException($msg, 0, E_ERROR, null, $stmt->getLine());
}
}
}
}
}
<?php










namespace Psy\Output;

use Symfony\Component\Console\Output\OutputInterface;





interface OutputPager extends OutputInterface
{



public function close();
}
<?php










namespace Psy\Output;

use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Output\ConsoleOutput;




class ShellOutput extends ConsoleOutput
{
const NUMBER_LINES = 128;

private $paging = 0;
private $pager;









public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null, $pager = null)
{
parent::__construct($verbosity, $decorated, $formatter);

$this->initFormatters();

if ($pager === null) {
$this->pager = new PassthruPager($this);
} elseif (\is_string($pager)) {
$this->pager = new ProcOutputPager($this, $pager);
} elseif ($pager instanceof OutputPager) {
$this->pager = $pager;
} else {
throw new \InvalidArgumentException('Unexpected pager parameter: ' . $pager);
}
}














public function page($messages, $type = 0)
{
if (\is_string($messages)) {
$messages = (array) $messages;
}

if (!\is_array($messages) && !\is_callable($messages)) {
throw new \InvalidArgumentException('Paged output requires a string, array or callback');
}

$this->startPaging();

if (\is_callable($messages)) {
$messages($this);
} else {
$this->write($messages, true, $type);
}

$this->stopPaging();
}




public function startPaging()
{
$this->paging++;
}




public function stopPaging()
{
$this->paging--;
$this->closePager();
}













public function write($messages, $newline = false, $type = 0)
{
if ($this->getVerbosity() === self::VERBOSITY_QUIET) {
return;
}

$messages = (array) $messages;

if ($type & self::NUMBER_LINES) {
$pad = \strlen((string) \count($messages));
$template = $this->isDecorated() ? "<aside>%{$pad}s</aside>: %s" : "%{$pad}s: %s";

if ($type & self::OUTPUT_RAW) {
$messages = \array_map(['Symfony\Component\Console\Formatter\OutputFormatter', 'escape'], $messages);
}

foreach ($messages as $i => $line) {
$messages[$i] = \sprintf($template, $i, $line);
}


 $type = $type & ~self::NUMBER_LINES & ~self::OUTPUT_RAW;
}

parent::write($messages, $newline, $type);
}









public function doWrite($message, $newline)
{
if ($this->paging > 0) {
$this->pager->doWrite($message, $newline);
} else {
parent::doWrite($message, $newline);
}
}




private function closePager()
{
if ($this->paging <= 0) {
$this->pager->close();
}
}




private function initFormatters()
{
$formatter = $this->getFormatter();

$formatter->setStyle('warning', new OutputFormatterStyle('black', 'yellow'));
$formatter->setStyle('error', new OutputFormatterStyle('white', 'red', ['bold']));
$formatter->setStyle('aside', new OutputFormatterStyle('blue'));
$formatter->setStyle('strong', new OutputFormatterStyle(null, null, ['bold']));
$formatter->setStyle('return', new OutputFormatterStyle('cyan'));
$formatter->setStyle('urgent', new OutputFormatterStyle('red'));
$formatter->setStyle('hidden', new OutputFormatterStyle('black'));


 $formatter->setStyle('public', new OutputFormatterStyle(null, null, ['bold']));
$formatter->setStyle('protected', new OutputFormatterStyle('yellow'));
$formatter->setStyle('private', new OutputFormatterStyle('red'));
$formatter->setStyle('global', new OutputFormatterStyle('cyan', null, ['bold']));
$formatter->setStyle('const', new OutputFormatterStyle('cyan'));
$formatter->setStyle('class', new OutputFormatterStyle('blue', null, ['underscore']));
$formatter->setStyle('function', new OutputFormatterStyle(null));
$formatter->setStyle('default', new OutputFormatterStyle(null));


 $formatter->setStyle('number', new OutputFormatterStyle('magenta'));
$formatter->setStyle('string', new OutputFormatterStyle('green'));
$formatter->setStyle('bool', new OutputFormatterStyle('cyan'));
$formatter->setStyle('keyword', new OutputFormatterStyle('yellow'));
$formatter->setStyle('comment', new OutputFormatterStyle('blue'));
$formatter->setStyle('object', new OutputFormatterStyle('blue'));
$formatter->setStyle('resource', new OutputFormatterStyle('yellow'));
}
}
<?php










namespace Psy\Output;

use Symfony\Component\Console\Output\StreamOutput;





class PassthruPager extends StreamOutput implements OutputPager
{





public function __construct(StreamOutput $output)
{
parent::__construct($output->getStream());
}




public function close()
{

 }
}
<?php










namespace Psy\Output;

use Symfony\Component\Console\Output\StreamOutput;









class ProcOutputPager extends StreamOutput implements OutputPager
{
private $proc;
private $pipe;
private $stream;
private $cmd;







public function __construct(StreamOutput $output, $cmd = 'less -R -S -F -X')
{
$this->stream = $output->getStream();
$this->cmd = $cmd;
}









public function doWrite($message, $newline)
{
$pipe = $this->getPipe();
if (false === @\fwrite($pipe, $message . ($newline ? PHP_EOL : ''))) {

 
 throw new \RuntimeException('Unable to write output');

 }

\fflush($pipe);
}




public function close()
{
if (isset($this->pipe)) {
\fclose($this->pipe);
}

if (isset($this->proc)) {
$exit = \proc_close($this->proc);
if ($exit !== 0) {
throw new \RuntimeException('Error closing output stream');
}
}

unset($this->pipe, $this->proc);
}






private function getPipe()
{
if (!isset($this->pipe) || !isset($this->proc)) {
$desc = [['pipe', 'r'], $this->stream, \fopen('php://stderr', 'w')];
$this->proc = \proc_open($this->cmd, $desc, $pipes);

if (!\is_resource($this->proc)) {
throw new \RuntimeException('Error opening output stream');
}

$this->pipe = $pipes[0];
}

return $this->pipe;
}
}
<?php










namespace Psy;

use Psy\Exception\DeprecatedException;
use Psy\Exception\RuntimeException;
use Psy\ExecutionLoop\ProcessForker;
use Psy\Output\OutputPager;
use Psy\Output\ShellOutput;
use Psy\Readline\GNUReadline;
use Psy\Readline\HoaConsole;
use Psy\Readline\Libedit;
use Psy\Readline\Readline;
use Psy\TabCompletion\AutoCompleter;
use Psy\VarDumper\Presenter;
use Psy\VersionUpdater\Checker;
use Psy\VersionUpdater\GitHubChecker;
use Psy\VersionUpdater\IntervalChecker;
use Psy\VersionUpdater\NoopChecker;
use Symfony\Component\Console\Output\OutputInterface;




class Configuration
{
const COLOR_MODE_AUTO = 'auto';
const COLOR_MODE_FORCED = 'forced';
const COLOR_MODE_DISABLED = 'disabled';

private static $AVAILABLE_OPTIONS = [
'codeCleaner',
'colorMode',
'configDir',
'dataDir',
'defaultIncludes',
'eraseDuplicates',
'errorLoggingLevel',
'forceArrayIndexes',
'historySize',
'manualDbFile',
'pager',
'prompt',
'rawOutput',
'requireSemicolons',
'runtimeDir',
'startupMessage',
'updateCheck',
'useBracketedPaste',
'usePcntl',
'useReadline',
'useTabCompletion',
'useUnicode',
'warnOnMultipleConfigs',
];

private $defaultIncludes;
private $configDir;
private $dataDir;
private $runtimeDir;
private $configFile;

private $historyFile;
private $historySize;
private $eraseDuplicates;
private $manualDbFile;
private $hasReadline;
private $useReadline;
private $useBracketedPaste;
private $hasPcntl;
private $usePcntl;
private $newCommands = [];
private $rawOutput = false;
private $requireSemicolons = false;
private $useUnicode;
private $useTabCompletion;
private $newMatchers = [];
private $errorLoggingLevel = E_ALL;
private $warnOnMultipleConfigs = false;
private $colorMode;
private $updateCheck;
private $startupMessage;
private $forceArrayIndexes = false;


 private $readline;
private $output;
private $shell;
private $cleaner;
private $pager;
private $manualDb;
private $presenter;
private $autoCompleter;
private $checker;
private $prompt;








public function __construct(array $config = [])
{
$this->setColorMode(self::COLOR_MODE_AUTO);


 if (isset($config['configFile'])) {
$this->configFile = $config['configFile'];
} elseif ($configFile = \getenv('PSYSH_CONFIG')) {
$this->configFile = $configFile;
}


 if (isset($config['baseDir'])) {
$msg = "The 'baseDir' configuration option is deprecated; " .
"please specify 'configDir' and 'dataDir' options instead";
throw new DeprecatedException($msg);
}

unset($config['configFile'], $config['baseDir']);


 $this->loadConfig($config);
$this->init();
}











public function init()
{

 $this->hasReadline = \function_exists('readline');
$this->hasPcntl = ProcessForker::isSupported();

if ($configFile = $this->getConfigFile()) {
$this->loadConfigFile($configFile);
}

if (!$this->configFile && $localConfig = $this->getLocalConfigFile()) {
$this->loadConfigFile($localConfig);
}
}















public function getConfigFile()
{
if (isset($this->configFile)) {
return $this->configFile;
}

$files = ConfigPaths::getConfigFiles(['config.php', 'rc.php'], $this->configDir);

if (!empty($files)) {
if ($this->warnOnMultipleConfigs && \count($files) > 1) {
$msg = \sprintf('Multiple configuration files found: %s. Using %s', \implode(', ', $files), $files[0]);
\trigger_error($msg, E_USER_NOTICE);
}

return $files[0];
}
}









public function getLocalConfigFile()
{
$localConfig = \getcwd() . '/.psysh.php';

if (@\is_file($localConfig)) {
return $localConfig;
}
}






public function loadConfig(array $options)
{
foreach (self::$AVAILABLE_OPTIONS as $option) {
if (isset($options[$option])) {
$method = 'set' . \ucfirst($option);
$this->$method($options[$option]);
}
}


 if (isset($options['tabCompletion'])) {
$msg = '`tabCompletion` is deprecated; use `useTabCompletion` instead.';
@\trigger_error($msg, E_USER_DEPRECATED);

$this->setUseTabCompletion($options['tabCompletion']);
}

foreach (['commands', 'matchers', 'casters'] as $option) {
if (isset($options[$option])) {
$method = 'add' . \ucfirst($option);
$this->$method($options[$option]);
}
}


 if (isset($options['tabCompletionMatchers'])) {
$msg = '`tabCompletionMatchers` is deprecated; use `matchers` instead.';
@\trigger_error($msg, E_USER_DEPRECATED);

$this->addMatchers($options['tabCompletionMatchers']);
}
}












public function loadConfigFile($file)
{
$__psysh_config_file__ = $file;
$load = function ($config) use ($__psysh_config_file__) {
$result = require $__psysh_config_file__;
if ($result !== 1) {
return $result;
}
};
$result = $load($this);

if (!empty($result)) {
if (\is_array($result)) {
$this->loadConfig($result);
} else {
throw new \InvalidArgumentException('Psy Shell configuration must return an array of options');
}
}
}






public function setDefaultIncludes(array $includes = [])
{
$this->defaultIncludes = $includes;
}






public function getDefaultIncludes()
{
return $this->defaultIncludes ?: [];
}






public function setConfigDir($dir)
{
$this->configDir = (string) $dir;
}






public function getConfigDir()
{
return $this->configDir;
}






public function setDataDir($dir)
{
$this->dataDir = (string) $dir;
}






public function getDataDir()
{
return $this->dataDir;
}






public function setRuntimeDir($dir)
{
$this->runtimeDir = (string) $dir;
}









public function getRuntimeDir()
{
if (!isset($this->runtimeDir)) {
$this->runtimeDir = ConfigPaths::getRuntimeDir();
}

if (!\is_dir($this->runtimeDir)) {
if (!@\mkdir($this->runtimeDir, 0700, true)) {
throw new RuntimeException(sprintf('Unable to create PsySH runtime directory. Make sure PHP is able to write to %s in order to continue.', dirname($this->runtimeDir)));
}
}

return $this->runtimeDir;
}






public function setHistoryFile($file)
{
$this->historyFile = ConfigPaths::touchFileWithMkdir($file);
}









public function getHistoryFile()
{
if (isset($this->historyFile)) {
return $this->historyFile;
}

$files = ConfigPaths::getConfigFiles(['psysh_history', 'history'], $this->configDir);

if (!empty($files)) {
if ($this->warnOnMultipleConfigs && \count($files) > 1) {
$msg = \sprintf('Multiple history files found: %s. Using %s', \implode(', ', $files), $files[0]);
\trigger_error($msg, E_USER_NOTICE);
}

$this->setHistoryFile($files[0]);
} else {

 $dir = $this->configDir ?: ConfigPaths::getCurrentConfigDir();
$this->setHistoryFile($dir . '/psysh_history');
}

return $this->historyFile;
}






public function setHistorySize($value)
{
$this->historySize = (int) $value;
}






public function getHistorySize()
{
return $this->historySize;
}






public function setEraseDuplicates($value)
{
$this->eraseDuplicates = (bool) $value;
}






public function getEraseDuplicates()
{
return $this->eraseDuplicates;
}













public function getTempFile($type, $pid)
{
return \tempnam($this->getRuntimeDir(), $type . '_' . $pid . '_');
}











public function getPipe($type, $pid)
{
return \sprintf('%s/%s_%s', $this->getRuntimeDir(), $type, $pid);
}






public function hasReadline()
{
return $this->hasReadline;
}






public function setUseReadline($useReadline)
{
$this->useReadline = (bool) $useReadline;
}









public function useReadline()
{
return isset($this->useReadline) ? ($this->hasReadline && $this->useReadline) : $this->hasReadline;
}






public function setReadline(Readline $readline)
{
$this->readline = $readline;
}












public function getReadline()
{
if (!isset($this->readline)) {
$className = $this->getReadlineClass();
$this->readline = new $className(
$this->getHistoryFile(),
$this->getHistorySize(),
$this->getEraseDuplicates()
);
}

return $this->readline;
}








private function getReadlineClass()
{
if ($this->useReadline()) {
if (GNUReadline::isSupported()) {
return 'Psy\Readline\GNUReadline';
} elseif (Libedit::isSupported()) {
return 'Psy\Readline\Libedit';
} elseif (HoaConsole::isSupported()) {
return 'Psy\Readline\HoaConsole';
}
}

return 'Psy\Readline\Transient';
}








public function setUseBracketedPaste($useBracketedPaste)
{
$this->useBracketedPaste = (bool) $useBracketedPaste;
}
















public function useBracketedPaste()
{

 $supported = ($this->getReadlineClass() === 'Psy\Readline\GNUReadline');

return $supported && $this->useBracketedPaste;


 
 }






public function hasPcntl()
{
return $this->hasPcntl;
}






public function setUsePcntl($usePcntl)
{
$this->usePcntl = (bool) $usePcntl;
}









public function usePcntl()
{
return isset($this->usePcntl) ? ($this->hasPcntl && $this->usePcntl) : $this->hasPcntl;
}









public function rawOutput()
{
return $this->rawOutput;
}






public function setRawOutput($rawOutput)
{
$this->rawOutput = (bool) $rawOutput;
}








public function setRequireSemicolons($requireSemicolons)
{
$this->requireSemicolons = (bool) $requireSemicolons;
}










public function requireSemicolons()
{
return $this->requireSemicolons;
}









public function setUseUnicode($useUnicode)
{
$this->useUnicode = (bool) $useUnicode;
}









public function useUnicode()
{
if (isset($this->useUnicode)) {
return $this->useUnicode;
}


 return true;
}








public function setErrorLoggingLevel($errorLoggingLevel)
{
$this->errorLoggingLevel = (E_ALL | E_STRICT) & $errorLoggingLevel;
}















public function errorLoggingLevel()
{
return $this->errorLoggingLevel;
}






public function setCodeCleaner(CodeCleaner $cleaner)
{
$this->cleaner = $cleaner;
}








public function getCodeCleaner()
{
if (!isset($this->cleaner)) {
$this->cleaner = new CodeCleaner();
}

return $this->cleaner;
}






public function setUseTabCompletion($useTabCompletion)
{
$this->useTabCompletion = (bool) $useTabCompletion;
}






public function setTabCompletion($useTabCompletion)
{
$this->setUseTabCompletion($useTabCompletion);
}









public function useTabCompletion()
{
return isset($this->useTabCompletion) ? ($this->hasReadline && $this->useTabCompletion) : $this->hasReadline;
}






public function getTabCompletion()
{
return $this->useTabCompletion();
}






public function setOutput(ShellOutput $output)
{
$this->output = $output;
}











public function getOutput()
{
if (!isset($this->output)) {
$this->output = new ShellOutput(
OutputInterface::VERBOSITY_NORMAL,
$this->getOutputDecorated(),
null,
$this->getPager()
);
}

return $this->output;
}






public function getOutputDecorated()
{
if ($this->colorMode() === self::COLOR_MODE_AUTO) {
return;
} elseif ($this->colorMode() === self::COLOR_MODE_FORCED) {
return true;
} elseif ($this->colorMode() === self::COLOR_MODE_DISABLED) {
return false;
}
}











public function setPager($pager)
{
if ($pager && !\is_string($pager) && !$pager instanceof OutputPager) {
throw new \InvalidArgumentException('Unexpected pager instance');
}

$this->pager = $pager;
}









public function getPager()
{
if (!isset($this->pager) && $this->usePcntl()) {
if ($pager = \ini_get('cli.pager')) {

 $this->pager = $pager;
} elseif ($less = \exec('which less 2>/dev/null')) {

 $this->pager = $less . ' -R -S -F -X';
}
}

return $this->pager;
}






public function setAutoCompleter(AutoCompleter $autoCompleter)
{
$this->autoCompleter = $autoCompleter;
}






public function getAutoCompleter()
{
if (!isset($this->autoCompleter)) {
$this->autoCompleter = new AutoCompleter();
}

return $this->autoCompleter;
}






public function getTabCompletionMatchers()
{
return [];
}











public function addMatchers(array $matchers)
{
$this->newMatchers = \array_merge($this->newMatchers, $matchers);
if (isset($this->shell)) {
$this->doAddMatchers();
}
}





private function doAddMatchers()
{
if (!empty($this->newMatchers)) {
$this->shell->addMatchers($this->newMatchers);
$this->newMatchers = [];
}
}






public function addTabCompletionMatchers(array $matchers)
{
$this->addMatchers($matchers);
}











public function addCommands(array $commands)
{
$this->newCommands = \array_merge($this->newCommands, $commands);
if (isset($this->shell)) {
$this->doAddCommands();
}
}





private function doAddCommands()
{
if (!empty($this->newCommands)) {
$this->shell->addCommands($this->newCommands);
$this->newCommands = [];
}
}






public function setShell(Shell $shell)
{
$this->shell = $shell;
$this->doAddCommands();
$this->doAddMatchers();
}









public function setManualDbFile($filename)
{
$this->manualDbFile = (string) $filename;
}






public function getManualDbFile()
{
if (isset($this->manualDbFile)) {
return $this->manualDbFile;
}

$files = ConfigPaths::getDataFiles(['php_manual.sqlite'], $this->dataDir);
if (!empty($files)) {
if ($this->warnOnMultipleConfigs && \count($files) > 1) {
$msg = \sprintf('Multiple manual database files found: %s. Using %s', \implode(', ', $files), $files[0]);
\trigger_error($msg, E_USER_NOTICE);
}

return $this->manualDbFile = $files[0];
}
}






public function getManualDb()
{
if (!isset($this->manualDb)) {
$dbFile = $this->getManualDbFile();
if (\is_file($dbFile)) {
try {
$this->manualDb = new \PDO('sqlite:' . $dbFile);
} catch (\PDOException $e) {
if ($e->getMessage() === 'could not find driver') {
throw new RuntimeException('SQLite PDO driver not found', 0, $e);
} else {
throw $e;
}
}
}
}

return $this->manualDb;
}






public function addCasters(array $casters)
{
$this->getPresenter()->addCasters($casters);
}






public function getPresenter()
{
if (!isset($this->presenter)) {
$this->presenter = new Presenter($this->getOutput()->getFormatter(), $this->forceArrayIndexes());
}

return $this->presenter;
}








public function setWarnOnMultipleConfigs($warnOnMultipleConfigs)
{
$this->warnOnMultipleConfigs = (bool) $warnOnMultipleConfigs;
}













public function warnOnMultipleConfigs()
{
return $this->warnOnMultipleConfigs;
}






public function setColorMode($colorMode)
{
$validColorModes = [
self::COLOR_MODE_AUTO,
self::COLOR_MODE_FORCED,
self::COLOR_MODE_DISABLED,
];

if (\in_array($colorMode, $validColorModes)) {
$this->colorMode = $colorMode;
} else {
throw new \InvalidArgumentException('invalid color mode: ' . $colorMode);
}
}






public function colorMode()
{
return $this->colorMode;
}






public function setChecker(Checker $checker)
{
$this->checker = $checker;
}








public function getChecker()
{
if (!isset($this->checker)) {
$interval = $this->getUpdateCheck();
switch ($interval) {
case Checker::ALWAYS:
$this->checker = new GitHubChecker();
break;

case Checker::DAILY:
case Checker::WEEKLY:
case Checker::MONTHLY:
$checkFile = $this->getUpdateCheckCacheFile();
if ($checkFile === false) {
$this->checker = new NoopChecker();
} else {
$this->checker = new IntervalChecker($checkFile, $interval);
}
break;

case Checker::NEVER:
$this->checker = new NoopChecker();
break;
}
}

return $this->checker;
}









public function getUpdateCheck()
{
return isset($this->updateCheck) ? $this->updateCheck : Checker::WEEKLY;
}








public function setUpdateCheck($interval)
{
$validIntervals = [
Checker::ALWAYS,
Checker::DAILY,
Checker::WEEKLY,
Checker::MONTHLY,
Checker::NEVER,
];

if (!\in_array($interval, $validIntervals)) {
throw new \InvalidArgumentException('invalid update check interval: ' . $interval);
}

$this->updateCheck = $interval;
}






public function getUpdateCheckCacheFile()
{
$dir = $this->configDir ?: ConfigPaths::getCurrentConfigDir();

return ConfigPaths::touchFileWithMkdir($dir . '/update_check.json');
}






public function setStartupMessage($message)
{
$this->startupMessage = $message;
}






public function getStartupMessage()
{
return $this->startupMessage;
}






public function setPrompt($prompt)
{
$this->prompt = $prompt;
}






public function getPrompt()
{
return $this->prompt;
}






public function forceArrayIndexes()
{
return $this->forceArrayIndexes;
}






public function setForceArrayIndexes($forceArrayIndexes)
{
$this->forceArrayIndexes = $forceArrayIndexes;
}
}
<?php










namespace Psy;







interface ContextAware
{





public function setContext(Context $context);
}
<?php










namespace Psy;

use PhpParser\NodeTraverser;
use PhpParser\Parser;
use PhpParser\PrettyPrinter\Standard as Printer;
use Psy\CodeCleaner\AbstractClassPass;
use Psy\CodeCleaner\AssignThisVariablePass;
use Psy\CodeCleaner\CalledClassPass;
use Psy\CodeCleaner\CallTimePassByReferencePass;
use Psy\CodeCleaner\EmptyArrayDimFetchPass;
use Psy\CodeCleaner\ExitPass;
use Psy\CodeCleaner\FinalClassPass;
use Psy\CodeCleaner\FunctionContextPass;
use Psy\CodeCleaner\FunctionReturnInWriteContextPass;
use Psy\CodeCleaner\ImplicitReturnPass;
use Psy\CodeCleaner\InstanceOfPass;
use Psy\CodeCleaner\LabelContextPass;
use Psy\CodeCleaner\LeavePsyshAlonePass;
use Psy\CodeCleaner\ListPass;
use Psy\CodeCleaner\LoopContextPass;
use Psy\CodeCleaner\MagicConstantsPass;
use Psy\CodeCleaner\NamespacePass;
use Psy\CodeCleaner\PassableByReferencePass;
use Psy\CodeCleaner\RequirePass;
use Psy\CodeCleaner\StrictTypesPass;
use Psy\CodeCleaner\UseStatementPass;
use Psy\CodeCleaner\ValidClassNamePass;
use Psy\CodeCleaner\ValidConstantPass;
use Psy\CodeCleaner\ValidConstructorPass;
use Psy\CodeCleaner\ValidFunctionNamePass;
use Psy\Exception\ParseErrorException;





class CodeCleaner
{
private $parser;
private $printer;
private $traverser;
private $namespace;








public function __construct(Parser $parser = null, Printer $printer = null, NodeTraverser $traverser = null)
{
if ($parser === null) {
$parserFactory = new ParserFactory();
$parser = $parserFactory->createParser();
}

$this->parser = $parser;
$this->printer = $printer ?: new Printer();
$this->traverser = $traverser ?: new NodeTraverser();

foreach ($this->getDefaultPasses() as $pass) {
$this->traverser->addVisitor($pass);
}
}






private function getDefaultPasses()
{
$useStatementPass = new UseStatementPass();
$namespacePass = new NamespacePass($this);


 
 $this->addImplicitDebugContext([$useStatementPass, $namespacePass]);

return [

 new AbstractClassPass(),
new AssignThisVariablePass(),
new CalledClassPass(),
new CallTimePassByReferencePass(),
new FinalClassPass(),
new FunctionContextPass(),
new FunctionReturnInWriteContextPass(),
new InstanceOfPass(),
new LabelContextPass(),
new LeavePsyshAlonePass(),
new ListPass(),
new LoopContextPass(),
new PassableByReferencePass(),
new EmptyArrayDimFetchPass(),
new ValidConstructorPass(),


 $useStatementPass, 
 new ExitPass(),
new ImplicitReturnPass(),
new MagicConstantsPass(),
$namespacePass, 
 new RequirePass(),
new StrictTypesPass(),


 new ValidClassNamePass(),
new ValidConstantPass(),
new ValidFunctionNamePass(),
];
}










private function addImplicitDebugContext(array $passes)
{
$file = $this->getDebugFile();
if ($file === null) {
return;
}

try {
$code = @\file_get_contents($file);
if (!$code) {
return;
}

$stmts = $this->parse($code, true);
if ($stmts === false) {
return;
}


 $traverser = new NodeTraverser();
foreach ($passes as $pass) {
$traverser->addVisitor($pass);
}

$traverser->traverse($stmts);
} catch (\Throwable $e) {

 } catch (\Exception $e) {

 }
}






private static function getDebugFile()
{
$trace = \debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);

foreach (\array_reverse($trace) as $stackFrame) {
if (!self::isDebugCall($stackFrame)) {
continue;
}

if (\preg_match('/eval\(/', $stackFrame['file'])) {
\preg_match_all('/([^\(]+)\((\d+)/', $stackFrame['file'], $matches);

return $matches[1][0];
}

return $stackFrame['file'];
}
}








private static function isDebugCall(array $stackFrame)
{
$class = isset($stackFrame['class']) ? $stackFrame['class'] : null;
$function = isset($stackFrame['function']) ? $stackFrame['function'] : null;

return ($class === null && $function === 'Psy\debug') ||
($class === 'Psy\Shell' && $function === 'debug');
}











public function clean(array $codeLines, $requireSemicolons = false)
{
$stmts = $this->parse('<?php ' . \implode(PHP_EOL, $codeLines) . PHP_EOL, $requireSemicolons);
if ($stmts === false) {
return false;
}


 $stmts = $this->traverser->traverse($stmts);


 $oldLocale = \setlocale(LC_NUMERIC, 0);
\setlocale(LC_NUMERIC, 'C');

$code = $this->printer->prettyPrint($stmts);


 \setlocale(LC_NUMERIC, $oldLocale);

return $code;
}








public function setNamespace(array $namespace = null)
{
$this->namespace = $namespace;
}






public function getNamespace()
{
return $this->namespace;
}














protected function parse($code, $requireSemicolons = false)
{
try {
return $this->parser->parse($code);
} catch (\PhpParser\Error $e) {
if ($this->parseErrorIsUnclosedString($e, $code)) {
return false;
}

if ($this->parseErrorIsUnterminatedComment($e, $code)) {
return false;
}

if ($this->parseErrorIsTrailingComma($e, $code)) {
return false;
}

if (!$this->parseErrorIsEOF($e)) {
throw ParseErrorException::fromParseError($e);
}

if ($requireSemicolons) {
return false;
}

try {

 return $this->parser->parse($code . ';');
} catch (\PhpParser\Error $e) {
return false;
}
}
}

private function parseErrorIsEOF(\PhpParser\Error $e)
{
$msg = $e->getRawMessage();

return ($msg === 'Unexpected token EOF') || (\strpos($msg, 'Syntax error, unexpected EOF') !== false);
}













private function parseErrorIsUnclosedString(\PhpParser\Error $e, $code)
{
if ($e->getRawMessage() !== 'Syntax error, unexpected T_ENCAPSED_AND_WHITESPACE') {
return false;
}

try {
$this->parser->parse($code . "';");
} catch (\Exception $e) {
return false;
}

return true;
}

private function parseErrorIsUnterminatedComment(\PhpParser\Error $e, $code)
{
return $e->getRawMessage() === 'Unterminated comment';
}

private function parseErrorIsTrailingComma(\PhpParser\Error $e, $code)
{
return ($e->getRawMessage() === 'A trailing comma is not allowed here') && (\substr(\rtrim($code), -1) === ',');
}
}
<?php










namespace Psy;

use XdgBaseDir\Xdg;




class ConfigPaths
{










public static function getConfigDirs()
{
$xdg = new Xdg();

return self::getDirNames($xdg->getConfigDirs());
}











public static function getHomeConfigDirs()
{
$xdg = new Xdg();

return self::getDirNames([$xdg->getHomeConfigDir()]);
}













public static function getCurrentConfigDir()
{
$configDirs = self::getHomeConfigDirs();
foreach ($configDirs as $configDir) {
if (@\is_dir($configDir)) {
return $configDir;
}
}

return $configDirs[0];
}









public static function getConfigFiles(array $names, $configDir = null)
{
$dirs = ($configDir === null) ? self::getConfigDirs() : [$configDir];

return self::getRealFiles($dirs, $names);
}













public static function getDataDirs()
{
$xdg = new Xdg();

return self::getDirNames($xdg->getDataDirs());
}









public static function getDataFiles(array $names, $dataDir = null)
{
$dirs = ($dataDir === null) ? self::getDataDirs() : [$dataDir];

return self::getRealFiles($dirs, $names);
}








public static function getRuntimeDir()
{
$xdg = new Xdg();

\set_error_handler(['Psy\Exception\ErrorException', 'throwException']);

try {

 
 
 $runtimeDir = $xdg->getRuntimeDir(false);
} catch (\Exception $e) {

 
 $runtimeDir = \sys_get_temp_dir();
}

\restore_error_handler();

return \strtr($runtimeDir, '\\', '/') . '/psysh';
}

private static function getDirNames(array $baseDirs)
{
$dirs = \array_map(function ($dir) {
return \strtr($dir, '\\', '/') . '/psysh';
}, $baseDirs);


 if ($home = \getenv('HOME')) {
$dirs[] = \strtr($home, '\\', '/') . '/.psysh';
}


 if (\defined('PHP_WINDOWS_VERSION_MAJOR')) {
if ($appData = \getenv('APPDATA')) {

 \array_unshift($dirs, \strtr($appData, '\\', '/') . '/PsySH');
}

$dir = \strtr(\getenv('HOMEDRIVE') . '/' . \getenv('HOMEPATH'), '\\', '/') . '/.psysh';
if (!\in_array($dir, $dirs)) {
$dirs[] = $dir;
}
}

return $dirs;
}

private static function getRealFiles(array $dirNames, array $fileNames)
{
$files = [];
foreach ($dirNames as $dir) {
foreach ($fileNames as $name) {
$file = $dir . '/' . $name;
if (@\is_file($file)) {
$files[] = $file;
}
}
}

return $files;
}










public static function ensureDir($dir)
{
if (!\is_dir($dir)) {

 @\mkdir($dir, 0700, true);
}

if (!\is_dir($dir) || !\is_writable($dir)) {
\trigger_error(\sprintf('Writing to %s is not allowed.', $dir), E_USER_NOTICE);

return false;
}

return true;
}










public static function touchFileWithMkdir($file)
{
if (\file_exists($file)) {
if (\is_writable($file)) {
return $file;
}

\trigger_error(\sprintf('Writing to %s is not allowed.', $file), E_USER_NOTICE);

return false;
}

if (!self::ensureDir(\dirname($file))) {
return false;
}

\touch($file);

return $file;
}
}
<?php










namespace Psy\Exception;




class ErrorException extends \ErrorException implements Exception
{
private $rawMessage;











public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, $previous = null)
{
$this->rawMessage = $message;

if (!empty($filename) && \preg_match('{Psy[/\\\\]ExecutionLoop}', $filename)) {
$filename = '';
}

switch ($severity) {
case E_STRICT:
$type = 'Strict error';
break;

case E_NOTICE:
case E_USER_NOTICE:
$type = 'Notice';
break;

case E_WARNING:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
case E_USER_WARNING:
$type = 'Warning';
break;

case E_DEPRECATED:
case E_USER_DEPRECATED:
$type = 'Deprecated';
break;

case E_RECOVERABLE_ERROR:
$type = 'Recoverable fatal error';
break;

default:
$type = 'Error';
break;
}

$message = \sprintf('PHP %s:  %s%s on line %d', $type, $message, $filename ? ' in ' . $filename : '', $lineno);
parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
}






public function getRawMessage()
{
return $this->rawMessage;
}















public static function throwException($errno, $errstr, $errfile, $errline)
{
throw new self($errstr, 0, $errno, $errfile, $errline);
}








public static function fromError(\Error $e)
{
return new self($e->getMessage(), $e->getCode(), 1, $e->getFile(), $e->getLine(), $e);
}
}
<?php










namespace Psy\Exception;




class BreakException extends \Exception implements Exception
{
private $rawMessage;




public function __construct($message = '', $code = 0, \Exception $previous = null)
{
$this->rawMessage = $message;
parent::__construct(\sprintf('Exit:  %s', $message), $code, $previous);
}






public function getRawMessage()
{
return $this->rawMessage;
}








public static function exitShell()
{
throw new self('Goodbye');
}
}
<?php










namespace Psy\Exception;




class RuntimeException extends \RuntimeException implements Exception
{
private $rawMessage;








public function __construct($message = '', $code = 0, \Exception $previous = null)
{
$this->rawMessage = $message;
parent::__construct($message, $code, $previous);
}






public function getRawMessage()
{
return $this->rawMessage;
}
}
<?php










namespace Psy\Exception;




interface Exception
{







public function getRawMessage();
}
<?php










namespace Psy\Exception;




class ThrowUpException extends \Exception implements Exception
{



public function __construct(\Exception $exception)
{
$message = \sprintf("Throwing %s with message '%s'", \get_class($exception), $exception->getMessage());
parent::__construct($message, $exception->getCode(), $exception);
}






public function getRawMessage()
{
return $this->getPrevious()->getMessage();
}








public static function fromThrowable($throwable)
{
if ($throwable instanceof \Error) {
$throwable = ErrorException::fromError($throwable);
}

if (!$throwable instanceof \Exception) {
throw new \InvalidArgumentException('throw-up can only throw Exceptions and Errors');
}

return new self($throwable);
}
}
<?php










namespace Psy\Exception;




class ParseErrorException extends \PhpParser\Error implements Exception
{






public function __construct($message = '', $line = -1)
{
$message = \sprintf('PHP Parse error: %s', $message);
parent::__construct($message, $line);
}








public static function fromParseError(\PhpParser\Error $e)
{
return new self($e->getRawMessage(), $e->getStartLine());
}
}
<?php










namespace Psy\Exception;




class DeprecatedException extends RuntimeException
{

}
<?php










namespace Psy\Exception;




class FatalErrorException extends \ErrorException implements Exception
{
private $rawMessage;











public function __construct($message = '', $code = 0, $severity = 1, $filename = null, $lineno = null, $previous = null)
{

 if ($lineno === -1) {
$lineno = null;
}

$this->rawMessage = $message;
$message = \sprintf('PHP Fatal error:  %s in %s on line %d', $message, $filename ?: "eval()'d code", $lineno);
parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
}






public function getRawMessage()
{
return $this->rawMessage;
}
}
<?php










namespace Psy\Exception;




class TypeErrorException extends \Exception implements Exception
{
private $rawMessage;







public function __construct($message = '', $code = 0)
{
$this->rawMessage = $message;
$message = \preg_replace('/, called in .*?: eval\\(\\)\'d code/', '', $message);
parent::__construct(\sprintf('TypeError: %s', $message), $code);
}






public function getRawMessage()
{
return $this->rawMessage;
}








public static function fromTypeError(\TypeError $e)
{
return new self($e->getMessage(), $e->getCode());
}
}
<?php










namespace Psy;




class ExecutionClosure
{
const NOOP_INPUT = 'return null;';

private $closure;




public function __construct(Shell $__psysh__)
{
$this->setClosure($__psysh__, function () use ($__psysh__) {
try {

 \extract($__psysh__->getScopeVariables(false));


 \ob_start([$__psysh__, 'writeStdout'], 1);


 \set_error_handler([$__psysh__, 'handleError']);


 $_ = eval($__psysh__->onExecute($__psysh__->flushCode() ?: self::NOOP_INPUT));
} catch (\Throwable $_e) {

 \restore_error_handler();
if (\ob_get_level() > 0) {
\ob_end_clean();
}

throw $_e;
} catch (\Exception $_e) {

 \restore_error_handler();
if (\ob_get_level() > 0) {
\ob_end_clean();
}

throw $_e;
}


 \restore_error_handler();


 \ob_end_flush();


 $__psysh__->setScopeVariables(\get_defined_vars());

return $_;
});
}







protected function setClosure(Shell $shell, \Closure $closure)
{
$that = $shell->getBoundObject();

if (\is_object($that)) {
$this->closure = $closure->bindTo($that, \get_class($that));
} else {
$this->closure = $closure->bindTo(null, $shell->getBoundClass());
}
}






public function execute()
{
$closure = $this->closure;

return $closure();
}
}
<?php










namespace Psy\TabCompletion\Matcher;

class ObjectMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher
{
public function getMatches(array $tokens, array $info = [])
{
$openBracket = \array_pop($tokens);
$functionName = \array_pop($tokens);
$methodOperator = \array_pop($tokens);

$objectToken = \array_pop($tokens);
if (!\is_array($objectToken)) {
return [];
}

$objectName = \str_replace('$', '', $objectToken[1]);

try {
$object = $this->getVariable($objectName);
$reflection = new \ReflectionObject($object);
} catch (\InvalidArgumentException $e) {
return [];
} catch (\ReflectionException $e) {
return [];
}

$methods = $reflection->getMethods();

foreach ($methods as $method) {
if ($method->getName() === $functionName[1]) {
return $this->getDefaultParameterCompletion($method->getParameters());
}
}

return [];
}

public function hasMatched(array $tokens)
{
$openBracket = \array_pop($tokens);

if ($openBracket !== '(') {
return false;
}

$functionName = \array_pop($tokens);

if (!self::tokenIs($functionName, self::T_STRING)) {
return false;
}

$operator = \array_pop($tokens);

if (!self::tokenIs($operator, self::T_OBJECT_OPERATOR)) {
return false;
}

return true;
}
}
<?php










namespace Psy\TabCompletion\Matcher;









class ClassMethodsMatcher extends AbstractMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);

$firstToken = \array_pop($tokens);
if (self::tokenIs($firstToken, self::T_STRING)) {

 \array_pop($tokens);
}

$class = $this->getNamespaceAndClass($tokens);

try {
$reflection = new \ReflectionClass($class);
} catch (\ReflectionException $re) {
return [];
}

if (self::needCompleteClass($tokens[1])) {
$methods = $reflection->getMethods();
} else {
$methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);
}

$methods = \array_map(function (\ReflectionMethod $method) {
return $method->getName();
}, $methods);

return \array_map(
function ($name) use ($class) {
$chunks = \explode('\\', $class);
$className = \array_pop($chunks);

return $className . '::' . $name;
},
\array_filter($methods, function ($method) use ($input) {
return AbstractMatcher::startsWith($input, $method);
})
);
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::tokenIs($prevToken, self::T_DOUBLE_COLON) && self::tokenIs($token, self::T_STRING):
case self::tokenIs($token, self::T_DOUBLE_COLON):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;









class ClassAttributesMatcher extends AbstractMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);

$firstToken = \array_pop($tokens);
if (self::tokenIs($firstToken, self::T_STRING)) {

 \array_pop($tokens);
}

$class = $this->getNamespaceAndClass($tokens);

try {
$reflection = new \ReflectionClass($class);
} catch (\ReflectionException $re) {
return [];
}

$vars = \array_merge(
\array_map(
function ($var) {
return '$' . $var;
},
\array_keys($reflection->getStaticProperties())
),
\array_keys($reflection->getConstants())
);

return \array_map(
function ($name) use ($class) {
$chunks = \explode('\\', $class);
$className = \array_pop($chunks);

return $className . '::' . $name;
},
\array_filter(
$vars,
function ($var) use ($input) {
return AbstractMatcher::startsWith($input, $var);
}
)
);
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::tokenIs($prevToken, self::T_DOUBLE_COLON) && self::tokenIs($token, self::T_STRING):
case self::tokenIs($token, self::T_DOUBLE_COLON):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;

use InvalidArgumentException;









class ObjectMethodsMatcher extends AbstractContextAwareMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);

$firstToken = \array_pop($tokens);
if (self::tokenIs($firstToken, self::T_STRING)) {

 \array_pop($tokens);
}
$objectToken = \array_pop($tokens);
if (!\is_array($objectToken)) {
return [];
}
$objectName = \str_replace('$', '', $objectToken[1]);

try {
$object = $this->getVariable($objectName);
} catch (InvalidArgumentException $e) {
return [];
}

if (!\is_object($object)) {
return [];
}

return \array_filter(
\get_class_methods($object),
function ($var) use ($input) {
return AbstractMatcher::startsWith($input, $var) &&

 !AbstractMatcher::startsWith('__', $var);
}
);
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::tokenIs($token, self::T_OBJECT_OPERATOR):
case self::tokenIs($prevToken, self::T_OBJECT_OPERATOR):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;








class MongoClientMatcher extends AbstractContextAwareMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);

$firstToken = \array_pop($tokens);
if (self::tokenIs($firstToken, self::T_STRING)) {

 \array_pop($tokens);
}
$objectToken = \array_pop($tokens);
$objectName = \str_replace('$', '', $objectToken[1]);
$object = $this->getVariable($objectName);

if (!$object instanceof \MongoClient) {
return [];
}

$list = $object->listDBs();

return \array_filter(
\array_map(function ($info) {
return $info['name'];
}, $list['databases']),
function ($var) use ($input) {
return AbstractMatcher::startsWith($input, $var);
}
);
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::tokenIs($token, self::T_OBJECT_OPERATOR):
case self::tokenIs($prevToken, self::T_OBJECT_OPERATOR):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;

abstract class AbstractDefaultParametersMatcher extends AbstractContextAwareMatcher
{





public function getDefaultParameterCompletion(array $reflectionParameters)
{
$parametersProcessed = [];

foreach ($reflectionParameters as $parameter) {
if (!$parameter->isDefaultValueAvailable()) {
return [];
}

$defaultValue = $this->valueToShortString($parameter->getDefaultValue());

$parametersProcessed[] = "\${$parameter->getName()} = $defaultValue";
}

if (empty($parametersProcessed)) {
return [];
}

return [\implode(', ', $parametersProcessed) . ')'];
}










private function valueToShortString($value)
{
if (!\is_array($value)) {
return \json_encode($value);
}

$chunks = [];
$chunksSequential = [];

$allSequential = true;

foreach ($value as $key => $item) {
$allSequential = $allSequential && \is_numeric($key) && $key === \count($chunksSequential);

$keyString = $this->valueToShortString($key);
$itemString = $this->valueToShortString($item);

$chunks[] = "{$keyString} => {$itemString}";
$chunksSequential[] = $itemString;
}

$chunksToImplode = $allSequential ? $chunksSequential : $chunks;

return '[' . \implode(', ', $chunksToImplode) . ']';
}
}
<?php










namespace Psy\TabCompletion\Matcher;

class FunctionDefaultParametersMatcher extends AbstractDefaultParametersMatcher
{
public function getMatches(array $tokens, array $info = [])
{
\array_pop($tokens); 

$functionName = \array_pop($tokens);

try {
$reflection = new \ReflectionFunction($functionName[1]);
} catch (\ReflectionException $e) {
return [];
}

$parameters = $reflection->getParameters();

return $this->getDefaultParameterCompletion($parameters);
}

public function hasMatched(array $tokens)
{
$openBracket = \array_pop($tokens);

if ($openBracket !== '(') {
return false;
}

$functionName = \array_pop($tokens);

if (!self::tokenIs($functionName, self::T_STRING)) {
return false;
}

if (!\function_exists($functionName[1])) {
return false;
}

return true;
}
}
<?php










namespace Psy\TabCompletion\Matcher;








class VariablesMatcher extends AbstractContextAwareMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$var = \str_replace('$', '', $this->getInput($tokens));

return \array_filter(\array_keys($this->getVariables()), function ($variable) use ($var) {
return AbstractMatcher::startsWith($var, $variable);
});
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);

switch (true) {
case self::hasToken([self::T_OPEN_TAG, self::T_VARIABLE], $token):
case \is_string($token) && $token === '$':
case self::isOperator($token):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;








class FunctionsMatcher extends AbstractMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$func = $this->getInput($tokens);

$functions = \get_defined_functions();
$allFunctions = \array_merge($functions['user'], $functions['internal']);

return \array_filter($allFunctions, function ($function) use ($func) {
return AbstractMatcher::startsWith($func, $function);
});
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::tokenIs($prevToken, self::T_NEW):
return false;
case self::hasToken([self::T_OPEN_TAG, self::T_STRING], $token):
case self::isOperator($token):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;








class KeywordsMatcher extends AbstractMatcher
{
protected $keywords = [
'array', 'clone', 'declare', 'die', 'echo', 'empty', 'eval', 'exit', 'include',
'include_once', 'isset', 'list', 'print', 'require', 'require_once', 'unset',
];

protected $mandatoryStartKeywords = [
'die', 'echo', 'print', 'unset',
];






public function getKeywords()
{
return $this->keywords;
}








public function isKeyword($keyword)
{
return \in_array($keyword, $this->keywords);
}




public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);

return \array_filter($this->keywords, function ($keyword) use ($input) {
return AbstractMatcher::startsWith($input, $keyword);
});
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::hasToken([self::T_OPEN_TAG, self::T_VARIABLE], $token):

 case self::hasToken([self::T_OPEN_TAG, self::T_VARIABLE], $prevToken) &&
self::tokenIs($token, self::T_STRING):
case self::isOperator($token):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;

use InvalidArgumentException;









class ObjectAttributesMatcher extends AbstractContextAwareMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);

$firstToken = \array_pop($tokens);
if (self::tokenIs($firstToken, self::T_STRING)) {

 \array_pop($tokens);
}
$objectToken = \array_pop($tokens);
if (!\is_array($objectToken)) {
return [];
}
$objectName = \str_replace('$', '', $objectToken[1]);

try {
$object = $this->getVariable($objectName);
} catch (InvalidArgumentException $e) {
return [];
}

if (!\is_object($object)) {
return [];
}

return \array_filter(
\array_keys(\get_class_vars(\get_class($object))),
function ($var) use ($input) {
return AbstractMatcher::startsWith($input, $var);
}
);
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::tokenIs($token, self::T_OBJECT_OPERATOR):
case self::tokenIs($prevToken, self::T_OBJECT_OPERATOR):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;








class MongoDatabaseMatcher extends AbstractContextAwareMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);

$firstToken = \array_pop($tokens);
if (self::tokenIs($firstToken, self::T_STRING)) {

 \array_pop($tokens);
}
$objectToken = \array_pop($tokens);
$objectName = \str_replace('$', '', $objectToken[1]);
$object = $this->getVariable($objectName);

if (!$object instanceof \MongoDB) {
return [];
}

return \array_filter(
$object->getCollectionNames(),
function ($var) use ($input) {
return AbstractMatcher::startsWith($input, $var);
}
);
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::tokenIs($token, self::T_OBJECT_OPERATOR):
case self::tokenIs($prevToken, self::T_OBJECT_OPERATOR):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;

use Psy\Context;
use Psy\ContextAware;









abstract class AbstractContextAwareMatcher extends AbstractMatcher implements ContextAware
{





protected $context;






public function setContext(Context $context)
{
$this->context = $context;
}








protected function getVariable($var)
{
return $this->context->get($var);
}






protected function getVariables()
{
return $this->context->getAll();
}
}
<?php










namespace Psy\TabCompletion\Matcher;






abstract class AbstractMatcher
{

const CONSTANT_SYNTAX = '^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$';
const VAR_SYNTAX = '^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$';
const MISC_OPERATORS = '+-*/^|&';

const T_OPEN_TAG = 'T_OPEN_TAG';
const T_VARIABLE = 'T_VARIABLE';
const T_OBJECT_OPERATOR = 'T_OBJECT_OPERATOR';
const T_DOUBLE_COLON = 'T_DOUBLE_COLON';
const T_NEW = 'T_NEW';
const T_CLONE = 'T_CLONE';
const T_NS_SEPARATOR = 'T_NS_SEPARATOR';
const T_STRING = 'T_STRING';
const T_WHITESPACE = 'T_WHITESPACE';
const T_AND_EQUAL = 'T_AND_EQUAL';
const T_BOOLEAN_AND = 'T_BOOLEAN_AND';
const T_BOOLEAN_OR = 'T_BOOLEAN_OR';

const T_ENCAPSED_AND_WHITESPACE = 'T_ENCAPSED_AND_WHITESPACE';
const T_REQUIRE = 'T_REQUIRE';
const T_REQUIRE_ONCE = 'T_REQUIRE_ONCE';
const T_INCLUDE = 'T_INCLUDE';
const T_INCLUDE_ONCE = 'T_INCLUDE_ONCE';








public function hasMatched(array $tokens)
{
return false;
}








protected function getInput(array $tokens)
{
$var = '';
$firstToken = \array_pop($tokens);
if (self::tokenIs($firstToken, self::T_STRING)) {
$var = $firstToken[1];
}

return $var;
}








protected function getNamespaceAndClass($tokens)
{
$class = '';
while (self::hasToken(
[self::T_NS_SEPARATOR, self::T_STRING],
$token = \array_pop($tokens)
)) {
if (self::needCompleteClass($token)) {
continue;
}

$class = $token[1] . $class;
}

return $class;
}









abstract public function getMatches(array $tokens, array $info = []);









public static function startsWith($prefix, $word)
{
return \preg_match(\sprintf('#^%s#', $prefix), $word);
}









public static function hasSyntax($token, $syntax = self::VAR_SYNTAX)
{
if (!\is_array($token)) {
return false;
}

$regexp = \sprintf('#%s#', $syntax);

return (bool) \preg_match($regexp, $token[1]);
}









public static function tokenIs($token, $which)
{
if (!\is_array($token)) {
return false;
}

return \token_name($token[0]) === $which;
}








public static function isOperator($token)
{
if (!\is_string($token)) {
return false;
}

return \strpos(self::MISC_OPERATORS, $token) !== false;
}

public static function needCompleteClass($token)
{
return \in_array($token[1], ['doc', 'ls', 'show']);
}









public static function hasToken(array $coll, $token)
{
if (!\is_array($token)) {
return false;
}

return \in_array(\token_name($token[0]), $coll);
}
}
<?php










namespace Psy\TabCompletion\Matcher;

use Psy\Command\Command;









class CommandsMatcher extends AbstractMatcher
{

protected $commands = [];






public function __construct(array $commands)
{
$this->setCommands($commands);
}






public function setCommands(array $commands)
{
$names = [];
foreach ($commands as $command) {
$names = \array_merge([$command->getName()], $names);
$names = \array_merge($command->getAliases(), $names);
}
$this->commands = $names;
}








protected function isCommand($name)
{
return \in_array($name, $this->commands);
}








protected function matchCommand($name)
{
foreach ($this->commands as $cmd) {
if ($this->startsWith($name, $cmd)) {
return true;
}
}

return false;
}




public function getMatches(array $tokens, array $info = [])
{
$input = $this->getInput($tokens);

return \array_filter($this->commands, function ($command) use ($input) {
return AbstractMatcher::startsWith($input, $command);
});
}




public function hasMatched(array $tokens)
{
 \array_shift($tokens);
$command = \array_shift($tokens);

switch (true) {
case self::tokenIs($command, self::T_STRING) &&
!$this->isCommand($command[1]) &&
$this->matchCommand($command[1]) &&
empty($tokens):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;








class ClassNamesMatcher extends AbstractMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$class = $this->getNamespaceAndClass($tokens);
if (\strlen($class) > 0 && $class[0] === '\\') {
$class = \substr($class, 1, \strlen($class));
}
$quotedClass = \preg_quote($class);

return \array_map(
function ($className) use ($class) {

 $nsPos = \substr_count($class, '\\');
$pieces = \explode('\\', $className);

 return \implode('\\', \array_slice($pieces, $nsPos, \count($pieces)));
},
\array_filter(
\get_declared_classes(),
function ($className) use ($quotedClass) {
return AbstractMatcher::startsWith($quotedClass, $className);
}
)
);
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

$blacklistedTokens = [
self::T_INCLUDE, self::T_INCLUDE_ONCE, self::T_REQUIRE, self::T_REQUIRE_ONCE,
];

switch (true) {
case self::hasToken([$blacklistedTokens], $token):
case self::hasToken([$blacklistedTokens], $prevToken):
case \is_string($token) && $token === '$':
return false;
case self::hasToken([self::T_NEW, self::T_OPEN_TAG, self::T_NS_SEPARATOR, self::T_STRING], $prevToken):
case self::hasToken([self::T_NEW, self::T_OPEN_TAG, self::T_NS_SEPARATOR], $token):
case self::hasToken([self::T_OPEN_TAG, self::T_VARIABLE], $token):
case self::isOperator($token):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;








class ConstantsMatcher extends AbstractMatcher
{



public function getMatches(array $tokens, array $info = [])
{
$const = $this->getInput($tokens);

return \array_filter(\array_keys(\get_defined_constants()), function ($constant) use ($const) {
return AbstractMatcher::startsWith($const, $constant);
});
}




public function hasMatched(array $tokens)
{
$token = \array_pop($tokens);
$prevToken = \array_pop($tokens);

switch (true) {
case self::tokenIs($prevToken, self::T_NEW):
case self::tokenIs($prevToken, self::T_NS_SEPARATOR):
return false;
case self::hasToken([self::T_OPEN_TAG, self::T_STRING], $token):
case self::isOperator($token):
return true;
}

return false;
}
}
<?php










namespace Psy\TabCompletion\Matcher;

class ClassMethodDefaultParametersMatcher extends AbstractDefaultParametersMatcher
{
public function getMatches(array $tokens, array $info = [])
{
$openBracket = \array_pop($tokens);
$functionName = \array_pop($tokens);
$methodOperator = \array_pop($tokens);

$class = $this->getNamespaceAndClass($tokens);

try {
$reflection = new \ReflectionClass($class);
} catch (\ReflectionException $e) {

 return [];
}

$methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC);

foreach ($methods as $method) {
if ($method->getName() === $functionName[1]) {
return $this->getDefaultParameterCompletion($method->getParameters());
}
}

return [];
}

public function hasMatched(array $tokens)
{
$openBracket = \array_pop($tokens);

if ($openBracket !== '(') {
return false;
}

$functionName = \array_pop($tokens);

if (!self::tokenIs($functionName, self::T_STRING)) {
return false;
}

$operator = \array_pop($tokens);

if (!self::tokenIs($operator, self::T_DOUBLE_COLON)) {
return false;
}

return true;
}
}
<?php










namespace Psy\TabCompletion;

use Psy\TabCompletion\Matcher\AbstractMatcher;






class AutoCompleter
{

protected $matchers;






public function addMatcher(AbstractMatcher $matcher)
{
$this->matchers[] = $matcher;
}




public function activate()
{
\readline_completion_function([&$this, 'callback']);
}










public function processCallback($input, $index, $info = [])
{

 
 $line = $info['line_buffer'];
if (isset($info['end'])) {
$line = \substr($line, 0, $info['end']);
}
if ($line === '' && $input !== '') {
$line = $input;
}

$tokens = \token_get_all('<?php ' . $line);


 $tokens = \array_filter($tokens, function ($token) {
return !AbstractMatcher::tokenIs($token, AbstractMatcher::T_WHITESPACE);
});

$matches = [];
foreach ($this->matchers as $matcher) {
if ($matcher->hasMatched($tokens)) {
$matches = \array_merge($matcher->getMatches($tokens), $matches);
}
}

$matches = \array_unique($matches);

return !empty($matches) ? $matches : [''];
}











public function callback($input, $index)
{
return $this->processCallback($input, $index, \readline_info());
}




public function __destruct()
{

 
 if (\function_exists('readline_callback_handler_remove')) {
\readline_callback_handler_remove();
}
}
}
<?php










namespace Psy\Sudo;

use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\StaticPropertyFetch;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified as FullyQualifiedName;
use PhpParser\Node\Scalar\String_;
use PhpParser\NodeVisitorAbstract;







class SudoVisitor extends NodeVisitorAbstract
{
const SUDO_CLASS = 'Psy\Sudo';

const PROPERTY_FETCH = 'fetchProperty';
const PROPERTY_ASSIGN = 'assignProperty';
const METHOD_CALL = 'callMethod';
const STATIC_PROPERTY_FETCH = 'fetchStaticProperty';
const STATIC_PROPERTY_ASSIGN = 'assignStaticProperty';
const STATIC_CALL = 'callStatic';
const CLASS_CONST_FETCH = 'fetchClassConst';




public function enterNode(Node $node)
{
if ($node instanceof PropertyFetch) {
$name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
$args = [
$node->var,
\is_string($name) ? new String_($name) : $name,
];

return $this->prepareCall(self::PROPERTY_FETCH, $args);
} elseif ($node instanceof Assign && $node->var instanceof PropertyFetch) {
$target = $node->var;
$name = $target->name instanceof Identifier ? $target->name->toString() : $target->name;
$args = [
$target->var,
\is_string($name) ? new String_($name) : $name,
$node->expr,
];

return $this->prepareCall(self::PROPERTY_ASSIGN, $args);
} elseif ($node instanceof MethodCall) {
$name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
$args = $node->args;
\array_unshift($args, new Arg(\is_string($name) ? new String_($name) : $name));
\array_unshift($args, new Arg($node->var));


 return new StaticCall(new FullyQualifiedName(self::SUDO_CLASS), self::METHOD_CALL, $args);
} elseif ($node instanceof StaticPropertyFetch) {
$class = $node->class instanceof Name ? $node->class->toString() : $node->class;
$name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
$args = [
\is_string($class) ? new String_($class) : $class,
\is_string($name) ? new String_($name) : $name,
];

return $this->prepareCall(self::STATIC_PROPERTY_FETCH, $args);
} elseif ($node instanceof Assign && $node->var instanceof StaticPropertyFetch) {
$target = $node->var;
$class = $target->class instanceof Name ? $target->class->toString() : $target->class;
$name = $target->name instanceof Identifier ? $target->name->toString() : $target->name;
$args = [
\is_string($class) ? new String_($class) : $class,
\is_string($name) ? new String_($name) : $name,
$node->expr,
];

return $this->prepareCall(self::STATIC_PROPERTY_ASSIGN, $args);
} elseif ($node instanceof StaticCall) {
$args = $node->args;
$class = $node->class instanceof Name ? $node->class->toString() : $node->class;
$name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
\array_unshift($args, new Arg(\is_string($name) ? new String_($name) : $name));
\array_unshift($args, new Arg(\is_string($class) ? new String_($class) : $class));


 return new StaticCall(new FullyQualifiedName(self::SUDO_CLASS), self::STATIC_CALL, $args);
} elseif ($node instanceof ClassConstFetch) {
$class = $node->class instanceof Name ? $node->class->toString() : $node->class;
$name = $node->name instanceof Identifier ? $node->name->toString() : $node->name;
$args = [
\is_string($class) ? new String_($class) : $class,
\is_string($name) ? new String_($name) : $name,
];

return $this->prepareCall(self::CLASS_CONST_FETCH, $args);
}
}

private function prepareCall($method, $args)
{
return new StaticCall(new FullyQualifiedName(self::SUDO_CLASS), $method, \array_map(function ($arg) {
return new Arg($arg);
}, $args));
}
}
<?php

namespace XdgBaseDir;






class Xdg
{
const S_IFDIR = 040000; 
 const S_IRWXO = 00007; 
 const S_IRWXG = 00056; 
 const RUNTIME_DIR_FALLBACK = 'php-xdg-runtime-dir-fallback-';




public function getHomeDir()
{
return getenv('HOME') ?: (getenv('HOMEDRIVE') . DIRECTORY_SEPARATOR . getenv('HOMEPATH'));
}




public function getHomeConfigDir()
{
if ($path = getenv('XDG_CONFIG_HOME')) {
return $path;
}

$homeDir = $this->getHomeDir();

$path = DIRECTORY_SEPARATOR === $homeDir ? $homeDir.'.config' : $homeDir . DIRECTORY_SEPARATOR . '.config';

return $path;
}




public function getHomeDataDir()
{
$path = getenv('XDG_DATA_HOME') ?: $this->getHomeDir() . DIRECTORY_SEPARATOR . '.local' . DIRECTORY_SEPARATOR . 'share';

return $path;
}




public function getConfigDirs()
{
$configDirs = getenv('XDG_CONFIG_DIRS') ? explode(':', getenv('XDG_CONFIG_DIRS')) : array('/etc/xdg');

$paths = array_merge(array($this->getHomeConfigDir()), $configDirs);

return $paths;
}




public function getDataDirs()
{
$dataDirs = getenv('XDG_DATA_DIRS') ? explode(':', getenv('XDG_DATA_DIRS')) : array('/usr/local/share', '/usr/share');

$paths = array_merge(array($this->getHomeDataDir()), $dataDirs);

return $paths;
}




public function getHomeCacheDir()
{
$path = getenv('XDG_CACHE_HOME') ?: $this->getHomeDir() . DIRECTORY_SEPARATOR . '.cache';

return $path;

}

public function getRuntimeDir($strict=true)
{
if ($runtimeDir = getenv('XDG_RUNTIME_DIR')) {
return $runtimeDir;
}

if ($strict) {
throw new \RuntimeException('XDG_RUNTIME_DIR was not set');
}

$fallback = sys_get_temp_dir() . DIRECTORY_SEPARATOR . self::RUNTIME_DIR_FALLBACK . getenv('USER');

$create = false;

if (!is_dir($fallback)) {
mkdir($fallback, 0700, true);
}

$st = lstat($fallback);


 if (!$st['mode'] & self::S_IFDIR) {
rmdir($fallback);
$create = true;
} elseif ($st['uid'] != $this->getUid() ||
$st['mode'] & (self::S_IRWXG | self::S_IRWXO)
) {
rmdir($fallback);
$create = true;
}

if ($create) {
mkdir($fallback, 0700, true);
}

return $fallback;
}

private function getUid()
{
if (function_exists('posix_getuid')) {
return posix_getuid();
}

return getmyuid();
}
}
<?php




namespace Psr\Container;




interface NotFoundExceptionInterface extends ContainerExceptionInterface
{
}
<?php




namespace Psr\Container;




interface ContainerInterface
{










public function get($id);












public function has($id);
}
<?php




namespace Psr\Container;




interface ContainerExceptionInterface
{
}
<?php

namespace Psr\Log;









class NullLogger extends AbstractLogger
{









public function log($level, $message, array $context = array())
{

 }
}
<?php

namespace Psr\Log;




trait LoggerAwareTrait
{





protected $logger;






public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}
<?php

namespace Psr\Log;




class LogLevel
{
const EMERGENCY = 'emergency';
const ALERT = 'alert';
const CRITICAL = 'critical';
const ERROR = 'error';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
const DEBUG = 'debug';
}
<?php

namespace Psr\Log;
















interface LoggerInterface
{








public function emergency($message, array $context = array());












public function alert($message, array $context = array());











public function critical($message, array $context = array());










public function error($message, array $context = array());












public function warning($message, array $context = array());









public function notice($message, array $context = array());











public function info($message, array $context = array());









public function debug($message, array $context = array());










public function log($level, $message, array $context = array());
}
<?php

namespace Psr\Log;




interface LoggerAwareInterface
{







public function setLogger(LoggerInterface $logger);
}
<?php

namespace Psr\Log;









trait LoggerTrait
{








public function emergency($message, array $context = array())
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}












public function alert($message, array $context = array())
{
$this->log(LogLevel::ALERT, $message, $context);
}











public function critical($message, array $context = array())
{
$this->log(LogLevel::CRITICAL, $message, $context);
}










public function error($message, array $context = array())
{
$this->log(LogLevel::ERROR, $message, $context);
}












public function warning($message, array $context = array())
{
$this->log(LogLevel::WARNING, $message, $context);
}









public function notice($message, array $context = array())
{
$this->log(LogLevel::NOTICE, $message, $context);
}











public function info($message, array $context = array())
{
$this->log(LogLevel::INFO, $message, $context);
}









public function debug($message, array $context = array())
{
$this->log(LogLevel::DEBUG, $message, $context);
}










abstract public function log($level, $message, array $context = array());
}
<?php

namespace Psr\Log;








abstract class AbstractLogger implements LoggerInterface
{








public function emergency($message, array $context = array())
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}












public function alert($message, array $context = array())
{
$this->log(LogLevel::ALERT, $message, $context);
}











public function critical($message, array $context = array())
{
$this->log(LogLevel::CRITICAL, $message, $context);
}










public function error($message, array $context = array())
{
$this->log(LogLevel::ERROR, $message, $context);
}












public function warning($message, array $context = array())
{
$this->log(LogLevel::WARNING, $message, $context);
}









public function notice($message, array $context = array())
{
$this->log(LogLevel::NOTICE, $message, $context);
}











public function info($message, array $context = array())
{
$this->log(LogLevel::INFO, $message, $context);
}









public function debug($message, array $context = array())
{
$this->log(LogLevel::DEBUG, $message, $context);
}
}
<?php

namespace Psr\Log;

class InvalidArgumentException extends \InvalidArgumentException
{
}
<?php

$grammarFileToName = [
__DIR__ . '/php5.y' => 'Php5',
__DIR__ . '/php7.y' => 'Php7',
];

$tokensFile = __DIR__ . '/tokens.y';
$tokensTemplate = __DIR__ . '/tokens.template';
$skeletonFile = __DIR__ . '/parser.template';
$tmpGrammarFile = __DIR__ . '/tmp_parser.phpy';
$tmpResultFile = __DIR__ . '/tmp_parser.php';
$resultDir = __DIR__ . '/../lib/PhpParser/Parser';
$tokensResultsFile = $resultDir . '/Tokens.php';


$kmyacc = __DIR__ . '/kmyacc.exe';
if (!file_exists($kmyacc)) {
$kmyacc = 'kmyacc';
}

$options = array_flip($argv);
$optionDebug = isset($options['--debug']);
$optionKeepTmpGrammar = isset($options['--keep-tmp-grammar']);





const LIB = '(?(DEFINE)
    (?<singleQuotedString>\'[^\\\\\']*+(?:\\\\.[^\\\\\']*+)*+\')
    (?<doubleQuotedString>"[^\\\\"]*+(?:\\\\.[^\\\\"]*+)*+")
    (?<string>(?&singleQuotedString)|(?&doubleQuotedString))
    (?<comment>/\*[^*]*+(?:\*(?!/)[^*]*+)*+\*/)
    (?<code>\{[^\'"/{}]*+(?:(?:(?&string)|(?&comment)|(?&code)|/)[^\'"/{}]*+)*+})
)';

const PARAMS = '\[(?<params>[^[\]]*+(?:\[(?&params)\][^[\]]*+)*+)\]';
const ARGS = '\((?<args>[^()]*+(?:\((?&args)\)[^()]*+)*+)\)';





$tokens = file_get_contents($tokensFile);

foreach ($grammarFileToName as $grammarFile => $name) {
echo "Building temporary $name grammar file.\n";

$grammarCode = file_get_contents($grammarFile);
$grammarCode = str_replace('%tokens', $tokens, $grammarCode);

$grammarCode = resolveNodes($grammarCode);
$grammarCode = resolveMacros($grammarCode);
$grammarCode = resolveStackAccess($grammarCode);

file_put_contents($tmpGrammarFile, $grammarCode);

$additionalArgs = $optionDebug ? '-t -v' : '';

echo "Building $name parser.\n";
$output = trim(shell_exec("$kmyacc $additionalArgs -l -m $skeletonFile -p $name $tmpGrammarFile 2>&1"));
echo "Output: \"$output\"\n";

$resultCode = file_get_contents($tmpResultFile);
$resultCode = removeTrailingWhitespace($resultCode);

ensureDirExists($resultDir);
file_put_contents("$resultDir/$name.php", $resultCode);
unlink($tmpResultFile);

echo "Building token definition.\n";
$output = trim(shell_exec("$kmyacc -l -m $tokensTemplate $tmpGrammarFile 2>&1"));
assert($output === '');
rename($tmpResultFile, $tokensResultsFile);

if (!$optionKeepTmpGrammar) {
unlink($tmpGrammarFile);
}
}





function resolveNodes($code) {
return preg_replace_callback(
'~\b(?<name>[A-Z][a-zA-Z_\\\\]++)\s*' . PARAMS . '~',
function($matches) {

 $matches['params'] = resolveNodes($matches['params']);

$params = magicSplit(
'(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,',
$matches['params']
);

$paramCode = '';
foreach ($params as $param) {
$paramCode .= $param . ', ';
}

return 'new ' . $matches['name'] . '(' . $paramCode . 'attributes())';
},
$code
);
}

function resolveMacros($code) {
return preg_replace_callback(
'~\b(?<!::|->)(?!array\()(?<name>[a-z][A-Za-z]++)' . ARGS . '~',
function($matches) {

 $matches['args'] = resolveMacros($matches['args']);

$name = $matches['name'];
$args = magicSplit(
'(?:' . PARAMS . '|' . ARGS . ')(*SKIP)(*FAIL)|,',
$matches['args']
);

if ('attributes' == $name) {
assertArgs(0, $args, $name);
return '$this->startAttributeStack[#1] + $this->endAttributes';
}

if ('stackAttributes' == $name) {
assertArgs(1, $args, $name);
return '$this->startAttributeStack[' . $args[0] . ']'
. ' + $this->endAttributeStack[' . $args[0] . ']';
}

if ('init' == $name) {
return '$$ = array(' . implode(', ', $args) . ')';
}

if ('push' == $name) {
assertArgs(2, $args, $name);

return $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0];
}

if ('pushNormalizing' == $name) {
assertArgs(2, $args, $name);

return 'if (is_array(' . $args[1] . ')) { $$ = array_merge(' . $args[0] . ', ' . $args[1] . '); }'
. ' else { ' . $args[0] . '[] = ' . $args[1] . '; $$ = ' . $args[0] . '; }';
}

if ('toArray' == $name) {
assertArgs(1, $args, $name);

return 'is_array(' . $args[0] . ') ? ' . $args[0] . ' : array(' . $args[0] . ')';
}

if ('parseVar' == $name) {
assertArgs(1, $args, $name);

return 'substr(' . $args[0] . ', 1)';
}

if ('parseEncapsed' == $name) {
assertArgs(3, $args, $name);

return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {'
. ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, ' . $args[1] . ', ' . $args[2] . '); } }';
}

if ('parseEncapsedDoc' == $name) {
assertArgs(2, $args, $name);

return 'foreach (' . $args[0] . ' as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) {'
. ' $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, ' . $args[1] . '); } }'
. ' $s->value = preg_replace(\'~(\r\n|\n|\r)\z~\', \'\', $s->value);'
. ' if (\'\' === $s->value) array_pop(' . $args[0] . ');';
}

if ('makeNop' == $name) {
assertArgs(2, $args, $name);

return '$startAttributes = ' . $args[1] . ';'
. ' if (isset($startAttributes[\'comments\']))'
. ' { ' . $args[0] . ' = new Stmt\Nop([\'comments\' => $startAttributes[\'comments\']]); }'
. ' else { ' . $args[0] . ' = null; }';
}

if ('strKind' == $name) {
assertArgs(1, $args, $name);

return '(' . $args[0] . '[0] === "\'" || (' . $args[0] . '[1] === "\'" && '
. '(' . $args[0] . '[0] === \'b\' || ' . $args[0] . '[0] === \'B\')) '
. '? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED)';
}

if ('setDocStringAttrs' == $name) {
assertArgs(2, $args, $name);

return $args[0] . '[\'kind\'] = strpos(' . $args[1] . ', "\'") === false '
. '? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; '
. 'preg_match(\'/\A[bB]?<<<[ \t]*[\\\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\\\'"]?(?:\r\n|\n|\r)\z/\', ' . $args[1] . ', $matches); '
. $args[0] . '[\'docLabel\'] = $matches[1];';
}

if ('prependLeadingComments' == $name) {
assertArgs(1, $args, $name);

return '$attrs = $this->startAttributeStack[#1]; $stmts = ' . $args[0] . '; '
. 'if (!empty($attrs[\'comments\'])) {'
. '$stmts[0]->setAttribute(\'comments\', '
. 'array_merge($attrs[\'comments\'], $stmts[0]->getAttribute(\'comments\', []))); }';
}

return $matches[0];
},
$code
);
}

function assertArgs($num, $args, $name) {
if ($num != count($args)) {
die('Wrong argument count for ' . $name . '().');
}
}

function resolveStackAccess($code) {
$code = preg_replace('/\$\d+/', '$this->semStack[$0]', $code);
$code = preg_replace('/#(\d+)/', '$$1', $code);
return $code;
}

function removeTrailingWhitespace($code) {
$lines = explode("\n", $code);
$lines = array_map('rtrim', $lines);
return implode("\n", $lines);
}

function ensureDirExists($dir) {
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
}





function regex($regex) {
return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~';
}

function magicSplit($regex, $string) {
$pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string);

foreach ($pieces as &$piece) {
$piece = trim($piece);
}

if ($pieces === ['']) {
return [];
}

return $pieces;
}
<?php

if (!class_exists('PhpParser\Autoloader')) {
require __DIR__ . '/PhpParser/Autoloader.php';
}
PhpParser\Autoloader::register();
<?php

namespace PhpParser;

use PhpParser\Parser\Tokens;

class Lexer
{
protected $code;
protected $tokens;
protected $pos;
protected $line;
protected $filePos;
protected $prevCloseTagHasNewline;

protected $tokenMap;
protected $dropTokens;

protected $usedAttributes;










public function __construct(array $options = array()) {

 $this->tokenMap = $this->createTokenMap();


 
 $this->dropTokens = array_fill_keys(
array(T_WHITESPACE, T_OPEN_TAG, T_COMMENT, T_DOC_COMMENT), 1
);


 
 $options += array(
'usedAttributes' => array('comments', 'startLine', 'endLine'),
);
$this->usedAttributes = array_fill_keys($options['usedAttributes'], true);
}











public function startLexing($code, ErrorHandler $errorHandler = null) {
if (null === $errorHandler) {
$errorHandler = new ErrorHandler\Throwing();
}

$this->code = $code; 
 $this->pos = -1;
$this->line = 1;
$this->filePos = 0;


 
 $this->prevCloseTagHasNewline = true;

$scream = ini_set('xdebug.scream', '0');

$this->resetErrors();
$this->tokens = @token_get_all($code);
$this->handleErrors($errorHandler);

if (false !== $scream) {
ini_set('xdebug.scream', $scream);
}
}

protected function resetErrors() {
if (function_exists('error_clear_last')) {
error_clear_last();
} else {

 set_error_handler(function() { return false; }, 0);
@$undefinedVariable;
restore_error_handler();
}
}

private function handleInvalidCharacterRange($start, $end, $line, ErrorHandler $errorHandler) {
for ($i = $start; $i < $end; $i++) {
$chr = $this->code[$i];
if ($chr === 'b' || $chr === 'B') {

 continue;
}

if ($chr === "\0") {

 $errorMsg = 'Unexpected null byte';
} else {
$errorMsg = sprintf(
'Unexpected character "%s" (ASCII %d)', $chr, ord($chr)
);
}

$errorHandler->handleError(new Error($errorMsg, [
'startLine' => $line,
'endLine' => $line,
'startFilePos' => $i,
'endFilePos' => $i,
]));
}
}

private function isUnterminatedComment($token) {
return ($token[0] === T_COMMENT || $token[0] === T_DOC_COMMENT)
&& substr($token[1], 0, 2) === '/*'
&& substr($token[1], -2) !== '*/';
}

private function errorMayHaveOccurred() {
if (defined('HHVM_VERSION')) {

 
 return true;
}

$error = error_get_last();
return null !== $error
&& false === strpos($error['message'], 'Undefined variable');
}

protected function handleErrors(ErrorHandler $errorHandler) {
if (!$this->errorMayHaveOccurred()) {
return;
}


 
 
 

$filePos = 0;
$line = 1;
foreach ($this->tokens as $i => $token) {
$tokenValue = \is_string($token) ? $token : $token[1];
$tokenLen = \strlen($tokenValue);

if (substr($this->code, $filePos, $tokenLen) !== $tokenValue) {

 $nextFilePos = strpos($this->code, $tokenValue, $filePos);
$this->handleInvalidCharacterRange(
$filePos, $nextFilePos, $line, $errorHandler);
$filePos = $nextFilePos;
}

$filePos += $tokenLen;
$line += substr_count($tokenValue, "\n");
}

if ($filePos !== \strlen($this->code)) {
if (substr($this->code, $filePos, 2) === '/*') {

 $comment = substr($this->code, $filePos);
$errorHandler->handleError(new Error('Unterminated comment', [
'startLine' => $line,
'endLine' => $line + substr_count($comment, "\n"),
'startFilePos' => $filePos,
'endFilePos' => $filePos + \strlen($comment),
]));


 $isDocComment = isset($comment[3]) && $comment[3] === '*';
$this->tokens[] = [$isDocComment ? T_DOC_COMMENT : T_COMMENT, $comment, $line];
} else {

 $this->handleInvalidCharacterRange(
$filePos, \strlen($this->code), $line, $errorHandler);
}
return;
}

if (count($this->tokens) > 0) {

 $lastToken = $this->tokens[count($this->tokens) - 1];
if ($this->isUnterminatedComment($lastToken)) {
$errorHandler->handleError(new Error('Unterminated comment', [
'startLine' => $line - substr_count($lastToken[1], "\n"),
'endLine' => $line,
'startFilePos' => $filePos - \strlen($lastToken[1]),
'endFilePos' => $filePos,
]));
}
}
}























public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) {
$startAttributes = array();
$endAttributes = array();

while (1) {
if (isset($this->tokens[++$this->pos])) {
$token = $this->tokens[$this->pos];
} else {

 $token = "\0";
}

if (isset($this->usedAttributes['startLine'])) {
$startAttributes['startLine'] = $this->line;
}
if (isset($this->usedAttributes['startTokenPos'])) {
$startAttributes['startTokenPos'] = $this->pos;
}
if (isset($this->usedAttributes['startFilePos'])) {
$startAttributes['startFilePos'] = $this->filePos;
}

if (\is_string($token)) {
$value = $token;
if (isset($token[1])) {

 $this->filePos += 2;
$id = ord('"');
} else {
$this->filePos += 1;
$id = ord($token);
}
} elseif (!isset($this->dropTokens[$token[0]])) {
$value = $token[1];
$id = $this->tokenMap[$token[0]];
if (T_CLOSE_TAG === $token[0]) {
$this->prevCloseTagHasNewline = false !== strpos($token[1], "\n");
} else if (T_INLINE_HTML === $token[0]) {
$startAttributes['hasLeadingNewline'] = $this->prevCloseTagHasNewline;
}

$this->line += substr_count($value, "\n");
$this->filePos += \strlen($value);
} else {
if (T_COMMENT === $token[0] || T_DOC_COMMENT === $token[0]) {
if (isset($this->usedAttributes['comments'])) {
$comment = T_DOC_COMMENT === $token[0]
? new Comment\Doc($token[1], $this->line, $this->filePos)
: new Comment($token[1], $this->line, $this->filePos);
$startAttributes['comments'][] = $comment;
}
}

$this->line += substr_count($token[1], "\n");
$this->filePos += \strlen($token[1]);
continue;
}

if (isset($this->usedAttributes['endLine'])) {
$endAttributes['endLine'] = $this->line;
}
if (isset($this->usedAttributes['endTokenPos'])) {
$endAttributes['endTokenPos'] = $this->pos;
}
if (isset($this->usedAttributes['endFilePos'])) {
$endAttributes['endFilePos'] = $this->filePos - 1;
}

return $id;
}

throw new \RuntimeException('Reached end of lexer loop');
}











public function getTokens() {
return $this->tokens;
}






public function handleHaltCompiler() {

 $textAfter = substr($this->code, $this->filePos);


 
 
 if (!preg_match('~^\s*\(\s*\)\s*(?:;|\?>\r?\n?)~', $textAfter, $matches)) {
throw new Error('__HALT_COMPILER must be followed by "();"');
}


 $this->pos = count($this->tokens);


 return (string) substr($textAfter, strlen($matches[0])); 
 }










protected function createTokenMap() {
$tokenMap = array();


 
 for ($i = 256; $i < 1000; ++$i) {
if (T_DOUBLE_COLON === $i) {

 $tokenMap[$i] = Tokens::T_PAAMAYIM_NEKUDOTAYIM;
} elseif(T_OPEN_TAG_WITH_ECHO === $i) {

 $tokenMap[$i] = Tokens::T_ECHO;
} elseif(T_CLOSE_TAG === $i) {

 $tokenMap[$i] = ord(';');
} elseif ('UNKNOWN' !== $name = token_name($i)) {
if ('T_HASHBANG' === $name) {

 $tokenMap[$i] = Tokens::T_INLINE_HTML;
} else if (defined($name = Tokens::class . '::' . $name)) {

 $tokenMap[$i] = constant($name);
}
}
}


 if (defined('T_ONUMBER')) {
$tokenMap[T_ONUMBER] = Tokens::T_DNUMBER;
}

 if (defined('T_COMPILER_HALT_OFFSET')) {
$tokenMap[T_COMPILER_HALT_OFFSET] = Tokens::T_STRING;
}

return $tokenMap;
}
}
<?php

namespace PhpParser\Lexer;

use PhpParser\ErrorHandler;
use PhpParser\Parser\Tokens;

class Emulative extends \PhpParser\Lexer
{
protected $newKeywords;
protected $inObjectAccess;

const T_ELLIPSIS = 1001;
const T_POW = 1002;
const T_POW_EQUAL = 1003;
const T_COALESCE = 1004;
const T_SPACESHIP = 1005;
const T_YIELD_FROM = 1006;

const PHP_7_0 = '7.0.0dev';
const PHP_5_6 = '5.6.0rc1';

public function __construct(array $options = array()) {
parent::__construct($options);

$newKeywordsPerVersion = array(

 );

$this->newKeywords = array();
foreach ($newKeywordsPerVersion as $version => $newKeywords) {
if (version_compare(PHP_VERSION, $version, '>=')) {
break;
}

$this->newKeywords += $newKeywords;
}

if (version_compare(PHP_VERSION, self::PHP_7_0, '>=')) {
return;
}
$this->tokenMap[self::T_COALESCE] = Tokens::T_COALESCE;
$this->tokenMap[self::T_SPACESHIP] = Tokens::T_SPACESHIP;
$this->tokenMap[self::T_YIELD_FROM] = Tokens::T_YIELD_FROM;

if (version_compare(PHP_VERSION, self::PHP_5_6, '>=')) {
return;
}
$this->tokenMap[self::T_ELLIPSIS] = Tokens::T_ELLIPSIS;
$this->tokenMap[self::T_POW] = Tokens::T_POW;
$this->tokenMap[self::T_POW_EQUAL] = Tokens::T_POW_EQUAL;
}

public function startLexing($code, ErrorHandler $errorHandler = null) {
$this->inObjectAccess = false;

parent::startLexing($code, $errorHandler);
if ($this->requiresEmulation($code)) {
$this->emulateTokens();
}
}




protected function requiresEmulation($code) {
if (version_compare(PHP_VERSION, self::PHP_7_0, '>=')) {
return false;
}

if (preg_match('(\?\?|<=>|yield[ \n\r\t]+from)', $code)) {
return true;
}

if (version_compare(PHP_VERSION, self::PHP_5_6, '>=')) {
return false;
}

return preg_match('(\.\.\.|(?<!/)\*\*(?!/))', $code);
}




protected function emulateTokens() {

 
 $line = 1;
for ($i = 0, $c = count($this->tokens); $i < $c; ++$i) {
$replace = null;
if (isset($this->tokens[$i + 1])) {
if ($this->tokens[$i] === '?' && $this->tokens[$i + 1] === '?') {
array_splice($this->tokens, $i, 2, array(
array(self::T_COALESCE, '??', $line)
));
$c--;
continue;
}
if ($this->tokens[$i][0] === T_IS_SMALLER_OR_EQUAL
&& $this->tokens[$i + 1] === '>'
) {
array_splice($this->tokens, $i, 2, array(
array(self::T_SPACESHIP, '<=>', $line)
));
$c--;
continue;
}
if ($this->tokens[$i] === '*' && $this->tokens[$i + 1] === '*') {
array_splice($this->tokens, $i, 2, array(
array(self::T_POW, '**', $line)
));
$c--;
continue;
}
if ($this->tokens[$i] === '*' && $this->tokens[$i + 1][0] === T_MUL_EQUAL) {
array_splice($this->tokens, $i, 2, array(
array(self::T_POW_EQUAL, '**=', $line)
));
$c--;
continue;
}
}

if (isset($this->tokens[$i + 2])) {
if ($this->tokens[$i][0] === T_YIELD && $this->tokens[$i + 1][0] === T_WHITESPACE
&& $this->tokens[$i + 2][0] === T_STRING
&& !strcasecmp($this->tokens[$i + 2][1], 'from')
) {
array_splice($this->tokens, $i, 3, array(
array(
self::T_YIELD_FROM,
$this->tokens[$i][1] . $this->tokens[$i + 1][1] . $this->tokens[$i + 2][1],
$line
)
));
$c -= 2;
$line += substr_count($this->tokens[$i][1], "\n");
continue;
}
if ($this->tokens[$i] === '.' && $this->tokens[$i + 1] === '.'
&& $this->tokens[$i + 2] === '.'
) {
array_splice($this->tokens, $i, 3, array(
array(self::T_ELLIPSIS, '...', $line)
));
$c -= 2;
continue;
}
}

if (\is_array($this->tokens[$i])) {
$line += substr_count($this->tokens[$i][1], "\n");
}
}
}

public function getNextToken(&$value = null, &$startAttributes = null, &$endAttributes = null) {
$token = parent::getNextToken($value, $startAttributes, $endAttributes);


 
 
 if (Tokens::T_STRING === $token && !$this->inObjectAccess) {
if (isset($this->newKeywords[strtolower($value)])) {
return $this->newKeywords[strtolower($value)];
}
} else {

 $this->inObjectAccess = Tokens::T_OBJECT_OPERATOR === $token;
}

return $token;
}
}
<?php

namespace PhpParser;

interface Builder
{





public function getNode();
}<?php

namespace PhpParser\Serializer;

use PhpParser\Comment;
use PhpParser\Node;
use PhpParser\Serializer;
use XMLWriter;




class XML implements Serializer
{
protected $writer;




public function __construct() {
$this->writer = new XMLWriter;
$this->writer->openMemory();
$this->writer->setIndent(true);
}

public function serialize(array $nodes) {
$this->writer->flush();
$this->writer->startDocument('1.0', 'UTF-8');

$this->writer->startElement('AST');
$this->writer->writeAttribute('xmlns:node', 'http://nikic.github.com/PHPParser/XML/node');
$this->writer->writeAttribute('xmlns:subNode', 'http://nikic.github.com/PHPParser/XML/subNode');
$this->writer->writeAttribute('xmlns:attribute', 'http://nikic.github.com/PHPParser/XML/attribute');
$this->writer->writeAttribute('xmlns:scalar', 'http://nikic.github.com/PHPParser/XML/scalar');

$this->_serialize($nodes);

$this->writer->endElement();

return $this->writer->outputMemory();
}

protected function _serialize($node) {
if ($node instanceof Node) {
$this->writer->startElement('node:' . $node->getType());

foreach ($node->getAttributes() as $name => $value) {
$this->writer->startElement('attribute:' . $name);
$this->_serialize($value);
$this->writer->endElement();
}

foreach ($node as $name => $subNode) {
$this->writer->startElement('subNode:' . $name);
$this->_serialize($subNode);
$this->writer->endElement();
}

$this->writer->endElement();
} elseif ($node instanceof Comment) {
$this->writer->startElement('comment');
$this->writer->writeAttribute('isDocComment', $node instanceof Comment\Doc ? 'true' : 'false');
$this->writer->writeAttribute('line', (string) $node->getLine());
$this->writer->text($node->getText());
$this->writer->endElement();
} elseif (is_array($node)) {
$this->writer->startElement('scalar:array');
foreach ($node as $subNode) {
$this->_serialize($subNode);
}
$this->writer->endElement();
} elseif (is_string($node)) {
$this->writer->writeElement('scalar:string', $node);
} elseif (is_int($node)) {
$this->writer->writeElement('scalar:int', (string) $node);
} elseif (is_float($node)) {

 $this->writer->writeElement('scalar:float', (string) $node);
} elseif (true === $node) {
$this->writer->writeElement('scalar:true');
} elseif (false === $node) {
$this->writer->writeElement('scalar:false');
} elseif (null === $node) {
$this->writer->writeElement('scalar:null');
} else {
throw new \InvalidArgumentException('Unexpected node type');
}
}
}
<?php

namespace PhpParser;




class NodeVisitorAbstract implements NodeVisitor
{
public function beforeTraverse(array $nodes) { }
public function enterNode(Node $node) { }
public function leaveNode(Node $node) { }
public function afterTraverse(array $nodes) { }
}<?php

namespace PhpParser\PrettyPrinter;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\AssignOp;
use PhpParser\Node\Expr\BinaryOp;
use PhpParser\Node\Expr\Cast;
use PhpParser\Node\Name;
use PhpParser\Node\Scalar;
use PhpParser\Node\Scalar\MagicConst;
use PhpParser\Node\Stmt;
use PhpParser\PrettyPrinterAbstract;

class Standard extends PrettyPrinterAbstract
{


protected function pParam(Node\Param $node) {
return ($node->type ? $this->pType($node->type) . ' ' : '')
. ($node->byRef ? '&' : '')
. ($node->variadic ? '...' : '')
. '$' . $node->name
. ($node->default ? ' = ' . $this->p($node->default) : '');
}

protected function pArg(Node\Arg $node) {
return ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '') . $this->p($node->value);
}

protected function pConst(Node\Const_ $node) {
return $node->name . ' = ' . $this->p($node->value);
}

protected function pNullableType(Node\NullableType $node) {
return '?' . $this->pType($node->type);
}



protected function pName(Name $node) {
return implode('\\', $node->parts);
}

protected function pName_FullyQualified(Name\FullyQualified $node) {
return '\\' . implode('\\', $node->parts);
}

protected function pName_Relative(Name\Relative $node) {
return 'namespace\\' . implode('\\', $node->parts);
}



protected function pScalar_MagicConst_Class(MagicConst\Class_ $node) {
return '__CLASS__';
}

protected function pScalar_MagicConst_Dir(MagicConst\Dir $node) {
return '__DIR__';
}

protected function pScalar_MagicConst_File(MagicConst\File $node) {
return '__FILE__';
}

protected function pScalar_MagicConst_Function(MagicConst\Function_ $node) {
return '__FUNCTION__';
}

protected function pScalar_MagicConst_Line(MagicConst\Line $node) {
return '__LINE__';
}

protected function pScalar_MagicConst_Method(MagicConst\Method $node) {
return '__METHOD__';
}

protected function pScalar_MagicConst_Namespace(MagicConst\Namespace_ $node) {
return '__NAMESPACE__';
}

protected function pScalar_MagicConst_Trait(MagicConst\Trait_ $node) {
return '__TRAIT__';
}



protected function pScalar_String(Scalar\String_ $node) {
$kind = $node->getAttribute('kind', Scalar\String_::KIND_SINGLE_QUOTED);
switch ($kind) {
case Scalar\String_::KIND_NOWDOC:
$label = $node->getAttribute('docLabel');
if ($label && !$this->containsEndLabel($node->value, $label)) {
if ($node->value === '') {
return $this->pNoIndent("<<<'$label'\n$label") . $this->docStringEndToken;
}

return $this->pNoIndent("<<<'$label'\n$node->value\n$label")
. $this->docStringEndToken;
}

case Scalar\String_::KIND_SINGLE_QUOTED:
return '\'' . $this->pNoIndent(addcslashes($node->value, '\'\\')) . '\'';
case Scalar\String_::KIND_HEREDOC:
$label = $node->getAttribute('docLabel');
if ($label && !$this->containsEndLabel($node->value, $label)) {
if ($node->value === '') {
return $this->pNoIndent("<<<$label\n$label") . $this->docStringEndToken;
}

$escaped = $this->escapeString($node->value, null);
return $this->pNoIndent("<<<$label\n" . $escaped ."\n$label")
. $this->docStringEndToken;
}

case Scalar\String_::KIND_DOUBLE_QUOTED:
return '"' . $this->escapeString($node->value, '"') . '"';
}
throw new \Exception('Invalid string kind');
}

protected function pScalar_Encapsed(Scalar\Encapsed $node) {
if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) {
$label = $node->getAttribute('docLabel');
if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) {
if (count($node->parts) === 1
&& $node->parts[0] instanceof Scalar\EncapsedStringPart
&& $node->parts[0]->value === ''
) {
return $this->pNoIndent("<<<$label\n$label") . $this->docStringEndToken;
}

return $this->pNoIndent(
"<<<$label\n" . $this->pEncapsList($node->parts, null) . "\n$label"
) . $this->docStringEndToken;
}
}
return '"' . $this->pEncapsList($node->parts, '"') . '"';
}

protected function pScalar_LNumber(Scalar\LNumber $node) {
if ($node->value === -\PHP_INT_MAX-1) {

 
 return '(-' . \PHP_INT_MAX . '-1)';
}

$kind = $node->getAttribute('kind', Scalar\LNumber::KIND_DEC);
if (Scalar\LNumber::KIND_DEC === $kind) {
return (string) $node->value;
}

$sign = $node->value < 0 ? '-' : '';
$str = (string) $node->value;
switch ($kind) {
case Scalar\LNumber::KIND_BIN:
return $sign . '0b' . base_convert($str, 10, 2);
case Scalar\LNumber::KIND_OCT:
return $sign . '0' . base_convert($str, 10, 8);
case Scalar\LNumber::KIND_HEX:
return $sign . '0x' . base_convert($str, 10, 16);
}
throw new \Exception('Invalid number kind');
}

protected function pScalar_DNumber(Scalar\DNumber $node) {
if (!is_finite($node->value)) {
if ($node->value === \INF) {
return '\INF';
} elseif ($node->value === -\INF) {
return '-\INF';
} else {
return '\NAN';
}
}


 $stringValue = sprintf('%.16G', $node->value);
if ($node->value !== (double) $stringValue) {
$stringValue = sprintf('%.17G', $node->value);
}


 
 
 $stringValue = str_replace(',', '.', $stringValue);


 return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue;
}



protected function pExpr_Assign(Expr\Assign $node) {
return $this->pInfixOp('Expr_Assign', $node->var, ' = ', $node->expr);
}

protected function pExpr_AssignRef(Expr\AssignRef $node) {
return $this->pInfixOp('Expr_AssignRef', $node->var, ' =& ', $node->expr);
}

protected function pExpr_AssignOp_Plus(AssignOp\Plus $node) {
return $this->pInfixOp('Expr_AssignOp_Plus', $node->var, ' += ', $node->expr);
}

protected function pExpr_AssignOp_Minus(AssignOp\Minus $node) {
return $this->pInfixOp('Expr_AssignOp_Minus', $node->var, ' -= ', $node->expr);
}

protected function pExpr_AssignOp_Mul(AssignOp\Mul $node) {
return $this->pInfixOp('Expr_AssignOp_Mul', $node->var, ' *= ', $node->expr);
}

protected function pExpr_AssignOp_Div(AssignOp\Div $node) {
return $this->pInfixOp('Expr_AssignOp_Div', $node->var, ' /= ', $node->expr);
}

protected function pExpr_AssignOp_Concat(AssignOp\Concat $node) {
return $this->pInfixOp('Expr_AssignOp_Concat', $node->var, ' .= ', $node->expr);
}

protected function pExpr_AssignOp_Mod(AssignOp\Mod $node) {
return $this->pInfixOp('Expr_AssignOp_Mod', $node->var, ' %= ', $node->expr);
}

protected function pExpr_AssignOp_BitwiseAnd(AssignOp\BitwiseAnd $node) {
return $this->pInfixOp('Expr_AssignOp_BitwiseAnd', $node->var, ' &= ', $node->expr);
}

protected function pExpr_AssignOp_BitwiseOr(AssignOp\BitwiseOr $node) {
return $this->pInfixOp('Expr_AssignOp_BitwiseOr', $node->var, ' |= ', $node->expr);
}

protected function pExpr_AssignOp_BitwiseXor(AssignOp\BitwiseXor $node) {
return $this->pInfixOp('Expr_AssignOp_BitwiseXor', $node->var, ' ^= ', $node->expr);
}

protected function pExpr_AssignOp_ShiftLeft(AssignOp\ShiftLeft $node) {
return $this->pInfixOp('Expr_AssignOp_ShiftLeft', $node->var, ' <<= ', $node->expr);
}

protected function pExpr_AssignOp_ShiftRight(AssignOp\ShiftRight $node) {
return $this->pInfixOp('Expr_AssignOp_ShiftRight', $node->var, ' >>= ', $node->expr);
}

protected function pExpr_AssignOp_Pow(AssignOp\Pow $node) {
return $this->pInfixOp('Expr_AssignOp_Pow', $node->var, ' **= ', $node->expr);
}



protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node) {
return $this->pInfixOp('Expr_BinaryOp_Plus', $node->left, ' + ', $node->right);
}

protected function pExpr_BinaryOp_Minus(BinaryOp\Minus $node) {
return $this->pInfixOp('Expr_BinaryOp_Minus', $node->left, ' - ', $node->right);
}

protected function pExpr_BinaryOp_Mul(BinaryOp\Mul $node) {
return $this->pInfixOp('Expr_BinaryOp_Mul', $node->left, ' * ', $node->right);
}

protected function pExpr_BinaryOp_Div(BinaryOp\Div $node) {
return $this->pInfixOp('Expr_BinaryOp_Div', $node->left, ' / ', $node->right);
}

protected function pExpr_BinaryOp_Concat(BinaryOp\Concat $node) {
return $this->pInfixOp('Expr_BinaryOp_Concat', $node->left, ' . ', $node->right);
}

protected function pExpr_BinaryOp_Mod(BinaryOp\Mod $node) {
return $this->pInfixOp('Expr_BinaryOp_Mod', $node->left, ' % ', $node->right);
}

protected function pExpr_BinaryOp_BooleanAnd(BinaryOp\BooleanAnd $node) {
return $this->pInfixOp('Expr_BinaryOp_BooleanAnd', $node->left, ' && ', $node->right);
}

protected function pExpr_BinaryOp_BooleanOr(BinaryOp\BooleanOr $node) {
return $this->pInfixOp('Expr_BinaryOp_BooleanOr', $node->left, ' || ', $node->right);
}

protected function pExpr_BinaryOp_BitwiseAnd(BinaryOp\BitwiseAnd $node) {
return $this->pInfixOp('Expr_BinaryOp_BitwiseAnd', $node->left, ' & ', $node->right);
}

protected function pExpr_BinaryOp_BitwiseOr(BinaryOp\BitwiseOr $node) {
return $this->pInfixOp('Expr_BinaryOp_BitwiseOr', $node->left, ' | ', $node->right);
}

protected function pExpr_BinaryOp_BitwiseXor(BinaryOp\BitwiseXor $node) {
return $this->pInfixOp('Expr_BinaryOp_BitwiseXor', $node->left, ' ^ ', $node->right);
}

protected function pExpr_BinaryOp_ShiftLeft(BinaryOp\ShiftLeft $node) {
return $this->pInfixOp('Expr_BinaryOp_ShiftLeft', $node->left, ' << ', $node->right);
}

protected function pExpr_BinaryOp_ShiftRight(BinaryOp\ShiftRight $node) {
return $this->pInfixOp('Expr_BinaryOp_ShiftRight', $node->left, ' >> ', $node->right);
}

protected function pExpr_BinaryOp_Pow(BinaryOp\Pow $node) {
return $this->pInfixOp('Expr_BinaryOp_Pow', $node->left, ' ** ', $node->right);
}

protected function pExpr_BinaryOp_LogicalAnd(BinaryOp\LogicalAnd $node) {
return $this->pInfixOp('Expr_BinaryOp_LogicalAnd', $node->left, ' and ', $node->right);
}

protected function pExpr_BinaryOp_LogicalOr(BinaryOp\LogicalOr $node) {
return $this->pInfixOp('Expr_BinaryOp_LogicalOr', $node->left, ' or ', $node->right);
}

protected function pExpr_BinaryOp_LogicalXor(BinaryOp\LogicalXor $node) {
return $this->pInfixOp('Expr_BinaryOp_LogicalXor', $node->left, ' xor ', $node->right);
}

protected function pExpr_BinaryOp_Equal(BinaryOp\Equal $node) {
return $this->pInfixOp('Expr_BinaryOp_Equal', $node->left, ' == ', $node->right);
}

protected function pExpr_BinaryOp_NotEqual(BinaryOp\NotEqual $node) {
return $this->pInfixOp('Expr_BinaryOp_NotEqual', $node->left, ' != ', $node->right);
}

protected function pExpr_BinaryOp_Identical(BinaryOp\Identical $node) {
return $this->pInfixOp('Expr_BinaryOp_Identical', $node->left, ' === ', $node->right);
}

protected function pExpr_BinaryOp_NotIdentical(BinaryOp\NotIdentical $node) {
return $this->pInfixOp('Expr_BinaryOp_NotIdentical', $node->left, ' !== ', $node->right);
}

protected function pExpr_BinaryOp_Spaceship(BinaryOp\Spaceship $node) {
return $this->pInfixOp('Expr_BinaryOp_Spaceship', $node->left, ' <=> ', $node->right);
}

protected function pExpr_BinaryOp_Greater(BinaryOp\Greater $node) {
return $this->pInfixOp('Expr_BinaryOp_Greater', $node->left, ' > ', $node->right);
}

protected function pExpr_BinaryOp_GreaterOrEqual(BinaryOp\GreaterOrEqual $node) {
return $this->pInfixOp('Expr_BinaryOp_GreaterOrEqual', $node->left, ' >= ', $node->right);
}

protected function pExpr_BinaryOp_Smaller(BinaryOp\Smaller $node) {
return $this->pInfixOp('Expr_BinaryOp_Smaller', $node->left, ' < ', $node->right);
}

protected function pExpr_BinaryOp_SmallerOrEqual(BinaryOp\SmallerOrEqual $node) {
return $this->pInfixOp('Expr_BinaryOp_SmallerOrEqual', $node->left, ' <= ', $node->right);
}

protected function pExpr_BinaryOp_Coalesce(BinaryOp\Coalesce $node) {
return $this->pInfixOp('Expr_BinaryOp_Coalesce', $node->left, ' ?? ', $node->right);
}

protected function pExpr_Instanceof(Expr\Instanceof_ $node) {
return $this->pInfixOp('Expr_Instanceof', $node->expr, ' instanceof ', $node->class);
}



protected function pExpr_BooleanNot(Expr\BooleanNot $node) {
return $this->pPrefixOp('Expr_BooleanNot', '!', $node->expr);
}

protected function pExpr_BitwiseNot(Expr\BitwiseNot $node) {
return $this->pPrefixOp('Expr_BitwiseNot', '~', $node->expr);
}

protected function pExpr_UnaryMinus(Expr\UnaryMinus $node) {
if ($node->expr instanceof Expr\UnaryMinus || $node->expr instanceof Expr\PreDec) {

 return '-(' . $this->p($node->expr) . ')';
}
return $this->pPrefixOp('Expr_UnaryMinus', '-', $node->expr);
}

protected function pExpr_UnaryPlus(Expr\UnaryPlus $node) {
if ($node->expr instanceof Expr\UnaryPlus || $node->expr instanceof Expr\PreInc) {

 return '+(' . $this->p($node->expr) . ')';
}
return $this->pPrefixOp('Expr_UnaryPlus', '+', $node->expr);
}

protected function pExpr_PreInc(Expr\PreInc $node) {
return $this->pPrefixOp('Expr_PreInc', '++', $node->var);
}

protected function pExpr_PreDec(Expr\PreDec $node) {
return $this->pPrefixOp('Expr_PreDec', '--', $node->var);
}

protected function pExpr_PostInc(Expr\PostInc $node) {
return $this->pPostfixOp('Expr_PostInc', $node->var, '++');
}

protected function pExpr_PostDec(Expr\PostDec $node) {
return $this->pPostfixOp('Expr_PostDec', $node->var, '--');
}

protected function pExpr_ErrorSuppress(Expr\ErrorSuppress $node) {
return $this->pPrefixOp('Expr_ErrorSuppress', '@', $node->expr);
}

protected function pExpr_YieldFrom(Expr\YieldFrom $node) {
return $this->pPrefixOp('Expr_YieldFrom', 'yield from ', $node->expr);
}

protected function pExpr_Print(Expr\Print_ $node) {
return $this->pPrefixOp('Expr_Print', 'print ', $node->expr);
}



protected function pExpr_Cast_Int(Cast\Int_ $node) {
return $this->pPrefixOp('Expr_Cast_Int', '(int) ', $node->expr);
}

protected function pExpr_Cast_Double(Cast\Double $node) {
return $this->pPrefixOp('Expr_Cast_Double', '(double) ', $node->expr);
}

protected function pExpr_Cast_String(Cast\String_ $node) {
return $this->pPrefixOp('Expr_Cast_String', '(string) ', $node->expr);
}

protected function pExpr_Cast_Array(Cast\Array_ $node) {
return $this->pPrefixOp('Expr_Cast_Array', '(array) ', $node->expr);
}

protected function pExpr_Cast_Object(Cast\Object_ $node) {
return $this->pPrefixOp('Expr_Cast_Object', '(object) ', $node->expr);
}

protected function pExpr_Cast_Bool(Cast\Bool_ $node) {
return $this->pPrefixOp('Expr_Cast_Bool', '(bool) ', $node->expr);
}

protected function pExpr_Cast_Unset(Cast\Unset_ $node) {
return $this->pPrefixOp('Expr_Cast_Unset', '(unset) ', $node->expr);
}



protected function pExpr_FuncCall(Expr\FuncCall $node) {
return $this->pCallLhs($node->name)
. '(' . $this->pMaybeMultiline($node->args) . ')';
}

protected function pExpr_MethodCall(Expr\MethodCall $node) {
return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name)
. '(' . $this->pMaybeMultiline($node->args) . ')';
}

protected function pExpr_StaticCall(Expr\StaticCall $node) {
return $this->pDereferenceLhs($node->class) . '::'
. ($node->name instanceof Expr
? ($node->name instanceof Expr\Variable
? $this->p($node->name)
: '{' . $this->p($node->name) . '}')
: $node->name)
. '(' . $this->pMaybeMultiline($node->args) . ')';
}

protected function pExpr_Empty(Expr\Empty_ $node) {
return 'empty(' . $this->p($node->expr) . ')';
}

protected function pExpr_Isset(Expr\Isset_ $node) {
return 'isset(' . $this->pCommaSeparated($node->vars) . ')';
}

protected function pExpr_Eval(Expr\Eval_ $node) {
return 'eval(' . $this->p($node->expr) . ')';
}

protected function pExpr_Include(Expr\Include_ $node) {
static $map = array(
Expr\Include_::TYPE_INCLUDE => 'include',
Expr\Include_::TYPE_INCLUDE_ONCE => 'include_once',
Expr\Include_::TYPE_REQUIRE => 'require',
Expr\Include_::TYPE_REQUIRE_ONCE => 'require_once',
);

return $map[$node->type] . ' ' . $this->p($node->expr);
}

protected function pExpr_List(Expr\List_ $node) {
return 'list(' . $this->pCommaSeparated($node->items) . ')';
}



protected function pExpr_Error(Expr\Error $node) {
throw new \LogicException('Cannot pretty-print AST with Error nodes');
}

protected function pExpr_Variable(Expr\Variable $node) {
if ($node->name instanceof Expr) {
return '${' . $this->p($node->name) . '}';
} else {
return '$' . $node->name;
}
}

protected function pExpr_Array(Expr\Array_ $node) {
$syntax = $node->getAttribute('kind',
$this->options['shortArraySyntax'] ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG);
if ($syntax === Expr\Array_::KIND_SHORT) {
return '[' . $this->pMaybeMultiline($node->items, true) . ']';
} else {
return 'array(' . $this->pMaybeMultiline($node->items, true) . ')';
}
}

protected function pExpr_ArrayItem(Expr\ArrayItem $node) {
return (null !== $node->key ? $this->p($node->key) . ' => ' : '')
. ($node->byRef ? '&' : '') . $this->p($node->value);
}

protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) {
return $this->pDereferenceLhs($node->var)
. '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']';
}

protected function pExpr_ConstFetch(Expr\ConstFetch $node) {
return $this->p($node->name);
}

protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) {
return $this->p($node->class) . '::'
. (is_string($node->name) ? $node->name : $this->p($node->name));
}

protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) {
return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name);
}

protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) {
return $this->pDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name);
}

protected function pExpr_ShellExec(Expr\ShellExec $node) {
return '`' . $this->pEncapsList($node->parts, '`') . '`';
}

protected function pExpr_Closure(Expr\Closure $node) {
return ($node->static ? 'static ' : '')
. 'function ' . ($node->byRef ? '&' : '')
. '(' . $this->pCommaSeparated($node->params) . ')'
. (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')': '')
. (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
. ' {' . $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pExpr_ClosureUse(Expr\ClosureUse $node) {
return ($node->byRef ? '&' : '') . '$' . $node->var;
}

protected function pExpr_New(Expr\New_ $node) {
if ($node->class instanceof Stmt\Class_) {
$args = $node->args ? '(' . $this->pMaybeMultiline($node->args) . ')' : '';
return 'new ' . $this->pClassCommon($node->class, $args);
}
return 'new ' . $this->p($node->class) . '(' . $this->pMaybeMultiline($node->args) . ')';
}

protected function pExpr_Clone(Expr\Clone_ $node) {
return 'clone ' . $this->p($node->expr);
}

protected function pExpr_Ternary(Expr\Ternary $node) {

 
 return $this->pInfixOp('Expr_Ternary',
$node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else
);
}

protected function pExpr_Exit(Expr\Exit_ $node) {
$kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE);
return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die')
. (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : '');
}

protected function pExpr_Yield(Expr\Yield_ $node) {
if ($node->value === null) {
return 'yield';
} else {

 return '(yield '
. ($node->key !== null ? $this->p($node->key) . ' => ' : '')
. $this->p($node->value)
. ')';
}
}



protected function pStmt_Namespace(Stmt\Namespace_ $node) {
if ($this->canUseSemicolonNamespaces) {
return 'namespace ' . $this->p($node->name) . ';' . "\n" . $this->pStmts($node->stmts, false);
} else {
return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '')
. ' {' . $this->pStmts($node->stmts) . "\n" . '}';
}
}

protected function pStmt_Use(Stmt\Use_ $node) {
return 'use ' . $this->pUseType($node->type)
. $this->pCommaSeparated($node->uses) . ';';
}

protected function pStmt_GroupUse(Stmt\GroupUse $node) {
return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix)
. '\{' . $this->pCommaSeparated($node->uses) . '};';
}

protected function pStmt_UseUse(Stmt\UseUse $node) {
return $this->pUseType($node->type) . $this->p($node->name)
. ($node->name->getLast() !== $node->alias ? ' as ' . $node->alias : '');
}

protected function pUseType($type) {
return $type === Stmt\Use_::TYPE_FUNCTION ? 'function '
: ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : '');
}

protected function pStmt_Interface(Stmt\Interface_ $node) {
return 'interface ' . $node->name
. (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '')
. "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_Class(Stmt\Class_ $node) {
return $this->pClassCommon($node, ' ' . $node->name);
}

protected function pStmt_Trait(Stmt\Trait_ $node) {
return 'trait ' . $node->name
. "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_TraitUse(Stmt\TraitUse $node) {
return 'use ' . $this->pCommaSeparated($node->traits)
. (empty($node->adaptations)
? ';'
: ' {' . $this->pStmts($node->adaptations) . "\n" . '}');
}

protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) {
return $this->p($node->trait) . '::' . $node->method
. ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';';
}

protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) {
return (null !== $node->trait ? $this->p($node->trait) . '::' : '')
. $node->method . ' as'
. (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '')
. (null !== $node->newName ? ' ' . $node->newName : '')
. ';';
}

protected function pStmt_Property(Stmt\Property $node) {
return (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags)) . $this->pCommaSeparated($node->props) . ';';
}

protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) {
return '$' . $node->name
. (null !== $node->default ? ' = ' . $this->p($node->default) : '');
}

protected function pStmt_ClassMethod(Stmt\ClassMethod $node) {
return $this->pModifiers($node->flags)
. 'function ' . ($node->byRef ? '&' : '') . $node->name
. '(' . $this->pCommaSeparated($node->params) . ')'
. (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
. (null !== $node->stmts
? "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}'
: ';');
}

protected function pStmt_ClassConst(Stmt\ClassConst $node) {
return $this->pModifiers($node->flags)
. 'const ' . $this->pCommaSeparated($node->consts) . ';';
}

protected function pStmt_Function(Stmt\Function_ $node) {
return 'function ' . ($node->byRef ? '&' : '') . $node->name
. '(' . $this->pCommaSeparated($node->params) . ')'
. (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '')
. "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_Const(Stmt\Const_ $node) {
return 'const ' . $this->pCommaSeparated($node->consts) . ';';
}

protected function pStmt_Declare(Stmt\Declare_ $node) {
return 'declare (' . $this->pCommaSeparated($node->declares) . ')'
. (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . "\n" . '}' : ';');
}

protected function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) {
return $node->key . '=' . $this->p($node->value);
}



protected function pStmt_If(Stmt\If_ $node) {
return 'if (' . $this->p($node->cond) . ') {'
. $this->pStmts($node->stmts) . "\n" . '}'
. $this->pImplode($node->elseifs)
. (null !== $node->else ? $this->p($node->else) : '');
}

protected function pStmt_ElseIf(Stmt\ElseIf_ $node) {
return ' elseif (' . $this->p($node->cond) . ') {'
. $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_Else(Stmt\Else_ $node) {
return ' else {' . $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_For(Stmt\For_ $node) {
return 'for ('
. $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '')
. $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '')
. $this->pCommaSeparated($node->loop)
. ') {' . $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_Foreach(Stmt\Foreach_ $node) {
return 'foreach (' . $this->p($node->expr) . ' as '
. (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '')
. ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {'
. $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_While(Stmt\While_ $node) {
return 'while (' . $this->p($node->cond) . ') {'
. $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_Do(Stmt\Do_ $node) {
return 'do {' . $this->pStmts($node->stmts) . "\n"
. '} while (' . $this->p($node->cond) . ');';
}

protected function pStmt_Switch(Stmt\Switch_ $node) {
return 'switch (' . $this->p($node->cond) . ') {'
. $this->pStmts($node->cases) . "\n" . '}';
}

protected function pStmt_Case(Stmt\Case_ $node) {
return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':'
. $this->pStmts($node->stmts);
}

protected function pStmt_TryCatch(Stmt\TryCatch $node) {
return 'try {' . $this->pStmts($node->stmts) . "\n" . '}'
. $this->pImplode($node->catches)
. ($node->finally !== null ? $this->p($node->finally) : '');
}

protected function pStmt_Catch(Stmt\Catch_ $node) {
return ' catch (' . $this->pImplode($node->types, '|') . ' $' . $node->var . ') {'
. $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_Finally(Stmt\Finally_ $node) {
return ' finally {' . $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pStmt_Break(Stmt\Break_ $node) {
return 'break' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';';
}

protected function pStmt_Continue(Stmt\Continue_ $node) {
return 'continue' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';';
}

protected function pStmt_Return(Stmt\Return_ $node) {
return 'return' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '') . ';';
}

protected function pStmt_Throw(Stmt\Throw_ $node) {
return 'throw ' . $this->p($node->expr) . ';';
}

protected function pStmt_Label(Stmt\Label $node) {
return $node->name . ':';
}

protected function pStmt_Goto(Stmt\Goto_ $node) {
return 'goto ' . $node->name . ';';
}



protected function pStmt_Echo(Stmt\Echo_ $node) {
return 'echo ' . $this->pCommaSeparated($node->exprs) . ';';
}

protected function pStmt_Static(Stmt\Static_ $node) {
return 'static ' . $this->pCommaSeparated($node->vars) . ';';
}

protected function pStmt_Global(Stmt\Global_ $node) {
return 'global ' . $this->pCommaSeparated($node->vars) . ';';
}

protected function pStmt_StaticVar(Stmt\StaticVar $node) {
return '$' . $node->name
. (null !== $node->default ? ' = ' . $this->p($node->default) : '');
}

protected function pStmt_Unset(Stmt\Unset_ $node) {
return 'unset(' . $this->pCommaSeparated($node->vars) . ');';
}

protected function pStmt_InlineHTML(Stmt\InlineHTML $node) {
$newline = $node->getAttribute('hasLeadingNewline', true) ? "\n" : '';
return '?>' . $this->pNoIndent($newline . $node->value) . '<?php ';
}

protected function pStmt_HaltCompiler(Stmt\HaltCompiler $node) {
return '__halt_compiler();' . $node->remaining;
}

protected function pStmt_Nop(Stmt\Nop $node) {
return '';
}



protected function pType($node) {
return is_string($node) ? $node : $this->p($node);
}

protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) {
return $this->pModifiers($node->flags)
. 'class' . $afterClassToken
. (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '')
. (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '')
. "\n" . '{' . $this->pStmts($node->stmts) . "\n" . '}';
}

protected function pObjectProperty($node) {
if ($node instanceof Expr) {
return '{' . $this->p($node) . '}';
} else {
return $node;
}
}

protected function pModifiers($modifiers) {
return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '')
. ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '')
. ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '')
. ($modifiers & Stmt\Class_::MODIFIER_STATIC ? 'static ' : '')
. ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT ? 'abstract ' : '')
. ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : '');
}

protected function pEncapsList(array $encapsList, $quote) {
$return = '';
foreach ($encapsList as $element) {
if ($element instanceof Scalar\EncapsedStringPart) {
$return .= $this->escapeString($element->value, $quote);
} else {
$return .= '{' . $this->p($element) . '}';
}
}

return $return;
}

protected function escapeString($string, $quote) {
if (null === $quote) {

 $escaped = addcslashes($string, "\t\f\v$\\");
} else {
$escaped = addcslashes($string, "\n\r\t\f\v$" . $quote . "\\");
}


 return preg_replace_callback('/([\0-\10\16-\37])(?=([0-7]?))/', function ($matches) {
$oct = decoct(ord($matches[1]));
if ($matches[2] !== '') {

 return '\\' . str_pad($oct, 3, '0', STR_PAD_LEFT);
}
return '\\' . $oct;
}, $escaped);
}

protected function containsEndLabel($string, $label, $atStart = true, $atEnd = true) {
$start = $atStart ? '(?:^|[\r\n])' : '[\r\n]';
$end = $atEnd ? '(?:$|[;\r\n])' : '[;\r\n]';
return false !== strpos($string, $label)
&& preg_match('/' . $start . $label . $end . '/', $string);
}

protected function encapsedContainsEndLabel(array $parts, $label) {
foreach ($parts as $i => $part) {
$atStart = $i === 0;
$atEnd = $i === count($parts) - 1;
if ($part instanceof Scalar\EncapsedStringPart
&& $this->containsEndLabel($part->value, $label, $atStart, $atEnd)
) {
return true;
}
}
return false;
}

protected function pDereferenceLhs(Node $node) {
if ($node instanceof Expr\Variable
|| $node instanceof Name
|| $node instanceof Expr\ArrayDimFetch
|| $node instanceof Expr\PropertyFetch
|| $node instanceof Expr\StaticPropertyFetch
|| $node instanceof Expr\FuncCall
|| $node instanceof Expr\MethodCall
|| $node instanceof Expr\StaticCall
|| $node instanceof Expr\Array_
|| $node instanceof Scalar\String_
|| $node instanceof Expr\ConstFetch
|| $node instanceof Expr\ClassConstFetch
) {
return $this->p($node);
} else {
return '(' . $this->p($node) . ')';
}
}

protected function pCallLhs(Node $node) {
if ($node instanceof Name
|| $node instanceof Expr\Variable
|| $node instanceof Expr\ArrayDimFetch
|| $node instanceof Expr\FuncCall
|| $node instanceof Expr\MethodCall
|| $node instanceof Expr\StaticCall
|| $node instanceof Expr\Array_
) {
return $this->p($node);
} else {
return '(' . $this->p($node) . ')';
}
}

private function hasNodeWithComments(array $nodes) {
foreach ($nodes as $node) {
if ($node && $node->getAttribute('comments')) {
return true;
}
}
return false;
}

private function pMaybeMultiline(array $nodes, $trailingComma = false) {
if (!$this->hasNodeWithComments($nodes)) {
return $this->pCommaSeparated($nodes);
} else {
return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . "\n";
}
}
}
<?php

namespace PhpParser\Parser;

use PhpParser\Error;
use PhpParser\ErrorHandler;
use PhpParser\Parser;

class Multiple implements Parser {

private $parsers;










public function __construct(array $parsers) {
$this->parsers = $parsers;
}

public function parse($code, ErrorHandler $errorHandler = null) {
if (null === $errorHandler) {
$errorHandler = new ErrorHandler\Throwing;
}

list($firstStmts, $firstError) = $this->tryParse($this->parsers[0], $errorHandler, $code);
if ($firstError === null) {
return $firstStmts;
}

for ($i = 1, $c = count($this->parsers); $i < $c; ++$i) {
list($stmts, $error) = $this->tryParse($this->parsers[$i], $errorHandler, $code);
if ($error === null) {
return $stmts;
}
}

throw $firstError;
}

private function tryParse(Parser $parser, ErrorHandler $errorHandler, $code) {
$stmts = null;
$error = null;
try {
$stmts = $parser->parse($code, $errorHandler);
} catch (Error $error) {}
return [$stmts, $error];
}
}
<?php

namespace PhpParser\Parser;

use PhpParser\Error;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
use PhpParser\Node\Scalar;
use PhpParser\Node\Stmt;







class Php5 extends \PhpParser\ParserAbstract
{
protected $tokenToSymbolMapSize = 392;
protected $actionTableSize = 1077;
protected $gotoTableSize = 591;

protected $invalidSymbol = 157;
protected $errorSymbol = 1;
protected $defaultAction = -32766;
protected $unexpectedTokenRule = 32767;

protected $YY2TBLSTATE = 407;
protected $YYNLSTATES = 669;

protected $symbolToName = array(
"EOF",
"error",
"T_INCLUDE",
"T_INCLUDE_ONCE",
"T_EVAL",
"T_REQUIRE",
"T_REQUIRE_ONCE",
"','",
"T_LOGICAL_OR",
"T_LOGICAL_XOR",
"T_LOGICAL_AND",
"T_PRINT",
"T_YIELD",
"T_DOUBLE_ARROW",
"T_YIELD_FROM",
"'='",
"T_PLUS_EQUAL",
"T_MINUS_EQUAL",
"T_MUL_EQUAL",
"T_DIV_EQUAL",
"T_CONCAT_EQUAL",
"T_MOD_EQUAL",
"T_AND_EQUAL",
"T_OR_EQUAL",
"T_XOR_EQUAL",
"T_SL_EQUAL",
"T_SR_EQUAL",
"T_POW_EQUAL",
"'?'",
"':'",
"T_COALESCE",
"T_BOOLEAN_OR",
"T_BOOLEAN_AND",
"'|'",
"'^'",
"'&'",
"T_IS_EQUAL",
"T_IS_NOT_EQUAL",
"T_IS_IDENTICAL",
"T_IS_NOT_IDENTICAL",
"T_SPACESHIP",
"'<'",
"T_IS_SMALLER_OR_EQUAL",
"'>'",
"T_IS_GREATER_OR_EQUAL",
"T_SL",
"T_SR",
"'+'",
"'-'",
"'.'",
"'*'",
"'/'",
"'%'",
"'!'",
"T_INSTANCEOF",
"'~'",
"T_INC",
"T_DEC",
"T_INT_CAST",
"T_DOUBLE_CAST",
"T_STRING_CAST",
"T_ARRAY_CAST",
"T_OBJECT_CAST",
"T_BOOL_CAST",
"T_UNSET_CAST",
"'@'",
"T_POW",
"'['",
"T_NEW",
"T_CLONE",
"T_EXIT",
"T_IF",
"T_ELSEIF",
"T_ELSE",
"T_ENDIF",
"T_LNUMBER",
"T_DNUMBER",
"T_STRING",
"T_STRING_VARNAME",
"T_VARIABLE",
"T_NUM_STRING",
"T_INLINE_HTML",
"T_ENCAPSED_AND_WHITESPACE",
"T_CONSTANT_ENCAPSED_STRING",
"T_ECHO",
"T_DO",
"T_WHILE",
"T_ENDWHILE",
"T_FOR",
"T_ENDFOR",
"T_FOREACH",
"T_ENDFOREACH",
"T_DECLARE",
"T_ENDDECLARE",
"T_AS",
"T_SWITCH",
"T_ENDSWITCH",
"T_CASE",
"T_DEFAULT",
"T_BREAK",
"T_CONTINUE",
"T_GOTO",
"T_FUNCTION",
"T_CONST",
"T_RETURN",
"T_TRY",
"T_CATCH",
"T_FINALLY",
"T_THROW",
"T_USE",
"T_INSTEADOF",
"T_GLOBAL",
"T_STATIC",
"T_ABSTRACT",
"T_FINAL",
"T_PRIVATE",
"T_PROTECTED",
"T_PUBLIC",
"T_VAR",
"T_UNSET",
"T_ISSET",
"T_EMPTY",
"T_HALT_COMPILER",
"T_CLASS",
"T_TRAIT",
"T_INTERFACE",
"T_EXTENDS",
"T_IMPLEMENTS",
"T_OBJECT_OPERATOR",
"T_LIST",
"T_ARRAY",
"T_CALLABLE",
"T_CLASS_C",
"T_TRAIT_C",
"T_METHOD_C",
"T_FUNC_C",
"T_LINE",
"T_FILE",
"T_START_HEREDOC",
"T_END_HEREDOC",
"T_DOLLAR_OPEN_CURLY_BRACES",
"T_CURLY_OPEN",
"T_PAAMAYIM_NEKUDOTAYIM",
"T_NAMESPACE",
"T_NS_C",
"T_DIR",
"T_NS_SEPARATOR",
"T_ELLIPSIS",
"';'",
"'{'",
"'}'",
"'('",
"')'",
"'$'",
"'`'",
"']'",
"'\"'"
);

protected $tokenToSymbol = array(
0, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 53, 156, 157, 153, 52, 35, 157,
151, 152, 50, 47, 7, 48, 49, 51, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 29, 148,
41, 15, 43, 28, 65, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 67, 157, 155, 34, 157, 154, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 149, 33, 150, 55, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 1, 2, 3, 4,
5, 6, 8, 9, 10, 11, 12, 13, 14, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 30, 31, 32, 36, 37, 38, 39, 40, 42,
44, 45, 46, 54, 56, 57, 58, 59, 60, 61,
62, 63, 64, 66, 68, 69, 70, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, 81, 157, 157,
82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
132, 133, 134, 135, 136, 137, 157, 157, 157, 157,
157, 157, 138, 139, 140, 141, 142, 143, 144, 145,
146, 147
);

protected $action = array(
674, 675, 676, 677, 678,-32766, 679, 680, 681, 717,
718, 218, 219, 220, 221, 222, 223, 224, 225, 226,
0, 227, 228, 229, 230, 231, 232, 233, 234, 235,
236, 237, 238,-32766,-32766,-32766,-32766,-32766,-32766,-32766,
-32766,-32767,-32767,-32767,-32767, 442, 239, 240,-32766,-32766,
-32766,-32766, 682,-32766, 308,-32766,-32766,-32766,-32766,-32766,
-32766,-32767,-32767,-32767,-32767,-32767, 683, 684, 685, 686,
687, 688, 689, 1174, 462, 749,-32766,-32766,-32766,-32766,
-32766, 25, 690, 691, 692, 693, 694, 695, 696, 697,
698, 699, 700, 720, 721, 722, 723, 724, 712, 713,
714, 715, 716, 701, 702, 703, 704, 705, 706, 707,
743, 744, 745, 746, 747, 748, 708, 709, 710, 711,
741, 732, 730, 731, 727, 728, 520, 719, 725, 726,
733, 734, 736, 735, 737, 738, 54, 55, 422, 56,
57, 729, 740, 739, 421, 58, 59, 341, 60,-32766,
-32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766, 9,-32767,
-32767,-32767,-32767, 52, 327,-32766, 331, 947, 948, 949,
946, 945, 944, 939, 1215, 29, 1217, 1216, 765, 766,
823, 61, 62, 1101, -269, 1180, 764, 63, 1174, 64,
293, 294, 65, 66, 67, 68, 69, 70, 71, 72,
129, 26, 301, 73, 415,-32766,-32766,-32766,-32766, 1089,
1090, 751, 635, 1180,-32766, 920, 206, 466,-32766,-32766,
-32766, 824, 409,-32766, 313,-32766, 902,-32766,-32766,-32766,
-32766,-32766,-32766, 215, 216, 217, 430,-32766,-32766,-32766,
-32766,-32766,-32766,-32766,-32766, 122, 493, 947, 948, 949,
946, 945, 944, 202, 475, 476, 284, 625, 127, 336,
895, 896, 341, 479, 480, 1187, 1095, 1096, 1097, 1098,
1092, 1093, 309, 494, 10, 443, 427, 494, 1099, 1094,
427, 587, -220, 1212, 123, 41, 449, 336, 323, 1056,
324, 423, -122, -122, -122, -4, 824, 465, 101, 102,
103, 813, 303, 282, 40, 21, 424, -122, 467, -122,
468, -122, 469, -122, 104, 425, 215, 216, 217, 30,
31, 470, 426, 626, 32, 471, 427, 814, 74, 871,
925, 351, 352, 472, 473, 358, 202, 243, 1101, 474,
414, 1184, 795, 842, 477, 478, 300, 236, 237, 238,
35, 105, 106, 107, 108, 109, 110, 111, 112, 113,
114, 115, 116, 239, 240, 1038, 423, 350, 826, 640,
-122, 824, 465, 215, 216, 217, 813, 1140, 241, 40,
21, 424, 48, 467, 440, 468, 334, 469, 297, 1038,
425, 977, 979, 202, 30, 31, 470, 426, 416, 32,
471, 1188, 1038, 74, 322, 1038, 351, 352, 472, 473,
-32766,-32766,-32766, 128, 474, 921, 811, 757, 842, 477,
478,-32767,-32767,-32767,-32767, 96, 97, 98, 99, 100,
-32766, 20,-32766,-32766,-32766,-32766, 895, 896, 335, 1038,
479, 423, -216, 826, 640, -4, 824, 465, 872, 494,
1207, 813, 427, 1206, 40, 21, 424, 299, 467, 121,
468, 1038, 469, -497, 118, 425, -201, -201, -201, 30,
31, 470, 426, 297, 32, 471, 810, 911, 74, 216,
217, 351, 352, 472, 473,-32766,-32766,-32766, 36, 474,
51, 340, 795, 842, 477, 478, 207, 751, 202, 1180,
126,-32766,-32766,-32766, 441,-32766, 417,-32766,-32766,-32766,
49, 33, 296,-32766,-32766,-32766, 423, 208, 826, 640,
-201,-32766, 465,-32766,-32766, 807, 813, 379, 117, 40,
21, 424, 1066, 467,-32766, 468, 217, 469, 805, 245,
425, -200, -200, -200, 30, 31, 470, 426, 1038, 32,
471, 286, 548, 74, 202, 824, 351, 352, 472, 473,
-32766,-32766,-32766, 494, 474, 125, 427, 795, 842, 477,
478, 431, 120, 336, 1038, 803, 78, 79, 80, 494,
-32766, 436, 427, 646, 642, 126,-32766,-32766,-32766, 244,
901, 246, 119, 826, 640, -200, 34, 298, 81, 82,
83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
103, 209, 303, 202, 824, 423, 822, 1038, 215, 216,
217, 465, 131, 130, 104, 813, 578, 1038, 40, 21,
424, 650, 467, 835, 468, 647, 469, 315, 202, 425,
285, 104, 643, 30, 31, 470, 824,-32766, 32, 471,
295, 303, 74,-32766,-32766, 351, 352, 215, 216, 217,
-32766,-32766, 50, 474, 98, 99, 100, 233, 234, 235,
239, 240, 456, 593, 644, 451, 22, 202, 132, 359,
765, 766, 601, 602, 423, 758, 645, 924, 668, 301,
465, 47, 858, 640, 813, 936, 656, 40, 21, 424,
43, 467, 46, 468, 45, 469, 44, 53, 425, 751,
607, 514, 30, 31, 470, 824, 423, 32, 471, 778,
752, 74, 465, 437, 351, 352, 813, 535, 519, 40,
21, 424, 474, 467, 536, 468, 1210, 469, 515, 435,
425, 439, 518, 648, 30, 31, 470, 824, 624, 32,
471, 614, 604, 74, 1059, 581, 351, 352,-32766, 526,
634, 826, 640, 611, 474, 1139, 460, 434, 281, 621,
328, 844, 314, 539, 14, 653, -80, 597, 837, 584,
330, 843, 325, -398, 395, 423, 1146, 0, 0, 0,
0, 465, 1100, 826, 640, 813, 598, 0, 40, 21,
424, 0, 467, 0, 468, 0, 469, 0, 372, 425,
0, 326, 0, 30, 31, 470, 824, 423, 32, 471,
312, -498, 74, 465, -497, 351, 352, 813, 479, 0,
40, 21, 424, 474, 467, 374, 468, 5, 469, 6,
11, 425, -407, 13, -406, 30, 31, 470, 1036, 386,
32, 471, 411, 410, 74, 387, 528, 351, 352, 436,
856, 1213, 826, 640, 866, 474, 865, 874, 815, 800,
821, 809, 763, 661, 660, 39, 38, 854, 931, 932,
929, 859, 930, 820, 808, 761, 423, 928, 806, 804,
798, 812, 465, 762, 826, 640, 813, 649, 77, 40,
21, 424, 651, 467, 652, 468, 242, 469, 654, 655,
425, 658, 663, 664, 30, 31, 470, 665, 124, 32,
471, 332, 333, 74, 210, 211, 351, 352, 407, 641,
212, 408, 213, 768, 474, 767, 864, 455, 1211, 1181,
1179, 1165, 1177, 1080, 204, 913, 1185, 1175, 838, 210,
211, 1040, 1089, 1090, 1041, 212,-32766, 213, 829, 863,
1091, 1052, 759, 826, 640, 306, 839, 840, 760, 204,
1214, 796, 662, 841, 770, 769, 937, 1089, 1090, 831,
1042,-32766, 305, 304, 24, 1091, 27, 292, 291, 283,
307, 338, 413, 419, 28, 205, 37, 42, 76, 75,
-32766, 0, 1018, 1017, 1082, 571, -216, 567, 1105, 1095,
1096, 1097, 1098, 1092, 1093, 385, 903, 1046, 1043, 631,
561, 1099, 1094, 463, 459, 457, 452, 380, 214, 0,
-32766, 18, 567, -217, 1095, 1096, 1097, 1098, 1092, 1093,
385, 17, 16, 605, 0, -416, 1099, 1094, 1160, 1159,
1106, 1209, 1079, 214, 1176,-32766, 1047, 0, 1164, 1178,
1065, 1050, 1051, 1048, 1049, 0, 1145
);

protected $actionCheck = array(
2, 3, 4, 5, 6, 8, 8, 9, 10, 11,
12, 31, 32, 33, 34, 35, 36, 37, 38, 39,
0, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 8, 9, 10, 31, 32, 33, 34,
35, 36, 37, 38, 39, 7, 66, 67, 31, 32,
33, 34, 54, 28, 7, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 68, 69, 70, 71,
72, 73, 74, 79, 7, 77, 31, 32, 33, 34,
35, 7, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 124, 125, 126, 127, 82, 129, 130, 131,
132, 133, 134, 135, 136, 137, 2, 3, 4, 5,
6, 143, 144, 145, 7, 11, 12, 153, 14, 31,
32, 33, 34, 35, 36, 37, 38, 39, 103, 41,
42, 43, 44, 67, 109, 79, 7, 112, 113, 114,
115, 116, 117, 118, 77, 7, 79, 80, 102, 103,
1, 47, 48, 139, 79, 79, 148, 53, 79, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
67, 67, 68, 69, 70, 8, 9, 10, 103, 75,
76, 77, 77, 79, 109, 148, 7, 83, 8, 9,
10, 1, 146, 118, 128, 28, 152, 30, 31, 32,
33, 34, 35, 8, 9, 10, 102, 151, 28, 153,
30, 31, 32, 33, 34, 149, 112, 112, 113, 114,
115, 116, 117, 28, 120, 121, 7, 77, 149, 153,
130, 131, 153, 129, 130, 1, 132, 133, 134, 135,
136, 137, 138, 143, 7, 7, 146, 143, 144, 145,
146, 82, 152, 150, 7, 151, 7, 153, 154, 152,
156, 71, 72, 73, 74, 0, 1, 77, 50, 51,
52, 81, 54, 13, 84, 85, 86, 87, 88, 89,
90, 91, 92, 93, 66, 95, 8, 9, 10, 99,
100, 101, 102, 143, 104, 105, 146, 148, 108, 29,
150, 111, 112, 113, 114, 7, 28, 29, 139, 119,
7, 77, 122, 123, 124, 125, 35, 50, 51, 52,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 66, 67, 12, 71, 7, 148, 149,
150, 1, 77, 8, 9, 10, 81, 152, 13, 84,
85, 86, 67, 88, 29, 90, 7, 92, 35, 12,
95, 56, 57, 28, 99, 100, 101, 102, 103, 104,
105, 152, 12, 108, 109, 12, 111, 112, 113, 114,
8, 9, 10, 149, 119, 148, 148, 122, 123, 124,
125, 41, 42, 43, 44, 45, 46, 47, 48, 49,
28, 152, 30, 31, 32, 33, 130, 131, 143, 12,
129, 71, 152, 148, 149, 150, 1, 77, 148, 143,
79, 81, 146, 82, 84, 85, 86, 7, 88, 13,
90, 12, 92, 128, 149, 95, 96, 97, 98, 99,
100, 101, 102, 35, 104, 105, 148, 79, 108, 9,
10, 111, 112, 113, 114, 8, 9, 10, 13, 119,
67, 67, 122, 123, 124, 125, 15, 77, 28, 79,
147, 8, 9, 10, 149, 28, 123, 30, 31, 32,
67, 140, 141, 8, 9, 10, 71, 15, 148, 149,
150, 28, 77, 30, 31, 148, 81, 78, 15, 84,
85, 86, 112, 88, 151, 90, 10, 92, 148, 15,
95, 96, 97, 98, 99, 100, 101, 102, 12, 104,
105, 153, 128, 108, 28, 1, 111, 112, 113, 114,
8, 9, 10, 143, 119, 29, 146, 122, 123, 124,
125, 151, 149, 153, 12, 148, 8, 9, 10, 143,
28, 146, 146, 29, 149, 147, 31, 32, 33, 15,
152, 15, 149, 148, 149, 150, 28, 35, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 15, 54, 28, 1, 71, 29, 12, 8, 9,
10, 77, 149, 29, 66, 81, 153, 12, 84, 85,
86, 29, 88, 35, 90, 29, 92, 29, 28, 95,
35, 66, 29, 99, 100, 101, 1, 31, 104, 105,
35, 54, 108, 31, 32, 111, 112, 8, 9, 10,
8, 9, 67, 119, 47, 48, 49, 47, 48, 49,
66, 67, 72, 73, 29, 72, 73, 28, 97, 98,
102, 103, 106, 107, 71, 148, 149, 148, 149, 68,
77, 67, 148, 149, 81, 148, 149, 84, 85, 86,
67, 88, 67, 90, 67, 92, 67, 67, 95, 77,
74, 77, 99, 100, 101, 1, 71, 104, 105, 77,
77, 108, 77, 77, 111, 112, 81, 77, 77, 84,
85, 86, 119, 88, 77, 90, 77, 92, 77, 77,
95, 86, 79, 29, 99, 100, 101, 1, 79, 104,
105, 79, 79, 108, 79, 87, 111, 112, 82, 82,
89, 148, 149, 93, 119, 155, 102, 102, 94, 91,
110, 123, 128, 94, 94, 29, 94, 96, 147, 96,
126, 123, 126, 142, 146, 71, 139, -1, -1, -1,
-1, 77, 139, 148, 149, 81, 109, -1, 84, 85,
86, -1, 88, -1, 90, -1, 92, -1, 142, 95,
-1, 127, -1, 99, 100, 101, 1, 71, 104, 105,
128, 128, 108, 77, 128, 111, 112, 81, 129, -1,
84, 85, 86, 119, 88, 146, 90, 142, 92, 142,
142, 95, 142, 142, 142, 99, 100, 101, 154, 146,
104, 105, 146, 146, 108, 146, 146, 111, 112, 146,
148, 150, 148, 149, 148, 119, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 71, 148, 148, 148,
148, 148, 77, 148, 148, 149, 81, 149, 149, 84,
85, 86, 149, 88, 149, 90, 29, 92, 149, 149,
95, 149, 149, 149, 99, 100, 101, 149, 149, 104,
105, 149, 149, 108, 47, 48, 111, 112, 149, 149,
53, 149, 55, 150, 119, 150, 150, 150, 150, 150,
150, 150, 150, 150, 67, 150, 150, 150, 150, 47,
48, 150, 75, 76, 150, 53, 79, 55, 150, 150,
83, 150, 150, 148, 149, 151, 150, 150, 150, 67,
150, 150, 150, 150, 150, 150, 150, 75, 76, 150,
152, 79, 151, 151, 151, 83, 151, 151, 151, 151,
151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
151, -1, 152, 152, 152, 152, 152, 130, 152, 132,
133, 134, 135, 136, 137, 138, 152, 152, 152, 152,
152, 144, 145, 152, 152, 152, 152, 152, 151, -1,
153, 152, 130, 152, 132, 133, 134, 135, 136, 137,
138, 152, 152, 155, -1, 154, 144, 145, 155, 155,
155, 155, 155, 151, 155, 153, 155, -1, 155, 155,
155, 155, 155, 155, 155, -1, 156
);

protected $actionBase = array(
0, 220, 295, 370, 445, 109, 109, 180, 744, -2,
-2, -2, -2, -2, 135, 655, 724, 756, 724, 623,
554, 825, 825, 825, 438, 353, 625, 625, 862, 625,
427, 390, 377, 449, 536, 615, 562, 393, 393, 393,
393, 134, 134, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
393, 393, 393, 300, 179, 446, 475, 751, 750, 746,
745, 838, 684, 860, 798, 799, 604, 800, 801, 802,
803, 805, 797, 806, 898, 807, 568, 568, 568, 568,
568, 568, 568, 568, 568, 568, 568, -3, 365, 225,
308, 620, 662, 659, 659, 659, 659, 659, 659, 659,
505, 505, 505, 505, 505, 505, 505, 505, 505, 505,
505, 505, 505, 505, 505, 505, 505, 470, 552, 552,
552, 526, 887, 595, 912, 912, 912, 912, 912, 912,
912, 912, 912, 912, 912, 912, 912, 912, 912, 912,
912, 912, 912, 912, 912, 912, 912, 912, 912, 912,
912, 912, 912, 912, 912, 912, 912, 912, 912, 912,
912, 912, 912, 912, 912, 912, 912, 493, -20, -20,
477, 626, 402, 632, 210, 555, 197, 25, 25, 25,
25, 25, 17, 45, 5, 5, 5, 5, 335, 380,
380, 380, 380, 118, 118, 118, 118, 833, 827, 826,
821, 311, 311, 709, 709, 631, 779, 627, 627, 630,
630, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 383, 105, 859, 130, 130, 130, 130, 306, 44,
657, 920, 264, 264, 264, 306, 248, 248, 248, 297,
297, 297, 76, 687, 371, 86, 86, 86, 86, 371,
86, 86, 588, 588, 588, 435, 759, 686, 436, 443,
97, 483, 693, 819, 691, 796, 549, 710, 96, 717,
716, 398, 675, 613, 610, 586, 651, 355, 398, 300,
557, 423, 607, 753, 667, 38, 747, 328, 268, 424,
547, 315, -6, 279, 782, 755, 863, 861, 249, 133,
703, 607, 607, 607, 74, 199, 783, 789, 315, 290,
614, 614, 614, 614, 835, 792, 614, 614, 614, 614,
834, 795, 267, 67, 793, 137, 749, 642, 642, 642,
642, 642, 642, 608, 642, 853, 671, 843, 843, 660,
683, 608, 856, 856, 856, 856, 608, 642, 843, 843,
608, 631, 843, 168, 608, 666, 642, 664, 664, 856,
736, 735, 671, 673, 694, 843, 843, 843, 694, 660,
608, 856, 697, 641, 209, 843, 856, 618, 618, 697,
608, 618, 683, 618, 20, 597, 643, 855, 858, 852,
644, 790, 668, 658, 847, 846, 857, 661, 672, 848,
845, 720, 734, 733, 656, 513, 649, 647, 645, 634,
705, 605, 702, 675, 723, 585, 585, 585, 706, 707,
706, 585, 585, 585, 585, 585, 585, 585, 585, 911,
712, 676, 654, 665, 732, 481, 699, 689, 502, 772,
663, 720, 720, 831, 876, 885, 901, 704, 653, 842,
878, 706, 919, 738, 277, 606, 841, 832, 713, 652,
719, 706, 824, 706, 773, 706, 875, 830, 669, 720,
828, 585, 874, 918, 917, 916, 915, 914, 913, 903,
909, 650, 907, 731, 678, 884, 47, 854, 651, 708,
648, 730, 159, 906, 822, 706, 706, 774, 759, 706,
778, 729, 737, 900, 728, 883, 905, 663, 882, 706,
674, 904, 159, 616, 646, 891, 680, 726, 851, 682,
866, 850, 758, 574, 524, 721, 612, 752, 899, 889,
864, 743, 763, 765, 576, 688, 685, 679, 839, 769,
849, 722, 808, 811, 877, 692, 723, 711, 670, 690,
681, 770, 814, 881, 739, 740, 741, 818, 742, 836,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
134, 134, 134, 134, -2, -2, -2, -2, 0, 0,
0, 0, 0, -2, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
0, 0, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 568, 568, 568, 568, 568, 568, 568, 568,
568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
568, 568, 568, 568, 568, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 568, -20, -20, -20,
-20, 568, -20, -20, -20, -20, -20, -20, -20, 568,
568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
568, 568, 568, 568, 568, 568, -20, 568, 568, 568,
-20, 420, -20, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 568, 0, 0, 568,
-20, 568, -20, 568, -20, 568, 568, 568, 568, 568,
568, -20, -20, -20, -20, -20, -20, 0, 248, 248,
248, 248, -20, -20, -20, -20, 55, 55, 55, 55,
420, 420, 420, 420, 420, 420, 248, 248, 297, 297,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
420, 55, 420, 642, 642, 642, 642, 642, 371, 371,
371, 106, 106, 106, 642, 0, 0, 0, 0, 0,
0, 642, 371, 0, 420, 420, 420, 420, 0, 420,
420, 642, 642, 642, 642, 106, 371, 642, 843, 0,
106, 591, 591, 591, 591, 159, 315, 0, 642, 642,
0, 673, 0, 0, 0, 843, 0, 0, 0, 0,
0, 585, 277, 842, 0, 360, 0, 0, 0, 0,
0, 0, 0, 653, 360, 450, 450, 0, 0, 650,
585, 585, 585, 0, 0, 653, 653, 0, 0, 0,
0, 0, 0, 379, 653, 0, 0, 0, 0, 379,
333, 0, 0, 333, 0, 159
);

protected $actionDefault = array(
3,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767, 525, 525,32767, 481,
32767,32767,32767,32767,32767,32767,32767, 287, 287, 287,
32767,32767,32767, 513, 513, 513, 513, 513, 513, 513,
513, 513, 513, 513,32767,32767,32767,32767,32767, 369,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767, 375, 530,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767, 350, 351, 353, 354,
286, 514, 237, 376, 529, 285, 239, 314, 485,32767,
32767,32767, 316, 116, 248, 193, 484, 119, 284, 224,
368, 370, 315, 291, 296, 297, 298, 299, 300, 301,
302, 303, 304, 305, 306, 307, 290, 441, 347, 346,
345, 443,32767, 442, 478, 478, 481,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767, 312, 469, 468,
313, 439, 317, 440, 319, 444, 318, 335, 336, 333,
334, 337, 446, 445, 462, 463, 460, 461, 289, 338,
339, 340, 341, 464, 465, 466, 467, 271, 271, 271,
271,32767,32767, 524, 524,32767,32767, 326, 327, 453,
454,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767, 272,32767, 228, 228, 228, 228, 228,32767,
32767,32767,32767,32767,32767,32767, 321, 322, 320, 448,
449, 447,32767, 415,32767,32767,32767,32767,32767, 417,
32767,32767,32767,32767,32767,32767,32767,32767,32767, 486,
32767,32767,32767,32767,32767,32767,32767, 499, 404,32767,
32767,32767, 397, 212, 214, 161, 472,32767,32767,32767,
32767, 504, 331,32767,32767,32767,32767,32767,32767, 539,
32767, 499,32767,32767,32767,32767,32767,32767,32767,32767,
344, 323, 324, 325,32767,32767,32767,32767, 503, 497,
456, 457, 458, 459,32767,32767, 450, 451, 452, 455,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767, 165,32767, 412,32767, 418, 418,32767,
32767, 165,32767,32767,32767,32767, 165,32767, 502, 501,
165,32767, 398, 480, 165, 178,32767, 176, 176,32767,
198, 198,32767,32767, 180, 473, 492,32767, 180,32767,
165,32767, 386, 167, 480,32767,32767, 230, 230, 386,
165, 230,32767, 230,32767, 82, 422,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767, 399,32767,32767,32767,32767, 365, 366, 475, 488,
32767, 489,32767, 397,32767, 329, 330, 332, 309,32767,
311, 355, 356, 357, 358, 359, 360, 361, 363,32767,
402,32767, 405,32767,32767,32767, 84, 108, 247,32767,
537, 84, 400,32767,32767, 294, 537,32767,32767,32767,
32767, 532,32767,32767, 288,32767,32767,32767, 84,32767,
84, 243,32767, 163,32767, 522,32767, 497,32767, 401,
32767, 328,32767,32767,32767,32767,32767,32767,32767,32767,
32767, 498,32767,32767,32767,32767, 219,32767, 435,32767,
84,32767, 179,32767,32767, 292, 238,32767,32767, 531,
32767,32767,32767,32767,32767,32767,32767,32767,32767, 164,
32767,32767, 181,32767,32767, 497,32767,32767,32767,32767,
32767,32767,32767,32767, 283,32767,32767,32767,32767,32767,
497,32767,32767,32767, 223,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767, 82, 60,32767, 265,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
121, 121, 3, 121, 121, 3, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 206, 250, 209,
198, 198, 158, 250, 250, 250, 121, 121, 257
);

protected $goto = array(
162, 162, 136, 136, 141, 136, 137, 138, 139, 144,
146, 183, 164, 160, 160, 160, 160, 141, 141, 161,
161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
156, 157, 158, 159, 180, 135, 181, 495, 496, 362,
497, 501, 502, 503, 504, 505, 506, 507, 508, 964,
140, 142, 143, 145, 167, 172, 182, 198, 247, 250,
252, 254, 256, 257, 258, 259, 260, 261, 269, 270,
271, 272, 287, 288, 316, 317, 318, 381, 382, 383,
551, 184, 185, 186, 187, 188, 189, 190, 191, 192,
193, 194, 195, 196, 147, 148, 149, 163, 150, 165,
151, 199, 166, 152, 153, 154, 200, 155, 133, 627,
569, 786, 569, 569, 569, 569, 569, 569, 569, 569,
569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
569, 569, 569, 569, 569, 569, 569, 569, 569, 569,
569, 569, 569, 569, 569, 1102, 636, 1102, 1102, 1102,
1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102, 1102,
525, 817, 499, 499, 499, 499, 499, 499, 1171, 510,
1171, 510, 499, 499, 499, 499, 499, 499, 499, 499,
499, 499, 511, 552, 511, 582, 608, 524, 887, 887,
1192, 1192, 755, 851, 851, 851, 851, 170, 846, 852,
524, 524, 173, 174, 175, 390, 391, 392, 393, 169,
197, 201, 203, 251, 253, 255, 262, 263, 264, 265,
266, 267, 273, 274, 275, 276, 289, 290, 319, 320,
321, 396, 397, 398, 399, 171, 176, 248, 249, 177,
178, 179, 389, 610, 545, 545, 575, 541, 8, 343,
1078, 1077, 543, 543, 498, 500, 531, 547, 576, 579,
589, 595, 550, 756, 568, 574, 568, 568, 568, 568,
568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
568, 568, 568, 568, 568, 568, 568, 568, 568, 516,
445, 447, 935, 638, 329, 311, 1103, 620, 933, 521,
521, 521, 521, 779, 553, 554, 555, 556, 557, 558,
559, 560, 562, 591, 857, 613, 540, 521, 619, 512,
360, 512, 905, 432, 432, 432, 432, 432, 432, 546,
779, 779, 1196, 432, 432, 432, 432, 432, 432, 432,
432, 432, 432, 1067, 1163, 1067, 894, 894, 894, 894,
894, 1170, 363, 1170, 585, 588, 633, 894, 371, 371,
371, 1060, 1186, 1186, 1186, 3, 4, 1067, 1067, 1067,
1067, 600, 1067, 1067, 521, 521, 538, 570, 521, 521,
617, 521, 371, 1151, 962, 609, 1169, 388, 772, 772,
780, 780, 780, 782, 522, 771, 1189, 1202, 1202, 537,
377, 659, 564, 549, 596, 884, 615, 618, 880, 622,
623, 630, 632, 637, 639, 900, 1202, 1203, 1203, 364,
592, 346, 406, 529, 1205, 754, 891, 542, 278, 279,
280, 1011, 349, 1063, 1064, 400, 1203, 1060, 873, 855,
853, 855, 657, 453, 513, 882, 877, 1083, 344, 345,
1061, 1162, 1061, 12, 1021, 19, 15, 357, 775, 773,
1062, 370, 375, 909, 404, 666, 1053, 448, 1058, 783,
580, 563, 861, 914, 1148, 461, 951, 0, 0, 0,
0, 0, 0, 23, 0, 0, 0, 0, 606, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 943, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
530
);

protected $gotoCheck = array(
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 53,
63, 25, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 119, 5, 119, 119, 119,
119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
94, 46, 110, 110, 110, 110, 110, 110, 111, 63,
111, 63, 110, 110, 110, 110, 110, 110, 110, 110,
110, 110, 110, 40, 110, 36, 36, 40, 71, 71,
71, 71, 11, 63, 63, 63, 63, 23, 63, 63,
40, 40, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 47, 47, 47, 47, 47, 47, 91, 66,
117, 117, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 2, 12, 53, 2, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 8,
7, 7, 7, 7, 118, 118, 7, 7, 7, 8,
8, 8, 8, 19, 103, 103, 103, 103, 103, 103,
103, 103, 103, 103, 29, 57, 8, 8, 57, 115,
57, 115, 78, 53, 53, 53, 53, 53, 53, 102,
19, 19, 132, 53, 53, 53, 53, 53, 53, 53,
53, 53, 53, 53, 76, 53, 53, 53, 53, 53,
53, 112, 43, 112, 56, 56, 56, 53, 116, 116,
116, 76, 112, 112, 112, 26, 26, 53, 53, 53,
53, 120, 53, 53, 8, 8, 8, 8, 8, 8,
53, 8, 116, 124, 94, 45, 112, 116, 19, 19,
19, 19, 19, 19, 8, 19, 130, 133, 133, 28,
44, 28, 28, 8, 28, 28, 28, 28, 28, 28,
28, 28, 28, 28, 28, 75, 133, 134, 134, 54,
64, 64, 64, 54, 133, 10, 73, 54, 61, 61,
61, 95, 14, 76, 76, 18, 134, 76, 10, 10,
10, 10, 10, 54, 10, 10, 10, 30, 66, 66,
76, 76, 76, 54, 30, 30, 30, 30, 21, 20,
76, 9, 13, 79, 17, 68, 106, 59, 108, 22,
60, 30, 65, 80, 123, 101, 93, -1, -1, -1,
-1, -1, -1, 30, -1, -1, -1, -1, 30, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 91, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
94
);

protected $gotoBase = array(
0, 0, -340, 0, 0, 142, 0, 345, 27, 186,
483, 230, 301, 173, 170, 0, 0, 116, 162, 41,
169, 184, 87, 35, 0, 101, -241, 0, -182, 354,
92, 0, 0, 0, 0, 0, 187, 0, 0, -24,
199, 0, 0, 372, 168, 163, 183, 1, 0, 0,
0, 0, 0, 102, 53, 0, 109, -83, 0, 89,
82, -175, 0, -92, 154, 83, -152, 0, 166, 0,
0, -53, 0, 178, 0, 160, 65, 0, 357, 165,
90, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 274, 0, 74, 159, 188, 0, 0, 0, 0,
0, 76, 362, 320, 0, 0, 108, 0, 107, 0,
-79, -93, 110, 0, 0, 78, 106, -23, 31, -47,
226, 0, 0, 80, 237, 0, 0, 0, 0, 0,
172, 0, 363, 147, 167, 0, 0
);

protected $gotoDefault = array(
-32768, 464, 670, 2, 671, 742, 750, 603, 481, 517,
792, 793, 794, 366, 412, 482, 365, 401, 394, 781,
774, 776, 784, 168, 402, 787, 1, 789, 523, 825,
1012, 353, 797, 354, 594, 799, 533, 801, 802, 134,
483, 367, 368, 534, 376, 583, 816, 268, 373, 818,
355, 819, 828, 356, 616, 599, 565, 612, 484, 444,
577, 277, 544, 1075, 572, 860, 342, 868, 667, 876,
879, 485, 566, 890, 450, 898, 1088, 384, 904, 910,
915, 918, 420, 403, 590, 922, 923, 7, 927, 628,
629, 942, 302, 950, 963, 418, 1031, 1033, 486, 487,
527, 458, 509, 532, 488, 1054, 438, 405, 1057, 489,
490, 428, 429, 1072, 348, 1156, 347, 446, 310, 1143,
586, 1107, 454, 1195, 1152, 339, 491, 492, 361, 378,
1190, 433, 1197, 1204, 337, 369, 573
);

protected $ruleToNonTerminal = array(
0, 1, 3, 3, 2, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 6, 6, 6, 6, 6, 6, 6,
7, 7, 8, 8, 9, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 14, 14, 15, 15,
15, 15, 17, 17, 13, 13, 18, 18, 19, 19,
20, 20, 21, 21, 16, 16, 22, 24, 24, 25,
26, 26, 28, 27, 27, 27, 27, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
29, 29, 29, 29, 29, 29, 10, 10, 50, 50,
52, 51, 51, 44, 44, 54, 54, 55, 55, 11,
12, 12, 12, 58, 58, 58, 59, 59, 62, 62,
60, 60, 64, 64, 37, 37, 46, 46, 49, 49,
49, 48, 48, 65, 38, 38, 38, 38, 66, 66,
67, 67, 68, 68, 35, 35, 31, 31, 69, 33,
33, 70, 32, 32, 34, 34, 45, 45, 45, 56,
56, 72, 72, 73, 73, 75, 75, 75, 74, 74,
57, 57, 76, 76, 76, 77, 77, 78, 78, 78,
41, 41, 79, 79, 79, 42, 42, 80, 80, 61,
61, 81, 81, 81, 81, 86, 86, 87, 87, 88,
88, 88, 88, 88, 89, 90, 90, 85, 85, 82,
82, 84, 84, 92, 92, 91, 91, 91, 91, 91,
91, 83, 83, 93, 93, 43, 43, 36, 36, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
39, 39, 39, 30, 30, 40, 40, 98, 98, 99,
99, 99, 99, 105, 94, 94, 101, 101, 107, 107,
108, 109, 109, 109, 109, 109, 109, 63, 63, 53,
53, 53, 95, 95, 113, 113, 110, 110, 114, 114,
114, 114, 96, 96, 96, 100, 100, 100, 106, 106,
119, 119, 119, 119, 119, 119, 119, 119, 119, 119,
119, 119, 119, 23, 23, 23, 23, 23, 23, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 104, 104, 97, 97, 97, 97, 120, 120,
123, 123, 122, 122, 124, 124, 47, 47, 47, 47,
126, 126, 125, 125, 125, 125, 125, 127, 127, 112,
112, 115, 115, 111, 111, 128, 128, 128, 128, 116,
116, 116, 116, 103, 103, 117, 117, 117, 117, 71,
129, 129, 130, 130, 130, 102, 102, 131, 131, 132,
132, 132, 132, 118, 118, 118, 118, 134, 135, 133,
133, 133, 133, 133, 133, 133, 136, 136, 136
);

protected $ruleToLength = array(
1, 1, 2, 0, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 3, 1, 1, 1, 1, 1, 3,
5, 4, 3, 4, 2, 3, 1, 1, 7, 8,
6, 7, 3, 1, 3, 1, 3, 1, 1, 3,
1, 2, 1, 2, 3, 1, 3, 3, 1, 3,
2, 0, 1, 1, 1, 1, 1, 3, 5, 8,
3, 5, 9, 3, 2, 3, 2, 3, 2, 3,
2, 3, 3, 3, 1, 2, 5, 7, 9, 5,
6, 3, 3, 2, 2, 1, 1, 1, 0, 2,
8, 0, 4, 1, 3, 0, 1, 0, 1, 10,
7, 6, 5, 1, 2, 2, 0, 2, 0, 2,
0, 2, 1, 3, 1, 4, 1, 4, 1, 1,
4, 1, 3, 3, 3, 4, 4, 5, 0, 2,
4, 3, 1, 1, 1, 4, 0, 2, 3, 0,
2, 4, 0, 2, 0, 3, 1, 2, 1, 1,
0, 1, 3, 4, 6, 1, 1, 1, 0, 1,
0, 2, 2, 3, 3, 1, 3, 1, 2, 2,
3, 1, 1, 2, 4, 3, 1, 1, 3, 2,
0, 3, 3, 9, 3, 1, 3, 0, 2, 4,
5, 4, 4, 4, 3, 1, 1, 1, 3, 1,
1, 0, 1, 1, 2, 1, 1, 1, 1, 1,
1, 1, 3, 1, 3, 3, 1, 0, 1, 1,
3, 3, 4, 4, 1, 2, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 1, 3, 5, 4, 3, 4, 4,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 1, 1, 1, 3, 2, 1,
2, 10, 11, 3, 3, 2, 4, 4, 3, 4,
4, 4, 4, 7, 3, 2, 0, 4, 1, 3,
2, 2, 4, 6, 2, 2, 4, 1, 1, 1,
2, 3, 1, 1, 1, 1, 1, 1, 3, 3,
4, 4, 0, 2, 1, 0, 1, 1, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 3, 2, 1, 3, 1, 4, 3, 1, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 5, 4,
4, 3, 1, 3, 1, 1, 3, 3, 0, 2,
0, 1, 3, 1, 3, 1, 1, 1, 1, 1,
6, 4, 3, 4, 2, 4, 4, 1, 3, 1,
2, 1, 1, 4, 1, 3, 6, 4, 4, 4,
4, 1, 4, 0, 1, 1, 3, 1, 1, 4,
3, 1, 1, 1, 0, 0, 2, 3, 1, 3,
1, 4, 2, 2, 2, 1, 2, 1, 1, 1,
4, 3, 3, 3, 6, 3, 1, 1, 1
);

protected function reduceRule0() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule1() {
$this->semValue = $this->handleNamespaces($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule2() {
if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; };
}

protected function reduceRule3() {
$this->semValue = array();
}

protected function reduceRule4() {
$startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; };
if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule5() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule6() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule7() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule8() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule9() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule10() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule11() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule12() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule13() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule14() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule15() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule16() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule17() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule18() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule19() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule20() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule21() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule22() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule23() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule24() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule25() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule26() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule27() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule28() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule29() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule30() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule31() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule32() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule33() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule34() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule35() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule36() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule37() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule38() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule39() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule40() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule41() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule42() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule43() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule44() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule45() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule46() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule47() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule48() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule49() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule50() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule51() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule52() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule53() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule54() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule55() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule56() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule57() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule58() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule59() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule60() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule61() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule62() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule63() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule64() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule65() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule66() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule67() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule68() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule69() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule70() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule71() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule72() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule73() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule74() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule75() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule76() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule77() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule78() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule79() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule80() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule81() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule82() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule83() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule84() {
$this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule85() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule86() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule87() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule88() {
$this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule89() {
$this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(3-2)], null, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
$this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON);
$this->checkNamespace($this->semValue);
}

protected function reduceRule90() {
$this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
$this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED);
$this->checkNamespace($this->semValue);
}

protected function reduceRule91() {
$this->semValue = new Stmt\Namespace_(null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
$this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED);
$this->checkNamespace($this->semValue);
}

protected function reduceRule92() {
$this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule93() {
$this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule94() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule95() {
$this->semValue = new Stmt\Const_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule96() {
$this->semValue = Stmt\Use_::TYPE_FUNCTION;
}

protected function reduceRule97() {
$this->semValue = Stmt\Use_::TYPE_CONSTANT;
}

protected function reduceRule98() {
$this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-3)] + $this->endAttributeStack[$this->stackPos-(7-3)]), $this->semStack[$this->stackPos-(7-6)], $this->semStack[$this->stackPos-(7-2)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
}

protected function reduceRule99() {
$this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(8-4)], $this->startAttributeStack[$this->stackPos-(8-4)] + $this->endAttributeStack[$this->stackPos-(8-4)]), $this->semStack[$this->stackPos-(8-7)], $this->semStack[$this->stackPos-(8-2)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes);
}

protected function reduceRule100() {
$this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-2)] + $this->endAttributeStack[$this->stackPos-(6-2)]), $this->semStack[$this->stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
}

protected function reduceRule101() {
$this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-3)] + $this->endAttributeStack[$this->stackPos-(7-3)]), $this->semStack[$this->stackPos-(7-6)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
}

protected function reduceRule102() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule103() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule104() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule105() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule106() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule107() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule108() {
$this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $this->stackPos-(1-1));
}

protected function reduceRule109() {
$this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $this->stackPos-(3-3));
}

protected function reduceRule110() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule111() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule112() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)]; $this->semValue->type = Stmt\Use_::TYPE_NORMAL;
}

protected function reduceRule113() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)]; $this->semValue->type = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule114() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule115() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule116() {
$this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule117() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule118() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule119() {
$this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule120() {
if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; };
}

protected function reduceRule121() {
$this->semValue = array();
}

protected function reduceRule122() {
$startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; };
if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule123() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule124() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule125() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule126() {
throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule127() {

if ($this->semStack[$this->stackPos-(3-2)]) {
$this->semValue = $this->semStack[$this->stackPos-(3-2)]; $attrs = $this->startAttributeStack[$this->stackPos-(3-1)]; $stmts = $this->semValue; if (!empty($attrs['comments'])) {$stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); };
} else {
$startAttributes = $this->startAttributeStack[$this->stackPos-(3-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; };
if (null === $this->semValue) { $this->semValue = array(); }
}

}

protected function reduceRule128() {
$this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(5-2)], ['stmts' => is_array($this->semStack[$this->stackPos-(5-3)]) ? $this->semStack[$this->stackPos-(5-3)] : array($this->semStack[$this->stackPos-(5-3)]), 'elseifs' => $this->semStack[$this->stackPos-(5-4)], 'else' => $this->semStack[$this->stackPos-(5-5)]], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule129() {
$this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(8-2)], ['stmts' => $this->semStack[$this->stackPos-(8-4)], 'elseifs' => $this->semStack[$this->stackPos-(8-5)], 'else' => $this->semStack[$this->stackPos-(8-6)]], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes);
}

protected function reduceRule130() {
$this->semValue = new Stmt\While_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule131() {
$this->semValue = new Stmt\Do_($this->semStack[$this->stackPos-(5-4)], is_array($this->semStack[$this->stackPos-(5-2)]) ? $this->semStack[$this->stackPos-(5-2)] : array($this->semStack[$this->stackPos-(5-2)]), $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule132() {
$this->semValue = new Stmt\For_(['init' => $this->semStack[$this->stackPos-(9-3)], 'cond' => $this->semStack[$this->stackPos-(9-5)], 'loop' => $this->semStack[$this->stackPos-(9-7)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes);
}

protected function reduceRule133() {
$this->semValue = new Stmt\Switch_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule134() {
$this->semValue = new Stmt\Break_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule135() {
$this->semValue = new Stmt\Break_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule136() {
$this->semValue = new Stmt\Continue_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule137() {
$this->semValue = new Stmt\Continue_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule138() {
$this->semValue = new Stmt\Return_(null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule139() {
$this->semValue = new Stmt\Return_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule140() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule141() {
$this->semValue = new Stmt\Global_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule142() {
$this->semValue = new Stmt\Static_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule143() {
$this->semValue = new Stmt\Echo_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule144() {
$this->semValue = new Stmt\InlineHTML($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule145() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule146() {
$this->semValue = new Stmt\Unset_($this->semStack[$this->stackPos-(5-3)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule147() {
$this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(7-3)], $this->semStack[$this->stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$this->stackPos-(7-5)][1], 'stmts' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
}

protected function reduceRule148() {
$this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(9-3)], $this->semStack[$this->stackPos-(9-7)][0], ['keyVar' => $this->semStack[$this->stackPos-(9-5)], 'byRef' => $this->semStack[$this->stackPos-(9-7)][1], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes);
}

protected function reduceRule149() {
$this->semValue = new Stmt\Declare_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule150() {
$this->semValue = new Stmt\TryCatch($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-5)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); $this->checkTryCatch($this->semValue);
}

protected function reduceRule151() {
$this->semValue = new Stmt\Throw_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule152() {
$this->semValue = new Stmt\Goto_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule153() {
$this->semValue = new Stmt\Label($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule154() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule155() {
$this->semValue = array(); 
}

protected function reduceRule156() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule157() {
$startAttributes = $this->startAttributeStack[$this->stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; };
if ($this->semValue === null) $this->semValue = array(); 
}

protected function reduceRule158() {
$this->semValue = array();
}

protected function reduceRule159() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule160() {
$this->semValue = new Stmt\Catch_(array($this->semStack[$this->stackPos-(8-3)]), substr($this->semStack[$this->stackPos-(8-4)], 1), $this->semStack[$this->stackPos-(8-7)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes);
}

protected function reduceRule161() {
$this->semValue = null;
}

protected function reduceRule162() {
$this->semValue = new Stmt\Finally_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule163() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule164() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule165() {
$this->semValue = false;
}

protected function reduceRule166() {
$this->semValue = true;
}

protected function reduceRule167() {
$this->semValue = false;
}

protected function reduceRule168() {
$this->semValue = true;
}

protected function reduceRule169() {
$this->semValue = new Stmt\Function_($this->semStack[$this->stackPos-(10-3)], ['byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-5)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes);
}

protected function reduceRule170() {
$this->semValue = new Stmt\Class_($this->semStack[$this->stackPos-(7-2)], ['type' => $this->semStack[$this->stackPos-(7-1)], 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
$this->checkClass($this->semValue, $this->stackPos-(7-2));
}

protected function reduceRule171() {
$this->semValue = new Stmt\Interface_($this->semStack[$this->stackPos-(6-2)], ['extends' => $this->semStack[$this->stackPos-(6-3)], 'stmts' => $this->semStack[$this->stackPos-(6-5)]], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
$this->checkInterface($this->semValue, $this->stackPos-(6-2));
}

protected function reduceRule172() {
$this->semValue = new Stmt\Trait_($this->semStack[$this->stackPos-(5-2)], ['stmts' => $this->semStack[$this->stackPos-(5-4)]], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule173() {
$this->semValue = 0;
}

protected function reduceRule174() {
$this->semValue = Stmt\Class_::MODIFIER_ABSTRACT;
}

protected function reduceRule175() {
$this->semValue = Stmt\Class_::MODIFIER_FINAL;
}

protected function reduceRule176() {
$this->semValue = null;
}

protected function reduceRule177() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule178() {
$this->semValue = array();
}

protected function reduceRule179() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule180() {
$this->semValue = array();
}

protected function reduceRule181() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule182() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule183() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule184() {
$this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule185() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule186() {
$this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule187() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule188() {
$this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule189() {
$this->semValue = null;
}

protected function reduceRule190() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule191() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule192() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule193() {
$this->semValue = new Stmt\DeclareDeclare($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule194() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule195() {
$this->semValue = $this->semStack[$this->stackPos-(4-3)];
}

protected function reduceRule196() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule197() {
$this->semValue = $this->semStack[$this->stackPos-(5-3)];
}

protected function reduceRule198() {
$this->semValue = array();
}

protected function reduceRule199() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule200() {
$this->semValue = new Stmt\Case_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule201() {
$this->semValue = new Stmt\Case_(null, $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule202() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule203() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule204() {
$this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule205() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule206() {
$this->semValue = array();
}

protected function reduceRule207() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule208() {
$this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(3-2)], is_array($this->semStack[$this->stackPos-(3-3)]) ? $this->semStack[$this->stackPos-(3-3)] : array($this->semStack[$this->stackPos-(3-3)]), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule209() {
$this->semValue = array();
}

protected function reduceRule210() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule211() {
$this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule212() {
$this->semValue = null;
}

protected function reduceRule213() {
$this->semValue = new Stmt\Else_(is_array($this->semStack[$this->stackPos-(2-2)]) ? $this->semStack[$this->stackPos-(2-2)] : array($this->semStack[$this->stackPos-(2-2)]), $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule214() {
$this->semValue = null;
}

protected function reduceRule215() {
$this->semValue = new Stmt\Else_($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule216() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)], false);
}

protected function reduceRule217() {
$this->semValue = array($this->semStack[$this->stackPos-(2-2)], true);
}

protected function reduceRule218() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)], false);
}

protected function reduceRule219() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule220() {
$this->semValue = array();
}

protected function reduceRule221() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule222() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule223() {
$this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(4-4)], 1), null, $this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); $this->checkParam($this->semValue);
}

protected function reduceRule224() {
$this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(6-4)], 1), $this->semStack[$this->stackPos-(6-6)], $this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-3)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); $this->checkParam($this->semValue);
}

protected function reduceRule225() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule226() {
$this->semValue = 'array';
}

protected function reduceRule227() {
$this->semValue = 'callable';
}

protected function reduceRule228() {
$this->semValue = null;
}

protected function reduceRule229() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule230() {
$this->semValue = null;
}

protected function reduceRule231() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule232() {
$this->semValue = array();
}

protected function reduceRule233() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule234() {
$this->semValue = array(new Node\Arg($this->semStack[$this->stackPos-(3-2)], false, false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes));
}

protected function reduceRule235() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule236() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule237() {
$this->semValue = new Node\Arg($this->semStack[$this->stackPos-(1-1)], false, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule238() {
$this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], true, false, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule239() {
$this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], false, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule240() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule241() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule242() {
$this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule243() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule244() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule245() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule246() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule247() {
$this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule248() {
$this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule249() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule250() {
$this->semValue = array();
}

protected function reduceRule251() {
$this->semValue = new Stmt\Property($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->checkProperty($this->semValue, $this->stackPos-(3-1));
}

protected function reduceRule252() {
$this->semValue = new Stmt\ClassConst($this->semStack[$this->stackPos-(3-2)], 0, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule253() {
$this->semValue = new Stmt\ClassMethod($this->semStack[$this->stackPos-(9-4)], ['type' => $this->semStack[$this->stackPos-(9-1)], 'byRef' => $this->semStack[$this->stackPos-(9-3)], 'params' => $this->semStack[$this->stackPos-(9-6)], 'returnType' => $this->semStack[$this->stackPos-(9-8)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes);
$this->checkClassMethod($this->semValue, $this->stackPos-(9-1));
}

protected function reduceRule254() {
$this->semValue = new Stmt\TraitUse($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule255() {
$this->semValue = array();
}

protected function reduceRule256() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule257() {
$this->semValue = array();
}

protected function reduceRule258() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule259() {
$this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule260() {
$this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(5-1)][0], $this->semStack[$this->stackPos-(5-1)][1], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule261() {
$this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], null, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule262() {
$this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule263() {
$this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule264() {
$this->semValue = array($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)]);
}

protected function reduceRule265() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule266() {
$this->semValue = array(null, $this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule267() {
$this->semValue = null;
}

protected function reduceRule268() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule269() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule270() {
$this->semValue = 0;
}

protected function reduceRule271() {
$this->semValue = 0;
}

protected function reduceRule272() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule273() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule274() {
$this->checkModifier($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->stackPos-(2-2)); $this->semValue = $this->semStack[$this->stackPos-(2-1)] | $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule275() {
$this->semValue = Stmt\Class_::MODIFIER_PUBLIC;
}

protected function reduceRule276() {
$this->semValue = Stmt\Class_::MODIFIER_PROTECTED;
}

protected function reduceRule277() {
$this->semValue = Stmt\Class_::MODIFIER_PRIVATE;
}

protected function reduceRule278() {
$this->semValue = Stmt\Class_::MODIFIER_STATIC;
}

protected function reduceRule279() {
$this->semValue = Stmt\Class_::MODIFIER_ABSTRACT;
}

protected function reduceRule280() {
$this->semValue = Stmt\Class_::MODIFIER_FINAL;
}

protected function reduceRule281() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule282() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule283() {
$this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule284() {
$this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule285() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule286() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule287() {
$this->semValue = array();
}

protected function reduceRule288() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule289() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule290() {
$this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule291() {
$this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule292() {
$this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule293() {
$this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule294() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule295() {
$this->semValue = new Expr\Clone_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule296() {
$this->semValue = new Expr\AssignOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule297() {
$this->semValue = new Expr\AssignOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule298() {
$this->semValue = new Expr\AssignOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule299() {
$this->semValue = new Expr\AssignOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule300() {
$this->semValue = new Expr\AssignOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule301() {
$this->semValue = new Expr\AssignOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule302() {
$this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule303() {
$this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule304() {
$this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule305() {
$this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule306() {
$this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule307() {
$this->semValue = new Expr\AssignOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule308() {
$this->semValue = new Expr\PostInc($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule309() {
$this->semValue = new Expr\PreInc($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule310() {
$this->semValue = new Expr\PostDec($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule311() {
$this->semValue = new Expr\PreDec($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule312() {
$this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule313() {
$this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule314() {
$this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule315() {
$this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule316() {
$this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule317() {
$this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule318() {
$this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule319() {
$this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule320() {
$this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule321() {
$this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule322() {
$this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule323() {
$this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule324() {
$this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule325() {
$this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule326() {
$this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule327() {
$this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule328() {
$this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule329() {
$this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule330() {
$this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule331() {
$this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule332() {
$this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule333() {
$this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule334() {
$this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule335() {
$this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule336() {
$this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule337() {
$this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule338() {
$this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule339() {
$this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule340() {
$this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule341() {
$this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule342() {
$this->semValue = new Expr\Instanceof_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule343() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule344() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule345() {
$this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule346() {
$this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule347() {
$this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule348() {
$this->semValue = new Expr\Isset_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule349() {
$this->semValue = new Expr\Empty_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule350() {
$this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule351() {
$this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule352() {
$this->semValue = new Expr\Eval_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule353() {
$this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule354() {
$this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule355() {
$this->semValue = new Expr\Cast\Int_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule356() {
$this->semValue = new Expr\Cast\Double($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule357() {
$this->semValue = new Expr\Cast\String_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule358() {
$this->semValue = new Expr\Cast\Array_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule359() {
$this->semValue = new Expr\Cast\Object_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule360() {
$this->semValue = new Expr\Cast\Bool_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule361() {
$this->semValue = new Expr\Cast\Unset_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule362() {
$attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes;
$attrs['kind'] = strtolower($this->semStack[$this->stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE;
$this->semValue = new Expr\Exit_($this->semStack[$this->stackPos-(2-2)], $attrs);
}

protected function reduceRule363() {
$this->semValue = new Expr\ErrorSuppress($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule364() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule365() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule366() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule367() {
$this->semValue = new Expr\ShellExec($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule368() {
$this->semValue = new Expr\Print_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule369() {
$this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule370() {
$this->semValue = new Expr\YieldFrom($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule371() {
$this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-4)], 'uses' => $this->semStack[$this->stackPos-(10-6)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes);
}

protected function reduceRule372() {
$this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$this->stackPos-(11-3)], 'params' => $this->semStack[$this->stackPos-(11-5)], 'uses' => $this->semStack[$this->stackPos-(11-7)], 'returnType' => $this->semStack[$this->stackPos-(11-8)], 'stmts' => $this->semStack[$this->stackPos-(11-10)]], $this->startAttributeStack[$this->stackPos-(11-1)] + $this->endAttributes);
}

protected function reduceRule373() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule374() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule375() {
$this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(2-2)], null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule376() {
$this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule377() {
$attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG;
$this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $attrs);
}

protected function reduceRule378() {
$attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT;
$this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $attrs);
}

protected function reduceRule379() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule380() {
$attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(4-1)][0] === "'" || ($this->semStack[$this->stackPos-(4-1)][1] === "'" && ($this->semStack[$this->stackPos-(4-1)][0] === 'b' || $this->semStack[$this->stackPos-(4-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED);
$this->semValue = new Expr\ArrayDimFetch(new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(4-1)]), $attrs), $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule381() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule382() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule383() {
$this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-2)]);
$this->checkClass($this->semValue[0], -1);
}

protected function reduceRule384() {
$this->semValue = new Expr\New_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule385() {
list($class, $ctorArgs) = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule386() {
$this->semValue = array();
}

protected function reduceRule387() {
$this->semValue = $this->semStack[$this->stackPos-(4-3)];
}

protected function reduceRule388() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule389() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule390() {
$this->semValue = new Expr\ClosureUse(substr($this->semStack[$this->stackPos-(2-2)], 1), $this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule391() {
$this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule392() {
$this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule393() {
$this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-4)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
}

protected function reduceRule394() {

if ($this->semStack[$this->stackPos-(2-1)] instanceof Node\Expr\StaticPropertyFetch) {
$this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(2-1)]->class, new Expr\Variable($this->semStack[$this->stackPos-(2-1)]->name, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
} elseif ($this->semStack[$this->stackPos-(2-1)] instanceof Node\Expr\ArrayDimFetch) {
$tmp = $this->semStack[$this->stackPos-(2-1)];
while ($tmp->var instanceof Node\Expr\ArrayDimFetch) {
$tmp = $tmp->var;
}

$this->semValue = new Expr\StaticCall($tmp->var->class, $this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
$tmp->var = new Expr\Variable($tmp->var->name, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
} else {
throw new \Exception;
}

}

protected function reduceRule395() {
$this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule396() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule397() {
$this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule398() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule399() {
$this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule400() {
$this->semValue = new Name\FullyQualified($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule401() {
$this->semValue = new Name\Relative($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule402() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule403() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule404() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule405() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule406() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule407() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule408() {
$this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule409() {
$this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule410() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule411() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule412() {
$this->semValue = null;
}

protected function reduceRule413() {
$this->semValue = null;
}

protected function reduceRule414() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule415() {
$this->semValue = array();
}

protected function reduceRule416() {
$this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$this->stackPos-(1-1)], '`', false), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes));
}

protected function reduceRule417() {
foreach ($this->semStack[$this->stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', false); } }; $this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule418() {
$this->semValue = array();
}

protected function reduceRule419() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule420() {
$this->semValue = $this->parseLNumber($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes, true);
}

protected function reduceRule421() {
$this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule422() {
$attrs = $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(1-1)][0] === "'" || ($this->semStack[$this->stackPos-(1-1)][1] === "'" && ($this->semStack[$this->stackPos-(1-1)][0] === 'b' || $this->semStack[$this->stackPos-(1-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED);
$this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)], false), $attrs);
}

protected function reduceRule423() {
$this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule424() {
$this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule425() {
$this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule426() {
$this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule427() {
$this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule428() {
$this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule429() {
$this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule430() {
$this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule431() {
$attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];;
$this->semValue = new Scalar\String_(Scalar\String_::parseDocString($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], false), $attrs);
}

protected function reduceRule432() {
$attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(2-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(2-1)], $matches); $attrs['docLabel'] = $matches[1];;
$this->semValue = new Scalar\String_('', $attrs);
}

protected function reduceRule433() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule434() {
$this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule435() {
$this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule436() {
$this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule437() {
$this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule438() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule439() {
$this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule440() {
$this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule441() {
$this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule442() {
$this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule443() {
$this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule444() {
$this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule445() {
$this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule446() {
$this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule447() {
$this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule448() {
$this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule449() {
$this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule450() {
$this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule451() {
$this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule452() {
$this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule453() {
$this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule454() {
$this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule455() {
$this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule456() {
$this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule457() {
$this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule458() {
$this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule459() {
$this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule460() {
$this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule461() {
$this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule462() {
$this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule463() {
$this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule464() {
$this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule465() {
$this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule466() {
$this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule467() {
$this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule468() {
$this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule469() {
$this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule470() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule471() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule472() {
$this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule473() {
$this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule474() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule475() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule476() {
$attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs);
}

protected function reduceRule477() {
$attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];;
foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, true); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs);
}

protected function reduceRule478() {
$this->semValue = array();
}

protected function reduceRule479() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule480() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule481() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule482() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule483() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule484() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule485() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule486() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule487() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule488() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule489() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule490() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-5)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
}

protected function reduceRule491() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule492() {
$this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule493() {
$this->semValue = new Expr\MethodCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule494() {
$this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule495() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule496() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule497() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule498() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule499() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule500() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule501() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule502() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule503() {
$this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule504() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule505() {
$this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], substr($this->semStack[$this->stackPos-(3-3)], 1), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule506() {
$this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-5)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
}

protected function reduceRule507() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule508() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule509() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule510() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule511() {
$this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule512() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule513() {
$this->semValue = null;
}

protected function reduceRule514() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule515() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule516() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule517() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule518() {
$this->semValue = new Expr\Error($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2;
}

protected function reduceRule519() {
$this->semValue = new Expr\List_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule520() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule521() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule522() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule523() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule524() {
$this->semValue = null;
}

protected function reduceRule525() {
$this->semValue = array();
}

protected function reduceRule526() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule527() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule528() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule529() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule530() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule531() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-1)], true, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule532() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(2-2)], null, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule533() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule534() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule535() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule536() {
$this->semValue = array($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]);
}

protected function reduceRule537() {
$this->semValue = new Scalar\EncapsedStringPart($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule538() {
$this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule539() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule540() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule541() {
$this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule542() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule543() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule544() {
$this->semValue = new Expr\ArrayDimFetch(new Expr\Variable($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-4)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
}

protected function reduceRule545() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule546() {
$this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule547() {
$this->semValue = $this->parseNumString($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule548() {
$this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}
}
<?php

namespace PhpParser\Parser;

use PhpParser\Error;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
use PhpParser\Node\Scalar;
use PhpParser\Node\Stmt;







class Php7 extends \PhpParser\ParserAbstract
{
protected $tokenToSymbolMapSize = 392;
protected $actionTableSize = 915;
protected $gotoTableSize = 429;

protected $invalidSymbol = 157;
protected $errorSymbol = 1;
protected $defaultAction = -32766;
protected $unexpectedTokenRule = 32767;

protected $YY2TBLSTATE = 330;
protected $YYNLSTATES = 578;

protected $symbolToName = array(
"EOF",
"error",
"T_INCLUDE",
"T_INCLUDE_ONCE",
"T_EVAL",
"T_REQUIRE",
"T_REQUIRE_ONCE",
"','",
"T_LOGICAL_OR",
"T_LOGICAL_XOR",
"T_LOGICAL_AND",
"T_PRINT",
"T_YIELD",
"T_DOUBLE_ARROW",
"T_YIELD_FROM",
"'='",
"T_PLUS_EQUAL",
"T_MINUS_EQUAL",
"T_MUL_EQUAL",
"T_DIV_EQUAL",
"T_CONCAT_EQUAL",
"T_MOD_EQUAL",
"T_AND_EQUAL",
"T_OR_EQUAL",
"T_XOR_EQUAL",
"T_SL_EQUAL",
"T_SR_EQUAL",
"T_POW_EQUAL",
"'?'",
"':'",
"T_COALESCE",
"T_BOOLEAN_OR",
"T_BOOLEAN_AND",
"'|'",
"'^'",
"'&'",
"T_IS_EQUAL",
"T_IS_NOT_EQUAL",
"T_IS_IDENTICAL",
"T_IS_NOT_IDENTICAL",
"T_SPACESHIP",
"'<'",
"T_IS_SMALLER_OR_EQUAL",
"'>'",
"T_IS_GREATER_OR_EQUAL",
"T_SL",
"T_SR",
"'+'",
"'-'",
"'.'",
"'*'",
"'/'",
"'%'",
"'!'",
"T_INSTANCEOF",
"'~'",
"T_INC",
"T_DEC",
"T_INT_CAST",
"T_DOUBLE_CAST",
"T_STRING_CAST",
"T_ARRAY_CAST",
"T_OBJECT_CAST",
"T_BOOL_CAST",
"T_UNSET_CAST",
"'@'",
"T_POW",
"'['",
"T_NEW",
"T_CLONE",
"T_EXIT",
"T_IF",
"T_ELSEIF",
"T_ELSE",
"T_ENDIF",
"T_LNUMBER",
"T_DNUMBER",
"T_STRING",
"T_STRING_VARNAME",
"T_VARIABLE",
"T_NUM_STRING",
"T_INLINE_HTML",
"T_ENCAPSED_AND_WHITESPACE",
"T_CONSTANT_ENCAPSED_STRING",
"T_ECHO",
"T_DO",
"T_WHILE",
"T_ENDWHILE",
"T_FOR",
"T_ENDFOR",
"T_FOREACH",
"T_ENDFOREACH",
"T_DECLARE",
"T_ENDDECLARE",
"T_AS",
"T_SWITCH",
"T_ENDSWITCH",
"T_CASE",
"T_DEFAULT",
"T_BREAK",
"T_CONTINUE",
"T_GOTO",
"T_FUNCTION",
"T_CONST",
"T_RETURN",
"T_TRY",
"T_CATCH",
"T_FINALLY",
"T_THROW",
"T_USE",
"T_INSTEADOF",
"T_GLOBAL",
"T_STATIC",
"T_ABSTRACT",
"T_FINAL",
"T_PRIVATE",
"T_PROTECTED",
"T_PUBLIC",
"T_VAR",
"T_UNSET",
"T_ISSET",
"T_EMPTY",
"T_HALT_COMPILER",
"T_CLASS",
"T_TRAIT",
"T_INTERFACE",
"T_EXTENDS",
"T_IMPLEMENTS",
"T_OBJECT_OPERATOR",
"T_LIST",
"T_ARRAY",
"T_CALLABLE",
"T_CLASS_C",
"T_TRAIT_C",
"T_METHOD_C",
"T_FUNC_C",
"T_LINE",
"T_FILE",
"T_START_HEREDOC",
"T_END_HEREDOC",
"T_DOLLAR_OPEN_CURLY_BRACES",
"T_CURLY_OPEN",
"T_PAAMAYIM_NEKUDOTAYIM",
"T_NAMESPACE",
"T_NS_C",
"T_DIR",
"T_NS_SEPARATOR",
"T_ELLIPSIS",
"';'",
"'{'",
"'}'",
"'('",
"')'",
"'`'",
"']'",
"'\"'",
"'$'"
);

protected $tokenToSymbol = array(
0, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 53, 155, 157, 156, 52, 35, 157,
151, 152, 50, 47, 7, 48, 49, 51, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 29, 148,
41, 15, 43, 28, 65, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 67, 157, 154, 34, 157, 153, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 149, 33, 150, 55, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
157, 157, 157, 157, 157, 157, 1, 2, 3, 4,
5, 6, 8, 9, 10, 11, 12, 13, 14, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 30, 31, 32, 36, 37, 38, 39, 40, 42,
44, 45, 46, 54, 56, 57, 58, 59, 60, 61,
62, 63, 64, 66, 68, 69, 70, 71, 72, 73,
74, 75, 76, 77, 78, 79, 80, 81, 157, 157,
82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
132, 133, 134, 135, 136, 137, 157, 157, 157, 157,
157, 157, 138, 139, 140, 141, 142, 143, 144, 145,
146, 147
);

protected $action = array(
583, 584, 585, 586, 587, 1037, 588, 589, 590, 626,
627, 479, 29, 101, 102, 103, 104, 105, 106, 107,
108, 109, 110, 111, 112,-32766,-32766,-32766, 97, 98,
99, 0, 241, 387, -282,-32766,-32766,-32766,-32766, -487,
1081, 544, 1084, 1082, 100,-32766, 664,-32766,-32766,-32766,
-32766,-32766, 591, 901, 903,-32766, 30,-32766,-32766,-32766,
-32766,-32766,-32766, 1034,-32766, 295, 592, 593, 594, 595,
596, 597, 598,-32766, 274, 658, 869, 870, 871, 868,
867, 866, 599, 600, 601, 602, 603, 604, 605, 606,
607, 608, 609, 629, 630, 631, 632, 633, 621, 622,
623, 624, 625, 610, 611, 612, 613, 614, 615, 616,
652, 653, 654, 655, 656, 657, 617, 618, 619, 620,
650, 641, 639, 640, 636, 637, -251, 628, 634, 635,
642, 643, 645, 644, 646, 647, 74, 75, 76, 556,
266, 638, 649, 648, 739, 44, 45, 392, 46, 47,
375, 680, 681, 73, 48, 49, 28, 50, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
99, 218, 241, 996, -487, -443, -487,-32766,-32766,-32766,
51, 52, 116, 663, 100, 339, 53, 242, 54, 221,
222, 55, 56, 57, 58, 59, 60, 61, 62, -173,
24, 234, 63, 347, 393,-32766,-32766,-32766, 1001, 1002,
394, 228, 1034, 217, 729,-32766, 1000, 34, 19, 395,
1051, 396, 127, 397, 118, 398, -442, 24, 399, 984,
43, 267, 36, 37, 400, 351, -443, 38, 401, 1034,
248, 64, 289, 1000, 288, 290, 248,-32766, 741, 226,
-443, 1034, 404, 405, 406, 442, 291, -443, 371, -446,
376, -251, 409, 410, 26, 1006, 1007, 1008, 1009, 1003,
1004, 245, 977,-32766,-32766,-32766, 419, 1010, 1005, 349,
-488, 226, 549, 278, 65,-32766, 257, -442, 262, 266,
410, 660, 467,-32766, 1073,-32766, 1048, 1072,-32766,-32766,
-32766, -442,-32766,-32766,-32766, 1078,-32766, 1034, -442,-32766,
-445, 67, 1014,-32766,-32766,-32766, 266,-32766,-32766,-32766,
-479, 123,-32766, 660, -172,-32766, 418,-32766, 266, 531,
-32766,-32766,-32766,-32766,-32766,-32766,-32766, 223,-32766, 560,
977,-32766, 818, 819, -173,-32766,-32766,-32766, 818, 819,
-32766,-32766, -227, 561,-32766, 27, 224,-32766, 418,-32766,
-32766, 122, -441,-32766, -232,-32766, 824, 40, 124, 227,
-88, 791, 265,-32766, 984, 1052,-32766,-32766,-32766, 660,
94, 95, 96,-32766, 266, 364,-32766,-32766,-32766, 42,
-32766, 553,-32766, 122,-32766,-32766,-32766,-32766,-32766,-32766,
-32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766, 363, 532,
-32766, 660, 554,-32766, 418,-32766, -477, 9,-32766,-32766,
-32766,-32766,-32766, -441,-32766, -488,-32766, -488, 249,-32766,
248, 660, 121,-32766,-32766,-32766,-32766, -441,-32766,-32766,
359, 555,-32766, 551, -441,-32766, 418, 517, 518, 115,
250,-32766, 1034,-32766,-32767,-32767,-32767,-32767, 92, 93,
94, 95, 96, 23, 308, -479, 504, 20, 344, -172,
225, 117, 741, 126,-32766, 533, -441, 564, 349,-32766,
660, 133, 847,-32766,-32766, 977, 120,-32766,-32766,-32766,
792,-32766, 119,-32766, 114,-32766, 345, 419,-32766, 113,
349, 130,-32766,-32766,-32766, 132,-32766,-32766,-32766, 738,
741,-32766, 660, 241,-32766, 418,-32766, 244,-32766,-32766,
-32766,-32766,-32766,-32766, 128,-32766, 753,-32766, 527, 266,
-32766, 741, 818, 819,-32766,-32766,-32766, -441, 100,-32766,
-32766, 129, 313,-32766, 680, 681,-32766, 418, 41,-32766,
660, -441,-32766, 453,-32766, 660, 321,-32766, -441,-32766,
777, -477,-32766,-32766,-32766, 1083,-32766, 261,-32766, 441,
-32766, 385, 8,-32766, 437, 24, 360,-32766,-32766,-32766,
497, 498,-32766,-32766,-32766, 501,-32766, 1034,-32766,-32766,
418, 1000, 818, 819, 660, 846, 575,-32766,-32766, 358,
-4,-32766,-32766,-32766, 301,-32766, 1076,-32766, 661,-32766,
455, 696,-32766, 858, 565, 513,-32766,-32766,-32766, 440,
977,-32766,-32766, 973, 446,-32766, 505,-32766,-32766, 418,
-133, -133, -133,-32766,-32766,-32766,-32766, 409, 410, 451,
542, 528, 509, 521, 510, -133, 12, -133, -80, -133,
216, -133, 495,-32766, 458,-32766,-32766,-32766,-32766, 67,
348, 356, 259, 258, 266, 1016,-32766,-32766,-32766,-32766,
260, 402, 403, 869, 870, 871, 868, 867, 866, 861,
715, 760, 407, 408, 977, 761, 762,-32766, 11,-32766,
-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767,-32767,
264, 229, 348, 337, 1013, 852, 741, 17, -133, 256,
-212, -212, -212, 402, 403, -400, 348, 5, 307, 775,
758, 21, 672, 760, 407, 408, 329, 402, 403, -211,
-211, -211, 448, 24, 326, 348, 715, 760, 407, 408,
341, 340, 318, 276, 325, 1034, 402, 403, 741, 1000,
-4,-32766,-32766,-32766, 359, 715, 760, 407, 408, 755,
552, 33, 741, 573, -212, 574, 720, 842, 794, 778,
32,-32766, 851,-32766,-32766, 854, 853, 850, 977, 773,
785, 741, 718, -211, 786, 843, 741, 252, 334, 550,
557, 558, 559, 562, 272, 409, 410, 273, 571, 570,
568, 566, 563, 335, 0, 757, 965, 783, 859, 0,
746, 964, 963, 756, 748, 683, 0, 67, 1079, 682,
685, 784, 266, 567, 716, 1080, 675, 674, 684, 759,
1049, 1046, 1041, 1077, 1035, 1028, 0, -444, -467, -446,
-445, 22, 25, 31, 35, 39, 66, 338, 336, 275,
240, 239, 238, 237, 220, 219, 134, 131, 125, 72,
71, 70, 69, 68, -469, 0, 310, 475, 941, 491,
541, 944, 13, 969, 825, 998, 940, 988, -230, -88,
538, 390, 383, 380, 377, 311, 18, 16, 15, 14,
-227, -228, 0, 957, -412, 0, 503, 0, 1040, 1075,
1026, 1027, 997, 0, 1015
);

protected $actionCheck = array(
2, 3, 4, 5, 6, 1, 8, 9, 10, 11,
12, 48, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 8, 9, 10, 50, 51,
52, 0, 54, 7, 79, 8, 9, 10, 8, 7,
77, 77, 79, 80, 66, 28, 1, 30, 31, 32,
33, 34, 54, 56, 57, 28, 13, 30, 31, 32,
33, 34, 35, 79, 109, 7, 68, 69, 70, 71,
72, 73, 74, 118, 7, 77, 112, 113, 114, 115,
116, 117, 84, 85, 86, 87, 88, 89, 90, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 124, 125, 126, 127, 7, 129, 130, 131,
132, 133, 134, 135, 136, 137, 8, 9, 10, 29,
156, 143, 144, 145, 1, 2, 3, 4, 5, 6,
29, 102, 103, 149, 11, 12, 28, 14, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 13, 54, 1, 152, 67, 154, 8, 9, 10,
47, 48, 13, 148, 66, 146, 53, 7, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64, 65, 7,
67, 68, 69, 70, 71, 8, 9, 10, 75, 76,
77, 7, 79, 13, 81, 1, 83, 84, 85, 86,
1, 88, 67, 90, 7, 92, 67, 67, 95, 1,
7, 67, 99, 100, 101, 102, 128, 104, 105, 79,
28, 108, 7, 83, 111, 112, 28, 1, 148, 35,
142, 79, 119, 120, 121, 82, 7, 149, 7, 151,
149, 152, 129, 130, 7, 132, 133, 134, 135, 136,
137, 138, 112, 8, 9, 10, 143, 144, 145, 146,
7, 35, 149, 33, 151, 71, 153, 128, 155, 156,
130, 77, 128, 28, 79, 81, 77, 82, 84, 85,
86, 142, 88, 1, 90, 150, 92, 79, 149, 95,
151, 151, 139, 99, 100, 101, 156, 71, 104, 105,
7, 149, 108, 77, 7, 111, 112, 81, 156, 79,
84, 85, 86, 119, 88, 1, 90, 35, 92, 29,
112, 95, 130, 131, 152, 99, 100, 101, 130, 131,
104, 105, 152, 29, 108, 140, 141, 111, 112, 8,
9, 147, 67, 149, 152, 119, 152, 67, 149, 35,
152, 29, 7, 71, 1, 152, 8, 9, 10, 77,
47, 48, 49, 81, 156, 7, 84, 85, 86, 67,
88, 29, 90, 147, 92, 149, 28, 95, 30, 31,
32, 99, 100, 101, 1, 71, 104, 105, 7, 77,
108, 77, 29, 111, 112, 81, 7, 7, 84, 85,
86, 119, 88, 128, 90, 152, 92, 154, 128, 95,
28, 77, 29, 99, 100, 101, 1, 142, 104, 105,
146, 29, 108, 149, 149, 111, 112, 72, 73, 149,
128, 149, 79, 119, 41, 42, 43, 44, 45, 46,
47, 48, 49, 7, 142, 152, 72, 73, 7, 152,
35, 149, 148, 15, 71, 143, 67, 29, 146, 1,
77, 15, 150, 149, 81, 112, 15, 84, 85, 86,
148, 88, 15, 90, 15, 92, 123, 143, 95, 15,
146, 15, 99, 100, 101, 15, 71, 104, 105, 29,
148, 108, 77, 54, 111, 112, 81, 29, 1, 84,
85, 86, 119, 88, 29, 90, 35, 92, 74, 156,
95, 148, 130, 131, 99, 100, 101, 128, 66, 104,
105, 97, 98, 108, 102, 103, 111, 112, 67, 71,
77, 142, 149, 77, 119, 77, 78, 82, 149, 81,
148, 152, 84, 85, 86, 80, 88, 110, 90, 77,
92, 102, 103, 95, 77, 67, 77, 99, 100, 101,
106, 107, 104, 105, 149, 79, 108, 79, 71, 111,
112, 83, 130, 131, 77, 148, 149, 119, 81, 77,
0, 84, 85, 86, 77, 88, 77, 90, 77, 92,
77, 77, 95, 148, 149, 79, 99, 100, 101, 79,
112, 104, 105, 79, 82, 108, 87, 149, 111, 112,
72, 73, 74, 8, 9, 10, 119, 129, 130, 86,
89, 91, 93, 96, 96, 87, 94, 89, 94, 91,
94, 93, 109, 28, 94, 30, 31, 32, 33, 151,
102, 102, 127, 126, 156, 139, 149, 8, 9, 10,
109, 113, 114, 112, 113, 114, 115, 116, 117, 118,
122, 123, 124, 125, 112, 123, 123, 28, 142, 30,
31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
126, 35, 102, 103, 139, 148, 148, 152, 150, 109,
96, 97, 98, 113, 114, 142, 102, 142, 142, 148,
150, 152, 122, 123, 124, 125, 146, 113, 114, 96,
97, 98, 146, 67, 146, 102, 122, 123, 124, 125,
146, 146, 146, 143, 146, 79, 113, 114, 148, 83,
150, 8, 9, 10, 146, 122, 123, 124, 125, 147,
149, 148, 148, 148, 150, 148, 148, 148, 148, 148,
148, 28, 148, 30, 31, 148, 148, 148, 112, 148,
148, 148, 148, 150, 148, 148, 148, 152, 149, 149,
149, 149, 149, 149, 149, 129, 130, 149, 149, 149,
149, 149, 149, 149, -1, 150, 150, 150, 150, -1,
150, 150, 150, 150, 150, 150, -1, 151, 150, 150,
150, 150, 156, 150, 150, 150, 150, 150, 150, 150,
150, 150, 150, 150, 150, 150, -1, 151, 151, 151,
151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
151, 151, 151, 151, 151, -1, 152, 152, 152, 152,
152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
152, 152, -1, 153, 153, -1, 154, -1, 154, 154,
154, 154, 154, -1, 155
);

protected $actionBase = array(
0, 568, 610, 624, 643, 182, 342, 567, -2, -2,
-2, -2, -36, 393, 110, 334, 110, 372, 422, 648,
648, 648, 224, 256, 312, 312, 312, 488, 413, 445,
344, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 527, 527, 527, 527, 527,
527, 527, 527, 527, 527, 45, 45, 352, 43, 645,
729, 725, 565, 730, 566, 724, 726, 168, 693, 694,
505, 695, 692, 691, 690, 727, 752, 579, 728, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 30, 179, 361, 207, 207,
207, 207, 207, 207, 207, 207, 207, 207, 207, 207,
207, 207, 207, 207, 207, 207, 207, 275, 275, 275,
753, 378, 419, 635, 17, 305, 27, 669, 669, 669,
669, 669, 423, 423, 423, 423, 676, 676, 518, 170,
170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
689, 580, 665, 666, 383, 343, 343, 222, 222, 222,
222, 238, 228, -45, 412, 183, 536, 759, 472, 229,
229, 118, 169, -22, -22, -22, 49, 552, 582, 582,
582, 582, 225, 225, 582, 582, 4, -37, 305, 305,
332, 305, 452, 452, 452, 364, 304, 485, 364, 621,
558, 667, 557, 681, 310, 283, 32, 605, -16, 604,
569, -16, 484, 404, 385, 737, 45, 583, 45, 45,
45, 45, 45, 45, 45, 45, 45, -16, -16, 45,
121, 45, 457, 352, 475, 469, 543, 174, 655, 327,
233, 165, 469, 469, 469, 658, 649, 119, 210, 664,
202, 479, 323, 260, 483, 483, 501, 507, 486, 483,
483, 483, 483, 516, 483, 700, 700, 704, 501, 483,
700, 501, 227, 411, 245, 259, 501, 388, 547, 483,
584, 584, 261, 507, 550, 214, 466, 545, 700, 700,
545, 486, 190, 501, 375, 625, 627, 553, 622, 67,
498, 498, 471, 553, 26, 501, 498, 516, 420, 58,
498, 31, 705, 722, 490, 721, 702, 720, 706, 719,
537, 650, 572, 573, 714, 713, 718, 502, 532, 703,
701, 596, 509, 494, 489, 585, 491, 696, 569, 618,
482, 482, 482, 491, 698, 482, 482, 482, 482, 482,
482, 482, 482, 758, 267, 586, 563, 487, 606, 570,
481, 662, 575, 596, 596, 684, 751, 750, 541, 712,
735, 717, 632, 468, 744, 711, 683, 608, 544, 598,
710, 743, 734, 661, 494, 733, 685, 539, 596, 686,
482, 697, 723, 756, 757, 699, 754, 742, 590, 495,
755, 687, 732, 660, 659, 623, 747, 736, 741, 688,
740, 628, 549, 749, 559, 707, 546, 708, 651, 680,
679, 496, 629, 678, 716, 630, 746, 745, 748, 631,
642, 652, 653, 500, 675, 476, 647, 715, 320, 464,
560, 646, 554, 731, 674, 654, 709, 644, 581, 673,
672, 738, 564, 618, 556, 467, 562, 561, 663, 671,
739, 458, 641, 639, 638, 637, 670, 634, 668, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 143,
143, 143, 143, -2, -2, -2, 0, 0, 0, 0,
-2, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
143, 143, 143, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
-3, 128, 128, -3, 128, 128, 128, 128, 128, 128,
-22, -22, -22, -22, 364, 364, 364, 364, 364, 364,
364, 364, 364, 364, 364, 364, 364, 364, 571, 571,
571, 571, 364, -22, -22, 364, 364, 364, 364, 364,
364, 571, 364, 225, 225, 225, 364, -16, -16, 0,
0, 0, 0, 0, 483, 225, 364, 364, 364, 364,
0, 0, 364, 364, -16, 0, 0, 0, 0, 0,
483, 483, 483, 0, 483, 225, 0, 45, 454, 454,
454, 454, 0, 0, 0, 483, 0, 483, 550, 0,
0, 0, 0, 501, 0, 700, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 482, 712, 0, 541, 0, 0, 0,
482, 482, 482, 541, 541, 0, 0, 541
);

protected $actionDefault = array(
3,32767,32767,32767,32767,32767,32767,32767,32767, 88,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767, 88, 489, 489, 489,32767,32767,32767,
32767, 302, 302, 302,32767, 481, 439, 439, 439, 439,
439, 439, 439, 481,32767,32767,32767,32767,32767, 381,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767, 88,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767, 486,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767, 364,
365, 367, 368, 301, 440, 250, 485, 300, 126, 261,
252, 204, 298, 236, 130, 329, 382, 331, 380, 384,
330, 307, 311, 312, 313, 314, 315, 316, 317, 318,
319, 320, 321, 322, 305, 306, 383, 361, 360, 359,
327, 328, 304, 332, 334, 304, 333, 350, 351, 348,
349, 352, 353, 354, 355, 356,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767, 88,32767,
284, 284, 284, 284,32767, 341, 342, 242, 242, 242,
242,32767, 242, 285,32767,32767,32767,32767,32767,32767,
32767, 433, 358, 336, 337, 335,32767, 411,32767,32767,
32767,32767,32767, 413,32767, 88,32767,32767, 324, 326,
405, 308,32767,32767, 90,32767,32767,32767,32767,32767,
32767,32767,32767,32767, 408, 441, 441,32767,32767, 88,
399, 88, 169, 223, 225, 174,32767, 416,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767, 346,32767, 496,32767, 441,
32767,32767, 338, 339, 340,32767,32767, 441, 441,32767,
441,32767, 441,32767,32767,32767, 174,32767,32767,32767,
32767,32767,32767,32767, 90, 414, 414, 409, 174,32767,
32767, 174, 87, 87, 87, 87, 174, 87, 187,32767,
185, 185, 87, 88, 88, 87, 87, 189,32767, 455,
189, 88, 87, 174, 87, 209, 209, 390, 176, 89,
244, 244, 89, 390, 87, 174, 244, 88, 87, 87,
244,32767,32767,32767, 82,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767, 401,32767,32767, 421,32767, 434, 453, 399,32767,
344, 345, 347,32767, 443, 369, 370, 371, 372, 373,
374, 375, 377,32767, 482, 404,32767,32767, 84, 117,
260,32767, 494, 84, 402,32767, 494,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767, 84,32767, 84,
32767,32767,32767,32767, 478,32767, 441,32767, 403,32767,
343, 417, 460,32767,32767, 442,32767,32767, 84,32767,
32767,32767,32767,32767,32767,32767,32767, 421,32767,32767,
32767,32767,32767, 441,32767,32767,32767,32767,32767,32767,
32767, 297,32767,32767,32767,32767,32767,32767, 441,32767,
32767,32767,32767, 235,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767, 82, 60,32767, 278,32767,32767,32767,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767, 132,
132, 3, 3, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 263, 164, 263, 217,
263, 263, 220, 209, 209, 270, 132, 132
);

protected $goto = array(
165, 165, 138, 138, 138, 148, 150, 181, 166, 163,
163, 163, 163, 147, 164, 164, 164, 164, 164, 164,
164, 147, 159, 160, 161, 162, 178, 176, 179, 420,
421, 315, 422, 425, 426, 427, 428, 429, 430, 431,
432, 888, 136, 139, 140, 141, 142, 143, 144, 145,
146, 149, 175, 177, 180, 197, 200, 201, 203, 204,
206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
235, 236, 253, 254, 255, 322, 323, 324, 470, 182,
183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
193, 194, 195, 151, 196, 152, 167, 168, 169, 198,
170, 153, 154, 155, 171, 156, 199, 137, 172, 157,
173, 174, 158, 534, 202, 438, 736, 281, 471, 857,
547, 7, 202, 526, 855, 472, 669, 231, 464, 232,
233, 443, 443, 443, 671, 443, 464, 793, 774, 772,
774, 569, 670, 436, 802, 797, 459, 456, 443, 545,
572, 492, 494, 520, 524, 529, 530, 804, 537, 539,
546, 800, 548, 424, 424, 424, 424, 424, 424, 424,
424, 424, 424, 424, 424, 424, 424, 423, 423, 423,
423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
423, 485, 506, 443, 443, 488, 490, 540, 457, 478,
443, 443, 974, 443, 768, 312, 543, 706, 444, 300,
303, 450, 473, 474, 476, 469, 481, 733, 468, 487,
487, 999, 999, 999, 999, 999, 999, 999, 999, 999,
999, 999, 999, 701, 689, 831, 435, 835, 776, 697,
1068, 1068, 779, 435, 263, 749, 482, 3, 4, 247,
316, 827, 809, 449, 769, 975, 465, 1068, 460, 673,
770, 770, 770, 770, 872, 1061, 764, 771, 705, 970,
697, 1071, 697, 976, 1030, 378, 678, 298, 728, 723,
724, 737, 679, 725, 676, 726, 727, 10, 1053, 677,
507, 731, 462, 935, 823, 328, 508, 332, 319, 319,
268, 269, 285, 466, 271, 327, 286, 330, 493, 807,
807, 1058, 1069, 1069, 282, 283, 812, 688, 688, 816,
1042, 512, 698, 698, 698, 700, 525, 687, 499, 1069,
314, 287, 693, 279, 309, 690, 832, 576, 966, 514,
370, 978, 971, 484, 817, 817, 817, 817, 978, 817,
836, 817, 865, 702, 1039, 817, 781, 686, 874, 386,
0, 1039, 0, 0, 0, 978, 978, 978, 978, 1050,
1050, 978, 978, 0, 0, 0, 0, 0, 0, 0,
0, 0, 744, 0, 0, 745, 1036, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 834, 0,
0, 834, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1043, 1044
);

protected $gotoCheck = array(
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 60, 53, 8, 10, 76, 7, 7,
7, 106, 53, 7, 7, 93, 13, 69, 81, 69,
69, 8, 8, 8, 15, 8, 81, 13, 13, 13,
13, 13, 14, 13, 13, 13, 8, 36, 8, 5,
36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 131, 129, 129, 129,
129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
129, 43, 43, 8, 8, 64, 64, 64, 8, 8,
8, 8, 88, 8, 72, 72, 72, 33, 8, 46,
46, 46, 46, 46, 46, 2, 2, 52, 8, 82,
82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
82, 82, 82, 11, 11, 11, 71, 11, 37, 23,
139, 139, 11, 71, 128, 11, 11, 34, 34, 128,
62, 90, 11, 62, 11, 88, 130, 139, 62, 10,
71, 71, 71, 71, 11, 138, 71, 71, 11, 11,
23, 139, 23, 88, 88, 62, 10, 49, 10, 10,
10, 10, 10, 10, 10, 10, 10, 62, 136, 10,
51, 10, 50, 112, 86, 53, 53, 53, 53, 53,
53, 53, 53, 53, 53, 53, 53, 53, 53, 81,
81, 81, 140, 140, 76, 76, 84, 23, 23, 87,
133, 65, 23, 23, 23, 23, 65, 23, 21, 140,
65, 17, 27, 9, 16, 25, 92, 78, 118, 20,
67, 60, 121, 68, 60, 60, 60, 60, 60, 60,
95, 60, 106, 29, 93, 60, 75, 12, 109, 116,
-1, 93, -1, -1, -1, 60, 60, 60, 60, 93,
93, 60, 60, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 60, -1, -1, 60, 93, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 93, -1,
-1, 93, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 93, 93
);

protected $gotoBase = array(
0, 0, -336, 0, 0, 137, 0, 113, -141, 57,
-20, -120, -25, 124, 140, 132, 47, 75, 0, 0,
4, 55, 0, -17, 0, 46, 0, 58, 0, -10,
-22, 0, 0, 198, -329, 0, -403, 220, 0, 0,
0, 0, 0, 159, 0, 0, 172, 0, 0, 243,
72, 73, 201, 79, 0, 0, 0, 0, 0, 0,
107, 0, -98, 0, -43, -60, 0, -21, -27, -441,
0, 2, -55, 0, 0, -15, -259, 0, 24, 0,
0, 93, 3, 0, 74, 0, 50, 71, -95, 0,
228, 0, 45, 120, 0, -14, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 109, 0, 0, -29,
0, 0, 52, 0, 0, 0, -24, 0, -8, 0,
0, 6, 0, 0, 0, 0, 0, 0, -13, -39,
231, -53, 0, 70, 0, 0, 245, 0, 239, -6,
66, 0, 0
);

protected $gotoDefault = array(
-32768, 391, 579, 2, 580, 651, 659, 515, 411, 439,
730, 877, 692, 712, 713, 714, 304, 342, 296, 302,
500, 489, 382, 699, 354, 691, 379, 694, 353, 703,
135, 516, 388, 707, 1, 709, 445, 740, 293, 717,
294, 519, 719, 452, 721, 722, 299, 305, 306, 881,
461, 486, 732, 205, 454, 734, 292, 735, 743, 333,
297, 365, 522, 496, 477, 511, 412, 367, 483, 230,
463, 985, 766, 374, 362, 780, 280, 788, 577, 796,
799, 413, 414, 372, 811, 373, 821, 815, 993, 366,
826, 355, 833, 1025, 357, 837, 840, 343, 502, 331,
844, 845, 6, 849, 535, 536, 864, 243, 384, 873,
352, 887, 346, 954, 956, 447, 381, 967, 361, 523,
389, 972, 1029, 350, 415, 368, 270, 284, 246, 416,
433, 251, 417, 369, 1032, 320, 1054, 434, 1062, 1070,
277, 317, 480
);

protected $ruleToNonTerminal = array(
0, 1, 3, 3, 2, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 6, 6, 6, 6, 6, 6, 6,
7, 7, 8, 8, 9, 10, 10, 11, 11, 12,
12, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 17, 17, 18, 18, 18, 18, 20, 22,
22, 16, 24, 24, 21, 26, 26, 23, 23, 25,
25, 27, 27, 19, 28, 28, 29, 31, 32, 32,
33, 34, 34, 36, 35, 35, 35, 35, 37, 37,
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
37, 37, 13, 13, 56, 56, 59, 59, 58, 57,
57, 50, 61, 61, 62, 62, 63, 63, 14, 15,
15, 15, 66, 66, 66, 67, 67, 70, 70, 68,
68, 72, 73, 73, 44, 44, 52, 52, 55, 55,
55, 54, 74, 74, 75, 45, 45, 45, 45, 76,
76, 77, 77, 78, 78, 42, 42, 38, 38, 79,
40, 40, 80, 39, 39, 41, 41, 51, 51, 51,
51, 64, 64, 83, 83, 84, 84, 86, 86, 87,
87, 87, 85, 85, 65, 65, 88, 88, 89, 89,
90, 90, 90, 47, 91, 91, 92, 48, 94, 94,
95, 95, 69, 69, 96, 96, 96, 96, 101, 101,
102, 102, 103, 103, 103, 103, 103, 104, 105, 105,
100, 100, 97, 97, 99, 99, 107, 107, 106, 106,
106, 106, 106, 106, 98, 108, 108, 109, 109, 49,
110, 110, 43, 43, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
30, 30, 30, 30, 30, 30, 30, 117, 111, 111,
116, 116, 119, 120, 120, 121, 122, 122, 122, 71,
71, 60, 60, 60, 112, 112, 112, 124, 124, 113,
113, 115, 115, 115, 118, 118, 129, 129, 129, 82,
131, 131, 131, 114, 114, 114, 114, 114, 114, 114,
114, 114, 114, 114, 114, 114, 114, 114, 114, 46,
46, 127, 127, 127, 123, 123, 123, 132, 132, 132,
132, 132, 132, 53, 53, 53, 93, 93, 93, 93,
134, 126, 126, 126, 126, 126, 126, 125, 125, 125,
133, 133, 133, 133, 81, 135, 135, 136, 136, 136,
136, 136, 130, 137, 137, 138, 138, 138, 138, 138,
128, 128, 128, 128, 140, 141, 139, 139, 139, 139,
139, 139, 139, 142, 142, 142, 142
);

protected $ruleToLength = array(
1, 1, 2, 0, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 3, 1, 1, 1, 0, 1, 0,
1, 1, 1, 1, 1, 3, 5, 4, 3, 4,
2, 3, 1, 1, 7, 8, 6, 7, 2, 3,
1, 2, 3, 1, 2, 3, 1, 1, 3, 1,
2, 1, 2, 2, 3, 1, 3, 2, 3, 1,
3, 2, 0, 1, 1, 1, 1, 1, 3, 7,
10, 5, 7, 9, 5, 3, 3, 3, 3, 3,
3, 1, 2, 5, 7, 9, 5, 6, 3, 3,
2, 1, 1, 1, 0, 2, 1, 3, 8, 0,
4, 2, 1, 3, 0, 1, 0, 1, 10, 7,
6, 5, 1, 2, 2, 0, 2, 0, 2, 0,
2, 2, 1, 3, 1, 4, 1, 4, 1, 1,
4, 2, 1, 3, 3, 3, 4, 4, 5, 0,
2, 4, 3, 1, 1, 1, 4, 0, 2, 5,
0, 2, 6, 0, 2, 0, 3, 1, 2, 1,
1, 2, 0, 1, 3, 4, 6, 1, 2, 1,
1, 1, 0, 1, 0, 2, 2, 4, 1, 3,
1, 2, 2, 2, 3, 1, 1, 2, 3, 1,
1, 3, 2, 0, 3, 4, 9, 3, 1, 3,
0, 2, 4, 5, 4, 4, 4, 3, 1, 1,
1, 3, 1, 1, 0, 1, 1, 2, 1, 1,
1, 1, 1, 1, 2, 1, 3, 1, 3, 2,
3, 1, 0, 1, 1, 3, 3, 3, 4, 1,
2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 2, 2, 2, 2, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 2, 2, 2, 2, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 5,
4, 3, 4, 4, 2, 2, 4, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 1, 3,
2, 1, 2, 4, 2, 10, 11, 7, 3, 2,
0, 4, 2, 1, 3, 2, 2, 2, 4, 1,
1, 1, 2, 3, 1, 1, 1, 1, 1, 0,
3, 0, 1, 1, 0, 1, 1, 3, 3, 3,
4, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 2, 3, 3, 0,
1, 1, 3, 1, 1, 3, 1, 1, 4, 4,
4, 1, 4, 1, 1, 3, 1, 4, 2, 2,
3, 1, 4, 4, 3, 3, 3, 1, 3, 1,
1, 3, 1, 1, 4, 3, 1, 1, 1, 3,
3, 0, 1, 3, 1, 3, 1, 4, 2, 0,
2, 2, 1, 2, 1, 1, 1, 4, 3, 3,
3, 6, 3, 1, 1, 2, 1
);

protected function reduceRule0() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule1() {
$this->semValue = $this->handleNamespaces($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule2() {
if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; };
}

protected function reduceRule3() {
$this->semValue = array();
}

protected function reduceRule4() {
$startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; };
if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule5() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule6() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule7() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule8() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule9() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule10() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule11() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule12() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule13() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule14() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule15() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule16() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule17() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule18() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule19() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule20() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule21() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule22() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule23() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule24() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule25() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule26() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule27() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule28() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule29() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule30() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule31() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule32() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule33() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule34() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule35() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule36() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule37() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule38() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule39() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule40() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule41() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule42() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule43() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule44() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule45() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule46() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule47() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule48() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule49() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule50() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule51() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule52() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule53() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule54() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule55() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule56() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule57() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule58() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule59() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule60() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule61() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule62() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule63() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule64() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule65() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule66() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule67() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule68() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule69() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule70() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule71() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule72() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule73() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule74() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule75() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule76() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule77() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule78() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule79() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule80() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule81() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule82() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule83() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule84() {
$this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule85() {

}

protected function reduceRule86() {

}

protected function reduceRule87() {

}

protected function reduceRule88() {
$this->emitError(new Error('A trailing comma is not allowed here', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes));
}

protected function reduceRule89() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule90() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule91() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule92() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule93() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule94() {
$this->semValue = new Stmt\HaltCompiler($this->lexer->handleHaltCompiler(), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule95() {
$this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(3-2)], null, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
$this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_SEMICOLON);
$this->checkNamespace($this->semValue);
}

protected function reduceRule96() {
$this->semValue = new Stmt\Namespace_($this->semStack[$this->stackPos-(5-2)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
$this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED);
$this->checkNamespace($this->semValue);
}

protected function reduceRule97() {
$this->semValue = new Stmt\Namespace_(null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
$this->semValue->setAttribute('kind', Stmt\Namespace_::KIND_BRACED);
$this->checkNamespace($this->semValue);
}

protected function reduceRule98() {
$this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(3-2)], Stmt\Use_::TYPE_NORMAL, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule99() {
$this->semValue = new Stmt\Use_($this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule100() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule101() {
$this->semValue = new Stmt\Const_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule102() {
$this->semValue = Stmt\Use_::TYPE_FUNCTION;
}

protected function reduceRule103() {
$this->semValue = Stmt\Use_::TYPE_CONSTANT;
}

protected function reduceRule104() {
$this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-3)] + $this->endAttributeStack[$this->stackPos-(7-3)]), $this->semStack[$this->stackPos-(7-6)], $this->semStack[$this->stackPos-(7-2)], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
}

protected function reduceRule105() {
$this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(8-4)], $this->startAttributeStack[$this->stackPos-(8-4)] + $this->endAttributeStack[$this->stackPos-(8-4)]), $this->semStack[$this->stackPos-(8-7)], $this->semStack[$this->stackPos-(8-2)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes);
}

protected function reduceRule106() {
$this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-2)] + $this->endAttributeStack[$this->stackPos-(6-2)]), $this->semStack[$this->stackPos-(6-5)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
}

protected function reduceRule107() {
$this->semValue = new Stmt\GroupUse(new Name($this->semStack[$this->stackPos-(7-3)], $this->startAttributeStack[$this->stackPos-(7-3)] + $this->endAttributeStack[$this->stackPos-(7-3)]), $this->semStack[$this->stackPos-(7-6)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
}

protected function reduceRule108() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule109() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule110() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule111() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule112() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule113() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule114() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule115() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule116() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule117() {
$this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(1-1)], null, Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $this->stackPos-(1-1));
}

protected function reduceRule118() {
$this->semValue = new Stmt\UseUse($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], Stmt\Use_::TYPE_UNKNOWN, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->checkUseUse($this->semValue, $this->stackPos-(3-3));
}

protected function reduceRule119() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule120() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule121() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)]; $this->semValue->type = Stmt\Use_::TYPE_NORMAL;
}

protected function reduceRule122() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)]; $this->semValue->type = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule123() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule124() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule125() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule126() {
$this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule127() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule128() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule129() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule130() {
$this->semValue = new Node\Const_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule131() {
if (is_array($this->semStack[$this->stackPos-(2-2)])) { $this->semValue = array_merge($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]); } else { $this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)]; };
}

protected function reduceRule132() {
$this->semValue = array();
}

protected function reduceRule133() {
$startAttributes = $this->lookaheadStartAttributes; if (isset($startAttributes['comments'])) { $nop = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $nop = null; };
if ($nop !== null) { $this->semStack[$this->stackPos-(1-1)][] = $nop; } $this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule134() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule135() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule136() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule137() {
throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule138() {

if ($this->semStack[$this->stackPos-(3-2)]) {
$this->semValue = $this->semStack[$this->stackPos-(3-2)]; $attrs = $this->startAttributeStack[$this->stackPos-(3-1)]; $stmts = $this->semValue; if (!empty($attrs['comments'])) {$stmts[0]->setAttribute('comments', array_merge($attrs['comments'], $stmts[0]->getAttribute('comments', []))); };
} else {
$startAttributes = $this->startAttributeStack[$this->stackPos-(3-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; };
if (null === $this->semValue) { $this->semValue = array(); }
}

}

protected function reduceRule139() {
$this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(7-3)], ['stmts' => is_array($this->semStack[$this->stackPos-(7-5)]) ? $this->semStack[$this->stackPos-(7-5)] : array($this->semStack[$this->stackPos-(7-5)]), 'elseifs' => $this->semStack[$this->stackPos-(7-6)], 'else' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
}

protected function reduceRule140() {
$this->semValue = new Stmt\If_($this->semStack[$this->stackPos-(10-3)], ['stmts' => $this->semStack[$this->stackPos-(10-6)], 'elseifs' => $this->semStack[$this->stackPos-(10-7)], 'else' => $this->semStack[$this->stackPos-(10-8)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes);
}

protected function reduceRule141() {
$this->semValue = new Stmt\While_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule142() {
$this->semValue = new Stmt\Do_($this->semStack[$this->stackPos-(7-5)], is_array($this->semStack[$this->stackPos-(7-2)]) ? $this->semStack[$this->stackPos-(7-2)] : array($this->semStack[$this->stackPos-(7-2)]), $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
}

protected function reduceRule143() {
$this->semValue = new Stmt\For_(['init' => $this->semStack[$this->stackPos-(9-3)], 'cond' => $this->semStack[$this->stackPos-(9-5)], 'loop' => $this->semStack[$this->stackPos-(9-7)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes);
}

protected function reduceRule144() {
$this->semValue = new Stmt\Switch_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule145() {
$this->semValue = new Stmt\Break_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule146() {
$this->semValue = new Stmt\Continue_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule147() {
$this->semValue = new Stmt\Return_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule148() {
$this->semValue = new Stmt\Global_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule149() {
$this->semValue = new Stmt\Static_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule150() {
$this->semValue = new Stmt\Echo_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule151() {
$this->semValue = new Stmt\InlineHTML($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule152() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule153() {
$this->semValue = new Stmt\Unset_($this->semStack[$this->stackPos-(5-3)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule154() {
$this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(7-3)], $this->semStack[$this->stackPos-(7-5)][0], ['keyVar' => null, 'byRef' => $this->semStack[$this->stackPos-(7-5)][1], 'stmts' => $this->semStack[$this->stackPos-(7-7)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
}

protected function reduceRule155() {
$this->semValue = new Stmt\Foreach_($this->semStack[$this->stackPos-(9-3)], $this->semStack[$this->stackPos-(9-7)][0], ['keyVar' => $this->semStack[$this->stackPos-(9-5)], 'byRef' => $this->semStack[$this->stackPos-(9-7)][1], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes);
}

protected function reduceRule156() {
$this->semValue = new Stmt\Declare_($this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule157() {
$this->semValue = new Stmt\TryCatch($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-5)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); $this->checkTryCatch($this->semValue);
}

protected function reduceRule158() {
$this->semValue = new Stmt\Throw_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule159() {
$this->semValue = new Stmt\Goto_($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule160() {
$this->semValue = new Stmt\Label($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule161() {
$this->semValue = array(); 
}

protected function reduceRule162() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule163() {
$startAttributes = $this->startAttributeStack[$this->stackPos-(1-1)]; if (isset($startAttributes['comments'])) { $this->semValue = new Stmt\Nop(['comments' => $startAttributes['comments']]); } else { $this->semValue = null; };
if ($this->semValue === null) $this->semValue = array(); 
}

protected function reduceRule164() {
$this->semValue = array();
}

protected function reduceRule165() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule166() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule167() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule168() {
$this->semValue = new Stmt\Catch_($this->semStack[$this->stackPos-(8-3)], substr($this->semStack[$this->stackPos-(8-4)], 1), $this->semStack[$this->stackPos-(8-7)], $this->startAttributeStack[$this->stackPos-(8-1)] + $this->endAttributes);
}

protected function reduceRule169() {
$this->semValue = null;
}

protected function reduceRule170() {
$this->semValue = new Stmt\Finally_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule171() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule172() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule173() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule174() {
$this->semValue = false;
}

protected function reduceRule175() {
$this->semValue = true;
}

protected function reduceRule176() {
$this->semValue = false;
}

protected function reduceRule177() {
$this->semValue = true;
}

protected function reduceRule178() {
$this->semValue = new Stmt\Function_($this->semStack[$this->stackPos-(10-3)], ['byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-5)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes);
}

protected function reduceRule179() {
$this->semValue = new Stmt\Class_($this->semStack[$this->stackPos-(7-2)], ['type' => $this->semStack[$this->stackPos-(7-1)], 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes);
$this->checkClass($this->semValue, $this->stackPos-(7-2));
}

protected function reduceRule180() {
$this->semValue = new Stmt\Interface_($this->semStack[$this->stackPos-(6-2)], ['extends' => $this->semStack[$this->stackPos-(6-3)], 'stmts' => $this->semStack[$this->stackPos-(6-5)]], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
$this->checkInterface($this->semValue, $this->stackPos-(6-2));
}

protected function reduceRule181() {
$this->semValue = new Stmt\Trait_($this->semStack[$this->stackPos-(5-2)], ['stmts' => $this->semStack[$this->stackPos-(5-4)]], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule182() {
$this->semValue = 0;
}

protected function reduceRule183() {
$this->semValue = Stmt\Class_::MODIFIER_ABSTRACT;
}

protected function reduceRule184() {
$this->semValue = Stmt\Class_::MODIFIER_FINAL;
}

protected function reduceRule185() {
$this->semValue = null;
}

protected function reduceRule186() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule187() {
$this->semValue = array();
}

protected function reduceRule188() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule189() {
$this->semValue = array();
}

protected function reduceRule190() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule191() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule192() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule193() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule194() {
$this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule195() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule196() {
$this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule197() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule198() {
$this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule199() {
$this->semValue = null;
}

protected function reduceRule200() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule201() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule202() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule203() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule204() {
$this->semValue = new Stmt\DeclareDeclare($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule205() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule206() {
$this->semValue = $this->semStack[$this->stackPos-(4-3)];
}

protected function reduceRule207() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule208() {
$this->semValue = $this->semStack[$this->stackPos-(5-3)];
}

protected function reduceRule209() {
$this->semValue = array();
}

protected function reduceRule210() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule211() {
$this->semValue = new Stmt\Case_($this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule212() {
$this->semValue = new Stmt\Case_(null, $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule213() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule214() {
$this->semValue = $this->semStack[$this->stackPos];
}

protected function reduceRule215() {
$this->semValue = is_array($this->semStack[$this->stackPos-(1-1)]) ? $this->semStack[$this->stackPos-(1-1)] : array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule216() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule217() {
$this->semValue = array();
}

protected function reduceRule218() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule219() {
$this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(5-3)], is_array($this->semStack[$this->stackPos-(5-5)]) ? $this->semStack[$this->stackPos-(5-5)] : array($this->semStack[$this->stackPos-(5-5)]), $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule220() {
$this->semValue = array();
}

protected function reduceRule221() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule222() {
$this->semValue = new Stmt\ElseIf_($this->semStack[$this->stackPos-(6-3)], $this->semStack[$this->stackPos-(6-6)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
}

protected function reduceRule223() {
$this->semValue = null;
}

protected function reduceRule224() {
$this->semValue = new Stmt\Else_(is_array($this->semStack[$this->stackPos-(2-2)]) ? $this->semStack[$this->stackPos-(2-2)] : array($this->semStack[$this->stackPos-(2-2)]), $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule225() {
$this->semValue = null;
}

protected function reduceRule226() {
$this->semValue = new Stmt\Else_($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule227() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)], false);
}

protected function reduceRule228() {
$this->semValue = array($this->semStack[$this->stackPos-(2-2)], true);
}

protected function reduceRule229() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)], false);
}

protected function reduceRule230() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)], false);
}

protected function reduceRule231() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule232() {
$this->semValue = array();
}

protected function reduceRule233() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule234() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule235() {
$this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(4-4)], 1), null, $this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-2)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); $this->checkParam($this->semValue);
}

protected function reduceRule236() {
$this->semValue = new Node\Param(substr($this->semStack[$this->stackPos-(6-4)], 1), $this->semStack[$this->stackPos-(6-6)], $this->semStack[$this->stackPos-(6-1)], $this->semStack[$this->stackPos-(6-2)], $this->semStack[$this->stackPos-(6-3)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes); $this->checkParam($this->semValue);
}

protected function reduceRule237() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule238() {
$this->semValue = new Node\NullableType($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule239() {
$this->semValue = $this->handleBuiltinTypes($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule240() {
$this->semValue = 'array';
}

protected function reduceRule241() {
$this->semValue = 'callable';
}

protected function reduceRule242() {
$this->semValue = null;
}

protected function reduceRule243() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule244() {
$this->semValue = null;
}

protected function reduceRule245() {
$this->semValue = $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule246() {
$this->semValue = array();
}

protected function reduceRule247() {
$this->semValue = $this->semStack[$this->stackPos-(4-2)];
}

protected function reduceRule248() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule249() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule250() {
$this->semValue = new Node\Arg($this->semStack[$this->stackPos-(1-1)], false, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule251() {
$this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], true, false, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule252() {
$this->semValue = new Node\Arg($this->semStack[$this->stackPos-(2-2)], false, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule253() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule254() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule255() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule256() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule257() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule258() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule259() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule260() {
$this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule261() {
$this->semValue = new Stmt\StaticVar(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule262() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule263() {
$this->semValue = array();
}

protected function reduceRule264() {
$this->semValue = new Stmt\Property($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->checkProperty($this->semValue, $this->stackPos-(3-1));
}

protected function reduceRule265() {
$this->semValue = new Stmt\ClassConst($this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-1)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes); $this->checkClassConst($this->semValue, $this->stackPos-(4-1));
}

protected function reduceRule266() {
$this->semValue = new Stmt\ClassMethod($this->semStack[$this->stackPos-(9-4)], ['type' => $this->semStack[$this->stackPos-(9-1)], 'byRef' => $this->semStack[$this->stackPos-(9-3)], 'params' => $this->semStack[$this->stackPos-(9-6)], 'returnType' => $this->semStack[$this->stackPos-(9-8)], 'stmts' => $this->semStack[$this->stackPos-(9-9)]], $this->startAttributeStack[$this->stackPos-(9-1)] + $this->endAttributes);
$this->checkClassMethod($this->semValue, $this->stackPos-(9-1));
}

protected function reduceRule267() {
$this->semValue = new Stmt\TraitUse($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule268() {
$this->semValue = array();
}

protected function reduceRule269() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule270() {
$this->semValue = array();
}

protected function reduceRule271() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule272() {
$this->semValue = new Stmt\TraitUseAdaptation\Precedence($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule273() {
$this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(5-1)][0], $this->semStack[$this->stackPos-(5-1)][1], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-4)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule274() {
$this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], $this->semStack[$this->stackPos-(4-3)], null, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule275() {
$this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule276() {
$this->semValue = new Stmt\TraitUseAdaptation\Alias($this->semStack[$this->stackPos-(4-1)][0], $this->semStack[$this->stackPos-(4-1)][1], null, $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule277() {
$this->semValue = array($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)]);
}

protected function reduceRule278() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule279() {
$this->semValue = array(null, $this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule280() {
$this->semValue = null;
}

protected function reduceRule281() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule282() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule283() {
$this->semValue = 0;
}

protected function reduceRule284() {
$this->semValue = 0;
}

protected function reduceRule285() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule286() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule287() {
$this->checkModifier($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->stackPos-(2-2)); $this->semValue = $this->semStack[$this->stackPos-(2-1)] | $this->semStack[$this->stackPos-(2-2)];
}

protected function reduceRule288() {
$this->semValue = Stmt\Class_::MODIFIER_PUBLIC;
}

protected function reduceRule289() {
$this->semValue = Stmt\Class_::MODIFIER_PROTECTED;
}

protected function reduceRule290() {
$this->semValue = Stmt\Class_::MODIFIER_PRIVATE;
}

protected function reduceRule291() {
$this->semValue = Stmt\Class_::MODIFIER_STATIC;
}

protected function reduceRule292() {
$this->semValue = Stmt\Class_::MODIFIER_ABSTRACT;
}

protected function reduceRule293() {
$this->semValue = Stmt\Class_::MODIFIER_FINAL;
}

protected function reduceRule294() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule295() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule296() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule297() {
$this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(1-1)], 1), null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule298() {
$this->semValue = new Stmt\PropertyProperty(substr($this->semStack[$this->stackPos-(3-1)], 1), $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule299() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule300() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule301() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule302() {
$this->semValue = array();
}

protected function reduceRule303() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule304() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule305() {
$this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule306() {
$this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule307() {
$this->semValue = new Expr\Assign($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule308() {
$this->semValue = new Expr\AssignRef($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule309() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule310() {
$this->semValue = new Expr\Clone_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule311() {
$this->semValue = new Expr\AssignOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule312() {
$this->semValue = new Expr\AssignOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule313() {
$this->semValue = new Expr\AssignOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule314() {
$this->semValue = new Expr\AssignOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule315() {
$this->semValue = new Expr\AssignOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule316() {
$this->semValue = new Expr\AssignOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule317() {
$this->semValue = new Expr\AssignOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule318() {
$this->semValue = new Expr\AssignOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule319() {
$this->semValue = new Expr\AssignOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule320() {
$this->semValue = new Expr\AssignOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule321() {
$this->semValue = new Expr\AssignOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule322() {
$this->semValue = new Expr\AssignOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule323() {
$this->semValue = new Expr\PostInc($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule324() {
$this->semValue = new Expr\PreInc($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule325() {
$this->semValue = new Expr\PostDec($this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule326() {
$this->semValue = new Expr\PreDec($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule327() {
$this->semValue = new Expr\BinaryOp\BooleanOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule328() {
$this->semValue = new Expr\BinaryOp\BooleanAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule329() {
$this->semValue = new Expr\BinaryOp\LogicalOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule330() {
$this->semValue = new Expr\BinaryOp\LogicalAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule331() {
$this->semValue = new Expr\BinaryOp\LogicalXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule332() {
$this->semValue = new Expr\BinaryOp\BitwiseOr($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule333() {
$this->semValue = new Expr\BinaryOp\BitwiseAnd($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule334() {
$this->semValue = new Expr\BinaryOp\BitwiseXor($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule335() {
$this->semValue = new Expr\BinaryOp\Concat($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule336() {
$this->semValue = new Expr\BinaryOp\Plus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule337() {
$this->semValue = new Expr\BinaryOp\Minus($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule338() {
$this->semValue = new Expr\BinaryOp\Mul($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule339() {
$this->semValue = new Expr\BinaryOp\Div($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule340() {
$this->semValue = new Expr\BinaryOp\Mod($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule341() {
$this->semValue = new Expr\BinaryOp\ShiftLeft($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule342() {
$this->semValue = new Expr\BinaryOp\ShiftRight($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule343() {
$this->semValue = new Expr\BinaryOp\Pow($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule344() {
$this->semValue = new Expr\UnaryPlus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule345() {
$this->semValue = new Expr\UnaryMinus($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule346() {
$this->semValue = new Expr\BooleanNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule347() {
$this->semValue = new Expr\BitwiseNot($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule348() {
$this->semValue = new Expr\BinaryOp\Identical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule349() {
$this->semValue = new Expr\BinaryOp\NotIdentical($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule350() {
$this->semValue = new Expr\BinaryOp\Equal($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule351() {
$this->semValue = new Expr\BinaryOp\NotEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule352() {
$this->semValue = new Expr\BinaryOp\Spaceship($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule353() {
$this->semValue = new Expr\BinaryOp\Smaller($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule354() {
$this->semValue = new Expr\BinaryOp\SmallerOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule355() {
$this->semValue = new Expr\BinaryOp\Greater($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule356() {
$this->semValue = new Expr\BinaryOp\GreaterOrEqual($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule357() {
$this->semValue = new Expr\Instanceof_($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule358() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule359() {
$this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(5-1)], $this->semStack[$this->stackPos-(5-3)], $this->semStack[$this->stackPos-(5-5)], $this->startAttributeStack[$this->stackPos-(5-1)] + $this->endAttributes);
}

protected function reduceRule360() {
$this->semValue = new Expr\Ternary($this->semStack[$this->stackPos-(4-1)], null, $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule361() {
$this->semValue = new Expr\BinaryOp\Coalesce($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule362() {
$this->semValue = new Expr\Isset_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule363() {
$this->semValue = new Expr\Empty_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule364() {
$this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule365() {
$this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_INCLUDE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule366() {
$this->semValue = new Expr\Eval_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule367() {
$this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule368() {
$this->semValue = new Expr\Include_($this->semStack[$this->stackPos-(2-2)], Expr\Include_::TYPE_REQUIRE_ONCE, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule369() {
$this->semValue = new Expr\Cast\Int_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule370() {
$this->semValue = new Expr\Cast\Double($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule371() {
$this->semValue = new Expr\Cast\String_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule372() {
$this->semValue = new Expr\Cast\Array_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule373() {
$this->semValue = new Expr\Cast\Object_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule374() {
$this->semValue = new Expr\Cast\Bool_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule375() {
$this->semValue = new Expr\Cast\Unset_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule376() {
$attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes;
$attrs['kind'] = strtolower($this->semStack[$this->stackPos-(2-1)]) === 'exit' ? Expr\Exit_::KIND_EXIT : Expr\Exit_::KIND_DIE;
$this->semValue = new Expr\Exit_($this->semStack[$this->stackPos-(2-2)], $attrs);
}

protected function reduceRule377() {
$this->semValue = new Expr\ErrorSuppress($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule378() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule379() {
$this->semValue = new Expr\ShellExec($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule380() {
$this->semValue = new Expr\Print_($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule381() {
$this->semValue = new Expr\Yield_(null, null, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule382() {
$this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(2-2)], null, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule383() {
$this->semValue = new Expr\Yield_($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-2)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule384() {
$this->semValue = new Expr\YieldFrom($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule385() {
$this->semValue = new Expr\Closure(['static' => false, 'byRef' => $this->semStack[$this->stackPos-(10-2)], 'params' => $this->semStack[$this->stackPos-(10-4)], 'uses' => $this->semStack[$this->stackPos-(10-6)], 'returnType' => $this->semStack[$this->stackPos-(10-7)], 'stmts' => $this->semStack[$this->stackPos-(10-9)]], $this->startAttributeStack[$this->stackPos-(10-1)] + $this->endAttributes);
}

protected function reduceRule386() {
$this->semValue = new Expr\Closure(['static' => true, 'byRef' => $this->semStack[$this->stackPos-(11-3)], 'params' => $this->semStack[$this->stackPos-(11-5)], 'uses' => $this->semStack[$this->stackPos-(11-7)], 'returnType' => $this->semStack[$this->stackPos-(11-8)], 'stmts' => $this->semStack[$this->stackPos-(11-10)]], $this->startAttributeStack[$this->stackPos-(11-1)] + $this->endAttributes);
}

protected function reduceRule387() {
$this->semValue = array(new Stmt\Class_(null, ['type' => 0, 'extends' => $this->semStack[$this->stackPos-(7-3)], 'implements' => $this->semStack[$this->stackPos-(7-4)], 'stmts' => $this->semStack[$this->stackPos-(7-6)]], $this->startAttributeStack[$this->stackPos-(7-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(7-2)]);
$this->checkClass($this->semValue[0], -1);
}

protected function reduceRule388() {
$this->semValue = new Expr\New_($this->semStack[$this->stackPos-(3-2)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule389() {
list($class, $ctorArgs) = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = new Expr\New_($class, $ctorArgs, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule390() {
$this->semValue = array();
}

protected function reduceRule391() {
$this->semValue = $this->semStack[$this->stackPos-(4-3)];
}

protected function reduceRule392() {
$this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule393() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule394() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule395() {
$this->semValue = new Expr\ClosureUse(substr($this->semStack[$this->stackPos-(2-2)], 1), $this->semStack[$this->stackPos-(2-1)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule396() {
$this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule397() {
$this->semValue = new Expr\FuncCall($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule398() {
$this->semValue = new Expr\StaticCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule399() {
$this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule400() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule401() {
$this->semValue = new Name($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule402() {
$this->semValue = new Name\FullyQualified($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule403() {
$this->semValue = new Name\Relative($this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule404() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule405() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule406() {
$this->semValue = new Expr\Error($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2;
}

protected function reduceRule407() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule408() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule409() {
$this->semValue = null;
}

protected function reduceRule410() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule411() {
$this->semValue = array();
}

protected function reduceRule412() {
$this->semValue = array(new Scalar\EncapsedStringPart(Scalar\String_::parseEscapeSequences($this->semStack[$this->stackPos-(1-1)], '`'), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes));
}

protected function reduceRule413() {
foreach ($this->semStack[$this->stackPos-(1-1)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '`', true); } }; $this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule414() {
$this->semValue = array();
}

protected function reduceRule415() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule416() {
$this->semValue = new Expr\ConstFetch($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule417() {
$this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule418() {
$this->semValue = new Expr\ClassConstFetch($this->semStack[$this->stackPos-(3-1)], new Expr\Error($this->startAttributeStack[$this->stackPos-(3-3)] + $this->endAttributeStack[$this->stackPos-(3-3)]), $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); $this->errorState = 2;
}

protected function reduceRule419() {
$attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_SHORT;
$this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(3-2)], $attrs);
}

protected function reduceRule420() {
$attrs = $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes; $attrs['kind'] = Expr\Array_::KIND_LONG;
$this->semValue = new Expr\Array_($this->semStack[$this->stackPos-(4-3)], $attrs);
}

protected function reduceRule421() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule422() {
$attrs = $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes; $attrs['kind'] = ($this->semStack[$this->stackPos-(1-1)][0] === "'" || ($this->semStack[$this->stackPos-(1-1)][1] === "'" && ($this->semStack[$this->stackPos-(1-1)][0] === 'b' || $this->semStack[$this->stackPos-(1-1)][0] === 'B')) ? Scalar\String_::KIND_SINGLE_QUOTED : Scalar\String_::KIND_DOUBLE_QUOTED);
$this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$this->stackPos-(1-1)]), $attrs);
}

protected function reduceRule423() {
$this->semValue = $this->parseLNumber($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule424() {
$this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$this->stackPos-(1-1)]), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule425() {
$this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule426() {
$this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule427() {
$this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule428() {
$this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule429() {
$this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule430() {
$this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule431() {
$this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule432() {
$this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule433() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule434() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule435() {
$attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];;
$this->semValue = new Scalar\String_(Scalar\String_::parseDocString($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-2)]), $attrs);
}

protected function reduceRule436() {
$attrs = $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(2-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(2-1)], $matches); $attrs['docLabel'] = $matches[1];;
$this->semValue = new Scalar\String_('', $attrs);
}

protected function reduceRule437() {
$attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs);
}

protected function reduceRule438() {
$attrs = $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = strpos($this->semStack[$this->stackPos-(3-1)], "'") === false ? Scalar\String_::KIND_HEREDOC : Scalar\String_::KIND_NOWDOC; preg_match('/\A[bB]?<<<[ \t]*[\'"]?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)[\'"]?(?:\r\n|\n|\r)\z/', $this->semStack[$this->stackPos-(3-1)], $matches); $attrs['docLabel'] = $matches[1];;
foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, true); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $attrs);
}

protected function reduceRule439() {
$this->semValue = null;
}

protected function reduceRule440() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule441() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule442() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule443() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule444() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule445() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule446() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule447() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule448() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule449() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule450() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule451() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule452() {
$this->semValue = new Expr\MethodCall($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->semStack[$this->stackPos-(4-4)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule453() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule454() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule455() {
$this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule456() {
$this->semValue = substr($this->semStack[$this->stackPos-(1-1)], 1);
}

protected function reduceRule457() {
$this->semValue = $this->semStack[$this->stackPos-(4-3)];
}

protected function reduceRule458() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule459() {
$this->semValue = new Expr\Error($this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes); $this->errorState = 2;
}

protected function reduceRule460() {
$this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule461() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule462() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule463() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule464() {
$this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule465() {
$this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule466() {
$this->semValue = new Expr\StaticPropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule467() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule468() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule469() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule470() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule471() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule472() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule473() {
$this->semValue = new Expr\Error($this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes); $this->errorState = 2;
}

protected function reduceRule474() {
$this->semValue = new Expr\List_($this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule475() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule476() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule477() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule478() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule479() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule480() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule481() {
$this->semValue = null;
}

protected function reduceRule482() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)]; $end = count($this->semValue)-1; if ($this->semValue[$end] === null) unset($this->semValue[$end]);
}

protected function reduceRule483() {
$this->semStack[$this->stackPos-(3-1)][] = $this->semStack[$this->stackPos-(3-3)]; $this->semValue = $this->semStack[$this->stackPos-(3-1)];
}

protected function reduceRule484() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule485() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(3-3)], $this->semStack[$this->stackPos-(3-1)], false, $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule486() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(1-1)], null, false, $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule487() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(4-4)], $this->semStack[$this->stackPos-(4-1)], true, $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule488() {
$this->semValue = new Expr\ArrayItem($this->semStack[$this->stackPos-(2-2)], null, true, $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule489() {
$this->semValue = null;
}

protected function reduceRule490() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule491() {
$this->semStack[$this->stackPos-(2-1)][] = $this->semStack[$this->stackPos-(2-2)]; $this->semValue = $this->semStack[$this->stackPos-(2-1)];
}

protected function reduceRule492() {
$this->semValue = array($this->semStack[$this->stackPos-(1-1)]);
}

protected function reduceRule493() {
$this->semValue = array($this->semStack[$this->stackPos-(2-1)], $this->semStack[$this->stackPos-(2-2)]);
}

protected function reduceRule494() {
$this->semValue = new Scalar\EncapsedStringPart($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule495() {
$this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule496() {
$this->semValue = $this->semStack[$this->stackPos-(1-1)];
}

protected function reduceRule497() {
$this->semValue = new Expr\ArrayDimFetch($this->semStack[$this->stackPos-(4-1)], $this->semStack[$this->stackPos-(4-3)], $this->startAttributeStack[$this->stackPos-(4-1)] + $this->endAttributes);
}

protected function reduceRule498() {
$this->semValue = new Expr\PropertyFetch($this->semStack[$this->stackPos-(3-1)], $this->semStack[$this->stackPos-(3-3)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule499() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule500() {
$this->semValue = new Expr\Variable($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes);
}

protected function reduceRule501() {
$this->semValue = new Expr\ArrayDimFetch(new Expr\Variable($this->semStack[$this->stackPos-(6-2)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes), $this->semStack[$this->stackPos-(6-4)], $this->startAttributeStack[$this->stackPos-(6-1)] + $this->endAttributes);
}

protected function reduceRule502() {
$this->semValue = $this->semStack[$this->stackPos-(3-2)];
}

protected function reduceRule503() {
$this->semValue = new Scalar\String_($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule504() {
$this->semValue = $this->parseNumString($this->semStack[$this->stackPos-(1-1)], $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}

protected function reduceRule505() {
$this->semValue = $this->parseNumString('-' . $this->semStack[$this->stackPos-(2-2)], $this->startAttributeStack[$this->stackPos-(2-1)] + $this->endAttributes);
}

protected function reduceRule506() {
$this->semValue = new Expr\Variable(substr($this->semStack[$this->stackPos-(1-1)], 1), $this->startAttributeStack[$this->stackPos-(1-1)] + $this->endAttributes);
}
}
<?php

namespace PhpParser\Parser;


final class Tokens
{
const YYERRTOK = 256;
const T_INCLUDE = 257;
const T_INCLUDE_ONCE = 258;
const T_EVAL = 259;
const T_REQUIRE = 260;
const T_REQUIRE_ONCE = 261;
const T_LOGICAL_OR = 262;
const T_LOGICAL_XOR = 263;
const T_LOGICAL_AND = 264;
const T_PRINT = 265;
const T_YIELD = 266;
const T_DOUBLE_ARROW = 267;
const T_YIELD_FROM = 268;
const T_PLUS_EQUAL = 269;
const T_MINUS_EQUAL = 270;
const T_MUL_EQUAL = 271;
const T_DIV_EQUAL = 272;
const T_CONCAT_EQUAL = 273;
const T_MOD_EQUAL = 274;
const T_AND_EQUAL = 275;
const T_OR_EQUAL = 276;
const T_XOR_EQUAL = 277;
const T_SL_EQUAL = 278;
const T_SR_EQUAL = 279;
const T_POW_EQUAL = 280;
const T_COALESCE = 281;
const T_BOOLEAN_OR = 282;
const T_BOOLEAN_AND = 283;
const T_IS_EQUAL = 284;
const T_IS_NOT_EQUAL = 285;
const T_IS_IDENTICAL = 286;
const T_IS_NOT_IDENTICAL = 287;
const T_SPACESHIP = 288;
const T_IS_SMALLER_OR_EQUAL = 289;
const T_IS_GREATER_OR_EQUAL = 290;
const T_SL = 291;
const T_SR = 292;
const T_INSTANCEOF = 293;
const T_INC = 294;
const T_DEC = 295;
const T_INT_CAST = 296;
const T_DOUBLE_CAST = 297;
const T_STRING_CAST = 298;
const T_ARRAY_CAST = 299;
const T_OBJECT_CAST = 300;
const T_BOOL_CAST = 301;
const T_UNSET_CAST = 302;
const T_POW = 303;
const T_NEW = 304;
const T_CLONE = 305;
const T_EXIT = 306;
const T_IF = 307;
const T_ELSEIF = 308;
const T_ELSE = 309;
const T_ENDIF = 310;
const T_LNUMBER = 311;
const T_DNUMBER = 312;
const T_STRING = 313;
const T_STRING_VARNAME = 314;
const T_VARIABLE = 315;
const T_NUM_STRING = 316;
const T_INLINE_HTML = 317;
const T_CHARACTER = 318;
const T_BAD_CHARACTER = 319;
const T_ENCAPSED_AND_WHITESPACE = 320;
const T_CONSTANT_ENCAPSED_STRING = 321;
const T_ECHO = 322;
const T_DO = 323;
const T_WHILE = 324;
const T_ENDWHILE = 325;
const T_FOR = 326;
const T_ENDFOR = 327;
const T_FOREACH = 328;
const T_ENDFOREACH = 329;
const T_DECLARE = 330;
const T_ENDDECLARE = 331;
const T_AS = 332;
const T_SWITCH = 333;
const T_ENDSWITCH = 334;
const T_CASE = 335;
const T_DEFAULT = 336;
const T_BREAK = 337;
const T_CONTINUE = 338;
const T_GOTO = 339;
const T_FUNCTION = 340;
const T_CONST = 341;
const T_RETURN = 342;
const T_TRY = 343;
const T_CATCH = 344;
const T_FINALLY = 345;
const T_THROW = 346;
const T_USE = 347;
const T_INSTEADOF = 348;
const T_GLOBAL = 349;
const T_STATIC = 350;
const T_ABSTRACT = 351;
const T_FINAL = 352;
const T_PRIVATE = 353;
const T_PROTECTED = 354;
const T_PUBLIC = 355;
const T_VAR = 356;
const T_UNSET = 357;
const T_ISSET = 358;
const T_EMPTY = 359;
const T_HALT_COMPILER = 360;
const T_CLASS = 361;
const T_TRAIT = 362;
const T_INTERFACE = 363;
const T_EXTENDS = 364;
const T_IMPLEMENTS = 365;
const T_OBJECT_OPERATOR = 366;
const T_LIST = 367;
const T_ARRAY = 368;
const T_CALLABLE = 369;
const T_CLASS_C = 370;
const T_TRAIT_C = 371;
const T_METHOD_C = 372;
const T_FUNC_C = 373;
const T_LINE = 374;
const T_FILE = 375;
const T_COMMENT = 376;
const T_DOC_COMMENT = 377;
const T_OPEN_TAG = 378;
const T_OPEN_TAG_WITH_ECHO = 379;
const T_CLOSE_TAG = 380;
const T_WHITESPACE = 381;
const T_START_HEREDOC = 382;
const T_END_HEREDOC = 383;
const T_DOLLAR_OPEN_CURLY_BRACES = 384;
const T_CURLY_OPEN = 385;
const T_PAAMAYIM_NEKUDOTAYIM = 386;
const T_NAMESPACE = 387;
const T_NS_C = 388;
const T_DIR = 389;
const T_NS_SEPARATOR = 390;
const T_ELLIPSIS = 391;
}
<?php

namespace PhpParser;

use PhpParser\Node;

abstract class NodeAbstract implements Node, \JsonSerializable
{
protected $attributes;






public function __construct(array $attributes = array()) {
$this->attributes = $attributes;
}






public function getType() {
$className = rtrim(get_class($this), '_');
return strtr(
substr($className, strlen(Node::class) + 1),
'\\',
'_'
);
}






public function getLine() {
return $this->getAttribute('startLine', -1);
}








public function setLine($line) {
$this->setAttribute('startLine', (int) $line);
}








public function getDocComment() {
$comments = $this->getAttribute('comments');
if (!$comments) {
return null;
}

$lastComment = $comments[count($comments) - 1];
if (!$lastComment instanceof Comment\Doc) {
return null;
}

return $lastComment;
}








public function setDocComment(Comment\Doc $docComment) {
$comments = $this->getAttribute('comments', []);

$numComments = count($comments);
if ($numComments > 0 && $comments[$numComments - 1] instanceof Comment\Doc) {

 $comments[$numComments - 1] = $docComment;
} else {

 $comments[] = $docComment;
}

$this->setAttribute('comments', $comments);
}

public function setAttribute($key, $value) {
$this->attributes[$key] = $value;
}

public function hasAttribute($key) {
return array_key_exists($key, $this->attributes);
}

public function &getAttribute($key, $default = null) {
if (!array_key_exists($key, $this->attributes)) {
return $default;
} else {
return $this->attributes[$key];
}
}

public function getAttributes() {
return $this->attributes;
}

public function jsonSerialize() {
return ['nodeType' => $this->getType()] + get_object_vars($this);
}
}
<?php

namespace PhpParser;

interface Node
{





public function getType();






public function getSubNodeNames();






public function getLine();








public function setLine($line);








public function getDocComment();








public function setDocComment(Comment\Doc $docComment);







public function setAttribute($key, $value);








public function hasAttribute($key);









public function &getAttribute($key, $default = null);






public function getAttributes();
}<?php

namespace PhpParser\Unserializer;

use DomainException;
use PhpParser\Unserializer;
use XMLReader;




class XML implements Unserializer
{
protected $reader;

public function __construct() {
$this->reader = new XMLReader;
}

public function unserialize($string) {
$this->reader->XML($string);

$this->reader->read();
if ('AST' !== $this->reader->name) {
throw new DomainException('AST root element not found');
}

return $this->read($this->reader->depth);
}

protected function read($depthLimit, $throw = true, &$nodeFound = null) {
$nodeFound = true;
while ($this->reader->read() && $depthLimit < $this->reader->depth) {
if (XMLReader::ELEMENT !== $this->reader->nodeType) {
continue;
}

if ('node' === $this->reader->prefix) {
return $this->readNode();
} elseif ('scalar' === $this->reader->prefix) {
return $this->readScalar();
} elseif ('comment' === $this->reader->name) {
return $this->readComment();
} else {
throw new DomainException(sprintf('Unexpected node of type "%s"', $this->reader->name));
}
}

$nodeFound = false;
if ($throw) {
throw new DomainException('Expected node or scalar');
}
}

protected function readNode() {
$className = $this->getClassNameFromType($this->reader->localName);


 $node = unserialize(
sprintf(
"O:%d:\"%s\":1:{s:13:\"\0*\0attributes\";a:0:{}}",
strlen($className), $className
)
);

$depthLimit = $this->reader->depth;
while ($this->reader->read() && $depthLimit < $this->reader->depth) {
if (XMLReader::ELEMENT !== $this->reader->nodeType) {
continue;
}

$type = $this->reader->prefix;
if ('subNode' !== $type && 'attribute' !== $type) {
throw new DomainException(
sprintf('Expected sub node or attribute, got node of type "%s"', $this->reader->name)
);
}

$name = $this->reader->localName;
$value = $this->read($this->reader->depth);

if ('subNode' === $type) {
$node->$name = $value;
} else {
$node->setAttribute($name, $value);
}
}

return $node;
}

protected function readScalar() {
switch ($name = $this->reader->localName) {
case 'array':
$depth = $this->reader->depth;
$array = array();
while (true) {
$node = $this->read($depth, false, $nodeFound);
if (!$nodeFound) {
break;
}
$array[] = $node;
}
return $array;
case 'string':
return $this->reader->readString();
case 'int':
return $this->parseInt($this->reader->readString());
case 'float':
$text = $this->reader->readString();
if (false === $float = filter_var($text, FILTER_VALIDATE_FLOAT)) {
throw new DomainException(sprintf('"%s" is not a valid float', $text));
}
return $float;
case 'true':
case 'false':
case 'null':
if (!$this->reader->isEmptyElement) {
throw new DomainException(sprintf('"%s" scalar must be empty', $name));
}
return constant($name);
default:
throw new DomainException(sprintf('Unknown scalar type "%s"', $name));
}
}

private function parseInt($text) {
if (false === $int = filter_var($text, FILTER_VALIDATE_INT)) {
throw new DomainException(sprintf('"%s" is not a valid integer', $text));
}
return $int;
}

protected function readComment() {
$className = $this->reader->getAttribute('isDocComment') === 'true'
? 'PhpParser\Comment\Doc'
: 'PhpParser\Comment'
;
return new $className(
$this->reader->readString(),
$this->parseInt($this->reader->getAttribute('line'))
);
}

protected function getClassNameFromType($type) {
$className = 'PhpParser\\Node\\' . strtr($type, '_', '\\');
if (!class_exists($className)) {
$className .= '_';
}
if (!class_exists($className)) {
throw new DomainException(sprintf('Unknown node type "%s"', $type));
}
return $className;
}
}
<?php

namespace PhpParser;

interface ErrorHandler
{





public function handleError(Error $error);
}<?php

namespace PhpParser;

class Error extends \RuntimeException
{
protected $rawMessage;
protected $attributes;








public function __construct($message, $attributes = array()) {
$this->rawMessage = (string) $message;
if (is_array($attributes)) {
$this->attributes = $attributes;
} else {
$this->attributes = array('startLine' => $attributes);
}
$this->updateMessage();
}






public function getRawMessage() {
return $this->rawMessage;
}






public function getStartLine() {
return isset($this->attributes['startLine']) ? $this->attributes['startLine'] : -1;
}






public function getEndLine() {
return isset($this->attributes['endLine']) ? $this->attributes['endLine'] : -1;
}







public function getAttributes() {
return $this->attributes;
}






public function setAttributes(array $attributes) {
$this->attributes = $attributes;
$this->updateMessage();
}






public function setRawMessage($message) {
$this->rawMessage = (string) $message;
$this->updateMessage();
}






public function setStartLine($line) {
$this->attributes['startLine'] = (int) $line;
$this->updateMessage();
}








public function hasColumnInfo() {
return isset($this->attributes['startFilePos']) && isset($this->attributes['endFilePos']);
}







public function getStartColumn($code) {
if (!$this->hasColumnInfo()) {
throw new \RuntimeException('Error does not have column information');
}

return $this->toColumn($code, $this->attributes['startFilePos']);
}







public function getEndColumn($code) {
if (!$this->hasColumnInfo()) {
throw new \RuntimeException('Error does not have column information');
}

return $this->toColumn($code, $this->attributes['endFilePos']);
}

public function getMessageWithColumnInfo($code) {
return sprintf(
'%s from %d:%d to %d:%d', $this->getRawMessage(),
$this->getStartLine(), $this->getStartColumn($code),
$this->getEndLine(), $this->getEndColumn($code)
);
}

private function toColumn($code, $pos) {
if ($pos > strlen($code)) {
throw new \RuntimeException('Invalid position information');
}

$lineStartPos = strrpos($code, "\n", $pos - strlen($code));
if (false === $lineStartPos) {
$lineStartPos = -1;
}

return $pos - $lineStartPos;
}




protected function updateMessage() {
$this->message = $this->rawMessage;

if (-1 === $this->getStartLine()) {
$this->message .= ' on unknown line';
} else {
$this->message .= ' on line ' . $this->getStartLine();
}
}
}
<?php

namespace PhpParser\ErrorHandler;

use PhpParser\Error;
use PhpParser\ErrorHandler;






class Throwing implements ErrorHandler
{
public function handleError(Error $error) {
throw $error;
}
}<?php

namespace PhpParser\ErrorHandler;

use PhpParser\Error;
use PhpParser\ErrorHandler;






class Collecting implements ErrorHandler
{

private $errors = [];

public function handleError(Error $error) {
$this->errors[] = $error;
}






public function getErrors() {
return $this->errors;
}






public function hasErrors() {
return !empty($this->errors);
}




public function clearErrors() {
$this->errors = [];
}
}<?php

namespace PhpParser;

class NodeTraverser implements NodeTraverserInterface
{







const DONT_TRAVERSE_CHILDREN = 1;







const STOP_TRAVERSAL = 2;








const REMOVE_NODE = false;


protected $visitors;


protected $stopTraversal;




public function __construct() {
$this->visitors = array();
}






public function addVisitor(NodeVisitor $visitor) {
$this->visitors[] = $visitor;
}






public function removeVisitor(NodeVisitor $visitor) {
foreach ($this->visitors as $index => $storedVisitor) {
if ($storedVisitor === $visitor) {
unset($this->visitors[$index]);
break;
}
}
}








public function traverse(array $nodes) {
$this->stopTraversal = false;

foreach ($this->visitors as $visitor) {
if (null !== $return = $visitor->beforeTraverse($nodes)) {
$nodes = $return;
}
}

$nodes = $this->traverseArray($nodes);

foreach ($this->visitors as $visitor) {
if (null !== $return = $visitor->afterTraverse($nodes)) {
$nodes = $return;
}
}

return $nodes;
}

protected function traverseNode(Node $node) {
foreach ($node->getSubNodeNames() as $name) {
$subNode =& $node->$name;

if (is_array($subNode)) {
$subNode = $this->traverseArray($subNode);
if ($this->stopTraversal) {
break;
}
} elseif ($subNode instanceof Node) {
$traverseChildren = true;
foreach ($this->visitors as $visitor) {
$return = $visitor->enterNode($subNode);
if (self::DONT_TRAVERSE_CHILDREN === $return) {
$traverseChildren = false;
} else if (self::STOP_TRAVERSAL === $return) {
$this->stopTraversal = true;
break 2;
} else if (null !== $return) {
$subNode = $return;
}
}

if ($traverseChildren) {
$subNode = $this->traverseNode($subNode);
if ($this->stopTraversal) {
break;
}
}

foreach ($this->visitors as $visitor) {
$return = $visitor->leaveNode($subNode);
if (self::STOP_TRAVERSAL === $return) {
$this->stopTraversal = true;
break 2;
} else if (null !== $return) {
if (is_array($return)) {
throw new \LogicException(
'leaveNode() may only return an array ' .
'if the parent structure is an array'
);
}
$subNode = $return;
}
}
}
}

return $node;
}

protected function traverseArray(array $nodes) {
$doNodes = array();

foreach ($nodes as $i => &$node) {
if (is_array($node)) {
$node = $this->traverseArray($node);
if ($this->stopTraversal) {
break;
}
} elseif ($node instanceof Node) {
$traverseChildren = true;
foreach ($this->visitors as $visitor) {
$return = $visitor->enterNode($node);
if (self::DONT_TRAVERSE_CHILDREN === $return) {
$traverseChildren = false;
} else if (self::STOP_TRAVERSAL === $return) {
$this->stopTraversal = true;
break 2;
} else if (null !== $return) {
$node = $return;
}
}

if ($traverseChildren) {
$node = $this->traverseNode($node);
if ($this->stopTraversal) {
break;
}
}

foreach ($this->visitors as $visitor) {
$return = $visitor->leaveNode($node);

if (self::REMOVE_NODE === $return) {
$doNodes[] = array($i, array());
break;
} else if (self::STOP_TRAVERSAL === $return) {
$this->stopTraversal = true;
break 2;
} elseif (is_array($return)) {
$doNodes[] = array($i, $return);
break;
} elseif (null !== $return) {
$node = $return;
}
}
}
}

if (!empty($doNodes)) {
while (list($i, $replace) = array_pop($doNodes)) {
array_splice($nodes, $i, 1, $replace);
}
}

return $nodes;
}
}
<?php

namespace PhpParser;

class Comment implements \JsonSerializable
{
protected $text;
protected $line;
protected $filePos;








public function __construct($text, $startLine = -1, $startFilePos = -1) {
$this->text = $text;
$this->line = $startLine;
$this->filePos = $startFilePos;
}






public function getText() {
return $this->text;
}






public function getLine() {
return $this->line;
}






public function getFilePos() {
return $this->filePos;
}






public function __toString() {
return $this->text;
}











public function getReformattedText() {
$text = trim($this->text);
$newlinePos = strpos($text, "\n");
if (false === $newlinePos) {

 return $text;
} elseif (preg_match('((*BSR_ANYCRLF)(*ANYCRLF)^.*(?:\R\s+\*.*)+$)', $text)) {

 
 
 
 
 
 
 
 return preg_replace('(^\s+\*)m', ' *', $this->text);
} elseif (preg_match('(^/\*\*?\s*[\r\n])', $text) && preg_match('(\n(\s*)\*/$)', $text, $matches)) {

 
 
 
 
 
 
 
 
 
 return preg_replace('(^' . preg_quote($matches[1]) . ')m', '', $text);
} elseif (preg_match('(^/\*\*?\s*(?!\s))', $text, $matches)) {

 
 
 
 
 
 
 
 
 $prefixLen = $this->getShortestWhitespacePrefixLen(substr($text, $newlinePos + 1));
$removeLen = $prefixLen - strlen($matches[0]);
return preg_replace('(^\s{' . $removeLen . '})m', '', $text);
}


 return $text;
}

private function getShortestWhitespacePrefixLen($str) {
$lines = explode("\n", $str);
$shortestPrefixLen = INF;
foreach ($lines as $line) {
preg_match('(^\s*)', $line, $matches);
$prefixLen = strlen($matches[0]);
if ($prefixLen < $shortestPrefixLen) {
$shortestPrefixLen = $prefixLen;
}
}
return $shortestPrefixLen;
}

public function jsonSerialize() {

 $type = $this instanceof Comment\Doc ? 'Comment_Doc' : 'Comment';
return [
'nodeType' => $type,
'text' => $this->text,
'line' => $this->line,
'filePos' => $this->filePos,
];
}
}<?php

namespace PhpParser\Node;

use PhpParser\NodeAbstract;

class NullableType extends NodeAbstract
{

public $type;







public function __construct($type, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
}

public function getSubNodeNames() {
return array('type');
}
}
<?php

namespace PhpParser\Node;

use PhpParser\NodeAbstract;

class Name extends NodeAbstract
{



public $parts;







public function __construct($name, array $attributes = array()) {
parent::__construct($attributes);
$this->parts = self::prepareName($name);
}

public function getSubNodeNames() {
return array('parts');
}






public function getFirst() {
return $this->parts[0];
}






public function getLast() {
return $this->parts[count($this->parts) - 1];
}






public function isUnqualified() {
return 1 == count($this->parts);
}






public function isQualified() {
return 1 < count($this->parts);
}






public function isFullyQualified() {
return false;
}






public function isRelative() {
return false;
}







public function toString() {
return implode('\\', $this->parts);
}







public function __toString() {
return implode('\\', $this->parts);
}

















public function slice($offset, $length = null) {
$numParts = count($this->parts);

$realOffset = $offset < 0 ? $offset + $numParts : $offset;
if ($realOffset < 0 || $realOffset > $numParts) {
throw new \OutOfBoundsException(sprintf('Offset %d is out of bounds', $offset));
}

if (null === $length) {
$realLength = $numParts - $realOffset;
} else {
$realLength = $length < 0 ? $length + $numParts - $realOffset : $length;
if ($realLength < 0 || $realLength > $numParts) {
throw new \OutOfBoundsException(sprintf('Length %d is out of bounds', $length));
}
}

if ($realLength === 0) {

 return null;
}

return new static(array_slice($this->parts, $realOffset, $realLength), $this->attributes);
}


















public static function concat($name1, $name2, array $attributes = []) {
if (null === $name1 && null === $name2) {
return null;
} elseif (null === $name1) {
return new static(self::prepareName($name2), $attributes);
} else if (null === $name2) {
return new static(self::prepareName($name1), $attributes);
} else {
return new static(
array_merge(self::prepareName($name1), self::prepareName($name2)), $attributes
);
}
}









private static function prepareName($name) {
if (\is_string($name)) {
return explode('\\', $name);
} elseif (\is_array($name)) {
return $name;
} elseif ($name instanceof self) {
return $name->parts;
}

throw new \InvalidArgumentException(
'Expected string, array of parts or Name instance'
);
}
}
<?php

namespace PhpParser\Node;

use PhpParser\NodeAbstract;

class Const_ extends NodeAbstract
{

public $name;

public $value;








public function __construct($name, Expr $value, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->value = $value;
}

public function getSubNodeNames() {
return array('name', 'value');
}
}
<?php

namespace PhpParser\Node;

use PhpParser\NodeAbstract;

abstract class Stmt extends NodeAbstract
{
}<?php

namespace PhpParser\Node\Scalar;

use PhpParser\Error;
use PhpParser\Node\Scalar;

class String_ extends Scalar
{

const KIND_SINGLE_QUOTED = 1;
const KIND_DOUBLE_QUOTED = 2;
const KIND_HEREDOC = 3;
const KIND_NOWDOC = 4;


public $value;

protected static $replacements = array(
'\\' => '\\',
'$' => '$',
'n' => "\n",
'r' => "\r",
't' => "\t",
'f' => "\f",
'v' => "\v",
'e' => "\x1B",
);







public function __construct($value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}

public function getSubNodeNames() {
return array('value');
}











public static function parse($str, $parseUnicodeEscape = true) {
$bLength = 0;
if ('b' === $str[0] || 'B' === $str[0]) {
$bLength = 1;
}

if ('\'' === $str[$bLength]) {
return str_replace(
array('\\\\', '\\\''),
array( '\\', '\''),
substr($str, $bLength + 1, -1)
);
} else {
return self::parseEscapeSequences(
substr($str, $bLength + 1, -1), '"', $parseUnicodeEscape
);
}
}












public static function parseEscapeSequences($str, $quote, $parseUnicodeEscape = true) {
if (null !== $quote) {
$str = str_replace('\\' . $quote, $quote, $str);
}

$extra = '';
if ($parseUnicodeEscape) {
$extra = '|u\{([0-9a-fA-F]+)\}';
}

return preg_replace_callback(
'~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}' . $extra . ')~',
function($matches) {
$str = $matches[1];

if (isset(self::$replacements[$str])) {
return self::$replacements[$str];
} elseif ('x' === $str[0] || 'X' === $str[0]) {
return chr(hexdec($str));
} elseif ('u' === $str[0]) {
return self::codePointToUtf8(hexdec($matches[2]));
} else {
return chr(octdec($str));
}
},
$str
);
}

private static function codePointToUtf8($num) {
if ($num <= 0x7F) {
return chr($num);
}
if ($num <= 0x7FF) {
return chr(($num>>6) + 0xC0) . chr(($num&0x3F) + 0x80);
}
if ($num <= 0xFFFF) {
return chr(($num>>12) + 0xE0) . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80);
}
if ($num <= 0x1FFFFF) {
return chr(($num>>18) + 0xF0) . chr((($num>>12)&0x3F) + 0x80)
. chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80);
}
throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large');
}












public static function parseDocString($startToken, $str, $parseUnicodeEscape = true) {

 $str = preg_replace('~(\r\n|\n|\r)\z~', '', $str);


 if (false !== strpos($startToken, '\'')) {
return $str;
}

return self::parseEscapeSequences($str, null, $parseUnicodeEscape);
}
}
<?php

namespace PhpParser\Node\Scalar;

use PhpParser\Node\Scalar;

abstract class MagicConst extends Scalar
{





public function __construct(array $attributes = array()) {
parent::__construct($attributes);
}

public function getSubNodeNames() {
return array();
}






abstract public function getName();
}
<?php

namespace PhpParser\Node\Scalar;

use PhpParser\Node\Expr;
use PhpParser\Node\Scalar;

class Encapsed extends Scalar
{

public $parts;







public function __construct(array $parts, array $attributes = array()) {
parent::__construct($attributes);
$this->parts = $parts;
}

public function getSubNodeNames() {
return array('parts');
}
}
<?php

namespace PhpParser\Node\Scalar;

use PhpParser\Error;
use PhpParser\Node\Scalar;

class LNumber extends Scalar
{

const KIND_BIN = 2;
const KIND_OCT = 8;
const KIND_DEC = 10;
const KIND_HEX = 16;


public $value;







public function __construct($value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}

public function getSubNodeNames() {
return array('value');
}










public static function fromString($str, array $attributes = array(), $allowInvalidOctal = false) {
if ('0' !== $str[0] || '0' === $str) {
$attributes['kind'] = LNumber::KIND_DEC;
return new LNumber((int) $str, $attributes);
}

if ('x' === $str[1] || 'X' === $str[1]) {
$attributes['kind'] = LNumber::KIND_HEX;
return new LNumber(hexdec($str), $attributes);
}

if ('b' === $str[1] || 'B' === $str[1]) {
$attributes['kind'] = LNumber::KIND_BIN;
return new LNumber(bindec($str), $attributes);
}

if (!$allowInvalidOctal && strpbrk($str, '89')) {
throw new Error('Invalid numeric literal', $attributes);
}


 $attributes['kind'] = LNumber::KIND_OCT;
return new LNumber(intval($str, 8), $attributes);
}
}
<?php

namespace PhpParser\Node\Scalar;

use PhpParser\Node\Scalar;

class EncapsedStringPart extends Scalar
{

public $value;







public function __construct($value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}

public function getSubNodeNames() {
return array('value');
}
}
<?php

namespace PhpParser\Node\Scalar;

use PhpParser\Node\Scalar;

class DNumber extends Scalar
{

public $value;







public function __construct($value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}

public function getSubNodeNames() {
return array('value');
}










public static function parse($str) {

 if (false !== strpbrk($str, '.eE')) {
return (float) $str;
}


 
 if ('0' === $str[0]) {

 if ('x' === $str[1] || 'X' === $str[1]) {
return hexdec($str);
}


 if ('b' === $str[1] || 'B' === $str[1]) {
return bindec($str);
}


 
 
 return octdec(substr($str, 0, strcspn($str, '89')));
}


 return (float) $str;
}
}
<?php

namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;

class Line extends MagicConst
{
public function getName() {
return '__LINE__';
}
}<?php

namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;

class File extends MagicConst
{
public function getName() {
return '__FILE__';
}
}<?php

namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;

class Method extends MagicConst
{
public function getName() {
return '__METHOD__';
}
}<?php

namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;

class Class_ extends MagicConst
{
public function getName() {
return '__CLASS__';
}
}<?php

namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;

class Trait_ extends MagicConst
{
public function getName() {
return '__TRAIT__';
}
}<?php

namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;

class Function_ extends MagicConst
{
public function getName() {
return '__FUNCTION__';
}
}<?php

namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;

class Namespace_ extends MagicConst
{
public function getName() {
return '__NAMESPACE__';
}
}<?php

namespace PhpParser\Node\Scalar\MagicConst;

use PhpParser\Node\Scalar\MagicConst;

class Dir extends MagicConst
{
public function getName() {
return '__DIR__';
}
}<?php

namespace PhpParser\Node;

use PhpParser\NodeAbstract;

class Param extends NodeAbstract
{

public $type;

public $byRef;

public $variadic;

public $name;

public $default;











public function __construct($name, Expr $default = null, $type = null, $byRef = false, $variadic = false, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
$this->byRef = $byRef;
$this->variadic = $variadic;
$this->name = $name;
$this->default = $default;
}

public function getSubNodeNames() {
return array('type', 'byRef', 'variadic', 'name', 'default');
}
}
<?php

namespace PhpParser\Node;

use PhpParser\Node;

interface FunctionLike extends Node
{





public function returnsByRef();






public function getParams();






public function getReturnType();






public function getStmts();
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class PropertyFetch extends Expr
{

public $var;

public $name;








public function __construct(Expr $var, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->name = $name;
}

public function getSubNodeNames() {
return array('var', 'name');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class PostInc extends Expr
{

public $var;







public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}

public function getSubNodeNames() {
return array('var');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Ternary extends Expr
{

public $cond;

public $if;

public $else;









public function __construct(Expr $cond, $if, Expr $else, array $attributes = array()) {
parent::__construct($attributes);
$this->cond = $cond;
$this->if = $if;
$this->else = $else;
}

public function getSubNodeNames() {
return array('cond', 'if', 'else');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node;
use PhpParser\Node\Expr;

class FuncCall extends Expr
{

public $name;

public $args;








public function __construct($name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->args = $args;
}

public function getSubNodeNames() {
return array('name', 'args');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Variable extends Expr
{

public $name;







public function __construct($name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}

public function getSubNodeNames() {
return array('name');
}
}
<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Mod extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class ShiftLeft extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Smaller extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Greater extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Minus extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class SmallerOrEqual extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Spaceship extends BinaryOp
{
}
<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Div extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Mul extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Equal extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Identical extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class BitwiseXor extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Pow extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class BitwiseAnd extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class NotIdentical extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class GreaterOrEqual extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class NotEqual extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class BooleanOr extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class ShiftRight extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class LogicalAnd extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class LogicalXor extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class LogicalOr extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Plus extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Concat extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class BitwiseOr extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class BooleanAnd extends BinaryOp
{
}<?php

namespace PhpParser\Node\Expr\BinaryOp;

use PhpParser\Node\Expr\BinaryOp;

class Coalesce extends BinaryOp
{
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

abstract class AssignOp extends Expr
{

public $var;

public $expr;








public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('var', 'expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

abstract class BinaryOp extends Expr
{

public $left;

public $right;








public function __construct(Expr $left, Expr $right, array $attributes = array()) {
parent::__construct($attributes);
$this->left = $left;
$this->right = $right;
}

public function getSubNodeNames() {
return array('left', 'right');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class YieldFrom extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node;
use PhpParser\Node\Expr;

class StaticCall extends Expr
{

public $class;

public $name;

public $args;









public function __construct($class, $name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = $name;
$this->args = $args;
}

public function getSubNodeNames() {
return array('class', 'name', 'args');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;
use PhpParser\Node\Name;

class Instanceof_ extends Expr
{

public $expr;

public $class;








public function __construct(Expr $expr, $class, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
$this->class = $class;
}

public function getSubNodeNames() {
return array('expr', 'class');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Eval_ extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Array_ extends Expr
{

 const KIND_LONG = 1; 
 const KIND_SHORT = 2; 


public $items;







public function __construct(array $items = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->items = $items;
}

public function getSubNodeNames() {
return array('items');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;







class Error extends Expr
{





public function __construct(array $attributes = array()) {
parent::__construct($attributes);
}

public function getSubNodeNames() {
return array();
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class List_ extends Expr
{

public $items;







public function __construct(array $items, array $attributes = array()) {
parent::__construct($attributes);
$this->items = $items;
}

public function getSubNodeNames() {
return array('items');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\FunctionLike;

class Closure extends Expr implements FunctionLike
{

public $static;

public $byRef;

public $params;

public $uses;

public $returnType;

public $stmts;













public function __construct(array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->static = isset($subNodes['static']) ? $subNodes['static'] : false;
$this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;
$this->params = isset($subNodes['params']) ? $subNodes['params'] : array();
$this->uses = isset($subNodes['uses']) ? $subNodes['uses'] : array();
$this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null;
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
}

public function getSubNodeNames() {
return array('static', 'byRef', 'params', 'uses', 'returnType', 'stmts');
}

public function returnsByRef() {
return $this->byRef;
}

public function getParams() {
return $this->params;
}

public function getReturnType() {
return $this->returnType;
}

public function getStmts() {
return $this->stmts;
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class ShellExec extends Expr
{

public $parts;







public function __construct(array $parts, array $attributes = array()) {
parent::__construct($attributes);
$this->parts = $parts;
}

public function getSubNodeNames() {
return array('parts');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

abstract class Cast extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class ClosureUse extends Expr
{

public $var;

public $byRef;








public function __construct($var, $byRef = false, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->byRef = $byRef;
}

public function getSubNodeNames() {
return array('var', 'byRef');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;
use PhpParser\Node\Name;

class StaticPropertyFetch extends Expr
{

public $class;

public $name;








public function __construct($class, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = $name;
}

public function getSubNodeNames() {
return array('class', 'name');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Exit_ extends Expr
{

const KIND_EXIT = 1;
const KIND_DIE = 2;


public $expr;







public function __construct(Expr $expr = null, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class BooleanNot extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Arg;
use PhpParser\Node\Expr;

class MethodCall extends Expr
{

public $var;

public $name;

public $args;









public function __construct(Expr $var, $name, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->name = $name;
$this->args = $args;
}

public function getSubNodeNames() {
return array('var', 'name', 'args');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class BitwiseNot extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Include_ extends Expr
{
const TYPE_INCLUDE = 1;
const TYPE_INCLUDE_ONCE = 2;
const TYPE_REQUIRE = 3;
const TYPE_REQUIRE_ONCE = 4;


public $expr;

public $type;








public function __construct(Expr $expr, $type, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
$this->type = $type;
}

public function getSubNodeNames() {
return array('expr', 'type');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node;
use PhpParser\Node\Expr;

class New_ extends Expr
{

public $class;

public $args;








public function __construct($class, array $args = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->args = $args;
}

public function getSubNodeNames() {
return array('class', 'args');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Assign extends Expr
{

public $var;

public $expr;








public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('var', 'expr');
}
}
<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class Mod extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class ShiftLeft extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class Minus extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class Div extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class Mul extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class BitwiseXor extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class Pow extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class BitwiseAnd extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class ShiftRight extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class Plus extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class Concat extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr\AssignOp;

use PhpParser\Node\Expr\AssignOp;

class BitwiseOr extends AssignOp
{
}<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class UnaryMinus extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Clone_ extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class PreDec extends Expr
{

public $var;







public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}

public function getSubNodeNames() {
return array('var');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Isset_ extends Expr
{

public $vars;







public function __construct(array $vars, array $attributes = array()) {
parent::__construct($attributes);
$this->vars = $vars;
}

public function getSubNodeNames() {
return array('vars');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Yield_ extends Expr
{

public $key;

public $value;








public function __construct(Expr $value = null, Expr $key = null, array $attributes = array()) {
parent::__construct($attributes);
$this->key = $key;
$this->value = $value;
}

public function getSubNodeNames() {
return array('key', 'value');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class PostDec extends Expr
{

public $var;







public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}

public function getSubNodeNames() {
return array('var');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Empty_ extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class ArrayDimFetch extends Expr
{

public $var;

public $dim;








public function __construct(Expr $var, Expr $dim = null, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->dim = $dim;
}

public function getSubNodeNames() {
return array('var', 'dim');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class ArrayItem extends Expr
{

public $key;

public $value;

public $byRef;









public function __construct(Expr $value, Expr $key = null, $byRef = false, array $attributes = array()) {
parent::__construct($attributes);
$this->key = $key;
$this->value = $value;
$this->byRef = $byRef;
}

public function getSubNodeNames() {
return array('key', 'value', 'byRef');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class UnaryPlus extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class ErrorSuppress extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class AssignRef extends Expr
{

public $var;

public $expr;








public function __construct(Expr $var, Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('var', 'expr');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class Print_ extends Expr
{

public $expr;







public function __construct(Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Expr\Cast;

use PhpParser\Node\Expr\Cast;

class Object_ extends Cast
{
}
<?php

namespace PhpParser\Node\Expr\Cast;

use PhpParser\Node\Expr\Cast;

class Unset_ extends Cast
{
}<?php

namespace PhpParser\Node\Expr\Cast;

use PhpParser\Node\Expr\Cast;

class Array_ extends Cast
{
}<?php

namespace PhpParser\Node\Expr\Cast;

use PhpParser\Node\Expr\Cast;

class String_ extends Cast
{
}
<?php

namespace PhpParser\Node\Expr\Cast;

use PhpParser\Node\Expr\Cast;

class Double extends Cast
{
}
<?php

namespace PhpParser\Node\Expr\Cast;

use PhpParser\Node\Expr\Cast;

class Bool_ extends Cast
{
}
<?php

namespace PhpParser\Node\Expr\Cast;

use PhpParser\Node\Expr\Cast;

class Int_ extends Cast
{
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;

class PreInc extends Expr
{

public $var;







public function __construct(Expr $var, array $attributes = array()) {
parent::__construct($attributes);
$this->var = $var;
}

public function getSubNodeNames() {
return array('var');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;
use PhpParser\Node\Name;

class ConstFetch extends Expr
{

public $name;







public function __construct(Name $name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}

public function getSubNodeNames() {
return array('name');
}
}
<?php

namespace PhpParser\Node\Expr;

use PhpParser\Node\Expr;
use PhpParser\Node\Name;

class ClassConstFetch extends Expr
{

public $class;

public $name;








public function __construct($class, $name, array $attributes = array()) {
parent::__construct($attributes);
$this->class = $class;
$this->name = $name;
}

public function getSubNodeNames() {
return array('class', 'name');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node\Stmt;

class Label extends Stmt
{

public $name;







public function __construct($name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}

public function getSubNodeNames() {
return array('name');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Else_ extends Node\Stmt
{

public $stmts;







public function __construct(array $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;


class TraitUse extends Node\Stmt
{

public $traits;

public $adaptations;








public function __construct(array $traits, array $adaptations = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->traits = $traits;
$this->adaptations = $adaptations;
}

public function getSubNodeNames() {
return array('traits', 'adaptations');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class For_ extends Node\Stmt
{

public $init;

public $cond;

public $loop;

public $stmts;











public function __construct(array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->init = isset($subNodes['init']) ? $subNodes['init'] : array();
$this->cond = isset($subNodes['cond']) ? $subNodes['cond'] : array();
$this->loop = isset($subNodes['loop']) ? $subNodes['loop'] : array();
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
}

public function getSubNodeNames() {
return array('init', 'cond', 'loop', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Do_ extends Node\Stmt
{

public $cond;

public $stmts;








public function __construct(Node\Expr $cond, array $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->cond = $cond;
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('cond', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Switch_ extends Node\Stmt
{

public $cond;

public $cases;








public function __construct(Node\Expr $cond, array $cases, array $attributes = array()) {
parent::__construct($attributes);
$this->cond = $cond;
$this->cases = $cases;
}

public function getSubNodeNames() {
return array('cond', 'cases');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;


class Nop extends Node\Stmt
{
public function getSubNodeNames() {
return array();
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Unset_ extends Node\Stmt
{

public $vars;







public function __construct(array $vars, array $attributes = array()) {
parent::__construct($attributes);
$this->vars = $vars;
}

public function getSubNodeNames() {
return array('vars');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node\Stmt;

class Goto_ extends Stmt
{

public $name;







public function __construct($name, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
}

public function getSubNodeNames() {
return array('name');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Case_ extends Node\Stmt
{

public $cond;

public $stmts;








public function __construct($cond, array $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->cond = $cond;
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('cond', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class ClassConst extends Node\Stmt
{

public $flags;

public $consts;








public function __construct(array $consts, $flags = 0, array $attributes = array()) {
parent::__construct($attributes);
$this->flags = $flags;
$this->consts = $consts;
}

public function getSubNodeNames() {
return array('flags', 'consts');
}

public function isPublic() {
return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
|| ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
}

public function isProtected() {
return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
}

public function isPrivate() {
return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
}

public function isStatic() {
return (bool) ($this->flags & Class_::MODIFIER_STATIC);
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Catch_ extends Node\Stmt
{

public $types;

public $var;

public $stmts;









public function __construct(array $types, $var, array $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->types = $types;
$this->var = $var;
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('types', 'var', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class StaticVar extends Node\Stmt
{

public $name;

public $default;








public function __construct($name, Node\Expr $default = null, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->default = $default;
}

public function getSubNodeNames() {
return array('name', 'default');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Const_ extends Node\Stmt
{

public $consts;







public function __construct(array $consts, array $attributes = array()) {
parent::__construct($attributes);
$this->consts = $consts;
}

public function getSubNodeNames() {
return array('consts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node\Stmt;

class Use_ extends Stmt
{





const TYPE_UNKNOWN = 0;

const TYPE_NORMAL = 1;

const TYPE_FUNCTION = 2;

const TYPE_CONSTANT = 3;


public $type;

public $uses;








public function __construct(array $uses, $type = self::TYPE_NORMAL, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
$this->uses = $uses;
}

public function getSubNodeNames() {
return array('type', 'uses');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Return_ extends Node\Stmt
{

public $expr;







public function __construct(Node\Expr $expr = null, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Foreach_ extends Node\Stmt
{

public $expr;

public $keyVar;

public $byRef;

public $valueVar;

public $stmts;












public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
$this->keyVar = isset($subNodes['keyVar']) ? $subNodes['keyVar'] : null;
$this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;
$this->valueVar = $valueVar;
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
}

public function getSubNodeNames() {
return array('expr', 'keyVar', 'byRef', 'valueVar', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Interface_ extends ClassLike
{

public $extends;










public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : array();
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
}

public function getSubNodeNames() {
return array('name', 'extends', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

abstract class ClassLike extends Node\Stmt {

public $name;

public $stmts;






public function getMethods() {
$methods = array();
foreach ($this->stmts as $stmt) {
if ($stmt instanceof ClassMethod) {
$methods[] = $stmt;
}
}
return $methods;
}








public function getMethod($name) {
$lowerName = strtolower($name);
foreach ($this->stmts as $stmt) {
if ($stmt instanceof ClassMethod && $lowerName === strtolower($stmt->name)) {
return $stmt;
}
}
return null;
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class ElseIf_ extends Node\Stmt
{

public $cond;

public $stmts;








public function __construct(Node\Expr $cond, array $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->cond = $cond;
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('cond', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node\Name;
use PhpParser\Node\Stmt;

class GroupUse extends Stmt
{

public $type;

public $prefix;

public $uses;









public function __construct(Name $prefix, array $uses, $type = Use_::TYPE_NORMAL, array $attributes = array()) {
parent::__construct($attributes);
$this->type = $type;
$this->prefix = $prefix;
$this->uses = $uses;
}

public function getSubNodeNames() {
return array('type', 'prefix', 'uses');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Finally_ extends Node\Stmt
{

public $stmts;







public function __construct(array $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Echo_ extends Node\Stmt
{

public $exprs;







public function __construct(array $exprs, array $attributes = array()) {
parent::__construct($attributes);
$this->exprs = $exprs;
}

public function getSubNodeNames() {
return array('exprs');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;
use PhpParser\Node\FunctionLike;

class ClassMethod extends Node\Stmt implements FunctionLike
{

public $flags;

public $byRef;

public $name;

public $params;

public $returnType;

public $stmts;


public $type;













public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->flags = isset($subNodes['flags']) ? $subNodes['flags']
: (isset($subNodes['type']) ? $subNodes['type'] : 0);
$this->type = $this->flags;
$this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;
$this->name = $name;
$this->params = isset($subNodes['params']) ? $subNodes['params'] : array();
$this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null;
$this->stmts = array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : array();
}

public function getSubNodeNames() {
return array('flags', 'byRef', 'name', 'params', 'returnType', 'stmts');
}

public function returnsByRef() {
return $this->byRef;
}

public function getParams() {
return $this->params;
}

public function getReturnType() {
return $this->returnType;
}

public function getStmts() {
return $this->stmts;
}

public function isPublic() {
return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
|| ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
}

public function isProtected() {
return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
}

public function isPrivate() {
return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
}

public function isAbstract() {
return (bool) ($this->flags & Class_::MODIFIER_ABSTRACT);
}

public function isFinal() {
return (bool) ($this->flags & Class_::MODIFIER_FINAL);
}

public function isStatic() {
return (bool) ($this->flags & Class_::MODIFIER_STATIC);
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class DeclareDeclare extends Node\Stmt
{

public $key;

public $value;








public function __construct($key, Node\Expr $value, array $attributes = array()) {
parent::__construct($attributes);
$this->key = $key;
$this->value = $value;
}

public function getSubNodeNames() {
return array('key', 'value');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Error;
use PhpParser\Node;

class Class_ extends ClassLike
{
const MODIFIER_PUBLIC = 1;
const MODIFIER_PROTECTED = 2;
const MODIFIER_PRIVATE = 4;
const MODIFIER_STATIC = 8;
const MODIFIER_ABSTRACT = 16;
const MODIFIER_FINAL = 32;

const VISIBILITY_MODIFIER_MASK = 7; 
 
const VISIBILITY_MODIFER_MASK = self::VISIBILITY_MODIFIER_MASK;


public $flags;

public $extends;

public $implements;


public $type;

protected static $specialNames = array(
'self' => true,
'parent' => true,
'static' => true,
);












public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->flags = isset($subNodes['flags']) ? $subNodes['flags']
: (isset($subNodes['type']) ? $subNodes['type'] : 0);
$this->type = $this->flags;
$this->name = $name;
$this->extends = isset($subNodes['extends']) ? $subNodes['extends'] : null;
$this->implements = isset($subNodes['implements']) ? $subNodes['implements'] : array();
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
}

public function getSubNodeNames() {
return array('flags', 'name', 'extends', 'implements', 'stmts');
}

public function isAbstract() {
return (bool) ($this->flags & self::MODIFIER_ABSTRACT);
}

public function isFinal() {
return (bool) ($this->flags & self::MODIFIER_FINAL);
}

public function isAnonymous() {
return null === $this->name;
}




public static function verifyModifier($a, $b) {
if ($a & self::VISIBILITY_MODIFIER_MASK && $b & self::VISIBILITY_MODIFIER_MASK) {
throw new Error('Multiple access type modifiers are not allowed');
}

if ($a & self::MODIFIER_ABSTRACT && $b & self::MODIFIER_ABSTRACT) {
throw new Error('Multiple abstract modifiers are not allowed');
}

if ($a & self::MODIFIER_STATIC && $b & self::MODIFIER_STATIC) {
throw new Error('Multiple static modifiers are not allowed');
}

if ($a & self::MODIFIER_FINAL && $b & self::MODIFIER_FINAL) {
throw new Error('Multiple final modifiers are not allowed');
}

if ($a & 48 && $b & 48) {
throw new Error('Cannot use the final modifier on an abstract class member');
}
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Declare_ extends Node\Stmt
{

public $declares;

public $stmts;








public function __construct(array $declares, array $stmts = null, array $attributes = array()) {
parent::__construct($attributes);
$this->declares = $declares;
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('declares', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Throw_ extends Node\Stmt
{

public $expr;







public function __construct(Node\Expr $expr, array $attributes = array()) {
parent::__construct($attributes);
$this->expr = $expr;
}

public function getSubNodeNames() {
return array('expr');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node\Stmt;

class HaltCompiler extends Stmt
{

public $remaining;







public function __construct($remaining, array $attributes = array()) {
parent::__construct($attributes);
$this->remaining = $remaining;
}

public function getSubNodeNames() {
return array('remaining');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Trait_ extends ClassLike
{








public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
}

public function getSubNodeNames() {
return array('name', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class UseUse extends Node\Stmt
{

public $type;

public $name;

public $alias;









public function __construct(Node\Name $name, $alias = null, $type = Use_::TYPE_UNKNOWN, array $attributes = array()) {
if (null === $alias) {
$alias = $name->getLast();
}

parent::__construct($attributes);
$this->type = $type;
$this->name = $name;
$this->alias = $alias;
}

public function getSubNodeNames() {
return array('type', 'name', 'alias');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class PropertyProperty extends Node\Stmt
{

public $name;

public $default;








public function __construct($name, Node\Expr $default = null, array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->default = $default;
}

public function getSubNodeNames() {
return array('name', 'default');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Continue_ extends Node\Stmt
{

public $num;







public function __construct(Node\Expr $num = null, array $attributes = array()) {
parent::__construct($attributes);
$this->num = $num;
}

public function getSubNodeNames() {
return array('num');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node\Stmt;

class InlineHTML extends Stmt
{

public $value;







public function __construct($value, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
}

public function getSubNodeNames() {
return array('value');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

abstract class TraitUseAdaptation extends Node\Stmt
{

public $trait;

public $method;
}
<?php

namespace PhpParser\Node\Stmt\TraitUseAdaptation;

use PhpParser\Node;

class Precedence extends Node\Stmt\TraitUseAdaptation
{

public $insteadof;









public function __construct(Node\Name $trait, $method, array $insteadof, array $attributes = array()) {
parent::__construct($attributes);
$this->trait = $trait;
$this->method = $method;
$this->insteadof = $insteadof;
}

public function getSubNodeNames() {
return array('trait', 'method', 'insteadof');
}
}
<?php

namespace PhpParser\Node\Stmt\TraitUseAdaptation;

use PhpParser\Node;

class Alias extends Node\Stmt\TraitUseAdaptation
{

public $newModifier;

public $newName;










public function __construct($trait, $method, $newModifier, $newName, array $attributes = array()) {
parent::__construct($attributes);
$this->trait = $trait;
$this->method = $method;
$this->newModifier = $newModifier;
$this->newName = $newName;
}

public function getSubNodeNames() {
return array('trait', 'method', 'newModifier', 'newName');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;
use PhpParser\Node\FunctionLike;

class Function_ extends Node\Stmt implements FunctionLike
{

public $byRef;

public $name;

public $params;

public $returnType;

public $stmts;












public function __construct($name, array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false;
$this->name = $name;
$this->params = isset($subNodes['params']) ? $subNodes['params'] : array();
$this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null;
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
}

public function getSubNodeNames() {
return array('byRef', 'name', 'params', 'returnType', 'stmts');
}

public function returnsByRef() {
return $this->byRef;
}

public function getParams() {
return $this->params;
}

public function getReturnType() {
return $this->returnType;
}

public function getStmts() {
return $this->stmts;
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class If_ extends Node\Stmt
{

public $cond;

public $stmts;

public $elseifs;

public $else;











public function __construct(Node\Expr $cond, array $subNodes = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->cond = $cond;
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : array();
$this->elseifs = isset($subNodes['elseifs']) ? $subNodes['elseifs'] : array();
$this->else = isset($subNodes['else']) ? $subNodes['else'] : null;
}

public function getSubNodeNames() {
return array('cond', 'stmts', 'elseifs', 'else');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Global_ extends Node\Stmt
{

public $vars;







public function __construct(array $vars, array $attributes = array()) {
parent::__construct($attributes);
$this->vars = $vars;
}

public function getSubNodeNames() {
return array('vars');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Namespace_ extends Node\Stmt
{

const KIND_SEMICOLON = 1;
const KIND_BRACED = 2;


public $name;

public $stmts;








public function __construct(Node\Name $name = null, $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('name', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Property extends Node\Stmt
{

public $flags;

public $props;


public $type;








public function __construct($flags, array $props, array $attributes = array()) {
parent::__construct($attributes);
$this->flags = $flags;
$this->type = $flags;
$this->props = $props;
}

public function getSubNodeNames() {
return array('flags', 'props');
}

public function isPublic() {
return ($this->flags & Class_::MODIFIER_PUBLIC) !== 0
|| ($this->flags & Class_::VISIBILITY_MODIFIER_MASK) === 0;
}

public function isProtected() {
return (bool) ($this->flags & Class_::MODIFIER_PROTECTED);
}

public function isPrivate() {
return (bool) ($this->flags & Class_::MODIFIER_PRIVATE);
}

public function isStatic() {
return (bool) ($this->flags & Class_::MODIFIER_STATIC);
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class While_ extends Node\Stmt
{

public $cond;

public $stmts;








public function __construct(Node\Expr $cond, array $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->cond = $cond;
$this->stmts = $stmts;
}

public function getSubNodeNames() {
return array('cond', 'stmts');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class TryCatch extends Node\Stmt
{

public $stmts;

public $catches;

public $finally;









public function __construct(array $stmts, array $catches, Finally_ $finally = null, array $attributes = array()) {
parent::__construct($attributes);
$this->stmts = $stmts;
$this->catches = $catches;
$this->finally = $finally;
}

public function getSubNodeNames() {
return array('stmts', 'catches', 'finally');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node\Stmt;

class Static_ extends Stmt
{

public $vars;







public function __construct(array $vars, array $attributes = array()) {
parent::__construct($attributes);
$this->vars = $vars;
}

public function getSubNodeNames() {
return array('vars');
}
}
<?php

namespace PhpParser\Node\Stmt;

use PhpParser\Node;

class Break_ extends Node\Stmt
{

public $num;







public function __construct(Node\Expr $num = null, array $attributes = array()) {
parent::__construct($attributes);
$this->num = $num;
}

public function getSubNodeNames() {
return array('num');
}
}
<?php

namespace PhpParser\Node;

use PhpParser\NodeAbstract;

class Arg extends NodeAbstract
{

public $value;

public $byRef;

public $unpack;









public function __construct(Expr $value, $byRef = false, $unpack = false, array $attributes = array()) {
parent::__construct($attributes);
$this->value = $value;
$this->byRef = $byRef;
$this->unpack = $unpack;
}

public function getSubNodeNames() {
return array('value', 'byRef', 'unpack');
}
}
<?php

namespace PhpParser\Node;

use PhpParser\NodeAbstract;

abstract class Expr extends NodeAbstract
{
}<?php

namespace PhpParser\Node\Name;

class FullyQualified extends \PhpParser\Node\Name
{





public function isUnqualified() {
return false;
}






public function isQualified() {
return false;
}






public function isFullyQualified() {
return true;
}






public function isRelative() {
return false;
}
}<?php

namespace PhpParser\Node\Name;

class Relative extends \PhpParser\Node\Name
{





public function isUnqualified() {
return false;
}






public function isQualified() {
return false;
}






public function isFullyQualified() {
return false;
}






public function isRelative() {
return true;
}
}<?php

namespace PhpParser\Node;

abstract class Scalar extends Expr
{
}<?php

namespace PhpParser;





use PhpParser\Node\Name;
use PhpParser\Node\Param;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassConst;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Interface_;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\TryCatch;
use PhpParser\Node\Stmt\UseUse;

abstract class ParserAbstract implements Parser
{
const SYMBOL_NONE = -1;






protected $tokenToSymbolMapSize;

protected $actionTableSize;

protected $gotoTableSize;


protected $invalidSymbol;

protected $errorSymbol;

protected $defaultAction;

protected $unexpectedTokenRule;

protected $YY2TBLSTATE;
protected $YYNLSTATES;


protected $tokenToSymbol;

protected $symbolToName;

protected $productions;




protected $actionBase;

protected $action;


protected $actionCheck;

protected $actionDefault;



protected $gotoBase;

protected $goto;


protected $gotoCheck;

protected $gotoDefault;



protected $ruleToNonTerminal;


protected $ruleToLength;






protected $lexer;

protected $semValue;

protected $stackPos;

protected $semStack;

protected $startAttributeStack;

protected $endAttributeStack;

protected $endAttributes;

protected $lookaheadStartAttributes;


protected $errorHandler;

protected $errors;

protected $errorState;







public function __construct(Lexer $lexer, array $options = array()) {
$this->lexer = $lexer;
$this->errors = array();

if (isset($options['throwOnError'])) {
throw new \LogicException(
'"throwOnError" is no longer supported, use "errorHandler" instead');
}
}














public function parse($code, ErrorHandler $errorHandler = null) {
$this->errorHandler = $errorHandler ?: new ErrorHandler\Throwing;


 $this->lexer->startLexing($code, $this->errorHandler);


 $symbol = self::SYMBOL_NONE;


 
 
 $startAttributes = '*POISON';
$endAttributes = '*POISON';
$this->endAttributes = $endAttributes;


 $this->startAttributeStack = array();
$this->endAttributeStack = array($endAttributes);


 $state = 0;
$stateStack = array($state);


 $this->semStack = array();


 $this->stackPos = 0;

$this->errorState = 0;

for (;;) {


if ($this->actionBase[$state] == 0) {
$rule = $this->actionDefault[$state];
} else {
if ($symbol === self::SYMBOL_NONE) {

 
 
 
 $tokenId = $this->lexer->getNextToken($tokenValue, $startAttributes, $endAttributes);


 $symbol = $tokenId >= 0 && $tokenId < $this->tokenToSymbolMapSize
? $this->tokenToSymbol[$tokenId]
: $this->invalidSymbol;

if ($symbol === $this->invalidSymbol) {
throw new \RangeException(sprintf(
'The lexer returned an invalid token (id=%d, value=%s)',
$tokenId, $tokenValue
));
}


 
 $this->startAttributeStack[$this->stackPos+1] = $startAttributes;
$this->endAttributeStack[$this->stackPos+1] = $endAttributes;
$this->lookaheadStartAttributes = $startAttributes;


 }

$idx = $this->actionBase[$state] + $symbol;
if ((($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] == $symbol)
|| ($state < $this->YY2TBLSTATE
&& ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $symbol) >= 0
&& $idx < $this->actionTableSize && $this->actionCheck[$idx] == $symbol))
&& ($action = $this->action[$idx]) != $this->defaultAction) {







if ($action > 0) {



++$this->stackPos;
$stateStack[$this->stackPos] = $state = $action;
$this->semStack[$this->stackPos] = $tokenValue;
$this->startAttributeStack[$this->stackPos] = $startAttributes;
$this->endAttributeStack[$this->stackPos] = $endAttributes;
$this->endAttributes = $endAttributes;
$symbol = self::SYMBOL_NONE;

if ($this->errorState) {
--$this->errorState;
}

if ($action < $this->YYNLSTATES) {
continue;
}


$rule = $action - $this->YYNLSTATES;
} else {
$rule = -$action;
}
} else {
$rule = $this->actionDefault[$state];
}
}

for (;;) {
if ($rule === 0) {


 return $this->semValue;
} elseif ($rule !== $this->unexpectedTokenRule) {



try {
$this->{'reduceRule' . $rule}();
} catch (Error $e) {
if (-1 === $e->getStartLine() && isset($startAttributes['startLine'])) {
$e->setStartLine($startAttributes['startLine']);
}

$this->emitError($e);

 return null;
}


$lastEndAttributes = $this->endAttributeStack[$this->stackPos];
$this->stackPos -= $this->ruleToLength[$rule];
$nonTerminal = $this->ruleToNonTerminal[$rule];
$idx = $this->gotoBase[$nonTerminal] + $stateStack[$this->stackPos];
if ($idx >= 0 && $idx < $this->gotoTableSize && $this->gotoCheck[$idx] == $nonTerminal) {
$state = $this->goto[$idx];
} else {
$state = $this->gotoDefault[$nonTerminal];
}

++$this->stackPos;
$stateStack[$this->stackPos] = $state;
$this->semStack[$this->stackPos] = $this->semValue;
$this->endAttributeStack[$this->stackPos] = $lastEndAttributes;
} else {

switch ($this->errorState) {
case 0:
$msg = $this->getErrorMessage($symbol, $state);
$this->emitError(new Error($msg, $startAttributes + $endAttributes));

 case 1:
case 2:
$this->errorState = 3;


 while (!(
(($idx = $this->actionBase[$state] + $this->errorSymbol) >= 0
&& $idx < $this->actionTableSize && $this->actionCheck[$idx] == $this->errorSymbol)
|| ($state < $this->YY2TBLSTATE
&& ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $this->errorSymbol) >= 0
&& $idx < $this->actionTableSize && $this->actionCheck[$idx] == $this->errorSymbol)
) || ($action = $this->action[$idx]) == $this->defaultAction) { 
 if ($this->stackPos <= 0) {

 return null;
}
$state = $stateStack[--$this->stackPos];

 }


 ++$this->stackPos;
$stateStack[$this->stackPos] = $state = $action;


 
 $this->endAttributeStack[$this->stackPos] = $this->endAttributeStack[$this->stackPos - 1];
$this->endAttributes = $this->endAttributeStack[$this->stackPos - 1];
break;

case 3:
if ($symbol === 0) {

 return null;
}


 $symbol = self::SYMBOL_NONE;
break 2;
}
}

if ($state < $this->YYNLSTATES) {
break;
}


$rule = $state - $this->YYNLSTATES;
}
}

throw new \RuntimeException('Reached end of parser loop');
}

protected function emitError(Error $error) {
$this->errorHandler->handleError($error);
}

protected function getErrorMessage($symbol, $state) {
$expectedString = '';
if ($expected = $this->getExpectedTokens($state)) {
$expectedString = ', expecting ' . implode(' or ', $expected);
}

return 'Syntax error, unexpected ' . $this->symbolToName[$symbol] . $expectedString;
}

protected function getExpectedTokens($state) {
$expected = array();

$base = $this->actionBase[$state];
foreach ($this->symbolToName as $symbol => $name) {
$idx = $base + $symbol;
if ($idx >= 0 && $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol
|| $state < $this->YY2TBLSTATE
&& ($idx = $this->actionBase[$state + $this->YYNLSTATES] + $symbol) >= 0
&& $idx < $this->actionTableSize && $this->actionCheck[$idx] === $symbol
) {
if ($this->action[$idx] != $this->unexpectedTokenRule
&& $this->action[$idx] != $this->defaultAction
&& $symbol != $this->errorSymbol
) {
if (count($expected) == 4) {

return array();
}

$expected[] = $name;
}
}
}

return $expected;
}














































protected function handleNamespaces(array $stmts) {
$hasErrored = false;
$style = $this->getNamespacingStyle($stmts);
if (null === $style) {

 return $stmts;
} elseif ('brace' === $style) {

 $afterFirstNamespace = false;
foreach ($stmts as $stmt) {
if ($stmt instanceof Node\Stmt\Namespace_) {
$afterFirstNamespace = true;
} elseif (!$stmt instanceof Node\Stmt\HaltCompiler
&& !$stmt instanceof Node\Stmt\Nop
&& $afterFirstNamespace && !$hasErrored) {
$this->emitError(new Error(
'No code may exist outside of namespace {}', $stmt->getAttributes()));
$hasErrored = true; 
 }
}
return $stmts;
} else {

 $resultStmts = array();
$targetStmts =& $resultStmts;
foreach ($stmts as $stmt) {
if ($stmt instanceof Node\Stmt\Namespace_) {
if ($stmt->stmts === null) {
$stmt->stmts = array();
$targetStmts =& $stmt->stmts;
$resultStmts[] = $stmt;
} else {

 $resultStmts[] = $stmt;
$targetStmts =& $resultStmts;
}
} elseif ($stmt instanceof Node\Stmt\HaltCompiler) {

 $resultStmts[] = $stmt;
} else {
$targetStmts[] = $stmt;
}
}
return $resultStmts;
}
}

private function getNamespacingStyle(array $stmts) {
$style = null;
$hasNotAllowedStmts = false;
foreach ($stmts as $i => $stmt) {
if ($stmt instanceof Node\Stmt\Namespace_) {
$currentStyle = null === $stmt->stmts ? 'semicolon' : 'brace';
if (null === $style) {
$style = $currentStyle;
if ($hasNotAllowedStmts) {
$this->emitError(new Error(
'Namespace declaration statement has to be the very first statement in the script',
$stmt->getLine() 
 ));
}
} elseif ($style !== $currentStyle) {
$this->emitError(new Error(
'Cannot mix bracketed namespace declarations with unbracketed namespace declarations',
$stmt->getLine() 
 ));

 return 'semicolon';
}
continue;
}


if ($stmt instanceof Node\Stmt\Declare_
|| $stmt instanceof Node\Stmt\HaltCompiler
|| $stmt instanceof Node\Stmt\Nop) {
continue;
}


if ($i == 0 && $stmt instanceof Node\Stmt\InlineHTML && preg_match('/\A#!.*\r?\n\z/', $stmt->value)) {
continue;
}


$hasNotAllowedStmts = true;
}
return $style;
}

protected function handleBuiltinTypes(Name $name) {
$scalarTypes = [
'bool' => true,
'int' => true,
'float' => true,
'string' => true,
'iterable' => true,
'void' => true,
'object' => true,
];

if (!$name->isUnqualified()) {
return $name;
}

$lowerName = strtolower($name->toString());
return isset($scalarTypes[$lowerName]) ? $lowerName : $name;
}

protected static $specialNames = array(
'self' => true,
'parent' => true,
'static' => true,
);

protected function getAttributesAt($pos) {
return $this->startAttributeStack[$pos] + $this->endAttributeStack[$pos];
}

protected function parseLNumber($str, $attributes, $allowInvalidOctal = false) {
try {
return LNumber::fromString($str, $attributes, $allowInvalidOctal);
} catch (Error $error) {
$this->emitError($error);

 return new LNumber(0, $attributes);
}
}

protected function parseNumString($str, $attributes) {
if (!preg_match('/^(?:0|-?[1-9][0-9]*)$/', $str)) {
return new String_($str, $attributes);
}

$num = +$str;
if (!is_int($num)) {
return new String_($str, $attributes);
}

return new LNumber($num, $attributes);
}

protected function checkModifier($a, $b, $modifierPos) {

 try {
Class_::verifyModifier($a, $b);
} catch (Error $error) {
$error->setAttributes($this->getAttributesAt($modifierPos));
$this->emitError($error);
}
}

protected function checkParam(Param $node) {
if ($node->variadic && null !== $node->default) {
$this->emitError(new Error(
'Variadic parameter cannot have a default value',
$node->default->getAttributes()
));
}
}

protected function checkTryCatch(TryCatch $node) {
if (empty($node->catches) && null === $node->finally) {
$this->emitError(new Error(
'Cannot use try without catch or finally', $node->getAttributes()
));
}
}

protected function checkNamespace(Namespace_ $node) {
if (isset(self::$specialNames[strtolower($node->name)])) {
$this->emitError(new Error(
sprintf('Cannot use \'%s\' as namespace name', $node->name),
$node->name->getAttributes()
));
}

if (null !== $node->stmts) {
foreach ($node->stmts as $stmt) {
if ($stmt instanceof Namespace_) {
$this->emitError(new Error(
'Namespace declarations cannot be nested', $stmt->getAttributes()
));
}
}
}
}

protected function checkClass(Class_ $node, $namePos) {
if (null !== $node->name && isset(self::$specialNames[strtolower($node->name)])) {
$this->emitError(new Error(
sprintf('Cannot use \'%s\' as class name as it is reserved', $node->name),
$this->getAttributesAt($namePos)
));
}

if (isset(self::$specialNames[strtolower($node->extends)])) {
$this->emitError(new Error(
sprintf('Cannot use \'%s\' as class name as it is reserved', $node->extends),
$node->extends->getAttributes()
));
}

foreach ($node->implements as $interface) {
if (isset(self::$specialNames[strtolower($interface)])) {
$this->emitError(new Error(
sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface),
$interface->getAttributes()
));
}
}
}

protected function checkInterface(Interface_ $node, $namePos) {
if (null !== $node->name && isset(self::$specialNames[strtolower($node->name)])) {
$this->emitError(new Error(
sprintf('Cannot use \'%s\' as class name as it is reserved', $node->name),
$this->getAttributesAt($namePos)
));
}

foreach ($node->extends as $interface) {
if (isset(self::$specialNames[strtolower($interface)])) {
$this->emitError(new Error(
sprintf('Cannot use \'%s\' as interface name as it is reserved', $interface),
$interface->getAttributes()
));
}
}
}

protected function checkClassMethod(ClassMethod $node, $modifierPos) {
if ($node->flags & Class_::MODIFIER_STATIC) {
switch (strtolower($node->name)) {
case '__construct':
$this->emitError(new Error(
sprintf('Constructor %s() cannot be static', $node->name),
$this->getAttributesAt($modifierPos)));
break;
case '__destruct':
$this->emitError(new Error(
sprintf('Destructor %s() cannot be static', $node->name),
$this->getAttributesAt($modifierPos)));
break;
case '__clone':
$this->emitError(new Error(
sprintf('Clone method %s() cannot be static', $node->name),
$this->getAttributesAt($modifierPos)));
break;
}
}
}

protected function checkClassConst(ClassConst $node, $modifierPos) {
if ($node->flags & Class_::MODIFIER_STATIC) {
$this->emitError(new Error(
"Cannot use 'static' as constant modifier",
$this->getAttributesAt($modifierPos)));
}
if ($node->flags & Class_::MODIFIER_ABSTRACT) {
$this->emitError(new Error(
"Cannot use 'abstract' as constant modifier",
$this->getAttributesAt($modifierPos)));
}
if ($node->flags & Class_::MODIFIER_FINAL) {
$this->emitError(new Error(
"Cannot use 'final' as constant modifier",
$this->getAttributesAt($modifierPos)));
}
}

protected function checkProperty(Property $node, $modifierPos) {
if ($node->flags & Class_::MODIFIER_ABSTRACT) {
$this->emitError(new Error('Properties cannot be declared abstract',
$this->getAttributesAt($modifierPos)));
}

if ($node->flags & Class_::MODIFIER_FINAL) {
$this->emitError(new Error('Properties cannot be declared final',
$this->getAttributesAt($modifierPos)));
}
}

protected function checkUseUse(UseUse $node, $namePos) {
if ('self' == strtolower($node->alias) || 'parent' == strtolower($node->alias)) {
$this->emitError(new Error(
sprintf(
'Cannot use %s as %s because \'%2$s\' is a special class name',
$node->name, $node->alias
),
$this->getAttributesAt($namePos)
));
}
}
}
<?php

namespace PhpParser;

use PhpParser\Node\Expr;
use PhpParser\Node\Stmt;

abstract class PrettyPrinterAbstract
{
protected $precedenceMap = array(

 'Expr_BinaryOp_Pow' => array( 0, 1),
'Expr_BitwiseNot' => array( 10, 1),
'Expr_PreInc' => array( 10, 1),
'Expr_PreDec' => array( 10, 1),
'Expr_PostInc' => array( 10, -1),
'Expr_PostDec' => array( 10, -1),
'Expr_UnaryPlus' => array( 10, 1),
'Expr_UnaryMinus' => array( 10, 1),
'Expr_Cast_Int' => array( 10, 1),
'Expr_Cast_Double' => array( 10, 1),
'Expr_Cast_String' => array( 10, 1),
'Expr_Cast_Array' => array( 10, 1),
'Expr_Cast_Object' => array( 10, 1),
'Expr_Cast_Bool' => array( 10, 1),
'Expr_Cast_Unset' => array( 10, 1),
'Expr_ErrorSuppress' => array( 10, 1),
'Expr_Instanceof' => array( 20, 0),
'Expr_BooleanNot' => array( 30, 1),
'Expr_BinaryOp_Mul' => array( 40, -1),
'Expr_BinaryOp_Div' => array( 40, -1),
'Expr_BinaryOp_Mod' => array( 40, -1),
'Expr_BinaryOp_Plus' => array( 50, -1),
'Expr_BinaryOp_Minus' => array( 50, -1),
'Expr_BinaryOp_Concat' => array( 50, -1),
'Expr_BinaryOp_ShiftLeft' => array( 60, -1),
'Expr_BinaryOp_ShiftRight' => array( 60, -1),
'Expr_BinaryOp_Smaller' => array( 70, 0),
'Expr_BinaryOp_SmallerOrEqual' => array( 70, 0),
'Expr_BinaryOp_Greater' => array( 70, 0),
'Expr_BinaryOp_GreaterOrEqual' => array( 70, 0),
'Expr_BinaryOp_Equal' => array( 80, 0),
'Expr_BinaryOp_NotEqual' => array( 80, 0),
'Expr_BinaryOp_Identical' => array( 80, 0),
'Expr_BinaryOp_NotIdentical' => array( 80, 0),
'Expr_BinaryOp_Spaceship' => array( 80, 0),
'Expr_BinaryOp_BitwiseAnd' => array( 90, -1),
'Expr_BinaryOp_BitwiseXor' => array(100, -1),
'Expr_BinaryOp_BitwiseOr' => array(110, -1),
'Expr_BinaryOp_BooleanAnd' => array(120, -1),
'Expr_BinaryOp_BooleanOr' => array(130, -1),
'Expr_BinaryOp_Coalesce' => array(140, 1),
'Expr_Ternary' => array(150, -1),

 'Expr_Assign' => array(160, 1),
'Expr_AssignRef' => array(160, 1),
'Expr_AssignOp_Plus' => array(160, 1),
'Expr_AssignOp_Minus' => array(160, 1),
'Expr_AssignOp_Mul' => array(160, 1),
'Expr_AssignOp_Div' => array(160, 1),
'Expr_AssignOp_Concat' => array(160, 1),
'Expr_AssignOp_Mod' => array(160, 1),
'Expr_AssignOp_BitwiseAnd' => array(160, 1),
'Expr_AssignOp_BitwiseOr' => array(160, 1),
'Expr_AssignOp_BitwiseXor' => array(160, 1),
'Expr_AssignOp_ShiftLeft' => array(160, 1),
'Expr_AssignOp_ShiftRight' => array(160, 1),
'Expr_AssignOp_Pow' => array(160, 1),
'Expr_YieldFrom' => array(165, 1),
'Expr_Print' => array(168, 1),
'Expr_BinaryOp_LogicalAnd' => array(170, -1),
'Expr_BinaryOp_LogicalXor' => array(180, -1),
'Expr_BinaryOp_LogicalOr' => array(190, -1),
'Expr_Include' => array(200, -1),
);

protected $noIndentToken;
protected $docStringEndToken;
protected $canUseSemicolonNamespaces;
protected $options;










public function __construct(array $options = []) {
$this->noIndentToken = '_NO_INDENT_' . mt_rand();
$this->docStringEndToken = '_DOC_STRING_END_' . mt_rand();

$defaultOptions = ['shortArraySyntax' => false];
$this->options = $options + $defaultOptions;
}








public function prettyPrint(array $stmts) {
$this->preprocessNodes($stmts);

return ltrim($this->handleMagicTokens($this->pStmts($stmts, false)));
}








public function prettyPrintExpr(Expr $node) {
return $this->handleMagicTokens($this->p($node));
}








public function prettyPrintFile(array $stmts) {
if (!$stmts) {
return "<?php\n\n";
}

$p = "<?php\n\n" . $this->prettyPrint($stmts);

if ($stmts[0] instanceof Stmt\InlineHTML) {
$p = preg_replace('/^<\?php\s+\?>\n?/', '', $p);
}
if ($stmts[count($stmts) - 1] instanceof Stmt\InlineHTML) {
$p = preg_replace('/<\?php$/', '', rtrim($p));
}

return $p;
}






protected function preprocessNodes(array $nodes) {

$this->canUseSemicolonNamespaces = true;
foreach ($nodes as $node) {
if ($node instanceof Stmt\Namespace_ && null === $node->name) {
$this->canUseSemicolonNamespaces = false;
}
}
}

protected function handleMagicTokens($str) {

 $str = str_replace($this->noIndentToken, '', $str);


 $str = str_replace($this->docStringEndToken . ";\n", ";\n", $str);
$str = str_replace($this->docStringEndToken, "\n", $str);

return $str;
}









protected function pStmts(array $nodes, $indent = true) {
$result = '';
foreach ($nodes as $node) {
$comments = $node->getAttribute('comments', array());
if ($comments) {
$result .= "\n" . $this->pComments($comments);
if ($node instanceof Stmt\Nop) {
continue;
}
}

$result .= "\n" . $this->p($node) . ($node instanceof Expr ? ';' : '');
}

if ($indent) {
return preg_replace('~\n(?!$|' . $this->noIndentToken . ')~', "\n    ", $result);
} else {
return $result;
}
}








protected function p(Node $node) {
return $this->{'p' . $node->getType()}($node);
}

protected function pInfixOp($type, Node $leftNode, $operatorString, Node $rightNode) {
list($precedence, $associativity) = $this->precedenceMap[$type];

return $this->pPrec($leftNode, $precedence, $associativity, -1)
. $operatorString
. $this->pPrec($rightNode, $precedence, $associativity, 1);
}

protected function pPrefixOp($type, $operatorString, Node $node) {
list($precedence, $associativity) = $this->precedenceMap[$type];
return $operatorString . $this->pPrec($node, $precedence, $associativity, 1);
}

protected function pPostfixOp($type, Node $node, $operatorString) {
list($precedence, $associativity) = $this->precedenceMap[$type];
return $this->pPrec($node, $precedence, $associativity, -1) . $operatorString;
}













protected function pPrec(Node $node, $parentPrecedence, $parentAssociativity, $childPosition) {
$type = $node->getType();
if (isset($this->precedenceMap[$type])) {
$childPrecedence = $this->precedenceMap[$type][0];
if ($childPrecedence > $parentPrecedence
|| ($parentPrecedence == $childPrecedence && $parentAssociativity != $childPosition)
) {
return '(' . $this->p($node) . ')';
}
}

return $this->p($node);
}









protected function pImplode(array $nodes, $glue = '') {
$pNodes = array();
foreach ($nodes as $node) {
if (null === $node) {
$pNodes[] = '';
} else {
$pNodes[] = $this->p($node);
}
}

return implode($glue, $pNodes);
}








protected function pCommaSeparated(array $nodes) {
return $this->pImplode($nodes, ', ');
}











protected function pCommaSeparatedMultiline(array $nodes, $trailingComma) {
$result = '';
$lastIdx = count($nodes) - 1;
foreach ($nodes as $idx => $node) {
if ($node !== null) {
$comments = $node->getAttribute('comments', array());
if ($comments) {
$result .= "\n" . $this->pComments($comments);
}

$result .= "\n" . $this->p($node);
} else {
$result .= "\n";
}
if ($trailingComma || $idx !== $lastIdx) {
$result .= ',';
}
}

return preg_replace('~\n(?!$|' . $this->noIndentToken . ')~', "\n    ", $result);
}








protected function pNoIndent($string) {
return str_replace("\n", "\n" . $this->noIndentToken, $string);
}








protected function pComments(array $comments) {
$formattedComments = [];

foreach ($comments as $comment) {
$formattedComments[] = $comment->getReformattedText();
}

return implode("\n", $formattedComments);
}
}
<?php

namespace PhpParser;




interface Serializer
{







public function serialize(array $nodes);
}<?php

namespace PhpParser;

interface Parser {










public function parse($code, ErrorHandler $errorHandler = null);
}
<?php

namespace PhpParser;

use PhpParser\Builder;
use PhpParser\Node\Stmt\Use_;












class BuilderFactory
{







protected function _namespace($name) {
return new Builder\Namespace_($name);
}








protected function _class($name) {
return new Builder\Class_($name);
}








protected function _interface($name) {
return new Builder\Interface_($name);
}








protected function _trait($name) {
return new Builder\Trait_($name);
}








public function method($name) {
return new Builder\Method($name);
}








public function param($name) {
return new Builder\Param($name);
}








public function property($name) {
return new Builder\Property($name);
}








protected function _function($name) {
return new Builder\Function_($name);
}








protected function _use($name) {
return new Builder\Use_($name, Use_::TYPE_NORMAL);
}

public function __call($name, array $args) {
if (method_exists($this, '_' . $name)) {
return call_user_func_array(array($this, '_' . $name), $args);
}

throw new \LogicException(sprintf('Method "%s" does not exist', $name));
}
}
<?php

namespace PhpParser;

class ParserFactory {
const PREFER_PHP7 = 1;
const PREFER_PHP5 = 2;
const ONLY_PHP7 = 3;
const ONLY_PHP5 = 4;










public function create($kind, Lexer $lexer = null, array $parserOptions = array()) {
if (null === $lexer) {
$lexer = new Lexer\Emulative();
}
switch ($kind) {
case self::PREFER_PHP7:
return new Parser\Multiple([
new Parser\Php7($lexer, $parserOptions), new Parser\Php5($lexer, $parserOptions)
]);
case self::PREFER_PHP5:
return new Parser\Multiple([
new Parser\Php5($lexer, $parserOptions), new Parser\Php7($lexer, $parserOptions)
]);
case self::ONLY_PHP7:
return new Parser\Php7($lexer, $parserOptions);
case self::ONLY_PHP5:
return new Parser\Php5($lexer, $parserOptions);
default:
throw new \LogicException(
'Kind must be one of ::PREFER_PHP7, ::PREFER_PHP5, ::ONLY_PHP7 or ::ONLY_PHP5'
);
}
}
}
<?php

namespace PhpParser\NodeVisitor;

use PhpParser\Error;
use PhpParser\ErrorHandler;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt;
use PhpParser\NodeVisitorAbstract;

class NameResolver extends NodeVisitorAbstract
{

protected $namespace;


protected $aliases;


protected $errorHandler;


protected $preserveOriginalNames;










public function __construct(ErrorHandler $errorHandler = null, array $options = []) {
$this->errorHandler = $errorHandler ?: new ErrorHandler\Throwing;
$this->preserveOriginalNames = !empty($options['preserveOriginalNames']);
}

public function beforeTraverse(array $nodes) {
$this->resetState();
}

public function enterNode(Node $node) {
if ($node instanceof Stmt\Namespace_) {
$this->resetState($node->name);
} elseif ($node instanceof Stmt\Use_) {
foreach ($node->uses as $use) {
$this->addAlias($use, $node->type, null);
}
} elseif ($node instanceof Stmt\GroupUse) {
foreach ($node->uses as $use) {
$this->addAlias($use, $node->type, $node->prefix);
}
} elseif ($node instanceof Stmt\Class_) {
if (null !== $node->extends) {
$node->extends = $this->resolveClassName($node->extends);
}

foreach ($node->implements as &$interface) {
$interface = $this->resolveClassName($interface);
}

if (null !== $node->name) {
$this->addNamespacedName($node);
}
} elseif ($node instanceof Stmt\Interface_) {
foreach ($node->extends as &$interface) {
$interface = $this->resolveClassName($interface);
}

$this->addNamespacedName($node);
} elseif ($node instanceof Stmt\Trait_) {
$this->addNamespacedName($node);
} elseif ($node instanceof Stmt\Function_) {
$this->addNamespacedName($node);
$this->resolveSignature($node);
} elseif ($node instanceof Stmt\ClassMethod
|| $node instanceof Expr\Closure
) {
$this->resolveSignature($node);
} elseif ($node instanceof Stmt\Const_) {
foreach ($node->consts as $const) {
$this->addNamespacedName($const);
}
} elseif ($node instanceof Expr\StaticCall
|| $node instanceof Expr\StaticPropertyFetch
|| $node instanceof Expr\ClassConstFetch
|| $node instanceof Expr\New_
|| $node instanceof Expr\Instanceof_
) {
if ($node->class instanceof Name) {
$node->class = $this->resolveClassName($node->class);
}
} elseif ($node instanceof Stmt\Catch_) {
foreach ($node->types as &$type) {
$type = $this->resolveClassName($type);
}
} elseif ($node instanceof Expr\FuncCall) {
if ($node->name instanceof Name) {
$node->name = $this->resolveOtherName($node->name, Stmt\Use_::TYPE_FUNCTION);
}
} elseif ($node instanceof Expr\ConstFetch) {
$node->name = $this->resolveOtherName($node->name, Stmt\Use_::TYPE_CONSTANT);
} elseif ($node instanceof Stmt\TraitUse) {
foreach ($node->traits as &$trait) {
$trait = $this->resolveClassName($trait);
}

foreach ($node->adaptations as $adaptation) {
if (null !== $adaptation->trait) {
$adaptation->trait = $this->resolveClassName($adaptation->trait);
}

if ($adaptation instanceof Stmt\TraitUseAdaptation\Precedence) {
foreach ($adaptation->insteadof as &$insteadof) {
$insteadof = $this->resolveClassName($insteadof);
}
}
}
}
}

protected function resetState(Name $namespace = null) {
$this->namespace = $namespace;
$this->aliases = array(
Stmt\Use_::TYPE_NORMAL => array(),
Stmt\Use_::TYPE_FUNCTION => array(),
Stmt\Use_::TYPE_CONSTANT => array(),
);
}

protected function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) {

 $name = $prefix ? Name::concat($prefix, $use->name) : $use->name;

 $type |= $use->type;


 if ($type === Stmt\Use_::TYPE_CONSTANT) {
$aliasName = $use->alias;
} else {
$aliasName = strtolower($use->alias);
}

if (isset($this->aliases[$type][$aliasName])) {
$typeStringMap = array(
Stmt\Use_::TYPE_NORMAL => '',
Stmt\Use_::TYPE_FUNCTION => 'function ',
Stmt\Use_::TYPE_CONSTANT => 'const ',
);

$this->errorHandler->handleError(new Error(
sprintf(
'Cannot use %s%s as %s because the name is already in use',
$typeStringMap[$type], $name, $use->alias
),
$use->getAttributes()
));
return;
}

$this->aliases[$type][$aliasName] = $name;
}


private function resolveSignature($node) {
foreach ($node->params as $param) {
$param->type = $this->resolveType($param->type);
}
$node->returnType = $this->resolveType($node->returnType);
}

private function resolveType($node) {
if ($node instanceof Node\NullableType) {
$node->type = $this->resolveType($node->type);
return $node;
}
if ($node instanceof Name) {
return $this->resolveClassName($node);
}
return $node;
}

protected function resolveClassName(Name $name) {
if ($this->preserveOriginalNames) {

 $originalName = $name;
$name = clone $originalName;
$name->setAttribute('originalName', $originalName);
}


 if (in_array(strtolower($name->toString()), array('self', 'parent', 'static'))) {
if (!$name->isUnqualified()) {
$this->errorHandler->handleError(new Error(
sprintf("'\\%s' is an invalid class name", $name->toString()),
$name->getAttributes()
));
}
return $name;
}


 if ($name->isFullyQualified()) {
return $name;
}

$aliasName = strtolower($name->getFirst());
if (!$name->isRelative() && isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName])) {

 $alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName];
return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes());
}


 return FullyQualified::concat($this->namespace, $name, $name->getAttributes());
}

protected function resolveOtherName(Name $name, $type) {
if ($this->preserveOriginalNames) {

 $originalName = $name;
$name = clone $originalName;
$name->setAttribute('originalName', $originalName);
}


 if ($name->isFullyQualified()) {
return $name;
}


 $aliasName = strtolower($name->getFirst());
if ($name->isQualified() && isset($this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName])) {
$alias = $this->aliases[Stmt\Use_::TYPE_NORMAL][$aliasName];
return FullyQualified::concat($alias, $name->slice(1), $name->getAttributes());
}

if ($name->isUnqualified()) {
if ($type === Stmt\Use_::TYPE_CONSTANT) {

 $aliasName = $name->getFirst();
}

if (isset($this->aliases[$type][$aliasName])) {

 return new FullyQualified($this->aliases[$type][$aliasName], $name->getAttributes());
}

if (null === $this->namespace) {

 return new FullyQualified($name, $name->getAttributes());
}


 
 $name->setAttribute('namespacedName',
FullyQualified::concat($this->namespace, $name, $name->getAttributes()));
return $name;
}


 return FullyQualified::concat($this->namespace, $name, $name->getAttributes());
}

protected function addNamespacedName(Node $node) {
$node->namespacedName = Name::concat($this->namespace, $node->name);
}
}
<?php

namespace PhpParser;




class Autoloader
{

private static $registered = false;






static public function register($prepend = false) {
if (self::$registered === true) {
return;
}

spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
self::$registered = true;
}






static public function autoload($class) {
if (0 === strpos($class, 'PhpParser\\')) {
$fileName = __DIR__ . strtr(substr($class, 9), '\\', '/') . '.php';
if (file_exists($fileName)) {
require $fileName;
}
}
}
}
<?php

namespace PhpParser;

use PhpParser\Comment;
use PhpParser\Node\Expr;
use PhpParser\Node\Name;
use PhpParser\Node\NullableType;
use PhpParser\Node\Scalar;
use PhpParser\Node\Stmt;

abstract class BuilderAbstract implements Builder {







protected function normalizeNode($node) {
if ($node instanceof Builder) {
return $node->getNode();
} elseif ($node instanceof Node) {
return $node;
}

throw new \LogicException('Expected node or builder object');
}








protected function normalizeName($name) {
if ($name instanceof Name) {
return $name;
} elseif (is_string($name)) {
if (!$name) {
throw new \LogicException('Name cannot be empty');
}

if ($name[0] == '\\') {
return new Name\FullyQualified(substr($name, 1));
} elseif (0 === strpos($name, 'namespace\\')) {
return new Name\Relative(substr($name, strlen('namespace\\')));
} else {
return new Name($name);
}
}

throw new \LogicException('Name must be a string or an instance of PhpParser\Node\Name');
}











protected function normalizeType($type) {
if (!is_string($type)) {
if (!$type instanceof Name && !$type instanceof NullableType) {
throw new \LogicException(
'Type must be a string, or an instance of Name or NullableType');
}
return $type;
}

$nullable = false;
if (strlen($type) > 0 && $type[0] === '?') {
$nullable = true;
$type = substr($type, 1);
}

$builtinTypes = array(
'array', 'callable', 'string', 'int', 'float', 'bool', 'iterable', 'void', 'object'
);

$lowerType = strtolower($type);
if (in_array($lowerType, $builtinTypes)) {
$type = $lowerType;
} else {
$type = $this->normalizeName($type);
}

if ($nullable && $type === 'void') {
throw new \LogicException('void type cannot be nullable');
}

return $nullable ? new Node\NullableType($type) : $type;
}









protected function normalizeValue($value) {
if ($value instanceof Node) {
return $value;
} elseif (is_null($value)) {
return new Expr\ConstFetch(
new Name('null')
);
} elseif (is_bool($value)) {
return new Expr\ConstFetch(
new Name($value ? 'true' : 'false')
);
} elseif (is_int($value)) {
return new Scalar\LNumber($value);
} elseif (is_float($value)) {
return new Scalar\DNumber($value);
} elseif (is_string($value)) {
return new Scalar\String_($value);
} elseif (is_array($value)) {
$items = array();
$lastKey = -1;
foreach ($value as $itemKey => $itemValue) {

 if (null !== $lastKey && ++$lastKey === $itemKey) {
$items[] = new Expr\ArrayItem(
$this->normalizeValue($itemValue)
);
} else {
$lastKey = null;
$items[] = new Expr\ArrayItem(
$this->normalizeValue($itemValue),
$this->normalizeValue($itemKey)
);
}
}

return new Expr\Array_($items);
} else {
throw new \LogicException('Invalid value');
}
}








protected function normalizeDocComment($docComment) {
if ($docComment instanceof Comment\Doc) {
return $docComment;
} else if (is_string($docComment)) {
return new Comment\Doc($docComment);
} else {
throw new \LogicException('Doc comment must be a string or an instance of PhpParser\Comment\Doc');
}
}






protected function setModifier($modifier) {
Stmt\Class_::verifyModifier($this->flags, $modifier);
$this->flags |= $modifier;
}
}
<?php

namespace PhpParser;

interface NodeTraverserInterface
{





function addVisitor(NodeVisitor $visitor);






function removeVisitor(NodeVisitor $visitor);








function traverse(array $nodes);
}

<?php

namespace PhpParser\Comment;

class Doc extends \PhpParser\Comment
{
}<?php

namespace PhpParser\Builder;

use PhpParser\BuilderAbstract;
use PhpParser\Node;
use PhpParser\Node\Stmt;




class Use_ extends BuilderAbstract {
protected $name;
protected $type;
protected $alias = null;







public function __construct($name, $type) {
$this->name = $this->normalizeName($name);
$this->type = $type;
}








protected function as_($alias) {
$this->alias = $alias;
return $this;
}
public function __call($name, $args) {
if (method_exists($this, $name . '_')) {
return call_user_func_array(array($this, $name . '_'), $args);
}

throw new \LogicException(sprintf('Method "%s" does not exist', $name));
}






public function getNode() {
$alias = null !== $this->alias ? $this->alias : $this->name->getLast();
return new Stmt\Use_(array(
new Stmt\UseUse($this->name, $alias)
), $this->type);
}
}
<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node;
use PhpParser\Node\Stmt;

class Method extends FunctionLike
{
protected $name;
protected $flags = 0;


protected $stmts = array();






public function __construct($name) {
$this->name = $name;
}






public function makePublic() {
$this->setModifier(Stmt\Class_::MODIFIER_PUBLIC);

return $this;
}






public function makeProtected() {
$this->setModifier(Stmt\Class_::MODIFIER_PROTECTED);

return $this;
}






public function makePrivate() {
$this->setModifier(Stmt\Class_::MODIFIER_PRIVATE);

return $this;
}






public function makeStatic() {
$this->setModifier(Stmt\Class_::MODIFIER_STATIC);

return $this;
}






public function makeAbstract() {
if (!empty($this->stmts)) {
throw new \LogicException('Cannot make method with statements abstract');
}

$this->setModifier(Stmt\Class_::MODIFIER_ABSTRACT);
$this->stmts = null; 

return $this;
}






public function makeFinal() {
$this->setModifier(Stmt\Class_::MODIFIER_FINAL);

return $this;
}








public function addStmt($stmt) {
if (null === $this->stmts) {
throw new \LogicException('Cannot add statements to an abstract method');
}

$this->stmts[] = $this->normalizeNode($stmt);

return $this;
}






public function getNode() {
return new Stmt\ClassMethod($this->name, array(
'flags' => $this->flags,
'byRef' => $this->returnByRef,
'params' => $this->params,
'returnType' => $this->returnType,
'stmts' => $this->stmts,
), $this->attributes);
}
}
<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node;

class Param extends PhpParser\BuilderAbstract
{
protected $name;

protected $default = null;


protected $type = null;

protected $byRef = false;

protected $variadic = false;






public function __construct($name) {
$this->name = $name;
}








public function setDefault($value) {
$this->default = $this->normalizeValue($value);

return $this;
}








public function setTypeHint($type) {
$this->type = $this->normalizeType($type);
if ($this->type === 'void') {
throw new \LogicException('Parameter type cannot be void');
}

return $this;
}






public function makeByRef() {
$this->byRef = true;

return $this;
}






public function makeVariadic() {
$this->variadic = true;

return $this;
}






public function getNode() {
return new Node\Param(
$this->name, $this->default, $this->type, $this->byRef, $this->variadic
);
}
}
<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt;

class Interface_ extends Declaration
{
protected $name;
protected $extends = array();
protected $constants = array();
protected $methods = array();






public function __construct($name) {
$this->name = $name;
}








public function extend() {
foreach (func_get_args() as $interface) {
$this->extends[] = $this->normalizeName($interface);
}

return $this;
}








public function addStmt($stmt) {
$stmt = $this->normalizeNode($stmt);

$type = $stmt->getType();
switch ($type) {
case 'Stmt_ClassConst':
$this->constants[] = $stmt;
break;

case 'Stmt_ClassMethod':

 $stmt->stmts = null;
$this->methods[] = $stmt;
break;

default:
throw new \LogicException(sprintf('Unexpected node of type "%s"', $type));
}

return $this;
}






public function getNode() {
return new Stmt\Interface_($this->name, array(
'extends' => $this->extends,
'stmts' => array_merge($this->constants, $this->methods),
), $this->attributes);
}
}<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt;

class Class_ extends Declaration
{
protected $name;

protected $extends = null;
protected $implements = array();
protected $flags = 0;

protected $uses = array();
protected $constants = array();
protected $properties = array();
protected $methods = array();






public function __construct($name) {
$this->name = $name;
}








public function extend($class) {
$this->extends = $this->normalizeName($class);

return $this;
}








public function implement() {
foreach (func_get_args() as $interface) {
$this->implements[] = $this->normalizeName($interface);
}

return $this;
}






public function makeAbstract() {
$this->setModifier(Stmt\Class_::MODIFIER_ABSTRACT);

return $this;
}






public function makeFinal() {
$this->setModifier(Stmt\Class_::MODIFIER_FINAL);

return $this;
}








public function addStmt($stmt) {
$stmt = $this->normalizeNode($stmt);

$targets = array(
'Stmt_TraitUse' => &$this->uses,
'Stmt_ClassConst' => &$this->constants,
'Stmt_Property' => &$this->properties,
'Stmt_ClassMethod' => &$this->methods,
);

$type = $stmt->getType();
if (!isset($targets[$type])) {
throw new \LogicException(sprintf('Unexpected node of type "%s"', $type));
}

$targets[$type][] = $stmt;

return $this;
}






public function getNode() {
return new Stmt\Class_($this->name, array(
'flags' => $this->flags,
'extends' => $this->extends,
'implements' => $this->implements,
'stmts' => array_merge($this->uses, $this->constants, $this->properties, $this->methods),
), $this->attributes);
}
}<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node;

abstract class FunctionLike extends Declaration
{
protected $returnByRef = false;
protected $params = array();


protected $returnType = null;






public function makeReturnByRef() {
$this->returnByRef = true;

return $this;
}








public function addParam($param) {
$param = $this->normalizeNode($param);

if (!$param instanceof Node\Param) {
throw new \LogicException(sprintf('Expected parameter node, got "%s"', $param->getType()));
}

$this->params[] = $param;

return $this;
}








public function addParams(array $params) {
foreach ($params as $param) {
$this->addParam($param);
}

return $this;
}









public function setReturnType($type)
{
$this->returnType = $this->normalizeType($type);

return $this;
}
}
<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node\Stmt;

class Trait_ extends Declaration
{
protected $name;
protected $uses = array();
protected $properties = array();
protected $methods = array();






public function __construct($name) {
$this->name = $name;
}








public function addStmt($stmt) {
$stmt = $this->normalizeNode($stmt);

if ($stmt instanceof Stmt\Property) {
$this->properties[] = $stmt;
} else if ($stmt instanceof Stmt\ClassMethod) {
$this->methods[] = $stmt;
} else if ($stmt instanceof Stmt\TraitUse) {
$this->uses[] = $stmt;
} else {
throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
}

return $this;
}






public function getNode() {
return new Stmt\Trait_(
$this->name, array(
'stmts' => array_merge($this->uses, $this->properties, $this->methods)
), $this->attributes
);
}
}
<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node;
use PhpParser\Node\Stmt;

class Function_ extends FunctionLike
{
protected $name;
protected $stmts = array();






public function __construct($name) {
$this->name = $name;
}








public function addStmt($stmt) {
$this->stmts[] = $this->normalizeNode($stmt);

return $this;
}






public function getNode() {
return new Stmt\Function_($this->name, array(
'byRef' => $this->returnByRef,
'params' => $this->params,
'returnType' => $this->returnType,
'stmts' => $this->stmts,
), $this->attributes);
}
}
<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node;
use PhpParser\Node\Stmt;

class Namespace_ extends Declaration
{
private $name;
private $stmts = array();






public function __construct($name) {
$this->name = null !== $name ? $this->normalizeName($name) : null;
}








public function addStmt($stmt) {
$this->stmts[] = $this->normalizeNode($stmt);

return $this;
}






public function getNode() {
return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes);
}
}
<?php

namespace PhpParser\Builder;

use PhpParser;
use PhpParser\Node\Stmt;

class Property extends PhpParser\BuilderAbstract
{
protected $name;

protected $flags = 0;
protected $default = null;
protected $attributes = array();






public function __construct($name) {
$this->name = $name;
}






public function makePublic() {
$this->setModifier(Stmt\Class_::MODIFIER_PUBLIC);

return $this;
}






public function makeProtected() {
$this->setModifier(Stmt\Class_::MODIFIER_PROTECTED);

return $this;
}






public function makePrivate() {
$this->setModifier(Stmt\Class_::MODIFIER_PRIVATE);

return $this;
}






public function makeStatic() {
$this->setModifier(Stmt\Class_::MODIFIER_STATIC);

return $this;
}








public function setDefault($value) {
$this->default = $this->normalizeValue($value);

return $this;
}








public function setDocComment($docComment) {
$this->attributes = array(
'comments' => array($this->normalizeDocComment($docComment))
);

return $this;
}






public function getNode() {
return new Stmt\Property(
$this->flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC,
array(
new Stmt\PropertyProperty($this->name, $this->default)
),
$this->attributes
);
}
}<?php

namespace PhpParser\Builder;

use PhpParser;

abstract class Declaration extends PhpParser\BuilderAbstract
{
protected $attributes = array();

abstract public function addStmt($stmt);








public function addStmts(array $stmts) {
foreach ($stmts as $stmt) {
$this->addStmt($stmt);
}

return $this;
}








public function setDocComment($docComment) {
$this->attributes['comments'] = array(
$this->normalizeDocComment($docComment)
);

return $this;
}
}<?php

namespace PhpParser;




interface Unserializer
{







public function unserialize($string);
}
<?php

namespace PhpParser;

interface NodeVisitor
{











public function beforeTraverse(array $nodes);


















public function enterNode(Node $node);




















public function leaveNode(Node $node);












public function afterTraverse(array $nodes);
}<?php

namespace PhpParser;

use PhpParser\Node\Expr\Include_;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\GroupUse;
use PhpParser\Node\Stmt\Use_;
use PhpParser\Node\Stmt\UseUse;

class NodeDumper
{
private $dumpComments;
private $dumpPositions;
private $code;











public function __construct(array $options = []) {
$this->dumpComments = !empty($options['dumpComments']);
$this->dumpPositions = !empty($options['dumpPositions']);
}











public function dump($node, $code = null) {
$this->code = $code;
return $this->dumpRecursive($node);
}

protected function dumpRecursive($node) {
if ($node instanceof Node) {
$r = $node->getType();
if ($this->dumpPositions && null !== $p = $this->dumpPosition($node)) {
$r .= $p;
}
$r .= '(';

foreach ($node->getSubNodeNames() as $key) {
$r .= "\n    " . $key . ': ';

$value = $node->$key;
if (null === $value) {
$r .= 'null';
} elseif (false === $value) {
$r .= 'false';
} elseif (true === $value) {
$r .= 'true';
} elseif (is_scalar($value)) {
if ('flags' === $key || 'newModifier' === $key) {
$r .= $this->dumpFlags($value);
} else if ('type' === $key && $node instanceof Include_) {
$r .= $this->dumpIncludeType($value);
} else if ('type' === $key
&& ($node instanceof Use_ || $node instanceof UseUse || $node instanceof GroupUse)) {
$r .= $this->dumpUseType($value);
} else {
$r .= $value;
}
} else {
$r .= str_replace("\n", "\n    ", $this->dumpRecursive($value));
}
}

if ($this->dumpComments && $comments = $node->getAttribute('comments')) {
$r .= "\n    comments: " . str_replace("\n", "\n    ", $this->dumpRecursive($comments));
}
} elseif (is_array($node)) {
$r = 'array(';

foreach ($node as $key => $value) {
$r .= "\n    " . $key . ': ';

if (null === $value) {
$r .= 'null';
} elseif (false === $value) {
$r .= 'false';
} elseif (true === $value) {
$r .= 'true';
} elseif (is_scalar($value)) {
$r .= $value;
} else {
$r .= str_replace("\n", "\n    ", $this->dumpRecursive($value));
}
}
} elseif ($node instanceof Comment) {
return $node->getReformattedText();
} else {
throw new \InvalidArgumentException('Can only dump nodes and arrays.');
}

return $r . "\n)";
}

protected function dumpFlags($flags) {
$strs = [];
if ($flags & Class_::MODIFIER_PUBLIC) {
$strs[] = 'MODIFIER_PUBLIC';
}
if ($flags & Class_::MODIFIER_PROTECTED) {
$strs[] = 'MODIFIER_PROTECTED';
}
if ($flags & Class_::MODIFIER_PRIVATE) {
$strs[] = 'MODIFIER_PRIVATE';
}
if ($flags & Class_::MODIFIER_ABSTRACT) {
$strs[] = 'MODIFIER_ABSTRACT';
}
if ($flags & Class_::MODIFIER_STATIC) {
$strs[] = 'MODIFIER_STATIC';
}
if ($flags & Class_::MODIFIER_FINAL) {
$strs[] = 'MODIFIER_FINAL';
}

if ($strs) {
return implode(' | ', $strs) . ' (' . $flags . ')';
} else {
return $flags;
}
}

protected function dumpIncludeType($type) {
$map = [
Include_::TYPE_INCLUDE => 'TYPE_INCLUDE',
Include_::TYPE_INCLUDE_ONCE => 'TYPE_INCLUDE_ONCE',
Include_::TYPE_REQUIRE => 'TYPE_REQUIRE',
Include_::TYPE_REQUIRE_ONCE => 'TYPE_REQURE_ONCE',
];

if (!isset($map[$type])) {
return $type;
}
return $map[$type] . ' (' . $type . ')';
}

protected function dumpUseType($type) {
$map = [
Use_::TYPE_UNKNOWN => 'TYPE_UNKNOWN',
Use_::TYPE_NORMAL => 'TYPE_NORMAL',
Use_::TYPE_FUNCTION => 'TYPE_FUNCTION',
Use_::TYPE_CONSTANT => 'TYPE_CONSTANT',
];

if (!isset($map[$type])) {
return $type;
}
return $map[$type] . ' (' . $type . ')';
}

protected function dumpPosition(Node $node) {
if (!$node->hasAttribute('startLine') || !$node->hasAttribute('endLine')) {
return null;
}

$start = $node->getAttribute('startLine');
$end = $node->getAttribute('endLine');
if ($node->hasAttribute('startFilePos') && $node->hasAttribute('endFilePos')
&& null !== $this->code
) {
$start .= ':' . $this->toColumn($this->code, $node->getAttribute('startFilePos'));
$end .= ':' . $this->toColumn($this->code, $node->getAttribute('endFilePos'));
}
return "[$start - $end]";
}


 private function toColumn($code, $pos) {
if ($pos > strlen($code)) {
throw new \RuntimeException('Invalid position information');
}

$lineStartPos = strrpos($code, "\n", $pos - strlen($code));
if (false === $lineStartPos) {
$lineStartPos = -1;
}

return $pos - $lineStartPos;
}
}
<?php

error_reporting(E_ALL | E_STRICT);
ini_set('short_open_tag', false);

if ('cli' !== php_sapi_name()) {
die('This script is designed for running on the command line.');
}

function showHelp($error) {
die($error . "\n\n" .
<<<OUTPUT
This script has to be called with the following signature:

    php run.php [--no-progress] testType pathToTestFiles

The test type must be one of: PHP5, PHP7 or Symfony.

The following options are available:

    --no-progress    Disables showing which file is currently tested.

OUTPUT
);
}

$options = array();
$arguments = array();


array_shift($argv);

foreach ($argv as $arg) {
if ('-' === $arg[0]) {
$options[] = $arg;
} else {
$arguments[] = $arg;
}
}

if (count($arguments) !== 2) {
showHelp('Too little arguments passed!');
}

$showProgress = true;
$verbose = false;
foreach ($options as $option) {
if ($option === '--no-progress') {
$showProgress = false;
} elseif ($option === '--verbose') {
$verbose = true;
} else {
showHelp('Invalid option passed!');
}
}

$testType = $arguments[0];
$dir = $arguments[1];

switch ($testType) {
case 'Symfony':
$version = 'Php5';
$fileFilter = function($path) {
return preg_match('~\.php(?:\.cache)?$~', $path) && false === strpos($path, 'skeleton');
};
$codeExtractor = function($file, $code) {
return $code;
};
break;
case 'PHP5':
case 'PHP7':
$version = $testType === 'PHP5' ? 'Php5' : 'Php7';
$fileFilter = function($path) {
return preg_match('~\.phpt$~', $path);
};
$codeExtractor = function($file, $code) {
if (preg_match('~(?:
# skeleton files
  ext.gmp.tests.001
| ext.skeleton.tests.001
# multibyte encoded files
| ext.mbstring.tests.zend_multibyte-01
| Zend.tests.multibyte.multibyte_encoding_001
| Zend.tests.multibyte.multibyte_encoding_004
| Zend.tests.multibyte.multibyte_encoding_005
# pretty print difference due to INF vs 1e1000
| ext.standard.tests.general_functions.bug27678
| tests.lang.bug24640
# pretty print differences due to negative LNumbers
| Zend.tests.neg_num_string
| Zend.tests.bug72918
# pretty print difference due to nop statements
| ext.mbstring.tests.htmlent
| ext.standard.tests.file.fread_basic
)\.phpt$~x', $file)) {
return null;
}

if (!preg_match('~--FILE--\s*(.*?)--[A-Z]+--~s', $code, $matches)) {
return null;
}
if (preg_match('~--EXPECT(?:F|REGEX)?--\s*(?:Parse|Fatal) error~', $code)) {
return null;
}

return $matches[1];
};
break;
default:
showHelp('Test type must be one of: PHP5, PHP7 or Symfony');
}

require_once dirname(__FILE__) . '/../lib/PhpParser/Autoloader.php';
PhpParser\Autoloader::register();

$parserName = 'PhpParser\Parser\\' . $version;
$parser = new $parserName(new PhpParser\Lexer\Emulative);
$prettyPrinter = new PhpParser\PrettyPrinter\Standard;
$nodeDumper = new PhpParser\NodeDumper;

$parseFail = $ppFail = $compareFail = $count = 0;

$readTime = $parseTime = $ppTime = $reparseTime = $compareTime = 0;
$totalStartTime = microtime(true);

foreach (new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dir),
RecursiveIteratorIterator::LEAVES_ONLY)
as $file) {
if (!$fileFilter($file)) {
continue;
}

$startTime = microtime(true);
$code = file_get_contents($file);
$readTime += microtime(true) - $startTime;

if (null === $code = $codeExtractor($file, $code)) {
continue;
}

set_time_limit(10);

++$count;

if ($showProgress) {
echo substr(str_pad('Testing file ' . $count . ': ' . substr($file, strlen($dir)), 79), 0, 79), "\r";
}

try {
$startTime = microtime(true);
$stmts = $parser->parse($code);
$parseTime += microtime(true) - $startTime;

$startTime = microtime(true);
$code = '<?php' . "\n" . $prettyPrinter->prettyPrint($stmts);
$ppTime += microtime(true) - $startTime;

try {
$startTime = microtime(true);
$ppStmts = $parser->parse($code);
$reparseTime += microtime(true) - $startTime;

$startTime = microtime(true);
$same = $nodeDumper->dump($stmts) == $nodeDumper->dump($ppStmts);
$compareTime += microtime(true) - $startTime;

if (!$same) {
echo $file, ":\n    Result of initial parse and parse after pretty print differ\n";
if ($verbose) {
echo "Pretty printer output:\n=====\n$code\n=====\n\n";
}

++$compareFail;
}
} catch (PhpParser\Error $e) {
echo $file, ":\n    Parse of pretty print failed with message: {$e->getMessage()}\n";
if ($verbose) {
echo "Pretty printer output:\n=====\n$code\n=====\n\n";
}

++$ppFail;
}
} catch (PhpParser\Error $e) {
echo $file, ":\n    Parse failed with message: {$e->getMessage()}\n";

++$parseFail;
}
}

if (0 === $parseFail && 0 === $ppFail && 0 === $compareFail) {
$exit = 0;
echo "\n\n", 'All tests passed.', "\n";
} else {
$exit = 1;
echo "\n\n", '==========', "\n\n", 'There were: ', "\n";
if (0 !== $parseFail) {
echo '    ', $parseFail, ' parse failures.', "\n";
}
if (0 !== $ppFail) {
echo '    ', $ppFail, ' pretty print failures.', "\n";
}
if (0 !== $compareFail) {
echo '    ', $compareFail, ' compare failures.', "\n";
}
}

echo "\n",
'Tested files:         ', $count, "\n",
"\n",
'Reading files took:   ', $readTime, "\n",
'Parsing took:         ', $parseTime, "\n",
'Pretty printing took: ', $ppTime, "\n",
'Reparsing took:       ', $reparseTime, "\n",
'Comparing took:       ', $compareTime, "\n",
"\n",
'Total time:           ', microtime(true) - $totalStartTime, "\n",
'Maximum memory usage: ', memory_get_peak_usage(true), "\n";

exit($exit);
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

final class Printer
{
    private $styles = array('reset' => "\33[0m", 'red' => "\33[31m", 'green' => "\33[32m", 'yellow' => "\33[33m", 'title' => "\33[33m", 'error' => "\33[37;41m", 'success' => "\33[30;42m");
    private $verbosity;
    private $supportColors;
    private $width;
    public function __construct($verbosity, $supportColors, $width = null)
    {
        if (null === $width) {
            $terminal = new \HumbugBox384\KevinGH\RequirementChecker\Terminal();
            $width = \min($terminal->getWidth(), 80);
        }
        $this->verbosity = $verbosity;
        $this->supportColors = $supportColors;
        $this->width = $width;
    }
    public function getVerbosity()
    {
        return $this->verbosity;
    }
    public function setVerbosity($verbosity)
    {
        $this->verbosity = $verbosity;
    }
    public function title($title, $verbosity, $style = null)
    {
        if (null === $style) {
            $style = 'title';
        }
        $this->printvln('', $verbosity, $style);
        $this->printvln($title, $verbosity, $style);
        $this->printvln(\str_repeat('=', \min(\strlen($title), $this->width)), $verbosity, $style);
        $this->printvln('', $verbosity, $style);
    }
    public function getRequirementErrorMessage(\HumbugBox384\KevinGH\RequirementChecker\Requirement $requirement)
    {
        if ($requirement->isFulfilled()) {
            return null;
        }
        $errorMessage = \wordwrap($requirement->getTestMessage(), $this->width - 3, \PHP_EOL . '   ') . \PHP_EOL;
        return $errorMessage;
    }
    public function block($title, $message, $verbosity, $style = null)
    {
        $prefix = ' [' . $title . '] ';
        $message = $prefix . \trim($message);
        $lines = array();
        $remainingMessage = $message;
        while ($remainingMessage !== '') {
            $wrapped = \wordwrap($remainingMessage, $this->width - 3, '¬');
            $exploded = \explode('¬', $wrapped);
            $line = $exploded[0];
            $remainingMessage = \ltrim(\substr($remainingMessage, \strlen($line)));
            if ($remainingMessage !== '') {
                $remainingMessage = \str_repeat(' ', \strlen($prefix)) . $remainingMessage;
            }
            $lines[] = \str_pad($line, $this->width, ' ', \STR_PAD_RIGHT);
        }
        $this->printvln('', $verbosity);
        $this->printvln(\str_repeat(' ', $this->width), $verbosity, $style);
        foreach ($lines as $line) {
            $this->printvln($line, $verbosity, $style);
        }
        $this->printv(\str_repeat(' ', $this->width), $verbosity, $style);
        $this->printvln('', $verbosity);
    }
    public function printvln($message, $verbosity, $style = null)
    {
        $this->printv($message, $verbosity, $style);
        $this->printv(\PHP_EOL, $verbosity, null);
    }
    public function printv($message, $verbosity, $style = null)
    {
        if ($verbosity > $this->verbosity) {
            return;
        }
        $message = \wordwrap($message, $this->width);
        $message = \sprintf('%s%s%s', $this->supportColors && isset($this->styles[$style]) ? $this->styles[$style] : '', $message, $this->supportColors ? $this->styles['reset'] : '');
        echo $message;
    }
}
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

use HumbugBox384\Composer\Semver\Semver;
final class IsPhpVersionFulfilled implements \HumbugBox384\KevinGH\RequirementChecker\IsFulfilled
{
    private $requiredPhpVersion;
    public function __construct($requiredPhpVersion)
    {
        $this->requiredPhpVersion = $requiredPhpVersion;
    }
    public function __invoke()
    {
        return \HumbugBox384\Composer\Semver\Semver::satisfies(\sprintf('%d.%d.%d', \PHP_MAJOR_VERSION, \PHP_MINOR_VERSION, \PHP_RELEASE_VERSION), $this->requiredPhpVersion);
    }
}
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

/**
@symfony
*/
final class Requirement
{
    private $checkIsFulfilled;
    private $fulfilled;
    private $testMessage;
    private $helpText;
    public function __construct($checkIsFulfilled, $testMessage, $helpText)
    {
        $this->checkIsFulfilled = $checkIsFulfilled;
        $this->testMessage = $testMessage;
        $this->helpText = $helpText;
    }
    public function isFulfilled()
    {
        if (null === $this->fulfilled) {
            $this->fulfilled = $this->checkIsFulfilled->__invoke();
        }
        return (bool) $this->fulfilled;
    }
    public function getIsFullfilledChecker()
    {
        return $this->checkIsFulfilled;
    }
    public function getTestMessage()
    {
        return $this->testMessage;
    }
    public function getHelpText()
    {
        return $this->helpText;
    }
}
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

/**
@symfony
*/
final class Checker
{
    private static $requirementsConfig;
    public static function checkRequirements()
    {
        $requirements = self::retrieveRequirements();
        $checkPassed = $requirements->evaluateRequirements();
        $io = new \HumbugBox384\KevinGH\RequirementChecker\IO();
        self::printCheck($checkPassed, new \HumbugBox384\KevinGH\RequirementChecker\Printer($io->getVerbosity(), $io->hasColorSupport()), $requirements);
        return $checkPassed;
    }
    public static function printCheck($checkPassed, \HumbugBox384\KevinGH\RequirementChecker\Printer $printer, \HumbugBox384\KevinGH\RequirementChecker\RequirementCollection $requirements)
    {
        if (\false === $checkPassed && \HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE > $printer->getVerbosity()) {
            $printer->setVerbosity(\HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE);
        }
        $verbosity = \HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_VERY_VERBOSE;
        $iniPath = $requirements->getPhpIniPath();
        $printer->title('Box Requirements Checker', $verbosity);
        $printer->printv('> Using PHP ', $verbosity);
        $printer->printvln(\PHP_VERSION, $verbosity, 'green');
        $printer->printvln('> PHP is using the following php.ini file:', $verbosity);
        if ($iniPath) {
            $printer->printvln('  ' . $iniPath, $verbosity, 'green');
        } else {
            $printer->printvln('  WARNING: No configuration file (php.ini) used by PHP!', $verbosity, 'yellow');
        }
        $printer->printvln('', $verbosity);
        if (\count($requirements) > 0) {
            $printer->printvln('> Checking Box requirements:', $verbosity);
            $printer->printv('  ', $verbosity);
        } else {
            $printer->printvln('> No requirements found.', $verbosity);
        }
        $errorMessages = array();
        foreach ($requirements->getRequirements() as $requirement) {
            if ($errorMessage = $printer->getRequirementErrorMessage($requirement)) {
                if (\HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG === $printer->getVerbosity()) {
                    $printer->printvln('✘ ' . $requirement->getTestMessage(), \HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG, 'red');
                    $printer->printv('  ', \HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG);
                    $errorMessages[] = $errorMessage;
                } else {
                    $printer->printv('E', $verbosity, 'red');
                    $errorMessages[] = $errorMessage;
                }
                continue;
            }
            if (\HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG === $printer->getVerbosity()) {
                $printer->printvln('✔ ' . $requirement->getHelpText(), \HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG, 'green');
                $printer->printv('  ', \HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG);
            } else {
                $printer->printv('.', $verbosity, 'green');
            }
        }
        if (\HumbugBox384\KevinGH\RequirementChecker\IO::VERBOSITY_DEBUG !== $printer->getVerbosity() && \count($requirements) > 0) {
            $printer->printvln('', $verbosity);
        }
        if ($requirements->evaluateRequirements()) {
            $printer->block('OK', 'Your system is ready to run the application.', $verbosity, 'success');
        } else {
            $printer->block('ERROR', 'Your system is not ready to run the application.', $verbosity, 'error');
            $printer->title('Fix the following mandatory requirements:', $verbosity, 'red');
            foreach ($errorMessages as $errorMessage) {
                $printer->printv(' * ' . $errorMessage, $verbosity);
            }
        }
        $printer->printvln('', $verbosity);
    }
    private static function retrieveRequirements()
    {
        if (null === self::$requirementsConfig) {
            self::$requirementsConfig = __DIR__ . '/../.requirements.php';
        }
        $config = (require self::$requirementsConfig);
        $requirements = new \HumbugBox384\KevinGH\RequirementChecker\RequirementCollection();
        foreach ($config as $constraint) {
            $requirements->addRequirement('php' === $constraint['type'] ? new \HumbugBox384\KevinGH\RequirementChecker\IsPhpVersionFulfilled($constraint['condition']) : new \HumbugBox384\KevinGH\RequirementChecker\IsExtensionFulfilled($constraint['condition']), $constraint['message'], $constraint['helpMessage']);
        }
        return $requirements;
    }
}
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

use ArrayIterator;
use Countable;
use IteratorAggregate;
use Traversable;
/**
@symfony
*/
final class RequirementCollection implements \IteratorAggregate, \Countable
{
    private $requirements = array();
    public function getIterator()
    {
        return new \ArrayIterator($this->requirements);
    }
    public function count()
    {
        return \count($this->requirements);
    }
    public function add(\HumbugBox384\KevinGH\RequirementChecker\Requirement $requirement)
    {
        $this->requirements[] = $requirement;
    }
    public function addRequirement($checkIsFulfilled, $testMessage, $helpText)
    {
        $this->add(new \HumbugBox384\KevinGH\RequirementChecker\Requirement($checkIsFulfilled, $testMessage, $helpText));
    }
    public function getRequirements()
    {
        return $this->requirements;
    }
    public function getPhpIniPath()
    {
        return \get_cfg_var('cfg_file_path');
    }
    public function evaluateRequirements()
    {
        return \array_reduce($this->requirements, function ($checkPassed, \HumbugBox384\KevinGH\RequirementChecker\Requirement $requirement) {
            return $checkPassed && $requirement->isFulfilled();
        }, \true);
    }
}
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

interface IsFulfilled
{
    public function __invoke();
}
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

/**
@symfony
*/
class Terminal
{
    private static $width;
    private static $height;
    private static $stty;
    public function getWidth()
    {
        $width = \getenv('COLUMNS');
        if (\false !== $width) {
            return (int) \trim($width);
        }
        if (null === self::$width) {
            self::initDimensions();
        }
        return self::$width ?: 80;
    }
    public function getHeight()
    {
        $height = \getenv('LINES');
        if (\false !== $height) {
            return (int) \trim($height);
        }
        if (null === self::$height) {
            self::initDimensions();
        }
        return self::$height ?: 50;
    }
    public static function hasSttyAvailable()
    {
        if (null !== self::$stty) {
            return self::$stty;
        }
        \exec('stty 2>&1', $output, $exitcode);
        return self::$stty = 0 === $exitcode;
    }
    private static function initDimensions()
    {
        if ('\\' === \DIRECTORY_SEPARATOR) {
            if (\preg_match('/^(\\d+)x(\\d+)(?: \\((\\d+)x(\\d+)\\))?$/', \trim(\getenv('ANSICON')), $matches)) {
                self::$width = (int) $matches[1];
                self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
            } elseif (!self::hasVt100Support() && self::hasSttyAvailable()) {
                self::initDimensionsUsingStty();
            } elseif (null !== ($dimensions = self::getConsoleMode())) {
                self::$width = (int) $dimensions[0];
                self::$height = (int) $dimensions[1];
            }
        } else {
            self::initDimensionsUsingStty();
        }
    }
    private static function hasVt100Support()
    {
        return \function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\fopen('php://stdout', 'wb'));
    }
    private static function initDimensionsUsingStty()
    {
        if ($sttyString = self::getSttyColumns()) {
            if (\preg_match('/rows.(\\d+);.columns.(\\d+);/i', $sttyString, $matches)) {
                self::$width = (int) $matches[2];
                self::$height = (int) $matches[1];
            } elseif (\preg_match('/;.(\\d+).rows;.(\\d+).columns/i', $sttyString, $matches)) {
                self::$width = (int) $matches[2];
                self::$height = (int) $matches[1];
            }
        }
    }
    private static function getConsoleMode()
    {
        $info = self::readFromProcess('mode CON');
        if (null === $info || !\preg_match('/--------+\\r?\\n.+?(\\d+)\\r?\\n.+?(\\d+)\\r?\\n/', $info, $matches)) {
            return null;
        }
        return array((int) $matches[2], (int) $matches[1]);
    }
    private static function getSttyColumns()
    {
        return self::readFromProcess('stty -a | grep columns');
    }
    private static function readFromProcess($command)
    {
        if (!\function_exists('proc_open')) {
            return null;
        }
        $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
        $process = \proc_open($command, $descriptorspec, $pipes, null, null, array('suppress_errors' => \true));
        if (!\is_resource($process)) {
            return null;
        }
        $info = \stream_get_contents($pipes[1]);
        \fclose($pipes[1]);
        \fclose($pipes[2]);
        \proc_close($process);
        return $info;
    }
}
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

final class IsExtensionFulfilled implements \HumbugBox384\KevinGH\RequirementChecker\IsFulfilled
{
    private $requiredExtension;
    public function __construct($requiredExtension)
    {
        $this->requiredExtension = $requiredExtension;
    }
    public function __invoke()
    {
        return \extension_loaded($this->requiredExtension);
    }
}
<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

final class IO
{
    const VERBOSITY_QUIET = 16;
    const VERBOSITY_NORMAL = 32;
    const VERBOSITY_VERBOSE = 64;
    const VERBOSITY_VERY_VERBOSE = 128;
    const VERBOSITY_DEBUG = 256;
    private $interactive;
    private $verbosity = self::VERBOSITY_NORMAL;
    private $colorSupport;
    private $options;
    public function __construct()
    {
        $this->options = \implode(' ', $_SERVER['argv']);
        $shellVerbosity = $this->configureVerbosity();
        $this->interactive = $this->checkInteractivity($shellVerbosity);
        $this->colorSupport = $this->checkColorSupport();
    }
    public function isInteractive()
    {
        return $this->interactive;
    }
    public function getVerbosity()
    {
        return $this->verbosity;
    }
    public function hasColorSupport()
    {
        return $this->colorSupport;
    }
    public function hasParameter($values)
    {
        $values = (array) $values;
        foreach ($values as $value) {
            $regexp = \sprintf('/\\s%s\\b/', \str_replace(' ', '\\s+', \preg_quote($value, '/')));
            if (1 === \preg_match($regexp, $this->options)) {
                return \true;
            }
        }
        return \false;
    }
    private function checkInteractivity($shellVerbosity)
    {
        if (-1 === $shellVerbosity) {
            return \false;
        }
        if (\true === $this->hasParameter(array('--no-interaction', '-n'))) {
            return \false;
        }
        if (\function_exists('posix_isatty') && !@\posix_isatty(\STDOUT) && \false === \getenv('SHELL_INTERACTIVE')) {
            return \false;
        }
        return \true;
    }
    private function configureVerbosity()
    {
        switch ($shellVerbosity = (int) \getenv('SHELL_VERBOSITY')) {
            case -1:
                $this->verbosity = self::VERBOSITY_QUIET;
                break;
            case 1:
                $this->verbosity = self::VERBOSITY_VERBOSE;
                break;
            case 2:
                $this->verbosity = self::VERBOSITY_VERY_VERBOSE;
                break;
            case 3:
                $this->verbosity = self::VERBOSITY_DEBUG;
                break;
            default:
                $shellVerbosity = 0;
                break;
        }
        if ($this->hasParameter(array('--quiet', '-q'))) {
            $this->verbosity = self::VERBOSITY_QUIET;
            $shellVerbosity = -1;
        } elseif ($this->hasParameter(array('-vvv', '--verbose=3', '--verbose 3'))) {
            $this->verbosity = self::VERBOSITY_DEBUG;
            $shellVerbosity = 3;
        } elseif ($this->hasParameter(array('-vv', '--verbose=2', '--verbose 2'))) {
            $this->verbosity = self::VERBOSITY_VERY_VERBOSE;
            $shellVerbosity = 2;
        } elseif ($this->hasParameter(array('-v', '--verbose=1', '--verbose 1', '--verbose'))) {
            $this->verbosity = self::VERBOSITY_VERBOSE;
            $shellVerbosity = 1;
        }
        return $shellVerbosity;
    }
    /**
    @symfony
    */
    private function checkColorSupport()
    {
        if ($this->hasParameter(array('--ansi'))) {
            return \true;
        }
        if ($this->hasParameter(array('--no-ansi'))) {
            return \false;
        }
        if (\DIRECTORY_SEPARATOR === '\\') {
            return \function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\STDOUT) || \false !== \getenv('ANSICON') || 'ON' === \getenv('ConEmuANSI') || 'xterm' === \getenv('TERM');
        }
        if (\function_exists('stream_isatty')) {
            return \stream_isatty(\STDOUT);
        }
        if (\function_exists('posix_isatty')) {
            return \posix_isatty(\STDOUT);
        }
        $stat = \fstat(\STDOUT);
        return $stat ? 020000 === ($stat['mode'] & 0170000) : \false;
    }
}
<?php

namespace _HumbugBox58fd4d9e2a25;

return array (
  0 => 
  array (
    'type' => 'php',
    'condition' => '>=7.1.3',
    'message' => 'The application requires the version ">=7.1.3" or greater.',
    'helpMessage' => 'The application requires the version ">=7.1.3" or greater.',
  ),
  1 => 
  array (
    'type' => 'extension',
    'condition' => 'tokenizer',
    'message' => 'The package "jakub-onderka/php-console-highlighter" requires the extension "tokenizer". Enable it or install a polyfill.',
    'helpMessage' => 'The package "jakub-onderka/php-console-highlighter" requires the extension "tokenizer".',
  ),
  2 => 
  array (
    'type' => 'extension',
    'condition' => 'tokenizer',
    'message' => 'The package "nikic/php-parser" requires the extension "tokenizer". Enable it or install a polyfill.',
    'helpMessage' => 'The package "nikic/php-parser" requires the extension "tokenizer".',
  ),
  3 => 
  array (
    'type' => 'extension',
    'condition' => 'tokenizer',
    'message' => 'The package "psy/psysh" requires the extension "tokenizer". Enable it or install a polyfill.',
    'helpMessage' => 'The package "psy/psysh" requires the extension "tokenizer".',
  ),
  4 => 
  array (
    'type' => 'extension',
    'condition' => 'json',
    'message' => 'The package "psy/psysh" requires the extension "json". Enable it or install a polyfill.',
    'helpMessage' => 'The package "psy/psysh" requires the extension "json".',
  ),
);<?php

namespace HumbugBox384\KevinGH\RequirementChecker;

require __DIR__ . '/../vendor/autoload.php';
if (\false === \in_array(\PHP_SAPI, array('cli', 'phpdbg', 'embed'), \true)) {
    echo \PHP_EOL . 'The application may only be invoked from a command line, got "' . \PHP_SAPI . '"' . \PHP_EOL;
    exit(1);
}
if ((\false === isset($_SERVER['BOX_REQUIREMENT_CHECKER']) || \true === (bool) $_SERVER['BOX_REQUIREMENT_CHECKER']) && \false === \HumbugBox384\KevinGH\RequirementChecker\Checker::checkRequirements()) {
    exit(1);
}
<?php

// autoload_static.php @generated by Composer

namespace Composer\Autoload;

class ComposerStaticInite0a68157e11eec19e04afb18c963e965
{
    public static $prefixLengthsPsr4 = array (
        'H' => 
        array (
            'HumbugBox384\\KevinGH\\RequirementChecker\\' => 40,
            'HumbugBox384\\Composer\\Semver\\' => 29,
        ),
    );

    public static $prefixDirsPsr4 = array (
        'HumbugBox384\\KevinGH\\RequirementChecker\\' => 
        array (
            0 => __DIR__ . '/../..' . '/src',
        ),
        'HumbugBox384\\Composer\\Semver\\' => 
        array (
            0 => __DIR__ . '/..' . '/composer/semver/src',
        ),
    );

    public static $classMap = array (
        'HumbugBox384\\Composer\\Semver\\Comparator' => __DIR__ . '/..' . '/composer/semver/src/Comparator.php',
        'HumbugBox384\\Composer\\Semver\\Constraint\\AbstractConstraint' => __DIR__ . '/..' . '/composer/semver/src/Constraint/AbstractConstraint.php',
        'HumbugBox384\\Composer\\Semver\\Constraint\\Constraint' => __DIR__ . '/..' . '/composer/semver/src/Constraint/Constraint.php',
        'HumbugBox384\\Composer\\Semver\\Constraint\\ConstraintInterface' => __DIR__ . '/..' . '/composer/semver/src/Constraint/ConstraintInterface.php',
        'HumbugBox384\\Composer\\Semver\\Constraint\\EmptyConstraint' => __DIR__ . '/..' . '/composer/semver/src/Constraint/EmptyConstraint.php',
        'HumbugBox384\\Composer\\Semver\\Constraint\\MultiConstraint' => __DIR__ . '/..' . '/composer/semver/src/Constraint/MultiConstraint.php',
        'HumbugBox384\\Composer\\Semver\\Semver' => __DIR__ . '/..' . '/composer/semver/src/Semver.php',
        'HumbugBox384\\Composer\\Semver\\VersionParser' => __DIR__ . '/..' . '/composer/semver/src/VersionParser.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\Checker' => __DIR__ . '/../..' . '/src/Checker.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\IO' => __DIR__ . '/../..' . '/src/IO.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\IsExtensionFulfilled' => __DIR__ . '/../..' . '/src/IsExtensionFulfilled.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\IsFulfilled' => __DIR__ . '/../..' . '/src/IsFulfilled.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\IsPhpVersionFulfilled' => __DIR__ . '/../..' . '/src/IsPhpVersionFulfilled.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\Printer' => __DIR__ . '/../..' . '/src/Printer.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\Requirement' => __DIR__ . '/../..' . '/src/Requirement.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\RequirementCollection' => __DIR__ . '/../..' . '/src/RequirementCollection.php',
        'HumbugBox384\\KevinGH\\RequirementChecker\\Terminal' => __DIR__ . '/../..' . '/src/Terminal.php',
    );

    public static function getInitializer(ClassLoader $loader)
    {
        return \Closure::bind(function () use ($loader) {
            $loader->prefixLengthsPsr4 = ComposerStaticInite0a68157e11eec19e04afb18c963e965::$prefixLengthsPsr4;
            $loader->prefixDirsPsr4 = ComposerStaticInite0a68157e11eec19e04afb18c963e965::$prefixDirsPsr4;
            $loader->classMap = ComposerStaticInite0a68157e11eec19e04afb18c963e965::$classMap;

        }, null, ClassLoader::class);
    }
}
<?php

/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <[email protected]>
 *     Jordi Boggiano <[email protected]>
 *
 * 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, PSR-4 and classmap class loader.
 *
 *     $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 <[email protected]>
 * @author Jordi Boggiano <[email protected]>
 * @see    http://www.php-fig.org/psr/psr-0/
 * @see    http://www.php-fig.org/psr/psr-4/
 */
class ClassLoader
{
    // PSR-4
    private $prefixLengthsPsr4 = array();
    private $prefixDirsPsr4 = array();
    private $fallbackDirsPsr4 = array();

    // PSR-0
    private $prefixesPsr0 = array();
    private $fallbackDirsPsr0 = array();

    private $useIncludePath = false;
    private $classMap = array();
    private $classMapAuthoritative = false;
    private $missingClasses = array();
    private $apcuPrefix;

    public function getPrefixes()
    {
        if (!empty($this->prefixesPsr0)) {
            return call_user_func_array('array_merge', $this->prefixesPsr0);
        }

        return array();
    }

    public function getPrefixesPsr4()
    {
        return $this->prefixDirsPsr4;
    }

    public function getFallbackDirs()
    {
        return $this->fallbackDirsPsr0;
    }

    public function getFallbackDirsPsr4()
    {
        return $this->fallbackDirsPsr4;
    }

    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 PSR-0 directories for a given prefix, either
     * appending or prepending to the ones previously set for this prefix.
     *
     * @param string       $prefix  The prefix
     * @param array|string $paths   The PSR-0 root directories
     * @param bool         $prepend Whether to prepend the directories
     */
    public function add($prefix, $paths, $prepend = false)
    {
        if (!$prefix) {
            if ($prepend) {
                $this->fallbackDirsPsr0 = array_merge(
                    (array) $paths,
                    $this->fallbackDirsPsr0
                );
            } else {
                $this->fallbackDirsPsr0 = array_merge(
                    $this->fallbackDirsPsr0,
                    (array) $paths
                );
            }

            return;
        }

        $first = $prefix[0];
        if (!isset($this->prefixesPsr0[$first][$prefix])) {
            $this->prefixesPsr0[$first][$prefix] = (array) $paths;

            return;
        }
        if ($prepend) {
            $this->prefixesPsr0[$first][$prefix] = array_merge(
                (array) $paths,
                $this->prefixesPsr0[$first][$prefix]
            );
        } else {
            $this->prefixesPsr0[$first][$prefix] = array_merge(
                $this->prefixesPsr0[$first][$prefix],
                (array) $paths
            );
        }
    }

    /**
     * Registers a set of PSR-4 directories for a given namespace, either
     * appending or prepending to the ones previously set for this namespace.
     *
     * @param string       $prefix  The prefix/namespace, with trailing '\\'
     * @param array|string $paths   The PSR-4 base directories
     * @param bool         $prepend Whether to prepend the directories
     *
     * @throws \InvalidArgumentException
     */
    public function addPsr4($prefix, $paths, $prepend = false)
    {
        if (!$prefix) {
            // Register directories for the root namespace.
            if ($prepend) {
                $this->fallbackDirsPsr4 = array_merge(
                    (array) $paths,
                    $this->fallbackDirsPsr4
                );
            } else {
                $this->fallbackDirsPsr4 = array_merge(
                    $this->fallbackDirsPsr4,
                    (array) $paths
                );
            }
        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
            // Register directories for a new namespace.
            $length = strlen($prefix);
            if ('\\' !== $prefix[$length - 1]) {
                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
            }
            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
            $this->prefixDirsPsr4[$prefix] = (array) $paths;
        } elseif ($prepend) {
            // Prepend directories for an already registered namespace.
            $this->prefixDirsPsr4[$prefix] = array_merge(
                (array) $paths,
                $this->prefixDirsPsr4[$prefix]
            );
        } else {
            // Append directories for an already registered namespace.
            $this->prefixDirsPsr4[$prefix] = array_merge(
                $this->prefixDirsPsr4[$prefix],
                (array) $paths
            );
        }
    }

    /**
     * Registers a set of PSR-0 directories for a given prefix,
     * replacing any others previously set for this prefix.
     *
     * @param string       $prefix The prefix
     * @param array|string $paths  The PSR-0 base directories
     */
    public function set($prefix, $paths)
    {
        if (!$prefix) {
            $this->fallbackDirsPsr0 = (array) $paths;
        } else {
            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
        }
    }

    /**
     * Registers a set of PSR-4 directories for a given namespace,
     * replacing any others previously set for this namespace.
     *
     * @param string       $prefix The prefix/namespace, with trailing '\\'
     * @param array|string $paths  The PSR-4 base directories
     *
     * @throws \InvalidArgumentException
     */
    public function setPsr4($prefix, $paths)
    {
        if (!$prefix) {
            $this->fallbackDirsPsr4 = (array) $paths;
        } else {
            $length = strlen($prefix);
            if ('\\' !== $prefix[$length - 1]) {
                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
            }
            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
            $this->prefixDirsPsr4[$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;
    }

    /**
     * Turns off searching the prefix and fallback directories for classes
     * that have not been registered with the class map.
     *
     * @param bool $classMapAuthoritative
     */
    public function setClassMapAuthoritative($classMapAuthoritative)
    {
        $this->classMapAuthoritative = $classMapAuthoritative;
    }

    /**
     * Should class lookup fail if not found in the current class map?
     *
     * @return bool
     */
    public function isClassMapAuthoritative()
    {
        return $this->classMapAuthoritative;
    }

    /**
     * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
     *
     * @param string|null $apcuPrefix
     */
    public function setApcuPrefix($apcuPrefix)
    {
        $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
    }

    /**
     * The APCu prefix in use, or null if APCu caching is not enabled.
     *
     * @return string|null
     */
    public function getApcuPrefix()
    {
        return $this->apcuPrefix;
    }

    /**
     * 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)) {
            includeFile($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)
    {
        // class map lookup
        if (isset($this->classMap[$class])) {
            return $this->classMap[$class];
        }
        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
            return false;
        }
        if (null !== $this->apcuPrefix) {
            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
            if ($hit) {
                return $file;
            }
        }

        $file = $this->findFileWithExtension($class, '.php');

        // Search for Hack files if we are running on HHVM
        if (false === $file && defined('HHVM_VERSION')) {
            $file = $this->findFileWithExtension($class, '.hh');
        }

        if (null !== $this->apcuPrefix) {
            apcu_add($this->apcuPrefix.$class, $file);
        }

        if (false === $file) {
            // Remember that this class does not exist.
            $this->missingClasses[$class] = true;
        }

        return $file;
    }

    private function findFileWithExtension($class, $ext)
    {
        // PSR-4 lookup
        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;

        $first = $class[0];
        if (isset($this->prefixLengthsPsr4[$first])) {
            $subPath = $class;
            while (false !== $lastPos = strrpos($subPath, '\\')) {
                $subPath = substr($subPath, 0, $lastPos);
                $search = $subPath . '\\';
                if (isset($this->prefixDirsPsr4[$search])) {
                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
                    foreach ($this->prefixDirsPsr4[$search] as $dir) {
                        if (file_exists($file = $dir . $pathEnd)) {
                            return $file;
                        }
                    }
                }
            }
        }

        // PSR-4 fallback dirs
        foreach ($this->fallbackDirsPsr4 as $dir) {
            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
                return $file;
            }
        }

        // PSR-0 lookup
        if (false !== $pos = strrpos($class, '\\')) {
            // namespaced class name
            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
        } else {
            // PEAR-like class name
            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
        }

        if (isset($this->prefixesPsr0[$first])) {
            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
                if (0 === strpos($class, $prefix)) {
                    foreach ($dirs as $dir) {
                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
                            return $file;
                        }
                    }
                }
            }
        }

        // PSR-0 fallback dirs
        foreach ($this->fallbackDirsPsr0 as $dir) {
            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
                return $file;
            }
        }

        // PSR-0 include paths.
        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
            return $file;
        }

        return false;
    }
}

/**
 * Scope isolated include.
 *
 * Prevents access to $this/self from included files.
 */
function includeFile($file)
{
    include $file;
}
<?php

// autoload_real.php @generated by Composer

class ComposerAutoloaderInite0a68157e11eec19e04afb18c963e965
{
    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('ComposerAutoloaderInite0a68157e11eec19e04afb18c963e965', 'loadClassLoader'), true, true);
        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
        spl_autoload_unregister(array('ComposerAutoloaderInite0a68157e11eec19e04afb18c963e965', 'loadClassLoader'));

        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
        if ($useStaticLoader) {
            require_once __DIR__ . '/autoload_static.php';

            call_user_func(\Composer\Autoload\ComposerStaticInite0a68157e11eec19e04afb18c963e965::getInitializer($loader));
        } else {
            $classMap = require __DIR__ . '/autoload_classmap.php';
            if ($classMap) {
                $loader->addClassMap($classMap);
            }
        }

        $loader->setClassMapAuthoritative(true);
        $loader->register(true);

        return $loader;
    }
}
<?php

namespace HumbugBox384\Composer\Semver;

use HumbugBox384\Composer\Semver\Constraint\ConstraintInterface;
use HumbugBox384\Composer\Semver\Constraint\EmptyConstraint;
use HumbugBox384\Composer\Semver\Constraint\MultiConstraint;
use HumbugBox384\Composer\Semver\Constraint\Constraint;
class VersionParser
{
    private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\\d+)*+)?)?([.-]?dev)?';
    private static $stabilities = array('stable', 'RC', 'beta', 'alpha', '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 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('{^([^,\\s+]++)\\+[^\\s]++$}', $version, $match)) {
            $version = $match[1];
        }
        if (\preg_match('{^v?(\\d{1,5})(\\.\\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]) ? \ltrim($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 parseNumericAliasPrefix($branch)
    {
        if (\preg_match('{^(?P<version>(\\d++\\.)*\\d++)(?:\\.x)?-dev$}i', $branch, $matches)) {
            return $matches['version'] . '.';
        }
        return \false;
    }
    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++|[xX*]))?(\\.(?:\\d++|[xX*]))?(\\.(?:\\d++|[xX*]))?$}i', $name, $matches)) {
            $version = '';
            for ($i = 1; $i < 5; ++$i) {
                $version .= isset($matches[$i]) ? \str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
            }
            return \str_replace('x', '9999999', $version) . '-dev';
        }
        return 'dev-' . $name;
    }
    public function parseConstraints($constraints)
    {
        $prettyConstraint = $constraints;
        if (\preg_match('{^([^,\\s]*?)@(' . \implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
            $constraints = empty($match[1]) ? '*' : $match[1];
        }
        if (\preg_match('{^(dev-[^,\\s@]+?|[^,\\s@]+?\\.x-dev)#.+$}i', $constraints, $match)) {
            $constraints = $match[1];
        }
        $orConstraints = \preg_split('{\\s*\\|\\|?\\s*}', \trim($constraints));
        $orGroups = array();
        foreach ($orConstraints as $constraints) {
            $andConstraints = \preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
            if (\count($andConstraints) > 1) {
                $constraintObjects = array();
                foreach ($andConstraints as $constraint) {
                    foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
                        $constraintObjects[] = $parsedConstraint;
                    }
                }
            } else {
                $constraintObjects = $this->parseConstraint($andConstraints[0]);
            }
            if (1 === \count($constraintObjects)) {
                $constraint = $constraintObjects[0];
            } else {
                $constraint = new \HumbugBox384\Composer\Semver\Constraint\MultiConstraint($constraintObjects);
            }
            $orGroups[] = $constraint;
        }
        if (1 === \count($orGroups)) {
            $constraint = $orGroups[0];
        } elseif (2 === \count($orGroups) && $orGroups[0] instanceof \HumbugBox384\Composer\Semver\Constraint\MultiConstraint && $orGroups[1] instanceof \HumbugBox384\Composer\Semver\Constraint\MultiConstraint && 2 === \count($orGroups[0]->getConstraints()) && 2 === \count($orGroups[1]->getConstraints()) && ($a = (string) $orGroups[0]) && \substr($a, 0, 3) === '[>=' && \false !== ($posA = \strpos($a, '<', 4)) && ($b = (string) $orGroups[1]) && \substr($b, 0, 3) === '[>=' && \false !== ($posB = \strpos($b, '<', 4)) && \substr($a, $posA + 2, -1) === \substr($b, 4, $posB - 5)) {
            $constraint = new \HumbugBox384\Composer\Semver\Constraint\MultiConstraint(array(new \HumbugBox384\Composer\Semver\Constraint\Constraint('>=', \substr($a, 4, $posA - 5)), new \HumbugBox384\Composer\Semver\Constraint\Constraint('<', \substr($b, $posB + 2, -1))));
        } else {
            $constraint = new \HumbugBox384\Composer\Semver\Constraint\MultiConstraint($orGroups, \false);
        }
        $constraint->setPrettyString($prettyConstraint);
        return $constraint;
    }
    private function parseConstraint($constraint)
    {
        if (\preg_match('{^([^,\\s]+?)@(' . \implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
            $constraint = $match[1];
            if ($match[2] !== 'stable') {
                $stabilityModifier = $match[2];
            }
        }
        if (\preg_match('{^v?[xX*](\\.[xX*])*$}i', $constraint)) {
            return array(new \HumbugBox384\Composer\Semver\Constraint\EmptyConstraint());
        }
        $versionRegex = 'v?(\\d++)(?:\\.(\\d++))?(?:\\.(\\d++))?(?:\\.(\\d++))?' . self::$modifierRegex . '(?:\\+[^\\s]+)?';
        if (\preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
            if (\substr($constraint, 0, 2) === '~>') {
                throw new \UnexpectedValueException('Could not parse version constraint ' . $constraint . ': ' . 'Invalid operator "~>", you probably meant to use the "~" operator');
            }
            if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
                $position = 4;
            } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
                $position = 3;
            } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
                $position = 2;
            } else {
                $position = 1;
            }
            $stabilitySuffix = '';
            if (empty($matches[5]) && empty($matches[7])) {
                $stabilitySuffix .= '-dev';
            }
            $lowVersion = $this->normalize(\substr($constraint . $stabilitySuffix, 1));
            $lowerBound = new \HumbugBox384\Composer\Semver\Constraint\Constraint('>=', $lowVersion);
            $highPosition = \max(1, $position - 1);
            $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
            $upperBound = new \HumbugBox384\Composer\Semver\Constraint\Constraint('<', $highVersion);
            return array($lowerBound, $upperBound);
        }
        if (\preg_match('{^\\^' . $versionRegex . '($)}i', $constraint, $matches)) {
            if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
                $position = 1;
            } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
                $position = 2;
            } else {
                $position = 3;
            }
            $stabilitySuffix = '';
            if (empty($matches[5]) && empty($matches[7])) {
                $stabilitySuffix .= '-dev';
            }
            $lowVersion = $this->normalize(\substr($constraint . $stabilitySuffix, 1));
            $lowerBound = new \HumbugBox384\Composer\Semver\Constraint\Constraint('>=', $lowVersion);
            $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
            $upperBound = new \HumbugBox384\Composer\Semver\Constraint\Constraint('<', $highVersion);
            return array($lowerBound, $upperBound);
        }
        if (\preg_match('{^v?(\\d++)(?:\\.(\\d++))?(?:\\.(\\d++))?(?:\\.[xX*])++$}', $constraint, $matches)) {
            if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
                $position = 3;
            } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
                $position = 2;
            } else {
                $position = 1;
            }
            $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
            $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
            if ($lowVersion === '0.0.0.0-dev') {
                return array(new \HumbugBox384\Composer\Semver\Constraint\Constraint('<', $highVersion));
            }
            return array(new \HumbugBox384\Composer\Semver\Constraint\Constraint('>=', $lowVersion), new \HumbugBox384\Composer\Semver\Constraint\Constraint('<', $highVersion));
        }
        if (\preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
            $lowStabilitySuffix = '';
            if (empty($matches[6]) && empty($matches[8])) {
                $lowStabilitySuffix = '-dev';
            }
            $lowVersion = $this->normalize($matches['from']);
            $lowerBound = new \HumbugBox384\Composer\Semver\Constraint\Constraint('>=', $lowVersion . $lowStabilitySuffix);
            $empty = function ($x) {
                return $x === 0 || $x === '0' ? \false : empty($x);
            };
            if (!$empty($matches[11]) && !$empty($matches[12]) || !empty($matches[14]) || !empty($matches[16])) {
                $highVersion = $this->normalize($matches['to']);
                $upperBound = new \HumbugBox384\Composer\Semver\Constraint\Constraint('<=', $highVersion);
            } else {
                $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
                $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
                $upperBound = new \HumbugBox384\Composer\Semver\Constraint\Constraint('<', $highVersion);
            }
            return array($lowerBound, $upperBound);
        }
        if (\preg_match('{^(<>|!=|>=?|<=?|==?)?\\s*(.*)}', $constraint, $matches)) {
            try {
                $version = $this->normalize($matches[2]);
                if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
                    $version .= '-' . $stabilityModifier;
                } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
                    if (!\preg_match('/-' . self::$modifierRegex . '$/', \strtolower($matches[2]))) {
                        if (\substr($matches[2], 0, 4) !== 'dev-') {
                            $version .= '-dev';
                        }
                    }
                }
                return array(new \HumbugBox384\Composer\Semver\Constraint\Constraint($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 manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
    {
        for ($i = 4; $i > 0; --$i) {
            if ($i > $position) {
                $matches[$i] = $pad;
            } elseif ($i === $position && $increment) {
                $matches[$i] += $increment;
                if ($matches[$i] < 0) {
                    $matches[$i] = $pad;
                    --$position;
                    if ($i === 1) {
                        return;
                    }
                }
            }
        }
        return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
    }
    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;
        }
    }
}
<?php

namespace HumbugBox384\Composer\Semver;

use HumbugBox384\Composer\Semver\Constraint\Constraint;
class Comparator
{
    public static function greaterThan($version1, $version2)
    {
        return self::compare($version1, '>', $version2);
    }
    public static function greaterThanOrEqualTo($version1, $version2)
    {
        return self::compare($version1, '>=', $version2);
    }
    public static function lessThan($version1, $version2)
    {
        return self::compare($version1, '<', $version2);
    }
    public static function lessThanOrEqualTo($version1, $version2)
    {
        return self::compare($version1, '<=', $version2);
    }
    public static function equalTo($version1, $version2)
    {
        return self::compare($version1, '==', $version2);
    }
    public static function notEqualTo($version1, $version2)
    {
        return self::compare($version1, '!=', $version2);
    }
    public static function compare($version1, $operator, $version2)
    {
        $constraint = new \HumbugBox384\Composer\Semver\Constraint\Constraint($operator, $version2);
        return $constraint->matches(new \HumbugBox384\Composer\Semver\Constraint\Constraint('==', $version1));
    }
}
<?php

namespace HumbugBox384\Composer\Semver;

use HumbugBox384\Composer\Semver\Constraint\Constraint;
class Semver
{
    const SORT_ASC = 1;
    const SORT_DESC = -1;
    private static $versionParser;
    public static function satisfies($version, $constraints)
    {
        if (null === self::$versionParser) {
            self::$versionParser = new \HumbugBox384\Composer\Semver\VersionParser();
        }
        $versionParser = self::$versionParser;
        $provider = new \HumbugBox384\Composer\Semver\Constraint\Constraint('==', $versionParser->normalize($version));
        $constraints = $versionParser->parseConstraints($constraints);
        return $constraints->matches($provider);
    }
    public static function satisfiedBy(array $versions, $constraints)
    {
        $versions = \array_filter($versions, function ($version) use($constraints) {
            return \HumbugBox384\Composer\Semver\Semver::satisfies($version, $constraints);
        });
        return \array_values($versions);
    }
    public static function sort(array $versions)
    {
        return self::usort($versions, self::SORT_ASC);
    }
    public static function rsort(array $versions)
    {
        return self::usort($versions, self::SORT_DESC);
    }
    private static function usort(array $versions, $direction)
    {
        if (null === self::$versionParser) {
            self::$versionParser = new \HumbugBox384\Composer\Semver\VersionParser();
        }
        $versionParser = self::$versionParser;
        $normalized = array();
        foreach ($versions as $key => $version) {
            $normalized[] = array($versionParser->normalize($version), $key);
        }
        \usort($normalized, function (array $left, array $right) use($direction) {
            if ($left[0] === $right[0]) {
                return 0;
            }
            if (\HumbugBox384\Composer\Semver\Comparator::lessThan($left[0], $right[0])) {
                return -$direction;
            }
            return $direction;
        });
        $sorted = array();
        foreach ($normalized as $item) {
            $sorted[] = $versions[$item[1]];
        }
        return $sorted;
    }
}
<?php

namespace HumbugBox384\Composer\Semver\Constraint;

interface ConstraintInterface
{
    public function matches(\HumbugBox384\Composer\Semver\Constraint\ConstraintInterface $provider);
    public function getPrettyString();
    public function __toString();
}
<?php

namespace HumbugBox384\Composer\Semver\Constraint;

class Constraint implements \HumbugBox384\Composer\Semver\Constraint\ConstraintInterface
{
    const OP_EQ = 0;
    const OP_LT = 1;
    const OP_LE = 2;
    const OP_GT = 3;
    const OP_GE = 4;
    const OP_NE = 5;
    private static $transOpStr = array('=' => self::OP_EQ, '==' => self::OP_EQ, '<' => self::OP_LT, '<=' => self::OP_LE, '>' => self::OP_GT, '>=' => self::OP_GE, '<>' => self::OP_NE, '!=' => self::OP_NE);
    private static $transOpInt = array(self::OP_EQ => '==', self::OP_LT => '<', self::OP_LE => '<=', self::OP_GT => '>', self::OP_GE => '>=', self::OP_NE => '!=');
    protected $operator;
    protected $version;
    protected $prettyString;
    public function matches(\HumbugBox384\Composer\Semver\Constraint\ConstraintInterface $provider)
    {
        if ($provider instanceof $this) {
            return $this->matchSpecific($provider);
        }
        return $provider->matches($this);
    }
    public function setPrettyString($prettyString)
    {
        $this->prettyString = $prettyString;
    }
    public function getPrettyString()
    {
        if ($this->prettyString) {
            return $this->prettyString;
        }
        return $this->__toString();
    }
    public static function getSupportedOperators()
    {
        return \array_keys(self::$transOpStr);
    }
    public function __construct($operator, $version)
    {
        if (!isset(self::$transOpStr[$operator])) {
            throw new \InvalidArgumentException(\sprintf('Invalid operator "%s" given, expected one of: %s', $operator, \implode(', ', self::getSupportedOperators())));
        }
        $this->operator = self::$transOpStr[$operator];
        $this->version = $version;
    }
    public function versionCompare($a, $b, $operator, $compareBranches = \false)
    {
        if (!isset(self::$transOpStr[$operator])) {
            throw new \InvalidArgumentException(\sprintf('Invalid operator "%s" given, expected one of: %s', $operator, \implode(', ', self::getSupportedOperators())));
        }
        $aIsBranch = 'dev-' === \substr($a, 0, 4);
        $bIsBranch = 'dev-' === \substr($b, 0, 4);
        if ($aIsBranch && $bIsBranch) {
            return $operator === '==' && $a === $b;
        }
        if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
            return \false;
        }
        return \version_compare($a, $b, $operator);
    }
    public function matchSpecific(\HumbugBox384\Composer\Semver\Constraint\Constraint $provider, $compareBranches = \false)
    {
        $noEqualOp = \str_replace('=', '', self::$transOpInt[$this->operator]);
        $providerNoEqualOp = \str_replace('=', '', self::$transOpInt[$provider->operator]);
        $isEqualOp = self::OP_EQ === $this->operator;
        $isNonEqualOp = self::OP_NE === $this->operator;
        $isProviderEqualOp = self::OP_EQ === $provider->operator;
        $isProviderNonEqualOp = self::OP_NE === $provider->operator;
        if ($isNonEqualOp || $isProviderNonEqualOp) {
            return !$isEqualOp && !$isProviderEqualOp || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
        }
        if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
            return \true;
        }
        if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
            if ($provider->version === $this->version && self::$transOpInt[$provider->operator] === $providerNoEqualOp && self::$transOpInt[$this->operator] !== $noEqualOp) {
                return \false;
            }
            return \true;
        }
        return \false;
    }
    public function __toString()
    {
        return self::$transOpInt[$this->operator] . ' ' . $this->version;
    }
}
<?php

namespace HumbugBox384\Composer\Semver\Constraint;

class MultiConstraint implements \HumbugBox384\Composer\Semver\Constraint\ConstraintInterface
{
    protected $constraints;
    protected $prettyString;
    protected $conjunctive;
    public function __construct(array $constraints, $conjunctive = \true)
    {
        $this->constraints = $constraints;
        $this->conjunctive = $conjunctive;
    }
    public function getConstraints()
    {
        return $this->constraints;
    }
    public function isConjunctive()
    {
        return $this->conjunctive;
    }
    public function isDisjunctive()
    {
        return !$this->conjunctive;
    }
    public function matches(\HumbugBox384\Composer\Semver\Constraint\ConstraintInterface $provider)
    {
        if (\false === $this->conjunctive) {
            foreach ($this->constraints as $constraint) {
                if ($constraint->matches($provider)) {
                    return \true;
                }
            }
            return \false;
        }
        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[] = (string) $constraint;
        }
        return '[' . \implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
    }
}
<?php

namespace HumbugBox384\Composer\Semver\Constraint;

\trigger_error('The ' . __NAMESPACE__ . '\\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', \E_USER_DEPRECATED);
abstract class AbstractConstraint implements \HumbugBox384\Composer\Semver\Constraint\ConstraintInterface
{
    protected $prettyString;
    public function matches(\HumbugBox384\Composer\Semver\Constraint\ConstraintInterface $provider)
    {
        if ($provider instanceof $this) {
            return $this->matchSpecific($provider);
        }
        return $provider->matches($this);
    }
    public function setPrettyString($prettyString)
    {
        $this->prettyString = $prettyString;
    }
    public function getPrettyString()
    {
        if ($this->prettyString) {
            return $this->prettyString;
        }
        return $this->__toString();
    }
}
<?php

namespace HumbugBox384\Composer\Semver\Constraint;

class EmptyConstraint implements \HumbugBox384\Composer\Semver\Constraint\ConstraintInterface
{
    protected $prettyString;
    public function matches(\HumbugBox384\Composer\Semver\Constraint\ConstraintInterface $provider)
    {
        return \true;
    }
    public function setPrettyString($prettyString)
    {
        $this->prettyString = $prettyString;
    }
    public function getPrettyString()
    {
        if ($this->prettyString) {
            return $this->prettyString;
        }
        return $this->__toString();
    }
    public function __toString()
    {
        return '[]';
    }
}
Copyright (C) 2015 Composer

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.
<?php

// autoload_classmap.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'HumbugBox384\\Composer\\Semver\\Comparator' => $vendorDir . '/composer/semver/src/Comparator.php',
    'HumbugBox384\\Composer\\Semver\\Constraint\\AbstractConstraint' => $vendorDir . '/composer/semver/src/Constraint/AbstractConstraint.php',
    'HumbugBox384\\Composer\\Semver\\Constraint\\Constraint' => $vendorDir . '/composer/semver/src/Constraint/Constraint.php',
    'HumbugBox384\\Composer\\Semver\\Constraint\\ConstraintInterface' => $vendorDir . '/composer/semver/src/Constraint/ConstraintInterface.php',
    'HumbugBox384\\Composer\\Semver\\Constraint\\EmptyConstraint' => $vendorDir . '/composer/semver/src/Constraint/EmptyConstraint.php',
    'HumbugBox384\\Composer\\Semver\\Constraint\\MultiConstraint' => $vendorDir . '/composer/semver/src/Constraint/MultiConstraint.php',
    'HumbugBox384\\Composer\\Semver\\Semver' => $vendorDir . '/composer/semver/src/Semver.php',
    'HumbugBox384\\Composer\\Semver\\VersionParser' => $vendorDir . '/composer/semver/src/VersionParser.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\Checker' => $baseDir . '/src/Checker.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\IO' => $baseDir . '/src/IO.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\IsExtensionFulfilled' => $baseDir . '/src/IsExtensionFulfilled.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\IsFulfilled' => $baseDir . '/src/IsFulfilled.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\IsPhpVersionFulfilled' => $baseDir . '/src/IsPhpVersionFulfilled.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\Printer' => $baseDir . '/src/Printer.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\Requirement' => $baseDir . '/src/Requirement.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\RequirementCollection' => $baseDir . '/src/RequirementCollection.php',
    'HumbugBox384\\KevinGH\\RequirementChecker\\Terminal' => $baseDir . '/src/Terminal.php',
);
<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'HumbugBox384\\KevinGH\\RequirementChecker\\' => array($baseDir . '/src'),
    'HumbugBox384\\Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
);

Copyright (c) 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.

<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
);
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInite0a68157e11eec19e04afb18c963e965::getLoader();
5wAʆ���0M����+�V�GBMB

Hry