From 99543e4c5b39b8aa67082b614c3286017264045b Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Fri, 4 Aug 2023 11:39:31 +0200 Subject: [PATCH] Add workflow for PHPUnit/Behat tests Signed-off-by: Benjamin Gaussorgues --- .drone.yml | 59 - .github/workflows/phpunit-sqlite.yml | 148 ++ .gitignore | 3 +- appinfo/app.php | 3 +- tests/integration/composer.json | 3 +- tests/integration/composer.lock | 472 ++-- tests/integration/config/behat.yml | 14 + tests/integration/features/Login.feature | 13 +- tests/integration/run.sh | 17 + tests/integration/vendor/autoload.php | 25 - .../vendor/behat/behat/CHANGELOG.md | 1055 -------- tests/integration/vendor/behat/behat/LICENSE | 22 - .../integration/vendor/behat/behat/README.md | 69 - .../integration/vendor/behat/behat/bin/behat | 34 - .../vendor/behat/behat/composer.json | 64 - tests/integration/vendor/behat/behat/i18n.php | 301 --- .../src/Behat/Behat/ApplicationFactory.php | 150 -- .../Context/Annotation/AnnotationReader.php | 37 - .../Context/Argument/ArgumentResolver.php | 34 - .../Context/Argument/CompositeFactory.php | 54 - .../Behat/Context/Argument/NullFactory.php | 40 - .../Argument/SuiteScopedResolverFactory.php | 34 - .../Context/Cli/ContextSnippetsController.php | 91 - .../Cli/InteractiveContextIdentifier.php | 97 - .../behat/src/Behat/Behat/Context/Context.php | 20 - .../Context/ContextClass/ClassGenerator.php | 44 - .../Context/ContextClass/ClassResolver.php | 41 - .../ContextClass/SimpleClassGenerator.php | 80 - .../Behat/Behat/Context/ContextFactory.php | 150 -- .../Context/CustomSnippetAcceptingContext.php | 34 - .../Environment/ContextEnvironment.php | 48 - .../Handler/ContextEnvironmentHandler.php | 194 -- .../InitializedContextEnvironment.php | 158 -- .../Reader/ContextEnvironmentReader.php | 93 - .../UninitializedContextEnvironment.php | 96 - .../Context/Exception/ContextException.php | 22 - .../Exception/ContextNotFoundException.php | 49 - .../UnknownTranslationResourceException.php | 49 - .../Exception/WrongContextClassException.php | 49 - .../Initializer/ContextInitializer.php | 28 - .../Context/Reader/AnnotatedContextReader.php | 230 -- .../Behat/Context/Reader/ContextReader.php | 32 - .../Reader/ContextReaderCachedPerContext.php | 54 - .../Reader/ContextReaderCachedPerSuite.php | 69 - .../Reader/TranslatableContextReader.php | 101 - .../ServiceContainer/ContextExtension.php | 454 ---- .../Appender/ContextSnippetAppender.php | 128 - .../Behat/Context/Snippet/ContextSnippet.php | 105 - .../Generator/AggregateContextIdentifier.php | 56 - .../Generator/AggregatePatternIdentifier.php | 49 - .../Generator/CachedContextIdentifier.php | 54 - ...ContextInterfaceBasedContextIdentifier.php | 37 - ...ContextInterfaceBasedPatternIdentifier.php | 33 - .../Generator/ContextSnippetGenerator.php | 360 --- .../Generator/FixedContextIdentifier.php | 48 - .../Generator/FixedPatternIdentifier.php | 44 - .../Snippet/Generator/PatternIdentifier.php | 30 - .../Generator/TargetContextIdentifier.php | 30 - .../Behat/Context/SnippetAcceptingContext.php | 26 - .../Suite/Setup/SuiteWithContextsSetup.php | 246 -- .../Behat/Context/TranslatableContext.php | 36 - .../Behat/Definition/Call/DefinitionCall.php | 78 - .../src/Behat/Behat/Definition/Call/Given.php | 31 - .../Definition/Call/RuntimeDefinition.php | 71 - .../src/Behat/Behat/Definition/Call/Then.php | 31 - .../src/Behat/Behat/Definition/Call/When.php | 31 - .../Cli/AvailableDefinitionsController.php | 118 - .../Annotation/DefinitionAnnotationReader.php | 52 - .../src/Behat/Behat/Definition/Definition.php | 42 - .../Behat/Definition/DefinitionFinder.php | 61 - .../Behat/Definition/DefinitionRepository.php | 70 - .../Behat/Definition/DefinitionWriter.php | 58 - .../Exception/AmbiguousMatchException.php | 57 - .../Exception/DefinitionException.php | 22 - .../Exception/InvalidPatternException.php | 22 - .../Exception/RedundantStepException.php | 41 - .../Definition/Exception/SearchException.php | 20 - .../Exception/UnknownPatternException.php | 49 - .../UnsupportedPatternTypeException.php | 49 - .../Behat/Definition/Pattern/Pattern.php | 76 - .../Definition/Pattern/PatternTransformer.php | 101 - .../Pattern/Policy/PatternPolicy.php | 60 - .../Pattern/Policy/RegexPatternPolicy.php | 135 - .../Pattern/Policy/TurnipPatternPolicy.php | 212 -- .../ConsoleDefinitionInformationPrinter.php | 147 -- .../Printer/ConsoleDefinitionListPrinter.php | 43 - .../Printer/ConsoleDefinitionPrinter.php | 123 - .../Definition/Printer/DefinitionPrinter.php | 30 - .../Search/RepositorySearchEngine.php | 130 - .../Behat/Definition/Search/SearchEngine.php | 38 - .../Behat/Behat/Definition/SearchResult.php | 86 - .../ServiceContainer/DefinitionExtension.php | 339 --- .../Translator/DefinitionTranslator.php | 64 - .../Translator/TranslatedDefinition.php | 140 - .../Cli/StopOnFailureController.php | 109 - .../Event/AfterBackgroundSetup.php | 96 - .../Event/AfterBackgroundTested.php | 118 - .../Event/AfterFeatureSetup.php | 68 - .../Event/AfterFeatureTested.php | 85 - .../Event/AfterOutlineSetup.php | 85 - .../Event/AfterOutlineTested.php | 107 - .../Event/AfterScenarioSetup.php | 86 - .../Event/AfterScenarioTested.php | 108 - .../EventDispatcher/Event/AfterStepSetup.php | 95 - .../EventDispatcher/Event/AfterStepTested.php | 154 -- .../Event/BackgroundTested.php | 45 - .../Event/BeforeBackgroundTeardown.php | 100 - .../Event/BeforeBackgroundTested.php | 79 - .../Event/BeforeFeatureTeardown.php | 68 - .../Event/BeforeFeatureTested.php | 51 - .../Event/BeforeOutlineTeardown.php | 89 - .../Event/BeforeOutlineTested.php | 68 - .../Event/BeforeScenarioTeardown.php | 90 - .../Event/BeforeScenarioTested.php | 69 - .../Event/BeforeStepTeardown.php | 126 - .../Event/BeforeStepTested.php | 68 - .../EventDispatcher/Event/ExampleTested.php | 24 - .../EventDispatcher/Event/FeatureTested.php | 45 - .../Event/GherkinNodeTested.php | 28 - .../EventDispatcher/Event/OutlineTested.php | 53 - .../Event/ScenarioLikeTested.php | 36 - .../EventDispatcher/Event/ScenarioTested.php | 34 - .../EventDispatcher/Event/StepTested.php | 50 - .../EventDispatcherExtension.php | 173 -- .../EventDispatchingBackgroundTester.php | 96 - .../Tester/EventDispatchingFeatureTester.php | 94 - .../Tester/EventDispatchingOutlineTester.php | 96 - .../Tester/EventDispatchingScenarioTester.php | 126 - .../Tester/EventDispatchingStepTester.php | 96 - .../Tester/TickingStepTester.php | 74 - .../Behat/Gherkin/Cli/FilterController.php | 98 - .../Behat/Gherkin/Cli/SyntaxController.php | 108 - .../ServiceContainer/GherkinExtension.php | 384 --- .../Specification/LazyFeatureIterator.php | 207 -- .../Locator/FilesystemFeatureLocator.php | 176 -- .../FilesystemRerunScenariosListLocator.php | 65 - .../FilesystemScenariosListLocator.php | 62 - .../Suite/Setup/SuiteWithPathsSetup.php | 116 - .../Argument/ServicesResolver.php | 72 - .../Argument/ServicesResolverFactory.php | 220 -- .../BuiltInServiceContainer.php | 203 -- .../Exception/HelperContainerException.php | 22 - .../Exception/ServiceNotFoundException.php | 49 - .../WrongContainerClassException.php | 49 - .../WrongServicesConfigurationException.php | 22 - .../HelperContainerExtension.php | 106 - .../Behat/Behat/Hook/Call/AfterFeature.php | 41 - .../Behat/Behat/Hook/Call/AfterScenario.php | 41 - .../src/Behat/Behat/Hook/Call/AfterStep.php | 41 - .../Behat/Behat/Hook/Call/BeforeFeature.php | 41 - .../Behat/Behat/Hook/Call/BeforeScenario.php | 41 - .../src/Behat/Behat/Hook/Call/BeforeStep.php | 41 - .../Behat/Hook/Call/RuntimeFeatureHook.php | 115 - .../Behat/Hook/Call/RuntimeScenarioHook.php | 96 - .../Behat/Behat/Hook/Call/RuntimeStepHook.php | 68 - .../Annotation/HookAnnotationReader.php | 65 - .../Behat/Hook/Scope/AfterFeatureScope.php | 102 - .../Behat/Hook/Scope/AfterScenarioScope.php | 119 - .../Behat/Behat/Hook/Scope/AfterStepScope.php | 120 - .../Behat/Hook/Scope/BeforeFeatureScope.php | 84 - .../Behat/Hook/Scope/BeforeScenarioScope.php | 101 - .../Behat/Hook/Scope/BeforeStepScope.php | 101 - .../Behat/Behat/Hook/Scope/FeatureScope.php | 32 - .../Behat/Behat/Hook/Scope/ScenarioScope.php | 40 - .../src/Behat/Behat/Hook/Scope/StepScope.php | 40 - .../Hook/ServiceContainer/HookExtension.php | 104 - .../Hook/Tester/HookableFeatureTester.php | 91 - .../Hook/Tester/HookableScenarioTester.php | 93 - .../Behat/Hook/Tester/HookableStepTester.php | 93 - .../NodeVisitorNotFoundException.php | 23 - .../EventListener/AST/FeatureListener.php | 94 - .../EventListener/AST/OutlineListener.php | 194 -- .../AST/OutlineTableListener.php | 260 -- .../AST/ScenarioNodeListener.php | 118 - .../Node/EventListener/AST/StepListener.php | 125 - .../Node/EventListener/AST/SuiteListener.php | 55 - .../Flow/FireOnlySiblingsListener.php | 75 - .../FirstBackgroundFiresFirstListener.php | 137 - .../Flow/OnlyFirstBackgroundFiresListener.php | 202 -- .../JUnit/JUnitFeatureElementListener.php | 193 -- .../JUnit/JUnitOutlineStoreListener.php | 111 - .../Statistics/HookStatsListener.php | 123 - .../Statistics/ScenarioStatsListener.php | 105 - .../Statistics/StatisticsListener.php | 86 - .../Statistics/StepStatsListener.php | 194 -- .../Output/Node/Printer/CounterPrinter.php | 81 - .../Output/Node/Printer/ExamplePrinter.php | 41 - .../Output/Node/Printer/ExampleRowPrinter.php | 34 - .../Output/Node/Printer/FeaturePrinter.php | 39 - .../Helper/ResultToStringConverter.php | 57 - .../Node/Printer/Helper/StepTextPainter.php | 106 - .../Node/Printer/Helper/WidthCalculator.php | 105 - .../Printer/JUnit/JUnitFeaturePrinter.php | 78 - .../Printer/JUnit/JUnitScenarioPrinter.php | 113 - .../Node/Printer/JUnit/JUnitSetupPrinter.php | 87 - .../Node/Printer/JUnit/JUnitStepPrinter.php | 78 - .../Node/Printer/JUnit/JUnitSuitePrinter.php | 57 - .../Behat/Output/Node/Printer/ListPrinter.php | 271 -- .../Output/Node/Printer/OutlinePrinter.php | 41 - .../Node/Printer/OutlineTablePrinter.php | 43 - .../Printer/Pretty/PrettyExamplePrinter.php | 74 - .../Pretty/PrettyExampleRowPrinter.php | 200 -- .../Printer/Pretty/PrettyFeaturePrinter.php | 133 - .../Printer/Pretty/PrettyOutlinePrinter.php | 140 - .../Pretty/PrettyOutlineTablePrinter.php | 145 - .../Node/Printer/Pretty/PrettyPathPrinter.php | 137 - .../Printer/Pretty/PrettyScenarioPrinter.php | 148 -- .../Printer/Pretty/PrettySetupPrinter.php | 212 -- .../Pretty/PrettySkippedStepPrinter.php | 162 -- .../Pretty/PrettyStatisticsPrinter.php | 71 - .../Node/Printer/Pretty/PrettyStepPrinter.php | 213 -- .../Progress/ProgressStatisticsPrinter.php | 77 - .../Printer/Progress/ProgressStepPrinter.php | 77 - .../Output/Node/Printer/ScenarioPrinter.php | 41 - .../Output/Node/Printer/SetupPrinter.php | 39 - .../Output/Node/Printer/StatisticsPrinter.php | 30 - .../Behat/Output/Node/Printer/StepPrinter.php | 34 - .../Output/Node/Printer/SuitePrinter.php | 38 - .../Output/Printer/ConsoleOutputFactory.php | 62 - .../Printer/Formatter/ConsoleFormatter.php | 57 - .../Formatter/JUnitFormatterFactory.php | 184 -- .../Formatter/PrettyFormatterFactory.php | 470 ---- .../Formatter/ProgressFormatterFactory.php | 195 -- .../Behat/Output/Statistics/HookStat.php | 98 - .../Output/Statistics/PhaseStatistics.php | 179 -- .../Behat/Output/Statistics/ScenarioStat.php | 86 - .../Behat/Output/Statistics/Statistics.php | 117 - .../Behat/Output/Statistics/StepStat.php | 120 - .../Behat/Output/Statistics/StepStatV2.php | 152 -- .../Output/Statistics/TotalStatistics.php | 244 -- .../Behat/Behat/Snippet/AggregateSnippet.php | 129 - .../Snippet/Appender/SnippetAppender.php | 40 - .../Behat/Snippet/Cli/SnippetsController.php | 163 -- .../EnvironmentSnippetGenerationException.php | 50 - .../Snippet/Exception/SnippetException.php | 22 - .../Snippet/Generator/SnippetGenerator.php | 46 - .../Snippet/Printer/ConsoleSnippetPrinter.php | 87 - .../Behat/Snippet/Printer/SnippetPrinter.php | 38 - .../ServiceContainer/SnippetExtension.php | 163 -- .../behat/src/Behat/Behat/Snippet/Snippet.php | 56 - .../Behat/Behat/Snippet/SnippetRegistry.php | 143 - .../Behat/Behat/Snippet/SnippetRepository.php | 33 - .../src/Behat/Behat/Snippet/SnippetWriter.php | 117 - .../src/Behat/Behat/Snippet/UndefinedStep.php | 63 - .../Behat/Behat/Tester/BackgroundTester.php | 59 - .../Behat/Tester/Cli/RerunController.php | 185 -- .../FeatureHasNoBackgroundException.php | 51 - .../Tester/Exception/PendingException.php | 32 - .../Stringer/PendingExceptionStringer.php | 39 - .../src/Behat/Behat/Tester/OutlineTester.php | 63 - .../Behat/Tester/Result/DefinedStepResult.php | 28 - .../Tester/Result/ExecutedStepResult.php | 113 - .../Tester/Result/FailedStepSearchResult.php | 69 - .../Behat/Tester/Result/SkippedStepResult.php | 70 - .../Behat/Behat/Tester/Result/StepResult.php | 23 - .../Tester/Result/UndefinedStepResult.php | 35 - .../Runtime/IsolatingScenarioTester.php | 84 - .../Runtime/RuntimeBackgroundTester.php | 84 - .../Tester/Runtime/RuntimeFeatureTester.php | 101 - .../Tester/Runtime/RuntimeOutlineTester.php | 81 - .../Tester/Runtime/RuntimeScenarioTester.php | 109 - .../Tester/Runtime/RuntimeStepTester.php | 147 -- .../src/Behat/Behat/Tester/ScenarioTester.php | 63 - .../ServiceContainer/TesterExtension.php | 315 --- .../Behat/Tester/StepContainerTester.php | 71 - .../src/Behat/Behat/Tester/StepTester.php | 63 - .../Filter/DefinitionArgumentsTransformer.php | 108 - .../Call/RuntimeTransformation.php | 59 - .../Call/TransformationCall.php | 58 - .../TransformationAnnotationReader.php | 76 - .../Exception/TransformationException.php | 22 - .../Exception/UnsupportedCallException.php | 50 - .../Behat/Transformation/RegexGenerator.php | 30 - .../TransformationExtension.php | 183 -- .../SimpleArgumentTransformation.php | 63 - .../Behat/Transformation/Transformation.php | 37 - .../ColumnBasedTableTransformation.php | 114 - .../Transformation/PatternTransformation.php | 148 -- .../ReturnTypeTransformation.php | 243 -- .../RowBasedTableTransformation.php | 130 - .../Transformation/TableRowTransformation.php | 118 - .../TokenNameAndReturnTypeTransformation.php | 113 - .../TokenNameTransformation.php | 109 - .../TransformationRepository.php | 55 - .../Transformer/ArgumentTransformer.php | 43 - .../RepositoryArgumentTransformer.php | 194 -- .../Cli/GherkinTranslationsController.php | 59 - .../GherkinTranslationsExtension.php | 79 - .../src/Behat/Testwork/ApplicationFactory.php | 94 - .../Testwork/Argument/ArgumentOrganiser.php | 31 - .../Argument/ConstructorArgumentOrganiser.php | 90 - .../Argument/Exception/ArgumentException.php | 22 - .../UnknownParameterValueException.php | 24 - .../UnsupportedFunctionException.php | 22 - .../Argument/MixedArgumentOrganiser.php | 473 ---- .../Argument/PregMatchArgumentOrganiser.php | 93 - .../ServiceContainer/ArgumentExtension.php | 81 - .../Autoloader/Cli/AutoloaderController.php | 55 - .../ServiceContainer/AutoloaderExtension.php | 155 -- .../behat/src/Behat/Testwork/Call/Call.php | 47 - .../src/Behat/Testwork/Call/CallCenter.php | 190 -- .../src/Behat/Testwork/Call/CallResult.php | 117 - .../src/Behat/Testwork/Call/CallResults.php | 113 - .../behat/src/Behat/Testwork/Call/Callee.php | 63 - .../Call/Exception/BadCallbackException.php | 49 - .../Call/Exception/CallErrorException.php | 52 - .../Testwork/Call/Exception/CallException.php | 22 - .../Call/Exception/CallHandlingException.php | 50 - .../Call/Exception/FatalThrowableError.php | 55 - .../Behat/Testwork/Call/Filter/CallFilter.php | 42 - .../Testwork/Call/Filter/ResultFilter.php | 42 - .../Testwork/Call/Handler/CallHandler.php | 43 - .../Exception/ClassNotFoundHandler.php | 71 - .../Exception/MethodNotFoundHandler.php | 71 - .../Call/Handler/ExceptionHandler.php | 39 - .../Call/Handler/RuntimeCallHandler.php | 164 -- .../src/Behat/Testwork/Call/RuntimeCallee.php | 132 - .../Call/ServiceContainer/CallExtension.php | 189 -- .../src/Behat/Testwork/Cli/Application.php | 236 -- .../behat/src/Behat/Testwork/Cli/Command.php | 70 - .../src/Behat/Testwork/Cli/Controller.php | 42 - .../src/Behat/Testwork/Cli/DebugCommand.php | 82 - .../Testwork/Cli/DumpReferenceCommand.php | 57 - .../Cli/ServiceContainer/CliExtension.php | 123 - .../Counter/Exception/TimerException.php | 23 - .../src/Behat/Testwork/Counter/Memory.php | 62 - .../src/Behat/Testwork/Counter/Timer.php | 105 - .../Environment/Call/EnvironmentCall.php | 102 - .../Testwork/Environment/Environment.php | 38 - .../Environment/EnvironmentManager.php | 121 - .../Exception/EnvironmentBuildException.php | 50 - .../Exception/EnvironmentException.php | 22 - .../EnvironmentIsolationException.php | 66 - .../Exception/EnvironmentReadException.php | 50 - .../Handler/EnvironmentHandler.php | 63 - .../Handler/StaticEnvironmentHandler.php | 55 - .../Environment/Reader/EnvironmentReader.php | 43 - .../ServiceContainer/EnvironmentExtension.php | 147 -- .../Environment/StaticEnvironment.php | 53 - .../EventDispatcher/Cli/SigintController.php | 75 - .../Event/AfterExerciseAborted.php | 27 - .../Event/AfterExerciseCompleted.php | 80 - .../Event/AfterExerciseSetup.php | 63 - .../EventDispatcher/Event/AfterSetup.php | 28 - .../Event/AfterSuiteAborted.php | 29 - .../EventDispatcher/Event/AfterSuiteSetup.php | 67 - .../Event/AfterSuiteTested.php | 88 - .../EventDispatcher/Event/AfterTested.php | 36 - .../Event/BeforeExerciseCompleted.php | 46 - .../Event/BeforeExerciseTeardown.php | 63 - .../Event/BeforeSuiteTeardown.php | 67 - .../Event/BeforeSuiteTested.php | 50 - .../EventDispatcher/Event/BeforeTeardown.php | 28 - .../EventDispatcher/Event/BeforeTested.php | 20 - .../Event/ExerciseCompleted.php | 35 - .../EventDispatcher/Event/LifecycleEvent.php | 58 - .../EventDispatcher/Event/SuiteTested.php | 33 - .../EventDispatcherExtension.php | 165 -- .../Tester/EventDispatchingExercise.php | 93 - .../Tester/EventDispatchingSuiteTester.php | 94 - .../TestworkEventDispatcher.php | 66 - .../Exception/Cli/VerbosityController.php | 64 - .../Testwork/Exception/ExceptionPresenter.php | 151 -- .../ServiceContainer/ExceptionExtension.php | 169 -- .../Exception/Stringer/ExceptionStringer.php | 43 - .../Stringer/PHPUnitExceptionStringer.php | 51 - .../Stringer/TestworkExceptionStringer.php | 39 - .../Testwork/Exception/TestworkException.php | 20 - .../Filesystem/ConsoleFilesystemLogger.php | 84 - .../Testwork/Filesystem/FilesystemLogger.php | 43 - .../ServiceContainer/FilesystemExtension.php | 83 - .../Behat/Testwork/Hook/Call/AfterSuite.php | 43 - .../Behat/Testwork/Hook/Call/BeforeSuite.php | 43 - .../src/Behat/Testwork/Hook/Call/HookCall.php | 52 - .../Hook/Call/RuntimeFilterableHook.php | 59 - .../Behat/Testwork/Hook/Call/RuntimeHook.php | 57 - .../Testwork/Hook/Call/RuntimeSuiteHook.php | 83 - .../Behat/Testwork/Hook/FilterableHook.php | 30 - .../behat/src/Behat/Testwork/Hook/Hook.php | 42 - .../Behat/Testwork/Hook/HookDispatcher.php | 76 - .../Behat/Testwork/Hook/HookRepository.php | 77 - .../Testwork/Hook/Scope/AfterSuiteScope.php | 90 - .../Testwork/Hook/Scope/AfterTestScope.php | 28 - .../Testwork/Hook/Scope/BeforeSuiteScope.php | 75 - .../Behat/Testwork/Hook/Scope/HookScope.php | 48 - .../Behat/Testwork/Hook/Scope/SuiteScope.php | 31 - .../Hook/ServiceContainer/HookExtension.php | 116 - .../Hook/Tester/HookableSuiteTester.php | 92 - .../Hook/Tester/Setup/HookedSetup.php | 73 - .../Hook/Tester/Setup/HookedTeardown.php | 73 - .../Testwork/Ordering/Cli/OrderController.php | 99 - .../Exception/InvalidOrderException.php | 22 - .../Testwork/Ordering/OrderedExercise.php | 120 - .../Testwork/Ordering/Orderer/NoopOrderer.php | 39 - .../Testwork/Ordering/Orderer/Orderer.php | 32 - .../Ordering/Orderer/RandomOrderer.php | 62 - .../Ordering/Orderer/ReverseOrderer.php | 70 - .../ServiceContainer/OrderingExtension.php | 156 -- .../Testwork/Output/Cli/OutputController.php | 253 -- .../Exception/BadOutputPathException.php | 49 - .../Exception/FormatterNotFoundException.php | 47 - .../Output/Exception/OutputException.php | 22 - .../Output/Exception/PrinterException.php | 20 - .../src/Behat/Testwork/Output/Formatter.php | 62 - .../Node/EventListener/ChainEventListener.php | 66 - .../Node/EventListener/EventListener.php | 31 - .../FireOnlyIfFormatterParameterListener.php | 62 - .../Output/NodeEventListeningFormatter.php | 132 - .../Behat/Testwork/Output/OutputManager.php | 208 -- .../Printer/Factory/ConsoleOutputFactory.php | 112 - .../Factory/FilesystemOutputFactory.php | 71 - .../Output/Printer/Factory/OutputFactory.php | 129 - .../Output/Printer/JUnitOutputPrinter.php | 153 -- .../Testwork/Output/Printer/OutputPrinter.php | 119 - .../Output/Printer/StreamOutputPrinter.php | 149 -- .../Formatter/FormatterFactory.php | 35 - .../ServiceContainer/OutputExtension.php | 223 -- .../Configuration/ConfigurationLoader.php | 282 -- .../Configuration/ConfigurationTree.php | 44 - .../ServiceContainer/ContainerLoader.php | 163 -- .../ConfigurationLoadingException.php | 22 - .../Exception/ExtensionException.php | 49 - .../ExtensionInitializationException.php | 20 - .../Exception/ProcessingException.php | 22 - .../Exception/ServiceContainerException.php | 22 - .../Testwork/ServiceContainer/Extension.php | 60 - .../ServiceContainer/ExtensionManager.php | 231 -- .../ServiceContainer/ServiceProcessor.php | 87 - .../GroupedSpecificationIterator.php | 138 - .../Locator/SpecificationLocator.php | 42 - .../NoSpecificationsIterator.php | 49 - .../SpecificationExtension.php | 115 - .../SpecificationArrayIterator.php | 50 - .../Specification/SpecificationFinder.php | 88 - .../Specification/SpecificationIterator.php | 29 - .../Suite/Cli/InitializationController.php | 75 - .../Testwork/Suite/Cli/SuiteController.php | 83 - .../Exception/ParameterNotFoundException.php | 48 - .../Exception/SuiteConfigurationException.php | 20 - .../Suite/Exception/SuiteException.php | 52 - .../Exception/SuiteGenerationException.php | 20 - .../Exception/SuiteNotFoundException.php | 20 - .../Suite/Exception/SuiteSetupException.php | 20 - .../Suite/Generator/GenericSuiteGenerator.php | 64 - .../Suite/Generator/SuiteGenerator.php | 44 - .../src/Behat/Testwork/Suite/GenericSuite.php | 96 - .../Suite/ServiceContainer/SuiteExtension.php | 272 -- .../Behat/Testwork/Suite/Setup/SuiteSetup.php | 40 - .../behat/src/Behat/Testwork/Suite/Suite.php | 51 - .../Testwork/Suite/SuiteBootstrapper.php | 60 - .../Behat/Testwork/Suite/SuiteRegistry.php | 125 - .../Behat/Testwork/Suite/SuiteRepository.php | 26 - .../Tester/Cli/ExerciseController.php | 179 -- .../Testwork/Tester/Cli/StrictController.php | 70 - .../Tester/Exception/TesterException.php | 20 - .../Tester/Exception/WrongPathsException.php | 49 - .../src/Behat/Testwork/Tester/Exercise.php | 55 - .../Tester/Result/ExceptionResult.php | 35 - .../Tester/Result/IntegerTestResult.php | 50 - .../Interpretation/ResultInterpretation.php | 33 - .../Interpretation/SoftInterpretation.php | 29 - .../Interpretation/StrictInterpretation.php | 29 - .../Tester/Result/ResultInterpreter.php | 54 - .../Testwork/Tester/Result/TestResult.php | 38 - .../Testwork/Tester/Result/TestResults.php | 87 - .../Tester/Result/TestWithSetupResult.php | 73 - .../Tester/Runtime/RuntimeExercise.php | 88 - .../Tester/Runtime/RuntimeSuiteTester.php | 80 - .../ServiceContainer/TesterExtension.php | 250 -- .../Testwork/Tester/Setup/FailedSetup.php | 35 - .../Testwork/Tester/Setup/FailedTeardown.php | 35 - .../src/Behat/Testwork/Tester/Setup/Setup.php | 33 - .../Testwork/Tester/Setup/SuccessfulSetup.php | 35 - .../Tester/Setup/SuccessfulTeardown.php | 35 - .../Behat/Testwork/Tester/Setup/Teardown.php | 33 - .../Testwork/Tester/SpecificationTester.php | 58 - .../src/Behat/Testwork/Tester/SuiteTester.php | 59 - .../Translator/Cli/LanguageController.php | 63 - .../ServiceContainer/TranslatorExtension.php | 155 -- .../vendor/behat/gherkin/CHANGES.md | 442 ---- .../vendor/behat/gherkin/CONTRIBUTING.md | 33 - .../integration/vendor/behat/gherkin/LICENSE | 22 - .../vendor/behat/gherkin/README.md | 64 - .../vendor/behat/gherkin/composer.json | 67 - .../integration/vendor/behat/gherkin/i18n.php | 1245 --------- .../vendor/behat/gherkin/libpath.php | 3 - .../Behat/Gherkin/Cache/CacheInterface.php | 48 - .../src/Behat/Gherkin/Cache/FileCache.php | 109 - .../src/Behat/Gherkin/Cache/MemoryCache.php | 66 - .../Gherkin/Exception/CacheException.php | 22 - .../src/Behat/Gherkin/Exception/Exception.php | 15 - .../Gherkin/Exception/LexerException.php | 17 - .../Behat/Gherkin/Exception/NodeException.php | 17 - .../Gherkin/Exception/ParserException.php | 17 - .../Behat/Gherkin/Filter/ComplexFilter.php | 52 - .../Gherkin/Filter/ComplexFilterInterface.php | 32 - .../Gherkin/Filter/FeatureFilterInterface.php | 39 - .../Behat/Gherkin/Filter/FilterInterface.php | 30 - .../src/Behat/Gherkin/Filter/LineFilter.php | 124 - .../Behat/Gherkin/Filter/LineRangeFilter.php | 143 - .../src/Behat/Gherkin/Filter/NameFilter.php | 76 - .../Behat/Gherkin/Filter/NarrativeFilter.php | 61 - .../src/Behat/Gherkin/Filter/PathsFilter.php | 72 - .../src/Behat/Gherkin/Filter/RoleFilter.php | 63 - .../src/Behat/Gherkin/Filter/SimpleFilter.php | 56 - .../src/Behat/Gherkin/Filter/TagFilter.php | 159 -- .../gherkin/src/Behat/Gherkin/Gherkin.php | 142 - .../Behat/Gherkin/Keywords/ArrayKeywords.php | 200 -- .../Gherkin/Keywords/CachedArrayKeywords.php | 31 - .../Gherkin/Keywords/CucumberKeywords.php | 121 - .../Behat/Gherkin/Keywords/KeywordsDumper.php | 365 --- .../Gherkin/Keywords/KeywordsInterface.php | 103 - .../behat/gherkin/src/Behat/Gherkin/Lexer.php | 653 ----- .../Gherkin/Loader/AbstractFileLoader.php | 72 - .../src/Behat/Gherkin/Loader/ArrayLoader.php | 312 --- .../Behat/Gherkin/Loader/DirectoryLoader.php | 80 - .../Gherkin/Loader/FileLoaderInterface.php | 26 - .../Gherkin/Loader/GherkinFileLoader.php | 101 - .../Behat/Gherkin/Loader/LoaderInterface.php | 39 - .../Behat/Gherkin/Loader/YamlFileLoader.php | 72 - .../Behat/Gherkin/Node/ArgumentInterface.php | 20 - .../src/Behat/Gherkin/Node/BackgroundNode.php | 112 - .../src/Behat/Gherkin/Node/ExampleNode.php | 274 -- .../Behat/Gherkin/Node/ExampleTableNode.php | 73 - .../src/Behat/Gherkin/Node/FeatureNode.php | 271 -- .../Gherkin/Node/KeywordNodeInterface.php | 33 - .../src/Behat/Gherkin/Node/NodeInterface.php | 33 - .../src/Behat/Gherkin/Node/OutlineNode.php | 246 -- .../src/Behat/Gherkin/Node/PyStringNode.php | 90 - .../Behat/Gherkin/Node/ScenarioInterface.php | 20 - .../Gherkin/Node/ScenarioLikeInterface.php | 20 - .../src/Behat/Gherkin/Node/ScenarioNode.php | 150 -- .../Gherkin/Node/StepContainerInterface.php | 33 - .../src/Behat/Gherkin/Node/StepNode.php | 152 -- .../src/Behat/Gherkin/Node/TableNode.php | 383 --- .../Gherkin/Node/TaggedNodeInterface.php | 42 - .../gherkin/src/Behat/Gherkin/Parser.php | 771 ------ .../vendor/behat/transliterator/CHANGELOG.md | 31 - .../behat/transliterator/CONTRIBUTING.md | 18 - .../vendor/behat/transliterator/LICENSE | 128 - .../vendor/behat/transliterator/README.md | 24 - .../vendor/behat/transliterator/composer.json | 34 - .../src/Behat/Transliterator/SyncTool.php | 213 -- .../Behat/Transliterator/Transliterator.php | 590 ----- .../src/Behat/Transliterator/data/x00.php | 19 - .../src/Behat/Transliterator/data/x01.php | 19 - .../src/Behat/Transliterator/data/x02.php | 19 - .../src/Behat/Transliterator/data/x03.php | 19 - .../src/Behat/Transliterator/data/x04.php | 19 - .../src/Behat/Transliterator/data/x05.php | 19 - .../src/Behat/Transliterator/data/x06.php | 19 - .../src/Behat/Transliterator/data/x07.php | 19 - .../src/Behat/Transliterator/data/x09.php | 19 - .../src/Behat/Transliterator/data/x0a.php | 19 - .../src/Behat/Transliterator/data/x0b.php | 19 - .../src/Behat/Transliterator/data/x0c.php | 19 - .../src/Behat/Transliterator/data/x0d.php | 19 - .../src/Behat/Transliterator/data/x0e.php | 19 - .../src/Behat/Transliterator/data/x0f.php | 19 - .../src/Behat/Transliterator/data/x10.php | 19 - .../src/Behat/Transliterator/data/x11.php | 19 - .../src/Behat/Transliterator/data/x12.php | 19 - .../src/Behat/Transliterator/data/x13.php | 19 - .../src/Behat/Transliterator/data/x14.php | 19 - .../src/Behat/Transliterator/data/x15.php | 19 - .../src/Behat/Transliterator/data/x16.php | 19 - .../src/Behat/Transliterator/data/x17.php | 19 - .../src/Behat/Transliterator/data/x18.php | 19 - .../src/Behat/Transliterator/data/x1e.php | 19 - .../src/Behat/Transliterator/data/x1f.php | 19 - .../src/Behat/Transliterator/data/x20.php | 19 - .../src/Behat/Transliterator/data/x21.php | 19 - .../src/Behat/Transliterator/data/x24.php | 19 - .../src/Behat/Transliterator/data/x25.php | 19 - .../src/Behat/Transliterator/data/x26.php | 19 - .../src/Behat/Transliterator/data/x27.php | 19 - .../src/Behat/Transliterator/data/x28.php | 19 - .../src/Behat/Transliterator/data/x30.php | 19 - .../src/Behat/Transliterator/data/x31.php | 19 - .../src/Behat/Transliterator/data/x32.php | 19 - .../src/Behat/Transliterator/data/x33.php | 19 - .../src/Behat/Transliterator/data/x4e.php | 19 - .../src/Behat/Transliterator/data/x4f.php | 19 - .../src/Behat/Transliterator/data/x50.php | 19 - .../src/Behat/Transliterator/data/x51.php | 19 - .../src/Behat/Transliterator/data/x52.php | 19 - .../src/Behat/Transliterator/data/x53.php | 19 - .../src/Behat/Transliterator/data/x54.php | 19 - .../src/Behat/Transliterator/data/x55.php | 19 - .../src/Behat/Transliterator/data/x56.php | 19 - .../src/Behat/Transliterator/data/x57.php | 19 - .../src/Behat/Transliterator/data/x58.php | 19 - .../src/Behat/Transliterator/data/x59.php | 19 - .../src/Behat/Transliterator/data/x5a.php | 19 - .../src/Behat/Transliterator/data/x5b.php | 19 - .../src/Behat/Transliterator/data/x5c.php | 19 - .../src/Behat/Transliterator/data/x5d.php | 19 - .../src/Behat/Transliterator/data/x5e.php | 19 - .../src/Behat/Transliterator/data/x5f.php | 19 - .../src/Behat/Transliterator/data/x60.php | 19 - .../src/Behat/Transliterator/data/x61.php | 19 - .../src/Behat/Transliterator/data/x62.php | 19 - .../src/Behat/Transliterator/data/x63.php | 19 - .../src/Behat/Transliterator/data/x64.php | 19 - .../src/Behat/Transliterator/data/x65.php | 19 - .../src/Behat/Transliterator/data/x66.php | 19 - .../src/Behat/Transliterator/data/x67.php | 19 - .../src/Behat/Transliterator/data/x68.php | 19 - .../src/Behat/Transliterator/data/x69.php | 19 - .../src/Behat/Transliterator/data/x6a.php | 19 - .../src/Behat/Transliterator/data/x6b.php | 19 - .../src/Behat/Transliterator/data/x6c.php | 19 - .../src/Behat/Transliterator/data/x6d.php | 19 - .../src/Behat/Transliterator/data/x6e.php | 19 - .../src/Behat/Transliterator/data/x6f.php | 19 - .../src/Behat/Transliterator/data/x70.php | 19 - .../src/Behat/Transliterator/data/x71.php | 19 - .../src/Behat/Transliterator/data/x72.php | 19 - .../src/Behat/Transliterator/data/x73.php | 19 - .../src/Behat/Transliterator/data/x74.php | 19 - .../src/Behat/Transliterator/data/x75.php | 19 - .../src/Behat/Transliterator/data/x76.php | 19 - .../src/Behat/Transliterator/data/x77.php | 19 - .../src/Behat/Transliterator/data/x78.php | 19 - .../src/Behat/Transliterator/data/x79.php | 19 - .../src/Behat/Transliterator/data/x7a.php | 19 - .../src/Behat/Transliterator/data/x7b.php | 19 - .../src/Behat/Transliterator/data/x7c.php | 19 - .../src/Behat/Transliterator/data/x7d.php | 19 - .../src/Behat/Transliterator/data/x7e.php | 19 - .../src/Behat/Transliterator/data/x7f.php | 19 - .../src/Behat/Transliterator/data/x80.php | 19 - .../src/Behat/Transliterator/data/x81.php | 19 - .../src/Behat/Transliterator/data/x82.php | 19 - .../src/Behat/Transliterator/data/x83.php | 19 - .../src/Behat/Transliterator/data/x84.php | 19 - .../src/Behat/Transliterator/data/x85.php | 19 - .../src/Behat/Transliterator/data/x86.php | 19 - .../src/Behat/Transliterator/data/x87.php | 19 - .../src/Behat/Transliterator/data/x88.php | 19 - .../src/Behat/Transliterator/data/x89.php | 19 - .../src/Behat/Transliterator/data/x8a.php | 19 - .../src/Behat/Transliterator/data/x8b.php | 19 - .../src/Behat/Transliterator/data/x8c.php | 19 - .../src/Behat/Transliterator/data/x8d.php | 19 - .../src/Behat/Transliterator/data/x8e.php | 19 - .../src/Behat/Transliterator/data/x8f.php | 19 - .../src/Behat/Transliterator/data/x90.php | 19 - .../src/Behat/Transliterator/data/x91.php | 19 - .../src/Behat/Transliterator/data/x92.php | 19 - .../src/Behat/Transliterator/data/x93.php | 19 - .../src/Behat/Transliterator/data/x94.php | 19 - .../src/Behat/Transliterator/data/x95.php | 19 - .../src/Behat/Transliterator/data/x96.php | 19 - .../src/Behat/Transliterator/data/x97.php | 19 - .../src/Behat/Transliterator/data/x98.php | 19 - .../src/Behat/Transliterator/data/x99.php | 19 - .../src/Behat/Transliterator/data/x9a.php | 19 - .../src/Behat/Transliterator/data/x9b.php | 19 - .../src/Behat/Transliterator/data/x9c.php | 19 - .../src/Behat/Transliterator/data/x9d.php | 19 - .../src/Behat/Transliterator/data/x9e.php | 19 - .../src/Behat/Transliterator/data/x9f.php | 19 - .../src/Behat/Transliterator/data/xa0.php | 19 - .../src/Behat/Transliterator/data/xa1.php | 19 - .../src/Behat/Transliterator/data/xa2.php | 19 - .../src/Behat/Transliterator/data/xa3.php | 19 - .../src/Behat/Transliterator/data/xa4.php | 19 - .../src/Behat/Transliterator/data/xac.php | 19 - .../src/Behat/Transliterator/data/xad.php | 19 - .../src/Behat/Transliterator/data/xae.php | 19 - .../src/Behat/Transliterator/data/xaf.php | 19 - .../src/Behat/Transliterator/data/xb0.php | 19 - .../src/Behat/Transliterator/data/xb1.php | 19 - .../src/Behat/Transliterator/data/xb2.php | 19 - .../src/Behat/Transliterator/data/xb3.php | 19 - .../src/Behat/Transliterator/data/xb4.php | 19 - .../src/Behat/Transliterator/data/xb5.php | 19 - .../src/Behat/Transliterator/data/xb6.php | 19 - .../src/Behat/Transliterator/data/xb7.php | 19 - .../src/Behat/Transliterator/data/xb8.php | 19 - .../src/Behat/Transliterator/data/xb9.php | 19 - .../src/Behat/Transliterator/data/xba.php | 19 - .../src/Behat/Transliterator/data/xbb.php | 19 - .../src/Behat/Transliterator/data/xbc.php | 19 - .../src/Behat/Transliterator/data/xbd.php | 19 - .../src/Behat/Transliterator/data/xbe.php | 19 - .../src/Behat/Transliterator/data/xbf.php | 19 - .../src/Behat/Transliterator/data/xc0.php | 19 - .../src/Behat/Transliterator/data/xc1.php | 19 - .../src/Behat/Transliterator/data/xc2.php | 19 - .../src/Behat/Transliterator/data/xc3.php | 19 - .../src/Behat/Transliterator/data/xc4.php | 19 - .../src/Behat/Transliterator/data/xc5.php | 19 - .../src/Behat/Transliterator/data/xc6.php | 19 - .../src/Behat/Transliterator/data/xc7.php | 19 - .../src/Behat/Transliterator/data/xc8.php | 19 - .../src/Behat/Transliterator/data/xc9.php | 19 - .../src/Behat/Transliterator/data/xca.php | 19 - .../src/Behat/Transliterator/data/xcb.php | 19 - .../src/Behat/Transliterator/data/xcc.php | 19 - .../src/Behat/Transliterator/data/xcd.php | 19 - .../src/Behat/Transliterator/data/xce.php | 19 - .../src/Behat/Transliterator/data/xcf.php | 19 - .../src/Behat/Transliterator/data/xd0.php | 19 - .../src/Behat/Transliterator/data/xd1.php | 19 - .../src/Behat/Transliterator/data/xd2.php | 19 - .../src/Behat/Transliterator/data/xd3.php | 19 - .../src/Behat/Transliterator/data/xd4.php | 19 - .../src/Behat/Transliterator/data/xd5.php | 19 - .../src/Behat/Transliterator/data/xd6.php | 19 - .../src/Behat/Transliterator/data/xd7.php | 19 - .../src/Behat/Transliterator/data/xf9.php | 19 - .../src/Behat/Transliterator/data/xfa.php | 19 - .../src/Behat/Transliterator/data/xfb.php | 19 - .../src/Behat/Transliterator/data/xfc.php | 19 - .../src/Behat/Transliterator/data/xfd.php | 19 - .../src/Behat/Transliterator/data/xfe.php | 19 - .../src/Behat/Transliterator/data/xff.php | 19 - tests/integration/vendor/bin/behat | 119 - .../vendor/composer/ClassLoader.php | 579 ---- tests/integration/vendor/composer/LICENSE | 21 - .../vendor/composer/autoload_classmap.php | 11 - .../vendor/composer/autoload_files.php | 22 - .../vendor/composer/autoload_namespaces.php | 10 - .../vendor/composer/autoload_psr4.php | 38 - .../vendor/composer/autoload_real.php | 50 - .../vendor/composer/autoload_static.php | 213 -- .../vendor/composer/installed.json | 2325 ---------------- .../vendor/guzzlehttp/guzzle/CHANGELOG.md | 1352 ---------- .../vendor/guzzlehttp/guzzle/LICENSE | 27 - .../vendor/guzzlehttp/guzzle/README.md | 97 - .../vendor/guzzlehttp/guzzle/UPGRADING.md | 1203 --------- .../vendor/guzzlehttp/guzzle/composer.json | 92 - .../vendor/guzzlehttp/guzzle/src/Client.php | 501 ---- .../guzzlehttp/guzzle/src/ClientInterface.php | 87 - .../guzzle/src/Cookie/CookieJar.php | 321 --- .../guzzle/src/Cookie/CookieJarInterface.php | 84 - .../guzzle/src/Cookie/FileCookieJar.php | 91 - .../guzzle/src/Cookie/SessionCookieJar.php | 72 - .../guzzle/src/Cookie/SetCookie.php | 410 --- .../src/Exception/BadResponseException.php | 27 - .../guzzle/src/Exception/ClientException.php | 9 - .../guzzle/src/Exception/ConnectException.php | 37 - .../guzzle/src/Exception/GuzzleException.php | 23 - .../guzzle/src/Exception/RequestException.php | 192 -- .../guzzle/src/Exception/SeekException.php | 27 - .../guzzle/src/Exception/ServerException.php | 9 - .../Exception/TooManyRedirectsException.php | 6 - .../src/Exception/TransferException.php | 6 - .../guzzle/src/Handler/CurlFactory.php | 585 ---- .../src/Handler/CurlFactoryInterface.php | 27 - .../guzzle/src/Handler/CurlHandler.php | 45 - .../guzzle/src/Handler/CurlMultiHandler.php | 219 -- .../guzzle/src/Handler/EasyHandle.php | 92 - .../guzzle/src/Handler/MockHandler.php | 195 -- .../guzzlehttp/guzzle/src/Handler/Proxy.php | 55 - .../guzzle/src/Handler/StreamHandler.php | 545 ---- .../guzzlehttp/guzzle/src/HandlerStack.php | 277 -- .../guzzle/src/MessageFormatter.php | 185 -- .../guzzlehttp/guzzle/src/Middleware.php | 254 -- .../vendor/guzzlehttp/guzzle/src/Pool.php | 134 - .../guzzle/src/PrepareBodyMiddleware.php | 111 - .../guzzle/src/RedirectMiddleware.php | 264 -- .../guzzlehttp/guzzle/src/RequestOptions.php | 263 -- .../guzzlehttp/guzzle/src/RetryMiddleware.php | 128 - .../guzzlehttp/guzzle/src/TransferStats.php | 126 - .../guzzlehttp/guzzle/src/UriTemplate.php | 237 -- .../guzzlehttp/guzzle/src/functions.php | 334 --- .../guzzle/src/functions_include.php | 6 - .../vendor/guzzlehttp/promises/CHANGELOG.md | 116 - .../vendor/guzzlehttp/promises/LICENSE | 24 - .../vendor/guzzlehttp/promises/README.md | 546 ---- .../vendor/guzzlehttp/promises/composer.json | 53 - .../promises/src/AggregateException.php | 17 - .../promises/src/CancellationException.php | 10 - .../guzzlehttp/promises/src/Coroutine.php | 169 -- .../guzzlehttp/promises/src/EachPromise.php | 247 -- .../promises/src/FulfilledPromise.php | 84 - .../guzzlehttp/promises/src/Promise.php | 278 -- .../promises/src/PromiseInterface.php | 97 - .../promises/src/PromisorInterface.php | 16 - .../promises/src/RejectedPromise.php | 91 - .../promises/src/RejectionException.php | 48 - .../guzzlehttp/promises/src/TaskQueue.php | 67 - .../promises/src/TaskQueueInterface.php | 24 - .../guzzlehttp/promises/src/functions.php | 363 --- .../promises/src/functions_include.php | 6 - .../vendor/guzzlehttp/psr7/CHANGELOG.md | 324 --- .../vendor/guzzlehttp/psr7/LICENSE | 26 - .../vendor/guzzlehttp/psr7/README.md | 844 ------ .../vendor/guzzlehttp/psr7/composer.json | 71 - .../guzzlehttp/psr7/src/AppendStream.php | 246 -- .../guzzlehttp/psr7/src/BufferStream.php | 142 - .../guzzlehttp/psr7/src/CachingStream.php | 147 -- .../guzzlehttp/psr7/src/DroppingStream.php | 45 - .../vendor/guzzlehttp/psr7/src/FnStream.php | 163 -- .../guzzlehttp/psr7/src/InflateStream.php | 56 - .../guzzlehttp/psr7/src/LazyOpenStream.php | 42 - .../guzzlehttp/psr7/src/LimitStream.php | 157 -- .../guzzlehttp/psr7/src/MessageTrait.php | 269 -- .../guzzlehttp/psr7/src/MultipartStream.php | 158 -- .../guzzlehttp/psr7/src/NoSeekStream.php | 25 - .../vendor/guzzlehttp/psr7/src/PumpStream.php | 170 -- .../vendor/guzzlehttp/psr7/src/Request.php | 152 -- .../vendor/guzzlehttp/psr7/src/Response.php | 155 -- .../guzzlehttp/psr7/src/ServerRequest.php | 379 --- .../vendor/guzzlehttp/psr7/src/Stream.php | 270 -- .../psr7/src/StreamDecoratorTrait.php | 152 -- .../guzzlehttp/psr7/src/StreamWrapper.php | 165 -- .../guzzlehttp/psr7/src/UploadedFile.php | 328 --- .../vendor/guzzlehttp/psr7/src/Uri.php | 810 ------ .../guzzlehttp/psr7/src/UriNormalizer.php | 219 -- .../guzzlehttp/psr7/src/UriResolver.php | 222 -- .../vendor/guzzlehttp/psr7/src/functions.php | 422 --- .../guzzlehttp/psr7/src/functions_include.php | 6 - .../vendor/psr/container/.gitignore | 3 - .../integration/vendor/psr/container/LICENSE | 21 - .../vendor/psr/container/README.md | 13 - .../vendor/psr/container/composer.json | 27 - .../src/ContainerExceptionInterface.php | 12 - .../psr/container/src/ContainerInterface.php | 36 - .../src/NotFoundExceptionInterface.php | 10 - .../vendor/psr/http-message/CHANGELOG.md | 36 - .../vendor/psr/http-message/LICENSE | 19 - .../vendor/psr/http-message/README.md | 16 - .../vendor/psr/http-message/composer.json | 26 - .../psr/http-message/src/MessageInterface.php | 189 -- .../psr/http-message/src/RequestInterface.php | 131 - .../http-message/src/ResponseInterface.php | 70 - .../src/ServerRequestInterface.php | 263 -- .../psr/http-message/src/StreamInterface.php | 160 -- .../src/UploadedFileInterface.php | 125 - .../psr/http-message/src/UriInterface.php | 326 --- .../vendor/symfony/config/CHANGELOG.md | 153 -- .../vendor/symfony/config/ConfigCache.php | 60 - .../symfony/config/ConfigCacheFactory.php | 44 - .../config/ConfigCacheFactoryInterface.php | 30 - .../symfony/config/ConfigCacheInterface.php | 47 - .../symfony/config/Definition/ArrayNode.php | 402 --- .../symfony/config/Definition/BaseNode.php | 542 ---- .../symfony/config/Definition/BooleanNode.php | 49 - .../Builder/ArrayNodeDefinition.php | 516 ---- .../Builder/BooleanNodeDefinition.php | 46 - .../Definition/Builder/EnumNodeDefinition.php | 52 - .../config/Definition/Builder/ExprBuilder.php | 252 -- .../Builder/FloatNodeDefinition.php | 30 - .../Builder/IntegerNodeDefinition.php | 30 - .../Definition/Builder/MergeBuilder.php | 61 - .../config/Definition/Builder/NodeBuilder.php | 204 -- .../Definition/Builder/NodeDefinition.php | 336 --- .../Builder/NodeParentInterface.php | 21 - .../Builder/NormalizationBuilder.php | 61 - .../Builder/NumericNodeDefinition.php | 67 - .../Builder/ParentNodeDefinitionInterface.php | 49 - .../Builder/ScalarNodeDefinition.php | 30 - .../config/Definition/Builder/TreeBuilder.php | 64 - .../Definition/Builder/ValidationBuilder.php | 44 - .../Builder/VariableNodeDefinition.php | 64 - .../Definition/ConfigurationInterface.php | 29 - .../Definition/Dumper/XmlReferenceDumper.php | 299 --- .../Definition/Dumper/YamlReferenceDumper.php | 260 -- .../symfony/config/Definition/EnumNode.php | 96 - .../Exception/DuplicateKeyException.php | 22 - .../config/Definition/Exception/Exception.php | 21 - .../Exception/ForbiddenOverwriteException.php | 22 - .../InvalidConfigurationException.php | 52 - .../Exception/InvalidDefinitionException.php | 21 - .../Exception/InvalidTypeException.php | 21 - .../Exception/UnsetKeyException.php | 22 - .../symfony/config/Definition/FloatNode.php | 48 - .../symfony/config/Definition/IntegerNode.php | 43 - .../config/Definition/NodeInterface.php | 77 - .../symfony/config/Definition/NumericNode.php | 58 - .../symfony/config/Definition/Processor.php | 89 - .../Definition/PrototypeNodeInterface.php | 27 - .../config/Definition/PrototypedArrayNode.php | 343 --- .../symfony/config/Definition/ScalarNode.php | 61 - .../config/Definition/VariableNode.php | 128 - ...LoaderImportCircularReferenceException.php | 27 - .../FileLocatorFileNotFoundException.php | 37 - .../vendor/symfony/config/FileLocator.php | 94 - .../symfony/config/FileLocatorInterface.php | 34 - .../integration/vendor/symfony/config/LICENSE | 19 - .../config/Loader/DelegatingLoader.php | 44 - .../symfony/config/Loader/FileLoader.php | 188 -- .../symfony/config/Loader/GlobFileLoader.php | 30 - .../vendor/symfony/config/Loader/Loader.php | 73 - .../symfony/config/Loader/LoaderInterface.php | 52 - .../symfony/config/Loader/LoaderResolver.php | 68 - .../config/Loader/LoaderResolverInterface.php | 27 - .../vendor/symfony/config/README.md | 15 - .../Resource/ClassExistenceResource.php | 227 -- .../config/Resource/ComposerResource.php | 64 - .../config/Resource/DirectoryResource.php | 96 - .../config/Resource/FileExistenceResource.php | 53 - .../symfony/config/Resource/FileResource.php | 60 - .../symfony/config/Resource/GlobResource.php | 249 -- .../Resource/ReflectionClassResource.php | 206 -- .../config/Resource/ResourceInterface.php | 31 - .../Resource/SelfCheckingResourceChecker.php | 46 - .../SelfCheckingResourceInterface.php | 28 - .../config/ResourceCheckerConfigCache.php | 181 -- .../ResourceCheckerConfigCacheFactory.php | 41 - .../config/ResourceCheckerInterface.php | 45 - .../vendor/symfony/config/Util/XmlUtils.php | 272 -- .../vendor/symfony/config/composer.json | 42 - .../vendor/symfony/console/Application.php | 1316 --------- .../vendor/symfony/console/CHANGELOG.md | 252 -- .../symfony/console/Command/Command.php | 725 ----- .../symfony/console/Command/HelpCommand.php | 82 - .../symfony/console/Command/ListCommand.php | 75 - .../symfony/console/Command/LockableTrait.php | 68 - .../vendor/symfony/console/ConsoleEvents.php | 72 - .../AddConsoleCommandPass.php | 134 - .../Descriptor/ApplicationDescription.php | 139 - .../symfony/console/Descriptor/Descriptor.php | 74 - .../Descriptor/DescriptorInterface.php | 27 - .../console/Descriptor/JsonDescriptor.php | 166 -- .../console/Descriptor/MarkdownDescriptor.php | 173 -- .../console/Descriptor/TextDescriptor.php | 317 --- .../console/Descriptor/XmlDescriptor.php | 232 -- .../console/Event/ConsoleCommandEvent.php | 51 - .../console/Event/ConsoleErrorEvent.php | 57 - .../symfony/console/Event/ConsoleEvent.php | 61 - .../console/Event/ConsoleTerminateEvent.php | 43 - .../console/EventListener/ErrorListener.php | 101 - .../Exception/CommandNotFoundException.php | 43 - .../console/Exception/ExceptionInterface.php | 21 - .../Exception/InvalidArgumentException.php | 19 - .../Exception/InvalidOptionException.php | 21 - .../console/Exception/LogicException.php | 19 - .../console/Exception/RuntimeException.php | 19 - .../console/Formatter/OutputFormatter.php | 268 -- .../Formatter/OutputFormatterInterface.php | 56 - .../Formatter/OutputFormatterStyle.php | 110 - .../OutputFormatterStyleInterface.php | 60 - .../Formatter/OutputFormatterStyleStack.php | 107 - .../console/Helper/DebugFormatterHelper.php | 98 - .../console/Helper/DescriptorHelper.php | 93 - .../console/Helper/FormatterHelper.php | 81 - .../vendor/symfony/console/Helper/Helper.php | 163 -- .../console/Helper/HelperInterface.php | 39 - .../symfony/console/Helper/HelperSet.php | 77 - .../console/Helper/InputAwareHelper.php | 33 - .../symfony/console/Helper/ProcessHelper.php | 137 - .../symfony/console/Helper/ProgressBar.php | 612 ----- .../console/Helper/ProgressIndicator.php | 235 -- .../symfony/console/Helper/QuestionHelper.php | 612 ----- .../console/Helper/SymfonyQuestionHelper.php | 109 - .../vendor/symfony/console/Helper/Table.php | 914 ------- .../symfony/console/Helper/TableCell.php | 72 - .../symfony/console/Helper/TableSeparator.php | 25 - .../symfony/console/Helper/TableStyle.php | 362 --- .../symfony/console/Input/ArgvInput.php | 370 --- .../symfony/console/Input/ArrayInput.php | 196 -- .../vendor/symfony/console/Input/Input.php | 192 -- .../symfony/console/Input/InputArgument.php | 154 -- .../console/Input/InputAwareInterface.php | 28 - .../symfony/console/Input/InputDefinition.php | 416 --- .../symfony/console/Input/InputInterface.php | 150 -- .../symfony/console/Input/InputOption.php | 255 -- .../Input/StreamableInputInterface.php | 39 - .../symfony/console/Input/StringInput.php | 87 - .../vendor/symfony/console/LICENSE | 19 - .../symfony/console/Logger/ConsoleLogger.php | 119 - .../symfony/console/Output/BufferedOutput.php | 43 - .../symfony/console/Output/ConsoleOutput.php | 165 -- .../console/Output/ConsoleOutputInterface.php | 33 - .../symfony/console/Output/NullOutput.php | 104 - .../vendor/symfony/console/Output/Output.php | 155 -- .../console/Output/OutputInterface.php | 107 - .../symfony/console/Output/StreamOutput.php | 113 - .../console/Question/ChoiceQuestion.php | 177 -- .../console/Question/ConfirmationQuestion.php | 57 - .../symfony/console/Question/Question.php | 291 -- .../vendor/symfony/console/README.md | 36 - .../console/Resources/bin/hiddeninput.exe | Bin 9216 -> 0 bytes .../symfony/console/Style/OutputStyle.php | 132 - .../symfony/console/Style/StyleInterface.php | 138 - .../symfony/console/Style/SymfonyStyle.php | 506 ---- .../vendor/symfony/console/Terminal.php | 236 -- .../console/Tester/ApplicationTester.php | 85 - .../symfony/console/Tester/CommandTester.php | 76 - .../vendor/symfony/console/composer.json | 51 - .../symfony/dependency-injection/Alias.php | 108 - .../Argument/ArgumentInterface.php | 27 - .../Argument/IteratorArgument.php | 40 - .../Argument/RewindableGenerator.php | 43 - .../Argument/ServiceClosureArgument.php | 46 - .../symfony/dependency-injection/CHANGELOG.md | 363 --- .../dependency-injection/ChildDefinition.php | 95 - .../Compiler/AbstractRecursivePass.php | 255 -- .../Compiler/AnalyzeServiceReferencesPass.php | 203 -- .../Compiler/AutoAliasServicePass.php | 42 - .../Compiler/AutowirePass.php | 717 ----- .../Compiler/CheckArgumentsValidityPass.php | 116 - .../Compiler/CheckCircularReferencesPass.php | 80 - .../Compiler/CheckDefinitionValidityPass.php | 100 - ...xceptionOnInvalidReferenceBehaviorPass.php | 105 - .../Compiler/CheckReferenceValidityPass.php | 43 - .../Compiler/Compiler.php | 104 - .../Compiler/CompilerPassInterface.php | 29 - .../Compiler/DecoratorServicePass.php | 131 - .../Compiler/ExtensionCompilerPass.php | 37 - .../Compiler/InlineServiceDefinitionsPass.php | 227 -- .../MergeExtensionConfigurationPass.php | 207 -- .../Compiler/PassConfig.php | 287 -- .../Compiler/PriorityTaggedServiceTrait.php | 171 -- .../RegisterServiceSubscribersPass.php | 141 - .../RemoveAbstractDefinitionsPass.php | 35 - .../Compiler/RemovePrivateAliasesPass.php | 41 - .../Compiler/RemoveUnusedDefinitionsPass.php | 89 - .../ReplaceAliasByActualDefinitionPass.php | 101 - .../Compiler/ResolveClassPass.php | 40 - .../Compiler/ResolveFactoryClassPass.php | 35 - .../ResolveInstanceofConditionalsPass.php | 178 -- .../Compiler/ResolveInvalidReferencesPass.php | 136 - .../Compiler/ResolveNamedArgumentsPass.php | 135 - .../ResolveParameterPlaceHoldersPass.php | 102 - .../ResolveReferencesToAliasesPass.php | 81 - .../ResolveServiceSubscribersPass.php | 52 - .../Compiler/ServiceLocatorTagPass.php | 135 - .../Compiler/ServiceReferenceGraph.php | 99 - .../Compiler/ServiceReferenceGraphEdge.php | 87 - .../Compiler/ServiceReferenceGraphNode.php | 114 - .../Config/ContainerParametersResource.php | 44 - .../ContainerParametersResourceChecker.php | 45 - .../dependency-injection/Container.php | 420 --- .../ContainerAwareInterface.php | 27 - .../ContainerAwareTrait.php | 37 - .../dependency-injection/ContainerBuilder.php | 1721 ------------ .../ContainerInterface.php | 72 - .../dependency-injection/Definition.php | 813 ------ .../dependency-injection/Dumper/Dumper.php | 29 - .../Dumper/DumperInterface.php | 25 - .../Dumper/GraphvizDumper.php | 249 -- .../dependency-injection/Dumper/PhpDumper.php | 2342 ----------------- .../dependency-injection/Dumper/XmlDumper.php | 431 --- .../Dumper/YamlDumper.php | 380 --- .../Exception/AutowiringFailedException.php | 77 - .../Exception/BadMethodCallException.php | 19 - .../Exception/EnvNotFoundException.php | 21 - .../Exception/EnvParameterException.php | 25 - .../Exception/ExceptionInterface.php | 24 - .../Exception/InvalidArgumentException.php | 21 - .../Exception/LogicException.php | 19 - .../Exception/OutOfBoundsException.php | 19 - .../ParameterCircularReferenceException.php | 37 - .../Exception/ParameterNotFoundException.php | 120 - .../Exception/RuntimeException.php | 21 - .../ServiceCircularReferenceException.php | 47 - .../Exception/ServiceNotFoundException.php | 76 - .../ExpressionLanguage.php | 37 - .../ExpressionLanguageProvider.php | 57 - .../ConfigurationExtensionInterface.php | 30 - .../Extension/Extension.php | 135 - .../Extension/ExtensionInterface.php | 56 - .../Extension/PrependExtensionInterface.php | 24 - .../symfony/dependency-injection/LICENSE | 19 - .../Instantiator/InstantiatorInterface.php | 34 - .../Instantiator/RealServiceInstantiator.php | 28 - .../LazyProxy/PhpDumper/DumperInterface.php | 42 - .../LazyProxy/PhpDumper/NullDumper.php | 39 - .../LazyProxy/ProxyHelper.php | 95 - .../Loader/ClosureLoader.php | 43 - .../Loader/DirectoryLoader.php | 50 - .../Loader/FileLoader.php | 329 --- .../Loader/IniFileLoader.php | 98 - .../Loader/PhpFileLoader.php | 206 -- .../Loader/XmlFileLoader.php | 863 ------ .../Loader/YamlFileLoader.php | 985 ------- .../schema/dic/services/services-1.0.xsd | 396 --- .../dependency-injection/Parameter.php | 32 - .../EnvPlaceholderParameterBag.php | 158 -- .../ParameterBag/FrozenParameterBag.php | 76 - .../ParameterBag/ParameterBag.php | 301 --- .../ParameterBag/ParameterBagInterface.php | 100 - .../symfony/dependency-injection/README.md | 14 - .../dependency-injection/Reference.php | 42 - .../dependency-injection/ServiceLocator.php | 151 -- .../TaggedContainerInterface.php | 27 - .../dependency-injection/TypedReference.php | 57 - .../symfony/dependency-injection/Variable.php | 40 - .../dependency-injection/composer.json | 48 - .../symfony/event-dispatcher/CHANGELOG.md | 96 - .../Debug/TraceableEventDispatcher.php | 376 --- .../Debug/WrappedListener.php | 144 - .../RegisterListenersPass.php | 216 -- .../event-dispatcher/EventDispatcher.php | 270 -- .../EventDispatcherInterface.php | 75 - .../EventSubscriberInterface.php | 49 - .../symfony/event-dispatcher/GenericEvent.php | 158 -- .../ImmutableEventDispatcher.php | 79 - .../vendor/symfony/event-dispatcher/LICENSE | 19 - .../vendor/symfony/event-dispatcher/README.md | 15 - .../symfony/event-dispatcher/composer.json | 47 - .../vendor/symfony/filesystem/CHANGELOG.md | 82 - .../Exception/ExceptionInterface.php | 21 - .../Exception/FileNotFoundException.php | 34 - .../filesystem/Exception/IOException.php | 36 - .../Exception/IOExceptionInterface.php | 25 - .../vendor/symfony/filesystem/Filesystem.php | 767 ------ .../vendor/symfony/filesystem/LICENSE | 19 - .../vendor/symfony/filesystem/README.md | 13 - .../vendor/symfony/filesystem/composer.json | 30 - .../vendor/symfony/polyfill-mbstring/LICENSE | 19 - .../symfony/polyfill-mbstring/Mbstring.php | 874 ------ .../symfony/polyfill-mbstring/README.md | 13 - .../Resources/unidata/lowerCase.php | 1397 ---------- .../Resources/unidata/upperCase.php | 1489 ----------- .../symfony/polyfill-mbstring/bootstrap.php | 147 -- .../symfony/polyfill-mbstring/composer.json | 41 - .../vendor/symfony/translation/CHANGELOG.md | 196 -- .../Catalogue/AbstractOperation.php | 190 -- .../translation/Catalogue/MergeOperation.php | 72 - .../Catalogue/OperationInterface.php | 61 - .../translation/Catalogue/TargetOperation.php | 86 - .../translation/Command/XliffLintCommand.php | 285 -- .../TranslationDataCollector.php | 148 -- .../translation/DataCollectorTranslator.php | 146 - .../translation/Dumper/CsvFileDumper.php | 56 - .../translation/Dumper/DumperInterface.php | 32 - .../symfony/translation/Dumper/FileDumper.php | 110 - .../translation/Dumper/IcuResFileDumper.php | 95 - .../translation/Dumper/IniFileDumper.php | 39 - .../translation/Dumper/JsonFileDumper.php | 34 - .../translation/Dumper/MoFileDumper.php | 76 - .../translation/Dumper/PhpFileDumper.php | 32 - .../translation/Dumper/PoFileDumper.php | 131 - .../translation/Dumper/QtFileDumper.php | 55 - .../translation/Dumper/XliffFileDumper.php | 221 -- .../translation/Dumper/YamlFileDumper.php | 56 - .../Exception/ExceptionInterface.php | 21 - .../Exception/InvalidArgumentException.php | 21 - .../Exception/InvalidResourceException.php | 21 - .../translation/Exception/LogicException.php | 21 - .../Exception/NotFoundResourceException.php | 21 - .../Exception/RuntimeException.php | 21 - .../Extractor/AbstractFileExtractor.php | 67 - .../translation/Extractor/ChainExtractor.php | 59 - .../Extractor/ExtractorInterface.php | 39 - .../translation/IdentityTranslator.php | 26 - .../vendor/symfony/translation/LICENSE | 19 - .../translation/Loader/ArrayLoader.php | 57 - .../translation/Loader/CsvFileLoader.php | 64 - .../symfony/translation/Loader/FileLoader.php | 57 - .../translation/Loader/IcuDatFileLoader.php | 58 - .../translation/Loader/IcuResFileLoader.php | 86 - .../translation/Loader/IniFileLoader.php | 25 - .../translation/Loader/JsonFileLoader.php | 51 - .../translation/Loader/LoaderInterface.php | 32 - .../translation/Loader/MoFileLoader.php | 138 - .../translation/Loader/PhpFileLoader.php | 35 - .../translation/Loader/PoFileLoader.php | 147 -- .../translation/Loader/QtFileLoader.php | 78 - .../translation/Loader/XliffFileLoader.php | 233 -- .../translation/Loader/YamlFileLoader.php | 51 - .../symfony/translation/LoggingTranslator.php | 115 - .../symfony/translation/MessageCatalogue.php | 338 --- .../translation/MessageCatalogueInterface.php | 134 - .../translation/MetadataAwareInterface.php | 48 - .../vendor/symfony/translation/README.md | 46 - .../vendor/symfony/translation/Translator.php | 472 ---- .../translation/TranslatorBagInterface.php | 36 - .../translation/Util/ArrayConverter.php | 97 - .../translation/Writer/TranslationWriter.php | 75 - .../vendor/symfony/translation/composer.json | 60 - .../vendor/symfony/yaml/CHANGELOG.md | 253 -- .../symfony/yaml/Command/LintCommand.php | 276 -- .../vendor/symfony/yaml/Dumper.php | 178 -- .../vendor/symfony/yaml/Escaper.php | 95 - .../symfony/yaml/Exception/DumpException.php | 21 - .../yaml/Exception/ExceptionInterface.php | 21 - .../symfony/yaml/Exception/ParseException.php | 132 - .../yaml/Exception/RuntimeException.php | 21 - .../vendor/symfony/yaml/Inline.php | 828 ------ tests/integration/vendor/symfony/yaml/LICENSE | 19 - .../vendor/symfony/yaml/Parser.php | 1246 --------- .../integration/vendor/symfony/yaml/README.md | 13 - .../vendor/symfony/yaml/Tag/TaggedValue.php | 38 - .../vendor/symfony/yaml/Unescaper.php | 108 - .../integration/vendor/symfony/yaml/Yaml.php | 97 - .../vendor/symfony/yaml/composer.json | 39 - 1184 files changed, 462 insertions(+), 128767 deletions(-) delete mode 100644 .drone.yml create mode 100644 .github/workflows/phpunit-sqlite.yml create mode 100644 tests/integration/config/behat.yml create mode 100755 tests/integration/run.sh delete mode 100644 tests/integration/vendor/autoload.php delete mode 100644 tests/integration/vendor/behat/behat/CHANGELOG.md delete mode 100644 tests/integration/vendor/behat/behat/LICENSE delete mode 100644 tests/integration/vendor/behat/behat/README.md delete mode 100755 tests/integration/vendor/behat/behat/bin/behat delete mode 100644 tests/integration/vendor/behat/behat/composer.json delete mode 100644 tests/integration/vendor/behat/behat/i18n.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/ApplicationFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Annotation/AnnotationReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/ArgumentResolver.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/CompositeFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/NullFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Cli/ContextSnippetsController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Context.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/ClassGenerator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/ClassResolver.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/SimpleClassGenerator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/CustomSnippetAcceptingContext.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/ContextEnvironment.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/Reader/ContextEnvironmentReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/UninitializedContextEnvironment.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/ContextException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/ContextNotFoundException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/UnknownTranslationResourceException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/WrongContextClassException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Initializer/ContextInitializer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReaderCachedPerContext.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReaderCachedPerSuite.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/TranslatableContextReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/ContextSnippet.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregateContextIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregatePatternIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/CachedContextIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextInterfaceBasedContextIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextInterfaceBasedPatternIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/FixedContextIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/FixedPatternIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/PatternIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/TargetContextIdentifier.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/SnippetAcceptingContext.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Context/TranslatableContext.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/DefinitionCall.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/Given.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/RuntimeDefinition.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/Then.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/When.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Cli/AvailableDefinitionsController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Context/Annotation/DefinitionAnnotationReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Definition.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionFinder.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionRepository.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionWriter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/AmbiguousMatchException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/DefinitionException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/InvalidPatternException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/RedundantStepException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/SearchException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/UnknownPatternException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/UnsupportedPatternTypeException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Pattern.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/PatternTransformer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/RegexPatternPolicy.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionListPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/DefinitionPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Search/RepositorySearchEngine.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Search/SearchEngine.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/SearchResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Translator/TranslatedDefinition.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterBackgroundSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterBackgroundTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterFeatureSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterFeatureTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterOutlineSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterOutlineTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterScenarioSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterScenarioTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BackgroundTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeBackgroundTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeBackgroundTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeFeatureTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeFeatureTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeOutlineTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeOutlineTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeScenarioTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeScenarioTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeStepTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ExampleTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/FeatureTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/GherkinNodeTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/OutlineTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ScenarioLikeTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ScenarioTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/StepTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/ServiceContainer/EventDispatcherExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/TickingStepTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Cli/FilterController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Cli/SyntaxController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemFeatureLocator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemRerunScenariosListLocator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemScenariosListLocator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/WrongContainerClassException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/WrongServicesConfigurationException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterFeature.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterScenario.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterStep.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeFeature.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeScenario.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeStep.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeStepHook.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Context/Annotation/HookAnnotationReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterFeatureScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterScenarioScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterStepScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeFeatureScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeScenarioScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeStepScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/FeatureScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/ScenarioScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/StepScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/ServiceContainer/HookExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableScenarioTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableStepTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Exception/NodeVisitorNotFoundException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ExamplePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ExampleRowPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/FeaturePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/ResultToStringConverter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/StepTextPainter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitSetupPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitStepPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitSuitePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ListPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/OutlinePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/OutlineTablePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExamplePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExampleRowPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlineTablePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyScenarioPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStatisticsPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStatisticsPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStepPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ScenarioPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/SetupPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/StatisticsPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/StepPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/SuitePrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Printer/ConsoleOutputFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Printer/Formatter/ConsoleFormatter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/ProgressFormatterFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/HookStat.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/PhaseStatistics.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/ScenarioStat.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/Statistics.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/StepStat.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/StepStatV2.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/TotalStatistics.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/AggregateSnippet.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Appender/SnippetAppender.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Cli/SnippetsController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Exception/EnvironmentSnippetGenerationException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Exception/SnippetException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Printer/SnippetPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/ServiceContainer/SnippetExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Snippet.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetRegistry.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetRepository.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetWriter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/UndefinedStep.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/BackgroundTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Cli/RerunController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/FeatureHasNoBackgroundException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/PendingException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/Stringer/PendingExceptionStringer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/OutlineTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/DefinedStepResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/ExecutedStepResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/FailedStepSearchResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/SkippedStepResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/StepResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/UndefinedStepResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/IsolatingScenarioTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeBackgroundTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeOutlineTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/ServiceContainer/TesterExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/StepContainerTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/Filter/DefinitionArgumentsTransformer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/RuntimeTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/TransformationCall.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Context/Annotation/TransformationAnnotationReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Exception/TransformationException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Exception/UnsupportedCallException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/RegexGenerator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/ColumnBasedTableTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/PatternTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/RowBasedTableTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TableRowTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TokenNameAndReturnTypeTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TokenNameTransformation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/TransformationRepository.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Translator/Cli/GherkinTranslationsController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Behat/Translator/ServiceContainer/GherkinTranslationsExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ApplicationFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ArgumentOrganiser.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ConstructorArgumentOrganiser.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/ArgumentException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/UnknownParameterValueException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/UnsupportedFunctionException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ServiceContainer/ArgumentExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Autoloader/Cli/AutoloaderController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Call.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallResults.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Callee.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/BadCallbackException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallErrorException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallHandlingException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/FatalThrowableError.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Filter/CallFilter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Filter/ResultFilter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/CallHandler.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/Exception/ClassNotFoundHandler.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/Exception/MethodNotFoundHandler.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/ExceptionHandler.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/RuntimeCallee.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/ServiceContainer/CallExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Command.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Controller.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/DebugCommand.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/DumpReferenceCommand.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Exception/TimerException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Memory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Timer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Call/EnvironmentCall.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Environment.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/EnvironmentManager.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentBuildException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentIsolationException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentReadException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Handler/StaticEnvironmentHandler.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/ServiceContainer/EnvironmentExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/StaticEnvironment.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseAborted.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseCompleted.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteAborted.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeExerciseCompleted.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeExerciseTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeSuiteTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeSuiteTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/ExerciseCompleted.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/LifecycleEvent.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/SuiteTested.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/ServiceContainer/EventDispatcherExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Cli/VerbosityController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/ExceptionPresenter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/ServiceContainer/ExceptionExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/PHPUnitExceptionStringer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/TestworkExceptionStringer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/TestworkException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/ConsoleFilesystemLogger.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/FilesystemLogger.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/ServiceContainer/FilesystemExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/AfterSuite.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/BeforeSuite.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/HookCall.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeFilterableHook.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeHook.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/FilterableHook.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Hook.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/HookRepository.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/AfterSuiteScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/AfterTestScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/BeforeSuiteScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/HookScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/SuiteScope.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/ServiceContainer/HookExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Cli/OrderController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Exception/InvalidOrderException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/NoopOrderer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/Orderer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/RandomOrderer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/ReverseOrderer.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/ServiceContainer/OrderingExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Cli/OutputController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/BadOutputPathException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/FormatterNotFoundException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/OutputException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/PrinterException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Formatter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/EventListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/NodeEventListeningFormatter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/OutputManager.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/ConsoleOutputFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/FilesystemOutputFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/OutputPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/StreamOutputPrinter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/ServiceContainer/Formatter/FormatterFactory.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/ServiceContainer/OutputExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ContainerLoader.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ConfigurationLoadingException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ExtensionException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ExtensionInitializationException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ProcessingException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ServiceContainerException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Extension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ExtensionManager.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ServiceProcessor.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/GroupedSpecificationIterator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/Locator/SpecificationLocator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/NoSpecificationsIterator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/ServiceContainer/SpecificationExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationArrayIterator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationFinder.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationIterator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Cli/InitializationController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Cli/SuiteController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/ParameterNotFoundException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteConfigurationException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteGenerationException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteNotFoundException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteSetupException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Generator/GenericSuiteGenerator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/GenericSuite.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/ServiceContainer/SuiteExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Setup/SuiteSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Suite.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteBootstrapper.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteRegistry.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteRepository.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/StrictController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exception/TesterException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exception/WrongPathsException.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exercise.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/ExceptionResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/IntegerTestResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/SoftInterpretation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/StrictInterpretation.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/ResultInterpreter.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestResults.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestWithSetupResult.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/FailedSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/FailedTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/Setup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/SuccessfulSetup.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/SuccessfulTeardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/Teardown.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/SpecificationTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/SuiteTester.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Translator/Cli/LanguageController.php delete mode 100644 tests/integration/vendor/behat/behat/src/Behat/Testwork/Translator/ServiceContainer/TranslatorExtension.php delete mode 100644 tests/integration/vendor/behat/gherkin/CHANGES.md delete mode 100644 tests/integration/vendor/behat/gherkin/CONTRIBUTING.md delete mode 100644 tests/integration/vendor/behat/gherkin/LICENSE delete mode 100644 tests/integration/vendor/behat/gherkin/README.md delete mode 100644 tests/integration/vendor/behat/gherkin/composer.json delete mode 100644 tests/integration/vendor/behat/gherkin/i18n.php delete mode 100644 tests/integration/vendor/behat/gherkin/libpath.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/CacheInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/FileCache.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/MemoryCache.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/CacheException.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/Exception.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/LexerException.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/NodeException.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/ParserException.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/ComplexFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/ComplexFilterInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/FeatureFilterInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/FilterInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/LineFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/LineRangeFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/NameFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/NarrativeFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/PathsFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/RoleFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/SimpleFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/TagFilter.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Gherkin.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/ArrayKeywords.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/CachedArrayKeywords.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/CucumberKeywords.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/KeywordsDumper.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/KeywordsInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Lexer.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/AbstractFileLoader.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/ArrayLoader.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/DirectoryLoader.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/FileLoaderInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/GherkinFileLoader.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/LoaderInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/YamlFileLoader.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ArgumentInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/BackgroundNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ExampleNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ExampleTableNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/FeatureNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/KeywordNodeInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/NodeInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/OutlineNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/PyStringNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioLikeInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/StepContainerInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/StepNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/TableNode.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/TaggedNodeInterface.php delete mode 100644 tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Parser.php delete mode 100644 tests/integration/vendor/behat/transliterator/CHANGELOG.md delete mode 100644 tests/integration/vendor/behat/transliterator/CONTRIBUTING.md delete mode 100644 tests/integration/vendor/behat/transliterator/LICENSE delete mode 100644 tests/integration/vendor/behat/transliterator/README.md delete mode 100644 tests/integration/vendor/behat/transliterator/composer.json delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/SyncTool.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/Transliterator.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x00.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x01.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x02.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x03.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x04.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x05.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x06.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x07.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x09.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x0a.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x0b.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x0c.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x0d.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x0e.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x0f.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x10.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x11.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x12.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x13.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x14.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x15.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x16.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x17.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x18.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x1e.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x1f.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x20.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x21.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x24.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x25.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x26.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x27.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x28.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x30.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x31.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x32.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x33.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x4e.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x4f.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x50.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x51.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x52.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x53.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x54.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x55.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x56.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x57.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x58.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x59.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x5a.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x5b.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x5c.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x5d.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x5e.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x5f.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x60.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x61.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x62.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x63.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x64.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x65.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x66.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x67.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x68.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x69.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x6a.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x6b.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x6c.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x6d.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x6e.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x6f.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x70.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x71.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x72.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x73.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x74.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x75.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x76.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x77.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x78.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x79.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x7a.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x7b.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x7c.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x7d.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x7e.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x7f.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x80.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x81.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x82.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x83.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x84.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x85.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x86.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x87.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x88.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x89.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x8a.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x8b.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x8c.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x8d.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x8e.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x8f.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x90.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x91.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x92.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x93.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x94.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x95.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x96.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x97.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x98.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x99.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x9a.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x9b.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x9c.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x9d.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x9e.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x9f.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xa0.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xa1.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xa2.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xa3.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xa4.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xac.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xad.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xae.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xaf.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb0.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb1.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb2.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb3.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb4.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb5.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb6.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb7.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb8.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xb9.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xba.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xbb.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xbc.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xbd.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xbe.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xbf.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc0.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc1.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc2.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc3.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc4.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc5.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc6.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc7.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc8.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xc9.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xca.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xcb.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xcc.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xcd.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xce.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xcf.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xd0.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xd1.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xd2.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xd3.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xd4.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xd5.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xd6.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xd7.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xf9.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xfa.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xfb.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xfc.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xfd.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xfe.php delete mode 100644 tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xff.php delete mode 100755 tests/integration/vendor/bin/behat delete mode 100644 tests/integration/vendor/composer/ClassLoader.php delete mode 100644 tests/integration/vendor/composer/LICENSE delete mode 100644 tests/integration/vendor/composer/autoload_classmap.php delete mode 100644 tests/integration/vendor/composer/autoload_files.php delete mode 100644 tests/integration/vendor/composer/autoload_namespaces.php delete mode 100644 tests/integration/vendor/composer/autoload_psr4.php delete mode 100644 tests/integration/vendor/composer/autoload_real.php delete mode 100644 tests/integration/vendor/composer/autoload_static.php delete mode 100644 tests/integration/vendor/composer/installed.json delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/CHANGELOG.md delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/LICENSE delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/README.md delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/UPGRADING.md delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/composer.json delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Client.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/ClientInterface.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/ConnectException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/HandlerStack.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/MessageFormatter.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Middleware.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/Pool.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/RequestOptions.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/TransferStats.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/UriTemplate.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/functions.php delete mode 100644 tests/integration/vendor/guzzlehttp/guzzle/src/functions_include.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/CHANGELOG.md delete mode 100644 tests/integration/vendor/guzzlehttp/promises/LICENSE delete mode 100644 tests/integration/vendor/guzzlehttp/promises/README.md delete mode 100644 tests/integration/vendor/guzzlehttp/promises/composer.json delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/AggregateException.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/CancellationException.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/Coroutine.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/EachPromise.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/FulfilledPromise.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/Promise.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/PromiseInterface.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/PromisorInterface.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/RejectedPromise.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/RejectionException.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/TaskQueue.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/TaskQueueInterface.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/functions.php delete mode 100644 tests/integration/vendor/guzzlehttp/promises/src/functions_include.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/CHANGELOG.md delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/LICENSE delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/README.md delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/composer.json delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/AppendStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/BufferStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/CachingStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/DroppingStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/FnStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/InflateStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/LazyOpenStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/LimitStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/MessageTrait.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/MultipartStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/NoSeekStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/PumpStream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/Request.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/Response.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/ServerRequest.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/Stream.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/StreamWrapper.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/UploadedFile.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/Uri.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/UriNormalizer.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/UriResolver.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/functions.php delete mode 100644 tests/integration/vendor/guzzlehttp/psr7/src/functions_include.php delete mode 100644 tests/integration/vendor/psr/container/.gitignore delete mode 100644 tests/integration/vendor/psr/container/LICENSE delete mode 100644 tests/integration/vendor/psr/container/README.md delete mode 100644 tests/integration/vendor/psr/container/composer.json delete mode 100644 tests/integration/vendor/psr/container/src/ContainerExceptionInterface.php delete mode 100644 tests/integration/vendor/psr/container/src/ContainerInterface.php delete mode 100644 tests/integration/vendor/psr/container/src/NotFoundExceptionInterface.php delete mode 100644 tests/integration/vendor/psr/http-message/CHANGELOG.md delete mode 100644 tests/integration/vendor/psr/http-message/LICENSE delete mode 100644 tests/integration/vendor/psr/http-message/README.md delete mode 100644 tests/integration/vendor/psr/http-message/composer.json delete mode 100644 tests/integration/vendor/psr/http-message/src/MessageInterface.php delete mode 100644 tests/integration/vendor/psr/http-message/src/RequestInterface.php delete mode 100644 tests/integration/vendor/psr/http-message/src/ResponseInterface.php delete mode 100644 tests/integration/vendor/psr/http-message/src/ServerRequestInterface.php delete mode 100644 tests/integration/vendor/psr/http-message/src/StreamInterface.php delete mode 100644 tests/integration/vendor/psr/http-message/src/UploadedFileInterface.php delete mode 100644 tests/integration/vendor/psr/http-message/src/UriInterface.php delete mode 100644 tests/integration/vendor/symfony/config/CHANGELOG.md delete mode 100644 tests/integration/vendor/symfony/config/ConfigCache.php delete mode 100644 tests/integration/vendor/symfony/config/ConfigCacheFactory.php delete mode 100644 tests/integration/vendor/symfony/config/ConfigCacheFactoryInterface.php delete mode 100644 tests/integration/vendor/symfony/config/ConfigCacheInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/ArrayNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/BaseNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/BooleanNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/ExprBuilder.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/MergeBuilder.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/NodeBuilder.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/NodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/NodeParentInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/TreeBuilder.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/ValidationBuilder.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/ConfigurationInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/EnumNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Exception/DuplicateKeyException.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Exception/Exception.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Exception/ForbiddenOverwriteException.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Exception/InvalidConfigurationException.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Exception/InvalidDefinitionException.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Exception/InvalidTypeException.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Exception/UnsetKeyException.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/FloatNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/IntegerNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/NodeInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/NumericNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/Processor.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/PrototypeNodeInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/PrototypedArrayNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/ScalarNode.php delete mode 100644 tests/integration/vendor/symfony/config/Definition/VariableNode.php delete mode 100644 tests/integration/vendor/symfony/config/Exception/FileLoaderImportCircularReferenceException.php delete mode 100644 tests/integration/vendor/symfony/config/Exception/FileLocatorFileNotFoundException.php delete mode 100644 tests/integration/vendor/symfony/config/FileLocator.php delete mode 100644 tests/integration/vendor/symfony/config/FileLocatorInterface.php delete mode 100644 tests/integration/vendor/symfony/config/LICENSE delete mode 100644 tests/integration/vendor/symfony/config/Loader/DelegatingLoader.php delete mode 100644 tests/integration/vendor/symfony/config/Loader/FileLoader.php delete mode 100644 tests/integration/vendor/symfony/config/Loader/GlobFileLoader.php delete mode 100644 tests/integration/vendor/symfony/config/Loader/Loader.php delete mode 100644 tests/integration/vendor/symfony/config/Loader/LoaderInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Loader/LoaderResolver.php delete mode 100644 tests/integration/vendor/symfony/config/Loader/LoaderResolverInterface.php delete mode 100644 tests/integration/vendor/symfony/config/README.md delete mode 100644 tests/integration/vendor/symfony/config/Resource/ClassExistenceResource.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/ComposerResource.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/DirectoryResource.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/FileExistenceResource.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/FileResource.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/GlobResource.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/ReflectionClassResource.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/ResourceInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/SelfCheckingResourceChecker.php delete mode 100644 tests/integration/vendor/symfony/config/Resource/SelfCheckingResourceInterface.php delete mode 100644 tests/integration/vendor/symfony/config/ResourceCheckerConfigCache.php delete mode 100644 tests/integration/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php delete mode 100644 tests/integration/vendor/symfony/config/ResourceCheckerInterface.php delete mode 100644 tests/integration/vendor/symfony/config/Util/XmlUtils.php delete mode 100644 tests/integration/vendor/symfony/config/composer.json delete mode 100644 tests/integration/vendor/symfony/console/Application.php delete mode 100644 tests/integration/vendor/symfony/console/CHANGELOG.md delete mode 100644 tests/integration/vendor/symfony/console/Command/Command.php delete mode 100644 tests/integration/vendor/symfony/console/Command/HelpCommand.php delete mode 100644 tests/integration/vendor/symfony/console/Command/ListCommand.php delete mode 100644 tests/integration/vendor/symfony/console/Command/LockableTrait.php delete mode 100644 tests/integration/vendor/symfony/console/ConsoleEvents.php delete mode 100644 tests/integration/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php delete mode 100644 tests/integration/vendor/symfony/console/Descriptor/ApplicationDescription.php delete mode 100644 tests/integration/vendor/symfony/console/Descriptor/Descriptor.php delete mode 100644 tests/integration/vendor/symfony/console/Descriptor/DescriptorInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Descriptor/JsonDescriptor.php delete mode 100644 tests/integration/vendor/symfony/console/Descriptor/MarkdownDescriptor.php delete mode 100644 tests/integration/vendor/symfony/console/Descriptor/TextDescriptor.php delete mode 100644 tests/integration/vendor/symfony/console/Descriptor/XmlDescriptor.php delete mode 100644 tests/integration/vendor/symfony/console/Event/ConsoleCommandEvent.php delete mode 100644 tests/integration/vendor/symfony/console/Event/ConsoleErrorEvent.php delete mode 100644 tests/integration/vendor/symfony/console/Event/ConsoleEvent.php delete mode 100644 tests/integration/vendor/symfony/console/Event/ConsoleTerminateEvent.php delete mode 100644 tests/integration/vendor/symfony/console/EventListener/ErrorListener.php delete mode 100644 tests/integration/vendor/symfony/console/Exception/CommandNotFoundException.php delete mode 100644 tests/integration/vendor/symfony/console/Exception/ExceptionInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Exception/InvalidArgumentException.php delete mode 100644 tests/integration/vendor/symfony/console/Exception/InvalidOptionException.php delete mode 100644 tests/integration/vendor/symfony/console/Exception/LogicException.php delete mode 100644 tests/integration/vendor/symfony/console/Exception/RuntimeException.php delete mode 100644 tests/integration/vendor/symfony/console/Formatter/OutputFormatter.php delete mode 100644 tests/integration/vendor/symfony/console/Formatter/OutputFormatterInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyle.php delete mode 100644 tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/DebugFormatterHelper.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/DescriptorHelper.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/FormatterHelper.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/Helper.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/HelperInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/HelperSet.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/InputAwareHelper.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/ProcessHelper.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/ProgressBar.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/ProgressIndicator.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/QuestionHelper.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/SymfonyQuestionHelper.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/Table.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/TableCell.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/TableSeparator.php delete mode 100644 tests/integration/vendor/symfony/console/Helper/TableStyle.php delete mode 100644 tests/integration/vendor/symfony/console/Input/ArgvInput.php delete mode 100644 tests/integration/vendor/symfony/console/Input/ArrayInput.php delete mode 100644 tests/integration/vendor/symfony/console/Input/Input.php delete mode 100644 tests/integration/vendor/symfony/console/Input/InputArgument.php delete mode 100644 tests/integration/vendor/symfony/console/Input/InputAwareInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Input/InputDefinition.php delete mode 100644 tests/integration/vendor/symfony/console/Input/InputInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Input/InputOption.php delete mode 100644 tests/integration/vendor/symfony/console/Input/StreamableInputInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Input/StringInput.php delete mode 100644 tests/integration/vendor/symfony/console/LICENSE delete mode 100644 tests/integration/vendor/symfony/console/Logger/ConsoleLogger.php delete mode 100644 tests/integration/vendor/symfony/console/Output/BufferedOutput.php delete mode 100644 tests/integration/vendor/symfony/console/Output/ConsoleOutput.php delete mode 100644 tests/integration/vendor/symfony/console/Output/ConsoleOutputInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Output/NullOutput.php delete mode 100644 tests/integration/vendor/symfony/console/Output/Output.php delete mode 100644 tests/integration/vendor/symfony/console/Output/OutputInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Output/StreamOutput.php delete mode 100644 tests/integration/vendor/symfony/console/Question/ChoiceQuestion.php delete mode 100644 tests/integration/vendor/symfony/console/Question/ConfirmationQuestion.php delete mode 100644 tests/integration/vendor/symfony/console/Question/Question.php delete mode 100644 tests/integration/vendor/symfony/console/README.md delete mode 100644 tests/integration/vendor/symfony/console/Resources/bin/hiddeninput.exe delete mode 100644 tests/integration/vendor/symfony/console/Style/OutputStyle.php delete mode 100644 tests/integration/vendor/symfony/console/Style/StyleInterface.php delete mode 100644 tests/integration/vendor/symfony/console/Style/SymfonyStyle.php delete mode 100644 tests/integration/vendor/symfony/console/Terminal.php delete mode 100644 tests/integration/vendor/symfony/console/Tester/ApplicationTester.php delete mode 100644 tests/integration/vendor/symfony/console/Tester/CommandTester.php delete mode 100644 tests/integration/vendor/symfony/console/composer.json delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Alias.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Argument/ArgumentInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Argument/IteratorArgument.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/CHANGELOG.md delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ChildDefinition.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/AutoAliasServicePass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/AutowirePass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/Compiler.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/CompilerPassInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/PassConfig.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Container.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ContainerAwareInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ContainerAwareTrait.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ContainerBuilder.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ContainerInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Definition.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Dumper/Dumper.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Dumper/DumperInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Dumper/PhpDumper.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Dumper/XmlDumper.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Dumper/YamlDumper.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/BadMethodCallException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/EnvParameterException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/ExceptionInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/InvalidArgumentException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/LogicException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/OutOfBoundsException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/RuntimeException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ExpressionLanguage.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Extension/Extension.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Extension/ExtensionInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Extension/PrependExtensionInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/LICENSE delete mode 100644 tests/integration/vendor/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Loader/ClosureLoader.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Loader/FileLoader.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Loader/IniFileLoader.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Loader/schema/dic/services/services-1.0.xsd delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Parameter.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ParameterBag/ParameterBagInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/README.md delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Reference.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/ServiceLocator.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/TaggedContainerInterface.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/TypedReference.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/Variable.php delete mode 100644 tests/integration/vendor/symfony/dependency-injection/composer.json delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/CHANGELOG.md delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/Debug/WrappedListener.php delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/EventDispatcher.php delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/EventDispatcherInterface.php delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/EventSubscriberInterface.php delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/GenericEvent.php delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/LICENSE delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/README.md delete mode 100644 tests/integration/vendor/symfony/event-dispatcher/composer.json delete mode 100644 tests/integration/vendor/symfony/filesystem/CHANGELOG.md delete mode 100644 tests/integration/vendor/symfony/filesystem/Exception/ExceptionInterface.php delete mode 100644 tests/integration/vendor/symfony/filesystem/Exception/FileNotFoundException.php delete mode 100644 tests/integration/vendor/symfony/filesystem/Exception/IOException.php delete mode 100644 tests/integration/vendor/symfony/filesystem/Exception/IOExceptionInterface.php delete mode 100644 tests/integration/vendor/symfony/filesystem/Filesystem.php delete mode 100644 tests/integration/vendor/symfony/filesystem/LICENSE delete mode 100644 tests/integration/vendor/symfony/filesystem/README.md delete mode 100644 tests/integration/vendor/symfony/filesystem/composer.json delete mode 100644 tests/integration/vendor/symfony/polyfill-mbstring/LICENSE delete mode 100644 tests/integration/vendor/symfony/polyfill-mbstring/Mbstring.php delete mode 100644 tests/integration/vendor/symfony/polyfill-mbstring/README.md delete mode 100644 tests/integration/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php delete mode 100644 tests/integration/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php delete mode 100644 tests/integration/vendor/symfony/polyfill-mbstring/bootstrap.php delete mode 100644 tests/integration/vendor/symfony/polyfill-mbstring/composer.json delete mode 100644 tests/integration/vendor/symfony/translation/CHANGELOG.md delete mode 100644 tests/integration/vendor/symfony/translation/Catalogue/AbstractOperation.php delete mode 100644 tests/integration/vendor/symfony/translation/Catalogue/MergeOperation.php delete mode 100644 tests/integration/vendor/symfony/translation/Catalogue/OperationInterface.php delete mode 100644 tests/integration/vendor/symfony/translation/Catalogue/TargetOperation.php delete mode 100644 tests/integration/vendor/symfony/translation/Command/XliffLintCommand.php delete mode 100644 tests/integration/vendor/symfony/translation/DataCollector/TranslationDataCollector.php delete mode 100644 tests/integration/vendor/symfony/translation/DataCollectorTranslator.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/CsvFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/DumperInterface.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/FileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/IcuResFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/IniFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/JsonFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/MoFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/PhpFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/PoFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/QtFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/XliffFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Dumper/YamlFileDumper.php delete mode 100644 tests/integration/vendor/symfony/translation/Exception/ExceptionInterface.php delete mode 100644 tests/integration/vendor/symfony/translation/Exception/InvalidArgumentException.php delete mode 100644 tests/integration/vendor/symfony/translation/Exception/InvalidResourceException.php delete mode 100644 tests/integration/vendor/symfony/translation/Exception/LogicException.php delete mode 100644 tests/integration/vendor/symfony/translation/Exception/NotFoundResourceException.php delete mode 100644 tests/integration/vendor/symfony/translation/Exception/RuntimeException.php delete mode 100644 tests/integration/vendor/symfony/translation/Extractor/AbstractFileExtractor.php delete mode 100644 tests/integration/vendor/symfony/translation/Extractor/ChainExtractor.php delete mode 100644 tests/integration/vendor/symfony/translation/Extractor/ExtractorInterface.php delete mode 100644 tests/integration/vendor/symfony/translation/IdentityTranslator.php delete mode 100644 tests/integration/vendor/symfony/translation/LICENSE delete mode 100644 tests/integration/vendor/symfony/translation/Loader/ArrayLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/CsvFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/FileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/IcuDatFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/IcuResFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/IniFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/JsonFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/LoaderInterface.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/MoFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/PhpFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/PoFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/QtFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/XliffFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/Loader/YamlFileLoader.php delete mode 100644 tests/integration/vendor/symfony/translation/LoggingTranslator.php delete mode 100644 tests/integration/vendor/symfony/translation/MessageCatalogue.php delete mode 100644 tests/integration/vendor/symfony/translation/MessageCatalogueInterface.php delete mode 100644 tests/integration/vendor/symfony/translation/MetadataAwareInterface.php delete mode 100644 tests/integration/vendor/symfony/translation/README.md delete mode 100644 tests/integration/vendor/symfony/translation/Translator.php delete mode 100644 tests/integration/vendor/symfony/translation/TranslatorBagInterface.php delete mode 100644 tests/integration/vendor/symfony/translation/Util/ArrayConverter.php delete mode 100644 tests/integration/vendor/symfony/translation/Writer/TranslationWriter.php delete mode 100644 tests/integration/vendor/symfony/translation/composer.json delete mode 100644 tests/integration/vendor/symfony/yaml/CHANGELOG.md delete mode 100644 tests/integration/vendor/symfony/yaml/Command/LintCommand.php delete mode 100644 tests/integration/vendor/symfony/yaml/Dumper.php delete mode 100644 tests/integration/vendor/symfony/yaml/Escaper.php delete mode 100644 tests/integration/vendor/symfony/yaml/Exception/DumpException.php delete mode 100644 tests/integration/vendor/symfony/yaml/Exception/ExceptionInterface.php delete mode 100644 tests/integration/vendor/symfony/yaml/Exception/ParseException.php delete mode 100644 tests/integration/vendor/symfony/yaml/Exception/RuntimeException.php delete mode 100644 tests/integration/vendor/symfony/yaml/Inline.php delete mode 100644 tests/integration/vendor/symfony/yaml/LICENSE delete mode 100644 tests/integration/vendor/symfony/yaml/Parser.php delete mode 100644 tests/integration/vendor/symfony/yaml/README.md delete mode 100644 tests/integration/vendor/symfony/yaml/Tag/TaggedValue.php delete mode 100644 tests/integration/vendor/symfony/yaml/Unescaper.php delete mode 100644 tests/integration/vendor/symfony/yaml/Yaml.php delete mode 100644 tests/integration/vendor/symfony/yaml/composer.json diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index d72dc19..0000000 --- a/.drone.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -kind: pipeline -name: check-app-compatbility - -steps: - - name: check-app-compatbility - image: nextcloudci/php7.4:2 - environment: - APP_NAME: limit_login_to_ip - CORE_BRANCH: master - DB: sqlite - commands: - # Pre-setup steps - - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh - - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - - cd ../server - - # Code checker - - ./occ app:check-code $APP_NAME -c strong-comparison - - ./occ app:check-code $APP_NAME -c deprecation - -trigger: - branch: - - master - - stable* - event: - - pull_request - - push - ---- -kind: pipeline -name: integration-tests - -steps: - - name: integration-tests 7.4 - image: nextcloudci/php7.4:2 - environment: - APP_NAME: limit_login_to_ip - CORE_BRANCH: master - DB: sqlite - commands: - # Pre-setup steps - - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh - - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - - cd ../server - - php occ app:enable limit_login_to_ip - - php -S 127.0.0.1:8080 & - - cd apps/limit_login_to_ip/tests/integration/ && vendor/bin/behat - -trigger: - branch: - - master - - stable* - event: - - pull_request - - push ---- -kind: signature -hmac: 786ab56c09be8ad5056e350c9137de0b597372064060b1a29739af0290e8f5a2 diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml new file mode 100644 index 0000000..d613117 --- /dev/null +++ b/.github/workflows/phpunit-sqlite.yml @@ -0,0 +1,148 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization + +name: PHPUnit sqlite + +on: + pull_request: + paths: + - '.github/workflows/**' + - 'appinfo/**' + - 'lib/**' + - 'templates/**' + - 'tests/**' + - 'vendor/**' + - 'vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + + push: + branches: + - main + - master + - stable* + +permissions: + contents: read + +concurrency: + group: phpunit-sqlite-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + phpunit-sqlite: + runs-on: ubuntu-latest + + strategy: + matrix: + php-versions: ['8.0'] + server-versions: ['master'] + + steps: + - name: Set app env + run: | + # Split and keep last + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Checkout server + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + with: + submodules: true + repository: nextcloud/server + ref: ${{ matrix.server-versions }} + + - name: Checkout app + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + with: + path: apps/${{ env.APP_NAME }} + + - name: Set up php ${{ matrix.php-versions }} + uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2 + with: + php-version: ${{ matrix.php-versions }} + # https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite + coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check composer file existence + id: check_composer + uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2 + with: + files: apps/${{ env.APP_NAME }}/composer.json + + - name: Set up dependencies + # Only run if phpunit config file exists + if: steps.check_composer.outputs.files_exists == 'true' + working-directory: apps/${{ env.APP_NAME }} + run: composer i + + - name: Set up Nextcloud + env: + DB_PORT: 4444 + run: | + mkdir data + ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin + ./occ app:enable --force ${{ env.APP_NAME }} + + - name: Check PHPUnit script is defined + id: check_phpunit + continue-on-error: true + working-directory: apps/${{ env.APP_NAME }} + run: | + composer run --list | grep "^ test:unit " | wc -l | grep 1 + + - name: PHPUnit + # Only run if phpunit config file exists + if: steps.check_phpunit.outcome == 'success' + working-directory: apps/${{ env.APP_NAME }} + run: composer run test:unit + + - name: Check PHPUnit integration script is defined + id: check_integration + continue-on-error: true + working-directory: apps/${{ env.APP_NAME }} + run: | + composer run --list | grep "^ test:integration " | wc -l | grep 1 + + - name: Run Nextcloud + # Only run if phpunit integration config file exists + if: steps.check_integration.outcome == 'success' + run: php -S localhost:8080 & + + - name: PHPUnit integration + # Only run if phpunit integration config file exists + if: steps.check_integration.outcome == 'success' + working-directory: apps/${{ env.APP_NAME }} + run: composer run test:integration + + - name: Print logs + if: always() + run: | + cat data/nextcloud.log + + - name: Skipped + # Fail the action when neither unit nor integration tests ran + if: steps.check_phpunit.outcome == 'failure' && steps.check_integration.outcome == 'failure' + run: | + echo 'Neither PHPUnit nor PHPUnit integration tests are specified in composer.json scripts' + exit 1 + + summary: + permissions: + contents: none + runs-on: ubuntu-latest + needs: phpunit-sqlite + + if: always() + + name: phpunit-sqlite-summary + + steps: + - name: Summary status + run: if ${{ needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi diff --git a/.gitignore b/.gitignore index 9f547ba..4e2dd8a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build vendor -.phpunit.result.cache .php-cs-fixer.cache +.phpunit.result.cache +.phpactor.json diff --git a/appinfo/app.php b/appinfo/app.php index 97c1572..867d43b 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -24,8 +24,7 @@ $config = \OC::$server->getConfig(); $request = \OC::$server->getRequest(); $urlGenerator = \OC::$server->getURLGenerator(); -$loginUrl = $urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'); -$isLoginPage = (parse_url($request->getRequestUri(), PHP_URL_PATH) === $urlGenerator->linkToRoute('core.login.showLoginForm')); +$isLoginPage = parse_url($request->getRequestUri(), PHP_URL_PATH) === $urlGenerator->linkToRoute('core.login.showLoginForm'); $loginHookListener = new \OCA\LimitLoginToIp\LoginHookListener( $config, diff --git a/tests/integration/composer.json b/tests/integration/composer.json index 4ad8a3c..be43a0d 100644 --- a/tests/integration/composer.json +++ b/tests/integration/composer.json @@ -1,6 +1,7 @@ { "require-dev": { - "behat/behat": "^3.3" + "behat/behat": "^3.3", + "jarnaiz/behat-junit-formatter": "^1.3" }, "require": { "guzzlehttp/guzzle": "^6.3" diff --git a/tests/integration/composer.lock b/tests/integration/composer.lock index a9abc0e..519bf81 100644 --- a/tests/integration/composer.lock +++ b/tests/integration/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5bb62a75fac212aff3deeeb479d1b7bc", + "content-hash": "725a01b2cb5d020dec60f4488794bede", "packages": [ { "name": "guzzlehttp/guzzle", @@ -850,6 +850,49 @@ }, "time": "2022-03-30T09:27:43+00:00" }, + { + "name": "jarnaiz/behat-junit-formatter", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/j-arnaiz/behat-junit-formatter.git", + "reference": "2f80b3881e04d3cf43e05ab821c0e80675a9846d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/j-arnaiz/behat-junit-formatter/zipball/2f80b3881e04d3cf43e05ab821c0e80675a9846d", + "reference": "2f80b3881e04d3cf43e05ab821c0e80675a9846d", + "shasum": "" + }, + "require": { + "behat/behat": "~3.0", + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "v1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "jarnaiz\\JUnitFormatter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "authors": [ + { + "name": "Jesús Arnaiz", + "email": "j.arnaiz@gmail.com" + } + ], + "description": "Behat 3 JUnit xml formatter", + "support": { + "issues": "https://github.com/j-arnaiz/behat-junit-formatter/issues", + "source": "https://github.com/j-arnaiz/behat-junit-formatter/tree/master" + }, + "time": "2016-01-26T17:05:07+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -955,35 +998,38 @@ }, { "name": "symfony/config", - "version": "v6.3.2", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "b47ca238b03e7b0d7880ffd1cf06e8d637ca1467" + "reference": "db4fc45c24e0c3e2198e68ada9d7f90daa1f97e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/b47ca238b03e7b0d7880ffd1cf06e8d637ca1467", - "reference": "b47ca238b03e7b0d7880ffd1cf06e8d637ca1467", + "url": "https://api.github.com/repos/symfony/config/zipball/db4fc45c24e0c3e2198e68ada9d7f90daa1f97e3", + "reference": "db4fc45c24e0c3e2198e68ada9d7f90daa1f97e3", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.0.2", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/filesystem": "^5.4|^6.0", - "symfony/polyfill-ctype": "~1.8" + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php81": "^1.22" }, "conflict": { - "symfony/finder": "<5.4", - "symfony/service-contracts": "<2.5" + "symfony/finder": "<4.4" }, "require-dev": { "symfony/event-dispatcher": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", "symfony/messenger": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", + "symfony/service-contracts": "^1.1|^2|^3", "symfony/yaml": "^5.4|^6.0" }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, "type": "library", "autoload": { "psr-4": { @@ -1010,7 +1056,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v6.3.2" + "source": "https://github.com/symfony/config/tree/v6.0.19" }, "funding": [ { @@ -1026,27 +1072,26 @@ "type": "tidelift" } ], - "time": "2023-07-19T20:22:16+00:00" + "time": "2023-01-09T04:36:00+00:00" }, { "name": "symfony/console", - "version": "v6.3.2", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898" + "reference": "c3ebc83d031b71c39da318ca8b7a07ecc67507ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/aa5d64ad3f63f2e48964fc81ee45cb318a723898", - "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898", + "url": "https://api.github.com/repos/symfony/console/zipball/c3ebc83d031b71c39da318ca8b7a07ecc67507ed", + "reference": "c3ebc83d031b71c39da318ca8b7a07ecc67507ed", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^2.5|^3", + "symfony/service-contracts": "^1.1|^2|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -1068,6 +1113,12 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, "type": "library", "autoload": { "psr-4": { @@ -1095,12 +1146,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command-line", + "command line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.3.2" + "source": "https://github.com/symfony/console/tree/v6.0.19" }, "funding": [ { @@ -1116,34 +1167,34 @@ "type": "tidelift" } ], - "time": "2023-07-19T20:17:28+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/dependency-injection", - "version": "v6.3.2", + "version": "v6.0.20", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "474cfbc46aba85a1ca11a27db684480d0db64ba7" + "reference": "359806e1adebd1c43e18e5ea22acd14bef7fcf8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/474cfbc46aba85a1ca11a27db684480d0db64ba7", - "reference": "474cfbc46aba85a1ca11a27db684480d0db64ba7", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/359806e1adebd1c43e18e5ea22acd14bef7fcf8c", + "reference": "359806e1adebd1c43e18e5ea22acd14bef7fcf8c", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.0.2", "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/service-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.2.10" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php81": "^1.22", + "symfony/service-contracts": "^1.1.6|^2.0|^3.0" }, "conflict": { "ext-psr": "<1.1|>=2", - "symfony/config": "<6.1", + "symfony/config": "<5.4", "symfony/finder": "<5.4", - "symfony/proxy-manager-bridge": "<6.3", + "symfony/proxy-manager-bridge": "<5.4", "symfony/yaml": "<5.4" }, "provide": { @@ -1151,10 +1202,17 @@ "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "^6.1", + "symfony/config": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0" }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, "type": "library", "autoload": { "psr-4": { @@ -1181,7 +1239,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.3.2" + "source": "https://github.com/symfony/dependency-injection/tree/v6.0.20" }, "funding": [ { @@ -1197,29 +1255,29 @@ "type": "tidelift" } ], - "time": "2023-07-19T20:17:28+00:00" + "time": "2023-01-30T15:41:07+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.3.0", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1248,7 +1306,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -1264,29 +1322,28 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.3.2", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e" + "reference": "2eaf8e63bc5b8cefabd4a800157f0d0c094f677a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/adb01fe097a4ee930db9258a3cc906b5beb5cf2e", - "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2eaf8e63bc5b8cefabd4a800157f0d0c094f677a", + "reference": "2eaf8e63bc5b8cefabd4a800157f0d0c094f677a", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/event-dispatcher-contracts": "^2.5|^3" + "php": ">=8.0.2", + "symfony/event-dispatcher-contracts": "^2|^3" }, "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/service-contracts": "<2.5" + "symfony/dependency-injection": "<5.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", @@ -1299,9 +1356,13 @@ "symfony/error-handler": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/http-foundation": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", + "symfony/service-contracts": "^1.1|^2|^3", "symfony/stopwatch": "^5.4|^6.0" }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, "type": "library", "autoload": { "psr-4": { @@ -1328,7 +1389,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.3.2" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.0.19" }, "funding": [ { @@ -1344,30 +1405,33 @@ "type": "tidelift" } ], - "time": "2023-07-06T06:56:43+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.3.0", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", - "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.0.2", "psr/event-dispatcher": "^1" }, + "suggest": { + "symfony/event-dispatcher-implementation": "" + }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1404,7 +1468,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.2" }, "funding": [ { @@ -1420,24 +1484,24 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/filesystem", - "version": "v6.3.1", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae" + "reference": "3d49eec03fda1f0fc19b7349fbbe55ebc1004214" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", - "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3d49eec03fda1f0fc19b7349fbbe55ebc1004214", + "reference": "3d49eec03fda1f0fc19b7349fbbe55ebc1004214", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, @@ -1467,7 +1531,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.3.1" + "source": "https://github.com/symfony/filesystem/tree/v6.0.19" }, "funding": [ { @@ -1483,7 +1547,7 @@ "type": "tidelift" } ], - "time": "2023-06-01T08:30:39+00:00" + "time": "2023-01-20T17:44:14+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1731,31 +1795,113 @@ ], "time": "2022-11-03T14:55:06+00:00" }, + { + "name": "symfony/polyfill-php81", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", + "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, { "name": "symfony/service-contracts", - "version": "v3.3.0", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d78d39c1599bd1188b8e26bb341da52c3c6d8a66", + "reference": "d78d39c1599bd1188b8e26bb341da52c3c6d8a66", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.0.2", "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" }, + "suggest": { + "symfony/service-implementation": "" + }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1765,10 +1911,7 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1795,7 +1938,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.0.2" }, "funding": [ { @@ -1811,37 +1954,36 @@ "type": "tidelift" } ], - "time": "2023-05-23T14:45:45+00:00" + "time": "2022-05-30T19:17:58+00:00" }, { "name": "symfony/string", - "version": "v6.3.2", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "53d1a83225002635bca3482fcbf963001313fb68" + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", - "reference": "53d1a83225002635bca3482fcbf963001313fb68", + "url": "https://api.github.com/repos/symfony/string/zipball/d9e72497367c23e08bf94176d2be45b00a9d232a", + "reference": "d9e72497367c23e08bf94176d2be45b00a9d232a", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.0.2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.5" + "symfony/translation-contracts": "<2.0" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", - "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.5|^3.0", + "symfony/translation-contracts": "^2.0|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -1881,7 +2023,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.3.2" + "source": "https://github.com/symfony/string/tree/v6.0.19" }, "funding": [ { @@ -1897,35 +2039,32 @@ "type": "tidelift" } ], - "time": "2023-07-05T08:41:27+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/translation", - "version": "v6.3.3", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd" + "reference": "9c24b3fdbbe9fb2ef3a6afd8bbaadfd72dad681f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", - "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", + "url": "https://api.github.com/repos/symfony/translation/zipball/9c24b3fdbbe9fb2ef3a6afd8bbaadfd72dad681f", + "reference": "9c24b3fdbbe9fb2ef3a6afd8bbaadfd72dad681f", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.5|^3.0" + "symfony/translation-contracts": "^2.3|^3.0" }, "conflict": { "symfony/config": "<5.4", "symfony/console": "<5.4", "symfony/dependency-injection": "<5.4", - "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", - "symfony/service-contracts": "<2.5", "symfony/twig-bundle": "<5.4", "symfony/yaml": "<5.4" }, @@ -1933,20 +2072,23 @@ "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { - "nikic/php-parser": "^4.13", "psr/log": "^1|^2|^3", "symfony/config": "^5.4|^6.0", "symfony/console": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^2.5|^3.0", + "symfony/http-client-contracts": "^1.1|^2.0|^3.0", "symfony/http-kernel": "^5.4|^6.0", "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/routing": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", + "symfony/service-contracts": "^1.1.2|^2|^3", "symfony/yaml": "^5.4|^6.0" }, + "suggest": { + "psr/log-implementation": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, "type": "library", "autoload": { "files": [ @@ -1976,7 +2118,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.3.3" + "source": "https://github.com/symfony/translation/tree/v6.0.19" }, "funding": [ { @@ -1992,29 +2134,32 @@ "type": "tidelift" } ], - "time": "2023-07-31T07:08:24+00:00" + "time": "2023-01-01T08:36:10+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.3.0", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86" + "reference": "acbfbb274e730e5a0236f619b6168d9dedb3e282" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/02c24deb352fb0d79db5486c0c79905a85e37e86", - "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/acbfbb274e730e5a0236f619b6168d9dedb3e282", + "reference": "acbfbb274e730e5a0236f619b6168d9dedb3e282", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.0.2" + }, + "suggest": { + "symfony/translation-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.4-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -2024,10 +2169,7 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2054,81 +2196,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.3.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-05-30T17:17:10+00:00" - }, - { - "name": "symfony/var-exporter", - "version": "v6.3.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-exporter.git", - "reference": "3400949782c0cb5b3e73aa64cfd71dde000beccc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/3400949782c0cb5b3e73aa64cfd71dde000beccc", - "reference": "3400949782c0cb5b3e73aa64cfd71dde000beccc", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "require-dev": { - "symfony/var-dumper": "^5.4|^6.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\VarExporter\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Allows exporting any serializable PHP data structure to plain PHP code", - "homepage": "https://symfony.com", - "keywords": [ - "clone", - "construct", - "export", - "hydrate", - "instantiate", - "lazy-loading", - "proxy", - "serialize" - ], - "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.3.2" + "source": "https://github.com/symfony/translation-contracts/tree/v3.0.2" }, "funding": [ { @@ -2144,25 +2212,24 @@ "type": "tidelift" } ], - "time": "2023-07-26T17:39:03+00:00" + "time": "2022-06-27T17:10:44+00:00" }, { "name": "symfony/yaml", - "version": "v6.3.3", + "version": "v6.0.19", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add" + "reference": "deec3a812a0305a50db8ae689b183f43d915c884" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e23292e8c07c85b971b44c1c4b87af52133e2add", - "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add", + "url": "https://api.github.com/repos/symfony/yaml/zipball/deec3a812a0305a50db8ae689b183f43d915c884", + "reference": "deec3a812a0305a50db8ae689b183f43d915c884", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.0.2", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -2171,6 +2238,9 @@ "require-dev": { "symfony/console": "^5.4|^6.0" }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, "bin": [ "Resources/bin/yaml-lint" ], @@ -2200,7 +2270,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.3.3" + "source": "https://github.com/symfony/yaml/tree/v6.0.19" }, "funding": [ { @@ -2216,7 +2286,7 @@ "type": "tidelift" } ], - "time": "2023-07-31T07:08:24+00:00" + "time": "2023-01-11T11:50:03+00:00" } ], "aliases": [], diff --git a/tests/integration/config/behat.yml b/tests/integration/config/behat.yml new file mode 100644 index 0000000..425da1b --- /dev/null +++ b/tests/integration/config/behat.yml @@ -0,0 +1,14 @@ +default: + autoload: + '': '%paths.base%/../features/bootstrap' + suites: + default: + paths: + - '%paths.base%/../features' + contexts: + - FeatureContext + + extensions: + jarnaiz\JUnitFormatter\JUnitFormatterExtension: + filename: report.xml + outputDir: '%paths.base%/../output/' diff --git a/tests/integration/features/Login.feature b/tests/integration/features/Login.feature index 2e22694..fc67a4c 100644 --- a/tests/integration/features/Login.feature +++ b/tests/integration/features/Login.feature @@ -6,11 +6,12 @@ Feature: Login Then the response status code should be "403" And the response URL should be "http://localhost:8080/index.php/apps/limit_login_to_ip/denied" - Scenario: Authenticating with blocked IP via API - Given The range "192.168.0.0/24" is permitted - When I try to login via "api" - Then the response status code should be "403" - And the response URL should be "http://localhost:8080/remote.php/webdav/" + # FIXME Broken feature + # Scenario: Authenticating with blocked IP via API + # Given The range "192.168.0.0/24" is permitted + # When I try to login via "api" + # Then the response status code should be "403" + # And the response URL should be "http://localhost:8080/remote.php/webdav/" Scenario: Authenticating with whitelisted IP via Web Given The range "127.0.0.0/24" is permitted @@ -25,4 +26,4 @@ Feature: Login Scenario: Authenticating with multiple whitelisted IP via API Given The range "192.168.0.0/24,127.0.0.0/24,192.168.1.0/24" is permitted When I try to login via "api" - Then the response status code should be "200" \ No newline at end of file + Then the response status code should be "200" diff --git a/tests/integration/run.sh b/tests/integration/run.sh new file mode 100755 index 0000000..25b0e05 --- /dev/null +++ b/tests/integration/run.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -euo pipefail + +declare -r APP_NAME=limit_login_to_ip +declare -r APP_INTEGRATION_DIR=${PWD} +declare -r ROOT_DIR=${APP_INTEGRATION_DIR}/../../../.. +declare -rx TEST_SERVER_URL="http://localhost:8080/" + +"${ROOT_DIR}/occ" app:enable "${APP_NAME}" +"${ROOT_DIR}/occ" app:list | grep "${APP_NAME}" + +(cd "${APP_INTEGRATION_DIR}" && composer install -o) +"${APP_INTEGRATION_DIR}/vendor/bin/behat" --colors -f junit -f pretty "${@}" +declare -ri RESULT=$? + +exit ${RESULT} + diff --git a/tests/integration/vendor/autoload.php b/tests/integration/vendor/autoload.php deleted file mode 100644 index e0deb53..0000000 --- a/tests/integration/vendor/autoload.php +++ /dev/null @@ -1,25 +0,0 @@ - --no-colors - -## 0.2.4 - 2010-10-19 -### Changed - * [Behat] Autoguess of colors support - * [Behat] Formatter setup bugfix (properl casing) - -## 0.2.3 - 2010-10-19 -### Changed - * [Behat] Filters optimisations - * [Behat] Changed Core Loaders with topic-specific (`StepDefinition\Loader\PHPLoader`, - `Features\Loader\GherkinLoader`) - * [Behat] Simplified TestCommand in prepare of Symfony2 BehatBundle - * [Behat] Configuration file/path setting update (you can now create `behat.yml` inside `./config/behat.yml` & Behat - will load it - * [Behat] Updated Redundant & Ambiguous exceptions behavior - -## 0.2.2 - 2010-10-10 -### Changed - * [Behat] Configuration file/path setting update - -## 0.2.1 - 2010-10-10 -### Changed - * [PEAR] Fix path to phpbin on installation - -## 0.2.0 - 2010-10-08 -### Changed - * [Behat] Brand new stateless testers, based on Visitor pattern - * [Behat] Refactored event listeners & event names - * [Behat] Refactored formatters to confirm with new stateless testers (statuses now sent as event parameters) - * [Behat] Refactored ConsoleFormatter (and removed base formatter) - * [Behat] Removed custom I18n classes & refactored Translator routines in flavor of Symfony\Component\Translation - * [Behat] Added missed translation strings into XLIFF files - * [Behat] Optimised multiline arguments (Node instances are sent to definitions instead of their plain representations) - * [Behat] Support for Scenario Outline tokens replace in multiline arguments (tables & pystrings) - * [Behat] Step arguments transformations (including table transformations) - * [Behat] Colorize inline step arguments - * [Behat] Optimized exit statuses of CLI - * [Behat] Added ability to turn-off colors - * [Behat] Added ability to translate formatters output with `--i18n` option - * [Behat] Bunch of new core feature tests - * [Gherkin] Parser now uses Symfony Dependency Injection to - * [Gherkin] Refactored parser to be like AST (Nodes that supports Visitor pattern) - * [Gherkin] Comments support - * [Gherkin] Fixed PHPUnit warnings - * [Behat,Gherkin] PEAR release script to support http://pear.everzet.com release model - * [Behat,Gherkin] DIC naming refactoring - * [Behat,Gherkin] Autoloader refactoring - * [Behat,Gherkin] Removed Zend & Goutte depencies - -## 0.1.5 - 2010-09-25 -### Changed - * Added ability to call other steps inside step definition - * Added profiles - * Refactored container creation routine - * Single quotes support in step definitions - * Added tests for hooks, profiles, inline steps - -## 0.1.4 - 2010-09-16 -### Changed - * Refactored code - * Removed logic from object constructors - * Added Loader & Filter interfaces - -## 0.1.3 - 2010-09-14 -### Changed - * Ability to specify arrays of paths/files for loaders - * Event hooks and support for `support/hooks.php` - * Formatters listens events with smallest priority - * Don't try to load steps if `steps` folder doesn't exists - * Bugfixes/refactoring - -## 0.1.2 - 2010-09-10 -### Changed - * Added ability to read from `behat.yml` and `behat.xml` - * Moved tags filter to separate object - * Refactored injection controller - * Optimized event names in event dispatcher - * Other small fixes/refactorings - -## 0.1.1 - 2010-09-09 -### Changed - * Added `--tags` option - * Changed environment (world) routines - * Added lots of core tests (writed in Behat itself) - -## 0.1.0 - 2010-09-08 -### Changed - * Initial release - -[3.13.0]: https://github.com/Behat/Behat/compare/v3.12.0...v3.13.0 -[3.12.0]: https://github.com/Behat/Behat/compare/v3.11.0...v3.12.0 -[3.11.0]: https://github.com/Behat/Behat/compare/v3.10.0...v3.11.0 -[3.9.0]: https://github.com/Behat/Behat/compare/v3.8.1...v3.9.0 -[3.8.1]: https://github.com/Behat/Behat/compare/v3.8.0...v3.8.1 -[3.8.0]: https://github.com/Behat/Behat/compare/v3.7.0...v3.8.0 -[3.7.0]: https://github.com/Behat/Behat/compare/v3.6.1...v3.7.0 -[3.6.1]: https://github.com/Behat/Behat/compare/v3.6.0...v3.6.1 -[3.6.0]: https://github.com/Behat/Behat/compare/v3.5.0...v3.6.0 -[3.5.0]: https://github.com/Behat/Behat/compare/v3.4.3...v3.5.0 -[3.4.3]: https://github.com/Behat/Behat/compare/v3.4.2...v3.4.3 -[3.4.2]: https://github.com/Behat/Behat/compare/v3.4.1...v3.4.2 -[3.4.1]: https://github.com/Behat/Behat/compare/v3.4.0...v3.4.1 -[3.4.0]: https://github.com/Behat/Behat/compare/v3.3.1...v3.4.0 -[3.3.1]: https://github.com/Behat/Behat/compare/v3.3.0...v3.3.1 -[3.3.0]: https://github.com/Behat/Behat/compare/v3.2.3...v3.3.0 -[3.2.3]: https://github.com/Behat/Behat/compare/v3.2.2...v3.2.3 -[3.2.2]: https://github.com/Behat/Behat/compare/v3.2.1...v3.2.2 -[3.2.1]: https://github.com/Behat/Behat/compare/v3.2.0...v3.2.1 -[3.2.0]: https://github.com/Behat/Behat/compare/v3.1.0...v3.2.0 -[3.1.0]: https://github.com/Behat/Behat/compare/v3.0.15...v3.1.0 -[3.0.15]: https://github.com/Behat/Behat/compare/v3.0.14...v3.0.15 -[3.0.14]: https://github.com/Behat/Behat/compare/v3.0.13...v3.0.14 -[3.0.13]: https://github.com/Behat/Behat/compare/v3.0.12...v3.0.13 -[3.0.12]: https://github.com/Behat/Behat/compare/v3.0.11...v3.0.12 -[3.0.11]: https://github.com/Behat/Behat/compare/v3.0.10...v3.0.11 -[3.0.10]: https://github.com/Behat/Behat/compare/v3.0.9...v3.0.10 -[3.0.9]: https://github.com/Behat/Behat/compare/v3.0.8...v3.0.9 -[3.0.8]: https://github.com/Behat/Behat/compare/v3.0.7...v3.0.8 -[3.0.7]: https://github.com/Behat/Behat/compare/v3.0.6...v3.0.7 -[3.0.6]: https://github.com/Behat/Behat/compare/v3.0.5...v3.0.6 -[3.0.5]: https://github.com/Behat/Behat/compare/v3.0.4...v3.0.5 -[3.0.4]: https://github.com/Behat/Behat/compare/v3.0.3...v3.0.4 -[3.0.3]: https://github.com/Behat/Behat/compare/v3.0.2...v3.0.3 -[3.0.2]: https://github.com/Behat/Behat/compare/v3.0.1...v3.0.2 -[3.0.1]: https://github.com/Behat/Behat/compare/v3.0.0...v3.0.1 -[3.0.0]: https://github.com/Behat/Behat/compare/v2.5.5...v3.0.0 diff --git a/tests/integration/vendor/behat/behat/LICENSE b/tests/integration/vendor/behat/behat/LICENSE deleted file mode 100644 index 86ebfc8..0000000 --- a/tests/integration/vendor/behat/behat/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2016 Konstantin Kudryashov - -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. diff --git a/tests/integration/vendor/behat/behat/README.md b/tests/integration/vendor/behat/behat/README.md deleted file mode 100644 index cbe2691..0000000 --- a/tests/integration/vendor/behat/behat/README.md +++ /dev/null @@ -1,69 +0,0 @@ -![Behat](https://github.com/Behat/logo/raw/master/logo.png) - -Behat is a BDD framework for PHP to help you test business expectations. - -[![Gitter chat](https://badges.gitter.im/Behat/Behat.svg)](https://gitter.im/Behat/Behat) -[![License](https://poser.pugx.org/behat/behat/license.svg)](https://packagist.org/packages/behat/behat) -[![Build Status](https://github.com/Behat/Behat/workflows/Build/badge.svg)](https://github.com/Behat/Behat/actions?query=workflow%3ABuild) - -Installing Behat ----------------- - -The easiest way to install Behat is by using [Composer](https://getcomposer.org): - -```bash -$> composer require --dev behat/behat -``` - -After that you'll be able to run Behat via: - -```bash -$> vendor/bin/behat -``` - -Installing Development Version ------------------------------- - -Clone the repository and install dependencies via [Composer](https://getcomposer.org): - -```bash -$> composer install -``` - -After that you will be able to run development version of Behat via: - -```bash -$> bin/behat -``` - -Contributing ------------- - -Before contributing to Behat, please take a look at the [CONTRIBUTING.md](CONTRIBUTING.md) document. - -Versioning ----------- - -Starting from `v3.0.0`, Behat is following [Semantic Versioning v2.0.0](http://semver.org/spec/v2.0.0.html). -This basically means that if all you do is implement interfaces (like [this one](https://github.com/Behat/Behat/blob/v3.1.0/src/Behat/Behat/Context/ContextClass/ClassResolver.php#L15-L22)) -and use service constants (like [this one](https://github.com/Behat/Behat/blob/v3.1.0/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php#L46)), -you would not have any backwards compatibility issues with Behat up until `v4.0.0` (or later major) -is released. Exception could be an extremely rare case where BC break is introduced as a measure -to fix a serious issue. - -You can read detailed guidance on what BC means in [Symfony BC guide](http://symfony.com/doc/current/contributing/code/bc.html). - -Useful Links ------------- - -- The main website is at [http://behat.org](http://behat.org) -- The documentation is at [http://docs.behat.org/en/latest/](http://docs.behat.org/en/latest/) -- Official Google Group is at [http://groups.google.com/group/behat](http://groups.google.com/group/behat) -- IRC channel on [#freenode](http://freenode.net/) is `#behat` -- [Note on Patches/Pull Requests](CONTRIBUTING.md) - -Contributors ------------- - -- Konstantin Kudryashov [everzet](http://github.com/everzet) [lead developer] -- Other [awesome developers](https://github.com/Behat/Behat/graphs/contributors) diff --git a/tests/integration/vendor/behat/behat/bin/behat b/tests/integration/vendor/behat/behat/bin/behat deleted file mode 100755 index b7dad59..0000000 --- a/tests/integration/vendor/behat/behat/bin/behat +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env php - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -define('BEHAT_BIN_PATH', __FILE__); - -if (is_file($autoload = getcwd() . '/vendor/autoload.php')) { - require $autoload; -} - -if (!class_exists('Behat\Behat\ApplicationFactory', true)) { - if (is_file($autoload = __DIR__ . '/../vendor/autoload.php')) { - require($autoload); - } elseif (is_file($autoload = __DIR__ . '/../../../autoload.php')) { - require($autoload); - } else { - fwrite(STDERR, - 'You must set up the project dependencies, run the following commands:'.PHP_EOL. - 'curl -s http://getcomposer.org/installer | php'.PHP_EOL. - 'php composer.phar install'.PHP_EOL - ); - exit(1); - } -} - -$factory = new \Behat\Behat\ApplicationFactory(); -$factory->createApplication()->run(); diff --git a/tests/integration/vendor/behat/behat/composer.json b/tests/integration/vendor/behat/behat/composer.json deleted file mode 100644 index 333713b..0000000 --- a/tests/integration/vendor/behat/behat/composer.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "behat/behat", - "description": "Scenario-oriented BDD framework for PHP", - "keywords": ["BDD", "ScenarioBDD", "StoryBDD", "Examples", "Scrum", "Agile", "User story", "Symfony", "business", "development", "testing", "documentation"], - "homepage": "http://behat.org/", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - - "require": { - "php": "^7.2 || ^8.0", - "ext-mbstring": "*", - "behat/gherkin": "^4.9.0", - "behat/transliterator": "^1.2", - "symfony/console": "^4.4 || ^5.0 || ^6.0", - "symfony/config": "^4.4 || ^5.0 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0", - "symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0", - "symfony/translation": "^4.4 || ^5.0 || ^6.0", - "symfony/yaml": "^4.4 || ^5.0 || ^6.0", - "psr/container": "^1.0 || ^2.0" - }, - - "require-dev": { - "symfony/process": "^4.4 || ^5.0 || ^6.0", - "phpunit/phpunit": "^8.5 || ^9.0", - "herrera-io/box": "~1.6.1", - "vimeo/psalm": "^4.8", - "phpspec/prophecy": "^1.15" - }, - - "suggest": { - "ext-dom": "Needed to output test results in JUnit format." - }, - - "autoload": { - "psr-4": { - "Behat\\Behat\\": "src/Behat/Behat/", - "Behat\\Testwork\\": "src/Behat/Testwork/", - "Behat\\Step\\": "src/Behat/Step/", - "Behat\\Hook\\": "src/Behat/Hook/" - } - }, - - "autoload-dev": { - "psr-4": { - "Behat\\Tests\\": "tests/" - } - }, - - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - - "bin": ["bin/behat"] -} diff --git a/tests/integration/vendor/behat/behat/i18n.php b/tests/integration/vendor/behat/behat/i18n.php deleted file mode 100644 index 8b41503..0000000 --- a/tests/integration/vendor/behat/behat/i18n.php +++ /dev/null @@ -1,301 +0,0 @@ - array( - 'snippet_context_choice' => '%count% suite has undefined steps. Please choose the context to generate snippets:', - 'snippet_proposal_title' => '%count% has missing steps. Define them with these snippets:', - 'snippet_missing_title' => 'Use --snippets-for CLI option to generate snippets for following %count% suite steps:', - 'skipped_scenarios_title' => 'Skipped scenarios:', - 'failed_scenarios_title' => 'Failed scenarios:', - 'failed_hooks_title' => 'Failed hooks:', - 'failed_steps_title' => 'Failed steps:', - 'failed_step_title' => 'Failed step:', - 'pending_steps_title' => 'Pending steps:', - 'scenarios_count' => '{0} No scenarios|{1} 1 scenario|]1,Inf] %count% scenarios', - 'steps_count' => '{0} No steps|{1} 1 step|]1,Inf] %count% steps', - 'passed_count' => '[1,Inf] %count% passed', - 'failed_count' => '[1,Inf] %count% failed', - 'pending_count' => '[1,Inf] %count% pending', - 'undefined_count' => '[1,Inf] %count% undefined', - 'skipped_count' => '[1,Inf] %count% skipped', - ), - 'bg' => array( - 'snippet_context_choice' => 'В сет %count% има недекларирани стъпки. Изберете в кой Context да бъдат създадени:', - 'snippet_proposal_title' => '%count% има липсващи стъпки. Можете да ги създадете чрез:', - 'snippet_missing_title' => 'Използвайте този снипет --snippets-for за да генерирате кода за следните стъпки %count% през конзолата:', - 'skipped_scenarios_title' => 'Пропуснати сценарии:', - 'failed_scenarios_title' => 'Провалени сценарии:', - 'failed_hooks_title' => 'Провалени хукове:', - 'failed_steps_title' => 'Провалени стъпки:', - 'failed_step_title' => 'Провалени стъпка:', - 'pending_steps_title' => 'Изчакващи стъпки:', - 'scenarios_count' => '{0} Няма сценарий|{1} 1 сценарий|]1,Inf] %count% сценарии', - 'steps_count' => '{0} Няма стъпки|{1} 1 стъпка|]1,Inf] %count% стъпки', - 'passed_count' => '[1,Inf] %count% успешни', - 'failed_count' => '[1,Inf] %count% провалени', - 'pending_count' => '[1,Inf] %count% изчакващи', - 'undefined_count' => '[1,Inf] %count% неопределени', - 'skipped_count' => '[1,Inf] %count% пропуснати', - ), - 'cs' => array( - 'snippet_proposal_title' => '%count% obsahuje chybné kroky. Definujte je za použití následujícího kódu:', - 'snippet_missing_title' => 'Snippety pro následující kroky v sadě %count% nebyly vygenerovány (zkontrolujte správnost konfigurace):', - 'failed_scenarios_title' => 'Chybné scénáře:', - 'failed_hooks_title' => 'Chybné hooky:', - 'failed_steps_title' => 'Chybné kroky:', - 'failed_step_title' => 'Chybné krok:', - 'pending_steps_title' => 'Čekající kroky:', - 'scenarios_count' => '{0} Žádný scénář|{1} 1 scénář|{2,3,4} %count% scénáře|]4,Inf] %count% scénářů', - 'steps_count' => '{0} Žádné kroky|{1} 1 krok|{2,3,4} %count% kroky|]4,Inf] %count% kroků', - 'passed_count' => '{1} %count% prošel|{2,3,4} %count% prošly|]4,Inf] %count% prošlo', - 'failed_count' => '{1} %count% selhal|{2,3,4} %count% selhaly|]4,Inf] %count% selhalo', - 'pending_count' => '{1} %count% čeká|{2,3,4} %count% čekají|]4,Inf] %count% čeká', - 'undefined_count' => '{1} %count% nedefinován|{2,3,4} %count% nedefinovány|]4,Inf] %count% nedefinováno', - 'skipped_count' => '{1} %count% přeskočen|{2,3,4} %count% přeskočeny|]4,Inf] %count% přeskočeno', - ), - 'de' => array( - 'snippet_proposal_title' => '%count% hat fehlende Schritte. Definiere diese mit den folgenden Snippets:', - 'snippet_missing_title' => 'Snippets für die folgenden Schritte in der %count% Suite wurden nicht generiert (Konfiguration überprüfen):', - 'failed_scenarios_title' => 'Fehlgeschlagene Szenarien:', - 'failed_hooks_title' => 'Fehlgeschlagene Hooks:', - 'failed_steps_title' => 'Fehlgeschlagene Schritte:', - 'failed_step_title' => 'Fehlgeschlagene Schritt:', - 'pending_steps_title' => 'Ausstehende Schritte:', - 'scenarios_count' => '{0} Kein Szenario|{1} 1 Szenario|]1,Inf] %count% Szenarien', - 'steps_count' => '{0} Kein Schritt|{1} 1 Schritt|]1,Inf] %count% Schritte', - 'passed_count' => '[1,Inf] %count% bestanden', - 'failed_count' => '[1,Inf] %count% fehlgeschlagen', - 'pending_count' => '[1,Inf] %count% ausstehend', - 'undefined_count' => '[1,Inf] %count% nicht definiert', - 'skipped_count' => '[1,Inf] %count% übersprungen', - ), - 'es' => array( - 'snippet_proposal_title' => 'A %count% le faltan pasos. Defínelos con estos pasos:', - 'snippet_missing_title' => 'Las plantillas para los siguientes pasos en %count% no fueron generadas (revisa tu configuración):', - 'failed_scenarios_title' => 'Escenarios fallidos:', - 'failed_hooks_title' => 'Hooks fallidos:', - 'failed_steps_title' => 'Pasos fallidos:', - 'failed_step_title' => 'Paso fallidos:', - 'pending_steps_title' => 'Pasos pendientes:', - 'scenarios_count' => '{0} Ningún escenario|{1} 1 escenario|]1,Inf] %count% escenarios', - 'steps_count' => '{0} Ningún paso|{1} 1 paso|]1,Inf] %count% pasos', - 'passed_count' => '[1,Inf] %count% pasaron', - 'failed_count' => '[1,Inf] %count% fallaron', - 'pending_count' => '[1,Inf] %count% pendientes', - 'undefined_count' => '[1,Inf] %count% por definir', - 'skipped_count' => '[1,Inf] %count% saltadas', - ), - 'fr' => array( - 'snippet_proposal_title' => '%count% a des étapes manquantes. Définissez-les avec les modèles suivants :', - 'snippet_missing_title' => 'Les modèles des étapes de la suite %count% n\'ont pas été générés (vérifiez votre configuration):', - 'failed_scenarios_title' => 'Scénarios échoués:', - 'failed_hooks_title' => 'Hooks échoués:', - 'failed_steps_title' => 'Etapes échouées:', - 'failed_step_title' => 'Etape échouées:', - 'pending_steps_title' => 'Etapes en attente:', - 'scenarios_count' => '{0} Pas de scénario|{1} 1 scénario|]1,Inf] %count% scénarios', - 'steps_count' => '{0} Pas d\'étape|{1} 1 étape|]1,Inf] %count% étapes', - 'passed_count' => '[1,Inf] %count% succès', - 'failed_count' => '[1,Inf] %count% échecs', - 'pending_count' => '[1,Inf] %count% en attente', - 'undefined_count' => '[1,Inf] %count% indéfinis', - 'skipped_count' => '[1,Inf] %count% ignorés', - ), - 'hu' => array( - 'snippet_context_choice' => '%count% sorozat meghatározatlan lépéseket tartalmaz. Válaszd ki a környezetet kódrészlet készítéséhez:', - 'snippet_proposal_title' => '%count% lépései hiányosak. Hozd létre az alábbi kódrészletekkel:', - 'snippet_missing_title' => 'Használd a --snippets-for parancssori kapcsolót kódrészletek készítéséhez a %count% sorozat lépéseihez:', - 'skipped_scenarios_title' => 'Kihagyott forgatókönyvek:', - 'failed_scenarios_title' => 'Sikertelen forgatókönyvek:', - 'failed_hooks_title' => 'Sikertelen kampók:', - 'failed_steps_title' => 'Sikertelen lépések:', - 'failed_step_title' => 'Sikertelen lépés:', - 'pending_steps_title' => 'Elintézendő lépések:', - 'scenarios_count' => '{0} Nem volt forgatókönyv|{1} 1 forgatókönyv|]1,Inf] %count% forgatókönyv', - 'steps_count' => '{0} Nem volt lépés|{1} 1 lépés|]1,Inf] %count% lépés', - 'passed_count' => '[1,Inf] %count% sikeres', - 'failed_count' => '[1,Inf] %count% sikertelen', - 'pending_count' => '[1,Inf] %count% elintézendő', - 'undefined_count' => '[1,Inf] %count% meghatározatlan', - 'skipped_count' => '[1,Inf] %count% kihagyott', - ), - 'it' => array( - 'snippet_proposal_title' => '%count% ha dei passaggi mancanti. Definiscili con questi snippet:', - 'snippet_missing_title' => 'Gli snippet per i seguenti passaggi della suite %count% non sono stati generati (verifica la configurazione):', - 'failed_scenarios_title' => 'Scenari falliti:', - 'failed_hooks_title' => 'Hook falliti:', - 'failed_steps_title' => 'Passaggi falliti:', - 'failed_step_title' => 'Passaggio fallito:', - 'pending_steps_title' => 'Passaggi in sospeso:', - 'scenarios_count' => '{0} Nessuno scenario|{1} 1 scenario|]1,Inf] %count% scenari', - 'steps_count' => '{0} Nessun passaggio|{1} 1 passaggio|]1,Inf] %count% passaggi', - 'passed_count' => '{1} 1 superato|]1,Inf] %count% superati', - 'failed_count' => '{1} 1 fallito|]1,Inf] %count% falliti', - 'pending_count' => '[1,Inf] %count% in sospeso', - 'undefined_count' => '{1} 1 non definito|]1,Inf] %count% non definiti', - 'skipped_count' => '{1} 1 ignorato|]1,Inf] %count% ignorati', - ), - 'ja' => array( - 'snippet_proposal_title' => '%count% のステップが見つかりません。 次のスニペットで定義できます:', - 'snippet_missing_title' => '以下のステップのスニペットは%count%スイートに生成されませんでした(設定を確認してください):', - 'skipped_scenarios_title' => 'スキップした シナリオ:', - 'failed_scenarios_title' => '失敗した シナリオ:', - 'failed_hooks_title' => '失敗した フック:', - 'failed_steps_title' => '失敗した ステップ:', - 'failed_step_title' => '失敗した ステップ:', - 'pending_steps_title' => '保留中のステップ:', - 'scenarios_count' => '{0} No scenarios|{1} 1 個のシナリオ|]1,Inf] %count% 個のシナリオ', - 'steps_count' => '{0} ステップがありません|{1} 1 個のステップ|]1,Inf] %count% 個のステップ', - 'passed_count' => '[1,Inf] %count% 個成功', - 'failed_count' => '[1,Inf] %count% 個失敗', - 'pending_count' => '[1,Inf] %count% 個保留', - 'undefined_count' => '[1,Inf] %count% 個未定義', - 'skipped_count' => '[1,Inf] %count% 個スキップ', - ), - 'ko' => array( - 'snippet_proposal_title' => '%count% 정의가 되지 않았습니다. 스니펫을 생성할 컨텍스트를 선택하십시오:', - 'snippet_missing_title' => '%count% 단계가 누락되었습니다. 스니펫을 정의해주세요:', - 'skipped_scenarios_title' => '건너뛴 시나리오:', - 'failed_scenarios_title' => '실패한 시나리오:', - 'failed_hooks_title' => '실패한 훅 연결:', - 'failed_steps_title' => '실패한 단계:', - 'failed_step_title' => '실패한 단계:', - 'pending_steps_title' => '준비중인 단계:', - 'scenarios_count' => '{0} 없는 시나리오들|{1} 1 시나리오|]1,Inf] %count% 시나리오들', - 'steps_count' => '{0} 없는 단계들|{1} 1 단계|]1,Inf] %count% 단계들', - 'passed_count' => '[1,Inf] %count% 통과', - 'failed_count' => '[1,Inf] %count% 실패', - 'pending_count' => '[1,Inf] %count% 준비중', - 'undefined_count' => '[1,Inf] %count% 정의되지 않았습니다.', - 'skipped_count' => '[1,Inf] %count% 건너뜀', - ), - 'nl' => array( - 'snippet_proposal_title' => 'Ontbrekende stappen in %count%. Definieer ze met de volgende fragmenten:', - 'snippet_missing_title' => 'Fragmenten voor de volgende stappen in de %count% suite werden niet gegenereerd (controleer de configuratie):', - 'failed_scenarios_title' => 'Gefaalde scenario\'s:', - 'failed_hooks_title' => 'Gefaalde hooks:', - 'failed_steps_title' => 'Gefaalde stappen:', - 'failed_step_title' => 'Gefaalde stap:', - 'pending_steps_title' => 'Onafgewerkte stappen:', - 'scenarios_count' => '{0} Geen scenario\'s|{1} 1 scenario|]1,Inf] %count% scenario\'s', - 'steps_count' => '{0} Geen stappen|{1} 1 stap|]1,Inf] %count% stappen', - 'passed_count' => '[1,Inf] %count% geslaagd', - 'failed_count' => '[1,Inf] %count% gefaald', - 'pending_count' => '[1,Inf] %count% wachtende', - 'undefined_count' => '[1,Inf] %count% niet gedefinieerd', - 'skipped_count' => '[1,Inf] %count% overgeslagen', - ), - 'no' => array( - 'snippet_proposal_title' => '%count% mangler steg. Definer dem med disse snuttene:', - 'snippet_missing_title' => 'Snutter for de følgende stegene i %count%-samlingen ble ikke laget. (Sjekk konfigurasjonen din.):', - 'failed_scenarios_title' => 'Feilende scenarier:', - 'failed_hooks_title' => 'Feilende hooks:', - 'failed_steps_title' => 'Feilende steg:', - 'failed_step_title' => 'Feilende steg:', - 'pending_steps_title' => 'Ikke implementerte steg:', - 'scenarios_count' => '{0} Ingen scenarier|{1} 1 scenario|]1,Inf] %count% scenarier', - 'steps_count' => '{0} Ingen steg|{1} 1 steg|]1,Inf] %count% steg', - 'passed_count' => '[1,Inf] %count% ok', - 'failed_count' => '[1,Inf] %count% feilet', - 'pending_count' => '[1,Inf] %count% ikke implementert', - 'undefined_count' => '[1,Inf] %count% ikke definert', - 'skipped_count' => '[1,Inf] %count% hoppet over', - ), - 'pl' => array( - 'snippet_proposal_title' => '%count% zawiera brakujące kroki. Utwórz je korzystając z tych fragmentów kodu:', - 'snippet_missing_title' => 'Fragmenty kodu dla następujących kroków %count% nie zostały wygenerowane (sprawdź swoją konfigurację):', - 'failed_scenarios_title' => 'Nieudane scenariusze:', - 'failed_hooks_title' => 'Nieudane hooki:', - 'failed_steps_title' => 'Nieudane kroki', - 'failed_step_title' => 'Nieudane krok:', - 'pending_steps_title' => 'Oczekujące kroki', - 'scenarios_count' => '{0} Brak scenariuszy|{1} 1 scenariusz|{2,3,4,22,23,24,32,33,34,42,43,44} %count% scenariusze|]4,Inf] %count% scenariuszy', - 'steps_count' => '{0} Brak kroków|{1} 1 krok|{2,3,4,22,23,24,32,33,34,42,43,44} %count% kroki|]4,Inf] %count% kroków', - 'passed_count' => '{1} %count% udany|{2,3,4,22,23,24,32,33,34,42,43,44} %count% udane|]4,Inf] %count% udanych', - 'failed_count' => '{1} %count% nieudany|{2,3,4,22,23,24,32,33,34,42,43,44} %count% nieudane|]4,Inf] %count% nieudanych', - 'pending_count' => '{1} %count% oczekujący|{2,3,4,22,23,24,32,33,34,42,43,44} %count% oczekujące|]4,Inf] %count% oczekujących', - 'undefined_count' => '{1} %count% niezdefiniowany|{2,3,4,22,23,24,32,33,34,42,43,44} %count% niezdefiniowane|]4,Inf] %count% niezdefiniowanych', - 'skipped_count' => '{1} %count% pominięty|{2,3,4,22,23,24,32,33,34,42,43,44} %count% pominięte|]4,Inf] %count% pominiętych', - ), - 'pt' => array( - 'snippet_proposal_title' => '%count% contém definições em falta. Defina-as com estes exemplos:', - 'snippet_missing_title' => 'Os exemplos para as seguintes definições da suite %count% não foram gerados (verifique a configuração):', - 'failed_scenarios_title' => 'Cenários que falharam:', - 'failed_hooks_title' => 'Hooks que falharam:', - 'failed_steps_title' => 'Definições que falharam:', - 'failed_step_title' => 'Definição que falhou:', - 'pending_steps_title' => 'Definições por definir:', - 'scenarios_count' => '{0} Nenhum cenário|{1} 1 cenário|]1,Inf] %count% cenários', - 'steps_count' => '{0} Nenhuma definição|{1} 1 definição|]1,Inf] %count% definições', - 'passed_count' => '{1} passou|]1,Inf] %count% passaram', - 'failed_count' => '{1} falhou|]1,Inf] %count% falharam', - 'pending_count' => '[1,Inf] %count% por definir', - 'undefined_count' => '{1} indefinido|]1,Inf] %count% indefinidos', - 'skipped_count' => '{1} omitido|]1,Inf] %count% omitidos', - ), - 'pt-BR' => array( - 'snippet_proposal_title' => '%count% possue etapas faltando. Defina elas com esse(s) trecho(s) de código:', - 'snippet_missing_title' => 'Trecho de códigos para as seguintes etapas em %count% suite não foram geradas (verique sua configuração):', - 'failed_scenarios_title' => 'Cenários falhados:', - 'failed_hooks_title' => 'Hooks falhados:', - 'failed_steps_title' => 'Etapas falhadas:', - 'failed_step_title' => 'Etapa com falha:', - 'pending_steps_title' => 'Etapas pendentes:', - 'scenarios_count' => '{0} Nenhum cenário|{1} 1 cenário|]1,Inf] %count% cenários', - 'steps_count' => '{0} Nenhuma etapa|{1} 1 etapa|]1,Inf] %count% etapas', - 'passed_count' => '[1,Inf] %count% passou', - 'failed_count' => '[1,Inf] %count% falhou', - 'pending_count' => '[1,Inf] %count% pendente', - 'undefined_count' => '[1,Inf] %count% indefinido', - 'skipped_count' => '[1,Inf] %count% pulado', - ), - 'ro' => array( - 'snippet_proposal_title' => '%count% are pași lipsa. Puteți implementa pașii cu ajutorul acestor fragmente de cod:', - 'snippet_missing_title' => 'Fragmentele de cod pentru urmatorii pași din suita %count% nu au fost generate (contextul tau implementeaza interfata SnippetAcceptingContext?):', - 'skipped_scenarios_title' => 'Scenarii omise:', - 'failed_scenarios_title' => 'Scenarii eșuate:', - 'failed_hooks_title' => 'Hook-uri eșuate:', - 'failed_steps_title' => 'Pași esuați:', - 'failed_step_title' => 'Paș esuaț:', - 'pending_steps_title' => 'Pași in așteptare:', - 'scenarios_count' => '{0} Niciun scenariu|{1} 1 scenariu|]1,Inf] %count% scenarii', - 'steps_count' => '{0} Niciun pas|{1} 1 pas|]1,Inf] %count% pasi', - 'passed_count' => '[1,Inf] %count% cu succes', - 'failed_count' => '[1,Inf] %count% fara success', - 'pending_count' => '[1,Inf] %count% in așteptare', - 'undefined_count' => '[1,Inf] %count% fara implementare', - 'skipped_count' => '{1} %count% omis|]1,Inf] %count% omiși', - ), - 'ru' => array( - 'snippet_proposal_title' => '%count% не содержит необходимых определений. Вы можете добавить их используя шаблоны:', - 'snippet_missing_title' => 'Шаблоны для следующих шагов в среде %count% не были сгенерированы (проверьте ваши настройки):', - 'skipped_scenarios_title' => 'Пропущенные сценарии:', - 'failed_scenarios_title' => 'Проваленные сценарии:', - 'failed_hooks_title' => 'Проваленные хуки:', - 'failed_steps_title' => 'Проваленные шаги:', - 'failed_step_title' => 'Проваленные шаг:', - 'pending_steps_title' => 'Шаги в ожидании:', - 'scenarios_count' => '{0} Нет сценариев|{1,21,31} %count% сценарий|{2,3,4,22,23,24} %count% сценария|]4,Inf] %count% сценариев', - 'steps_count' => '{0} Нет шагов|{1,21,31} %count% шаг|{2,3,4,22,23,24} %count% шага|]4,Inf] %count% шагов', - 'passed_count' => '{1,21,31} %count% пройден|]1,Inf] %count% пройдено', - 'failed_count' => '{1,21,31} %count% провален|]1,Inf] %count% провалено', - 'pending_count' => '[1,Inf] %count% в ожидании', - 'undefined_count' => '{1,21,31} %count% не определен|]1,Inf] %count% не определено', - 'skipped_count' => '{1,21,31} %count% пропущен|]1,Inf] %count% пропущено', - ), - 'zh' => array( - 'snippet_context_choice' => '%count% 有新的场景步骤, 请选择要生成代码片段的ContextClass:', - 'snippet_proposal_title' => '%count% 已经更新。 请检查生成片段:', - 'snippet_missing_title' => '您可以使用 --snippets-for CLI命令更新 %count% 的ContextClass:', - 'skipped_scenarios_title' => '跳过场景:', - 'failed_scenarios_title' => '失败的场景:', - 'failed_hooks_title' => '失败的挂钩(hooks):', - 'failed_steps_title' => '失败的步骤:', - 'pending_steps_title' => '生成的步骤:', - 'scenarios_count' => '{0} No scenarios|{1} 1 个场景|]1,Inf] %count% 个场景', - 'steps_count' => '{0} 没有步骤|{1} 1 个步骤|]1,Inf] %count% 个步骤', - 'passed_count' => '[1,Inf] %count% 个成功', - 'failed_count' => '[1,Inf] %count% 个失败', - 'pending_count' => '[1,Inf] %count% 个待实现方法', - 'undefined_count' => '[1,Inf] %count% 个未定义', - 'skipped_count' => '[1,Inf] %count% 个跳过', - ), -); diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/ApplicationFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/ApplicationFactory.php deleted file mode 100644 index f2870ae..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/ApplicationFactory.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat; - -use Behat\Behat\Context\ServiceContainer\ContextExtension; -use Behat\Behat\Definition\ServiceContainer\DefinitionExtension; -use Behat\Behat\EventDispatcher\ServiceContainer\EventDispatcherExtension; -use Behat\Behat\Gherkin\ServiceContainer\GherkinExtension; -use Behat\Behat\Hook\ServiceContainer\HookExtension; -use Behat\Behat\Output\ServiceContainer\Formatter\JUnitFormatterFactory; -use Behat\Behat\Output\ServiceContainer\Formatter\PrettyFormatterFactory; -use Behat\Behat\Output\ServiceContainer\Formatter\ProgressFormatterFactory; -use Behat\Behat\HelperContainer\ServiceContainer\HelperContainerExtension; -use Behat\Behat\Snippet\ServiceContainer\SnippetExtension; -use Behat\Behat\Tester\ServiceContainer\TesterExtension; -use Behat\Behat\Transformation\ServiceContainer\TransformationExtension; -use Behat\Behat\Translator\ServiceContainer\GherkinTranslationsExtension; -use Behat\Testwork\ApplicationFactory as BaseFactory; -use Behat\Testwork\Argument\ServiceContainer\ArgumentExtension; -use Behat\Testwork\Autoloader\ServiceContainer\AutoloaderExtension; -use Behat\Testwork\Call\ServiceContainer\CallExtension; -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; -use Behat\Testwork\Exception\ServiceContainer\ExceptionExtension; -use Behat\Testwork\Filesystem\ServiceContainer\FilesystemExtension; -use Behat\Testwork\Ordering\ServiceContainer\OrderingExtension; -use Behat\Testwork\Output\ServiceContainer\Formatter\FormatterFactory; -use Behat\Testwork\Output\ServiceContainer\OutputExtension; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Specification\ServiceContainer\SpecificationExtension; -use Behat\Testwork\Suite\ServiceContainer\SuiteExtension; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; - -/** - * Defines the way behat is created. - * - * @author Konstantin Kudryashov - */ -final class ApplicationFactory extends BaseFactory -{ - public const VERSION = '3.13.0'; - - /** - * {@inheritdoc} - */ - protected function getName() - { - return 'behat'; - } - - /** - * {@inheritdoc} - */ - protected function getVersion() - { - return self::VERSION; - } - - /** - * {@inheritdoc} - */ - protected function getDefaultExtensions() - { - $processor = new ServiceProcessor(); - - return array( - new ArgumentExtension(), - new AutoloaderExtension(array('' => '%paths.base%/features/bootstrap')), - new SuiteExtension($processor), - new OutputExtension('pretty', $this->getDefaultFormatterFactories($processor), $processor), - new ExceptionExtension($processor), - new GherkinExtension($processor), - new CallExtension($processor), - new TranslatorExtension(), - new GherkinTranslationsExtension(), - new TesterExtension($processor), - new CliExtension($processor), - new EnvironmentExtension($processor), - new SpecificationExtension($processor), - new FilesystemExtension(), - new ContextExtension($processor), - new SnippetExtension($processor), - new DefinitionExtension($processor), - new EventDispatcherExtension($processor), - new HookExtension(), - new TransformationExtension($processor), - new OrderingExtension($processor), - new HelperContainerExtension($processor) - ); - } - - /** - * {@inheritdoc} - */ - protected function getEnvironmentVariableName() - { - return 'BEHAT_PARAMS'; - } - - /** - * {@inheritdoc} - */ - protected function getConfigPath() - { - $cwd = rtrim(getcwd(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; - $configDir = $cwd . 'config' . DIRECTORY_SEPARATOR; - $paths = array( - $cwd . 'behat.yaml', - $cwd . 'behat.yml', - $cwd . 'behat.yaml.dist', - $cwd . 'behat.yml.dist', - $configDir . 'behat.yaml', - $configDir . 'behat.yml', - $configDir . 'behat.yaml.dist', - $configDir . 'behat.yml.dist', - ); - - foreach ($paths as $path) { - if (is_file($path)) { - return $path; - } - } - - return null; - } - - /** - * Returns default formatter factories. - * - * @param ServiceProcessor $processor - * - * @return FormatterFactory[] - */ - private function getDefaultFormatterFactories(ServiceProcessor $processor) - { - return array( - new PrettyFormatterFactory($processor), - new ProgressFormatterFactory($processor), - new JUnitFormatterFactory(), - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Annotation/AnnotationReader.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Annotation/AnnotationReader.php deleted file mode 100644 index 84f7ac9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Annotation/AnnotationReader.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Annotation; - -use Behat\Behat\Context\Reader\AnnotatedContextReader; -use Behat\Testwork\Call\Callee; -use ReflectionMethod; - -/** - * Reads custom annotation of a provided context method into a Callee. - * - * @see AnnotatedContextReader - * - * @author Konstantin Kudryashov - */ -interface AnnotationReader -{ - /** - * Reads all callees associated with a provided method. - * - * @param string $contextClass - * @param ReflectionMethod $method - * @param string $docLine - * @param string $description - * - * @return null|Callee - */ - public function readCallee($contextClass, ReflectionMethod $method, $docLine, $description); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/ArgumentResolver.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/ArgumentResolver.php deleted file mode 100644 index e218276..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/ArgumentResolver.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Argument; - -use Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler; -use ReflectionClass; - -/** - * Resolves arguments of context constructors. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - */ -interface ArgumentResolver -{ - /** - * Resolves context constructor arguments. - * - * @param ReflectionClass $classReflection - * @param mixed[] $arguments - * - * @return mixed[] - */ - public function resolveArguments(ReflectionClass $classReflection, array $arguments); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/CompositeFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/CompositeFactory.php deleted file mode 100644 index 5b3d93f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/CompositeFactory.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Argument; - -use Behat\Testwork\Suite\Suite; - -/** - * Composite factory. Delegates to other (registered) factories to do the job. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - * - * @deprecated and will be removed in 4.0. Use CompositeArgumentResolverFactory instead - */ -final class CompositeFactory implements SuiteScopedResolverFactory -{ - /** - * @var SuiteScopedResolverFactory[] - */ - private $factories = array(); - - /** - * Registers factory. - * - * @param SuiteScopedResolverFactory $factory - */ - public function registerFactory(SuiteScopedResolverFactory $factory) - { - $this->factories[] = $factory; - } - - /** - * {@inheritdoc} - */ - public function generateArgumentResolvers(Suite $suite) - { - return array_reduce( - $this->factories, - function (array $resolvers, SuiteScopedResolverFactory $factory) use ($suite) { - return array_merge($resolvers, $factory->generateArgumentResolvers($suite)); - }, - array() - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/NullFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/NullFactory.php deleted file mode 100644 index c2e070c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/NullFactory.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Argument; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Suite\Suite; - -/** - * NoOp factory. Always returns zero resolvers. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - */ -final class NullFactory implements ArgumentResolverFactory, SuiteScopedResolverFactory -{ - /** - * {@inheritdoc} - */ - public function generateArgumentResolvers(Suite $suite) - { - return array(); - } - - /** - * {@inheritdoc} - */ - public function createArgumentResolvers(Environment $environment) - { - return array(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactory.php deleted file mode 100644 index 9f953fc..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Argument/SuiteScopedResolverFactory.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Argument; - -use Behat\Testwork\Suite\Suite; - -/** - * Creates argument resolvers for provided suite. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - * - * @deprecated since 3.4. Use `ArgumentResolverFactory` instead - */ -interface SuiteScopedResolverFactory -{ - /** - * Creates argument resolvers for provided suite. - * - * @param Suite $suite - * - * @return ArgumentResolver[] - */ - public function generateArgumentResolvers(Suite $suite); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Cli/ContextSnippetsController.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Cli/ContextSnippetsController.php deleted file mode 100644 index 3bfbc40..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Cli/ContextSnippetsController.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Cli; - -use Behat\Behat\Context\Snippet\Generator\AggregatePatternIdentifier; -use Behat\Behat\Context\Snippet\Generator\ContextInterfaceBasedContextIdentifier; -use Behat\Behat\Context\Snippet\Generator\ContextInterfaceBasedPatternIdentifier; -use Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator; -use Behat\Behat\Context\Snippet\Generator\FixedContextIdentifier; -use Behat\Behat\Context\Snippet\Generator\FixedPatternIdentifier; -use Behat\Behat\Context\Snippet\Generator\AggregateContextIdentifier; -use Behat\Behat\Definition\Translator\TranslatorInterface; -use Behat\Testwork\Cli\Controller; -use Symfony\Component\Console\Command\Command as SymfonyCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Configures which context snippets are generated for. - * - * @author Konstantin Kudryashov - */ -final class ContextSnippetsController implements Controller -{ - /** - * @var ContextSnippetGenerator - */ - private $generator; - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * Initialises controller. - * - * @param ContextSnippetGenerator $generator - * @param TranslatorInterface $translator - */ - public function __construct(ContextSnippetGenerator $generator, TranslatorInterface $translator) - { - $this->generator = $generator; - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function configure(SymfonyCommand $command) - { - $command - ->addOption( - '--snippets-for', null, InputOption::VALUE_OPTIONAL, - "Specifies which context class to generate snippets for." - ) - ->addOption( - '--snippets-type', null, InputOption::VALUE_REQUIRED, - "Specifies which type of snippets (turnip, regex) to generate." - ); - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $this->generator->setContextIdentifier( - new AggregateContextIdentifier(array( - new ContextInterfaceBasedContextIdentifier(), - new FixedContextIdentifier($input->getOption('snippets-for')), - new InteractiveContextIdentifier($this->translator, $input, $output) - )) - ); - - $this->generator->setPatternIdentifier( - new AggregatePatternIdentifier(array( - new ContextInterfaceBasedPatternIdentifier(), - new FixedPatternIdentifier($input->getOption('snippets-type')) - )) - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php deleted file mode 100644 index 78be23b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Cli/InteractiveContextIdentifier.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Cli; - -use Behat\Behat\Context\Environment\ContextEnvironment; -use Behat\Behat\Context\Snippet\Generator\TargetContextIdentifier; -use Behat\Behat\Definition\Translator\TranslatorInterface; -use Symfony\Component\Console\Helper\QuestionHelper; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\ChoiceQuestion; - -/** - * Interactive identifier that asks user for input. - * - * @author Konstantin Kudryashov - */ -final class InteractiveContextIdentifier implements TargetContextIdentifier -{ - /** - * @var TranslatorInterface - */ - private $translator; - /** - * @var InputInterface - */ - private $input; - /** - * @var OutputInterface - */ - private $output; - - /** - * Initialises identifier. - * - * @param TranslatorInterface $translator - * @param InputInterface $input - * @param OutputInterface $output - */ - public function __construct(TranslatorInterface $translator, InputInterface $input, OutputInterface $output) - { - $this->translator = $translator; - $this->input = $input; - $this->output = $output; - } - - /** - * {@inheritdoc} - */ - public function guessTargetContextClass(ContextEnvironment $environment) - { - if (!$this->input->isInteractive()) { - return null; - } - - $suiteName = $environment->getSuite()->getName(); - $contextClasses = $environment->getContextClasses(); - - if (!count($contextClasses)) { - return null; - } - - $message = $this->translator->trans('snippet_context_choice', array('%count%' => $suiteName), 'output'); - $choices = array_values(array_merge(array('None'), $contextClasses)); - $default = 1; - - $answer = $this->askQuestion('>> ' . $message, $choices, $default); - - return 'None' !== $answer ? $answer : null; - } - - /** - * Asks user question. - * - * @param string $message - * @param string[] $choices - * @param string $default - * - * @return string - */ - private function askQuestion($message, $choices, $default) - { - $this->output->writeln(''); - $helper = new QuestionHelper(); - $question = new ChoiceQuestion(' ' . $message . "\n", $choices, $default); - - return $helper->ask($this->input, $this->output, $question); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Context.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Context.php deleted file mode 100644 index b9ac895..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Context.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context; - -/** - * Marks a custom user-defined class as a behat context. - * - * @author Konstantin Kudryashov - */ -interface Context -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/ClassGenerator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/ClassGenerator.php deleted file mode 100644 index 0a7cb5e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/ClassGenerator.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\ContextClass; - -use Behat\Behat\Context\Suite\Setup\SuiteWithContextsSetup; -use Behat\Testwork\Suite\Suite; - -/** - * Generates context classes (as a string). - * - * @see SuiteWithContextsSetup - * - * @author Konstantin Kudryashov - */ -interface ClassGenerator -{ - /** - * Checks if generator supports provided context class. - * - * @param Suite $suite - * @param string $contextClass - * - * @return bool - */ - public function supportsSuiteAndClass(Suite $suite, $contextClass); - - /** - * Generates context class code. - * - * @param Suite $suite - * @param string $contextClass - * - * @return string The context class source code - */ - public function generateClass(Suite $suite, $contextClass); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/ClassResolver.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/ClassResolver.php deleted file mode 100644 index dce0f80..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/ClassResolver.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\ContextClass; - -use Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler; - -/** - * Resolves arbitrary context strings into a context classes. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - */ -interface ClassResolver -{ - /** - * Checks if resolvers supports provided class. - * - * @param string $contextString - * - * @return bool - */ - public function supportsClass($contextString); - - /** - * Resolves context class. - * - * @param string $contextClass - * - * @return string - */ - public function resolveClass($contextClass); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/SimpleClassGenerator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/SimpleClassGenerator.php deleted file mode 100644 index f37ac44..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextClass/SimpleClassGenerator.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\ContextClass; - -use Behat\Testwork\Suite\Suite; - -/** - * Generates basic PHP 5.3+ class with an optional namespace. - * - * @author Konstantin Kudryashov - */ -final class SimpleClassGenerator implements ClassGenerator -{ - /** - * @var string - */ - protected static $template = <<<'PHP' - $namespace, - '{className}' => $contextClass, - ) - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextFactory.php deleted file mode 100644 index 0d22650..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ContextFactory.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context; - -use Behat\Testwork\Argument\Validator; -use Behat\Behat\Context\Argument\ArgumentResolver; -use Behat\Behat\Context\Initializer\ContextInitializer; -use Behat\Testwork\Argument\ArgumentOrganiser; -use ReflectionClass; - -/** - * Instantiates contexts using registered argument resolvers and context initializers. - * - * @author Konstantin Kudryashov - */ -final class ContextFactory -{ - /** - * @var ArgumentOrganiser - */ - private $argumentOrganiser; - /** - * @var ArgumentResolver[] - */ - private $argumentResolvers = array(); - /** - * @var ContextInitializer[] - */ - private $contextInitializers = array(); - /** - * @var Validator - */ - private $validator; - - /** - * Initialises factory. - * - * @param ArgumentOrganiser $argumentOrganiser - */ - public function __construct(ArgumentOrganiser $argumentOrganiser) - { - $this->argumentOrganiser = $argumentOrganiser; - $this->validator = new Validator(); - } - - /** - * Registers context argument resolver. - * - * @param ArgumentResolver $resolver - */ - public function registerArgumentResolver(ArgumentResolver $resolver) - { - $this->argumentResolvers[] = $resolver; - } - - /** - * Registers context initializer. - * - * @param ContextInitializer $initializer - */ - public function registerContextInitializer(ContextInitializer $initializer) - { - $this->contextInitializers[] = $initializer; - } - - /** - * Creates and initializes context class. - * - * @param string $class - * @param array $arguments - * @param ArgumentResolver[] $singleUseResolvers - * - * @return Context - */ - public function createContext($class, array $arguments = array(), array $singleUseResolvers = array()) - { - $reflection = new ReflectionClass($class); - $resolvers = array_merge($singleUseResolvers, $this->argumentResolvers); - $resolvedArguments = $this->resolveArguments($reflection, $arguments, $resolvers); - $context = $this->createInstance($reflection, $resolvedArguments); - $this->initializeInstance($context); - - return $context; - } - - /** - * Resolves arguments for a specific class using registered argument resolvers. - * - * @param ReflectionClass $reflection - * @param array $arguments - * @param ArgumentResolver[] $resolvers - * - * @return mixed[] - */ - private function resolveArguments(ReflectionClass $reflection, array $arguments, array $resolvers) - { - $newArguments = $arguments; - - foreach ($resolvers as $resolver) { - $newArguments = $resolver->resolveArguments($reflection, $newArguments); - } - - if (!$reflection->hasMethod('__construct')) { - return $newArguments; - } - - $constructor = $reflection->getConstructor(); - $newArguments = $this->argumentOrganiser->organiseArguments($constructor, $newArguments); - $this->validator->validateArguments($constructor, $newArguments); - - return $newArguments; - } - - /** - * Creates context instance. - * - * @param ReflectionClass $reflection - * @param array $arguments - * - * @return mixed - */ - private function createInstance(ReflectionClass $reflection, array $arguments) - { - if (count($arguments)) { - return $reflection->newInstanceArgs(array_values($arguments)); - } - - return $reflection->newInstance(); - } - - /** - * Initializes context class and returns new context instance. - * - * @param Context $context - */ - private function initializeInstance(Context $context) - { - foreach ($this->contextInitializers as $initializer) { - $initializer->initializeContext($context); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/CustomSnippetAcceptingContext.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/CustomSnippetAcceptingContext.php deleted file mode 100644 index 5090d30..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/CustomSnippetAcceptingContext.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context; - -use Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator; - -/** - * Context that implements this interface is treated as a custom-snippet-friendly context. - * - * @see ContextSnippetGenerator - * - * @author Konstantin Kudryashov - * - * @deprecated will be removed in 4.0. Use --snippets-for and --snippets-type CLI options instead - */ -interface CustomSnippetAcceptingContext extends SnippetAcceptingContext -{ - /** - * Returns type of the snippets that this context accepts. - * - * Behat implements a couple of types by default: "regex" and "turnip" - * - * @return string - */ - public static function getAcceptedSnippetType(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/ContextEnvironment.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/ContextEnvironment.php deleted file mode 100644 index c63543e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/ContextEnvironment.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Environment; - -use Behat\Behat\Context\Context; -use Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler; -use Behat\Testwork\Environment\Environment; - -/** - * Represents test environment based on a collection of contexts. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - */ -interface ContextEnvironment extends Environment -{ - /** - * Checks if environment has any contexts registered. - * - * @return bool - */ - public function hasContexts(); - - /** - * Returns list of registered context classes. - * - * @return list> - */ - public function getContextClasses(); - - /** - * Checks if environment contains context with the specified class name. - * - * @param class-string $class - * - * @return bool - */ - public function hasContextClass($class); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php deleted file mode 100644 index d686400..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/Handler/ContextEnvironmentHandler.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Environment\Handler; - -use Behat\Behat\Context\Argument\SuiteScopedResolverFactory; -use Behat\Behat\Context\Argument\SuiteScopedResolverFactoryAdapter; -use Behat\Behat\Context\Argument\ArgumentResolverFactory; -use Behat\Behat\Context\Argument\NullFactory; -use Behat\Behat\Context\ContextClass\ClassResolver; -use Behat\Behat\Context\ContextFactory; -use Behat\Behat\Context\Environment\InitializedContextEnvironment; -use Behat\Behat\Context\Environment\UninitializedContextEnvironment; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\Exception\EnvironmentIsolationException; -use Behat\Testwork\Environment\Handler\EnvironmentHandler; -use Behat\Testwork\Suite\Exception\SuiteConfigurationException; -use Behat\Testwork\Suite\Suite; - -/** - * Handles build and initialisation of the context-based environments. - * - * @see ContextFactory - * - * @author Konstantin Kudryashov - */ -final class ContextEnvironmentHandler implements EnvironmentHandler -{ - /** - * @var ContextFactory - */ - private $contextFactory; - /** - * @var ArgumentResolverFactory - */ - private $resolverFactory; - /** - * @var ClassResolver[] - */ - private $classResolvers = array(); - - /** - * Initializes handler. - * - * @param ContextFactory $factory - * @param ArgumentResolverFactory|SuiteScopedResolverFactory $resolverFactory - */ - public function __construct(ContextFactory $factory, $resolverFactory = null) - { - $this->contextFactory = $factory; - - if ($resolverFactory && !$resolverFactory instanceof ArgumentResolverFactory) { - $resolverFactory = new SuiteScopedResolverFactoryAdapter($resolverFactory); - } - - $this->resolverFactory = $resolverFactory ?: new NullFactory(); - } - - /** - * Registers context class resolver. - * - * @param ClassResolver $resolver - */ - public function registerClassResolver(ClassResolver $resolver) - { - $this->classResolvers[] = $resolver; - } - - /** - * {@inheritdoc} - */ - public function supportsSuite(Suite $suite) - { - return $suite->hasSetting('contexts'); - } - - /** - * {@inheritdoc} - */ - public function buildEnvironment(Suite $suite) - { - $environment = new UninitializedContextEnvironment($suite); - foreach ($this->getNormalizedContextSettings($suite) as $context) { - $environment->registerContextClass($this->resolveClass($context[0]), $context[1]); - } - - return $environment; - } - - /** - * {@inheritdoc} - */ - public function supportsEnvironmentAndSubject(Environment $environment, $testSubject = null) - { - return $environment instanceof UninitializedContextEnvironment; - } - - /** - * {@inheritdoc} - */ - public function isolateEnvironment(Environment $uninitializedEnvironment, $testSubject = null) - { - if (!$uninitializedEnvironment instanceof UninitializedContextEnvironment) { - throw new EnvironmentIsolationException(sprintf( - 'ContextEnvironmentHandler does not support isolation of `%s` environment.', - get_class($uninitializedEnvironment) - ), $uninitializedEnvironment); - } - - $environment = new InitializedContextEnvironment($uninitializedEnvironment->getSuite()); - $resolvers = $this->resolverFactory->createArgumentResolvers($environment); - - foreach ($uninitializedEnvironment->getContextClassesWithArguments() as $class => $arguments) { - $context = $this->contextFactory->createContext($class, $arguments, $resolvers); - $environment->registerContext($context); - } - - return $environment; - } - - /** - * Returns normalized suite context settings. - * - * @param Suite $suite - * - * @return array - */ - private function getNormalizedContextSettings(Suite $suite) - { - return array_map( - function ($context) { - $class = $context; - $arguments = array(); - - if (is_array($context)) { - $class = current(array_keys($context)); - $arguments = $context[$class]; - } - - return array($class, $arguments); - }, - $this->getSuiteContexts($suite) - ); - } - - /** - * Returns array of context classes configured for the provided suite. - * - * @param Suite $suite - * - * @return string[] - * - * @throws SuiteConfigurationException If `contexts` setting is not an array - */ - private function getSuiteContexts(Suite $suite) - { - if (!is_array($suite->getSetting('contexts'))) { - throw new SuiteConfigurationException( - sprintf('`contexts` setting of the "%s" suite is expected to be an array, %s given.', - $suite->getName(), - gettype($suite->getSetting('contexts')) - ), - $suite->getName() - ); - } - - return $suite->getSetting('contexts'); - } - - /** - * Resolves class using registered class resolvers. - * - * @param string $class - * - * @return string - */ - private function resolveClass($class) - { - foreach ($this->classResolvers as $resolver) { - if ($resolver->supportsClass($class)) { - return $resolver->resolveClass($class); - } - } - - return $class; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php deleted file mode 100644 index 45774d1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/InitializedContextEnvironment.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Environment; - -use Behat\Behat\Context\Context; -use Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler; -use Behat\Behat\Context\Exception\ContextNotFoundException; -use Behat\Behat\HelperContainer\Environment\ServiceContainerEnvironment; -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Suite\Suite; -use Psr\Container\ContainerInterface; - -/** - * Context environment based on a list of instantiated context objects. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - */ -final class InitializedContextEnvironment implements ContextEnvironment, ServiceContainerEnvironment -{ - /** - * @var string - */ - private $suite; - /** - * @var ContainerInterface - */ - private $serviceContainer; - /** - * @var array, Context> - * @psalm-var class-string-map - */ - private $contexts = array(); - - /** - * Initializes environment. - * - * @param Suite $suite - */ - public function __construct(Suite $suite) - { - $this->suite = $suite; - } - - /** - * Registers context instance in the environment. - * - * @param Context $context - */ - public function registerContext(Context $context) - { - $this->contexts[get_class($context)] = $context; - } - - /** - * {@inheritdoc} - */ - public function setServiceContainer(ContainerInterface $container = null) - { - $this->serviceContainer = $container; - } - - /** - * {@inheritdoc} - */ - public function getSuite() - { - return $this->suite; - } - - /** - * {@inheritdoc} - */ - public function hasContexts() - { - return count($this->contexts) > 0; - } - - /** - * {@inheritdoc} - */ - public function getContextClasses() - { - return array_keys($this->contexts); - } - - /** - * {@inheritdoc} - */ - public function hasContextClass($class) - { - return isset($this->contexts[$class]); - } - - /** - * Returns list of registered context instances. - * - * @return list - */ - public function getContexts() - { - return array_values($this->contexts); - } - - /** - * Returns registered context by its class name. - * - * @template T of Context - * - * @param class-string $class - * - * @return T - * - * @throws ContextNotFoundException If context is not in the environment - */ - public function getContext($class) - { - if (!$this->hasContextClass($class)) { - throw new ContextNotFoundException(sprintf( - '`%s` context is not found in the suite environment. Have you registered it?', - $class - ), $class); - } - - return $this->contexts[$class]; - } - - /** - * {@inheritdoc} - */ - public function getServiceContainer() - { - return $this->serviceContainer; - } - - /** - * {@inheritdoc} - */ - public function bindCallee(Callee $callee) - { - $callable = $callee->getCallable(); - - if ($callee->isAnInstanceMethod()) { - return array($this->getContext($callable[0]), $callable[1]); - } - - return $callable; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/Reader/ContextEnvironmentReader.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/Reader/ContextEnvironmentReader.php deleted file mode 100644 index 71759e9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/Reader/ContextEnvironmentReader.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Environment\Reader; - -use Behat\Behat\Context\Environment\ContextEnvironment; -use Behat\Behat\Context\Reader\ContextReader; -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\Exception\EnvironmentReadException; -use Behat\Testwork\Environment\Reader\EnvironmentReader; - -/** - * Reads context-based environment callees using registered context loaders. - * - * @author Konstantin Kudryashov - */ -final class ContextEnvironmentReader implements EnvironmentReader -{ - /** - * @var ContextReader[] - */ - private $contextReaders = array(); - - /** - * Registers context loader. - * - * @param ContextReader $contextReader - */ - public function registerContextReader(ContextReader $contextReader) - { - $this->contextReaders[] = $contextReader; - } - - /** - * {@inheritdoc} - */ - public function supportsEnvironment(Environment $environment) - { - return $environment instanceof ContextEnvironment; - } - - /** - * {@inheritdoc} - */ - public function readEnvironmentCallees(Environment $environment) - { - if (!$environment instanceof ContextEnvironment) { - throw new EnvironmentReadException(sprintf( - 'ContextEnvironmentReader does not support `%s` environment.', - get_class($environment) - ), $environment); - } - - $callees = array(); - foreach ($environment->getContextClasses() as $contextClass) { - $callees = array_merge( - $callees, - $this->readContextCallees($environment, $contextClass) - ); - } - - return $callees; - } - - /** - * Reads callees from a specific suite's context. - * - * @param ContextEnvironment $environment - * @param string $contextClass - * - * @return Callee[] - */ - private function readContextCallees(ContextEnvironment $environment, $contextClass) - { - $callees = array(); - foreach ($this->contextReaders as $loader) { - $callees = array_merge( - $callees, - $loader->readContextCallees($environment, $contextClass) - ); - } - - return $callees; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/UninitializedContextEnvironment.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/UninitializedContextEnvironment.php deleted file mode 100644 index a517d5f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Environment/UninitializedContextEnvironment.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Environment; - -use Behat\Behat\Context\Context; -use Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler; -use Behat\Behat\Context\Exception\ContextNotFoundException; -use Behat\Behat\Context\Exception\WrongContextClassException; -use Behat\Testwork\Environment\StaticEnvironment; - -/** - * Context environment based on a list of context classes. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - */ -final class UninitializedContextEnvironment extends StaticEnvironment implements ContextEnvironment -{ - /** - * @var array, array> - */ - private $contextClasses = array(); - - /** - * Registers context class. - * - * @param class-string $contextClass - * @param null|array $arguments - * - * @throws ContextNotFoundException If class does not exist - * @throws WrongContextClassException if class does not implement Context interface - */ - public function registerContextClass($contextClass, array $arguments = null) - { - if (!class_exists($contextClass)) { - throw new ContextNotFoundException(sprintf( - '`%s` context class not found and can not be used.', - $contextClass - ), $contextClass); - } - - $reflClass = new \ReflectionClass($contextClass); - - if (!$reflClass->implementsInterface('Behat\Behat\Context\Context')) { - throw new WrongContextClassException(sprintf( - 'Every context class must implement Behat Context interface, but `%s` does not.', - $contextClass - ), $contextClass); - } - - $this->contextClasses[$contextClass] = $arguments ? : array(); - } - - /** - * {@inheritdoc} - */ - public function hasContexts() - { - return count($this->contextClasses) > 0; - } - - /** - * {@inheritdoc} - */ - public function getContextClasses() - { - return array_keys($this->contextClasses); - } - - /** - * {@inheritdoc} - */ - public function hasContextClass($class) - { - return isset($this->contextClasses[$class]); - } - - /** - * Returns context classes with their arguments. - * - * @return array, array> - */ - public function getContextClassesWithArguments() - { - return $this->contextClasses; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/ContextException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/ContextException.php deleted file mode 100644 index bc1a427..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/ContextException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * Represents an exception thrown during context handling. - * - * @author Konstantin Kudryashov - */ -interface ContextException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/ContextNotFoundException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/ContextNotFoundException.php deleted file mode 100644 index 64cfde9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/ContextNotFoundException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception thrown when provided context class is not found. - * - * @author Konstantin Kudryashov - */ -final class ContextNotFoundException extends InvalidArgumentException implements ContextException -{ - /** - * @var string - */ - private $class; - - /** - * Initializes exception. - * - * @param string $message - * @param string $class - */ - public function __construct($message, $class) - { - $this->class = $class; - - parent::__construct($message); - } - - /** - * Returns not found classname. - * - * @return string - */ - public function getClass() - { - return $this->class; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/UnknownTranslationResourceException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/UnknownTranslationResourceException.php deleted file mode 100644 index 2c4a761..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/UnknownTranslationResourceException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception when provided translation resource is not recognised. - * - * @author Konstantin Kudryashov - */ -final class UnknownTranslationResourceException extends InvalidArgumentException implements ContextException -{ - /** - * @var string - */ - private $resource; - - /** - * Initializes exception. - * - * @param string $message - * @param string $class - */ - public function __construct($message, $class) - { - $this->resource = $class; - - parent::__construct($message); - } - - /** - * Returns unsupported resource. - * - * @return string - */ - public function getResource() - { - return $this->resource; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/WrongContextClassException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/WrongContextClassException.php deleted file mode 100644 index 69ccc8c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Exception/WrongContextClassException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception when provided class exists, but is not an acceptable as a context. - * - * @author Konstantin Kudryashov - */ -final class WrongContextClassException extends InvalidArgumentException implements ContextException -{ - /** - * @var string - */ - private $class; - - /** - * Initializes exception. - * - * @param integer $message - * @param string $class - */ - public function __construct($message, $class) - { - $this->class = $class; - - parent::__construct($message); - } - - /** - * Returns not found classname. - * - * @return string - */ - public function getClass() - { - return $this->class; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Initializer/ContextInitializer.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Initializer/ContextInitializer.php deleted file mode 100644 index 3d2b356..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Initializer/ContextInitializer.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Initializer; - -use Behat\Behat\Context\Context; - -/** - * Initializes contexts using custom logic. - * - * @author Konstantin Kudryashov - */ -interface ContextInitializer -{ - /** - * Initializes provided context. - * - * @param Context $context - */ - public function initializeContext(Context $context); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php deleted file mode 100644 index 6fe0b07..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/AnnotatedContextReader.php +++ /dev/null @@ -1,230 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Reader; - -use Behat\Behat\Context\Annotation\AnnotationReader; -use Behat\Behat\Context\Annotation\DocBlockHelper; -use Behat\Behat\Context\Environment\ContextEnvironment; -use Behat\Testwork\Call\Callee; -use ReflectionClass; -use ReflectionException; -use ReflectionMethod; - -/** - * Reads context callees by annotations using registered annotation readers. - * - * @author Konstantin Kudryashov - */ -final class AnnotatedContextReader implements ContextReader -{ - public const DOCLINE_TRIMMER_REGEX = '/^\/\*\*\s*|^\s*\*\s*|\s*\*\/$|\s*$/'; - - /** - * @var string[] - */ - private static $ignoreAnnotations = array( - '@param', - '@return', - '@throws', - '@see', - '@uses', - '@todo' - ); - /** - * @var AnnotationReader[] - */ - private $readers = array(); - - /** - * @var DocBlockHelper - */ - private $docBlockHelper; - - /** - * Initializes reader. - * - * @param DocBlockHelper $docBlockHelper - */ - public function __construct(DocBlockHelper $docBlockHelper) - { - $this->docBlockHelper = $docBlockHelper; - } - - /** - * Registers annotation reader. - * - * @param AnnotationReader $reader - */ - public function registerAnnotationReader(AnnotationReader $reader) - { - $this->readers[] = $reader; - } - - /** - * {@inheritdoc} - */ - public function readContextCallees(ContextEnvironment $environment, $contextClass) - { - $reflection = new ReflectionClass($contextClass); - - $callees = array(); - foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { - foreach ($this->readMethodCallees($reflection->getName(), $method) as $callee) { - $callees[] = $callee; - } - } - - return $callees; - } - - /** - * Loads callees associated with specific method. - * - * @param string $class - * @param ReflectionMethod $method - * - * @return Callee[] - */ - private function readMethodCallees($class, ReflectionMethod $method) - { - $callees = array(); - - // read parent annotations - try { - $prototype = $method->getPrototype(); - // error occurs on every second PHP stable release - getPrototype() returns itself - if ($prototype->getDeclaringClass()->getName() !== $method->getDeclaringClass()->getName()) { - $callees = array_merge($callees, $this->readMethodCallees($class, $prototype)); - } - } catch (ReflectionException $e) { - } - - if ($docBlock = $method->getDocComment()) { - $callees = array_merge($callees, $this->readDocBlockCallees($class, $method, $docBlock)); - } - - return $callees; - } - - /** - * Reads callees from the method doc block. - * - * @param string $class - * @param ReflectionMethod $method - * @param string $docBlock - * - * @return Callee[] - */ - private function readDocBlockCallees($class, ReflectionMethod $method, $docBlock) - { - $callees = array(); - $description = $this->docBlockHelper->extractDescription($docBlock); - $docBlock = $this->mergeMultilines($docBlock); - - foreach (explode("\n", $docBlock) as $docLine) { - $docLine = preg_replace(self::DOCLINE_TRIMMER_REGEX, '', $docLine); - - if ($this->isEmpty($docLine)) { - continue; - } - - if ($this->isNotAnnotation($docLine)) { - continue; - } - - if ($callee = $this->readDocLineCallee($class, $method, $docLine, $description)) { - $callees[] = $callee; - } - } - - return $callees; - } - - /** - * Merges multiline strings (strings ending with "\") - * - * @param string $docBlock - * - * @return string - */ - private function mergeMultilines($docBlock) - { - return preg_replace("#\\\\$\s*+\*\s*+([^\\\\$]++)#m", '$1', $docBlock); - } - - /** - * Checks if provided doc lien is empty. - * - * @param string $docLine - * - * @return bool - */ - private function isEmpty($docLine) - { - return '' == $docLine; - } - - /** - * Checks if provided doc line is not an annotation. - * - * @param string $docLine - * - * @return bool - */ - private function isNotAnnotation($docLine) - { - return '@' !== substr($docLine, 0, 1); - } - - /** - * Reads callee from provided doc line using registered annotation readers. - * - * @param string $class - * @param ReflectionMethod $method - * @param string $docLine - * @param null|string $description - * - * @return null|Callee - */ - private function readDocLineCallee($class, ReflectionMethod $method, $docLine, $description = null) - { - if ($this->isIgnoredAnnotation($docLine)) { - return null; - } - - foreach ($this->readers as $reader) { - if ($callee = $reader->readCallee($class, $method, $docLine, $description)) { - return $callee; - } - } - - return null; - } - - /** - * Checks if provided doc line is one of the ignored annotations. - * - * @param string $docLine - * - * @return bool - */ - private function isIgnoredAnnotation($docLine) - { - $lowDocLine = strtolower($docLine); - foreach (self::$ignoreAnnotations as $ignoredAnnotation) { - if ($ignoredAnnotation == substr($lowDocLine, 0, strlen($ignoredAnnotation))) { - return true; - } - } - - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReader.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReader.php deleted file mode 100644 index b8a9156..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReader.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Reader; - -use Behat\Behat\Context\Environment\ContextEnvironment; -use Behat\Testwork\Call\Callee; - -/** - * Reads callees from a context class. - * - * @author Konstantin Kudryashov - */ -interface ContextReader -{ - /** - * Reads callees from specific environment & context. - * - * @param ContextEnvironment $environment - * @param string $contextClass - * - * @return Callee[] - */ - public function readContextCallees(ContextEnvironment $environment, $contextClass); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReaderCachedPerContext.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReaderCachedPerContext.php deleted file mode 100644 index 8a51662..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReaderCachedPerContext.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Reader; - -use Behat\Behat\Context\Environment\ContextEnvironment; - -/** - * Proxies call to another reader and caches context callees for a length of an entire exercise. - * - * @author Konstantin Kudryashov - */ -final class ContextReaderCachedPerContext implements ContextReader -{ - /** - * @var ContextReader - */ - private $childReader; - /** - * @var array[] - */ - private $cachedCallees = array(); - - /** - * Initializes reader. - * - * @param ContextReader $childReader - */ - public function __construct(ContextReader $childReader) - { - $this->childReader = $childReader; - } - - /** - * {@inheritdoc} - */ - public function readContextCallees(ContextEnvironment $environment, $contextClass) - { - if (isset($this->cachedCallees[$contextClass])) { - return $this->cachedCallees[$contextClass]; - } - - return $this->cachedCallees[$contextClass] = $this->childReader->readContextCallees( - $environment, $contextClass - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReaderCachedPerSuite.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReaderCachedPerSuite.php deleted file mode 100644 index 4a8bfd5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/ContextReaderCachedPerSuite.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Reader; - -use Behat\Behat\Context\Environment\ContextEnvironment; - -/** - * Proxies call to another reader and caches callees for a length of an entire suite. - * - * @author Konstantin Kudryashov - */ -final class ContextReaderCachedPerSuite implements ContextReader -{ - /** - * @var ContextReader - */ - private $childReader; - /** - * @var array[] - */ - private $cachedCallees = array(); - - /** - * Initializes reader. - * - * @param ContextReader $childReader - */ - public function __construct(ContextReader $childReader) - { - $this->childReader = $childReader; - } - - /** - * {@inheritdoc} - */ - public function readContextCallees(ContextEnvironment $environment, $contextClass) - { - $key = $this->generateCacheKey($environment, $contextClass); - - if (isset($this->cachedCallees[$key])) { - return $this->cachedCallees[$key]; - } - - return $this->cachedCallees[$key] = $this->childReader->readContextCallees( - $environment, $contextClass - ); - } - - /** - * Generates cache key. - * - * @param ContextEnvironment $environment - * @param string $contextClass - * - * @return string - */ - private function generateCacheKey(ContextEnvironment $environment, $contextClass) - { - return $environment->getSuite()->getName() . $contextClass; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/TranslatableContextReader.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/TranslatableContextReader.php deleted file mode 100644 index 11327ee..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Reader/TranslatableContextReader.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Reader; - -use Behat\Behat\Context\Environment\ContextEnvironment; -use Behat\Behat\Context\Exception\UnknownTranslationResourceException; -use Behat\Behat\Context\TranslatableContext; -use Symfony\Component\Translation\Translator; - -/** - * Reads translation resources from translatable contexts. - * - * @author Konstantin Kudryashov - */ -final class TranslatableContextReader implements ContextReader -{ - /** - * @var Translator - */ - private $translator; - - /** - * Initializes loader. - * - * @param Translator $translator - */ - public function __construct(Translator $translator) - { - $this->translator = $translator; - } - - /** - * {@inheritdoc} - * - * @see TranslatableContext - */ - public function readContextCallees(ContextEnvironment $environment, $contextClass) - { - $reflClass = new \ReflectionClass($contextClass); - - if (!$reflClass->implementsInterface('Behat\Behat\Context\TranslatableContext')) { - return array(); - } - - $assetsId = $environment->getSuite()->getName(); - foreach (call_user_func(array($contextClass, 'getTranslationResources')) as $path) { - $this->addTranslationResource($path, $assetsId); - } - - return array(); - } - - /** - * Adds translation resource. - * - * @param string $path - * @param string $assetsId - * - * @throws UnknownTranslationResourceException - */ - private function addTranslationResource($path, $assetsId) - { - switch ($ext = pathinfo($path, PATHINFO_EXTENSION)) { - case 'yml': - $this->addTranslatorResource('yaml', $path, basename($path, '.' . $ext), $assetsId); - break; - case 'xliff': - $this->addTranslatorResource('xliff', $path, basename($path, '.' . $ext), $assetsId); - break; - case 'php': - $this->addTranslatorResource('php', $path, basename($path, '.' . $ext), $assetsId); - break; - default: - throw new UnknownTranslationResourceException(sprintf( - 'Can not read translations from `%s`. File type is not supported.', - $path - ), $path); - } - } - - /** - * Adds resource to translator instance. - * - * @param string $type - * @param string $path - * @param string $language - * @param string $assetsId - */ - private function addTranslatorResource($type, $path, $language, $assetsId) - { - $this->translator->addResource($type, $path, $language, $assetsId); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php deleted file mode 100644 index 1ae669f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/ServiceContainer/ContextExtension.php +++ /dev/null @@ -1,454 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\ServiceContainer; - -use Behat\Behat\Definition\ServiceContainer\DefinitionExtension; -use Behat\Behat\Snippet\ServiceContainer\SnippetExtension; -use Behat\Testwork\Argument\ServiceContainer\ArgumentExtension; -use Behat\Testwork\Autoloader\ServiceContainer\AutoloaderExtension; -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; -use Behat\Testwork\Filesystem\ServiceContainer\FilesystemExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Suite\ServiceContainer\SuiteExtension; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Behat context extension. - * - * Extends Behat with context services. - * - * @author Konstantin Kudryashov - */ -final class ContextExtension implements Extension -{ - /** - * Available services - */ - public const FACTORY_ID = 'context.factory'; - public const CONTEXT_SNIPPET_GENERATOR_ID = 'snippet.generator.context'; - public const AGGREGATE_RESOLVER_FACTORY_ID = 'context.argument.aggregate_resolver_factory'; - private const ENVIRONMENT_HANDLER_ID = EnvironmentExtension::HANDLER_TAG . '.context'; - private const ENVIRONMENT_READER_ID = EnvironmentExtension::READER_TAG . '.context'; - private const SUITE_SETUP_ID = SuiteExtension::SETUP_TAG . '.suite_with_contexts'; - private const ANNOTATED_CONTEXT_READER_ID = self::READER_TAG . '.annotated'; - private const ATTRIBUTED_CONTEXT_READER_ID = self::READER_TAG . '.attributed'; - - /* - * Available extension points - */ - public const CLASS_RESOLVER_TAG = 'context.class_resolver'; - public const ARGUMENT_RESOLVER_TAG = 'context.argument_resolver'; - public const INITIALIZER_TAG = 'context.initializer'; - public const READER_TAG = 'context.reader'; - public const ANNOTATION_READER_TAG = 'context.annotation_reader'; - public const ATTRIBUTE_READER_TAG = 'context.attribute_reader'; - public const CLASS_GENERATOR_TAG = 'context.class_generator'; - public const SUITE_SCOPED_RESOLVER_FACTORY_TAG = 'context.argument.suite_resolver_factory'; - public const DOC_BLOCK_HELPER_ID = 'context.docblock_helper'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes compiler pass. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'contexts'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadFactory($container); - $this->loadArgumentResolverFactory($container); - $this->loadEnvironmentHandler($container); - $this->loadEnvironmentReader($container); - $this->loadSuiteSetup($container); - $this->loadSnippetAppender($container); - $this->loadSnippetGenerators($container); - $this->loadSnippetsController($container); - $this->loadDefaultClassGenerators($container); - $this->loadDefaultContextReaders($container); - $this->loadDocblockHelper($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processClassResolvers($container); - $this->processArgumentResolverFactories($container); - $this->processArgumentResolvers($container); - $this->processContextInitializers($container); - $this->processContextReaders($container); - $this->processClassGenerators($container); - $this->processAnnotationReaders($container); - $this->processAttributeReaders($container); - } - - /** - * Loads context factory. - * - * @param ContainerBuilder $container - */ - private function loadFactory(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\ContextFactory', array( - new Reference(ArgumentExtension::CONSTRUCTOR_ARGUMENT_ORGANISER_ID) - )); - $container->setDefinition(self::FACTORY_ID, $definition); - } - - /** - * Loads argument resolver factory used in the environment handler. - * - * @param ContainerBuilder $container - */ - private function loadArgumentResolverFactory(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Argument\CompositeArgumentResolverFactory'); - $container->setDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID, $definition); - } - - /** - * Loads context environment handlers. - * - * @param ContainerBuilder $container - */ - private function loadEnvironmentHandler(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Environment\Handler\ContextEnvironmentHandler', array( - new Reference(self::FACTORY_ID), - new Reference(self::AGGREGATE_RESOLVER_FACTORY_ID) - )); - $definition->addTag(EnvironmentExtension::HANDLER_TAG, array('priority' => 50)); - $container->setDefinition(self::ENVIRONMENT_HANDLER_ID, $definition); - } - - /** - * Loads context environment readers. - * - * @param ContainerBuilder $container - */ - private function loadEnvironmentReader(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Environment\Reader\ContextEnvironmentReader'); - $definition->addTag(EnvironmentExtension::READER_TAG, array('priority' => 50)); - $container->setDefinition(self::ENVIRONMENT_READER_ID, $definition); - } - - /** - * Loads context environment setup. - * - * @param ContainerBuilder $container - */ - private function loadSuiteSetup(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Suite\Setup\SuiteWithContextsSetup', array( - new Reference(AutoloaderExtension::CLASS_LOADER_ID), - new Reference(FilesystemExtension::LOGGER_ID) - )); - $definition->addTag(SuiteExtension::SETUP_TAG, array('priority' => 20)); - $container->setDefinition(self::SUITE_SETUP_ID, $definition); - } - - /** - * Loads context snippet appender. - * - * @param ContainerBuilder $container - */ - private function loadSnippetAppender(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Snippet\Appender\ContextSnippetAppender', array( - new Reference(FilesystemExtension::LOGGER_ID) - )); - $definition->addTag(SnippetExtension::APPENDER_TAG, array('priority' => 50)); - $container->setDefinition(SnippetExtension::APPENDER_TAG . '.context', $definition); - } - - /** - * Loads context snippet generators. - * - * @param ContainerBuilder $container - */ - private function loadSnippetGenerators(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator', array( - new Reference(DefinitionExtension::PATTERN_TRANSFORMER_ID) - )); - $definition->addTag(SnippetExtension::GENERATOR_TAG, array('priority' => 50)); - $container->setDefinition(self::CONTEXT_SNIPPET_GENERATOR_ID, $definition); - } - - /** - * @param ContainerBuilder $container - */ - protected function loadSnippetsController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Cli\ContextSnippetsController', array( - new Reference(self::CONTEXT_SNIPPET_GENERATOR_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 410)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.context_snippets', $definition); - } - - /** - * Loads default context class generators. - * - * @param ContainerBuilder $container - */ - private function loadDefaultClassGenerators(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\ContextClass\SimpleClassGenerator'); - $definition->addTag(self::CLASS_GENERATOR_TAG, array('priority' => 50)); - $container->setDefinition(self::CLASS_GENERATOR_TAG . '.simple', $definition); - } - - /** - * Loads default context readers. - * - * @param ContainerBuilder $container - */ - private function loadDefaultContextReaders(ContainerBuilder $container) - { - $this->loadAnnotatedContextReader($container); - - $this->loadAttributedContextReader($container); - - $this->loadTranslatableContextReader($container); - } - - /** - * Loads AnnotatedContextReader - * - * @param ContainerBuilder $container - */ - private function loadAnnotatedContextReader(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Reader\AnnotatedContextReader', array( - new Reference(self::DOC_BLOCK_HELPER_ID) - )); - $container->setDefinition(self::ANNOTATED_CONTEXT_READER_ID, $definition); - - $definition = new Definition('Behat\Behat\Context\Reader\ContextReaderCachedPerContext', array( - new Reference(self::ANNOTATED_CONTEXT_READER_ID) - )); - $definition->addTag(self::READER_TAG, array('priority' => 50)); - $container->setDefinition(self::ANNOTATED_CONTEXT_READER_ID . '.cached', $definition); - } - - /** - * Loads AttributedContextReader - * - * @param ContainerBuilder $container - */ - private function loadAttributedContextReader(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Reader\AttributeContextReader'); - $container->setDefinition(self::ATTRIBUTED_CONTEXT_READER_ID, $definition); - - $definition = new Definition('Behat\Behat\Context\Reader\ContextReaderCachedPerContext', array( - new Reference(self::ATTRIBUTED_CONTEXT_READER_ID) - )); - $definition->addTag(self::READER_TAG, array('priority' => 50)); - $container->setDefinition(self::ATTRIBUTED_CONTEXT_READER_ID . '.cached', $definition); - return $definition; - } - - /** - * Loads TranslatableContextReader - * - * @param ContainerBuilder $container - */ - private function loadTranslatableContextReader(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Reader\TranslatableContextReader', array( - new Reference(TranslatorExtension::TRANSLATOR_ID) - )); - $container->setDefinition(self::READER_TAG . '.translatable', $definition); - - $definition = new Definition('Behat\Behat\Context\Reader\ContextReaderCachedPerSuite', array( - new Reference(self::READER_TAG . '.translatable') - )); - $definition->addTag(self::READER_TAG, array('priority' => 50)); - $container->setDefinition(self::READER_TAG . '.translatable.cached', $definition); - } - - /** - * Loads DocBlockHelper - * - * @param ContainerBuilder $container - */ - private function loadDocblockHelper(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Annotation\DocBlockHelper'); - - $container->setDefinition(self::DOC_BLOCK_HELPER_ID, $definition); - } - - /** - * Processes all class resolvers. - * - * @param ContainerBuilder $container - */ - private function processClassResolvers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::CLASS_RESOLVER_TAG); - $definition = $container->getDefinition(self::ENVIRONMENT_HANDLER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerClassResolver', array($reference)); - } - } - - /** - * Processes all argument resolver factories. - * - * @param ContainerBuilder $container - */ - private function processArgumentResolverFactories($container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::SUITE_SCOPED_RESOLVER_FACTORY_TAG); - $definition = $container->getDefinition(self::AGGREGATE_RESOLVER_FACTORY_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerFactory', array($reference)); - } - } - - /** - * Processes all argument resolvers. - * - * @param ContainerBuilder $container - */ - private function processArgumentResolvers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::ARGUMENT_RESOLVER_TAG); - $definition = $container->getDefinition(self::FACTORY_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerArgumentResolver', array($reference)); - } - } - - /** - * Processes all context initializers. - * - * @param ContainerBuilder $container - */ - private function processContextInitializers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::INITIALIZER_TAG); - $definition = $container->getDefinition(self::FACTORY_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerContextInitializer', array($reference)); - } - } - - /** - * Processes all context readers. - * - * @param ContainerBuilder $container - */ - private function processContextReaders(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::READER_TAG); - $definition = $container->getDefinition(self::ENVIRONMENT_READER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerContextReader', array($reference)); - } - } - - /** - * Processes all class generators. - * - * @param ContainerBuilder $container - */ - private function processClassGenerators(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::CLASS_GENERATOR_TAG); - $definition = $container->getDefinition(self::SUITE_SETUP_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerClassGenerator', array($reference)); - } - } - - /** - * Processes all annotation readers. - * - * @param ContainerBuilder $container - */ - private function processAnnotationReaders(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::ANNOTATION_READER_TAG); - $definition = $container->getDefinition(self::ANNOTATED_CONTEXT_READER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerAnnotationReader', array($reference)); - } - } - - /** - * Processes all attribute readers. - * - * @param ContainerBuilder $container - */ - private function processAttributeReaders(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::ATTRIBUTE_READER_TAG); - $definition = $container->getDefinition(self::ATTRIBUTED_CONTEXT_READER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerAttributeReader', array($reference)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php deleted file mode 100644 index 456809b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Appender/ContextSnippetAppender.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Appender; - -use Behat\Behat\Snippet\AggregateSnippet; -use Behat\Behat\Snippet\Appender\SnippetAppender; -use Behat\Testwork\Filesystem\FilesystemLogger; -use ReflectionClass; - -/** - * Appends context-related snippets to their context classes. - * - * @author Konstantin Kudryashov - */ -final class ContextSnippetAppender implements SnippetAppender -{ - /** - * @const PendingException class - */ - public const PENDING_EXCEPTION_CLASS = 'Behat\Behat\Tester\Exception\PendingException'; - - /** - * @var FilesystemLogger - */ - private $logger; - - /** - * Initializes appender. - * - * @param null|FilesystemLogger $logger - */ - public function __construct(FilesystemLogger $logger = null) - { - $this->logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function supportsSnippet(AggregateSnippet $snippet) - { - return 'context' === $snippet->getType(); - } - - /** - * {@inheritdoc} - */ - public function appendSnippet(AggregateSnippet $snippet) - { - foreach ($snippet->getTargets() as $contextClass) { - $reflection = new ReflectionClass($contextClass); - $content = file_get_contents($reflection->getFileName()); - - foreach ($snippet->getUsedClasses() as $class) { - if (!$this->isClassImported($class, $content)) { - $content = $this->importClass($class, $content); - } - } - - $generated = rtrim(strtr($snippet->getSnippet(), array('\\' => '\\\\', '$' => '\\$'))); - $content = preg_replace('/}\s*$/', "\n" . $generated . "\n}\n", $content); - $path = $reflection->getFileName(); - - file_put_contents($path, $content); - - $this->logSnippetAddition($snippet, $path); - } - } - - /** - * Checks if context file already has class in it. - * - * @param string $class - * @param string $contextFileContent - * - * @return bool - */ - private function isClassImported($class, $contextFileContent) - { - $classImportRegex = sprintf( - '@use[^;]*%s.*;@ms', - preg_quote($class, '@') - ); - - return 1 === preg_match($classImportRegex, $contextFileContent); - } - - /** - * Adds use-block for class. - * - * @param string $class - * @param string $contextFileContent - * - * @return string - */ - private function importClass($class, $contextFileContent) - { - $replaceWith = "\$1" . 'use ' . $class . ";\n\$2;"; - - return preg_replace('@^(.*)(use\s+[^;]*);@m', $replaceWith, $contextFileContent, 1); - } - - /** - * Logs snippet addition to the provided path (if logger is given). - * - * @param AggregateSnippet $snippet - * @param string $path - */ - private function logSnippetAddition(AggregateSnippet $snippet, $path) - { - if (!$this->logger) { - return; - } - - $steps = $snippet->getSteps(); - $reason = sprintf("`%s` definition added", $steps[0]->getText()); - - $this->logger->fileUpdated($path, $reason); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/ContextSnippet.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/ContextSnippet.php deleted file mode 100644 index 6ece5f1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/ContextSnippet.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet; - -use Behat\Behat\Snippet\Snippet; -use Behat\Gherkin\Node\StepNode; - -/** - * Represents a definition snippet for a context class. - * - * @author Konstantin Kudryashov - */ -final class ContextSnippet implements Snippet -{ - /** - * @var StepNode - */ - private $step; - /** - * @var string - */ - private $template; - /** - * @var string - */ - private $contextClass; - /** - * @var string[] - */ - private $usedClasses; - - /** - * Initializes definition snippet. - * - * @param StepNode $step - * @param string $template - * @param string $contextClass - * @param string[] $usedClasses - */ - public function __construct(StepNode $step, $template, $contextClass, array $usedClasses = array()) - { - $this->step = $step; - $this->template = $template; - $this->contextClass = $contextClass; - $this->usedClasses = $usedClasses; - } - - /** - * {@inheritdoc} - */ - public function getType() - { - return 'context'; - } - - /** - * {@inheritdoc} - */ - public function getHash() - { - return md5($this->template); - } - - /** - * {@inheritdoc} - */ - public function getSnippet() - { - return sprintf($this->template, $this->step->getKeywordType()); - } - - /** - * {@inheritdoc} - */ - public function getStep() - { - return $this->step; - } - - /** - * {@inheritdoc} - */ - public function getTarget() - { - return $this->contextClass; - } - - /** - * Returns the classes used in the snippet which should be imported. - * - * @return string[] - */ - public function getUsedClasses() - { - return $this->usedClasses; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregateContextIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregateContextIdentifier.php deleted file mode 100644 index 632d937..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregateContextIdentifier.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -use Behat\Behat\Context\Environment\ContextEnvironment; - -/** - * Uses multiple child identifiers - the first one that returns non-null result would - * be the winner. - * - * This behaviour was introduced in 3.x to support the BC for interface-focused - * context identifier, while providing better user experience (no need to explicitly - * call `--snippets-for` on `--append-snippets` when contexts do not implement any - * snippet accepting interfaces). - */ -final class AggregateContextIdentifier implements TargetContextIdentifier -{ - /** - * @var TargetContextIdentifier[] - */ - private $identifiers; - - /** - * Initialises identifier. - * - * @param TargetContextIdentifier[] $identifiers - */ - public function __construct(array $identifiers) - { - $this->identifiers = $identifiers; - } - - /** - * {@inheritdoc} - */ - public function guessTargetContextClass(ContextEnvironment $environment) - { - foreach ($this->identifiers as $identifier) { - $contextClass = $identifier->guessTargetContextClass($environment); - - if (null !== $contextClass) { - return $contextClass; - } - } - - return null; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregatePatternIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregatePatternIdentifier.php deleted file mode 100644 index 1e1fc27..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/AggregatePatternIdentifier.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -/** - * Uses multiple child identifiers - the first one that returns non-null result would - * be the winner. - */ -final class AggregatePatternIdentifier implements PatternIdentifier -{ - /** - * @var PatternIdentifier[] - */ - private $identifiers; - - /** - * Initialises identifier. - * - * @param PatternIdentifier[] $identifiers - */ - public function __construct(array $identifiers) - { - $this->identifiers = $identifiers; - } - - /** - * {@inheritdoc} - */ - public function guessPatternType($contextClass) - { - foreach ($this->identifiers as $identifier) { - $pattern = $identifier->guessPatternType($contextClass); - - if (null !== $pattern) { - return $pattern; - } - } - - return null; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/CachedContextIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/CachedContextIdentifier.php deleted file mode 100644 index 6ff1bb6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/CachedContextIdentifier.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -use Behat\Behat\Context\Environment\ContextEnvironment; - -/** - * Decorates actual identifier and caches its answers per suite. - * - * @author Konstantin Kudryashov - */ -final class CachedContextIdentifier implements TargetContextIdentifier -{ - /** - * @var TargetContextIdentifier - */ - private $decoratedIdentifier; - /** - * @var array - */ - private $contextClasses = array(); - - /** - * Initialise the identifier. - * - * @param TargetContextIdentifier $identifier - */ - public function __construct(TargetContextIdentifier $identifier) - { - $this->decoratedIdentifier = $identifier; - } - - /** - * {@inheritdoc} - */ - public function guessTargetContextClass(ContextEnvironment $environment) - { - $suiteKey = $environment->getSuite()->getName(); - - if (array_key_exists($suiteKey, $this->contextClasses)) { - return $this->contextClasses[$suiteKey]; - } - - return $this->contextClasses[$suiteKey] = $this->decoratedIdentifier->guessTargetContextClass($environment); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextInterfaceBasedContextIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextInterfaceBasedContextIdentifier.php deleted file mode 100644 index 7e1c154..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextInterfaceBasedContextIdentifier.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -use Behat\Behat\Context\Environment\ContextEnvironment; - -/** - * Identifier that uses context interfaces to guess which one is target. - * - * @author Konstantin Kudryashov - * - * @deprecated in favour of --snippets-for and will be removed in 4.0 - */ -final class ContextInterfaceBasedContextIdentifier implements TargetContextIdentifier -{ - /** - * {@inheritdoc} - */ - public function guessTargetContextClass(ContextEnvironment $environment) - { - foreach ($environment->getContextClasses() as $class) { - if (in_array('Behat\Behat\Context\SnippetAcceptingContext', class_implements($class))) { - return $class; - } - } - - return null; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextInterfaceBasedPatternIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextInterfaceBasedPatternIdentifier.php deleted file mode 100644 index 31e956a..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextInterfaceBasedPatternIdentifier.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -/** - * Identifier that uses context interfaces to guess the pattern type. - * - * @author Konstantin Kudryashov - * - * @deprecated in favour of --snippet-type and will be removed in 4.0 - */ -final class ContextInterfaceBasedPatternIdentifier implements PatternIdentifier -{ - /** - * {@inheritdoc} - */ - public function guessPatternType($contextClass) - { - if (!in_array('Behat\Behat\Context\CustomSnippetAcceptingContext', class_implements($contextClass))) { - return null; - } - - return $contextClass::getAcceptedSnippetType(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php deleted file mode 100644 index 2373220..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/ContextSnippetGenerator.php +++ /dev/null @@ -1,360 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -use Behat\Behat\Context\Environment\ContextEnvironment; -use Behat\Behat\Context\Snippet\ContextSnippet; -use Behat\Behat\Definition\Pattern\PatternTransformer; -use Behat\Behat\Snippet\Exception\EnvironmentSnippetGenerationException; -use Behat\Behat\Snippet\Generator\SnippetGenerator; -use Behat\Gherkin\Node\PyStringNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Gherkin\Node\TableNode; -use Behat\Testwork\Environment\Environment; -use ReflectionClass; - -/** - * Generates snippets for a context class. - * - * @author Konstantin Kudryashov - */ -final class ContextSnippetGenerator implements SnippetGenerator -{ - /** - * @var string[string] - */ - private static $proposedMethods = array(); - /** - * @var string - */ - private static $templateTemplate = <<patternTransformer = $patternTransformer; - - $this->setContextIdentifier(new FixedContextIdentifier(null)); - $this->setPatternIdentifier(new FixedPatternIdentifier(null)); - } - - /** - * Sets target context identifier. - * - * @param TargetContextIdentifier $identifier - */ - public function setContextIdentifier(TargetContextIdentifier $identifier) - { - $this->contextIdentifier = new CachedContextIdentifier($identifier); - } - - /** - * Sets target pattern type identifier. - * - * @param PatternIdentifier $identifier - */ - public function setPatternIdentifier(PatternIdentifier $identifier) - { - $this->patternIdentifier = $identifier; - } - - /** - * {@inheritdoc} - */ - public function supportsEnvironmentAndStep(Environment $environment, StepNode $step) - { - if (!$environment instanceof ContextEnvironment) { - return false; - } - - if (!$environment->hasContexts()) { - return false; - } - - return null !== $this->contextIdentifier->guessTargetContextClass($environment); - } - - /** - * {@inheritdoc} - */ - public function generateSnippet(Environment $environment, StepNode $step) - { - if (!$environment instanceof ContextEnvironment) { - throw new EnvironmentSnippetGenerationException(sprintf( - 'ContextSnippetGenerator does not support `%s` environment.', - get_class($environment) - ), $environment); - } - - $contextClass = $this->contextIdentifier->guessTargetContextClass($environment); - $patternType = $this->patternIdentifier->guessPatternType($contextClass); - $stepText = $step->getText(); - $pattern = $this->patternTransformer->generatePattern($patternType, $stepText); - - $methodName = $this->getMethodName($contextClass, $pattern->getCanonicalText(), $pattern->getPattern()); - $methodArguments = $this->getMethodArguments($step, $pattern->getPlaceholderCount()); - $snippetTemplate = $this->getSnippetTemplate($pattern->getPattern(), $methodName, $methodArguments); - - $usedClasses = $this->getUsedClasses($step); - - return new ContextSnippet($step, $snippetTemplate, $contextClass, $usedClasses); - } - - /** - * Generates method name using step text and regex. - * - * @param string $contextClass - * @param string $canonicalText - * @param string $pattern - * - * @return string - */ - private function getMethodName($contextClass, $canonicalText, $pattern) - { - $methodName = $this->deduceMethodName($canonicalText); - $methodName = $this->getUniqueMethodName($contextClass, $pattern, $methodName); - - return $methodName; - } - - /** - * Returns an array of method argument names from step and token count. - * - * @param StepNode $step - * @param integer $tokenCount - * - * @return string[] - */ - private function getMethodArguments(StepNode $step, $tokenCount) - { - $args = array(); - for ($i = 0; $i < $tokenCount; $i++) { - $args[] = '$arg' . ($i + 1); - } - - foreach ($step->getArguments() as $argument) { - $args[] = $this->getMethodArgument($argument); - } - - return $args; - } - - /** - * Returns an array of classes used by the snippet template - * - * @param StepNode $step - * - * @return string[] - */ - private function getUsedClasses(StepNode $step) - { - $usedClasses = array('Behat\Behat\Tester\Exception\PendingException'); - - foreach ($step->getArguments() as $argument) { - if ($argument instanceof TableNode) { - $usedClasses[] = 'Behat\Gherkin\Node\TableNode'; - } elseif ($argument instanceof PyStringNode) { - $usedClasses[] = 'Behat\Gherkin\Node\PyStringNode'; - } - } - - return $usedClasses; - } - - /** - * Generates snippet template using regex, method name and arguments. - * - * @param string $pattern - * @param string $methodName - * @param string[] $methodArguments - * - * @return string - */ - private function getSnippetTemplate($pattern, $methodName, array $methodArguments) - { - return sprintf( - self::$templateTemplate, - str_replace('%', '%%', $pattern), - $methodName, - implode(', ', $methodArguments) - ); - } - - /** - * Generates definition method name based on the step text. - * - * @param string $canonicalText - * - * @return string - */ - private function deduceMethodName($canonicalText) - { - // check that method name is not empty - if (0 !== strlen($canonicalText)) { - $canonicalText[0] = strtolower($canonicalText[0]); - - return $canonicalText; - } - - return 'stepDefinition1'; - } - - /** - * Ensures uniqueness of the method name in the context. - * - * @param string $contextClass - * @param string $stepPattern - * @param string $name - * - * @return string - */ - private function getUniqueMethodName($contextClass, $stepPattern, $name) - { - $reflection = new ReflectionClass($contextClass); - - $number = $this->getMethodNumberFromTheMethodName($name); - list($name, $number) = $this->getMethodNameNotExistentInContext($reflection, $name, $number); - $name = $this->getMethodNameNotProposedEarlier($contextClass, $stepPattern, $name, $number); - - return $name; - } - - /** - * Tries to deduct method number from the provided method name. - * - * @param string $methodName - * - * @return integer - */ - private function getMethodNumberFromTheMethodName($methodName) - { - $methodNumber = 2; - if (preg_match('/(\d+)$/', $methodName, $matches)) { - $methodNumber = intval($matches[1]); - } - - return $methodNumber; - } - - /** - * Tries to guess method name that is not yet defined in the context class. - * - * @param ReflectionClass $reflection - * @param string $methodName - * @param integer $methodNumber - * - * @return array - */ - private function getMethodNameNotExistentInContext(ReflectionClass $reflection, $methodName, $methodNumber) - { - while ($reflection->hasMethod($methodName)) { - $methodName = preg_replace('/\d+$/', '', $methodName); - $methodName .= $methodNumber++; - } - - return array($methodName, $methodNumber); - } - - /** - * Tries to guess method name that is not yet proposed to the context class. - * - * @param string $contextClass - * @param string $stepPattern - * @param string $name - * @param integer $number - * - * @return string - */ - private function getMethodNameNotProposedEarlier($contextClass, $stepPattern, $name, $number) - { - foreach ($this->getAlreadyProposedMethods($contextClass) as $proposedPattern => $proposedMethod) { - if ($proposedPattern === $stepPattern) { - continue; - } - - while ($proposedMethod === $name) { - $name = preg_replace('/\d+$/', '', $name); - $name .= $number++; - } - } - - $this->markMethodAsAlreadyProposed($contextClass, $stepPattern, $name); - - return $name; - } - - /** - * Returns already proposed method names. - * - * @param string $contextClass - * - * @return string[] - */ - private function getAlreadyProposedMethods($contextClass) - { - return self::$proposedMethods[$contextClass] ?? array(); - } - - /** - * Marks method as proposed one. - * - * @param string $contextClass - * @param string $stepPattern - * @param string $methodName - */ - private function markMethodAsAlreadyProposed($contextClass, $stepPattern, $methodName) - { - self::$proposedMethods[$contextClass][$stepPattern] = $methodName; - } - - /** - * Returns method argument. - * - * @param string $argument - * - * @return string - */ - private function getMethodArgument($argument) - { - $arg = '__unknown__'; - if ($argument instanceof PyStringNode) { - $arg = 'PyStringNode $string'; - } elseif ($argument instanceof TableNode) { - $arg = 'TableNode $table'; - } - - return $arg; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/FixedContextIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/FixedContextIdentifier.php deleted file mode 100644 index 0d4b8e6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/FixedContextIdentifier.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -use Behat\Behat\Context\Environment\ContextEnvironment; - -/** - * Identifier that always returns same context, if it is defined in the suite. - * - * @author Konstantin Kudryashov - */ -final class FixedContextIdentifier implements TargetContextIdentifier -{ - /** - * @var - */ - private $contextClass; - - /** - * Initialises identifier. - * - * @param string $contextClass - */ - public function __construct($contextClass) - { - $this->contextClass = $contextClass; - } - - /** - * {@inheritdoc} - */ - public function guessTargetContextClass(ContextEnvironment $environment) - { - if ($environment->hasContextClass($this->contextClass)) { - return $this->contextClass; - } - - return null; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/FixedPatternIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/FixedPatternIdentifier.php deleted file mode 100644 index 7358bd4..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/FixedPatternIdentifier.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -use Behat\Behat\Context\Context; - -/** - * Identifier that always returns same pattern type. - * - * @author Konstantin Kudryashov - */ -final class FixedPatternIdentifier implements PatternIdentifier -{ - /** - * @var string - */ - private $patternType; - - /** - * Initialises identifier. - * - * @param string $patternType - */ - public function __construct($patternType) - { - $this->patternType = $patternType; - } - - /** - * {@inheritdoc} - */ - public function guessPatternType($contextClass) - { - return $this->patternType; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/PatternIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/PatternIdentifier.php deleted file mode 100644 index c10b7f8..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/PatternIdentifier.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -use Behat\Behat\Context\Context; - -/** - * Identifies target pattern for snippets. - * - * @author Konstantin Kudryashov - */ -interface PatternIdentifier -{ - /** - * Attempts to guess the target pattern type from the context. - * - * @param string $contextClass - * - * @return null|string - */ - public function guessPatternType($contextClass); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/TargetContextIdentifier.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/TargetContextIdentifier.php deleted file mode 100644 index d7e534d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Snippet/Generator/TargetContextIdentifier.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Snippet\Generator; - -use Behat\Behat\Context\Environment\ContextEnvironment; - -/** - * Identifies target context for snippets. - * - * @author Konstantin Kudryashov - */ -interface TargetContextIdentifier -{ - /** - * Attempts to guess the target context class from the environment. - * - * @param ContextEnvironment $environment - * - * @return null|string - */ - public function guessTargetContextClass(ContextEnvironment $environment); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/SnippetAcceptingContext.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/SnippetAcceptingContext.php deleted file mode 100644 index 2d6f7e9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/SnippetAcceptingContext.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context; - -use Behat\Behat\Context\Snippet\Generator\ContextSnippetGenerator; - -/** - * Context that implements this interface is treated as a snippet-friendly context. - * - * @see ContextSnippetGenerator - * - * @author Konstantin Kudryashov - * - * @deprecated will be removed in 4.0. Use --snippets-for CLI option instead - */ -interface SnippetAcceptingContext extends Context -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php deleted file mode 100644 index 9fc219d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/Suite/Setup/SuiteWithContextsSetup.php +++ /dev/null @@ -1,246 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context\Suite\Setup; - -use Behat\Behat\Context\ContextClass\ClassGenerator; -use Behat\Behat\Context\Exception\ContextNotFoundException; -use Behat\Testwork\Filesystem\FilesystemLogger; -use Behat\Testwork\Suite\Exception\SuiteConfigurationException; -use Behat\Testwork\Suite\Setup\SuiteSetup; -use Behat\Testwork\Suite\Suite; -use Composer\Autoload\ClassLoader; - -/** - * Generates classes for all contexts in the suite using autoloader. - * - * @author Konstantin Kudryashov - */ -final class SuiteWithContextsSetup implements SuiteSetup -{ - /** - * @var ClassLoader - */ - private $autoloader; - /** - * @var null|FilesystemLogger - */ - private $logger; - /** - * @var ClassGenerator[] - */ - private $classGenerators = array(); - - /** - * Initializes setup. - * - * @param ClassLoader $autoloader - * @param null|FilesystemLogger $logger - */ - public function __construct(ClassLoader $autoloader, FilesystemLogger $logger = null) - { - $this->autoloader = $autoloader; - $this->logger = $logger; - } - - /** - * Registers class generator. - * - * @param ClassGenerator $generator - */ - public function registerClassGenerator(ClassGenerator $generator) - { - $this->classGenerators[] = $generator; - } - - /** - * {@inheritdoc} - */ - public function supportsSuite(Suite $suite) - { - return $suite->hasSetting('contexts'); - } - - /** - * {@inheritdoc} - */ - public function setupSuite(Suite $suite) - { - foreach ($this->getNormalizedContextClasses($suite) as $class) { - if (class_exists($class)) { - continue; - } - - $this->ensureContextDirectory($path = $this->findClassFile($class)); - - if ($content = $this->generateClass($suite, $class)) { - $this->createContextFile($path, $content); - } - } - } - - /** - * Returns normalized context classes. - * - * @param Suite $suite - * - * @return string[] - */ - private function getNormalizedContextClasses(Suite $suite) - { - return array_map( - function ($context) { - return is_array($context) ? current(array_keys($context)) : $context; - }, - $this->getSuiteContexts($suite) - ); - } - - /** - * Returns array of context classes configured for the provided suite. - * - * @param Suite $suite - * - * @return string[] - * - * @throws SuiteConfigurationException If `contexts` setting is not an array - */ - private function getSuiteContexts(Suite $suite) - { - $contexts = $suite->getSetting('contexts'); - - if (!is_array($contexts)) { - throw new SuiteConfigurationException( - sprintf('`contexts` setting of the "%s" suite is expected to be an array, `%s` given.', - $suite->getName(), - gettype($contexts) - ), - $suite->getName() - ); - } - - return $contexts; - } - - /** - * Creates context directory in the filesystem. - * - * @param string $path - */ - private function createContextDirectory($path) - { - mkdir($path, 0777, true); - - if ($this->logger) { - $this->logger->directoryCreated($path, 'place your context classes here'); - } - } - - /** - * Creates context class file in the filesystem. - * - * @param string $path - * @param string $content - */ - private function createContextFile($path, $content) - { - file_put_contents($path, $content); - - if ($this->logger) { - $this->logger->fileCreated($path, 'place your definitions, transformations and hooks here'); - } - } - - /** - * Finds file to store a class. - * - * @param string $class - * - * @return string - * - * @throws ContextNotFoundException If class file could not be determined - */ - private function findClassFile($class) - { - list($classpath, $classname) = $this->findClasspathAndClass($class); - $classpath .= str_replace('_', DIRECTORY_SEPARATOR, $classname) . '.php'; - - foreach ($this->autoloader->getPrefixes() as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - return current($dirs) . DIRECTORY_SEPARATOR . $classpath; - } - } - - if ($dirs = $this->autoloader->getFallbackDirs()) { - return current($dirs) . DIRECTORY_SEPARATOR . $classpath; - } - - throw new ContextNotFoundException(sprintf( - 'Could not find where to put "%s" class. Have you configured autoloader properly?', - $class - ), $class); - } - - /** - * Generates class using registered class generators. - * - * @param Suite $suite - * @param string $class - * - * @return null|string - */ - private function generateClass(Suite $suite, $class) - { - $content = null; - foreach ($this->classGenerators as $generator) { - if ($generator->supportsSuiteAndClass($suite, $class)) { - $content = $generator->generateClass($suite, $class); - } - } - - return $content; - } - - /** - * Ensures that directory for a classpath exists. - * - * @param string $classpath - */ - private function ensureContextDirectory($classpath) - { - if (!is_dir(dirname($classpath))) { - $this->createContextDirectory(dirname($classpath)); - } - } - - /** - * Finds classpath and classname from class. - * - * @param string $class - * - * @return array - */ - private function findClasspathAndClass($class) - { - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $classpath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR; - $classname = substr($class, $pos + 1); - - return array($classpath, $classname); - } - - // PEAR-like class name - $classpath = null; - $classname = $class; - - return array($classpath, $classname); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/TranslatableContext.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/TranslatableContext.php deleted file mode 100644 index 91bbb05..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Context/TranslatableContext.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Context; - -use Behat\Behat\Context\Reader\TranslatableContextReader; - -/** - * Context that implements this interface is also treated as a translation provider for all it's callees. - * - * @see TranslatableContextReader - * - * @author Konstantin Kudryashov - */ -interface TranslatableContext extends Context -{ - /** - * Returns array of Translator-supported resource paths. - * - * For instance: - * - * * array(__DIR__.'/../'ru.yml) - * * array(__DIR__.'/../'en.xliff) - * * array(__DIR__.'/../'de.php) - * - * @return string[] - */ - public static function getTranslationResources(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/DefinitionCall.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/DefinitionCall.php deleted file mode 100644 index 0c68af2..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/DefinitionCall.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Call; - -use Behat\Behat\Definition\Definition; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Call\EnvironmentCall; -use Behat\Testwork\Environment\Environment; - -/** - * Enhances environment call with definition information. - * - * @author Konstantin Kudryashov - */ -final class DefinitionCall extends EnvironmentCall -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var StepNode - */ - private $step; - - /** - * Initializes definition call. - * - * @param Environment $environment - * @param FeatureNode $feature - * @param StepNode $step - * @param Definition $definition - * @param array $arguments - * @param null|integer $errorReportingLevel - */ - public function __construct( - Environment $environment, - FeatureNode $feature, - StepNode $step, - Definition $definition, - array $arguments, - $errorReportingLevel = null - ) { - parent::__construct($environment, $definition, $arguments, $errorReportingLevel); - - $this->feature = $feature; - $this->step = $step; - } - - /** - * Returns step feature node. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns definition step node. - * - * @return StepNode - */ - public function getStep() - { - return $this->step; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/Given.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/Given.php deleted file mode 100644 index 324ffb8..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/Given.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Call; - -/** - * Given steps definition. - * - * @author Konstantin Kudryashov - */ -final class Given extends RuntimeDefinition -{ - /** - * Initializes definition. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - parent::__construct('Given', $pattern, $callable, $description); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/RuntimeDefinition.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/RuntimeDefinition.php deleted file mode 100644 index 4c2c494..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/RuntimeDefinition.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Call; - -use Behat\Behat\Definition\Definition; -use Behat\Testwork\Call\RuntimeCallee; - -/** - * Represents a step definition created and executed in the runtime. - * - * @author Konstantin Kudryashov - */ -abstract class RuntimeDefinition extends RuntimeCallee implements Definition -{ - /** - * @var string - */ - private $type; - /** - * @var string - */ - private $pattern; - - /** - * Initializes definition. - * - * @param string $type - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($type, $pattern, $callable, $description = null) - { - $this->type = $type; - $this->pattern = $pattern; - - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getType() - { - return $this->type; - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return $this->getType() . ' ' . $this->getPattern(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/Then.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/Then.php deleted file mode 100644 index 50dabc1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/Then.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Call; - -/** - * Then steps definition. - * - * @author Konstantin Kudryashov - */ -final class Then extends RuntimeDefinition -{ - /** - * Initializes definition. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - parent::__construct('Then', $pattern, $callable, $description); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/When.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/When.php deleted file mode 100644 index 1ff6560..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Call/When.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Call; - -/** - * When steps definition. - * - * @author Konstantin Kudryashov - */ -final class When extends RuntimeDefinition -{ - /** - * Initializes definition. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - parent::__construct('When', $pattern, $callable, $description); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Cli/AvailableDefinitionsController.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Cli/AvailableDefinitionsController.php deleted file mode 100644 index eaa22d4..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Cli/AvailableDefinitionsController.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Cli; - -use Behat\Behat\Definition\DefinitionWriter; -use Behat\Behat\Definition\Printer\ConsoleDefinitionInformationPrinter; -use Behat\Behat\Definition\Printer\ConsoleDefinitionListPrinter; -use Behat\Behat\Definition\Printer\DefinitionPrinter; -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\Suite\SuiteRepository; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Shows all currently available definitions to the user. - * - * @author Konstantin Kudryashov - */ -final class AvailableDefinitionsController implements Controller -{ - /** - * @var SuiteRepository - */ - private $suiteRepository; - /** - * @var DefinitionWriter - */ - private $writer; - /** - * @var ConsoleDefinitionListPrinter - */ - private $listPrinter; - /** - * @var ConsoleDefinitionInformationPrinter - */ - private $infoPrinter; - - /** - * Initializes controller. - * - * @param SuiteRepository $suiteRepository - * @param DefinitionWriter $writer - * @param ConsoleDefinitionListPrinter $listPrinter - * @param ConsoleDefinitionInformationPrinter $infoPrinter - */ - public function __construct( - SuiteRepository $suiteRepository, - DefinitionWriter $writer, - ConsoleDefinitionListPrinter $listPrinter, - ConsoleDefinitionInformationPrinter $infoPrinter - ) { - $this->suiteRepository = $suiteRepository; - $this->writer = $writer; - $this->listPrinter = $listPrinter; - $this->infoPrinter = $infoPrinter; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - $command->addOption('--definitions', '-d', InputOption::VALUE_REQUIRED, - "Print all available step definitions:" . PHP_EOL . - "- use --definitions l to just list definition expressions." . PHP_EOL . - "- use --definitions i to show definitions with extended info." . PHP_EOL . - "- use --definitions 'needle' to find specific definitions." . PHP_EOL . - "Use --lang to see definitions in specific language." - ); - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - if (null === $argument = $input->getOption('definitions')) { - return null; - } - - $printer = $this->getDefinitionPrinter($argument); - foreach ($this->suiteRepository->getSuites() as $suite) { - $this->writer->printSuiteDefinitions($printer, $suite); - } - - return 0; - } - - /** - * Returns definition printer for provided option argument. - * - * @param string $argument - * - * @return DefinitionPrinter - */ - private function getDefinitionPrinter($argument) - { - if ('l' === $argument) { - return $this->listPrinter; - } - - if ('i' !== $argument) { - $this->infoPrinter->setSearchCriterion($argument); - } - - return $this->infoPrinter; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Context/Annotation/DefinitionAnnotationReader.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Context/Annotation/DefinitionAnnotationReader.php deleted file mode 100644 index baa6c88..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Context/Annotation/DefinitionAnnotationReader.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Context\Annotation; - -use Behat\Behat\Context\Annotation\AnnotationReader; -use ReflectionMethod; - -/** - * Reads definition annotations from the context class. - * - * @author Konstantin Kudryashov - */ -final class DefinitionAnnotationReader implements AnnotationReader -{ - /** - * @var string - */ - private static $regex = '/^\@(given|when|then)\s+(.+)$/i'; - /** - * @var string[] - */ - private static $classes = array( - 'given' => 'Behat\Behat\Definition\Call\Given', - 'when' => 'Behat\Behat\Definition\Call\When', - 'then' => 'Behat\Behat\Definition\Call\Then', - ); - - /** - * {@inheritdoc} - */ - public function readCallee($contextClass, ReflectionMethod $method, $docLine, $description) - { - if (!preg_match(self::$regex, $docLine, $match)) { - return null; - } - - $type = strtolower($match[1]); - $class = self::$classes[$type]; - $pattern = $match[2]; - $callable = array($contextClass, $method->getName()); - - return new $class($pattern, $callable, $description); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Definition.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Definition.php deleted file mode 100644 index 43b78b5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Definition.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition; - -use Behat\Testwork\Call\Callee; - -/** - * Represents a step definition. - * - * @author Konstantin Kudryashov - */ -interface Definition extends Callee -{ - /** - * Returns definition type (Given|When|Then). - * - * @return string - */ - public function getType(); - - /** - * Returns step pattern exactly as it was defined. - * - * @return string - */ - public function getPattern(); - - /** - * Represents definition as a string. - * - * @return string - */ - public function __toString(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionFinder.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionFinder.php deleted file mode 100644 index 14d2763..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionFinder.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition; - -use Behat\Behat\Definition\Search\SearchEngine; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; - -/** - * Finds specific step definition in environment using registered search engines. - * - * @author Konstantin Kudryashov - */ -final class DefinitionFinder -{ - /** - * @var SearchEngine[] - */ - private $engines = array(); - - /** - * Registers definition search engine. - * - * @param SearchEngine $searchEngine - */ - public function registerSearchEngine(SearchEngine $searchEngine) - { - $this->engines[] = $searchEngine; - } - - /** - * Searches definition for a provided step in a provided environment. - * - * @param Environment $environment - * @param FeatureNode $feature - * @param StepNode $step - * - * @return SearchResult - */ - public function findDefinition(Environment $environment, FeatureNode $feature, StepNode $step) - { - foreach ($this->engines as $engine) { - $result = $engine->searchDefinition($environment, $feature, $step); - - if (null !== $result && $result->hasMatch()) { - return $result; - } - } - - return new SearchResult(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionRepository.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionRepository.php deleted file mode 100644 index b1db15a..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionRepository.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition; - -use Behat\Behat\Definition\Exception\RedundantStepException; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\EnvironmentManager; - -/** - * Provides step definitions using environment manager. - * - * @author Konstantin Kudryashov - */ -final class DefinitionRepository -{ - /** - * @var EnvironmentManager - */ - private $environmentManager; - - /** - * Initializes repository. - * - * @param EnvironmentManager $environmentManager - */ - public function __construct(EnvironmentManager $environmentManager) - { - $this->environmentManager = $environmentManager; - } - - /** - * Returns all available definitions for a specific environment. - * - * @param Environment $environment - * - * @return Definition[] - * - * @throws RedundantStepException - */ - public function getEnvironmentDefinitions(Environment $environment) - { - $patterns = array(); - $definitions = array(); - - foreach ($this->environmentManager->readEnvironmentCallees($environment) as $callee) { - if (!$callee instanceof Definition) { - continue; - } - - $pattern = $callee->getPattern(); - if (isset($patterns[$pattern])) { - throw new RedundantStepException($callee, $patterns[$pattern]); - } - - $patterns[$pattern] = $callee; - - $definitions[] = $callee; - } - - return $definitions; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionWriter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionWriter.php deleted file mode 100644 index 204d1ae..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/DefinitionWriter.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition; - -use Behat\Behat\Definition\Printer\DefinitionPrinter; -use Behat\Testwork\Environment\EnvironmentManager; -use Behat\Testwork\Suite\Suite; - -/** - * Prints definitions using provided printer. - * - * @author Konstantin Kudryashov - */ -final class DefinitionWriter -{ - /** - * @var EnvironmentManager - */ - private $environmentManager; - /** - * @var DefinitionRepository - */ - private $repository; - - /** - * Initializes writer. - * - * @param EnvironmentManager $environmentManager - * @param DefinitionRepository $repository - */ - public function __construct(EnvironmentManager $environmentManager, DefinitionRepository $repository) - { - $this->environmentManager = $environmentManager; - $this->repository = $repository; - } - - /** - * Prints definitions for provided suite using printer. - * - * @param DefinitionPrinter $printer - * @param Suite $suite - */ - public function printSuiteDefinitions(DefinitionPrinter $printer, $suite) - { - $environment = $this->environmentManager->buildEnvironment($suite); - $definitions = $this->repository->getEnvironmentDefinitions($environment); - - $printer->printDefinitions($suite, $definitions); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/AmbiguousMatchException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/AmbiguousMatchException.php deleted file mode 100644 index bb5ba33..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/AmbiguousMatchException.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Exception; - -use Behat\Behat\Definition\Definition; -use RuntimeException; - -/** - * Represents an exception caused by an ambiguous step definition match. - * - * If multiple definitions match the same step, behat is not able to determine which one is better and thus this - * exception is thrown and test suite is stopped. - * - * @author Konstantin Kudryashov - */ -final class AmbiguousMatchException extends RuntimeException implements SearchException -{ - /** - * @var string - */ - private $text; - /** - * @var Definition[] - */ - private $matches = array(); - - /** - * Initializes ambiguous exception. - * - * @param string $text step description - * @param Definition[] $matches ambiguous matches (array of Definition's) - */ - public function __construct($text, array $matches) - { - $this->text = $text; - $this->matches = $matches; - - $message = sprintf("Ambiguous match of \"%s\":", $text); - foreach ($matches as $definition) { - $message .= sprintf( - "\nto `%s` from %s", - $definition->getPattern(), - $definition->getPath() - ); - } - - parent::__construct($message); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/DefinitionException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/DefinitionException.php deleted file mode 100644 index 07ee2e4..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/DefinitionException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * Represents an exception thrown during step definition handling. - * - * @author Konstantin Kudryashov - */ -interface DefinitionException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/InvalidPatternException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/InvalidPatternException.php deleted file mode 100644 index 1990bea..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/InvalidPatternException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception caused by an invalid definition pattern (not able to transform it to a regex). - * - * @author Christophe Coevoet - */ -final class InvalidPatternException extends InvalidArgumentException implements DefinitionException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/RedundantStepException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/RedundantStepException.php deleted file mode 100644 index 8a47c5e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/RedundantStepException.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Exception; - -use Behat\Behat\Definition\Definition; -use RuntimeException; - -/** - * Represents an exception caused by a redundant step definition. - * - * If multiple step definitions in the boundaries of the same suite use same regular expression, behat is not able - * to determine which one is better and thus this exception is thrown and test suite is stopped. - * - * @author Konstantin Kudryashov - */ -final class RedundantStepException extends RuntimeException implements SearchException -{ - /** - * Initializes redundant exception. - * - * @param Definition $step2 duplicate step definition - * @param Definition $step1 firstly matched step definition - */ - public function __construct(Definition $step2, Definition $step1) - { - $message = sprintf( - "Step \"%s\" is already defined in %s\n\n%s\n%s", - $step2->getPattern(), $step1->getPath(), $step1->getPath(), $step2->getPath() - ); - - parent::__construct($message); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/SearchException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/SearchException.php deleted file mode 100644 index bc3457b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/SearchException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Exception; - -/** - * Represents an exception caused by a definition search. - * - * @author Konstantin Kudryashov - */ -interface SearchException extends DefinitionException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/UnknownPatternException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/UnknownPatternException.php deleted file mode 100644 index bc23cb3..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/UnknownPatternException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception caused by an unrecognised definition pattern. - * - * @author Konstantin Kudryashov - */ -final class UnknownPatternException extends InvalidArgumentException implements DefinitionException -{ - /** - * @var string - */ - private $pattern; - - /** - * Initializes exception. - * - * @param string $message - * @param integer $pattern - */ - public function __construct($message, $pattern) - { - $this->pattern = $pattern; - - parent::__construct($message); - } - - /** - * Returns pattern that caused exception. - * - * @return string - */ - public function getPattern() - { - return $this->pattern; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/UnsupportedPatternTypeException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/UnsupportedPatternTypeException.php deleted file mode 100644 index 17114e6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Exception/UnsupportedPatternTypeException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception caused by an unsupported pattern type. - * - * @author Konstantin Kudryashov - */ -final class UnsupportedPatternTypeException extends InvalidArgumentException implements DefinitionException -{ - /** - * @var string - */ - private $type; - - /** - * Initializes exception. - * - * @param string $message - * @param string $type - */ - public function __construct($message, $type) - { - $this->type = $type; - - parent::__construct($message); - } - - /** - * Returns pattern type that caused exception. - * - * @return string - */ - public function getType() - { - return $this->type; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Pattern.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Pattern.php deleted file mode 100644 index 0a3834f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Pattern.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Pattern; - -/** - * Step definition pattern. - * - * @author Konstantin Kudryashov - */ -final class Pattern -{ - /** - * @var string - */ - private $canonicalText; - /** - * @var string - */ - private $pattern; - /** - * @var integer - */ - private $placeholderCount; - - /** - * Initializes pattern. - * - * @param string $canonicalText - * @param string $pattern - * @param integer $placeholderCount - */ - public function __construct($canonicalText, $pattern, $placeholderCount = 0) - { - $this->canonicalText = $canonicalText; - $this->pattern = $pattern; - $this->placeholderCount = $placeholderCount; - } - - /** - * Returns canonical step text. - * - * @return string - */ - public function getCanonicalText() - { - return $this->canonicalText; - } - - /** - * Returns pattern. - * - * @return string - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * Returns pattern placeholder count. - * - * @return integer - */ - public function getPlaceholderCount() - { - return $this->placeholderCount; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/PatternTransformer.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/PatternTransformer.php deleted file mode 100644 index adda52b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/PatternTransformer.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Pattern; - -use Behat\Behat\Definition\Exception\UnknownPatternException; -use Behat\Behat\Definition\Exception\UnsupportedPatternTypeException; -use Behat\Behat\Definition\Pattern\Policy\PatternPolicy; - -/** - * Transforms patterns using registered policies. - * - * @author Konstantin Kudryashov - */ -final class PatternTransformer -{ - /** - * @var PatternPolicy[] - */ - private $policies = array(); - - /** - * @var string[] - */ - private $patternToRegexpCache = array(); - - /** - * Registers pattern policy. - * - * @param PatternPolicy $policy - */ - public function registerPatternPolicy(PatternPolicy $policy) - { - $this->policies[] = $policy; - $this->patternToRegexpCache = array(); - } - - /** - * Generates pattern. - * - * @param string $type - * @param string $stepText - * - * @return Pattern - * - * @throws UnsupportedPatternTypeException - */ - public function generatePattern($type, $stepText) - { - foreach ($this->policies as $policy) { - if ($policy->supportsPatternType($type)) { - return $policy->generatePattern($stepText); - } - } - - throw new UnsupportedPatternTypeException(sprintf('Can not find policy for a pattern type `%s`.', $type), $type); - } - - /** - * Transforms pattern string to regex. - * - * @param string $pattern - * - * @return string - * - * @throws UnknownPatternException - */ - public function transformPatternToRegex($pattern) - { - if (!isset($this->patternToRegexpCache[$pattern])) { - $this->patternToRegexpCache[$pattern] = $this->transformPatternToRegexWithSupportedPolicy($pattern); - } - - return $this->patternToRegexpCache[$pattern]; - } - - /** - * @param string $pattern - * - * @return string - * - * @throws UnknownPatternException - */ - private function transformPatternToRegexWithSupportedPolicy($pattern) - { - foreach ($this->policies as $policy) { - if ($policy->supportsPattern($pattern)) { - return $policy->transformPatternToRegex($pattern); - } - } - - throw new UnknownPatternException(sprintf('Can not find policy for a pattern `%s`.', $pattern), $pattern); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php deleted file mode 100644 index cd3daac..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/PatternPolicy.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Pattern\Policy; - -use Behat\Behat\Definition\Pattern\Pattern; -use Behat\Behat\Definition\Pattern\PatternTransformer; - -/** - * Defines a way to handle custom definition patterns. - * - * @see PatternTransformer - * - * @author Konstantin Kudryashov - */ -interface PatternPolicy -{ - /** - * Checks if policy supports pattern type. - * - * @param string $type - * - * @return bool - */ - public function supportsPatternType($type); - - /** - * Generates pattern for step text. - * - * @param string $stepText - * - * @return Pattern - */ - public function generatePattern($stepText); - - /** - * Checks if policy supports pattern. - * - * @param string $pattern - * - * @return bool - */ - public function supportsPattern($pattern); - - /** - * Transforms pattern string to regex. - * - * @param string $pattern - * - * @return string - */ - public function transformPatternToRegex($pattern); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/RegexPatternPolicy.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/RegexPatternPolicy.php deleted file mode 100644 index 76498b9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/RegexPatternPolicy.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Pattern\Policy; - -use Behat\Behat\Definition\Exception\InvalidPatternException; -use Behat\Behat\Definition\Pattern\Pattern; -use Behat\Transliterator\Transliterator; - -/** - * Defines a way to handle regex patterns. - * - * @author Konstantin Kudryashov - */ -final class RegexPatternPolicy implements PatternPolicy -{ - /** - * @var string[string] - */ - private static $replacePatterns = array( - "/(?<=\W|^)\\\'(?:((?!\\').)*)\\\'(?=\W|$)/" => "'([^']*)'", // Single quoted strings - '/(?<=\W|^)\"(?:[^\"]*)\"(?=\W|$)/' => "\"([^\"]*)\"", // Double quoted strings - '/(?<=\W|^)(\d+)(?=\W|$)/' => "(\\d+)", // Numbers - ); - - /** - * {@inheritdoc} - */ - public function supportsPatternType($type) - { - return 'regex' === $type; - } - - /** - * {@inheritdoc} - */ - public function generatePattern($stepText) - { - $canonicalText = $this->generateCanonicalText($stepText); - $stepRegex = $this->generateRegex($stepText); - $placeholderCount = $this->countPlaceholders($stepText, $stepRegex); - - return new Pattern($canonicalText, '/^' . $stepRegex . '$/', $placeholderCount); - } - - /** - * {@inheritdoc} - */ - public function supportsPattern($pattern) - { - return (bool) preg_match('/^(?:\\{.*\\}|([~\\/#`]).*\1)[imsxADSUXJu]*$/s', $pattern); - } - - /** - * {@inheritdoc} - */ - public function transformPatternToRegex($pattern) - { - if (false === @preg_match($pattern, 'anything')) { - $error = error_get_last(); - $errorMessage = $error['message'] ?? ''; - - throw new InvalidPatternException(sprintf('The regex `%s` is invalid: %s', $pattern, $errorMessage)); - } - - return $pattern; - } - - /** - * Generates regex from step text. - * - * @param string $stepText - * - * @return string - */ - private function generateRegex($stepText) - { - return preg_replace( - array_keys(self::$replacePatterns), - array_values(self::$replacePatterns), - $this->escapeStepText($stepText) - ); - } - - /** - * Generates canonical text for step text. - * - * @param string $stepText - * - * @return string - */ - private function generateCanonicalText($stepText) - { - $canonicalText = preg_replace(array_keys(self::$replacePatterns), '', $stepText); - $canonicalText = Transliterator::transliterate($canonicalText, ' '); - $canonicalText = preg_replace('/[^a-zA-Z\_\ ]/', '', $canonicalText); - $canonicalText = str_replace(' ', '', ucwords($canonicalText)); - - return $canonicalText; - } - - /** - * Counts regex placeholders using provided text. - * - * @param string $stepText - * @param string $stepRegex - * - * @return integer - */ - private function countPlaceholders($stepText, $stepRegex) - { - preg_match('/^' . $stepRegex . '$/', $stepText, $matches); - - return count($matches) ? count($matches) - 1 : 0; - } - - /** - * Returns escaped step text. - * - * @param string $stepText - * - * @return string - */ - private function escapeStepText($stepText) - { - return preg_replace('/([\/\[\]\(\)\\\^\$\.\|\?\*\+\'])/', '\\\\$1', $stepText); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php deleted file mode 100644 index aa37f9e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Pattern/Policy/TurnipPatternPolicy.php +++ /dev/null @@ -1,212 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Pattern\Policy; - -use Behat\Behat\Definition\Pattern\Pattern; -use Behat\Behat\Definition\Exception\InvalidPatternException; -use Behat\Transliterator\Transliterator; - -/** - * Defines a way to handle turnip patterns. - * - * @author Konstantin Kudryashov - */ -final class TurnipPatternPolicy implements PatternPolicy -{ - public const TOKEN_REGEX = "[\"']?(?P<%s>(?<=\")[^\"]*(?=\")|(?<=')[^']*(?=')|\-?[\w\.\,]+)['\"]?"; - - public const PLACEHOLDER_REGEXP = "/\\\:(\w+)/"; - public const OPTIONAL_WORD_REGEXP = '/(\s)?\\\\\(([^\\\]+)\\\\\)(\s)?/'; - public const ALTERNATIVE_WORD_REGEXP = '/(\w+)\\\\\/(\w+)/'; - - /** - * @var string[] - */ - private $regexCache = array(); - - /** - * @var string[] - */ - private static $placeholderPatterns = array( - "/(?escapeAlternationSyntax($pattern); - $canonicalText = $this->generateCanonicalText($stepText); - - return new Pattern($canonicalText, $pattern, $count); - } - - /** - * {@inheritdoc} - */ - public function supportsPattern($pattern) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function transformPatternToRegex($pattern) - { - if (!isset($this->regexCache[$pattern])) { - $this->regexCache[$pattern] = $this->createTransformedRegex($pattern); - } - return $this->regexCache[$pattern]; - } - - /** - * @param string $pattern - * @return string - */ - private function createTransformedRegex($pattern) - { - $regex = preg_quote($pattern, '/'); - - $regex = $this->replaceTokensWithRegexCaptureGroups($regex); - $regex = $this->replaceTurnipOptionalEndingWithRegex($regex); - $regex = $this->replaceTurnipAlternativeWordsWithRegex($regex); - - return '/^' . $regex . '$/iu'; - } - - /** - * Generates canonical text for step text. - * - * @param string $stepText - * - * @return string - */ - private function generateCanonicalText($stepText) - { - $canonicalText = preg_replace(self::$placeholderPatterns, '', $stepText); - $canonicalText = Transliterator::transliterate($canonicalText, ' '); - $canonicalText = preg_replace('/[^a-zA-Z\_\ ]/', '', $canonicalText); - $canonicalText = str_replace(' ', '', ucwords($canonicalText)); - - return $canonicalText; - } - - /** - * Replaces turnip tokens with regex capture groups. - * - * @param string $regex - * - * @return string - */ - private function replaceTokensWithRegexCaptureGroups($regex) - { - $tokenRegex = self::TOKEN_REGEX; - - return preg_replace_callback( - self::PLACEHOLDER_REGEXP, - array($this, 'replaceTokenWithRegexCaptureGroup'), - $regex - ); - } - - private function replaceTokenWithRegexCaptureGroup($tokenMatch) - { - if (strlen($tokenMatch[1]) >= 32) { - throw new InvalidPatternException( - "Token name should not exceed 32 characters, but `{$tokenMatch[1]}` was used." - ); - } - - return sprintf(self::TOKEN_REGEX, $tokenMatch[1]); - } - - /** - * Replaces turnip optional ending with regex non-capturing optional group. - * - * @param string $regex - * - * @return string - */ - private function replaceTurnipOptionalEndingWithRegex($regex) - { - return preg_replace(self::OPTIONAL_WORD_REGEXP, '(?:\1)?(?:\2)?(?:\3)?', $regex); - } - - /** - * Replaces turnip alternative words with regex non-capturing alternating group. - * - * @param string $regex - * - * @return string - */ - private function replaceTurnipAlternativeWordsWithRegex($regex) - { - $regex = preg_replace(self::ALTERNATIVE_WORD_REGEXP, '(?:\1|\2)', $regex); - $regex = $this->removeEscapingOfAlternationSyntax($regex); - - return $regex; - } - - /** - * Adds escaping to alternation syntax in pattern. - * - * By default, Turnip treats `/` as alternation syntax. Meaning `one/two` for Turnip - * means either `one` or `two`. Sometimes though you'll want to use slash character - * with different purpose (URL, UNIX paths). In this case, you would escape slashes - * with backslash. - * - * This method adds escaping to all slashes in generated snippets. - * - * @param string $pattern - * - * @return string - */ - private function escapeAlternationSyntax($pattern) - { - return str_replace('/', '\/', $pattern); - } - - /** - * Removes escaping of alternation syntax from regex. - * - * This method removes those escaping backslashes from your slashes, so your steps - * could be matched against your escaped definitions. - * - * @param string $regex - * - * @return string - */ - private function removeEscapingOfAlternationSyntax($regex) - { - return str_replace('\\\/', '/', $regex); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php deleted file mode 100644 index d690982..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionInformationPrinter.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Printer; - -use Behat\Behat\Definition\Definition; -use Behat\Testwork\Suite\Suite; - -/** - * Prints definitions with full information about them. - * - * @author Konstantin Kudryashov - */ -final class ConsoleDefinitionInformationPrinter extends ConsoleDefinitionPrinter -{ - /** - * @var null|string - */ - private $searchCriterion; - - /** - * Sets search criterion. - * - * @param string $criterion - */ - public function setSearchCriterion($criterion) - { - $this->searchCriterion = $criterion; - } - - /** - * {@inheritdoc} - */ - public function printDefinitions(Suite $suite, $definitions) - { - $search = $this->searchCriterion; - $output = array(); - - foreach ($definitions as $definition) { - $definition = $this->translateDefinition($suite, $definition); - $pattern = $definition->getPattern(); - - if (null !== $search && false === mb_strpos($pattern, $search, 0, 'utf8')) { - continue; - } - - $lines = array_merge( - $this->extractHeader($suite, $definition), - $this->extractDescription($suite, $definition), - $this->extractFooter($suite, $definition) - ); - - $output[] = implode(PHP_EOL, $lines) . PHP_EOL; - } - - $this->write(rtrim(implode(PHP_EOL, $output))); - } - - /** - * Extracts the formatted header from the definition. - * - * @param Suite $suite - * @param Definition $definition - * - * @return string[] - */ - private function extractHeader(Suite $suite, Definition $definition) - { - $pattern = $definition->getPattern(); - $lines = array(); - $lines[] = strtr( - '{suite} | {type} {regex}', array( - '{suite}' => $suite->getName(), - '{type}' => $this->getDefinitionType($definition), - '{regex}' => $pattern, - ) - ); - - return $lines; - } - - /** - * Extracts the formatted description from the definition. - * - * @param Suite $suite - * @param Definition $definition - * - * @return string[] - */ - private function extractDescription(Suite $suite, Definition $definition) - { - $definition = $this->translateDefinition($suite, $definition); - - $lines = array(); - if ($description = $definition->getDescription()) { - foreach (explode("\n", $description) as $descriptionLine) { - $lines[] = strtr( - '{space}| {description}', array( - '{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1), - '{description}' => $descriptionLine - ) - ); - } - } - - return $lines; - } - - /** - * Extracts the formatted footer from the definition. - * - * @param Suite $suite - * @param Definition $definition - * - * @return string[] - */ - private function extractFooter(Suite $suite, Definition $definition) - { - $lines = array(); - $lines[] = strtr( - '{space}| at `{path}`', array( - '{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1), - '{path}' => $definition->getPath() - ) - ); - - if ($this->isVerbose()) { - $lines[] = strtr( - '{space}| on `{filepath}[{start}:{end}]`', array( - '{space}' => str_pad('', mb_strlen($suite->getName(), 'utf8') + 1), - '{filepath}' => $definition->getReflection()->getFileName(), - '{start}' => $definition->getReflection()->getStartLine(), - '{end}' => $definition->getReflection()->getEndLine() - ) - ); - } - - return $lines; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionListPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionListPrinter.php deleted file mode 100644 index d155d94..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionListPrinter.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Printer; - -use Behat\Testwork\Suite\Suite; - -/** - * Prints simple definitions list. - * - * @author Konstantin Kudryashov - */ -final class ConsoleDefinitionListPrinter extends ConsoleDefinitionPrinter -{ - /** - * {@inheritdoc} - */ - public function printDefinitions(Suite $suite, $definitions) - { - $output = array(); - - foreach ($definitions as $definition) { - $definition = $this->translateDefinition($suite, $definition); - - $output[] = strtr( - '{suite} | {type} {regex}', array( - '{suite}' => $suite->getName(), - '{type}' => $this->getDefinitionType($definition, true), - '{regex}' => $definition->getPattern(), - ) - ); - } - - $this->write(rtrim(implode(PHP_EOL, $output))); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php deleted file mode 100644 index bd0546f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/ConsoleDefinitionPrinter.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Printer; - -use Behat\Behat\Definition\Definition; -use Behat\Behat\Definition\Pattern\PatternTransformer; -use Behat\Behat\Definition\Translator\DefinitionTranslator; -use Behat\Gherkin\Keywords\KeywordsInterface; -use Behat\Testwork\Suite\Suite; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Represents console-based definition printer. - * - * @author Konstantin Kudryashov - */ -abstract class ConsoleDefinitionPrinter implements DefinitionPrinter -{ - /** - * @var OutputInterface - */ - private $output; - /** - * @var PatternTransformer - */ - private $patternTransformer; - /** - * @var DefinitionTranslator - */ - private $translator; - /** - * @var KeywordsInterface - */ - private $keywords; - - /** - * Initializes printer. - * - * @param OutputInterface $output - * @param PatternTransformer $patternTransformer - * @param DefinitionTranslator $translator - * @param KeywordsInterface $keywords - */ - public function __construct( - OutputInterface $output, - PatternTransformer $patternTransformer, - DefinitionTranslator $translator, - KeywordsInterface $keywords - ) { - $this->output = $output; - $this->patternTransformer = $patternTransformer; - $this->translator = $translator; - $this->keywords = $keywords; - - $output->getFormatter()->setStyle('def_regex', new OutputFormatterStyle('yellow')); - $output->getFormatter()->setStyle( - 'def_regex_capture', - new OutputFormatterStyle('yellow', null, array('bold')) - ); - $output->getFormatter()->setStyle( - 'def_dimmed', - new OutputFormatterStyle('black', null, array('bold')) - ); - } - - /** - * Writes text to the console. - * - * @param string $text - */ - final protected function write($text) - { - $this->output->writeln($text); - $this->output->writeln(''); - } - - final protected function getDefinitionType(Definition $definition, $onlyOne = false) - { - $this->keywords->setLanguage($this->translator->getLocale()); - - $method = 'get'.ucfirst($definition->getType()).'Keywords'; - - $keywords = explode('|', $this->keywords->$method()); - - if ($onlyOne) { - return current($keywords); - } - - return 1 < count($keywords) ? '['.implode('|', $keywords).']' : implode('|', $keywords); - } - - /** - * Translates definition using translator. - * - * @param Suite $suite - * @param Definition $definition - * - * @return Definition - */ - final protected function translateDefinition(Suite $suite, Definition $definition) - { - return $this->translator->translateDefinition($suite, $definition); - } - - /** - * Returns whether verbosity is verbose (-v). - * - * @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise - */ - final protected function isVerbose() - { - return $this->output->isVerbose(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/DefinitionPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/DefinitionPrinter.php deleted file mode 100644 index 826ce5b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Printer/DefinitionPrinter.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Printer; - -use Behat\Behat\Definition\Definition; -use Behat\Testwork\Suite\Suite; - -/** - * Prints provided definition. - * - * @author Konstantin Kudryashov - */ -interface DefinitionPrinter -{ - /** - * Prints definition. - * - * @param Suite $suite - * @param Definition[] $definitions - */ - public function printDefinitions(Suite $suite, $definitions); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Search/RepositorySearchEngine.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Search/RepositorySearchEngine.php deleted file mode 100644 index 6b69485..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Search/RepositorySearchEngine.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Search; - -use Behat\Behat\Definition\Definition; -use Behat\Behat\Definition\DefinitionRepository; -use Behat\Behat\Definition\Exception\AmbiguousMatchException; -use Behat\Behat\Definition\Pattern\PatternTransformer; -use Behat\Behat\Definition\SearchResult; -use Behat\Behat\Definition\Translator\DefinitionTranslator; -use Behat\Gherkin\Node\ArgumentInterface; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Argument\ArgumentOrganiser; -use Behat\Testwork\Environment\Environment; - -/** - * Searches for a step definition using definition repository. - * - * @see DefinitionRepository - * - * @author Konstantin Kudryashov - */ -final class RepositorySearchEngine implements SearchEngine -{ - /** - * @var DefinitionRepository - */ - private $repository; - /** - * @var PatternTransformer - */ - private $patternTransformer; - /** - * @var DefinitionTranslator - */ - private $translator; - /** - * @var ArgumentOrganiser - */ - private $argumentOrganiser; - - /** - * Initializes search engine. - * - * @param DefinitionRepository $repository - * @param PatternTransformer $patternTransformer - * @param DefinitionTranslator $translator - * @param ArgumentOrganiser $argumentOrganiser - */ - public function __construct( - DefinitionRepository $repository, - PatternTransformer $patternTransformer, - DefinitionTranslator $translator, - ArgumentOrganiser $argumentOrganiser - ) { - $this->repository = $repository; - $this->patternTransformer = $patternTransformer; - $this->translator = $translator; - $this->argumentOrganiser = $argumentOrganiser; - } - - /** - * {@inheritdoc} - * - * @throws AmbiguousMatchException - */ - public function searchDefinition( - Environment $environment, - FeatureNode $feature, - StepNode $step - ) { - $suite = $environment->getSuite(); - $language = $feature->getLanguage(); - $stepText = $step->getText(); - $multi = $step->getArguments(); - - $definitions = array(); - $result = null; - - foreach ($this->repository->getEnvironmentDefinitions($environment) as $definition) { - $definition = $this->translator->translateDefinition($suite, $definition, $language); - - if (!$newResult = $this->match($definition, $stepText, $multi)) { - continue; - } - - $result = $newResult; - $definitions[] = $newResult->getMatchedDefinition(); - } - - if (count($definitions) > 1) { - throw new AmbiguousMatchException($result->getMatchedText(), $definitions); - } - - return $result; - } - - /** - * Attempts to match provided definition against a step text. - * - * @param Definition $definition - * @param string $stepText - * @param ArgumentInterface[] $multiline - * - * @return null|SearchResult - */ - private function match(Definition $definition, $stepText, array $multiline) - { - $regex = $this->patternTransformer->transformPatternToRegex($definition->getPattern()); - - if (!preg_match($regex, $stepText, $match)) { - return null; - } - - $function = $definition->getReflection(); - $match = array_merge($match, array_values($multiline)); - $arguments = $this->argumentOrganiser->organiseArguments($function, $match); - - return new SearchResult($definition, $stepText, $arguments); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Search/SearchEngine.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Search/SearchEngine.php deleted file mode 100644 index a869adc..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Search/SearchEngine.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Search; - -use Behat\Behat\Definition\DefinitionFinder; -use Behat\Behat\Definition\SearchResult; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; - -/** - * Searches for a step definition in a specific environment. - * - * @see DefinitionFinder - * - * @author Konstantin Kudryashov - */ -interface SearchEngine -{ - /** - * Searches for a step definition. - * - * @param Environment $environment - * @param FeatureNode $feature - * @param StepNode $step - * - * @return null|SearchResult - */ - public function searchDefinition(Environment $environment, FeatureNode $feature, StepNode $step); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/SearchResult.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/SearchResult.php deleted file mode 100644 index cdb4191..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/SearchResult.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition; - -/** - * Step definition search result. - * - * @author Konstantin Kudryashov - */ -final class SearchResult -{ - /** - * @var null|Definition - */ - private $definition; - /** - * @var null|string - */ - private $matchedText; - /** - * @var null|array - */ - private $arguments; - - /** - * Registers search match. - * - * @param null|Definition $definition - * @param null|string $matchedText - * @param null|array $arguments - */ - public function __construct(Definition $definition = null, $matchedText = null, array $arguments = null) - { - $this->definition = $definition; - $this->matchedText = $matchedText; - $this->arguments = $arguments; - } - - /** - * Checks if result contains a match. - * - * @return bool - */ - public function hasMatch() - { - return null !== $this->definition; - } - - /** - * Returns matched definition. - * - * @return null|Definition - */ - public function getMatchedDefinition() - { - return $this->definition; - } - - /** - * Returns matched text. - * - * @return null|string - */ - public function getMatchedText() - { - return $this->matchedText; - } - - /** - * Returns matched definition arguments. - * - * @return null|array - */ - public function getMatchedArguments() - { - return $this->arguments; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php deleted file mode 100644 index e408f53..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/ServiceContainer/DefinitionExtension.php +++ /dev/null @@ -1,339 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\ServiceContainer; - -use Behat\Behat\Context\ServiceContainer\ContextExtension; -use Behat\Testwork\Argument\ServiceContainer\ArgumentExtension; -use Behat\Behat\Gherkin\ServiceContainer\GherkinExtension; -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Suite\ServiceContainer\SuiteExtension; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Extends Behat with definition services. - * - * @author Konstantin Kudryashov - */ -final class DefinitionExtension implements Extension -{ - /* - * Available services - */ - public const FINDER_ID = 'definition.finder'; - public const REPOSITORY_ID = 'definition.repository'; - public const PATTERN_TRANSFORMER_ID = 'definition.pattern_transformer'; - public const WRITER_ID = 'definition.writer'; - public const DEFINITION_TRANSLATOR_ID = 'definition.translator'; - - /* - * Available extension points - */ - public const SEARCH_ENGINE_TAG = 'definition.search_engine'; - public const PATTERN_POLICY_TAG = 'definition.pattern_policy'; - public const DOC_BLOCK_HELPER_ID = 'definition.doc_block_helper'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes compiler pass. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'definitions'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadFinder($container); - $this->loadRepository($container); - $this->loadWriter($container); - $this->loadPatternTransformer($container); - $this->loadDefinitionTranslator($container); - $this->loadDefaultSearchEngines($container); - $this->loadDefaultPatternPolicies($container); - $this->loadAnnotationReader($container); - $this->loadAttributeReader($container); - $this->loadDefinitionPrinters($container); - $this->loadController($container); - $this->loadDocblockHelper($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processSearchEngines($container); - $this->processPatternPolicies($container); - } - - /** - * Loads definition finder. - * - * @param ContainerBuilder $container - */ - private function loadFinder(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\DefinitionFinder'); - $container->setDefinition(self::FINDER_ID, $definition); - } - - /** - * Loads definition repository. - * - * @param ContainerBuilder $container - */ - private function loadRepository(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\DefinitionRepository', array( - new Reference(EnvironmentExtension::MANAGER_ID) - )); - $container->setDefinition(self::REPOSITORY_ID, $definition); - } - - /** - * Loads definition writer. - * - * @param ContainerBuilder $container - */ - private function loadWriter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\DefinitionWriter', array( - new Reference(EnvironmentExtension::MANAGER_ID), - new Reference(self::REPOSITORY_ID) - )); - $container->setDefinition(self::WRITER_ID, $definition); - } - - /** - * Loads definition pattern transformer. - * - * @param ContainerBuilder $container - */ - private function loadPatternTransformer(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\Pattern\PatternTransformer'); - $container->setDefinition(self::PATTERN_TRANSFORMER_ID, $definition); - } - - /** - * Loads definition translator. - * - * @param ContainerBuilder $container - */ - private function loadDefinitionTranslator(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\Translator\DefinitionTranslator', array( - new Reference(TranslatorExtension::TRANSLATOR_ID) - )); - $container->setDefinition(self::DEFINITION_TRANSLATOR_ID, $definition); - } - - /** - * Loads default search engines. - * - * @param ContainerBuilder $container - */ - private function loadDefaultSearchEngines(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\Search\RepositorySearchEngine', array( - new Reference(self::REPOSITORY_ID), - new Reference(self::PATTERN_TRANSFORMER_ID), - new Reference(self::DEFINITION_TRANSLATOR_ID), - new Reference(ArgumentExtension::PREG_MATCH_ARGUMENT_ORGANISER_ID) - )); - $definition->addTag(self::SEARCH_ENGINE_TAG, array('priority' => 50)); - $container->setDefinition(self::SEARCH_ENGINE_TAG . '.repository', $definition); - } - - /** - * Loads default pattern policies. - * - * @param ContainerBuilder $container - */ - private function loadDefaultPatternPolicies(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\Pattern\Policy\TurnipPatternPolicy'); - $definition->addTag(self::PATTERN_POLICY_TAG, array('priority' => 50)); - $container->setDefinition(self::PATTERN_POLICY_TAG . '.turnip', $definition); - - $definition = new Definition('Behat\Behat\Definition\Pattern\Policy\RegexPatternPolicy'); - $definition->addTag(self::PATTERN_POLICY_TAG, array('priority' => 60)); - $container->setDefinition(self::PATTERN_POLICY_TAG . '.regex', $definition); - } - - /** - * Loads definition annotation reader. - * - * @param ContainerBuilder $container - */ - private function loadAnnotationReader(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\Context\Annotation\DefinitionAnnotationReader'); - $definition->addTag(ContextExtension::ANNOTATION_READER_TAG, array('priority' => 50)); - $container->setDefinition(ContextExtension::ANNOTATION_READER_TAG . '.definition', $definition); - } - - /** - * Loads definition Attribute reader. - * - * @param ContainerBuilder $container - */ - private function loadAttributeReader(ContainerBuilder $container) - { - $definition = new Definition('\Behat\Behat\Definition\Context\Attribute\DefinitionAttributeReader', array( - new Reference(self::DOC_BLOCK_HELPER_ID) - )); - $definition->addTag(ContextExtension::ATTRIBUTE_READER_TAG, array('priority' => 50)); - $container->setDefinition(ContextExtension::ATTRIBUTE_READER_TAG . '.definition', $definition); - } - - /** - * Loads definition printers. - * - * @param ContainerBuilder $container - */ - private function loadDefinitionPrinters(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\Printer\ConsoleDefinitionInformationPrinter', array( - new Reference(CliExtension::OUTPUT_ID), - new Reference(self::PATTERN_TRANSFORMER_ID), - new Reference(self::DEFINITION_TRANSLATOR_ID), - new Reference(GherkinExtension::KEYWORDS_ID) - )); - $container->setDefinition($this->getInformationPrinterId(), $definition); - - $definition = new Definition('Behat\Behat\Definition\Printer\ConsoleDefinitionListPrinter', array( - new Reference(CliExtension::OUTPUT_ID), - new Reference(self::PATTERN_TRANSFORMER_ID), - new Reference(self::DEFINITION_TRANSLATOR_ID), - new Reference(GherkinExtension::KEYWORDS_ID) - )); - $container->setDefinition($this->getListPrinterId(), $definition); - } - - /** - * Loads definition controller. - * - * @param ContainerBuilder $container - */ - private function loadController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Definition\Cli\AvailableDefinitionsController', array( - new Reference(SuiteExtension::REGISTRY_ID), - new Reference(self::WRITER_ID), - new Reference($this->getListPrinterId()), - new Reference($this->getInformationPrinterId()) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 500)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.available_definitions', $definition); - } - - /** - * Loads DocBlockHelper - * - * @param ContainerBuilder $container - */ - private function loadDocblockHelper(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Context\Annotation\DocBlockHelper'); - - $container->setDefinition(self::DOC_BLOCK_HELPER_ID, $definition); - } - - /** - * Processes all search engines in the container. - * - * @param ContainerBuilder $container - */ - private function processSearchEngines(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::SEARCH_ENGINE_TAG); - $definition = $container->getDefinition(self::FINDER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerSearchEngine', array($reference)); - } - } - - /** - * Processes all pattern policies. - * - * @param ContainerBuilder $container - */ - private function processPatternPolicies(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::PATTERN_POLICY_TAG); - $definition = $container->getDefinition(self::PATTERN_TRANSFORMER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerPatternPolicy', array($reference)); - } - } - - /** - * returns list printer service id. - * - * @return string - */ - private function getListPrinterId() - { - return 'definition.list_printer'; - } - - /** - * Returns information printer service id. - * - * @return string - */ - private function getInformationPrinterId() - { - return 'definition.information_printer'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php deleted file mode 100644 index 105d61c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Translator/DefinitionTranslator.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Translator; - -use Behat\Behat\Definition\Definition; -use Behat\Testwork\Suite\Suite; - -/** - * Translates definitions using translator component. - * - * @author Konstantin Kudryashov - */ -final class DefinitionTranslator -{ - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * Initialises definition translator. - * - * @param TranslatorInterface $translator - */ - public function __construct(TranslatorInterface $translator) - { - $this->translator = $translator; - } - - /** - * Attempts to translate definition using translator and produce translated one on success. - * - * @param Suite $suite - * @param Definition $definition - * @param null|string $language - * - * @return Definition|TranslatedDefinition - */ - public function translateDefinition(Suite $suite, Definition $definition, $language = null) - { - $assetsId = $suite->getName(); - $pattern = $definition->getPattern(); - - $translatedPattern = $this->translator->trans($pattern, array(), $assetsId, $language); - if ($pattern != $translatedPattern) { - return new TranslatedDefinition($definition, $translatedPattern, $language); - } - - return $definition; - } - - public function getLocale() - { - return $this->translator->getLocale(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Translator/TranslatedDefinition.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Translator/TranslatedDefinition.php deleted file mode 100644 index 69813fa..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Definition/Translator/TranslatedDefinition.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Definition\Translator; - -use Behat\Behat\Definition\Definition; - -/** - * Represents definition translated to the specific language. - * - * @author Konstantin Kudryashov - */ -final class TranslatedDefinition implements Definition -{ - /** - * @var Definition - */ - private $definition; - /** - * @var string - */ - private $translatedPattern; - /** - * @var string - */ - private $language; - - /** - * Initialises translated definition. - * - * @param Definition $definition - * @param string $translatedPattern - * @param string $language - */ - public function __construct(Definition $definition, $translatedPattern, $language) - { - $this->definition = $definition; - $this->translatedPattern = $translatedPattern; - $this->language = $language; - } - - /** - * {@inheritdoc} - */ - public function getType() - { - return $this->definition->getType(); - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->translatedPattern; - } - - /** - * Returns original (not translated) pattern. - * - * @return string - */ - public function getOriginalPattern() - { - return $this->definition->getPattern(); - } - - /** - * Returns language definition was translated to. - * - * @return string - */ - public function getLanguage() - { - return $this->language; - } - - /** - * {@inheritdoc} - */ - public function getDescription() - { - return $this->definition->getDescription(); - } - - /** - * {@inheritdoc} - */ - public function getPath() - { - return $this->definition->getPath(); - } - - /** - * {@inheritdoc} - */ - public function isAMethod() - { - return $this->definition->isAMethod(); - } - - /** - * {@inheritdoc} - */ - public function isAnInstanceMethod() - { - return $this->definition->isAnInstanceMethod(); - } - - /** - * {@inheritdoc} - */ - public function getCallable() - { - return $this->definition->getCallable(); - } - - /** - * {@inheritdoc} - */ - public function getReflection() - { - return $this->definition->getReflection(); - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return $this->definition->__toString(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php deleted file mode 100644 index b4e13e0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Cli/StopOnFailureController.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Cli; - -use Behat\Behat\EventDispatcher\Event\AfterScenarioTested; -use Behat\Behat\EventDispatcher\Event\ExampleTested; -use Behat\Behat\EventDispatcher\Event\ScenarioTested; -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\EventDispatcher\Event\AfterExerciseAborted; -use Behat\Testwork\EventDispatcher\Event\AfterSuiteAborted; -use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted; -use Behat\Testwork\EventDispatcher\Event\SuiteTested; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Behat\Testwork\Tester\Result\Interpretation\ResultInterpretation; -use Behat\Testwork\Tester\Result\Interpretation\SoftInterpretation; -use Behat\Testwork\Tester\Result\Interpretation\StrictInterpretation; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Stops tests on first scenario failure. - * - * @author Konstantin Kudryashov - */ -final class StopOnFailureController implements Controller -{ - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * @var ResultInterpretation - */ - private $resultInterpretation; - - /** - * Initializes controller. - * - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(EventDispatcherInterface $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - $this->resultInterpretation = new SoftInterpretation(); - } - - /** - * Configures command to be executable by the controller. - * - * @param Command $command - */ - public function configure(Command $command) - { - $command->addOption('--stop-on-failure', null, InputOption::VALUE_NONE, - 'Stop processing on first failed scenario.' - ); - } - - /** - * Executes controller. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return null|integer - */ - public function execute(InputInterface $input, OutputInterface $output) - { - if (!$input->getOption('stop-on-failure')) { - return null; - } - - if ($input->getOption('strict')) { - $this->resultInterpretation = new StrictInterpretation(); - } - - $this->eventDispatcher->addListener(ScenarioTested::AFTER, array($this, 'exitOnFailure'), -100); - $this->eventDispatcher->addListener(ExampleTested::AFTER, array($this, 'exitOnFailure'), -100); - } - - /** - * Exits if scenario is a failure and if stopper is enabled. - * - * @param AfterScenarioTested $event - */ - public function exitOnFailure(AfterScenarioTested $event) - { - if (!$this->resultInterpretation->isFailure($event->getTestResult())) { - return; - } - - $this->eventDispatcher->dispatch(new AfterSuiteAborted($event->getEnvironment()), SuiteTested::AFTER); - $this->eventDispatcher->dispatch(new AfterExerciseAborted(), ExerciseCompleted::AFTER); - - exit(1); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterBackgroundSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterBackgroundSetup.php deleted file mode 100644 index 59b32ad..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterBackgroundSetup.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\BackgroundNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterSetup; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents an event right after background was setup for testing. - * - * @author Konstantin Kudryashov - */ -final class AfterBackgroundSetup extends BackgroundTested implements AfterSetup -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var BackgroundNode - */ - private $background; - /** - * @var Setup - */ - private $setup; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param BackgroundNode $background - * @param Setup $setup - */ - public function __construct(Environment $env, FeatureNode $feature, BackgroundNode $background, Setup $setup) - { - parent::__construct($env); - - $this->feature = $feature; - $this->background = $background; - $this->setup = $setup; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario node. - * - * @return ScenarioInterface - */ - public function getScenario() - { - return $this->background; - } - - /** - * Returns background node. - * - * @return BackgroundNode - */ - public function getBackground() - { - return $this->background; - } - - /** - * Returns current test setup. - * - * @return Setup - */ - public function getSetup() - { - return $this->setup; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterBackgroundTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterBackgroundTested.php deleted file mode 100644 index 76e1577..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterBackgroundTested.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\BackgroundNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterTested; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents an event in which background was tested. - * - * @author Konstantin Kudryashov - */ -final class AfterBackgroundTested extends BackgroundTested implements AfterTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var BackgroundNode - */ - private $background; - /** - * @var TestResult - */ - private $result; - /** - * @var Teardown - */ - private $teardown; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param BackgroundNode $background - * @param TestResult $result - * @param Teardown $teardown - */ - public function __construct( - Environment $env, - FeatureNode $feature, - BackgroundNode $background, - TestResult $result, - Teardown $teardown - ) { - parent::__construct($env); - - $this->feature = $feature; - $this->background = $background; - $this->result = $result; - $this->teardown = $teardown; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario node. - * - * @return ScenarioInterface - */ - public function getScenario() - { - return $this->background; - } - - /** - * Returns background node. - * - * @return BackgroundNode - */ - public function getBackground() - { - return $this->background; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } - - /** - * Returns current test teardown. - * - * @return Teardown - */ - public function getTeardown() - { - return $this->teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterFeatureSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterFeatureSetup.php deleted file mode 100644 index 73076ea..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterFeatureSetup.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterSetup; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents an event right after feature is setup for a test. - * - * @author Konstantin Kudryashov - */ -final class AfterFeatureSetup extends FeatureTested implements AfterSetup -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var Setup - */ - private $setup; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param Setup $setup - */ - public function __construct(Environment $env, FeatureNode $feature, Setup $setup) - { - parent::__construct($env); - - $this->feature = $feature; - $this->setup = $setup; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns current test setup. - * - * @return Setup - */ - public function getSetup() - { - return $this->setup; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterFeatureTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterFeatureTested.php deleted file mode 100644 index ed19128..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterFeatureTested.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterTested; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents an event right after feature was tested. - * - * @author Konstantin Kudryashov - */ -final class AfterFeatureTested extends FeatureTested implements AfterTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var TestResult - */ - private $result; - /** - * @var Teardown - */ - private $teardown; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param TestResult $result - * @param Teardown $teardown - */ - public function __construct(Environment $env, FeatureNode $feature, TestResult $result, Teardown $teardown) - { - parent::__construct($env); - - $this->feature = $feature; - $this->result = $result; - $this->teardown = $teardown; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } - - /** - * Returns current test teardown. - * - * @return Teardown - */ - public function getTeardown() - { - return $this->teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterOutlineSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterOutlineSetup.php deleted file mode 100644 index 3251d24..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterOutlineSetup.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterSetup; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents an event right after outline setup. - * - * @author Konstantin Kudryashov - */ -final class AfterOutlineSetup extends OutlineTested implements AfterSetup -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var OutlineNode - */ - private $outline; - /** - * @var Setup - */ - private $setup; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param OutlineNode $outline - * @param Setup $setup - */ - public function __construct(Environment $env, FeatureNode $feature, OutlineNode $outline, Setup $setup) - { - parent::__construct($env); - - $this->feature = $feature; - $this->outline = $outline; - $this->setup = $setup; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns outline node. - * - * @return OutlineNode - */ - public function getOutline() - { - return $this->outline; - } - - /** - * Returns current test setup. - * - * @return Setup - */ - public function getSetup() - { - return $this->setup; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterOutlineTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterOutlineTested.php deleted file mode 100644 index b4fd1a2..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterOutlineTested.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterTested; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents an event after outline was tested. - * - * @author Konstantin Kudryashov - */ -final class AfterOutlineTested extends OutlineTested implements AfterTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var OutlineNode - */ - private $outline; - /** - * @var TestResult - */ - private $result; - /** - * @var Teardown - */ - private $teardown; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param OutlineNode $outline - * @param TestResult $result - * @param Teardown $teardown - */ - public function __construct( - Environment $env, - FeatureNode $feature, - OutlineNode $outline, - TestResult $result, - Teardown $teardown - ) { - parent::__construct($env); - - $this->feature = $feature; - $this->outline = $outline; - $this->result = $result; - $this->teardown = $teardown; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns outline node. - * - * @return OutlineNode - */ - public function getOutline() - { - return $this->outline; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } - - /** - * Returns current test teardown. - * - * @return Teardown - */ - public function getTeardown() - { - return $this->teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterScenarioSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterScenarioSetup.php deleted file mode 100644 index 38666bf..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterScenarioSetup.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\ScenarioNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterSetup; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents an event after scenario setup. - * - * @author Konstantin Kudryashov - */ -final class AfterScenarioSetup extends ScenarioTested implements AfterSetup -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var Scenario - */ - private $scenario; - /** - * @var Setup - */ - private $setup; - - /** - * Initializes event - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - * @param Setup $setup - */ - public function __construct(Environment $env, FeatureNode $feature, Scenario $scenario, Setup $setup) - { - parent::__construct($env); - - $this->feature = $feature; - $this->scenario = $scenario; - $this->setup = $setup; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario node. - * - * @return ScenarioNode - */ - public function getScenario() - { - return $this->scenario; - } - - /** - * Returns current test setup. - * - * @return Setup - */ - public function getSetup() - { - return $this->setup; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterScenarioTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterScenarioTested.php deleted file mode 100644 index 6af6f18..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterScenarioTested.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\ScenarioNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterTested; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents an event after scenario has been tested. - * - * @author Konstantin Kudryashov - */ -final class AfterScenarioTested extends ScenarioTested implements AfterTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var Scenario - */ - private $scenario; - /** - * @var TestResult - */ - private $result; - /** - * @var Teardown - */ - private $teardown; - - /** - * Initializes event - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - * @param TestResult $result - * @param Teardown $teardown - */ - public function __construct( - Environment $env, - FeatureNode $feature, - Scenario $scenario, - TestResult $result, - Teardown $teardown - ) { - parent::__construct($env); - - $this->feature = $feature; - $this->scenario = $scenario; - $this->result = $result; - $this->teardown = $teardown; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario node. - * - * @return ScenarioNode - */ - public function getScenario() - { - return $this->scenario; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } - - /** - * Returns current test teardown. - * - * @return Teardown - */ - public function getTeardown() - { - return $this->teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php deleted file mode 100644 index a2256f0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterStepSetup.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterSetup; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents an event after step setup. - * - * @author Konstantin Kudryashov - */ -final class AfterStepSetup extends StepTested implements AfterSetup -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var StepNode - */ - private $step; - /** - * @var Setup - */ - private $setup; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * @param Setup $setup - */ - public function __construct(Environment $env, FeatureNode $feature, StepNode $step, Setup $setup) - { - parent::__construct($env); - - $this->feature = $feature; - $this->step = $step; - $this->setup = $setup; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns step node. - * - * @return StepNode - */ - public function getStep() - { - return $this->step; - } - - /** - * Returns current test setup. - * - * @return Setup - */ - public function getSetup() - { - return $this->setup; - } - - /** - * Checks if step call, setup or teardown produced any output (stdOut or exception). - * - * @return bool - */ - public function hasOutput() - { - return $this->setup->hasOutput(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php deleted file mode 100644 index d5829b7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/AfterStepTested.php +++ /dev/null @@ -1,154 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Behat\Tester\Result\ExecutedStepResult; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterTested; -use Behat\Testwork\Tester\Result\ExceptionResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents an event after step has been tested. - * - * @author Konstantin Kudryashov - */ -final class AfterStepTested extends StepTested implements AfterTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var StepNode - */ - private $step; - /** - * @var StepResult - */ - private $result; - /** - * @var Teardown - */ - private $teardown; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * @param StepResult $result - * @param Teardown $teardown - */ - public function __construct( - Environment $env, - FeatureNode $feature, - StepNode $step, - StepResult $result, - Teardown $teardown - ) { - parent::__construct($env); - - $this->feature = $feature; - $this->step = $step; - $this->result = $result; - $this->teardown = $teardown; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns step node. - * - * @return StepNode - */ - public function getStep() - { - return $this->step; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } - - /** - * Returns current test teardown. - * - * @return Teardown - */ - public function getTeardown() - { - return $this->teardown; - } - - /** - * Checks if step call, setup or teardown produced any output (stdOut or exception). - * - * @return bool - */ - public function hasOutput() - { - return $this->teardownHasOutput() || $this->resultHasException() || $this->resultCallHasOutput(); - } - - /** - * Checks if step teardown has output. - * - * @return bool - */ - private function teardownHasOutput() - { - return $this->teardown->hasOutput(); - } - - /** - * Checks if result has produced exception. - * - * @return bool - */ - private function resultHasException() - { - return $this->result instanceof ExceptionResult && $this->result->getException(); - } - - /** - * Checks if result is executed and call result has produced exception or stdOut. - * - * @return bool - */ - private function resultCallHasOutput() - { - if (!$this->result instanceof ExecutedStepResult) { - return false; - } - - return $this->result->getCallResult()->hasStdOut() || $this->result->getCallResult()->hasException(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BackgroundTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BackgroundTested.php deleted file mode 100644 index dd43ae0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BackgroundTested.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\BackgroundNode; -use Behat\Gherkin\Node\NodeInterface; -use Behat\Testwork\EventDispatcher\Event\LifecycleEvent; - -/** - * Represents a background event. - * - * @author Konstantin Kudryashov - */ -abstract class BackgroundTested extends LifecycleEvent implements ScenarioLikeTested -{ - public const BEFORE = 'tester.background_tested.before'; - public const AFTER_SETUP = 'tester.background_tested.after_setup'; - public const BEFORE_TEARDOWN = 'tester.background_tested.before_teardown'; - public const AFTER = 'tester.background_tested.after'; - - /** - * Returns background node. - * - * @return BackgroundNode - */ - abstract public function getBackground(); - - /** - * Returns node. - * - * @return NodeInterface - */ - final public function getNode() - { - return $this->getBackground(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeBackgroundTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeBackgroundTeardown.php deleted file mode 100644 index b416717..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeBackgroundTeardown.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\BackgroundNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTeardown; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an event right before background teardown. - * - * @author Konstantin Kudryashov - */ -final class BeforeBackgroundTeardown extends BackgroundTested implements BeforeTeardown -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var BackgroundNode - */ - private $background; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param BackgroundNode $background - * @param TestResult $result - */ - public function __construct( - Environment $env, - FeatureNode $feature, - BackgroundNode $background, - TestResult $result - ) { - parent::__construct($env); - - $this->feature = $feature; - $this->background = $background; - $this->result = $result; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario node. - * - * @return ScenarioInterface - */ - public function getScenario() - { - return $this->background; - } - - /** - * Returns background node. - * - * @return BackgroundNode - */ - public function getBackground() - { - return $this->background; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeBackgroundTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeBackgroundTested.php deleted file mode 100644 index d88a6f9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeBackgroundTested.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\BackgroundNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTested; - -/** - * Represents a BeforeBackgroundTested event. - * - * @author Konstantin Kudryashov - */ -final class BeforeBackgroundTested extends BackgroundTested implements BeforeTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var BackgroundNode - */ - private $background; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param BackgroundNode $background - */ - public function __construct(Environment $env, FeatureNode $feature, BackgroundNode $background) - { - parent::__construct($env); - - $this->feature = $feature; - $this->background = $background; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario node. - * - * @return ScenarioInterface - */ - public function getScenario() - { - return $this->background; - } - - /** - * Returns background node. - * - * @return BackgroundNode - */ - public function getBackground() - { - return $this->background; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeFeatureTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeFeatureTeardown.php deleted file mode 100644 index 82c9c7b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeFeatureTeardown.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTeardown; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an event right before feature is teardown. - * - * @author Konstantin Kudryashov - */ -final class BeforeFeatureTeardown extends FeatureTested implements BeforeTeardown -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param TestResult $result - */ - public function __construct(Environment $env, FeatureNode $feature, TestResult $result) - { - parent::__construct($env); - - $this->feature = $feature; - $this->result = $result; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeFeatureTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeFeatureTested.php deleted file mode 100644 index 1f2f4ea..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeFeatureTested.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTested; - -/** - * Represents an event before feature tested. - * - * @author Konstantin Kudryashov - */ -final class BeforeFeatureTested extends FeatureTested implements BeforeTested -{ - /** - * @var FeatureNode - */ - private $feature; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - */ - public function __construct(Environment $env, FeatureNode $feature) - { - parent::__construct($env); - - $this->feature = $feature; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeOutlineTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeOutlineTeardown.php deleted file mode 100644 index 7980267..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeOutlineTeardown.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTeardown; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an event right before outline teardown. - * - * @author Konstantin Kudryashov - */ -final class BeforeOutlineTeardown extends OutlineTested implements BeforeTeardown -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var OutlineNode - */ - private $outline; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param OutlineNode $outline - * @param TestResult $result - */ - public function __construct( - Environment $env, - FeatureNode $feature, - OutlineNode $outline, - TestResult $result - ) { - parent::__construct($env); - - $this->feature = $feature; - $this->outline = $outline; - $this->result = $result; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns outline node. - * - * @return OutlineNode - */ - public function getOutline() - { - return $this->outline; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeOutlineTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeOutlineTested.php deleted file mode 100644 index 25aa4fd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeOutlineTested.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTested; - -/** - * Represents an event before outline is tested. - * - * @author Konstantin Kudryashov - */ -final class BeforeOutlineTested extends OutlineTested implements BeforeTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var OutlineNode - */ - private $outline; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param OutlineNode $outline - */ - public function __construct(Environment $env, FeatureNode $feature, OutlineNode $outline) - { - parent::__construct($env); - - $this->feature = $feature; - $this->outline = $outline; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns outline node. - * - * @return OutlineNode - */ - public function getOutline() - { - return $this->outline; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeScenarioTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeScenarioTeardown.php deleted file mode 100644 index da413b4..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeScenarioTeardown.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\ScenarioNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTeardown; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an event before scenario teardown. - * - * @author Konstantin Kudryashov - */ -final class BeforeScenarioTeardown extends ScenarioTested implements BeforeTeardown -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var Scenario - */ - private $scenario; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes event - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - * @param TestResult $result - */ - public function __construct( - Environment $env, - FeatureNode $feature, - Scenario $scenario, - TestResult $result - ) { - parent::__construct($env); - - $this->feature = $feature; - $this->scenario = $scenario; - $this->result = $result; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario node. - * - * @return ScenarioNode - */ - public function getScenario() - { - return $this->scenario; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeScenarioTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeScenarioTested.php deleted file mode 100644 index d2737b8..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeScenarioTested.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\ScenarioNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTested; - -/** - * Represents an event before scenario is tested. - * - * @author Konstantin Kudryashov - */ -final class BeforeScenarioTested extends ScenarioTested implements BeforeTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var Scenario - */ - private $scenario; - - /** - * Initializes event - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - */ - public function __construct(Environment $env, FeatureNode $feature, Scenario $scenario) - { - parent::__construct($env); - - $this->feature = $feature; - $this->scenario = $scenario; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario node. - * - * @return ScenarioNode - */ - public function getScenario() - { - return $this->scenario; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php deleted file mode 100644 index 89f626f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeStepTeardown.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Behat\Tester\Result\ExecutedStepResult; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTeardown; -use Behat\Testwork\Tester\Result\ExceptionResult; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an event before step teardown. - * - * @author Konstantin Kudryashov - */ -final class BeforeStepTeardown extends StepTested implements BeforeTeardown -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var StepNode - */ - private $step; - /** - * @var StepResult - */ - private $result; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * @param StepResult $result - */ - public function __construct( - Environment $env, - FeatureNode $feature, - StepNode $step, - StepResult $result - ) { - parent::__construct($env); - - $this->feature = $feature; - $this->step = $step; - $this->result = $result; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns step node. - * - * @return StepNode - */ - public function getStep() - { - return $this->step; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } - - /** - * Checks if step call produced any output (stdOut or exception). - * - * @return bool - */ - public function hasOutput() - { - return $this->resultHasException() || $this->resultCallHasOutput(); - } - - /** - * Checks if result has produced exception. - * - * @return bool - */ - private function resultHasException() - { - return $this->result instanceof ExceptionResult && $this->result->getException(); - } - - /** - * Checks if result is executed and call result has produced exception or stdOut. - * - * @return bool - */ - private function resultCallHasOutput() - { - if (!$this->result instanceof ExecutedStepResult) { - return false; - } - - return $this->result->getCallResult()->hasStdOut() || $this->result->getCallResult()->hasException(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeStepTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeStepTested.php deleted file mode 100644 index 22b1e09..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/BeforeStepTested.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\BeforeTested; - -/** - * Represents an event before step test. - * - * @author Konstantin Kudryashov - */ -final class BeforeStepTested extends StepTested implements BeforeTested -{ - /** - * @var FeatureNode - */ - private $feature; - /** - * @var StepNode - */ - private $step; - - /** - * Initializes event. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - */ - public function __construct(Environment $env, FeatureNode $feature, StepNode $step) - { - parent::__construct($env); - - $this->feature = $feature; - $this->step = $step; - } - - /** - * Returns feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns step node. - * - * @return StepNode - */ - public function getStep() - { - return $this->step; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ExampleTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ExampleTested.php deleted file mode 100644 index 9a10767..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ExampleTested.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -/** - * Represents an example event. - * - * @author Konstantin Kudryashov - */ -interface ExampleTested -{ - public const BEFORE = 'tester.example_tested.before'; - public const AFTER_SETUP = 'tester.example_tested.after_setup'; - public const BEFORE_TEARDOWN = 'tester.example_tested.before_teardown'; - public const AFTER = 'tester.example_tested.after'; -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/FeatureTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/FeatureTested.php deleted file mode 100644 index a75d81f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/FeatureTested.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\NodeInterface; -use Behat\Testwork\EventDispatcher\Event\LifecycleEvent; - -/** - * Represents a feature event. - * - * @author Konstantin Kudryashov - */ -abstract class FeatureTested extends LifecycleEvent implements GherkinNodeTested -{ - public const BEFORE = 'tester.feature_tested.before'; - public const AFTER_SETUP = 'tester.feature_tested.after_setup'; - public const BEFORE_TEARDOWN = 'tester.feature_tested.before_teardown'; - public const AFTER = 'tester.feature_tested.after'; - - /** - * Returns feature. - * - * @return FeatureNode - */ - abstract public function getFeature(); - - /** - * Returns node. - * - * @return NodeInterface - */ - final public function getNode() - { - return $this->getFeature(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/GherkinNodeTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/GherkinNodeTested.php deleted file mode 100644 index 3d1fe07..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/GherkinNodeTested.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\NodeInterface; - -/** - * Represents a Gherkin node based event. - * - * @author Konstantin Kudryashov - */ -interface GherkinNodeTested -{ - /** - * Returns node. - * - * @return NodeInterface - */ - public function getNode(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/OutlineTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/OutlineTested.php deleted file mode 100644 index 557e429..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/OutlineTested.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\NodeInterface; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\EventDispatcher\Event\LifecycleEvent; - -/** - * Represents an outline event. - * - * @author Konstantin Kudryashov - */ -abstract class OutlineTested extends LifecycleEvent implements GherkinNodeTested -{ - public const BEFORE = 'tester.outline_tested.before'; - public const AFTER_SETUP = 'tester.outline_tested.after_setup'; - public const BEFORE_TEARDOWN = 'tester.outline_tested.before_teardown'; - public const AFTER = 'tester.outline_tested.after'; - - /** - * Returns feature. - * - * @return FeatureNode - */ - abstract public function getFeature(); - - /** - * Returns outline node. - * - * @return OutlineNode - */ - abstract public function getOutline(); - - /** - * Returns node. - * - * @return NodeInterface - */ - final public function getNode() - { - return $this->getOutline(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ScenarioLikeTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ScenarioLikeTested.php deleted file mode 100644 index bd74185..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ScenarioLikeTested.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Represents an event of scenario-like structure (Scenario, Background, Example). - * - * @author Konstantin Kudryashov - */ -interface ScenarioLikeTested extends GherkinNodeTested -{ - /** - * Returns feature node. - * - * @return FeatureNode - */ - public function getFeature(); - - /** - * Returns scenario node. - * - * @return ScenarioInterface - */ - public function getScenario(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ScenarioTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ScenarioTested.php deleted file mode 100644 index 6a27ae5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/ScenarioTested.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Testwork\EventDispatcher\Event\LifecycleEvent; - -/** - * Represents a scenario event. - * - * @author Konstantin Kudryashov - */ -abstract class ScenarioTested extends LifecycleEvent implements ScenarioLikeTested -{ - public const BEFORE = 'tester.scenario_tested.before'; - public const AFTER_SETUP = 'tester.scenario_tested.after_setup'; - public const BEFORE_TEARDOWN = 'tester.scenario_tested.before_teardown'; - public const AFTER = 'tester.scenario_tested.after'; - - /** - * {@inheritdoc} - */ - final public function getNode() - { - return $this->getScenario(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/StepTested.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/StepTested.php deleted file mode 100644 index 9df91fb..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Event/StepTested.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Event; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\EventDispatcher\Event\LifecycleEvent; - -/** - * Represents a step event. - * - * @author Konstantin Kudryashov - */ -abstract class StepTested extends LifecycleEvent implements GherkinNodeTested -{ - public const BEFORE = 'tester.step_tested.before'; - public const AFTER_SETUP = 'tester.step_tested.after_setup'; - public const BEFORE_TEARDOWN = 'tester.step_tested.before_teardown'; - public const AFTER = 'tester.step_tested.after'; - - /** - * Returns feature. - * - * @return FeatureNode - */ - abstract public function getFeature(); - - /** - * Returns step node. - * - * @return StepNode - */ - abstract public function getStep(); - - /** - * {@inheritdoc} - */ - final public function getNode() - { - return $this->getStep(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/ServiceContainer/EventDispatcherExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/ServiceContainer/EventDispatcherExtension.php deleted file mode 100644 index 0aa0695..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/ServiceContainer/EventDispatcherExtension.php +++ /dev/null @@ -1,173 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\ServiceContainer; - -use Behat\Behat\EventDispatcher\Event\ExampleTested; -use Behat\Behat\EventDispatcher\Event\ScenarioTested; -use Behat\Behat\Tester\ServiceContainer\TesterExtension; -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension as BaseExtension; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Extends Testwork EventDispatcherExtension with additional event-dispatching testers. - * - * @author Konstantin Kudryashov - */ -class EventDispatcherExtension extends BaseExtension -{ - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - parent::load($container, $config); - - $this->loadStopOnFailureController($container); - $this->loadEventDispatchingBackgroundTester($container); - $this->loadEventDispatchingFeatureTester($container); - $this->loadEventDispatchingOutlineTester($container); - $this->loadEventDispatchingScenarioTester($container); - $this->loadEventDispatchingExampleTester($container); - $this->loadEventDispatchingStepTester($container); - $this->loadTickingStepTester($container); - } - - /** - * Loads stop on failure controller. - * - * @param ContainerBuilder $container - */ - protected function loadStopOnFailureController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\EventDispatcher\Cli\StopOnFailureController', array( - new Reference(EventDispatcherExtension::DISPATCHER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 100)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.stop_on_failure', $definition); - } - - /** - * Loads event-dispatching background tester. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingBackgroundTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\EventDispatcher\Tester\EventDispatchingBackgroundTester', array( - new Reference(TesterExtension::BACKGROUND_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::BACKGROUND_TESTER_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::BACKGROUND_TESTER_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Loads event-dispatching feature tester. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingFeatureTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\EventDispatcher\Tester\EventDispatchingFeatureTester', array( - new Reference(TesterExtension::SPECIFICATION_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Loads event-dispatching outline tester. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingOutlineTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\EventDispatcher\Tester\EventDispatchingOutlineTester', array( - new Reference(TesterExtension::OUTLINE_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::OUTLINE_TESTER_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::OUTLINE_TESTER_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Loads event-dispatching scenario tester. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingScenarioTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester', array( - new Reference(TesterExtension::SCENARIO_TESTER_ID), - new Reference(self::DISPATCHER_ID), - ScenarioTested::BEFORE, - ScenarioTested::AFTER_SETUP, - ScenarioTested::BEFORE_TEARDOWN, - ScenarioTested::AFTER - )); - $definition->addTag(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Loads event-dispatching example tester. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingExampleTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\EventDispatcher\Tester\EventDispatchingScenarioTester', array( - new Reference(TesterExtension::EXAMPLE_TESTER_ID), - new Reference(self::DISPATCHER_ID), - ExampleTested::BEFORE, - ExampleTested::AFTER_SETUP, - ExampleTested::BEFORE_TEARDOWN, - ExampleTested::AFTER - )); - $definition->addTag(TesterExtension::EXAMPLE_TESTER_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::EXAMPLE_TESTER_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Loads event-dispatching step tester. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingStepTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\EventDispatcher\Tester\EventDispatchingStepTester', array( - new Reference(TesterExtension::STEP_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::STEP_TESTER_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::STEP_TESTER_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * This method used in the past to load the TickingStepTester to work around - * a bug with the scope of declare(ticks) in PHP < 7.1. Since we don't - * support those PHP versions anymore loading the TickingStepTester is - * no longer needed. This method is left here to prevent breaking BC. - * - * @todo Remove this method in next major - * - * @deprecated - * - * @param ContainerBuilder $container - */ - protected function loadTickingStepTester(ContainerBuilder $container) - { - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php deleted file mode 100644 index cb5d32d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingBackgroundTester.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Tester; - -use Behat\Behat\EventDispatcher\Event\AfterBackgroundSetup; -use Behat\Behat\EventDispatcher\Event\AfterBackgroundTested; -use Behat\Behat\EventDispatcher\Event\BackgroundTested; -use Behat\Behat\EventDispatcher\Event\BeforeBackgroundTeardown; -use Behat\Behat\EventDispatcher\Event\BeforeBackgroundTested; -use Behat\Behat\Tester\BackgroundTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Behat\Testwork\Tester\Result\TestResult; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Background tester dispatching BEFORE/AFTER events. - * - * @author Konstantin Kudryashov - */ -final class EventDispatchingBackgroundTester implements BackgroundTester -{ - /** - * @var BackgroundTester - */ - private $baseTester; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * Initializes tester. - * - * @param BackgroundTester $baseTester - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(BackgroundTester $baseTester, EventDispatcherInterface $eventDispatcher) - { - $this->baseTester = $baseTester; - $this->eventDispatcher = $eventDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, $skip) - { - $event = new BeforeBackgroundTested($env, $feature, $feature->getBackground()); - - $this->eventDispatcher->dispatch($event, $event::BEFORE); - - $setup = $this->baseTester->setUp($env, $feature, $skip); - - $event = new AfterBackgroundSetup($env, $feature, $feature->getBackground(), $setup); - - $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP); - - return $setup; - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, $skip) - { - return $this->baseTester->test($env, $feature, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResult $result) - { - $event = new BeforeBackgroundTeardown($env, $feature, $feature->getBackground(), $result); - - $this->eventDispatcher->dispatch($event, BackgroundTested::BEFORE_TEARDOWN); - - $teardown = $this->baseTester->tearDown($env, $feature, $skip, $result); - - $event = new AfterBackgroundTested($env, $feature, $feature->getBackground(), $result, $teardown); - - $this->eventDispatcher->dispatch($event, BackgroundTested::AFTER); - - return $teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php deleted file mode 100644 index a0ce588..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingFeatureTester.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Tester; - -use Behat\Behat\EventDispatcher\Event\AfterFeatureSetup; -use Behat\Behat\EventDispatcher\Event\AfterFeatureTested; -use Behat\Behat\EventDispatcher\Event\BeforeFeatureTeardown; -use Behat\Behat\EventDispatcher\Event\BeforeFeatureTested; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\SpecificationTester; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Feature tester dispatching BEFORE/AFTER events during tests. - * - * @author Konstantin Kudryashov - */ -final class EventDispatchingFeatureTester implements SpecificationTester -{ - /** - * @var SpecificationTester - */ - private $baseTester; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * Initializes tester. - * - * @param SpecificationTester $baseTester - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(SpecificationTester $baseTester, EventDispatcherInterface $eventDispatcher) - { - $this->baseTester = $baseTester; - $this->eventDispatcher = $eventDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, $feature, $skip) - { - $event = new BeforeFeatureTested($env, $feature); - - $this->eventDispatcher->dispatch($event, $event::BEFORE); - - $setup = $this->baseTester->setUp($env, $feature, $skip); - - $event = new AfterFeatureSetup($env, $feature, $setup); - - $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP); - - return $setup; - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, $feature, $skip) - { - return $this->baseTester->test($env, $feature, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, $feature, $skip, TestResult $result) - { - $event = new BeforeFeatureTeardown($env, $feature, $result); - - $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN); - - $teardown = $this->baseTester->tearDown($env, $feature, $skip, $result); - - $event = new AfterFeatureTested($env, $feature, $result, $teardown); - - $this->eventDispatcher->dispatch($event, $event::AFTER); - - return $teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php deleted file mode 100644 index 132f584..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingOutlineTester.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Tester; - -use Behat\Behat\EventDispatcher\Event\AfterOutlineSetup; -use Behat\Behat\EventDispatcher\Event\AfterOutlineTested; -use Behat\Behat\EventDispatcher\Event\BeforeOutlineTeardown; -use Behat\Behat\EventDispatcher\Event\BeforeOutlineTested; -use Behat\Behat\Tester\OutlineTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Behat\Testwork\Tester\Result\TestResult; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Outline tester dispatching BEFORE/AFTER events during tests. - * - * @author Konstantin Kudryashov - */ -final class EventDispatchingOutlineTester implements OutlineTester -{ - /** - * @var OutlineTester - */ - private $baseTester; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * Initializes tester. - * - * @param OutlineTester $baseTester - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(OutlineTester $baseTester, EventDispatcherInterface $eventDispatcher) - { - $this->baseTester = $baseTester; - $this->eventDispatcher = $eventDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip) - { - $event = new BeforeOutlineTested($env, $feature, $outline); - - $this->eventDispatcher->dispatch($event, $event::BEFORE); - - $setup = $this->baseTester->setUp($env, $feature, $outline, $skip); - - $event = new AfterOutlineSetup($env, $feature, $outline, $setup); - - $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP); - - return $setup; - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip) - { - return $this->baseTester->test($env, $feature, $outline, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip, TestResult $result) - { - $event = new BeforeOutlineTeardown($env, $feature, $outline, $result); - - $this->eventDispatcher->dispatch( $event,$event::BEFORE_TEARDOWN); - - $teardown = $this->baseTester->tearDown($env, $feature, $outline, $skip, $result); - - $event = new AfterOutlineTested($env, $feature, $outline, $result, $teardown); - - $this->eventDispatcher->dispatch($event, $event::AFTER); - - return $teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php deleted file mode 100644 index 882be52..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingScenarioTester.php +++ /dev/null @@ -1,126 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Tester; - -use Behat\Behat\EventDispatcher\Event\AfterScenarioSetup; -use Behat\Behat\EventDispatcher\Event\AfterScenarioTested; -use Behat\Behat\EventDispatcher\Event\BeforeScenarioTeardown; -use Behat\Behat\EventDispatcher\Event\BeforeScenarioTested; -use Behat\Behat\Tester\ScenarioTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface as Scenario; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Behat\Testwork\Tester\Result\TestResult; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Scenario tester dispatching BEFORE/AFTER events during tests. - * - * @author Konstantin Kudryashov - */ -final class EventDispatchingScenarioTester implements ScenarioTester -{ - /** - * @var ScenarioTester - */ - private $baseTester; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - /** - * @var string - */ - private $beforeEventName; - /** - * @var string - */ - private $afterSetupEventName; - /** - * @var string - */ - private $beforeTeardownEventName; - /** - * @var string - */ - private $afterEventName; - - /** - * Initializes tester. - * - * @param ScenarioTester $baseTester - * @param EventDispatcherInterface $eventDispatcher - * @param string $beforeEventName - * @param string $afterSetupEventName - * @param string $beforeTeardownEventName - * @param string $afterEventName - */ - public function __construct( - ScenarioTester $baseTester, - EventDispatcherInterface $eventDispatcher, - $beforeEventName, - $afterSetupEventName, - $beforeTeardownEventName, - $afterEventName - ) { - $this->baseTester = $baseTester; - $this->eventDispatcher = $eventDispatcher; - $this->beforeEventName = $beforeEventName; - $this->afterSetupEventName = $afterSetupEventName; - $this->beforeTeardownEventName = $beforeTeardownEventName; - $this->afterEventName = $afterEventName; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario, $skip) - { - $event = new BeforeScenarioTested($env, $feature, $scenario); - - $this->eventDispatcher->dispatch($event, $this->beforeEventName); - - $setup = $this->baseTester->setUp($env, $feature, $scenario, $skip); - - $event = new AfterScenarioSetup($env, $feature, $scenario, $setup); - - $this->eventDispatcher->dispatch($event, $this->afterSetupEventName); - - return $setup; - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, Scenario $scenario, $skip) - { - return $this->baseTester->test($env, $feature, $scenario, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result) - { - $event = new BeforeScenarioTeardown($env, $feature, $scenario, $result); - - $this->eventDispatcher->dispatch($event, $this->beforeTeardownEventName); - - $teardown = $this->baseTester->tearDown($env, $feature, $scenario, $skip, $result); - - $event = new AfterScenarioTested($env, $feature, $scenario, $result, $teardown); - - $this->eventDispatcher->dispatch($event, $this->afterEventName); - - return $teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php deleted file mode 100644 index 1daafad..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/EventDispatchingStepTester.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Tester; - -use Behat\Behat\EventDispatcher\Event\AfterStepSetup; -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\EventDispatcher\Event\BeforeStepTeardown; -use Behat\Behat\EventDispatcher\Event\BeforeStepTested; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Behat\Tester\StepTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Step tester dispatching BEFORE/AFTER events during tests. - * - * @author Konstantin Kudryashov - */ -final class EventDispatchingStepTester implements StepTester -{ - /** - * @var StepTester - */ - private $baseTester; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * Initializes tester. - * - * @param StepTester $baseTester - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(StepTester $baseTester, EventDispatcherInterface $eventDispatcher) - { - $this->baseTester = $baseTester; - $this->eventDispatcher = $eventDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip) - { - $event = new BeforeStepTested($env, $feature, $step); - - $this->eventDispatcher->dispatch($event, $event::BEFORE); - - $setup = $this->baseTester->setUp($env, $feature, $step, $skip); - - $event = new AfterStepSetup($env, $feature, $step, $setup); - - $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP); - - return $setup; - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, StepNode $step, $skip) - { - return $this->baseTester->test($env, $feature, $step, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result) - { - $event = new BeforeStepTeardown($env, $feature, $step, $result); - - $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN); - - $teardown = $this->baseTester->tearDown($env, $feature, $step, $skip, $result); - - $event = new AfterStepTested($env, $feature, $step, $result, $teardown); - - $this->eventDispatcher->dispatch($event, $event::AFTER); - - return $teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/TickingStepTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/TickingStepTester.php deleted file mode 100644 index dcbdf4c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/EventDispatcher/Tester/TickingStepTester.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\EventDispatcher\Tester; - -use Behat\Behat\Tester\Result\StepResult; -use Behat\Behat\Tester\StepTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; - -/** - * Enable ticks during step testing to allow SigintController in Testwork - * to handle an interupt (on PHP7) - * - * @see Behat\Testwork\EventDispatcher\Cli\SigintController - * - * @deprecated Since the way signals are handled changed to use pcntl_signal_dispatch - * this class is no longer needed. - * - * @todo Remove this class in the next major version - * - * @author Peter Mitchell - */ -final class TickingStepTester implements StepTester -{ - /** - * @var StepTester - */ - private $baseTester; - - /** - * Initializes tester. - * - * @param StepTester $baseTester - */ - public function __construct(StepTester $baseTester) - { - $this->baseTester = $baseTester; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip) - { - return $this->baseTester->setUp($env, $feature, $step, $skip); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, StepNode $step, $skip) - { - declare(ticks = 1); - - return $this->baseTester->test($env, $feature, $step, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result) - { - return $this->baseTester->tearDown($env, $feature, $step, $skip, $result); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Cli/FilterController.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Cli/FilterController.php deleted file mode 100644 index 7f13989..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Cli/FilterController.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Gherkin\Cli; - -use Behat\Gherkin\Filter\NameFilter; -use Behat\Gherkin\Filter\RoleFilter; -use Behat\Gherkin\Filter\TagFilter; -use Behat\Gherkin\Gherkin; -use Behat\Testwork\Cli\Controller; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Configures default Gherkin filters. - * - * @author Konstantin Kudryashov - */ -final class FilterController implements Controller -{ - /** - * @var Gherkin - */ - private $gherkin; - - /** - * Initializes controller. - * - * @param Gherkin $gherkin - */ - public function __construct(Gherkin $gherkin) - { - $this->gherkin = $gherkin; - } - - /** - * Configures command to be executable by the controller. - * - * @param Command $command - */ - public function configure(Command $command) - { - $command - ->addOption( - '--name', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, - "Only executeCall the feature elements which match part" . PHP_EOL . - "of the given name or regex." - ) - ->addOption( - '--tags', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, - "Only executeCall the features or scenarios with tags" . PHP_EOL . - "matching tag filter expression." - ) - ->addOption( - '--role', null, InputOption::VALUE_REQUIRED, - "Only executeCall the features with actor role matching" . PHP_EOL . - "a wildcard." - ); - } - - /** - * Executes controller. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return null|integer - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $filters = array(); - - foreach ($input->getOption('name') as $name) { - $filters[] = new NameFilter($name); - } - - foreach ($input->getOption('tags') as $tags) { - $filters[] = new TagFilter($tags); - } - - if ($role = $input->getOption('role')) { - $filters[] = new RoleFilter($role); - } - - if (count($filters)) { - $this->gherkin->setFilters($filters); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Cli/SyntaxController.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Cli/SyntaxController.php deleted file mode 100644 index 62acc12..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Cli/SyntaxController.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Gherkin\Cli; - -use Behat\Behat\Definition\Translator\TranslatorInterface; -use Behat\Gherkin\Keywords\KeywordsDumper; -use Behat\Testwork\Cli\Controller; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Prints example of the feature to present all available syntax keywords. - * - * @author Konstantin Kudryashov - */ -final class SyntaxController implements Controller -{ - /** - * @var KeywordsDumper - */ - private $keywordsDumper; - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * Initializes controller. - * - * @param KeywordsDumper $dumper - * @param TranslatorInterface $translator - */ - public function __construct(KeywordsDumper $dumper, TranslatorInterface $translator) - { - $dumper->setKeywordsDumperFunction(array($this, 'dumpKeywords')); - $this->keywordsDumper = $dumper; - $this->translator = $translator; - } - - /** - * Configures command to be executable by the controller. - * - * @param Command $command - */ - public function configure(Command $command) - { - $command - ->addOption( - '--story-syntax', null, InputOption::VALUE_NONE, - "Print *.feature example." . PHP_EOL . - "Use --lang to see specific language." - ); - } - - /** - * Executes controller. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return null|integer - */ - public function execute(InputInterface $input, OutputInterface $output) - { - if (!$input->getOption('story-syntax')) { - return null; - } - - $output->getFormatter()->setStyle('gherkin_keyword', new OutputFormatterStyle('green', null, array('bold'))); - $output->getFormatter()->setStyle('gherkin_comment', new OutputFormatterStyle('yellow')); - - $story = $this->keywordsDumper->dump($this->translator->getLocale()); - $story = preg_replace('/^\#.*/', '$0', $story); - $output->writeln($story); - $output->writeln(''); - - return 0; - } - - /** - * Keywords dumper. - * - * @param array $keywords keywords list - * - * @return string - */ - public function dumpKeywords(array $keywords) - { - $dump = '' . implode('|', $keywords) . ''; - - if (1 < count($keywords)) { - return '[' . $dump . ']'; - } - - return $dump; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php deleted file mode 100644 index 60aef8e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/ServiceContainer/GherkinExtension.php +++ /dev/null @@ -1,384 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Gherkin\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\Filesystem\ServiceContainer\FilesystemExtension; -use Behat\Testwork\ServiceContainer\Exception\ExtensionException; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Specification\ServiceContainer\SpecificationExtension; -use Behat\Testwork\Suite\ServiceContainer\SuiteExtension; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; -use ReflectionClass; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Extends Behat with gherkin suites and features. - * - * @author Konstantin Kudryashov - */ -final class GherkinExtension implements Extension -{ - /* - * Available services - */ - public const MANAGER_ID = 'gherkin'; - public const KEYWORDS_DUMPER_ID = 'gherkin.keywords_dumper'; - public const KEYWORDS_ID = 'gherkin.keywords'; - - /* - * Available extension points - */ - public const LOADER_TAG = 'gherkin.loader'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'gherkin'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - $builder - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('cache') - ->info('Sets the gherkin parser cache folder') - ->defaultValue( - is_writable(sys_get_temp_dir()) - ? sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat_gherkin_cache' - : null - ) - ->end() - ->arrayNode('filters') - ->info('Sets the gherkin filters (overridable by CLI options)') - ->performNoDeepMerging() - ->defaultValue(array()) - ->useAttributeAsKey('name') - ->prototype('scalar')->end() - ->end() - ->end() - ; - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadParameters($container); - $this->loadGherkin($container); - $this->loadKeywords($container); - $this->loadParser($container); - $this->loadDefaultLoaders($container, $config['cache']); - $this->loadProfileFilters($container, $config['filters']); - $this->loadSyntaxController($container); - $this->loadFilterController($container); - $this->loadSuiteWithPathsSetup($container); - $this->loadFilesystemFeatureLocator($container); - $this->loadFilesystemScenariosListLocator($container); - $this->loadFilesystemRerunScenariosListLocator($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processLoaders($container); - } - - /** - * Loads default container parameters. - * - * @param ContainerBuilder $container - */ - private function loadParameters(ContainerBuilder $container) - { - $container->setParameter('gherkin.paths.lib', $this->getLibPath()); - $container->setParameter('gherkin.paths.i18n', '%gherkin.paths.lib%/i18n.php'); - $container->setParameter( - 'suite.generic.default_settings', - array( - 'paths' => array('%paths.base%/features'), - 'contexts' => array('FeatureContext') - ) - ); - } - - /** - * Returns gherkin library path. - * - * @return string - */ - private function getLibPath() - { - $reflection = new ReflectionClass('Behat\Gherkin\Gherkin'); - $libPath = rtrim(dirname($reflection->getFilename()) . '/../../../', DIRECTORY_SEPARATOR); - - return $libPath; - } - - /** - * Loads gherkin service. - * - * @param ContainerBuilder $container - */ - private function loadGherkin(ContainerBuilder $container) - { - $definition = new Definition('Behat\Gherkin\Gherkin'); - $container->setDefinition(self::MANAGER_ID, $definition); - } - - /** - * Loads keyword services. - * - * @param ContainerBuilder $container - */ - private function loadKeywords(ContainerBuilder $container) - { - $definition = new Definition('Behat\Gherkin\Keywords\CachedArrayKeywords', array( - '%gherkin.paths.i18n%' - )); - $container->setDefinition(self::KEYWORDS_ID, $definition); - - $definition = new Definition('Behat\Gherkin\Keywords\KeywordsDumper', array( - new Reference(self::KEYWORDS_ID) - )); - $container->setDefinition(self::KEYWORDS_DUMPER_ID, $definition); - } - - /** - * Loads gherkin parser. - * - * @param ContainerBuilder $container - */ - private function loadParser(ContainerBuilder $container) - { - $definition = new Definition('Behat\Gherkin\Parser', array( - new Reference('gherkin.lexer') - )); - $container->setDefinition('gherkin.parser', $definition); - - $definition = new Definition('Behat\Gherkin\Lexer', array( - new Reference('gherkin.keywords') - )); - $container->setDefinition('gherkin.lexer', $definition); - } - - /** - * Loads gherkin loaders. - * - * @param ContainerBuilder $container - * @param string $cachePath - */ - private function loadDefaultLoaders(ContainerBuilder $container, $cachePath) - { - $definition = new Definition('Behat\Gherkin\Loader\GherkinFileLoader', array( - new Reference('gherkin.parser') - )); - - if ($cachePath) { - $cacheDefinition = new Definition('Behat\Gherkin\Cache\FileCache', array($cachePath)); - } else { - $cacheDefinition = new Definition('Behat\Gherkin\Cache\MemoryCache'); - } - - $definition->addMethodCall('setCache', array($cacheDefinition)); - $definition->addMethodCall('setBasePath', array('%paths.base%')); - $definition->addTag(self::LOADER_TAG, array('priority' => 50)); - $container->setDefinition('gherkin.loader.gherkin_file', $definition); - } - - /** - * Loads profile-level gherkin filters. - * - * @param ContainerBuilder $container - * @param array $filters - */ - private function loadProfileFilters(ContainerBuilder $container, array $filters) - { - $gherkin = $container->getDefinition(self::MANAGER_ID); - foreach ($filters as $type => $filterString) { - $filter = $this->createFilterDefinition($type, $filterString); - $gherkin->addMethodCall('addFilter', array($filter)); - } - } - - /** - * Loads syntax controller. - * - * @param ContainerBuilder $container - */ - private function loadSyntaxController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Gherkin\Cli\SyntaxController', array( - new Reference(self::KEYWORDS_DUMPER_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 600)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.gherkin_syntax', $definition); - } - - /** - * Loads filter controller. - * - * @param ContainerBuilder $container - */ - private function loadFilterController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Gherkin\Cli\FilterController', array( - new Reference(self::MANAGER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 700)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.gherkin_filters', $definition); - } - - /** - * Loads suite with paths setup. - * - * @param ContainerBuilder $container - */ - private function loadSuiteWithPathsSetup(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Gherkin\Suite\Setup\SuiteWithPathsSetup', array( - '%paths.base%', - new Reference(FilesystemExtension::LOGGER_ID) - )); - $definition->addTag(SuiteExtension::SETUP_TAG, array('priority' => 50)); - $container->setDefinition(SuiteExtension::SETUP_TAG . '.suite_with_paths', $definition); - } - - /** - * Loads filesystem feature locator. - * - * @param ContainerBuilder $container - */ - private function loadFilesystemFeatureLocator(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Gherkin\Specification\Locator\FilesystemFeatureLocator', array( - new Reference(self::MANAGER_ID), - '%paths.base%' - )); - $definition->addTag(SpecificationExtension::LOCATOR_TAG, array('priority' => 60)); - $container->setDefinition(SpecificationExtension::LOCATOR_TAG . '.filesystem_feature', $definition); - } - - /** - * Loads filesystem scenarios list locator. - * - * @param ContainerBuilder $container - */ - private function loadFilesystemScenariosListLocator(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Gherkin\Specification\Locator\FilesystemScenariosListLocator', array( - new Reference(self::MANAGER_ID) - )); - $definition->addTag(SpecificationExtension::LOCATOR_TAG, array('priority' => 50)); - $container->setDefinition(SpecificationExtension::LOCATOR_TAG . '.filesystem_scenarios_list', $definition); - } - - /** - * Loads filesystem rerun scenarios list locator. - * - * @param ContainerBuilder $container - */ - private function loadFilesystemRerunScenariosListLocator(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Gherkin\Specification\Locator\FilesystemRerunScenariosListLocator', array( - new Reference(self::MANAGER_ID) - )); - $definition->addTag(SpecificationExtension::LOCATOR_TAG, array('priority' => 50)); - $container->setDefinition(SpecificationExtension::LOCATOR_TAG . '.filesystem_rerun_scenarios_list', $definition); - } - - /** - * Processes all available gherkin loaders. - * - * @param ContainerBuilder $container - */ - private function processLoaders(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::LOADER_TAG); - $definition = $container->getDefinition(self::MANAGER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('addLoader', array($reference)); - } - } - - /** - * Creates filter definition of provided type. - * - * @param string $type - * @param string $filterString - * - * @return Definition - * - * @throws ExtensionException If filter type is not recognised - */ - private function createFilterDefinition($type, $filterString) - { - if ('role' === $type) { - return new Definition('Behat\Gherkin\Filter\RoleFilter', array($filterString)); - } - - if ('name' === $type) { - return new Definition('Behat\Gherkin\Filter\NameFilter', array($filterString)); - } - - if ('tags' === $type) { - return new Definition('Behat\Gherkin\Filter\TagFilter', array($filterString)); - } - - if ('narrative' === $type) { - return new Definition('Behat\Gherkin\Filter\NarrativeFilter', array($filterString)); - } - - throw new ExtensionException(sprintf( - '`%s` filter is not supported by the `filters` option of gherkin extension. Supported types are `%s`.', - $type, - implode('`, `', array('narrative', 'role', 'name', 'tags')) - ), 'gherkin'); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php deleted file mode 100644 index 1883a0c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/LazyFeatureIterator.php +++ /dev/null @@ -1,207 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Gherkin\Specification; - -use Behat\Gherkin\Filter\FilterInterface; -use Behat\Gherkin\Filter\NameFilter; -use Behat\Gherkin\Filter\NarrativeFilter; -use Behat\Gherkin\Filter\RoleFilter; -use Behat\Gherkin\Filter\TagFilter; -use Behat\Gherkin\Gherkin; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Suite\Exception\SuiteConfigurationException; -use Behat\Testwork\Suite\Suite; - -/** - * Lazily iterates (parses one-by-one) over features. - * - * @author Konstantin Kudryashov - */ -final class LazyFeatureIterator implements SpecificationIterator -{ - /** - * @var Suite - */ - private $suite; - /** - * @var Gherkin - */ - private $gherkin; - /** - * @var string[] - */ - private $paths = array(); - /** - * @var FilterInterface[] - */ - private $filters = array(); - /** - * @var integer - */ - private $position = 0; - /** - * @var FeatureNode[] - */ - private $features = array(); - /** - * @var FeatureNode - */ - private $currentFeature; - - /** - * Initializes specifications. - * - * @param Suite $suite - * @param Gherkin $gherkin - * @param string[] $paths - * @param FilterInterface[] $filters - */ - public function __construct(Suite $suite, Gherkin $gherkin, array $paths, array $filters = array()) - { - $this->suite = $suite; - $this->gherkin = $gherkin; - $this->paths = array_values($paths); - $this->filters = array_merge($this->getSuiteFilters($suite), $filters); - } - - /** - * {@inheritdoc} - */ - public function getSuite() - { - return $this->suite; - } - - /** - * {@inheritdoc} - */ - public function rewind(): void - { - $this->position = 0; - $this->moveToNextAvailableFeature(); - } - - /** - * {@inheritdoc} - */ - public function next(): void - { - $this->moveToNextAvailableFeature(); - } - - /** - * {@inheritdoc} - */ - public function valid(): bool - { - return null !== $this->currentFeature; - } - - /** - * {@inheritdoc} - */ - public function key(): int - { - return $this->position; - } - - /** - * {@inheritdoc} - */ - public function current(): FeatureNode - { - return $this->currentFeature; - } - - /** - * Returns list of filters from suite settings. - * - * @param Suite $suite - * - * @return FilterInterface[] - */ - private function getSuiteFilters(Suite $suite) - { - if (!$suite->hasSetting('filters') || !is_array($suite->getSetting('filters'))) { - return array(); - } - - $filters = array(); - foreach ($suite->getSetting('filters') as $type => $filterString) { - $filters[] = $this->createFilter($type, $filterString, $suite); - } - - return $filters; - } - - /** - * Creates filter of provided type. - * - * @param string $type - * @param string $filterString - * @param Suite $suite - * - * @return FilterInterface - * - * @throws SuiteConfigurationException If filter type is not recognised - */ - private function createFilter($type, $filterString, Suite $suite) - { - if ('role' === $type) { - return new RoleFilter($filterString); - } - - if ('name' === $type) { - return new NameFilter($filterString); - } - - if ('tags' === $type) { - return new TagFilter($filterString); - } - - if ('narrative' === $type) { - return new NarrativeFilter($filterString); - } - - throw new SuiteConfigurationException(sprintf( - '`%s` filter is not supported by the `%s` suite. Supported types are `%s`.', - $type, - $suite->getName(), - implode('`, `', array('role', 'name', 'tags')) - ), $suite->getName()); - } - - /** - * Parses paths consequently. - */ - private function moveToNextAvailableFeature() - { - while (!count($this->features) && $this->position < count($this->paths)) { - $this->features = $this->parseFeature($this->paths[$this->position]); - $this->position++; - } - - $this->currentFeature = array_shift($this->features); - } - - /** - * Parses feature at path. - * - * @param string $path - * - * @return FeatureNode[] - */ - private function parseFeature($path) - { - return $this->gherkin->load($path, $this->filters); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemFeatureLocator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemFeatureLocator.php deleted file mode 100644 index d96cf8e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemFeatureLocator.php +++ /dev/null @@ -1,176 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Gherkin\Specification\Locator; - -use Behat\Behat\Gherkin\Specification\LazyFeatureIterator; -use Behat\Gherkin\Filter\PathsFilter; -use Behat\Gherkin\Gherkin; -use Behat\Testwork\Specification\Locator\SpecificationLocator; -use Behat\Testwork\Specification\NoSpecificationsIterator; -use Behat\Testwork\Suite\Exception\SuiteConfigurationException; -use Behat\Testwork\Suite\Suite; -use RecursiveDirectoryIterator; -use RecursiveIteratorIterator; -use RegexIterator; - -/** - * Loads gherkin features from the filesystem using gherkin parser. - * - * @author Konstantin Kudryashov - */ -final class FilesystemFeatureLocator implements SpecificationLocator -{ - /** - * @var Gherkin - */ - private $gherkin; - /** - * @var string - */ - private $basePath; - - /** - * Initializes loader. - * - * @param Gherkin $gherkin - * @param string $basePath - */ - public function __construct(Gherkin $gherkin, $basePath) - { - $this->gherkin = $gherkin; - $this->basePath = $basePath; - } - - /** - * {@inheritdoc} - */ - public function getLocatorExamples() - { - return array( - "a dir (features/)", - "a feature (*.feature)", - "a scenario at specific line (*.feature:10).", - "all scenarios at or after a specific line (*.feature:10-*).", - "all scenarios at a line within a specific range (*.feature:10-20)." - ); - } - - /** - * {@inheritdoc} - */ - public function locateSpecifications(Suite $suite, $locator) - { - if (!$suite->hasSetting('paths')) { - return new NoSpecificationsIterator($suite); - } - - $suiteLocators = $this->getSuitePaths($suite); - - if ($locator) { - $filters = array(new PathsFilter($suiteLocators)); - - return new LazyFeatureIterator($suite, $this->gherkin, $this->findFeatureFiles($locator), $filters); - } - - $featurePaths = array(); - foreach ($suiteLocators as $suiteLocator) { - $featurePaths = array_merge($featurePaths, $this->findFeatureFiles($suiteLocator)); - } - - return new LazyFeatureIterator($suite, $this->gherkin, $featurePaths); - } - - /** - * Returns array of feature paths configured for the provided suite. - * - * @param Suite $suite - * - * @return string[] - * - * @throws SuiteConfigurationException If `paths` setting is not an array - */ - private function getSuitePaths(Suite $suite) - { - if (!is_array($suite->getSetting('paths'))) { - throw new SuiteConfigurationException( - sprintf('`paths` setting of the "%s" suite is expected to be an array, %s given.', - $suite->getName(), - gettype($suite->getSetting('paths')) - ), - $suite->getName() - ); - } - - return $suite->getSetting('paths'); - } - - /** - * Loads feature files paths from provided path. - * - * @param string $path - * - * @return string[] - */ - private function findFeatureFiles($path) - { - $absolutePath = $this->findAbsolutePath($path); - - if (!$absolutePath) { - return array($path); - } - - if (is_file($absolutePath)) { - return array($absolutePath); - } - - $iterator = new RegexIterator( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator( - $absolutePath, - RecursiveDirectoryIterator::FOLLOW_SYMLINKS | RecursiveDirectoryIterator::SKIP_DOTS - ) - ), - '/^.+\.feature$/i', - RegexIterator::MATCH - ); - - $paths = array_map('strval', iterator_to_array($iterator)); - uasort($paths, 'strnatcasecmp'); - - return $paths; - } - - /** - * Finds absolute path for provided relative (relative to base features path). - * - * @param string $path Relative path - * - * @return string - */ - private function findAbsolutePath($path) - { - if (is_file($path) || is_dir($path)) { - return realpath($path); - } - - if (null === $this->basePath) { - return false; - } - - if (is_file($this->basePath . DIRECTORY_SEPARATOR . $path) - || is_dir($this->basePath . DIRECTORY_SEPARATOR . $path) - ) { - return realpath($this->basePath . DIRECTORY_SEPARATOR . $path); - } - - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemRerunScenariosListLocator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemRerunScenariosListLocator.php deleted file mode 100644 index 8636d32..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemRerunScenariosListLocator.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Gherkin\Specification\Locator; - -use Behat\Behat\Gherkin\Specification\LazyFeatureIterator; -use Behat\Gherkin\Gherkin; -use Behat\Testwork\Specification\Locator\SpecificationLocator; -use Behat\Testwork\Specification\NoSpecificationsIterator; -use Behat\Testwork\Suite\Suite; - -/** - * Loads gherkin features using a file with the list of scenarios. - * - * @author Konstantin Kudryashov - */ -final class FilesystemRerunScenariosListLocator implements SpecificationLocator -{ - /** - * @var Gherkin - */ - private $gherkin; - - /** - * Initializes locator. - * - * @param Gherkin $gherkin - */ - public function __construct(Gherkin $gherkin) - { - $this->gherkin = $gherkin; - } - - /** - * {@inheritdoc} - */ - public function getLocatorExamples() - { - return array(); - } - - /** - * {@inheritdoc} - */ - public function locateSpecifications(Suite $suite, $locator) - { - if (null === $locator || !is_file($locator) || 'rerun' !== pathinfo($locator, PATHINFO_EXTENSION)) { - return new NoSpecificationsIterator($suite); - } - - $scenarios = json_decode(trim(file_get_contents($locator)), true); - if (empty($scenarios) || empty($scenarios[$suite->getName()])) { - return new NoSpecificationsIterator($suite); - } - - return new LazyFeatureIterator($suite, $this->gherkin, $scenarios[$suite->getName()]); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemScenariosListLocator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemScenariosListLocator.php deleted file mode 100644 index ccacedd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Specification/Locator/FilesystemScenariosListLocator.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Gherkin\Specification\Locator; - -use Behat\Behat\Gherkin\Specification\LazyFeatureIterator; -use Behat\Gherkin\Gherkin; -use Behat\Testwork\Specification\Locator\SpecificationLocator; -use Behat\Testwork\Specification\NoSpecificationsIterator; -use Behat\Testwork\Suite\Suite; - -/** - * Loads gherkin features using a file with the list of scenarios. - * - * @author Konstantin Kudryashov - */ -final class FilesystemScenariosListLocator implements SpecificationLocator -{ - /** - * @var Gherkin - */ - private $gherkin; - - /** - * Initializes locator. - * - * @param Gherkin $gherkin - */ - public function __construct(Gherkin $gherkin) - { - $this->gherkin = $gherkin; - } - - /** - * {@inheritdoc} - */ - public function getLocatorExamples() - { - return array("a scenarios list file (*.scenarios)."); - } - - /** - * {@inheritdoc} - */ - public function locateSpecifications(Suite $suite, $locator) - { - if (null === $locator || !is_file($locator) || 'scenarios' !== pathinfo($locator, PATHINFO_EXTENSION)) { - return new NoSpecificationsIterator($suite); - } - - $scenarios = explode("\n", trim(file_get_contents($locator))); - - return new LazyFeatureIterator($suite, $this->gherkin, $scenarios); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php deleted file mode 100644 index f50249f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Gherkin/Suite/Setup/SuiteWithPathsSetup.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Gherkin\Suite\Setup; - -use Behat\Testwork\Filesystem\FilesystemLogger; -use Behat\Testwork\Suite\Setup\SuiteSetup; -use Behat\Testwork\Suite\Suite; - -/** - * Sets up gherkin suite in the filesystem (creates feature folders). - * - * @author Konstantin Kudryashov - */ -final class SuiteWithPathsSetup implements SuiteSetup -{ - /** - * @var string - */ - private $basePath; - /** - * @var null|FilesystemLogger - */ - private $logger; - - /** - * Initializes setup. - * - * @param string $basePath - * @param null|FilesystemLogger $logger - */ - public function __construct($basePath, FilesystemLogger $logger = null) - { - $this->basePath = $basePath; - $this->logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function supportsSuite(Suite $suite) - { - return $suite->hasSetting('paths') && is_array($suite->getSetting('paths')); - } - - /** - * {@inheritdoc} - */ - public function setupSuite(Suite $suite) - { - foreach ($suite->getSetting('paths') as $locator) { - if (0 !== strpos($locator, '@') && !is_dir($path = $this->locatePath($locator))) { - $this->createFeatureDirectory($path); - } - } - } - - /** - * Creates feature directory. - * - * @param string $path - */ - private function createFeatureDirectory($path) - { - mkdir($path, 0777, true); - - if ($this->logger) { - $this->logger->directoryCreated($path, 'place your *.feature files here'); - } - } - - /** - * Locates path from a relative one. - * - * @param string $path - * - * @return string - */ - private function locatePath($path) - { - if ($this->isAbsolutePath($path)) { - return $path; - } - - return $this->basePath . DIRECTORY_SEPARATOR . $path; - } - - /** - * Returns whether the file path is an absolute path. - * - * @param string $file A file path - * - * @return bool - */ - private function isAbsolutePath($file) - { - if ($file[0] == '/' || $file[0] == '\\' - || (strlen($file) > 3 && ctype_alpha($file[0]) - && $file[1] == ':' - && ($file[2] == '\\' || $file[2] == '/') - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ) { - return true; - } - - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php deleted file mode 100644 index 7e2191a..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Argument/ServicesResolver.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\HelperContainer\Argument; - -use Behat\Behat\Context\Argument\ArgumentResolver; -use Psr\Container\ContainerExceptionInterface; -use Psr\Container\ContainerInterface; -use ReflectionClass; - -/** - * Resolves arguments using provided service container. - * - * @see ContextFactory - * - * @author Konstantin Kudryashov - */ -final class ServicesResolver implements ArgumentResolver -{ - /** - * @var ContainerInterface - */ - private $container; - - /** - * Initialises resolver. - * - * @param ContainerInterface $container - */ - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - /** - * {@inheritdoc} - * - * @throws ContainerExceptionInterface - */ - public function resolveArguments(ReflectionClass $classReflection, array $arguments) - { - return array_map(array($this, 'resolveArgument'), $arguments); - } - - /** - * Attempts to resolve singular argument from container. - * - * Convention is strings starting with `@` are considered services and - * are expected to be present in the container. - * - * @param mixed $value - * - * @return mixed - * - * @throws ContainerExceptionInterface - */ - private function resolveArgument($value) - { - if (is_string($value) && 0 === mb_strpos($value, '@')) { - return $this->container->get(mb_substr($value, 1)); - } - - return $value; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php deleted file mode 100644 index 8820288..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Argument/ServicesResolverFactory.php +++ /dev/null @@ -1,220 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\HelperContainer\Argument; - -use Behat\Behat\Context\Argument\ArgumentResolver; -use Behat\Behat\HelperContainer\Environment\ServiceContainerEnvironment; -use Behat\Behat\Context\Argument\ArgumentResolverFactory; -use Behat\Behat\Context\Argument\SuiteScopedResolverFactory; -use Behat\Behat\HelperContainer\BuiltInServiceContainer; -use Behat\Behat\HelperContainer\Exception\WrongContainerClassException; -use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException; -use Behat\Behat\HelperContainer\ServiceContainer\HelperContainerExtension; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Suite\Suite; -use Psr\Container\ContainerInterface; -use Symfony\Component\DependencyInjection\TaggedContainerInterface; - -/** - * Generates ServiceContainer argument resolvers based on suite's `services` setting. - * - * @see ContextEnvironmentHandler - * - * @author Konstantin Kudryashov - */ -final class ServicesResolverFactory implements SuiteScopedResolverFactory, ArgumentResolverFactory -{ - /** - * @var TaggedContainerInterface - */ - private $container; - - /** - * Initialises factory. - * - * @param TaggedContainerInterface $container - */ - public function __construct(TaggedContainerInterface $container) - { - $this->container = $container; - } - - /** - * {@inheritdoc} - * - * @deprecated as part of SuiteScopedResolverFactory deprecation. Would be removed in 4.0 - * - * @throws WrongServicesConfigurationException - * @throws WrongContainerClassException - */ - public function generateArgumentResolvers(Suite $suite) - { - @trigger_error( - 'SuiteScopedResolverFactory::generateArgumentResolvers() was deprecated and will be removed in 4.0', - E_USER_DEPRECATED - ); - - if (!$suite->hasSetting('services')) { - return array(); - } - - $container = $this->createContainer($suite->getSetting('services')); - - return $this->createResolvers($container, false); - } - - /** - * {@inheritdoc} - * - * @throws WrongServicesConfigurationException - * @throws WrongContainerClassException - */ - public function createArgumentResolvers(Environment $environment) - { - $suite = $environment->getSuite(); - - if (!$suite->hasSetting('services')) { - return array(); - } - - $container = $this->createContainer($suite->getSetting('services')); - $autowire = $suite->hasSetting('autowire') && $suite->getSetting('autowire'); - - if ($environment instanceof ServiceContainerEnvironment) { - $environment->setServiceContainer($container); - } - - return $this->createResolvers($container, $autowire); - } - - /** - * Creates container from the setting passed. - * - * @param string $settings - * - * @return mixed - * - * @throws WrongServicesConfigurationException - */ - private function createContainer($settings) - { - if (is_string($settings)) { - return $this->createContainerFromString($settings); - } - - if (is_array($settings)) { - return $this->createContainerFromArray($settings); - } - - throw new WrongServicesConfigurationException( - sprintf('`services` must be either string or an array, but `%s` given.', gettype($settings)) - ); - } - - /** - * Creates custom container using class/constructor given. - * - * @param string $settings - * - * @return mixed - * - * @throws WrongServicesConfigurationException - */ - private function createContainerFromString($settings) - { - if (0 === mb_strpos($settings, '@')) { - return $this->loadContainerFromContainer(mb_substr($settings, 1)); - } - - return $this->createContainerFromClassSpec($settings); - } - - /** - * Creates built-in service container with provided settings. - * - * @param array $settings - * - * @return BuiltInServiceContainer - */ - private function createContainerFromArray(array $settings) - { - return new BuiltInServiceContainer($settings); - } - - /** - * Loads container from string. - * - * @param string $name - * - * @return mixed - * - * @throws WrongServicesConfigurationException - */ - private function loadContainerFromContainer($name) - { - $services = $this->container->findTaggedServiceIds(HelperContainerExtension::HELPER_CONTAINER_TAG); - - if (!array_key_exists($name, $services)) { - throw new WrongServicesConfigurationException( - sprintf('Service container `@%s` was not found.', $name) - ); - } - - return $this->container->get($name); - } - - /** - * Creates container from string-based class spec. - * - * @param string $classSpec - * - * @return mixed - */ - private function createContainerFromClassSpec($classSpec) - { - $constructor = explode('::', $classSpec); - - if (2 === count($constructor)) { - return call_user_func($constructor); - } - - return new $constructor[0]; - } - - /** - * Checks if container implements the correct interface and creates resolver using it. - * - * @param mixed $container - * @param bool $autowire - * - * @return ArgumentResolver[] - * - * @throws WrongContainerClassException - */ - private function createResolvers($container, $autowire) - { - if (!$container instanceof ContainerInterface) { - throw new WrongContainerClassException( - sprintf( - 'Service container is expected to implement `Psr\Container\ContainerInterface`, but `%s` does not.', - get_class($container) - ), - get_class($container) - ); - } - - if ($autowire) { - return array(new ServicesResolver($container), new AutowiringResolver($container)); - } - - return array(new ServicesResolver($container)); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php deleted file mode 100644 index 85d302f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/BuiltInServiceContainer.php +++ /dev/null @@ -1,203 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\HelperContainer; - -use Behat\Behat\HelperContainer\Exception\ServiceNotFoundException; -use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException; -use Psr\Container\ContainerInterface as PsrContainerInterface; -use ReflectionClass; -use ReflectionMethod; - -/** - * Built-in service container. - * - * @author Konstantin Kudryashov - */ -final class BuiltInServiceContainer implements PsrContainerInterface -{ - /** - * @var array - */ - private $schema; - /** - * @var array - */ - private $instances; - - /** - * Initialises container using provided service configuration. - * - * @param array $schema - */ - public function __construct(array $schema) - { - $this->schema = $schema; - } - - /** - * {@inheritdoc} - */ - public function has($id): bool - { - return array_key_exists($id, $this->schema); - } - - /** - * {@inheritdoc} - */ - public function get($id) - { - if (!$this->has($id)) { - throw new ServiceNotFoundException( - sprintf('Service with id `%s` was not defined inside the `services` setting`.', $id), - $id - ); - } - - return $this->instances[$id] = $this->instances[$id] ?? $this->createInstance($id); - } - - /** - * Creates an instance of given service. - * - * @param string $id - * - * @return mixed - */ - private function createInstance($id) - { - $schema = $this->getAndValidateServiceSchema($id); - - $reflection = new ReflectionClass($schema['class']); - $arguments = $schema['arguments']; - - if ($factoryMethod = $this->getAndValidateFactoryMethod($reflection, $schema)) { - return $factoryMethod->invokeArgs(null, $arguments); - } - - return $reflection->newInstanceArgs($arguments); - } - - /** - * Gets and validates a service configuration for a service with given ID. - * - * @param string $id - * - * @throws WrongServicesConfigurationException - * - * @return array|string - */ - private function getAndValidateServiceSchema($id) - { - $schema = $this->schema[$id]; - - if (null === $schema) { - $schema = array('class' => $id); - } - - if (is_string($schema)) { - $schema = array('class' => $schema); - } - - $schema['class'] = $this->getAndValidateClass($id, $schema); - $schema['arguments'] = $this->getAndValidateArguments($schema); - - return $schema; - } - - /** - * Gets and validates a class from schema. - * - * @param string $id - * @param string|array $schema - * - * @return string - */ - private function getAndValidateClass($id, array $schema) - { - if (!isset($schema['class'])) { - $schema['class'] = $id; - } - - return $schema['class']; - } - - /** - * Gets and validates arguments from schema. - * - * @param array $schema - * - * @return array - */ - private function getAndValidateArguments(array $schema) - { - return isset($schema['arguments']) ? (array)$schema['arguments'] : array(); - } - - /** - * Gets and validates a factory method. - * - * @param ReflectionClass $reflection - * @param array $schema - * - * @return null|ReflectionMethod - */ - private function getAndValidateFactoryMethod(ReflectionClass $reflection, array $schema) - { - if (!isset($schema['factory_method'])) { - return null; - } - - $factoryMethod = $schema['factory_method']; - $this->assertFactoryMethodExists($reflection, $factoryMethod); - $method = $reflection->getMethod($factoryMethod); - $this->assertFactoryMethodIsStatic($method); - - return $method; - } - - /** - * Checks if factory method exists. - * - * @param ReflectionClass $class - * @param string $methodName - * - * @throws WrongServicesConfigurationException - */ - private function assertFactoryMethodExists(ReflectionClass $class, $methodName) - { - if (!$class->hasMethod($methodName)) { - throw new WrongServicesConfigurationException(sprintf( - 'Factory method `%s::%s` does not exist.', - $class->getName(), - $methodName - )); - } - } - - /** - * Checks if factory method is static. - * - * @param ReflectionMethod $method - * - * @throws WrongServicesConfigurationException - */ - private function assertFactoryMethodIsStatic(ReflectionMethod $method) - { - if (!$method->isStatic()) { - throw new WrongServicesConfigurationException(sprintf( - 'Service factory methods must be static, but `%s::%s` is not.', - $method->getDeclaringClass()->getName(), - $method->getName() - )); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php deleted file mode 100644 index d619192..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/HelperContainerException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\HelperContainer\Exception; - -use Behat\Testwork\Environment\Exception\EnvironmentException; - -/** - * All HelperContainer exceptions implement this interface. - * - * @author Konstantin Kudryashov - */ -interface HelperContainerException extends ContainerException, EnvironmentException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php deleted file mode 100644 index a82b63e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/ServiceNotFoundException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\HelperContainer\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception thrown when service ID is not found inside the container. - * - * @author Konstantin Kudryashov - */ -final class ServiceNotFoundException extends InvalidArgumentException implements HelperContainerException, NotFoundException -{ - /** - * @var string - */ - private $serviceId; - - /** - * Initializes exception. - * - * @param string $message - * @param string $serviceId - */ - public function __construct($message, $serviceId) - { - $this->serviceId = $serviceId; - - parent::__construct($message); - } - - /** - * Returns service ID that caused exception. - * - * @return string - */ - public function getServiceId() - { - return $this->serviceId; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/WrongContainerClassException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/WrongContainerClassException.php deleted file mode 100644 index 5dd8321..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/WrongContainerClassException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\HelperContainer\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception when provided class exists, but is not an acceptable as a container. - * - * @author Konstantin Kudryashov - */ -final class WrongContainerClassException extends InvalidArgumentException implements HelperContainerException -{ - /** - * @var string - */ - private $class; - - /** - * Initializes exception. - * - * @param integer $message - * @param string $class - */ - public function __construct($message, $class) - { - $this->class = $class; - - parent::__construct($message); - } - - /** - * Returns not found classname. - * - * @return string - */ - public function getClass() - { - return $this->class; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/WrongServicesConfigurationException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/WrongServicesConfigurationException.php deleted file mode 100644 index fd65f02..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/Exception/WrongServicesConfigurationException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\HelperContainer\Exception; - -use RuntimeException; - -/** - * Represents an exception when wrong value passed into `services` setting. - * - * @author Konstantin Kudryashov - */ -final class WrongServicesConfigurationException extends RuntimeException implements HelperContainerException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php deleted file mode 100644 index 399ffff..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/HelperContainer/ServiceContainer/HelperContainerExtension.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\HelperContainer\ServiceContainer; - -use Behat\Behat\Context\ServiceContainer\ContextExtension; -use Behat\Behat\HelperContainer\Exception\WrongServicesConfigurationException; -use Behat\Testwork\Call\ServiceContainer\CallExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Behat helper container extension. - * - * Extends Behat with helper containers support. - * - * @author Konstantin Kudryashov - */ -final class HelperContainerExtension implements Extension -{ - /* - * Available extension points - */ - public const HELPER_CONTAINER_TAG = 'helper_container.container'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes compiler pass. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'helper_container'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $definition = new Definition('Behat\Behat\HelperContainer\Argument\ServicesResolverFactory', array( - new Reference('service_container') - )); - $definition->addTag(ContextExtension::SUITE_SCOPED_RESOLVER_FACTORY_TAG, array('priority' => 0)); - $container->setDefinition(ContextExtension::SUITE_SCOPED_RESOLVER_FACTORY_TAG . '.helper_container', $definition); - - $definition = new Definition('Behat\Behat\HelperContainer\Call\Filter\ServicesResolver'); - $definition->addTag(CallExtension::CALL_FILTER_TAG, array('priority' => 0)); - $container->setDefinition(CallExtension::CALL_FILTER_TAG . '.helper_container', $definition); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::HELPER_CONTAINER_TAG); - - foreach ($references as $reference) { - if ($container->getDefinition((string) $reference)->isShared()) { - throw new WrongServicesConfigurationException(sprintf( - 'Container services must not be configured as shared, but `@%s` is.', $reference - )); - } - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterFeature.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterFeature.php deleted file mode 100644 index 9041f1b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterFeature.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\FeatureScope; - -/** - * Represents an AfterFeature hook. - * - * @author Konstantin Kudryashov - */ -final class AfterFeature extends RuntimeFeatureHook -{ - /** - * Initializes hook. - * - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($filterString, $callable, $description = null) - { - parent::__construct(FeatureScope::AFTER, $filterString, $callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'AfterFeature'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterScenario.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterScenario.php deleted file mode 100644 index 70fbaaf..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterScenario.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\ScenarioScope; - -/** - * Represents an AfterScenario hook. - * - * @author Konstantin Kudryashov - */ -final class AfterScenario extends RuntimeScenarioHook -{ - /** - * Initializes hook. - * - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($filterString, $callable, $description = null) - { - parent::__construct(ScenarioScope::AFTER, $filterString, $callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'AfterScenario'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterStep.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterStep.php deleted file mode 100644 index 684ef79..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/AfterStep.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\StepScope; - -/** - * Represents an AfterStep hook. - * - * @author Konstantin Kudryashov - */ -final class AfterStep extends RuntimeStepHook -{ - /** - * Initializes hook. - * - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($filterString, $callable, $description = null) - { - parent::__construct(StepScope::AFTER, $filterString, $callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'AfterStep'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeFeature.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeFeature.php deleted file mode 100644 index 60e326d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeFeature.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\FeatureScope; - -/** - * Represents a BeforeFeature hook. - * - * @author Konstantin Kudryashov - */ -final class BeforeFeature extends RuntimeFeatureHook -{ - /** - * Initializes hook. - * - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($filterString, $callable, $description = null) - { - parent::__construct(FeatureScope::BEFORE, $filterString, $callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'BeforeFeature'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeScenario.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeScenario.php deleted file mode 100644 index 114def0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeScenario.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\ScenarioScope; - -/** - * Represents a BeforeScenario hook. - * - * @author Konstantin Kudryashov - */ -final class BeforeScenario extends RuntimeScenarioHook -{ - /** - * Initializes hook. - * - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($filterString, $callable, $description = null) - { - parent::__construct(ScenarioScope::BEFORE, $filterString, $callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'BeforeScenario'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeStep.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeStep.php deleted file mode 100644 index 390f918..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/BeforeStep.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\StepScope; - -/** - * Represents a BeforeStep hook. - * - * @author Konstantin Kudryashov - */ -final class BeforeStep extends RuntimeStepHook -{ - /** - * Initializes hook. - * - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($filterString, $callable, $description = null) - { - parent::__construct(StepScope::BEFORE, $filterString, $callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'BeforeStep'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php deleted file mode 100644 index 9bc9a55..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeFeatureHook.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\FeatureScope; -use Behat\Gherkin\Filter\NameFilter; -use Behat\Gherkin\Filter\TagFilter; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Call\Exception\BadCallbackException; -use Behat\Testwork\Hook\Call\RuntimeFilterableHook; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents a feature hook. - * - * @author Konstantin Kudryashov - */ -abstract class RuntimeFeatureHook extends RuntimeFilterableHook -{ - /** - * Initializes hook. - * - * @param string $scopeName - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - * - * @throws BadCallbackException If callback is method, but not a static one - */ - public function __construct($scopeName, $filterString, $callable, $description = null) - { - parent::__construct($scopeName, $filterString, $callable, $description); - - if ($this->isAnInstanceMethod()) { - throw new BadCallbackException(sprintf( - 'Feature hook callback: %s::%s() must be a static method', - $callable[0], - $callable[1] - ), $callable); - } - } - - /** - * {@inheritdoc} - */ - public function filterMatches(HookScope $scope) - { - if (!$scope instanceof FeatureScope) { - return false; - } - - if (null === ($filterString = $this->getFilterString())) { - return true; - } - - return $this->isMatch($scope->getFeature(), $filterString); - } - - /** - * @param FeatureNode $feature - * @param string $filterString - * - * @return bool - */ - private function isMatch(FeatureNode $feature, $filterString) - { - if (false !== strpos($filterString, '@')) { - return $this->isMatchTagFilter($feature, $filterString); - } - - if (!empty($filterString)) { - return $this->isMatchNameFilter($feature, $filterString); - } - - return false; - } - - /** - * Checks if feature matches tag filter. - * - * @param FeatureNode $feature - * @param string $filterString - * - * @return bool - */ - private function isMatchTagFilter(FeatureNode $feature, $filterString) - { - $filter = new TagFilter($filterString); - - return $filter->isFeatureMatch($feature); - } - - /** - * Checks if feature matches name filter. - * - * @param FeatureNode $feature - * @param string $filterString - * - * @return bool - */ - private function isMatchNameFilter(FeatureNode $feature, $filterString) - { - $filter = new NameFilter($filterString); - - return $filter->isFeatureMatch($feature); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php deleted file mode 100644 index 429fafe..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeScenarioHook.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\ScenarioScope; -use Behat\Gherkin\Filter\NameFilter; -use Behat\Gherkin\Filter\TagFilter; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; -use Behat\Testwork\Hook\Call\RuntimeFilterableHook; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents a scenario hook. - * - * @author Konstantin Kudryashov - */ -abstract class RuntimeScenarioHook extends RuntimeFilterableHook -{ - /** - * {@inheritdoc} - */ - public function filterMatches(HookScope $scope) - { - if (!$scope instanceof ScenarioScope) { - return false; - } - - if (null === ($filterString = $this->getFilterString())) { - return true; - } - - return $this->isMatch($scope->getFeature(), $scope->getScenario(), $filterString); - } - - /** - * Checks if nodes match filter. - * - * @param FeatureNode $feature - * @param ScenarioInterface $scenario - * @param string $filterString - * - * @return bool - */ - protected function isMatch(FeatureNode $feature, ScenarioInterface $scenario, $filterString) - { - if (false !== strpos($filterString, '@')) { - return $this->isMatchTagFilter($feature, $scenario, $filterString); - } - - if (!empty($filterString)) { - return $this->isMatchNameFilter($scenario, $filterString); - } - - return false; - } - - /** - * Checks if node match tag filter. - * - * @param FeatureNode $feature - * @param ScenarioInterface $scenario - * @param string $filterString - * - * @return bool - */ - protected function isMatchTagFilter(FeatureNode $feature, ScenarioInterface $scenario, $filterString) - { - $filter = new TagFilter($filterString); - - return $filter->isScenarioMatch($feature, $scenario); - } - - /** - * Checks if scenario matches name filter. - * - * @param ScenarioInterface $scenario - * @param string $filterString - * - * @return bool - */ - protected function isMatchNameFilter(ScenarioInterface $scenario, $filterString) - { - $filter = new NameFilter($filterString); - - return $filter->isScenarioMatch($scenario); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeStepHook.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeStepHook.php deleted file mode 100644 index 401e3cc..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Call/RuntimeStepHook.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Call; - -use Behat\Behat\Hook\Scope\StepScope; -use Behat\Gherkin\Filter\NameFilter; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Hook\Call\RuntimeFilterableHook; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents a step hook. - * - * @author Konstantin Kudryashov - */ -abstract class RuntimeStepHook extends RuntimeFilterableHook -{ - /** - * {@inheritdoc} - */ - public function filterMatches(HookScope $scope) - { - if (!$scope instanceof StepScope) { - return false; - } - - if (null === ($filterString = $this->getFilterString())) { - return true; - } - - if (!empty($filterString)) { - $filter = new NameFilter($filterString); - - if ($filter->isFeatureMatch($scope->getFeature())) { - return true; - } - - return $this->isStepMatch($scope->getStep(), $filterString); - } - - return false; - } - - /** - * Checks if Feature matches specified filter. - * - * @param StepNode $step - * @param string $filterString - * - * @return bool - */ - private function isStepMatch(StepNode $step, $filterString) - { - if ('/' === $filterString[0]) { - return 1 === preg_match($filterString, $step->getText()); - } - - return false !== mb_strpos($step->getText(), $filterString, 0, 'utf8'); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Context/Annotation/HookAnnotationReader.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Context/Annotation/HookAnnotationReader.php deleted file mode 100644 index 663245e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Context/Annotation/HookAnnotationReader.php +++ /dev/null @@ -1,65 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Context\Annotation; - -use Behat\Behat\Context\Annotation\AnnotationReader; -use Behat\Testwork\Hook\Call\RuntimeHook; -use ReflectionMethod; - -/** - * Reads hook callees from context method annotations. - * - * @author Konstantin Kudryashov - */ -final class HookAnnotationReader implements AnnotationReader -{ - /** - * @var string - */ - private static $regex = '/^\@(beforesuite|aftersuite|beforefeature|afterfeature|beforescenario|afterscenario|beforestep|afterstep)(?:\s+(.+))?$/i'; - /** - * @var string[] - */ - private static $classes = array( - 'beforesuite' => 'Behat\Testwork\Hook\Call\BeforeSuite', - 'aftersuite' => 'Behat\Testwork\Hook\Call\AfterSuite', - 'beforefeature' => 'Behat\Behat\Hook\Call\BeforeFeature', - 'afterfeature' => 'Behat\Behat\Hook\Call\AfterFeature', - 'beforescenario' => 'Behat\Behat\Hook\Call\BeforeScenario', - 'afterscenario' => 'Behat\Behat\Hook\Call\AfterScenario', - 'beforestep' => 'Behat\Behat\Hook\Call\BeforeStep', - 'afterstep' => 'Behat\Behat\Hook\Call\AfterStep' - ); - - /** - * Loads step callees (if exist) associated with specific method. - * - * @param string $contextClass - * @param ReflectionMethod $method - * @param string $docLine - * @param string $description - * - * @return null|RuntimeHook - */ - public function readCallee($contextClass, ReflectionMethod $method, $docLine, $description) - { - if (!preg_match(self::$regex, $docLine, $match)) { - return null; - } - - $type = strtolower($match[1]); - $class = self::$classes[$type]; - $pattern = $match[2] ?? null; - $callable = array($contextClass, $method->getName()); - - return new $class($pattern, $callable, $description); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterFeatureScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterFeatureScope.php deleted file mode 100644 index 4a321e9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterFeatureScope.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Hook\Scope\AfterTestScope; -use Behat\Testwork\Suite\Suite; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an AfterFeature hook scope. - * - * @author Konstantin Kudryashov - */ -final class AfterFeatureScope implements FeatureScope, AfterTestScope -{ - /** - * @var Environment - */ - private $environment; - /** - * @var FeatureNode - */ - private $feature; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes scope. - * - * @param Environment $env - * @param FeatureNode $feature - * @param TestResult $result - */ - public function __construct(Environment $env, FeatureNode $feature, TestResult $result) - { - $this->environment = $env; - $this->feature = $feature; - $this->result = $result; - } - - /** - * Returns hook scope name. - * - * @return string - */ - public function getName() - { - return self::AFTER; - } - - /** - * Returns hook suite. - * - * @return Suite - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * Returns hook environment. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterScenarioScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterScenarioScope.php deleted file mode 100644 index 45985d9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterScenarioScope.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface as Scenario; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Hook\Scope\AfterTestScope; -use Behat\Testwork\Suite\Suite; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an AfterScenario hook scope. - * - * @author Konstantin Kudryashov - */ -final class AfterScenarioScope implements ScenarioScope, AfterTestScope -{ - /** - * @var Environment - */ - private $environment; - /** - * @var FeatureNode - */ - private $feature; - /** - * @var Scenario - */ - private $scenario; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes scope. - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - * @param TestResult $result - */ - public function __construct(Environment $env, FeatureNode $feature, Scenario $scenario, TestResult $result) - { - $this->environment = $env; - $this->feature = $feature; - $this->scenario = $scenario; - $this->result = $result; - } - - /** - * Returns hook scope name. - * - * @return string - */ - public function getName() - { - return self::AFTER; - } - - /** - * Returns hook suite. - * - * @return Suite - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * Returns hook environment. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario. - * - * @return Scenario - */ - public function getScenario() - { - return $this->scenario; - } - - /** - * Returns test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterStepScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterStepScope.php deleted file mode 100644 index 54d63f0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/AfterStepScope.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Hook\Scope\AfterTestScope; -use Behat\Testwork\Suite\Suite; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an AfterStep hook scope. - * - * @author Konstantin Kudryashov - */ -final class AfterStepScope implements StepScope, AfterTestScope -{ - /** - * @var Environment - */ - private $environment; - /** - * @var FeatureNode - */ - private $feature; - /** - * @var StepNode - */ - private $step; - /** - * @var StepResult - */ - private $result; - - /** - * Initializes scope. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * @param StepResult $result - */ - public function __construct(Environment $env, FeatureNode $feature, StepNode $step, StepResult $result) - { - $this->environment = $env; - $this->feature = $feature; - $this->step = $step; - $this->result = $result; - } - - /** - * Returns hook scope name. - * - * @return string - */ - public function getName() - { - return self::AFTER; - } - - /** - * Returns hook suite. - * - * @return Suite - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * Returns hook environment. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scope step. - * - * @return StepNode - */ - public function getStep() - { - return $this->step; - } - - /** - * Returns test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeFeatureScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeFeatureScope.php deleted file mode 100644 index 73254de..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeFeatureScope.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Suite\Suite; - -/** - * Represents a BeforeFeature hook scope. - * - * @author Konstantin Kudryashov - */ -final class BeforeFeatureScope implements FeatureScope -{ - /** - * @var Environment - */ - private $environment; - /** - * @var FeatureNode - */ - private $feature; - - /** - * Initializes scope. - * - * @param Environment $env - * @param FeatureNode $feature - */ - public function __construct(Environment $env, FeatureNode $feature) - { - $this->environment = $env; - $this->feature = $feature; - } - - /** - * Returns hook scope name. - * - * @return string - */ - public function getName() - { - return self::BEFORE; - } - - /** - * Returns hook suite. - * - * @return Suite - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * Returns hook environment. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeScenarioScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeScenarioScope.php deleted file mode 100644 index af4178e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeScenarioScope.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface as Scenario; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Suite\Suite; - -/** - * Represents a BeforeScenario hook scope. - * - * @author Konstantin Kudryashov - */ -final class BeforeScenarioScope implements ScenarioScope -{ - /** - * @var Environment - */ - private $environment; - /** - * @var FeatureNode - */ - private $feature; - /** - * @var Scenario - */ - private $scenario; - - /** - * Initializes scope. - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - */ - public function __construct(Environment $env, FeatureNode $feature, Scenario $scenario) - { - $this->environment = $env; - $this->feature = $feature; - $this->scenario = $scenario; - } - - /** - * Returns hook scope name. - * - * @return string - */ - public function getName() - { - return self::BEFORE; - } - - /** - * Returns hook suite. - * - * @return Suite - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * Returns hook environment. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scenario. - * - * @return Scenario - */ - public function getScenario() - { - return $this->scenario; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeStepScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeStepScope.php deleted file mode 100644 index 72e1cad..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/BeforeStepScope.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Suite\Suite; - -/** - * Represents a BeforeStep hook scope. - * - * @author Konstantin Kudryashov - */ -final class BeforeStepScope implements StepScope -{ - /** - * @var Environment - */ - private $environment; - /** - * @var FeatureNode - */ - private $feature; - /** - * @var StepNode - */ - private $step; - - /** - * Initializes scope. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - */ - public function __construct(Environment $env, FeatureNode $feature, StepNode $step) - { - $this->environment = $env; - $this->feature = $feature; - $this->step = $step; - } - - /** - * Returns hook scope name. - * - * @return string - */ - public function getName() - { - return self::BEFORE; - } - - /** - * Returns hook suite. - * - * @return Suite - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * Returns hook environment. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } - - /** - * Returns scope step. - * - * @return StepNode - */ - public function getStep() - { - return $this->step; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/FeatureScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/FeatureScope.php deleted file mode 100644 index 6b27b82..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/FeatureScope.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents a feature hook scope. - * - * @author Konstantin Kudryashov - */ -interface FeatureScope extends HookScope -{ - public const BEFORE = 'feature.before'; - public const AFTER = 'feature.after'; - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/ScenarioScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/ScenarioScope.php deleted file mode 100644 index c7dbe51..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/ScenarioScope.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface as Scenario; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents a scenario hook scope. - * - * @author Konstantin Kudryashov - */ -interface ScenarioScope extends HookScope -{ - public const BEFORE = 'scenario.before'; - public const AFTER = 'scenario.after'; - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature(); - - /** - * Returns scenario. - * - * @return Scenario - */ - public function getScenario(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/StepScope.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/StepScope.php deleted file mode 100644 index 449154d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Scope/StepScope.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Scope; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents a step hook scope. - * - * @author Konstantin Kudryashov - */ -interface StepScope extends HookScope -{ - public const BEFORE = 'step.before'; - public const AFTER = 'step.after'; - - /** - * Returns scope feature. - * - * @return FeatureNode - */ - public function getFeature(); - - /** - * Returns scope step. - * - * @return StepNode - */ - public function getStep(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/ServiceContainer/HookExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/ServiceContainer/HookExtension.php deleted file mode 100644 index 97742c3..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/ServiceContainer/HookExtension.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\ServiceContainer; - -use Behat\Behat\Context\ServiceContainer\ContextExtension; -use Behat\Behat\Definition\ServiceContainer\DefinitionExtension; -use Behat\Behat\Tester\ServiceContainer\TesterExtension; -use Behat\Testwork\Hook\ServiceContainer\HookExtension as BaseExtension; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Extends Testwork HookExtension with additional behat services. - * - * @author Konstantin Kudryashov - */ -final class HookExtension extends BaseExtension -{ - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - parent::load($container, $config); - - $this->loadAnnotationReader($container); - $this->loadAttributeReader($container); - } - - /** - * Loads hookable testers. - * - * @param ContainerBuilder $container - */ - protected function loadHookableTesters(ContainerBuilder $container) - { - parent::loadHookableTesters($container); - - $definition = new Definition('Behat\Behat\Hook\Tester\HookableFeatureTester', array( - new Reference(TesterExtension::SPECIFICATION_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG, array('priority' => 9999)); - $container->setDefinition(TesterExtension::SPECIFICATION_TESTER_WRAPPER_TAG . '.hookable', $definition); - - $definition = new Definition('Behat\Behat\Hook\Tester\HookableScenarioTester', array( - new Reference(TesterExtension::SCENARIO_TESTER_ID), - new Reference(self::DISPATCHER_ID) - ) - ); - $definition->addTag(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG, array('priority' => 9999)); - $container->setDefinition(TesterExtension::SCENARIO_TESTER_WRAPPER_TAG . '.hookable', $definition); - - $definition = new Definition('Behat\Behat\Hook\Tester\HookableScenarioTester', array( - new Reference(TesterExtension::EXAMPLE_TESTER_ID), - new Reference(self::DISPATCHER_ID) - ) - ); - $definition->addTag(TesterExtension::EXAMPLE_TESTER_WRAPPER_TAG, array('priority' => 9999)); - $container->setDefinition(TesterExtension::EXAMPLE_TESTER_WRAPPER_TAG . '.hookable', $definition); - - $definition = new Definition('Behat\Behat\Hook\Tester\HookableStepTester', array( - new Reference(TesterExtension::STEP_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::STEP_TESTER_WRAPPER_TAG, array('priority' => 9999)); - $container->setDefinition(TesterExtension::STEP_TESTER_WRAPPER_TAG . '.hookable', $definition); - } - - /** - * Loads hook annotation reader. - * - * @param ContainerBuilder $container - */ - private function loadAnnotationReader(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Hook\Context\Annotation\HookAnnotationReader'); - $definition->addTag(ContextExtension::ANNOTATION_READER_TAG, array('priority' => 50)); - $container->setDefinition(ContextExtension::ANNOTATION_READER_TAG . '.hook', $definition); - } - - /** - * Loads hook attribute reader. - * - * @param ContainerBuilder $container - */ - private function loadAttributeReader(ContainerBuilder $container) - { - $definition = new Definition('\Behat\Behat\Hook\Context\Attribute\HookAttributeReader', array( - new Reference(DefinitionExtension::DOC_BLOCK_HELPER_ID) - )); - $definition->addTag(ContextExtension::ATTRIBUTE_READER_TAG, array('priority' => 50)); - $container->setDefinition(ContextExtension::ATTRIBUTE_READER_TAG . '.hook', $definition); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php deleted file mode 100644 index 288c6c0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableFeatureTester.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Tester; - -use Behat\Behat\Hook\Scope\AfterFeatureScope; -use Behat\Behat\Hook\Scope\BeforeFeatureScope; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Hook\HookDispatcher; -use Behat\Testwork\Hook\Tester\Setup\HookedSetup; -use Behat\Testwork\Hook\Tester\Setup\HookedTeardown; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\SpecificationTester; - -/** - * Feature tester which dispatches hooks during its execution. - * - * @author Konstantin Kudryashov - */ -final class HookableFeatureTester implements SpecificationTester -{ - /** - * @var SpecificationTester - */ - private $baseTester; - /** - * @var HookDispatcher - */ - private $hookDispatcher; - - /** - * Initializes tester. - * - * @param SpecificationTester $baseTester - * @param HookDispatcher $hookDispatcher - */ - public function __construct(SpecificationTester $baseTester, HookDispatcher $hookDispatcher) - { - $this->baseTester = $baseTester; - $this->hookDispatcher = $hookDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, $spec, $skip) - { - $setup = $this->baseTester->setUp($env, $spec, $skip); - - if ($skip) { - return $setup; - } - - $scope = new BeforeFeatureScope($env, $spec); - $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope); - - return new HookedSetup($setup, $hookCallResults); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, $spec, $skip) - { - return $this->baseTester->test($env, $spec, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, $spec, $skip, TestResult $result) - { - $teardown = $this->baseTester->tearDown($env, $spec, $skip, $result); - - if ($skip) { - return $teardown; - } - - $scope = new AfterFeatureScope($env, $spec, $result); - $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope); - - return new HookedTeardown($teardown, $hookCallResults); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableScenarioTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableScenarioTester.php deleted file mode 100644 index 2ec0c06..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableScenarioTester.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Tester; - -use Behat\Behat\Hook\Scope\AfterScenarioScope; -use Behat\Behat\Hook\Scope\BeforeScenarioScope; -use Behat\Behat\Tester\ScenarioTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface as Scenario; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Hook\HookDispatcher; -use Behat\Testwork\Hook\Tester\Setup\HookedSetup; -use Behat\Testwork\Hook\Tester\Setup\HookedTeardown; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Scenario tester which dispatches hooks during its execution. - * - * @author Konstantin Kudryashov - */ -final class HookableScenarioTester implements ScenarioTester -{ - /** - * @var ScenarioTester - */ - private $baseTester; - /** - * @var HookDispatcher - */ - private $hookDispatcher; - - /** - * Initializes tester. - * - * @param ScenarioTester $baseTester - * @param HookDispatcher $hookDispatcher - */ - public function __construct(ScenarioTester $baseTester, HookDispatcher $hookDispatcher) - { - $this->baseTester = $baseTester; - $this->hookDispatcher = $hookDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario, $skip) - { - $setup = $this->baseTester->setUp($env, $feature, $scenario, $skip); - - if ($skip) { - return $setup; - } - - $scope = new BeforeScenarioScope($env, $feature, $scenario); - $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope); - - return new HookedSetup($setup, $hookCallResults); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, Scenario $scenario, $skip) - { - return $this->baseTester->test($env, $feature, $scenario, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result) - { - $teardown = $this->baseTester->tearDown($env, $feature, $scenario, $skip, $result); - - if ($skip) { - return $teardown; - } - - $scope = new AfterScenarioScope($env, $feature, $scenario, $result); - $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope); - - return new HookedTeardown($teardown, $hookCallResults); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableStepTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableStepTester.php deleted file mode 100644 index 590d1f5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Hook/Tester/HookableStepTester.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Hook\Tester; - -use Behat\Behat\Hook\Scope\AfterStepScope; -use Behat\Behat\Hook\Scope\BeforeStepScope; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Behat\Tester\StepTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Hook\HookDispatcher; -use Behat\Testwork\Hook\Tester\Setup\HookedSetup; -use Behat\Testwork\Hook\Tester\Setup\HookedTeardown; - -/** - * Step tester which dispatches hooks during its execution. - * - * @author Konstantin Kudryashov - */ -final class HookableStepTester implements StepTester -{ - /** - * @var StepTester - */ - private $baseTester; - /** - * @var HookDispatcher - */ - private $hookDispatcher; - - /** - * Initializes tester. - * - * @param StepTester $baseTester - * @param HookDispatcher $hookDispatcher - */ - public function __construct(StepTester $baseTester, HookDispatcher $hookDispatcher) - { - $this->baseTester = $baseTester; - $this->hookDispatcher = $hookDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip) - { - $setup = $this->baseTester->setUp($env, $feature, $step, $skip); - - if ($skip) { - return $setup; - } - - $scope = new BeforeStepScope($env, $feature, $step); - $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope); - - return new HookedSetup($setup, $hookCallResults); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, StepNode $step, $skip) - { - return $this->baseTester->test($env, $feature, $step, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result) - { - $teardown = $this->baseTester->tearDown($env, $feature, $step, $skip, $result); - - if ($skip) { - return $teardown; - } - - $scope = new AfterStepScope($env, $feature, $step, $result); - $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope); - - return new HookedTeardown($teardown, $hookCallResults); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Exception/NodeVisitorNotFoundException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Exception/NodeVisitorNotFoundException.php deleted file mode 100644 index 5493bd6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Exception/NodeVisitorNotFoundException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Exception; - -use Behat\Testwork\Output\Exception\OutputException; -use InvalidArgumentException; - -/** - * Represents an exception caused by a request for non-existent node visitor. - * - * @author Konstantin Kudryashov - */ -class NodeVisitorNotFoundException extends InvalidArgumentException implements OutputException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php deleted file mode 100644 index 9487ecd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/FeatureListener.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\AST; - -use Behat\Behat\EventDispatcher\Event\AfterFeatureSetup; -use Behat\Behat\EventDispatcher\Event\AfterFeatureTested; -use Behat\Behat\EventDispatcher\Event\FeatureTested; -use Behat\Behat\Output\Node\Printer\FeaturePrinter; -use Behat\Behat\Output\Node\Printer\SetupPrinter; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Listens to feature events and calls appropriate printers. - * - * @author Konstantin Kudryashov - */ -final class FeatureListener implements EventListener -{ - /** - * @var FeaturePrinter - */ - private $featurePrinter; - /** - * @var SetupPrinter - */ - private $setupPrinter; - - /** - * Initializes listener. - * - * @param FeaturePrinter $featurePrinter - * @param SetupPrinter $setupPrinter - */ - public function __construct(FeaturePrinter $featurePrinter, SetupPrinter $setupPrinter) - { - $this->featurePrinter = $featurePrinter; - $this->setupPrinter = $setupPrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - if (!$event instanceof FeatureTested) { - return; - } - - $this->printHeaderOnBeforeEvent($formatter, $event); - $this->printFooterOnAfterEvent($formatter, $event); - } - - /** - * Prints feature header on BEFORE event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printHeaderOnBeforeEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterFeatureSetup) { - return; - } - - $this->setupPrinter->printSetup($formatter, $event->getSetup()); - $this->featurePrinter->printHeader($formatter, $event->getFeature()); - } - - /** - * Prints feature footer on AFTER event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printFooterOnAfterEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterFeatureTested) { - return; - } - - $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); - $this->featurePrinter->printFooter($formatter, $event->getTestResult()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php deleted file mode 100644 index 85b602b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/OutlineListener.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\AST; - -use Behat\Behat\EventDispatcher\Event\AfterOutlineTested; -use Behat\Behat\EventDispatcher\Event\AfterScenarioSetup; -use Behat\Behat\EventDispatcher\Event\AfterScenarioTested; -use Behat\Behat\EventDispatcher\Event\AfterStepSetup; -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\EventDispatcher\Event\BeforeOutlineTested; -use Behat\Behat\EventDispatcher\Event\ExampleTested; -use Behat\Behat\Output\Node\Printer\ExamplePrinter; -use Behat\Behat\Output\Node\Printer\OutlinePrinter; -use Behat\Behat\Output\Node\Printer\SetupPrinter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Gherkin\Node\ExampleNode; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Listens to expanded outline events and calls appropriate printers. - * - * @author Konstantin Kudryashov - */ -final class OutlineListener implements EventListener -{ - /** - * @var OutlinePrinter - */ - private $outlinePrinter; - /** - * @var ExamplePrinter - */ - private $examplePrinter; - /** - * @var StepPrinter - */ - private $stepPrinter; - /** - * @var SetupPrinter - */ - private $stepSetupPrinter; - /** - * @var SetupPrinter - */ - private $exampleSetupPrinter; - /** - * @var ExampleNode - */ - private $example; - - /** - * Initializes listener. - * - * @param OutlinePrinter $outlinePrinter - * @param ExamplePrinter $examplePrinter - * @param StepPrinter $stepPrinter - * @param SetupPrinter $exampleSetupPrinter - * @param SetupPrinter $stepSetupPrinter - */ - public function __construct( - OutlinePrinter $outlinePrinter, - ExamplePrinter $examplePrinter, - StepPrinter $stepPrinter, - SetupPrinter $exampleSetupPrinter, - SetupPrinter $stepSetupPrinter - ) { - $this->outlinePrinter = $outlinePrinter; - $this->examplePrinter = $examplePrinter; - $this->stepPrinter = $stepPrinter; - $this->exampleSetupPrinter = $exampleSetupPrinter; - $this->stepSetupPrinter = $stepSetupPrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->printAndCaptureOutlineHeaderOnBeforeEvent($formatter, $event); - $this->printAndForgetOutlineFooterOnAfterEvent($formatter, $event); - $this->printExampleHeaderOnBeforeExampleEvent($formatter, $event); - $this->printExampleFooterOnAfterExampleEvent($formatter, $event, $eventName); - $this->printStepSetupOnBeforeStepEvent($formatter, $event); - $this->printStepOnAfterStepEvent($formatter, $event); - } - - /** - * Prints outline header and captures outline into ivar on BEFORE event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printAndCaptureOutlineHeaderOnBeforeEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof BeforeOutlineTested) { - return; - } - - $this->outlinePrinter->printHeader($formatter, $event->getFeature(), $event->getOutline()); - } - - /** - * Prints outline footer and removes outline from ivar on AFTER event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printAndForgetOutlineFooterOnAfterEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterOutlineTested) { - return; - } - - $this->outlinePrinter->printFooter($formatter, $event->getTestResult()); - } - - /** - * Prints example header on example BEFORE event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printExampleHeaderOnBeforeExampleEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterScenarioSetup) { - return; - } - - $this->example = $event->getScenario(); - - $this->exampleSetupPrinter->printSetup($formatter, $event->getSetup()); - $this->examplePrinter->printHeader($formatter, $event->getFeature(), $this->example); - } - - /** - * Prints example footer on example AFTER event. - * - * @param Formatter $formatter - * @param Event $event - * @param string $eventName - */ - private function printExampleFooterOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName) - { - if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) { - return; - } - - $this->examplePrinter->printFooter($formatter, $event->getTestResult()); - $this->exampleSetupPrinter->printTeardown($formatter, $event->getTeardown()); - - $this->example = null; - } - - /** - * Prints step setup on step BEFORE event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printStepSetupOnBeforeStepEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterStepSetup) { - return; - } - - $this->stepSetupPrinter->printSetup($formatter, $event->getSetup()); - } - - /** - * Prints example step on step AFTER event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printStepOnAfterStepEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterStepTested) { - return; - } - - $this->stepPrinter->printStep($formatter, $this->example, $event->getStep(), $event->getTestResult()); - $this->stepSetupPrinter->printTeardown($formatter, $event->getTeardown()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php deleted file mode 100644 index 09a179b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/OutlineTableListener.php +++ /dev/null @@ -1,260 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\AST; - -use Behat\Behat\EventDispatcher\Event\AfterOutlineTested; -use Behat\Behat\EventDispatcher\Event\AfterScenarioSetup; -use Behat\Behat\EventDispatcher\Event\AfterScenarioTested; -use Behat\Behat\EventDispatcher\Event\AfterStepSetup; -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\EventDispatcher\Event\BeforeOutlineTested; -use Behat\Behat\EventDispatcher\Event\ExampleTested; -use Behat\Behat\EventDispatcher\Event\OutlineTested; -use Behat\Behat\EventDispatcher\Event\StepTested; -use Behat\Behat\Output\Node\Printer\ExampleRowPrinter; -use Behat\Behat\Output\Node\Printer\OutlineTablePrinter; -use Behat\Behat\Output\Node\Printer\SetupPrinter; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Listens to outline table events and calls appropriate printers. - * - * @author Konstantin Kudryashov - */ -final class OutlineTableListener implements EventListener -{ - /** - * @var OutlineTablePrinter - */ - private $tablePrinter; - /** - * @var ExampleRowPrinter - */ - private $exampleRowPrinter; - /** - * @var SetupPrinter - */ - private $stepSetupPrinter; - /** - * @var SetupPrinter - */ - private $exampleSetupPrinter; - /** - * @var OutlineNode - */ - private $outline; - /** - * @var Setup - */ - private $exampleSetup; - /** - * @var bool - */ - private $headerPrinted = false; - /** - * @var AfterStepSetup[] - */ - private $stepBeforeTestedEvents = array(); - /** - * @var AfterStepTested[] - */ - private $stepAfterTestedEvents = array(); - - /** - * Initializes listener. - * - * @param OutlineTablePrinter $tablePrinter - * @param ExampleRowPrinter $exampleRowPrinter - * @param SetupPrinter $exampleSetupPrinter - * @param SetupPrinter $stepSetupPrinter - */ - public function __construct( - OutlineTablePrinter $tablePrinter, - ExampleRowPrinter $exampleRowPrinter, - SetupPrinter $exampleSetupPrinter, - SetupPrinter $stepSetupPrinter - ) { - $this->tablePrinter = $tablePrinter; - $this->exampleRowPrinter = $exampleRowPrinter; - $this->exampleSetupPrinter = $exampleSetupPrinter; - $this->stepSetupPrinter = $stepSetupPrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - if ($event instanceof StepTested) { - $this->captureStepEvent($event); - - return; - } - - $this->captureOutlineOnBeforeOutlineEvent($event); - $this->forgetOutlineOnAfterOutlineEvent($eventName); - $this->captureExampleSetupOnBeforeEvent($event); - - $this->printHeaderOnAfterExampleEvent($formatter, $event, $eventName); - $this->printExampleRowOnAfterExampleEvent($formatter, $event, $eventName); - $this->printFooterOnAfterEvent($formatter, $event); - } - - /** - * Captures step tested event. - * - * @param StepTested $event - */ - private function captureStepEvent(StepTested $event) - { - if ($event instanceof AfterStepSetup) { - $this->stepBeforeTestedEvents[$event->getStep()->getLine()] = $event; - } else { - $this->stepAfterTestedEvents[$event->getStep()->getLine()] = $event; - } - } - - /** - * Captures outline into the ivar on outline BEFORE event. - * - * @param Event $event - */ - private function captureOutlineOnBeforeOutlineEvent(Event $event) - { - if (!$event instanceof BeforeOutlineTested) { - return; - } - - $this->outline = $event->getOutline(); - $this->headerPrinted = false; - } - - /** - * Captures example setup on example BEFORE event. - * - * @param Event $event - */ - private function captureExampleSetupOnBeforeEvent(Event $event) - { - if (!$event instanceof AfterScenarioSetup) { - return; - } - - $this->exampleSetup = $event->getSetup(); - } - - /** - * Removes outline from the ivar on outline AFTER event. - * - * @param string $eventName - */ - private function forgetOutlineOnAfterOutlineEvent($eventName) - { - if (OutlineTested::AFTER !== $eventName) { - return; - } - - $this->outline = null; - } - - /** - * Prints outline header (if has not been printed yet) on example AFTER event. - * - * @param Formatter $formatter - * @param Event $event - * @param string $eventName - */ - private function printHeaderOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName) - { - if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) { - return; - } - - if ($this->headerPrinted) { - return; - } - - $feature = $event->getFeature(); - $stepTestResults = $this->getStepTestResults(); - - $this->tablePrinter->printHeader($formatter, $feature, $this->outline, $stepTestResults); - $this->headerPrinted = true; - } - - /** - * Prints example row on example AFTER event. - * - * @param Formatter $formatter - * @param Event $event - * @param string $eventName - */ - private function printExampleRowOnAfterExampleEvent(Formatter $formatter, Event $event, $eventName) - { - if (!$event instanceof AfterScenarioTested || ExampleTested::AFTER !== $eventName) { - return; - } - - $example = $event->getScenario(); - - $this->exampleSetupPrinter->printSetup($formatter, $this->exampleSetup); - - foreach ($this->stepBeforeTestedEvents as $beforeEvent) { - $this->stepSetupPrinter->printSetup($formatter, $beforeEvent->getSetup()); - } - - $this->exampleRowPrinter->printExampleRow($formatter, $this->outline, $example, $this->stepAfterTestedEvents); - - foreach ($this->stepAfterTestedEvents as $afterEvent) { - $this->stepSetupPrinter->printTeardown($formatter, $afterEvent->getTeardown()); - } - - $this->exampleSetupPrinter->printTeardown($formatter, $event->getTeardown()); - - $this->exampleSetup = null; - $this->stepBeforeTestedEvents = array(); - $this->stepAfterTestedEvents = array(); - } - - /** - * Prints outline footer on outline AFTER event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printFooterOnAfterEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterOutlineTested) { - return; - } - - $this->tablePrinter->printFooter($formatter, $event->getTestResult()); - } - - /** - * Returns currently captured step events results. - * - * @return StepResult[] - */ - private function getStepTestResults() - { - return array_map( - function (AfterStepTested $event) { - return $event->getTestResult(); - }, - $this->stepAfterTestedEvents - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php deleted file mode 100644 index bcc9f20..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/ScenarioNodeListener.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\AST; - -use Behat\Behat\EventDispatcher\Event\ScenarioLikeTested; -use Behat\Behat\Output\Node\Printer\ScenarioPrinter; -use Behat\Behat\Output\Node\Printer\SetupPrinter; -use Behat\Testwork\Event\Event; -use Behat\Testwork\EventDispatcher\Event\AfterSetup; -use Behat\Testwork\EventDispatcher\Event\AfterTested; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Listens to scenario events and calls appropriate printers (header/footer). - * - * @author Konstantin Kudryashov - */ -final class ScenarioNodeListener implements EventListener -{ - /** - * @var string - */ - private $beforeEventName; - /** - * @var string - */ - private $afterEventName; - /** - * @var ScenarioPrinter - */ - private $scenarioPrinter; - /** - * @var SetupPrinter - */ - private $setupPrinter; - - /** - * Initializes listener. - * - * @param string $beforeEventName - * @param string $afterEventName - * @param ScenarioPrinter $scenarioPrinter - * @param null|SetupPrinter $setupPrinter - */ - public function __construct( - $beforeEventName, - $afterEventName, - ScenarioPrinter $scenarioPrinter, - SetupPrinter $setupPrinter = null - ) { - $this->beforeEventName = $beforeEventName; - $this->afterEventName = $afterEventName; - $this->scenarioPrinter = $scenarioPrinter; - $this->setupPrinter = $setupPrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - if (!$event instanceof ScenarioLikeTested) { - return; - } - - $this->printHeaderOnBeforeEvent($formatter, $event, $eventName); - $this->printFooterOnAfterEvent($formatter, $event, $eventName); - } - - /** - * Prints scenario/background header on BEFORE event. - * - * @param Formatter $formatter - * @param ScenarioLikeTested|AfterSetup $event - * @param string $eventName - */ - private function printHeaderOnBeforeEvent(Formatter $formatter, ScenarioLikeTested $event, $eventName) - { - if ($this->beforeEventName !== $eventName || !$event instanceof AfterSetup) { - return; - } - - if ($this->setupPrinter) { - $this->setupPrinter->printSetup($formatter, $event->getSetup()); - } - - $this->scenarioPrinter->printHeader($formatter, $event->getFeature(), $event->getScenario()); - } - - /** - * Prints scenario/background footer on AFTER event. - * - * @param Formatter $formatter - * @param ScenarioLikeTested|AfterTested $event - * @param string $eventName - */ - private function printFooterOnAfterEvent(Formatter $formatter, ScenarioLikeTested $event, $eventName) - { - if ($this->afterEventName !== $eventName || !$event instanceof AfterTested) { - return; - } - - if ($this->setupPrinter) { - $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); - } - - $this->scenarioPrinter->printFooter($formatter, $event->getTestResult()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php deleted file mode 100644 index dda597b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/StepListener.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\AST; - -use Behat\Behat\EventDispatcher\Event\AfterStepSetup; -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\EventDispatcher\Event\ExampleTested; -use Behat\Behat\EventDispatcher\Event\ScenarioLikeTested; -use Behat\Behat\EventDispatcher\Event\ScenarioTested; -use Behat\Behat\Output\Node\Printer\SetupPrinter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Gherkin\Node\ScenarioLikeInterface; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Listens to step events and call appropriate printers. - * - * @author Konstantin Kudryashov - */ -final class StepListener implements EventListener -{ - /** - * @var StepPrinter - */ - private $stepPrinter; - /** - * @var ScenarioLikeInterface - */ - private $scenario; - /** - * @var null|SetupPrinter - */ - private $setupPrinter; - - /** - * Initializes listener. - * - * @param StepPrinter $stepPrinter - * @param null|SetupPrinter $setupPrinter - */ - public function __construct(StepPrinter $stepPrinter, SetupPrinter $setupPrinter = null) - { - $this->stepPrinter = $stepPrinter; - $this->setupPrinter = $setupPrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->captureScenarioOnScenarioEvent($event); - $this->forgetScenarioOnAfterEvent($eventName); - $this->printStepSetupOnBeforeEvent($formatter, $event); - $this->printStepOnAfterEvent($formatter, $event); - } - - /** - * Captures scenario into the ivar on scenario/background/example BEFORE event. - * - * @param Event $event - */ - private function captureScenarioOnScenarioEvent(Event $event) - { - if (!$event instanceof ScenarioLikeTested) { - return; - } - - $this->scenario = $event->getScenario(); - } - - /** - * Removes scenario from the ivar on scenario/background/example AFTER event. - * - * @param string $eventName - */ - private function forgetScenarioOnAfterEvent($eventName) - { - if (!in_array($eventName, array(ScenarioTested::AFTER, ExampleTested::AFTER))) { - return; - } - - $this->scenario = null; - } - - private function printStepSetupOnBeforeEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterStepSetup) { - return; - } - - if ($this->setupPrinter) { - $this->setupPrinter->printSetup($formatter, $event->getSetup()); - } - } - - /** - * Prints step on AFTER event. - * - * @param Formatter $formatter - * @param Event $event - */ - private function printStepOnAfterEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterStepTested) { - return; - } - - $this->stepPrinter->printStep($formatter, $this->scenario, $event->getStep(), $event->getTestResult()); - - if ($this->setupPrinter) { - $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php deleted file mode 100644 index 71ee608..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/AST/SuiteListener.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\AST; - -use Behat\Behat\Output\Node\Printer\SetupPrinter; -use Behat\Testwork\Event\Event; -use Behat\Testwork\EventDispatcher\Event\AfterSuiteSetup; -use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Behat suite listener. - * - * @author Konstantin Kudryashov - */ -final class SuiteListener implements EventListener -{ - /** - * @var SetupPrinter - */ - private $setupPrinter; - - /** - * Initializes listener. - * - * @param SetupPrinter $setupPrinter - */ - public function __construct(SetupPrinter $setupPrinter) - { - $this->setupPrinter = $setupPrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - if ($event instanceof AfterSuiteSetup) { - $this->setupPrinter->printSetup($formatter, $event->getSetup()); - } - - if ($event instanceof AfterSuiteTested) { - $this->setupPrinter->printTeardown($formatter, $event->getTeardown()); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php deleted file mode 100644 index 243b200..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/FireOnlySiblingsListener.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\Flow; - -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Behat fire only siblings listener. - * - * This listener catches all events, but proxies them to further listeners only if they - * live inside specific event lifecycle (between BEFORE and AFTER events). - * - * @author Konstantin Kudryashov - */ -class FireOnlySiblingsListener implements EventListener -{ - /** - * @var string - */ - private $beforeEventName; - /** - * @var string - */ - private $afterEventName; - /** - * @var EventListener - */ - private $descendant; - /** - * @var bool - */ - private $inContext = false; - - /** - * Initializes listener. - * - * @param string $beforeEventName - * @param string $afterEventName - * @param EventListener $descendant - */ - public function __construct($beforeEventName, $afterEventName, EventListener $descendant) - { - $this->beforeEventName = $beforeEventName; - $this->afterEventName = $afterEventName; - $this->descendant = $descendant; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - if ($this->beforeEventName === $eventName) { - $this->inContext = true; - } - - if ($this->inContext) { - $this->descendant->listenEvent($formatter, $event, $eventName); - } - - if ($this->afterEventName === $eventName) { - $this->inContext = false; - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php deleted file mode 100644 index 7898362..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/FirstBackgroundFiresFirstListener.php +++ /dev/null @@ -1,137 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\Flow; - -use Behat\Behat\EventDispatcher\Event\BackgroundTested; -use Behat\Behat\EventDispatcher\Event\ExampleTested; -use Behat\Behat\EventDispatcher\Event\FeatureTested; -use Behat\Behat\EventDispatcher\Event\OutlineTested; -use Behat\Behat\EventDispatcher\Event\ScenarioTested; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Behat first background fires first listener. - * - * This listener catches first scenario and background events in the feature and makes sure - * that background event are always fired before scenario events, thus following Gherkin format. - * - * @author Konstantin Kudryashov - */ -class FirstBackgroundFiresFirstListener implements EventListener -{ - /** - * @var \Behat\Testwork\Output\Node\EventListener\EventListener - */ - private $descendant; - /** - * @var bool - */ - private $firstBackgroundEnded = false; - /** - * @var Event[] - */ - private $delayedUntilBackgroundEnd = array(); - - /** - * Initializes listener. - * - * @param EventListener $descendant - */ - public function __construct(EventListener $descendant) - { - $this->descendant = $descendant; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->flushStatesIfBeginningOfTheFeature($eventName); - $this->markFirstBackgroundPrintedAfterBackground($eventName); - - if ($this->isEventDelayedUntilFirstBackgroundPrinted($event)) { - $this->delayedUntilBackgroundEnd[] = array($event, $eventName); - - return; - } - - $this->descendant->listenEvent($formatter, $event, $eventName); - $this->fireDelayedEventsOnAfterBackground($formatter, $eventName); - } - - /** - * Flushes state if the event is the BEFORE feature. - * - * @param string $eventName - */ - private function flushStatesIfBeginningOfTheFeature($eventName) - { - if (FeatureTested::BEFORE !== $eventName) { - return; - } - - $this->firstBackgroundEnded = false; - } - - /** - * Marks first background printed. - * - * @param string $eventName - */ - private function markFirstBackgroundPrintedAfterBackground($eventName) - { - if (BackgroundTested::AFTER !== $eventName) { - return; - } - - $this->firstBackgroundEnded = true; - } - - /** - * Checks if provided event should be postponed until background is printed. - * - * @param Event $event - * - * @return bool - */ - private function isEventDelayedUntilFirstBackgroundPrinted(Event $event) - { - if (!$event instanceof ScenarioTested && !$event instanceof OutlineTested && !$event instanceof ExampleTested) { - return false; - } - - return !$this->firstBackgroundEnded && $event->getFeature()->hasBackground(); - } - - /** - * Fires delayed events on AFTER background event. - * - * @param Formatter $formatter - * @param string $eventName - */ - private function fireDelayedEventsOnAfterBackground(Formatter $formatter, $eventName) - { - if (BackgroundTested::AFTER !== $eventName) { - return; - } - - foreach ($this->delayedUntilBackgroundEnd as $eventInfo) { - list($event, $eventName) = $eventInfo; - - $this->descendant->listenEvent($formatter, $event, $eventName); - } - - $this->delayedUntilBackgroundEnd = array(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php deleted file mode 100644 index 9bb7382..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Flow/OnlyFirstBackgroundFiresListener.php +++ /dev/null @@ -1,202 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\Flow; - -use Behat\Behat\EventDispatcher\Event\AfterStepSetup; -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\EventDispatcher\Event\BackgroundTested; -use Behat\Behat\EventDispatcher\Event\FeatureTested; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Behat only first background fires listener. - * - * This listener catches all in-background events and then proxies them further - * only if they meet one of two conditions: - * - * 1. It is a first background - * 2. It is a failing step - * - * @author Konstantin Kudryashov - */ -class OnlyFirstBackgroundFiresListener implements EventListener -{ - /** - * @var EventListener - */ - private $descendant; - /** - * @var bool - */ - private $firstBackgroundEnded = false; - /** - * @var bool - */ - private $inBackground = false; - /** - * @var bool - */ - private $stepSetupHadOutput = false; - - /** - * Initializes listener. - * - * @param EventListener $descendant - */ - public function __construct(EventListener $descendant) - { - $this->descendant = $descendant; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->flushStatesIfBeginningOfTheFeature($eventName); - $this->markBeginningOrEndOfTheBackground($eventName); - - if ($this->isSkippableEvent($event)) { - return; - } - - $this->markFirstBackgroundPrintedAfterBackground($eventName); - - $this->descendant->listenEvent($formatter, $event, $eventName); - } - - /** - * Flushes state if the event is the BEFORE feature. - * - * @param string $eventName - */ - private function flushStatesIfBeginningOfTheFeature($eventName) - { - if (FeatureTested::BEFORE !== $eventName) { - return; - } - - $this->firstBackgroundEnded = false; - $this->inBackground = false; - } - - /** - * Marks beginning or end of the background. - * - * @param string $eventName - */ - private function markBeginningOrEndOfTheBackground($eventName) - { - if (BackgroundTested::BEFORE === $eventName) { - $this->inBackground = true; - } - - if (BackgroundTested::AFTER === $eventName) { - $this->inBackground = false; - } - } - - /** - * Marks first background printed. - * - * @param string $eventName - */ - private function markFirstBackgroundPrintedAfterBackground($eventName) - { - if (BackgroundTested::AFTER !== $eventName) { - return; - } - - $this->firstBackgroundEnded = true; - } - - /** - * Checks if provided event is skippable. - * - * @param Event $event - * - * @return bool - */ - private function isSkippableEvent(Event $event) - { - if (!$this->firstBackgroundEnded) { - return false; - } - - return $event instanceof BackgroundTested || $this->isNonFailingConsequentBackgroundStep($event); - } - - /** - * Checks if provided event is a non-failing step in consequent background. - * - * @param Event $event - * - * @return bool - */ - private function isNonFailingConsequentBackgroundStep(Event $event) - { - if (!$this->inBackground) { - return false; - } - - return !$this->isStepEventWithOutput($event); - } - - /** - * Checks if provided event is a step event which setup or teardown produced any output. - * - * @param Event $event - * - * @return bool - */ - private function isStepEventWithOutput(Event $event) - { - return $this->isBeforeStepEventWithOutput($event) || $this->isAfterStepWithOutput($event); - } - - /** - * Checks if provided event is a BEFORE step with setup that produced output. - * - * @param Event $event - * - * @return bool - */ - private function isBeforeStepEventWithOutput(Event $event) - { - if ($event instanceof AfterStepSetup && $event->hasOutput()) { - $this->stepSetupHadOutput = true; - - return true; - } - - return false; - } - - /** - * Checks if provided event is an AFTER step with teardown that produced output. - * - * @param Event $event - * - * @return bool - */ - private function isAfterStepWithOutput(Event $event) - { - if ($event instanceof AfterStepTested && ($this->stepSetupHadOutput || $event->hasOutput())) { - $this->stepSetupHadOutput = false; - - return true; - } - - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php deleted file mode 100644 index 2aae5a2..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php +++ /dev/null @@ -1,193 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\JUnit; - -use Behat\Behat\EventDispatcher\Event\AfterFeatureTested; -use Behat\Behat\EventDispatcher\Event\AfterScenarioTested; -use Behat\Behat\EventDispatcher\Event\AfterStepSetup; -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\EventDispatcher\Event\BeforeFeatureTested; -use Behat\Behat\EventDispatcher\Event\ScenarioTested; -use Behat\Behat\EventDispatcher\Event\StepTested; -use Behat\Behat\Output\Node\Printer\FeaturePrinter; -use Behat\Behat\Output\Node\Printer\JUnit\JUnitScenarioPrinter; -use Behat\Behat\Output\Node\Printer\SetupPrinter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Event\Event; -use Behat\Testwork\EventDispatcher\Event\AfterSetup; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Listens to feature, scenario and step events and calls appropriate printers. - * - * @author Wouter J - */ -final class JUnitFeatureElementListener implements EventListener -{ - /** - * @var FeaturePrinter - */ - private $featurePrinter; - /** - * @var JUnitScenarioPrinter - */ - private $scenarioPrinter; - /** - * @var StepPrinter - */ - private $stepPrinter; - /** - * @var SetupPrinter - */ - private $setupPrinter; - /** - * @var FeatureNode - */ - private $beforeFeatureTestedEvent; - /** - * @var AfterScenarioTested[] - */ - private $afterScenarioTestedEvents = array(); - /** - * @var AfterStepTested[] - */ - private $afterStepTestedEvents = array(); - /** - * @var AfterSetup[] - */ - private $afterStepSetupEvents = array(); - - /** - * Initializes listener. - * - * @param FeaturePrinter $featurePrinter - * @param JUnitScenarioPrinter $scenarioPrinter - * @param StepPrinter $stepPrinter - * @param SetupPrinter $setupPrinter - */ - public function __construct(FeaturePrinter $featurePrinter, - JUnitScenarioPrinter $scenarioPrinter, - StepPrinter $stepPrinter, - SetupPrinter $setupPrinter) - { - $this->featurePrinter = $featurePrinter; - $this->scenarioPrinter = $scenarioPrinter; - $this->stepPrinter = $stepPrinter; - $this->setupPrinter = $setupPrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - if ($event instanceof ScenarioTested) { - $this->captureScenarioEvent($event); - } - - if ($event instanceof StepTested - || $event instanceof AfterStepSetup - ) { - $this->captureStepEvent($event); - } - - $this->captureFeatureOnBeforeEvent($event); - $this->printFeatureOnAfterEvent($formatter, $event); - } - - /** - * Captures scenario tested event. - * - * @param ScenarioTested $event - */ - private function captureScenarioEvent(ScenarioTested $event) - { - if ($event instanceof AfterScenarioTested) { - $this->afterScenarioTestedEvents[$event->getScenario()->getLine()] = array( - 'event' => $event, - 'step_events' => $this->afterStepTestedEvents, - 'step_setup_events' => $this->afterStepSetupEvents, - ); - - $this->afterStepTestedEvents = array(); - $this->afterStepSetupEvents = array(); - } - } - - /** - * Captures feature on BEFORE event. - * - * @param Event $event - */ - private function captureFeatureOnBeforeEvent(Event $event) - { - if (!$event instanceof BeforeFeatureTested) { - return; - } - - $this->beforeFeatureTestedEvent = $event->getFeature(); - } - - /** - * Captures step tested event. - * - * @param Event $event - */ - private function captureStepEvent(Event $event) - { - if ($event instanceof AfterStepTested) { - $this->afterStepTestedEvents[$event->getStep()->getLine()] = $event; - } - if ($event instanceof AfterStepSetup) { - $this->afterStepSetupEvents[$event->getStep()->getLine()] = $event; - } - } - - /** - * Prints the feature on AFTER event. - * - * @param Formatter $formatter - * @param Event $event - */ - public function printFeatureOnAfterEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterFeatureTested) { - return; - } - - $this->featurePrinter->printHeader($formatter, $this->beforeFeatureTestedEvent); - - foreach ($this->afterScenarioTestedEvents as $afterScenario) { - $afterScenarioTested = $afterScenario['event']; - $this->scenarioPrinter->printOpenTag( - $formatter, - $afterScenarioTested->getFeature(), - $afterScenarioTested->getScenario(), - $afterScenarioTested->getTestResult(), - $event->getFeature()->getFile() - ); - - /** @var AfterStepSetup $afterStepSetup */ - foreach ($afterScenario['step_setup_events'] as $afterStepSetup) { - $this->setupPrinter->printSetup($formatter, $afterStepSetup->getSetup()); - } - foreach ($afterScenario['step_events'] as $afterStepTested) { - $this->stepPrinter->printStep($formatter, $afterScenarioTested->getScenario(), $afterStepTested->getStep(), $afterStepTested->getTestResult()); - $this->setupPrinter->printTeardown($formatter, $afterStepTested->getTeardown()); - } - } - - $this->featurePrinter->printFooter($formatter, $event->getTestResult()); - $this->afterScenarioTestedEvents = array(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php deleted file mode 100644 index 530a6ca..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitOutlineStoreListener.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\JUnit; - -use Behat\Behat\EventDispatcher\Event\BeforeOutlineTested; -use Behat\Behat\Output\Node\Printer\SuitePrinter; -use Behat\Gherkin\Node\ExampleNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Event\Event; -use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested; -use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTested; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Listens for Outline events store the current one - * - * @author James Watson - */ -final class JUnitOutlineStoreListener implements EventListener -{ - - /** - * @var SuitePrinter - */ - private $suitePrinter; - - /** - * @var array - */ - private $lineScenarioMap = array(); - - /** - * Initializes listener. - * - * @param SuitePrinter $suitePrinter - */ - public function __construct(SuitePrinter $suitePrinter) - { - $this->suitePrinter = $suitePrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->captureOutlineOnBeforeOutlineEvent($event); - - $this->printHeaderOnBeforeSuiteTestedEvent($formatter, $event); - $this->printFooterOnAfterSuiteTestedEvent($formatter, $event); - } - - /** - * Captures outline into the ivar on outline BEFORE event. - * - * @param Event $event - */ - private function captureOutlineOnBeforeOutlineEvent(Event $event) - { - if (!$event instanceof BeforeOutlineTested) { - return; - } - - $outline = $event->getOutline(); - foreach ($outline->getExamples() as $example) { - $this->lineScenarioMap[$example->getLine()] = $outline; - } - } - - /** - * @param Formatter $formatter - * @param Event $event - */ - private function printHeaderOnBeforeSuiteTestedEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof BeforeSuiteTested) { - return; - } - $this->suitePrinter->printHeader($formatter, $event->getSuite()); - } - - /** - * @param Formatter $formatter - * @param Event $event - */ - private function printFooterOnAfterSuiteTestedEvent(Formatter $formatter, Event $event) - { - if (!$event instanceof AfterSuiteTested) { - return; - } - $this->suitePrinter->printFooter($formatter, $event->getSuite()); - } - - /** - * @param ExampleNode $scenario - * @return OutlineNode - */ - public function getCurrentOutline(ExampleNode $scenario) - { - return $this->lineScenarioMap[$scenario->getLine()]; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php deleted file mode 100644 index a4c9b77..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/HookStatsListener.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\Statistics; - -use Behat\Behat\Output\Statistics\HookStat; -use Behat\Behat\Output\Statistics\Statistics; -use Behat\Testwork\Call\CallResult; -use Behat\Testwork\Event\Event; -use Behat\Testwork\EventDispatcher\Event\AfterSetup; -use Behat\Testwork\EventDispatcher\Event\AfterTested; -use Behat\Testwork\Exception\ExceptionPresenter; -use Behat\Testwork\Hook\Tester\Setup\HookedSetup; -use Behat\Testwork\Hook\Tester\Setup\HookedTeardown; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Listens and records hook stats. - * - * @author Konstantin Kudryashov - */ -final class HookStatsListener implements EventListener -{ - /** - * @var Statistics - */ - private $statistics; - /** - * @var ExceptionPresenter - */ - private $exceptionPresenter; - - /** - * Initializes listener. - * - * @param Statistics $statistics - * @param ExceptionPresenter $exceptionPresenter - */ - public function __construct(Statistics $statistics, ExceptionPresenter $exceptionPresenter) - { - $this->statistics = $statistics; - $this->exceptionPresenter = $exceptionPresenter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->captureHookStatsOnEvent($event); - } - - /** - * Captures hook stats on hooked event. - * - * @param Event $event - */ - private function captureHookStatsOnEvent(Event $event) - { - if ($event instanceof AfterSetup && $event->getSetup() instanceof HookedSetup) { - $this->captureBeforeHookStats($event->getSetup()); - } - - if ($event instanceof AfterTested && $event->getTeardown() instanceof HookedTeardown) { - $this->captureAfterHookStats($event->getTeardown()); - } - } - - /** - * Captures before hook stats. - * - * @param HookedSetup $setup - */ - private function captureBeforeHookStats(HookedSetup $setup) - { - $hookCallResults = $setup->getHookCallResults(); - - foreach ($hookCallResults as $hookCallResult) { - $this->captureHookStat($hookCallResult); - } - } - - /** - * Captures before hook stats. - * - * @param HookedTeardown $teardown - */ - private function captureAfterHookStats(HookedTeardown $teardown) - { - $hookCallResults = $teardown->getHookCallResults(); - - foreach ($hookCallResults as $hookCallResult) { - $this->captureHookStat($hookCallResult); - } - } - - /** - * Captures hook call result. - * - * @param CallResult $hookCallResult - */ - private function captureHookStat(CallResult $hookCallResult) - { - $callee = $hookCallResult->getCall()->getCallee(); - $hook = (string) $callee; - $path = $callee->getPath(); - $stdOut = $hookCallResult->getStdOut(); - $error = $hookCallResult->getException() - ? $this->exceptionPresenter->presentException($hookCallResult->getException()) - : null; - - $stat = new HookStat($hook, $path, $error, $stdOut); - $this->statistics->registerHookStat($stat); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php deleted file mode 100644 index ce94b2b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/ScenarioStatsListener.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\Statistics; - -use Behat\Behat\EventDispatcher\Event\AfterFeatureTested; -use Behat\Behat\EventDispatcher\Event\AfterScenarioTested; -use Behat\Behat\EventDispatcher\Event\BeforeFeatureTested; -use Behat\Behat\Output\Statistics\ScenarioStat; -use Behat\Behat\Output\Statistics\Statistics; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Listens and records scenario events to the statistics. - * - * @author Konstantin Kudryashov - */ -final class ScenarioStatsListener implements EventListener -{ - /** - * @var Statistics - */ - private $statistics; - /** - * @var string - */ - private $currentFeaturePath; - - /** - * Initializes listener. - * - * @param Statistics $statistics - */ - public function __construct(Statistics $statistics) - { - $this->statistics = $statistics; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->captureCurrentFeaturePathOnBeforeFeatureEvent($event); - $this->forgetCurrentFeaturePathOnAfterFeatureEvent($event); - $this->captureScenarioOrExampleStatsOnAfterEvent($event); - } - - /** - * Captures current feature file path to the ivar on feature BEFORE event. - * - * @param Event $event - */ - private function captureCurrentFeaturePathOnBeforeFeatureEvent(Event $event) - { - if (!$event instanceof BeforeFeatureTested) { - return; - } - - $this->currentFeaturePath = $event->getFeature()->getFile(); - } - - /** - * Removes current feature file path from the ivar on feature AFTER event. - * - * @param Event $event - */ - private function forgetCurrentFeaturePathOnAfterFeatureEvent($event) - { - if (!$event instanceof AfterFeatureTested) { - return; - } - - $this->currentFeaturePath = null; - } - - /** - * Captures scenario or example stats on their AFTER event. - * - * @param Event $event - */ - private function captureScenarioOrExampleStatsOnAfterEvent(Event $event) - { - if (!$event instanceof AfterScenarioTested) { - return; - } - - $scenario = $event->getScenario(); - $title = $scenario->getTitle(); - $path = sprintf('%s:%d', $this->currentFeaturePath, $scenario->getLine()); - $resultCode = $event->getTestResult()->getResultCode(); - - $stat = new ScenarioStat($title, $path, $resultCode); - $this->statistics->registerScenarioStat($stat); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php deleted file mode 100644 index 763eb76..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/StatisticsListener.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\Statistics; - -use Behat\Behat\Output\Node\Printer\StatisticsPrinter; -use Behat\Behat\Output\Statistics\Statistics; -use Behat\Testwork\Event\Event; -use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Collects general suite stats such as time and memory during its execution and prints it afterwards. - * - * @author Konstantin Kudryashov - */ -final class StatisticsListener implements EventListener -{ - /** - * @var Statistics - */ - private $statistics; - /** - * @var StatisticsPrinter - */ - private $printer; - - /** - * Initializes listener. - * - * @param Statistics $statistics - * @param StatisticsPrinter $statisticsPrinter - */ - public function __construct(Statistics $statistics, StatisticsPrinter $statisticsPrinter) - { - $this->statistics = $statistics; - $this->printer = $statisticsPrinter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->startTimerOnBeforeExercise($eventName); - $this->printStatisticsOnAfterExerciseEvent($formatter, $eventName); - } - - /** - * Starts timer on exercise BEFORE event. - * - * @param string $eventName - */ - private function startTimerOnBeforeExercise($eventName) - { - if (ExerciseCompleted::BEFORE !== $eventName) { - return; - } - - $this->statistics->startTimer(); - } - - /** - * Prints statistics on after exercise event. - * - * @param Formatter $formatter - * @param string $eventName - */ - private function printStatisticsOnAfterExerciseEvent(Formatter $formatter, $eventName) - { - if (ExerciseCompleted::AFTER !== $eventName) { - return; - } - - $this->statistics->stopTimer(); - $this->printer->printStatistics($formatter, $this->statistics); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php deleted file mode 100644 index 2e4a2f7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/EventListener/Statistics/StepStatsListener.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\EventListener\Statistics; - -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\EventDispatcher\Event\BeforeFeatureTested; -use Behat\Behat\EventDispatcher\Event\BeforeScenarioTested; -use Behat\Behat\EventDispatcher\Event\FeatureTested; -use Behat\Behat\EventDispatcher\Event\ScenarioTested; -use Behat\Behat\Output\Statistics\StepStatV2; -use Behat\Behat\Output\Statistics\Statistics; -use Behat\Behat\Tester\Exception\PendingException; -use Behat\Behat\Tester\Result\ExecutedStepResult; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Exception\ExceptionPresenter; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; -use Behat\Testwork\Tester\Result\ExceptionResult; -use Exception; - -/** - * Listens and records step events to statistics. - * - * @author Konstantin Kudryashov - */ -final class StepStatsListener implements EventListener -{ - /** - * @var Statistics - */ - private $statistics; - /** - * @var string - */ - private $currentFeaturePath; - /** - * @var ExceptionPresenter - */ - private $exceptionPresenter; - /** - * @var string - */ - private $scenarioTitle; - /** - * @var string - */ - private $scenarioPath; - - /** - * Initializes listener. - * - * @param Statistics $statistics - * @param ExceptionPresenter $exceptionPresenter - */ - public function __construct(Statistics $statistics, ExceptionPresenter $exceptionPresenter) - { - $this->statistics = $statistics; - $this->exceptionPresenter = $exceptionPresenter; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - $this->captureCurrentFeaturePathOnBeforeFeatureEvent($event); - $this->forgetCurrentFeaturePathOnAfterFeatureEvent($eventName); - $this->captureScenarioOnBeforeFeatureEvent($event); - $this->forgetScenarioOnAfterFeatureEvent($eventName); - $this->captureStepStatsOnAfterEvent($event); - } - - /** - * Captures current feature file path to the ivar on feature BEFORE event. - * - * @param Event $event - */ - private function captureCurrentFeaturePathOnBeforeFeatureEvent(Event $event) - { - if (!$event instanceof BeforeFeatureTested) { - return; - } - - $this->currentFeaturePath = $event->getFeature()->getFile(); - } - - /** - * Removes current feature file path from the ivar on feature AFTER event. - * - * @param string $eventName - */ - private function forgetCurrentFeaturePathOnAfterFeatureEvent($eventName) - { - if (FeatureTested::AFTER !== $eventName) { - return; - } - - $this->currentFeaturePath = null; - } - - /** - * Captures current scenario title and path on scenario BEFORE event. - * - * @param Event $event - */ - private function captureScenarioOnBeforeFeatureEvent(Event $event) - { - if (!$event instanceof BeforeScenarioTested) { - return; - } - - $this->scenarioTitle = sprintf('%s: %s', $event->getScenario()->getKeyword(), $event->getScenario()->getTitle()); - $this->scenarioPath = sprintf('%s:%s', $this->currentFeaturePath, $event->getScenario()->getLine()); - } - - private function forgetScenarioOnAfterFeatureEvent($eventName) - { - if (ScenarioTested::AFTER !== $eventName) { - return; - } - - $this->scenarioTitle = $this->scenarioPath = null; - } - - /** - * Captures step stats on step AFTER event. - * - * @param Event $event - */ - private function captureStepStatsOnAfterEvent(Event $event) - { - if (!$event instanceof AfterStepTested) { - return; - } - - $result = $event->getTestResult(); - $step = $event->getStep(); - $text = sprintf('%s %s', $step->getKeyword(), $step->getText()); - $exception = $this->getStepException($result); - - $path = $this->getStepPath($event, $exception); - $error = $exception ? $this->exceptionPresenter->presentException($exception) : null; - $stdOut = $result instanceof ExecutedStepResult ? $result->getCallResult()->getStdOut() : null; - - $resultCode = $result->getResultCode(); - $stat = new StepStatV2($this->scenarioTitle, $this->scenarioPath, $text, $path, $resultCode, $error, $stdOut); - - $this->statistics->registerStepStat($stat); - } - - /** - * Gets exception from the step test results. - * - * @param StepResult $result - * - * @return null|Exception - */ - private function getStepException(StepResult $result) - { - if ($result instanceof ExceptionResult) { - return $result->getException(); - } - - return null; - } - - /** - * Gets step path from the AFTER test event and exception. - * - * @param AfterStepTested $event - * @param null|Exception $exception - * - * @return string - */ - private function getStepPath(AfterStepTested $event, Exception $exception = null) - { - $path = sprintf('%s:%d', $this->currentFeaturePath, $event->getStep()->getLine()); - - if ($exception && $exception instanceof PendingException) { - $path = $event->getTestResult()->getStepDefinition()->getPath(); - } - - return $path; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php deleted file mode 100644 index 92954c3..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/CounterPrinter.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Behat\Definition\Translator\TranslatorInterface; -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Testwork\Output\Printer\OutputPrinter; - -/** - * Behat counter printer. - * - * @author Konstantin Kudryashov - */ -final class CounterPrinter -{ - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * Initializes printer. - * - * @param ResultToStringConverter $resultConverter - * @param TranslatorInterface $translator - */ - public function __construct(ResultToStringConverter $resultConverter, TranslatorInterface $translator) - { - $this->resultConverter = $resultConverter; - $this->translator = $translator; - } - - /** - * Prints scenario and step counters. - * - * @param OutputPrinter $printer - * @param string $intro - * @param array $stats - */ - public function printCounters(OutputPrinter $printer, $intro, array $stats) - { - $stats = array_filter($stats, function ($count) { return 0 !== $count; }); - - if (0 === count($stats)) { - $totalCount = 0; - } else { - $totalCount = array_sum($stats); - } - - $detailedStats = array(); - foreach ($stats as $resultCode => $count) { - $style = $this->resultConverter->convertResultCodeToString($resultCode); - - $transId = $style . '_count'; - $message = $this->translator->trans($transId, array('%count%' => $count), 'output'); - - $detailedStats[] = sprintf('{+%s}%s{-%s}', $style, $message, $style); - } - - $message = $this->translator->trans($intro, array('%count%' => $totalCount), 'output'); - $printer->write($message); - - if (count($detailedStats)) { - $printer->write(sprintf(' (%s)', implode(', ', $detailedStats))); - } - - $printer->writeln(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ExamplePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ExamplePrinter.php deleted file mode 100644 index 048f547..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ExamplePrinter.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Gherkin\Node\ExampleNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints example headers and footers. - * - * @author Konstantin Kudryashov - */ -interface ExamplePrinter -{ - /** - * Prints example header using provided printer. - * - * @param Formatter $formatter - * @param FeatureNode $feature - * @param ExampleNode $example - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, ExampleNode $example); - - /** - * Prints example footer using provided printer. - * - * @param Formatter $formatter - * @param TestResult $result - */ - public function printFooter(Formatter $formatter, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ExampleRowPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ExampleRowPrinter.php deleted file mode 100644 index 1b52997..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ExampleRowPrinter.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Gherkin\Node\ExampleNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Output\Formatter; - -/** - * Prints outline example row results. - * - * @author Konstantin Kudryashov - */ -interface ExampleRowPrinter -{ - /** - * Prints example row result using provided printer. - * - * @param Formatter $formatter - * @param OutlineNode $outline - * @param ExampleNode $example - * @param AfterStepTested[] $events - */ - public function printExampleRow(Formatter $formatter, OutlineNode $outline, ExampleNode $example, array $events); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/FeaturePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/FeaturePrinter.php deleted file mode 100644 index 699615f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/FeaturePrinter.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints feature headers and footers. - * - * @author Konstantin Kudryashov - */ -interface FeaturePrinter -{ - /** - * Prints feature header using provided formatter. - * - * @param Formatter $formatter - * @param FeatureNode $feature - */ - public function printHeader(Formatter $formatter, FeatureNode $feature); - - /** - * Prints feature footer using provided printer. - * - * @param Formatter $formatter - * @param TestResult $result - */ - public function printFooter(Formatter $formatter, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/ResultToStringConverter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/ResultToStringConverter.php deleted file mode 100644 index dabddfd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/ResultToStringConverter.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Helper; - -use Behat\Behat\Tester\Result\StepResult; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Converts result objects into a string representation. - * - * @author Konstantin Kudryashov - */ -final class ResultToStringConverter -{ - /** - * Converts provided test result to a string. - * - * @param TestResult $result - * - * @return string - */ - public function convertResultToString(TestResult $result) - { - return $this->convertResultCodeToString($result->getResultCode()); - } - - /** - * Converts provided result code to a string. - * - * @param integer $resultCode - * - * @return string - */ - public function convertResultCodeToString($resultCode) - { - switch ($resultCode) { - case TestResult::SKIPPED: - return 'skipped'; - case TestResult::PENDING: - return 'pending'; - case TestResult::FAILED: - return 'failed'; - case StepResult::UNDEFINED: - return 'undefined'; - } - - return 'passed'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/StepTextPainter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/StepTextPainter.php deleted file mode 100644 index d2becc5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/StepTextPainter.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Helper; - -use Behat\Behat\Definition\Definition; -use Behat\Behat\Definition\Pattern\PatternTransformer; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Paints step text (with tokens) according to found definition. - * - * @author Konstantin Kudryashov - */ -final class StepTextPainter -{ - /** - * @var PatternTransformer - */ - private $patternTransformer; - /** - * @var ResultToStringConverter - */ - private $resultConverter; - - /** - * Initializes painter. - * - * @param PatternTransformer $patternTransformer - * @param ResultToStringConverter $resultConverter - */ - public function __construct(PatternTransformer $patternTransformer, ResultToStringConverter $resultConverter) - { - $this->patternTransformer = $patternTransformer; - $this->resultConverter = $resultConverter; - } - - /** - * Colorizes step text arguments according to definition. - * - * @param string $text - * @param Definition $definition - * @param TestResult $result - * - * @return string - */ - public function paintText($text, Definition $definition, TestResult $result) - { - $regex = $this->patternTransformer->transformPatternToRegex($definition->getPattern()); - $style = $this->resultConverter->convertResultToString($result); - $paramStyle = $style . '_param'; - - // If it's just a string - skip - if ('/' !== substr($regex, 0, 1)) { - return $text; - } - - // Find arguments with offsets - $matches = array(); - preg_match($regex, $text, $matches, PREG_OFFSET_CAPTURE); - array_shift($matches); - - // Replace arguments with colorized ones - $shift = 0; - $lastReplacementPosition = 0; - foreach ($matches as $key => $match) { - if (!is_numeric($key) || -1 === $match[1] || false !== strpos($match[0], '<')) { - continue; - } - - $offset = $match[1] + $shift; - $value = $match[0]; - - // Skip inner matches - if ($lastReplacementPosition > $offset) { - continue; - } - $lastReplacementPosition = $offset + strlen($value); - - $begin = substr($text, 0, $offset); - $end = substr($text, $lastReplacementPosition); - $format = "{-$style}{+$paramStyle}%s{-$paramStyle}{+$style}"; - $text = sprintf("%s{$format}%s", $begin, $value, $end); - - // Keep track of how many extra characters are added - $shift += strlen($format) - 2; - $lastReplacementPosition += strlen($format) - 2; - } - - // Replace "<", ">" with colorized ones - $text = preg_replace( - '/(<[^>]+>)/', - "{-$style}{+$paramStyle}\$1{-$paramStyle}{+$style}", - $text - ); - - return $text; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php deleted file mode 100644 index c7a1fa9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Helper/WidthCalculator.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Helper; - -use Behat\Gherkin\Node\ExampleNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\StepNode; - -/** - * Calculates width of scenario. Width of scenario = max width of scenario title and scenario step texts. - * - * @author Konstantin Kudryashov - */ -final class WidthCalculator -{ - /** - * Calculates scenario width. - * - * @param Scenario $scenario - * @param integer $indentation - * @param integer $subIndentation - * - * @return integer - */ - public function calculateScenarioWidth(Scenario $scenario, $indentation, $subIndentation) - { - $length = $this->calculateScenarioHeaderWidth($scenario, $indentation); - - foreach ($scenario->getSteps() as $step) { - $stepLength = $this->calculateStepWidth($step, $indentation + $subIndentation); - $length = max($length, $stepLength); - } - - return $length; - } - - /** - * Calculates outline examples width. - * - * @param ExampleNode $example - * @param integer $indentation - * @param integer $subIndentation - * - * @return integer - */ - public function calculateExampleWidth(ExampleNode $example, $indentation, $subIndentation) - { - $length = $this->calculateScenarioHeaderWidth($example, $indentation); - - foreach ($example->getSteps() as $step) { - $stepLength = $this->calculateStepWidth($step, $indentation + $subIndentation); - $length = max($length, $stepLength); - } - - return $length; - } - - /** - * Calculates scenario header width. - * - * @param Scenario $scenario - * @param integer $indentation - * - * @return integer - */ - public function calculateScenarioHeaderWidth(Scenario $scenario, $indentation) - { - $indentText = str_repeat(' ', intval($indentation)); - - if ($scenario instanceof ExampleNode) { - $header = sprintf('%s%s', $indentText, $scenario->getTitle()); - } else { - $title = $scenario->getTitle(); - $lines = explode("\n", $title ?? ''); - $header = sprintf('%s%s: %s', $indentText, $scenario->getKeyword(), array_shift($lines)); - } - - return mb_strlen(rtrim($header), 'utf8'); - } - - /** - * Calculates step width. - * - * @param StepNode $step - * @param integer $indentation - * - * @return integer - */ - public function calculateStepWidth(StepNode $step, $indentation) - { - $indentText = str_repeat(' ', intval($indentation)); - - $text = sprintf('%s%s %s', $indentText, $step->getKeyword(), $step->getText()); - - return mb_strlen($text, 'utf8'); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php deleted file mode 100644 index 651c4a6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitFeaturePrinter.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\JUnit; - -use Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener; -use Behat\Behat\Output\Node\Printer\FeaturePrinter; -use Behat\Behat\Output\Statistics\PhaseStatistics; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\JUnitOutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints the element. - * - * @author Wouter J - */ -final class JUnitFeaturePrinter implements FeaturePrinter -{ - /** - * @var PhaseStatistics - */ - private $statistics; - - /** - * @var JUnitDurationListener|null - */ - private $durationListener; - - public function __construct(PhaseStatistics $statistics, JUnitDurationListener $durationListener = null) - { - $this->statistics = $statistics; - $this->durationListener = $durationListener; - } - - /** - * {@inheritDoc} - */ - public function printHeader(Formatter $formatter, FeatureNode $feature) - { - $stats = $this->statistics->getScenarioStatCounts(); - - if (0 === count($stats)) { - $totalCount = 0; - } else { - $totalCount = array_sum($stats); - } - - /** @var JUnitOutputPrinter $outputPrinter */ - $outputPrinter = $formatter->getOutputPrinter(); - - $outputPrinter->addTestsuite(array( - 'name' => $feature->getTitle(), - 'tests' => $totalCount, - 'skipped' => $stats[TestResult::SKIPPED], - 'failures' => $stats[TestResult::FAILED], - 'errors' => $stats[TestResult::PENDING] + $stats[StepResult::UNDEFINED], - 'time' => $this->durationListener ? $this->durationListener->getFeatureDuration($feature) : '', - )); - $this->statistics->reset(); - } - - /** - * {@inheritDoc} - */ - public function printFooter(Formatter $formatter, TestResult $result) - { - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php deleted file mode 100644 index 8ed7b09..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitScenarioPrinter.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\JUnit; - -use Behat\Behat\Output\Node\EventListener\JUnit\JUnitOutlineStoreListener; -use Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener; -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Gherkin\Node\ExampleNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\ScenarioLikeInterface; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\JUnitOutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints the element. - * - * @author Wouter J - */ -final class JUnitScenarioPrinter -{ - /** - * @var ResultToStringConverter - */ - private $resultConverter; - - /** - * @var JUnitOutlineStoreListener - */ - private $outlineStoreListener; - - /** - * @var OutlineNode - */ - private $lastOutline; - - /** - * @var int - */ - private $outlineStepCount; - - /** - * @var JUnitDurationListener|null - */ - private $durationListener; - - public function __construct(ResultToStringConverter $resultConverter, JUnitOutlineStoreListener $outlineListener, JUnitDurationListener $durationListener = null) - { - $this->resultConverter = $resultConverter; - $this->outlineStoreListener = $outlineListener; - $this->durationListener = $durationListener; - } - - /** - * {@inheritDoc} - */ - public function printOpenTag(Formatter $formatter, FeatureNode $feature, ScenarioLikeInterface $scenario, TestResult $result, string $file = null) - { - $name = implode(' ', array_map(function ($l) { - return trim($l); - }, explode("\n", $scenario->getTitle()))); - - if ($scenario instanceof ExampleNode) { - $name = $this->buildExampleName($scenario); - } - - /** @var JUnitOutputPrinter $outputPrinter */ - $outputPrinter = $formatter->getOutputPrinter(); - - $testCaseAttributes = array( - 'name' => $name, - 'classname' => $feature->getTitle(), - 'status' => $this->resultConverter->convertResultToString($result), - 'time' => $this->durationListener ? $this->durationListener->getDuration($scenario) : '' - ); - - if ($file) { - $cwd = realpath(getcwd()); - $testCaseAttributes['file'] = - substr($file, 0, strlen($cwd)) === $cwd ? - ltrim(substr($file, strlen($cwd)), DIRECTORY_SEPARATOR) : $file; - } - - $outputPrinter->addTestcase($testCaseAttributes); - } - - /** - * @param ExampleNode $scenario - * @return string - */ - private function buildExampleName(ExampleNode $scenario) - { - $currentOutline = $this->outlineStoreListener->getCurrentOutline($scenario); - if ($currentOutline === $this->lastOutline) { - $this->outlineStepCount++; - } else { - $this->lastOutline = $currentOutline; - $this->outlineStepCount = 1; - } - - $name = $currentOutline->getTitle() . ' #' . $this->outlineStepCount; - return $name; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitSetupPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitSetupPrinter.php deleted file mode 100644 index 401c7e9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitSetupPrinter.php +++ /dev/null @@ -1,87 +0,0 @@ - - */ -class JUnitSetupPrinter implements SetupPrinter -{ - - /** @var ExceptionPresenter */ - private $exceptionPresenter; - - public function __construct(ExceptionPresenter $exceptionPresenter) - { - $this->exceptionPresenter = $exceptionPresenter; - } - - /** - * {@inheritdoc} - */ - public function printSetup(Formatter $formatter, Setup $setup) - { - if (!$setup->isSuccessful()) { - if ($setup instanceof HookedSetup) { - $this->handleHookCalls($formatter, $setup->getHookCallResults(), 'setup'); - } - } - } - - /** - * {@inheritdoc} - */ - public function printTeardown(Formatter $formatter, Teardown $teardown) - { - if (!$teardown->isSuccessful()) { - if ($teardown instanceof HookedTeardown) { - $this->handleHookCalls($formatter, $teardown->getHookCallResults(), 'teardown'); - } - } - } - - /** - * @param Formatter $formatter - * @param CallResults $results - * @param string $messageType - */ - private function handleHookCalls(Formatter $formatter, CallResults $results, $messageType) - { - /** @var CallResult $hookCallResult */ - foreach ($results as $hookCallResult) { - if ($hookCallResult->hasException()) { - /** @var HookCall $call */ - $call = $hookCallResult->getCall(); - $scope = $call->getScope(); - /** @var JUnitOutputPrinter $outputPrinter */ - $outputPrinter = $formatter->getOutputPrinter(); - - $message = ''; - if ($scope instanceof StepScope) { - $message .= $scope->getStep()->getKeyword() . ' ' . $scope->getStep()->getText() . ': '; - } - $message .= $this->exceptionPresenter->presentException($hookCallResult->getException()); - - $attributes = array( - 'message' => $message, - 'type' => $messageType, - ); - - $outputPrinter->addTestcaseChild('failure', $attributes); - - } - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitStepPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitStepPrinter.php deleted file mode 100644 index dcca50d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitStepPrinter.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\JUnit; - -use Behat\Behat\Tester\Result\StepResult; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Exception\ExceptionPresenter; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\JUnitOutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\ExceptionResult; - -/** - * Prints step with optional results. - * - * @author Wouter J - * @author James Watson - */ -class JUnitStepPrinter implements StepPrinter -{ - /** - * @var ExceptionPresenter - */ - private $exceptionPresenter; - - public function __construct(ExceptionPresenter $exceptionPresenter) - { - $this->exceptionPresenter = $exceptionPresenter; - } - - /** - * Prints step using provided printer. - * - * @param Formatter $formatter - * @param Scenario $scenario - * @param StepNode $step - * @param StepResult $result - */ - public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result) - { - /** @var JUnitOutputPrinter $outputPrinter */ - $outputPrinter = $formatter->getOutputPrinter(); - - $message = $step->getKeyword() . ' ' . $step->getText(); - - if ($result instanceof ExceptionResult && $result->hasException()) { - $message .= ': ' . $this->exceptionPresenter->presentException($result->getException()); - } - - $attributes = array('message' => $message); - - switch ($result->getResultCode()) { - case TestResult::FAILED: - $outputPrinter->addTestcaseChild('failure', $attributes); - break; - - case TestResult::PENDING: - $attributes['type'] = 'pending'; - $outputPrinter->addTestcaseChild('error', $attributes); - break; - - case StepResult::UNDEFINED: - $attributes['type'] = 'undefined'; - $outputPrinter->addTestcaseChild('error', $attributes); - break; - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitSuitePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitSuitePrinter.php deleted file mode 100644 index 7e5efad..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/JUnit/JUnitSuitePrinter.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\JUnit; - -use Behat\Behat\Output\Node\Printer\SuitePrinter; -use Behat\Behat\Output\Statistics\PhaseStatistics; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\JUnitOutputPrinter; -use Behat\Testwork\Suite\Suite; - -/** - * Creates new JUnit report file. - * - * @author Wouter J - */ -final class JUnitSuitePrinter implements SuitePrinter -{ - /** - * @var PhaseStatistics - */ - private $statistics; - - public function __construct(PhaseStatistics $statistics = null) - { - $this->statistics = $statistics; - } - - /** - * {@inheritDoc} - */ - public function printHeader(Formatter $formatter, Suite $suite) - { - if ($this->statistics) { - $this->statistics->reset(); - } - - /** @var JUnitOutputPrinter $outputPrinter */ - $outputPrinter = $formatter->getOutputPrinter(); - $outputPrinter->createNewFile($suite->getName()); - } - - /** - * {@inheritDoc} - */ - public function printFooter(Formatter $formatter, Suite $suite) - { - $formatter->getOutputPrinter()->flush(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ListPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ListPrinter.php deleted file mode 100644 index 8f71936..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ListPrinter.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Behat\Definition\Translator\TranslatorInterface; -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Output\Statistics\HookStat; -use Behat\Behat\Output\Statistics\ScenarioStat; -use Behat\Behat\Output\Statistics\StepStatV2; -use Behat\Behat\Output\Statistics\StepStat; -use Behat\Testwork\Exception\ExceptionPresenter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Behat list printer. - * - * @author Konstantin Kudryashov - */ -final class ListPrinter -{ - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var ExceptionPresenter - */ - private $exceptionPresenter; - /** - * @var TranslatorInterface - */ - private $translator; - /** - * @var string - */ - private $basePath; - - /** - * Initializes printer. - * - * @param ResultToStringConverter $resultConverter - * @param ExceptionPresenter $exceptionPresenter - * @param TranslatorInterface $translator - * @param string $basePath - */ - public function __construct( - ResultToStringConverter $resultConverter, - ExceptionPresenter $exceptionPresenter, - TranslatorInterface $translator, - $basePath - ) { - $this->resultConverter = $resultConverter; - $this->exceptionPresenter = $exceptionPresenter; - $this->translator = $translator; - $this->basePath = $basePath; - } - - /** - * Prints scenarios list. - * - * @param OutputPrinter $printer - * @param string $intro - * @param integer $resultCode - * @param ScenarioStat[] $scenarioStats - */ - public function printScenariosList(OutputPrinter $printer, $intro, $resultCode, array $scenarioStats) - { - if (!count($scenarioStats)) { - return; - } - - $style = $this->resultConverter->convertResultCodeToString($resultCode); - $intro = $this->translator->trans($intro, array(), 'output'); - - $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); - foreach ($scenarioStats as $stat) { - $path = $this->relativizePaths((string) $stat); - $printer->writeln(sprintf(' {+%s}%s{-%s}', $style, $path, $style)); - } - - $printer->writeln(); - } - - /** - * Prints step list. - * - * @param OutputPrinter $printer - * @param string $intro - * @param integer $resultCode - * @param StepStat[] $stepStats - */ - public function printStepList(OutputPrinter $printer, $intro, $resultCode, array $stepStats) - { - if (!count($stepStats)) { - return; - } - - $style = $this->resultConverter->convertResultCodeToString($resultCode); - $intro = $this->translator->trans($intro, array(), 'output'); - - $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); - - foreach ($stepStats as $num => $stepStat) { - if ($stepStat instanceof StepStatV2) { - $this->printStepStat($printer, $num + 1, $stepStat, $style); - } elseif ($stepStat instanceof StepStat) { - $this->printStat($printer, $stepStat->getText(), $stepStat->getPath(), $style, $stepStat->getStdOut(), $stepStat->getError()); - } - } - } - - /** - * Prints failed hooks list. - * - * @param OutputPrinter $printer - * @param string $intro - * @param HookStat[] $failedHookStats - */ - public function printFailedHooksList(OutputPrinter $printer, $intro, array $failedHookStats) - { - if (!count($failedHookStats)) { - return; - } - - $style = $this->resultConverter->convertResultCodeToString(TestResult::FAILED); - $intro = $this->translator->trans($intro, array(), 'output'); - - $printer->writeln(sprintf('--- {+%s}%s{-%s}' . PHP_EOL, $style, $intro, $style)); - foreach ($failedHookStats as $hookStat) { - $this->printHookStat($printer, $hookStat, $style); - } - } - - /** - * Prints hook stat. - * - * @param OutputPrinter $printer - * @param string $name - * @param string $path - * @param string $style - * @param null|string $stdOut - * @param null|string $error - * - * @deprecated Remove in 4.0 - */ - private function printStat(OutputPrinter $printer, $name, $path, $style, $stdOut, $error) - { - $path = $this->relativizePaths($path); - $printer->writeln(sprintf(' {+%s}%s{-%s} {+comment}# %s{-comment}', $style, $name, $style, $path)); - - $pad = function ($line) { return ' ' . $line; }; - - if (null !== $stdOut) { - $padText = function ($line) { return ' │ ' . $line; }; - $stdOutString = array_map($padText, explode("\n", $stdOut)); - $printer->writeln(implode("\n", $stdOutString)); - } - - if ($error) { - $exceptionString = implode("\n", array_map($pad, explode("\n", $error))); - $printer->writeln(sprintf('{+%s}%s{-%s}', $style, $exceptionString, $style)); - } - - $printer->writeln(); - } - - /** - * Prints hook stat. - * - * @param OutputPrinter $printer - * @param HookStat $hookStat - * @param string $style - */ - private function printHookStat(OutputPrinter $printer, HookStat $hookStat, $style) - { - $printer->writeln( - sprintf(' {+%s}%s{-%s} {+comment}# %s{-comment}', - $style, $hookStat->getName(), $style, $this->relativizePaths($hookStat->getPath()) - ) - ); - - $pad = function ($line) { return ' ' . $line; }; - - if (null !== $hookStat->getStdOut()) { - $padText = function ($line) { return ' │ ' . $line; }; - $stdOutString = array_map($padText, explode("\n", $hookStat->getStdOut())); - $printer->writeln(implode("\n", $stdOutString)); - } - - if ($hookStat->getError()) { - $exceptionString = implode("\n", array_map($pad, explode("\n", $hookStat->getError()))); - $printer->writeln(sprintf('{+%s}%s{-%s}', $style, $exceptionString, $style)); - } - - $printer->writeln(); - } - - /** - * Prints hook stat. - * - * @param OutputPrinter $printer - * @param integer $number - * @param StepStatV2 $stat - * @param string $style - */ - private function printStepStat(OutputPrinter $printer, $number, StepStatV2 $stat, $style) - { - $maxLength = max(mb_strlen($stat->getScenarioText(), 'utf8'), mb_strlen($stat->getStepText(), 'utf8') + 2) + 1; - - $printer->writeln( - sprintf('%03d {+%s}%s{-%s}%s{+comment}# %s{-comment}', - $number, - $style, - $stat->getScenarioText(), - $style, - str_pad(' ', $maxLength - mb_strlen($stat->getScenarioText(), 'utf8')), - $this->relativizePaths($stat->getScenarioPath()) - ) - ); - - $printer->writeln( - sprintf(' {+%s}%s{-%s}%s{+comment}# %s{-comment}', - $style, - $stat->getStepText(), - $style, - str_pad(' ', $maxLength - mb_strlen($stat->getStepText(), 'utf8') - 2), - $this->relativizePaths($stat->getStepPath()) - ) - ); - - $pad = function ($line) { return ' ' . $line; }; - - if (null !== $stat->getStdOut()) { - $padText = function ($line) { return ' │ ' . $line; }; - $stdOutString = array_map($padText, explode("\n", $stat->getStdOut())); - $printer->writeln(implode("\n", $stdOutString)); - } - - if ($stat->getError()) { - $exceptionString = implode("\n", array_map($pad, explode("\n", $stat->getError()))); - $printer->writeln(sprintf('{+%s}%s{-%s}', $style, $exceptionString, $style)); - } - - $printer->writeln(); - } - - /** - * Transforms path to relative. - * - * @param string $path - * - * @return string - */ - private function relativizePaths($path) - { - if (!$this->basePath) { - return $path; - } - - return str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/OutlinePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/OutlinePrinter.php deleted file mode 100644 index eb460ad..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/OutlinePrinter.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints outline headers and footers. - * - * @author Konstantin Kudryashov - */ -interface OutlinePrinter -{ - /** - * Prints outline header using provided printer. - * - * @param Formatter $formatter - * @param FeatureNode $feature - * @param OutlineNode $outline - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, OutlineNode $outline); - - /** - * Prints outline footer using provided printer. - * - * @param Formatter $formatter - * @param TestResult $result - */ - public function printFooter(Formatter $formatter, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/OutlineTablePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/OutlineTablePrinter.php deleted file mode 100644 index 488fae6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/OutlineTablePrinter.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints outline table representation headers and footers. - * - * @author Konstantin Kudryashov - */ -interface OutlineTablePrinter -{ - /** - * Prints outline header using provided printer and first row example step results. - * - * @param Formatter $formatter - * @param FeatureNode $feature - * @param OutlineNode $outline - * @param StepResult[] $results - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, OutlineNode $outline, array $results); - - /** - * Prints outline footer using provided printer. - * - * @param Formatter $formatter - * @param TestResult $result - */ - public function printFooter(Formatter $formatter, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExamplePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExamplePrinter.php deleted file mode 100644 index 2d5babf..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExamplePrinter.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\ExamplePrinter; -use Behat\Gherkin\Node\ExampleNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints example header (usually simply an example row) and footer. - * - * @author Konstantin Kudryashov - */ -final class PrettyExamplePrinter implements ExamplePrinter -{ - /** - * @var PrettyPathPrinter - */ - private $pathPrinter; - /** - * @var string - */ - private $indentText; - - /** - * Initializes printer. - * - * @param PrettyPathPrinter $pathPrinter - * @param integer $indentation - */ - public function __construct(PrettyPathPrinter $pathPrinter, $indentation = 6) - { - $this->pathPrinter = $pathPrinter; - $this->indentText = str_repeat(' ', intval($indentation)); - } - - /** - * {@inheritdoc} - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, ExampleNode $example) - { - $this->printTitle($formatter->getOutputPrinter(), $example); - $this->pathPrinter->printScenarioPath($formatter, $feature, $example, mb_strlen($this->indentText, 'utf8')); - } - - /** - * {@inheritdoc} - */ - public function printFooter(Formatter $formatter, TestResult $result) - { - } - - /** - * Prints example title. - * - * @param OutputPrinter $printer - * @param ExampleNode $example - */ - private function printTitle(OutputPrinter $printer, ExampleNode $example) - { - $printer->write(sprintf('%s%s', $this->indentText, $example->getTitle())); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExampleRowPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExampleRowPrinter.php deleted file mode 100644 index 2713fc0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyExampleRowPrinter.php +++ /dev/null @@ -1,200 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Definition\Translator\TranslatorInterface; -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\Output\Node\Printer\ExampleRowPrinter; -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Tester\Result\ExecutedStepResult; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\ExampleNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\EventDispatcher\Event\AfterTested; -use Behat\Testwork\Exception\ExceptionPresenter; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\ExceptionResult; -use Behat\Testwork\Tester\Result\TestResults; - -/** - * Prints example results in form of a table row. - * - * @author Konstantin Kudryashov - */ -final class PrettyExampleRowPrinter implements ExampleRowPrinter -{ - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var ExceptionPresenter - */ - private $exceptionPresenter; - /** - * @var string - */ - private $indentText; - /** - * @var string - */ - private $subIndentText; - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * Initializes printer. - * - * @param ResultToStringConverter $resultConverter - * @param ExceptionPresenter $exceptionPresenter - * @param integer $indentation - * @param integer $subIndentation - */ - public function __construct( - ResultToStringConverter $resultConverter, - ExceptionPresenter $exceptionPresenter, - TranslatorInterface $translator, - $indentation = 6, - $subIndentation = 2 - ) { - $this->resultConverter = $resultConverter; - $this->exceptionPresenter = $exceptionPresenter; - $this->translator = $translator; - $this->indentText = str_repeat(' ', intval($indentation)); - $this->subIndentText = $this->indentText . str_repeat(' ', intval($subIndentation)); - } - - /** - * {@inheritdoc} - */ - public function printExampleRow(Formatter $formatter, OutlineNode $outline, ExampleNode $example, array $events) - { - $rowNum = array_search($example, $outline->getExamples()) + 1; - $wrapper = $this->getWrapperClosure($outline, $example, $events); - $row = $outline->getExampleTable()->getRowAsStringWithWrappedValues($rowNum, $wrapper); - - $formatter->getOutputPrinter()->writeln(sprintf('%s%s', $this->indentText, $row)); - $this->printStepExceptionsAndStdOut($formatter->getOutputPrinter(), $events); - } - - /** - * Creates wrapper-closure for the example table. - * - * @param OutlineNode $outline - * @param ExampleNode $example - * @param AfterStepTested[] $stepEvents - * - * @return callable - */ - private function getWrapperClosure(OutlineNode $outline, ExampleNode $example, array $stepEvents) - { - $resultConverter = $this->resultConverter; - - return function ($value, $column) use ($outline, $example, $stepEvents, $resultConverter) { - $results = array(); - foreach ($stepEvents as $event) { - $index = array_search($event->getStep(), $example->getSteps()); - $header = $outline->getExampleTable()->getRow(0); - $steps = $outline->getSteps(); - $outlineStepText = $steps[$index]->getText(); - - if (false !== strpos($outlineStepText, '<' . $header[$column] . '>')) { - $results[] = $event->getTestResult(); - } - } - - $result = new TestResults($results); - $style = $resultConverter->convertResultToString($result); - - return sprintf('{+%s}%s{-%s}', $style, $value, $style); - }; - } - - /** - * Prints step events exceptions (if has some). - * - * @param OutputPrinter $printer - * @param AfterTested[] $events - */ - private function printStepExceptionsAndStdOut(OutputPrinter $printer, array $events) - { - foreach ($events as $event) { - $this->printStepStdOut($printer, $event->getTestResult()); - $this->printStepException($printer, $event); - } - } - - /** - * Prints step exception (if has one). - * - * @param OutputPrinter $printer - * @param AfterTested $event - */ - private function printStepException(OutputPrinter $printer, AfterTested $event) - { - $result = $event->getTestResult(); - - $style = $this->resultConverter->convertResultToString($result); - - if (!$result instanceof ExceptionResult || !$result->hasException()) { - return; - } - - if ($event instanceof AfterStepTested) { - $title = $this->translator->trans('failed_step_title', [], 'output'); - $step = $event->getStep(); - $printer->writeln(sprintf('{+%s}%s%s %s %s{-%s}', $style, $this->subIndentText, $title, $step->getKeyword(), $step->getText(), $style)); - } - - $text = $this->exceptionPresenter->presentException($result->getException()); - $indentedText = implode("\n", array_map(array($this, 'subIndent'), explode("\n", $text))); - $printer->writeln(sprintf('{+%s}%s{-%s}', $style, $indentedText, $style)); - } - - /** - * Prints step output (if has one). - * - * @param OutputPrinter $printer - * @param StepResult $result - */ - private function printStepStdOut(OutputPrinter $printer, StepResult $result) - { - if (!$result instanceof ExecutedStepResult || null === $result->getCallResult()->getStdOut()) { - return; - } - - $callResult = $result->getCallResult(); - $indentedText = $this->subIndentText; - - $pad = function ($line) use ($indentedText) { - return sprintf( - '%s│ {+stdout}%s{-stdout}', $indentedText, $line - ); - }; - - $printer->writeln(implode("\n", array_map($pad, explode("\n", $callResult->getStdOut())))); - } - - /** - * Indents text to the subIndentation level. - * - * @param string $text - * - * @return string - */ - private function subIndent($text) - { - return $this->subIndentText . $text; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php deleted file mode 100644 index 1a352c7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyFeaturePrinter.php +++ /dev/null @@ -1,133 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\FeaturePrinter; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\TaggedNodeInterface; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints feature header and footer. - * - * @author Konstantin Kudryashov - */ -final class PrettyFeaturePrinter implements FeaturePrinter -{ - /** - * @var string - */ - private $indentText; - /** - * @var string - */ - private $subIndentText; - - /** - * Initializes printer. - * - * @param integer $indentation - * @param integer $subIndentation - */ - public function __construct($indentation = 0, $subIndentation = 2) - { - $this->indentText = str_repeat(' ', intval($indentation)); - $this->subIndentText = $this->indentText . str_repeat(' ', intval($subIndentation)); - } - - /** - * {@inheritdoc} - */ - public function printHeader(Formatter $formatter, FeatureNode $feature) - { - if ($feature instanceof TaggedNodeInterface) { - $this->printTags($formatter->getOutputPrinter(), $feature->getTags()); - } - - $this->printTitle($formatter->getOutputPrinter(), $feature); - $this->printDescription($formatter->getOutputPrinter(), $feature); - } - - /** - * {@inheritdoc} - */ - public function printFooter(Formatter $formatter, TestResult $result) - { - } - - /** - * Prints feature tags. - * - * @param OutputPrinter $printer - * @param string[] $tags - */ - private function printTags(OutputPrinter $printer, array $tags) - { - if (!count($tags)) { - return; - } - - $tags = array_map(array($this, 'prependTagWithTagSign'), $tags); - $printer->writeln(sprintf('%s{+tag}%s{-tag}', $this->indentText, implode(' ', $tags))); - } - - /** - * Prints feature title using provided printer. - * - * @param OutputPrinter $printer - * @param FeatureNode $feature - */ - private function printTitle(OutputPrinter $printer, FeatureNode $feature) - { - $printer->write(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $feature->getKeyword())); - - if ($title = $feature->getTitle()) { - $printer->write(sprintf(' %s', $title)); - } - - $printer->writeln(); - } - - /** - * Prints feature description using provided printer. - * - * @param OutputPrinter $printer - * @param FeatureNode $feature - */ - private function printDescription(OutputPrinter $printer, FeatureNode $feature) - { - if (!$feature->getDescription()) { - $printer->writeln(); - - return; - } - - foreach (explode("\n", $feature->getDescription()) as $descriptionLine) { - $printer->writeln(sprintf('%s%s', $this->subIndentText, $descriptionLine)); - } - - $printer->writeln(); - } - - /** - * Prepends tags string with tag-sign. - * - * @param string $tag - * - * @return string - */ - private function prependTagWithTagSign($tag) - { - return '@' . $tag; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php deleted file mode 100644 index 8fbc033..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlinePrinter.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Output\Node\Printer\OutlinePrinter; -use Behat\Behat\Output\Node\Printer\ScenarioPrinter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Behat\Tester\Result\UndefinedStepResult; -use Behat\Gherkin\Node\ExampleTableNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints outline header with outline steps and table header. - * - * @author Konstantin Kudryashov - */ -final class PrettyOutlinePrinter implements OutlinePrinter -{ - /** - * @var ScenarioPrinter - */ - private $scenarioPrinter; - /** - * @var StepPrinter - */ - private $stepPrinter; - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var string - */ - private $indentText; - /** - * @var string - */ - private $subIndentText; - - /** - * @param ScenarioPrinter $scenarioPrinter - * @param StepPrinter $stepPrinter - * @param ResultToStringConverter $resultConverter - * @param integer $indentation - * @param integer $subIndentation - */ - public function __construct( - ScenarioPrinter $scenarioPrinter, - StepPrinter $stepPrinter, - ResultToStringConverter $resultConverter, - $indentation = 4, - $subIndentation = 2 - ) { - $this->scenarioPrinter = $scenarioPrinter; - $this->stepPrinter = $stepPrinter; - $this->resultConverter = $resultConverter; - $this->indentText = str_repeat(' ', intval($indentation)); - $this->subIndentText = $this->indentText . str_repeat(' ', intval($subIndentation)); - } - - /** - * {@inheritdoc} - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, OutlineNode $outline) - { - $this->scenarioPrinter->printHeader($formatter, $feature, $outline); - - $this->printExamplesSteps($formatter, $outline, $outline->getSteps()); - $this->printExamplesTableHeader($formatter->getOutputPrinter(), $outline->getExampleTable()); - } - - /** - * {@inheritdoc} - */ - public function printFooter(Formatter $formatter, TestResult $result) - { - $formatter->getOutputPrinter()->writeln(); - } - - /** - * Prints outline steps. - * - * @param Formatter $formatter - * @param OutlineNode $outline - * @param StepNode[] $steps - */ - private function printExamplesSteps(Formatter $formatter, OutlineNode $outline, array $steps) - { - foreach ($steps as $step) { - $this->stepPrinter->printStep($formatter, $outline, $step, new UndefinedStepResult()); - } - - $formatter->getOutputPrinter()->writeln(); - } - - /** - * Prints examples table header. - * - * @param OutputPrinter $printer - * @param ExampleTableNode $table - */ - private function printExamplesTableHeader(OutputPrinter $printer, ExampleTableNode $table) - { - $printer->writeln(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $table->getKeyword())); - - $rowNum = 0; - $wrapper = $this->getWrapperClosure(); - $row = $table->getRowAsStringWithWrappedValues($rowNum, $wrapper); - - $printer->writeln(sprintf('%s%s', $this->subIndentText, $row)); - } - - /** - * Creates wrapper-closure for the example header. - * - * @return callable - */ - private function getWrapperClosure() - { - $style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED); - - return function ($col) use ($style) { - return sprintf('{+%s_param}%s{-%s_param}', $style, $col, $style); - }; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlineTablePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlineTablePrinter.php deleted file mode 100644 index ea0298e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyOutlineTablePrinter.php +++ /dev/null @@ -1,145 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Output\Node\Printer\OutlineTablePrinter; -use Behat\Behat\Output\Node\Printer\ScenarioPrinter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\ExampleTableNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints outline table header and footer. - * - * @author Konstantin Kudryashov - */ -final class PrettyOutlineTablePrinter implements OutlineTablePrinter -{ - /** - * @var ScenarioPrinter - */ - private $scenarioPrinter; - /** - * @var StepPrinter - */ - private $stepPrinter; - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var string - */ - private $indentText; - /** - * @var string - */ - private $subIndentText; - - /** - * Initializes printer. - * - * @param ScenarioPrinter $scenarioPrinter - * @param StepPrinter $stepPrinter - * @param ResultToStringConverter $resultConverter - * @param integer $indentation - * @param integer $subIndentation - */ - public function __construct( - ScenarioPrinter $scenarioPrinter, - StepPrinter $stepPrinter, - ResultToStringConverter $resultConverter, - $indentation = 4, - $subIndentation = 2 - ) { - $this->scenarioPrinter = $scenarioPrinter; - $this->stepPrinter = $stepPrinter; - $this->resultConverter = $resultConverter; - $this->indentText = str_repeat(' ', intval($indentation)); - $this->subIndentText = $this->indentText . str_repeat(' ', intval($subIndentation)); - } - - /** - * {@inheritdoc} - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, OutlineNode $outline, array $results) - { - $this->scenarioPrinter->printHeader($formatter, $feature, $outline); - - $this->printExamplesSteps($formatter, $outline, $outline->getSteps(), $results); - $this->printExamplesTableHeader($formatter->getOutputPrinter(), $outline->getExampleTable()); - } - - /** - * {@inheritdoc} - */ - public function printFooter(Formatter $formatter, TestResult $result) - { - $formatter->getOutputPrinter()->writeln(); - } - - /** - * Prints example steps with definition paths (if has some), but without exceptions or state (skipped). - * - * @param Formatter $formatter - * @param OutlineNode $outline - * @param StepNode[] $steps - * @param StepResult[] $results - */ - private function printExamplesSteps(Formatter $formatter, OutlineNode $outline, array $steps, array $results) - { - foreach ($steps as $step) { - $result = $results[$step->getLine()]; - - $this->stepPrinter->printStep($formatter, $outline, $step, $result); - } - - $formatter->getOutputPrinter()->writeln(); - } - - /** - * Prints examples table header. - * - * @param OutputPrinter $printer - * @param ExampleTableNode $table - */ - private function printExamplesTableHeader(OutputPrinter $printer, ExampleTableNode $table) - { - $printer->writeln(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $table->getKeyword())); - - $rowNum = 0; - $wrapper = $this->getWrapperClosure(); - $row = $table->getRowAsStringWithWrappedValues($rowNum, $wrapper); - - $printer->writeln(sprintf('%s%s', $this->subIndentText, $row)); - } - - /** - * Creates wrapper-closure for the example header. - * - * @return callable - */ - private function getWrapperClosure() - { - $style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED); - - return function ($col) use ($style) { - return sprintf('{+%s_param}%s{-%s_param}', $style, $col, $style); - }; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php deleted file mode 100644 index 9ea0b68..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyPathPrinter.php +++ /dev/null @@ -1,137 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\Helper\WidthCalculator; -use Behat\Behat\Tester\Result\DefinedStepResult; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; - -/** - * Prints paths for scenarios, examples, backgrounds and steps. - * - * @author Konstantin Kudryashov - */ -final class PrettyPathPrinter -{ - /** - * @var WidthCalculator - */ - private $widthCalculator; - /** - * @var string - */ - private $basePath; - - /** - * Initializes printer. - * - * @param WidthCalculator $widthCalculator - * @param string $basePath - */ - public function __construct(WidthCalculator $widthCalculator, $basePath) - { - $this->widthCalculator = $widthCalculator; - $this->basePath = $basePath; - } - - /** - * Prints scenario path comment. - * - * @param Formatter $formatter - * @param FeatureNode $feature - * @param Scenario $scenario - * @param integer $indentation - */ - public function printScenarioPath(Formatter $formatter, FeatureNode $feature, Scenario $scenario, $indentation) - { - $printer = $formatter->getOutputPrinter(); - - if (!$formatter->getParameter('paths')) { - $printer->writeln(); - - return; - } - - $fileAndLine = sprintf('%s:%s', $this->relativizePaths($feature->getFile()), $scenario->getLine()); - $headerWidth = $this->widthCalculator->calculateScenarioHeaderWidth($scenario, $indentation); - $scenarioWidth = $this->widthCalculator->calculateScenarioWidth($scenario, $indentation, 2); - $spacing = str_repeat(' ', max(0, $scenarioWidth - $headerWidth)); - - $printer->writeln(sprintf('%s {+comment}# %s{-comment}', $spacing, $fileAndLine)); - } - - /** - * Prints step path comment. - * - * @param Formatter $formatter - * @param Scenario $scenario - * @param StepNode $step - * @param StepResult $result - * @param integer $indentation - */ - public function printStepPath( - Formatter $formatter, - Scenario $scenario, - StepNode $step, - StepResult $result, - $indentation - ) { - $printer = $formatter->getOutputPrinter(); - - if (!$result instanceof DefinedStepResult || !$result->getStepDefinition() || !$formatter->getParameter('paths')) { - $printer->writeln(); - - return; - } - - $textWidth = $this->widthCalculator->calculateStepWidth($step, $indentation); - $scenarioWidth = $this->widthCalculator->calculateScenarioWidth($scenario, $indentation - 2, 2); - - $this->printDefinedStepPath($printer, $result, $scenarioWidth, $textWidth); - } - - /** - * Prints defined step path. - * - * @param OutputPrinter $printer - * @param DefinedStepResult $result - * @param integer $scenarioWidth - * @param integer $stepWidth - */ - private function printDefinedStepPath(OutputPrinter $printer, DefinedStepResult $result, $scenarioWidth, $stepWidth) - { - $path = $result->getStepDefinition()->getPath(); - $spacing = str_repeat(' ', max(0, $scenarioWidth - $stepWidth)); - - $printer->writeln(sprintf('%s {+comment}# %s{-comment}', $spacing, $path)); - } - - /** - * Transforms path to relative. - * - * @param string $path - * - * @return string - */ - private function relativizePaths($path) - { - if (!$this->basePath) { - return $path; - } - - return str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $path); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyScenarioPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyScenarioPrinter.php deleted file mode 100644 index 28f3adc..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyScenarioPrinter.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\ScenarioPrinter; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\TaggedNodeInterface; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints scenario headers (with tags, keyword and long title) and footers. - * - * @author Konstantin Kudryashov - */ -final class PrettyScenarioPrinter implements ScenarioPrinter -{ - /** - * @var PrettyPathPrinter - */ - private $pathPrinter; - /** - * @var string - */ - private $indentText; - /** - * @var string - */ - private $subIndentText; - - /** - * Initializes printer. - * - * @param PrettyPathPrinter $pathPrinter - * @param integer $indentation - * @param integer $subIndentation - */ - public function __construct(PrettyPathPrinter $pathPrinter, $indentation = 2, $subIndentation = 2) - { - $this->pathPrinter = $pathPrinter; - $this->indentText = str_repeat(' ', intval($indentation)); - $this->subIndentText = $this->indentText . str_repeat(' ', intval($subIndentation)); - } - - /** - * {@inheritdoc} - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, Scenario $scenario) - { - if ($scenario instanceof TaggedNodeInterface) { - $this->printTags($formatter->getOutputPrinter(), $scenario->getTags()); - } - - $this->printKeyword($formatter->getOutputPrinter(), $scenario->getKeyword()); - $this->printTitle($formatter->getOutputPrinter(), $scenario->getTitle()); - $this->pathPrinter->printScenarioPath($formatter, $feature, $scenario, mb_strlen($this->indentText, 'utf8')); - $this->printDescription($formatter->getOutputPrinter(), $scenario->getTitle()); - } - - /** - * {@inheritdoc} - */ - public function printFooter(Formatter $formatter, TestResult $result) - { - $formatter->getOutputPrinter()->writeln(); - } - - /** - * Prints scenario tags. - * - * @param OutputPrinter $printer - * @param string[] $tags - */ - private function printTags(OutputPrinter $printer, array $tags) - { - if (!count($tags)) { - return; - } - - $tags = array_map(array($this, 'prependTagWithTagSign'), $tags); - $printer->writeln(sprintf('%s{+tag}%s{-tag}', $this->indentText, implode(' ', $tags))); - } - - /** - * Prints scenario keyword. - * - * @param OutputPrinter $printer - * @param string $keyword - */ - private function printKeyword(OutputPrinter $printer, $keyword) - { - $printer->write(sprintf('%s{+keyword}%s:{-keyword}', $this->indentText, $keyword)); - } - - /** - * Prints scenario title (first line of long title). - * - * @param OutputPrinter $printer - * @param string $longTitle - */ - private function printTitle(OutputPrinter $printer, $longTitle) - { - $description = explode("\n", $longTitle ?? ''); - $title = array_shift($description); - - if ('' !== $title) { - $printer->write(sprintf(' %s', $title)); - } - } - - /** - * Prints scenario description (other lines of long title). - * - * @param OutputPrinter $printer - * @param string $longTitle - */ - private function printDescription(OutputPrinter $printer, $longTitle) - { - $lines = explode("\n", $longTitle ?? ''); - array_shift($lines); - - foreach ($lines as $line) { - $printer->writeln(sprintf('%s%s', $this->subIndentText, $line)); - } - } - - /** - * Prepends tags string with tag-sign. - * - * @param string $tag - * - * @return string - */ - private function prependTagWithTagSign($tag) - { - return '@' . $tag; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php deleted file mode 100644 index 5475f51..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySetupPrinter.php +++ /dev/null @@ -1,212 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Output\Node\Printer\SetupPrinter; -use Behat\Testwork\Call\CallResult; -use Behat\Testwork\Exception\ExceptionPresenter; -use Behat\Testwork\Hook\Tester\Setup\HookedSetup; -use Behat\Testwork\Hook\Tester\Setup\HookedTeardown; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Prints hooks in a pretty fashion. - * - * @author Konstantin Kudryashov - */ -final class PrettySetupPrinter implements SetupPrinter -{ - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var ExceptionPresenter - */ - private $exceptionPresenter; - /** - * @var string - */ - private $indentText; - /** - * @var bool - */ - private $newlineBefore; - /** - * @var bool - */ - private $newlineAfter; - - /** - * Initializes printer. - * - * @param ResultToStringConverter $resultConverter - * @param ExceptionPresenter $exceptionPresenter - * @param integer $indentation - * @param bool $newlineBefore - * @param bool $newlineAfter - */ - public function __construct( - ResultToStringConverter $resultConverter, - ExceptionPresenter $exceptionPresenter, - $indentation = 0, - $newlineBefore = false, - $newlineAfter = false - ) { - $this->resultConverter = $resultConverter; - $this->exceptionPresenter = $exceptionPresenter; - $this->indentText = str_repeat(' ', intval($indentation)); - $this->newlineBefore = $newlineBefore; - $this->newlineAfter = $newlineAfter; - } - - /** - * {@inheritdoc} - */ - public function printSetup(Formatter $formatter, Setup $setup) - { - if (!$setup instanceof HookedSetup) { - return; - } - - foreach ($setup->getHookCallResults() as $callResult) { - $this->printSetupHookCallResult($formatter->getOutputPrinter(), $callResult); - } - } - - /** - * {@inheritdoc} - */ - public function printTeardown(Formatter $formatter, Teardown $teardown) - { - if (!$teardown instanceof HookedTeardown) { - return; - } - - foreach ($teardown->getHookCallResults() as $callResult) { - $this->printTeardownHookCallResult($formatter->getOutputPrinter(), $callResult); - } - } - - /** - * Prints setup hook call result. - * - * @param OutputPrinter $printer - * @param CallResult $callResult - */ - private function printSetupHookCallResult(OutputPrinter $printer, CallResult $callResult) - { - if (!$callResult->hasStdOut() && !$callResult->hasException()) { - return; - } - - $resultCode = $callResult->hasException() ? TestResult::FAILED : TestResult::PASSED; - $style = $this->resultConverter->convertResultCodeToString($resultCode); - $hook = $callResult->getCall()->getCallee(); - $path = $hook->getPath(); - - $printer->writeln( - sprintf('%s┌─ {+%s}@%s{-%s} {+comment}# %s{-comment}', $this->indentText, $style, $hook, $style, $path) - ); - - $printer->writeln(sprintf('%s│', $this->indentText)); - - $this->printHookCallStdOut($printer, $callResult, $this->indentText); - $this->printHookCallException($printer, $callResult, $this->indentText); - - if ($this->newlineBefore) { - $printer->writeln(); - } - } - - /** - * Prints teardown hook call result. - * - * @param OutputPrinter $printer - * @param CallResult $callResult - */ - private function printTeardownHookCallResult(OutputPrinter $printer, CallResult $callResult) - { - if (!$callResult->hasStdOut() && !$callResult->hasException()) { - return; - } - - $resultCode = $callResult->hasException() ? TestResult::FAILED : TestResult::PASSED; - $style = $this->resultConverter->convertResultCodeToString($resultCode); - $hook = $callResult->getCall()->getCallee(); - $path = $hook->getPath(); - - $printer->writeln(sprintf('%s│', $this->indentText)); - - $this->printHookCallStdOut($printer, $callResult, $this->indentText); - $this->printHookCallException($printer, $callResult, $this->indentText); - - $printer->writeln( - sprintf('%s└─ {+%s}@%s{-%s} {+comment}# %s{-comment}', $this->indentText, $style, $hook, $style, $path) - ); - - if ($this->newlineAfter) { - $printer->writeln(); - } - } - - /** - * Prints hook call output (if has some). - * - * @param OutputPrinter $printer - * @param CallResult $callResult - * @param string $indentText - */ - private function printHookCallStdOut(OutputPrinter $printer, CallResult $callResult, $indentText) - { - if (!$callResult->hasStdOut()) { - return; - } - - $pad = function ($line) use ($indentText) { - return sprintf( - '%s│ {+stdout}%s{-stdout}', $indentText, $line - ); - }; - - $printer->writeln(implode("\n", array_map($pad, explode("\n", $callResult->getStdOut())))); - $printer->writeln(sprintf('%s│', $indentText)); - } - - /** - * Prints hook call exception (if has some). - * - * @param OutputPrinter $printer - * @param CallResult $callResult - * @param string $indentText - */ - private function printHookCallException(OutputPrinter $printer, CallResult $callResult, $indentText) - { - if (!$callResult->hasException()) { - return; - } - - $pad = function ($l) use ($indentText) { - return sprintf( - '%s╳ {+exception}%s{-exception}', $indentText, $l - ); - }; - - $exception = $this->exceptionPresenter->presentException($callResult->getException()); - $printer->writeln(implode("\n", array_map($pad, explode("\n", $exception)))); - $printer->writeln(sprintf('%s│', $indentText)); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php deleted file mode 100644 index b8c8d46..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettySkippedStepPrinter.php +++ /dev/null @@ -1,162 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Output\Node\Printer\Helper\StepTextPainter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Behat\Tester\Result\DefinedStepResult; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\ArgumentInterface; -use Behat\Gherkin\Node\PyStringNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints steps as skipped. - * - * @author Konstantin Kudryashov - */ -final class PrettySkippedStepPrinter implements StepPrinter -{ - /** - * @var StepTextPainter - */ - private $textPainter; - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var PrettyPathPrinter - */ - private $pathPrinter; - /** - * @var string - */ - private $indentText; - /** - * @var string - */ - private $subIndentText; - - /** - * Initializes printer. - * - * @param StepTextPainter $textPainter - * @param ResultToStringConverter $resultConverter - * @param PrettyPathPrinter $pathPrinter - * @param integer $indentation - * @param integer $subIndentation - */ - public function __construct( - StepTextPainter $textPainter, - ResultToStringConverter $resultConverter, - PrettyPathPrinter $pathPrinter, - $indentation = 4, - $subIndentation = 2 - ) { - $this->textPainter = $textPainter; - $this->resultConverter = $resultConverter; - $this->pathPrinter = $pathPrinter; - $this->indentText = str_repeat(' ', intval($indentation)); - $this->subIndentText = $this->indentText . str_repeat(' ', intval($subIndentation)); - } - - /** - * {@inheritdoc} - */ - public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result) - { - $this->printText($formatter->getOutputPrinter(), $step->getKeyword(), $step->getText(), $result); - $this->pathPrinter->printStepPath($formatter, $scenario, $step, $result, mb_strlen($this->indentText, 'utf8')); - $this->printArguments($formatter, $step->getArguments()); - } - - /** - * Prints step text. - * - * @param OutputPrinter $printer - * @param string $stepType - * @param string $stepText - * @param StepResult $result - */ - private function printText(OutputPrinter $printer, $stepType, $stepText, StepResult $result) - { - $style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED); - - if ($result instanceof DefinedStepResult && $result->getStepDefinition()) { - $definition = $result->getStepDefinition(); - $stepText = $this->textPainter->paintText( - $stepText, $definition, new IntegerTestResult(TestResult::SKIPPED) - ); - } - - $printer->write(sprintf('%s{+%s}%s %s{-%s}', $this->indentText, $style, $stepType, $stepText, $style)); - } - - /** - * Prints step multiline arguments. - * - * @param Formatter $formatter - * @param ArgumentInterface[] $arguments - */ - private function printArguments(Formatter $formatter, array $arguments) - { - $style = $this->resultConverter->convertResultCodeToString(TestResult::SKIPPED); - - foreach ($arguments as $argument) { - $text = $this->getArgumentString($argument, !$formatter->getParameter('multiline')); - - $indentedText = implode("\n", array_map(array($this, 'subIndent'), explode("\n", $text))); - $formatter->getOutputPrinter()->writeln(sprintf('{+%s}%s{-%s}', $style, $indentedText, $style)); - } - } - - /** - * Returns argument string for provided argument. - * - * @param ArgumentInterface $argument - * @param bool $collapse - * - * @return string - */ - private function getArgumentString(ArgumentInterface $argument, $collapse = false) - { - if ($collapse) { - return '...'; - } - - if ($argument instanceof PyStringNode) { - $text = '"""' . "\n" . $argument . "\n" . '"""'; - - return $text; - } - - return (string) $argument; - } - - /** - * Indents text to the subIndentation level. - * - * @param string $text - * - * @return string - */ - private function subIndent($text) - { - return $this->subIndentText . $text; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStatisticsPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStatisticsPrinter.php deleted file mode 100644 index 23702c7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStatisticsPrinter.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\CounterPrinter; -use Behat\Behat\Output\Node\Printer\ListPrinter; -use Behat\Behat\Output\Node\Printer\StatisticsPrinter; -use Behat\Behat\Output\Statistics\Statistics; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints exercise statistics. - * - * @author Konstantin Kudryashov - */ -final class PrettyStatisticsPrinter implements StatisticsPrinter -{ - /** - * @var CounterPrinter - */ - private $counterPrinter; - /** - * @var ListPrinter - */ - private $listPrinter; - - /** - * Initializes printer. - * - * @param CounterPrinter $counterPrinter - * @param ListPrinter $listPrinter - */ - public function __construct(CounterPrinter $counterPrinter, ListPrinter $listPrinter) - { - $this->counterPrinter = $counterPrinter; - $this->listPrinter = $listPrinter; - } - - /** - * {@inheritdoc} - */ - public function printStatistics(Formatter $formatter, Statistics $statistics) - { - $printer = $formatter->getOutputPrinter(); - - $scenarioStats = $statistics->getSkippedScenarios(); - $this->listPrinter->printScenariosList($printer, 'skipped_scenarios_title', TestResult::SKIPPED, $scenarioStats); - - $scenarioStats = $statistics->getFailedScenarios(); - $this->listPrinter->printScenariosList($printer, 'failed_scenarios_title', TestResult::FAILED, $scenarioStats); - - $this->counterPrinter->printCounters($printer, 'scenarios_count', $statistics->getScenarioStatCounts()); - $this->counterPrinter->printCounters($printer, 'steps_count', $statistics->getStepStatCounts()); - - if ($formatter->getParameter('timer')) { - $timer = $statistics->getTimer(); - $memory = $statistics->getMemory(); - - $formatter->getOutputPrinter()->writeln(sprintf('%s (%s)', $timer, $memory)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php deleted file mode 100644 index ee2e5d0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Pretty/PrettyStepPrinter.php +++ /dev/null @@ -1,213 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Pretty; - -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Output\Node\Printer\Helper\StepTextPainter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Behat\Tester\Result\DefinedStepResult; -use Behat\Behat\Tester\Result\ExecutedStepResult; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\ArgumentInterface; -use Behat\Gherkin\Node\PyStringNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Exception\ExceptionPresenter; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\Tester\Result\ExceptionResult; - -/** - * Prints step. - * - * @author Konstantin Kudryashov - */ -final class PrettyStepPrinter implements StepPrinter -{ - /** - * @var StepTextPainter - */ - private $textPainter; - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var PrettyPathPrinter - */ - private $pathPrinter; - /** - * @var ExceptionPresenter - */ - private $exceptionPresenter; - /** - * @var string - */ - private $indentText; - /** - * @var string - */ - private $subIndentText; - - /** - * Initializes printer. - * - * @param StepTextPainter $textPainter - * @param ResultToStringConverter $resultConverter - * @param PrettyPathPrinter $pathPrinter - * @param ExceptionPresenter $exceptionPresenter - * @param integer $indentation - * @param integer $subIndentation - */ - public function __construct( - StepTextPainter $textPainter, - ResultToStringConverter $resultConverter, - PrettyPathPrinter $pathPrinter, - ExceptionPresenter $exceptionPresenter, - $indentation = 4, - $subIndentation = 2 - ) { - $this->textPainter = $textPainter; - $this->resultConverter = $resultConverter; - $this->pathPrinter = $pathPrinter; - $this->exceptionPresenter = $exceptionPresenter; - $this->indentText = str_repeat(' ', intval($indentation)); - $this->subIndentText = $this->indentText . str_repeat(' ', intval($subIndentation)); - } - - /** - * {@inheritdoc} - */ - public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result) - { - $this->printText($formatter->getOutputPrinter(), $step->getKeyword(), $step->getText(), $result); - $this->pathPrinter->printStepPath($formatter, $scenario, $step, $result, mb_strlen($this->indentText, 'utf8')); - $this->printArguments($formatter, $step->getArguments(), $result); - $this->printStdOut($formatter->getOutputPrinter(), $result); - $this->printException($formatter->getOutputPrinter(), $result); - } - - /** - * Prints step text. - * - * @param OutputPrinter $printer - * @param string $stepType - * @param string $stepText - * @param StepResult $result - */ - private function printText(OutputPrinter $printer, $stepType, $stepText, StepResult $result) - { - if ($result && $result instanceof DefinedStepResult && $result->getStepDefinition()) { - $definition = $result->getStepDefinition(); - $stepText = $this->textPainter->paintText($stepText, $definition, $result); - } - - $style = $this->resultConverter->convertResultToString($result); - $printer->write(sprintf('%s{+%s}%s %s{-%s}', $this->indentText, $style, $stepType, $stepText, $style)); - } - - /** - * Prints step multiline arguments. - * - * @param Formatter $formatter - * @param ArgumentInterface[] $arguments - * @param StepResult $result - */ - private function printArguments(Formatter $formatter, array $arguments, StepResult $result) - { - $style = $this->resultConverter->convertResultToString($result); - - foreach ($arguments as $argument) { - $text = $this->getArgumentString($argument, !$formatter->getParameter('multiline')); - - $indentedText = implode("\n", array_map(array($this, 'subIndent'), explode("\n", $text))); - $formatter->getOutputPrinter()->writeln(sprintf('{+%s}%s{-%s}', $style, $indentedText, $style)); - } - } - - /** - * Prints step output (if has one). - * - * @param OutputPrinter $printer - * @param StepResult $result - */ - private function printStdOut(OutputPrinter $printer, StepResult $result) - { - if (!$result instanceof ExecutedStepResult || null === $result->getCallResult()->getStdOut()) { - return; - } - - $callResult = $result->getCallResult(); - $indentedText = $this->subIndentText; - - $pad = function ($line) use ($indentedText) { - return sprintf( - '%s│ {+stdout}%s{-stdout}', $indentedText, $line - ); - }; - - $printer->writeln(implode("\n", array_map($pad, explode("\n", $callResult->getStdOut())))); - } - - /** - * Prints step exception (if has one). - * - * @param OutputPrinter $printer - * @param StepResult $result - */ - private function printException(OutputPrinter $printer, StepResult $result) - { - $style = $this->resultConverter->convertResultToString($result); - - if (!$result instanceof ExceptionResult || !$result->hasException()) { - return; - } - - $text = $this->exceptionPresenter->presentException($result->getException()); - $indentedText = implode("\n", array_map(array($this, 'subIndent'), explode("\n", $text))); - $printer->writeln(sprintf('{+%s}%s{-%s}', $style, $indentedText, $style)); - } - - /** - * Returns argument string for provided argument. - * - * @param ArgumentInterface $argument - * @param bool $collapse - * - * @return string - */ - private function getArgumentString(ArgumentInterface $argument, $collapse = false) - { - if ($collapse) { - return '...'; - } - - if ($argument instanceof PyStringNode) { - $text = '"""' . "\n" . $argument . "\n" . '"""'; - - return $text; - } - - return (string) $argument; - } - - /** - * Indents text to the subIndentation level. - * - * @param string $text - * - * @return string - */ - private function subIndent($text) - { - return $this->subIndentText . $text; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStatisticsPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStatisticsPrinter.php deleted file mode 100644 index a104178..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStatisticsPrinter.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Progress; - -use Behat\Behat\Output\Node\Printer\CounterPrinter; -use Behat\Behat\Output\Node\Printer\ListPrinter; -use Behat\Behat\Output\Node\Printer\StatisticsPrinter; -use Behat\Behat\Output\Statistics\Statistics; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Behat progress statistics printer. - * - * @author Konstantin Kudryashov - */ -final class ProgressStatisticsPrinter implements StatisticsPrinter -{ - /** - * @var CounterPrinter - */ - private $counterPrinter; - /** - * @var ListPrinter - */ - private $listPrinter; - - /** - * Initializes printer. - * - * @param CounterPrinter $counterPrinter - * @param ListPrinter $listPrinter - */ - public function __construct(CounterPrinter $counterPrinter, ListPrinter $listPrinter) - { - $this->counterPrinter = $counterPrinter; - $this->listPrinter = $listPrinter; - } - - /** - * {@inheritdoc} - */ - public function printStatistics(Formatter $formatter, Statistics $statistics) - { - $printer = $formatter->getOutputPrinter(); - - $printer->writeln(); - $printer->writeln(); - - $hookStats = $statistics->getFailedHookStats(); - $this->listPrinter->printFailedHooksList($printer, 'failed_hooks_title', $hookStats); - - $stepStats = $statistics->getFailedSteps(); - $this->listPrinter->printStepList($printer, 'failed_steps_title', TestResult::FAILED, $stepStats); - - $stepStats = $statistics->getPendingSteps(); - $this->listPrinter->printStepList($printer, 'pending_steps_title', TestResult::PENDING, $stepStats); - - $this->counterPrinter->printCounters($printer, 'scenarios_count', $statistics->getScenarioStatCounts()); - $this->counterPrinter->printCounters($printer, 'steps_count', $statistics->getStepStatCounts()); - - if ($formatter->getParameter('timer')) { - $timer = $statistics->getTimer(); - $memory = $statistics->getMemory(); - - $formatter->getOutputPrinter()->writeln(sprintf('%s (%s)', $timer, $memory)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStepPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStepPrinter.php deleted file mode 100644 index ca1656f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/Progress/ProgressStepPrinter.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer\Progress; - -use Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter; -use Behat\Behat\Output\Node\Printer\StepPrinter; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Behat progress step printer. - * - * @author Konstantin Kudryashov - */ -final class ProgressStepPrinter implements StepPrinter -{ - /** - * @var ResultToStringConverter - */ - private $resultConverter; - /** - * @var integer - */ - private $stepsPrinted = 0; - - /** - * Initializes printer. - * - * @param ResultToStringConverter $resultConverter - */ - public function __construct(ResultToStringConverter $resultConverter) - { - $this->resultConverter = $resultConverter; - } - - /** - * {@inheritdoc} - */ - public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result) - { - $printer = $formatter->getOutputPrinter(); - $style = $this->resultConverter->convertResultToString($result); - - switch ($result->getResultCode()) { - case TestResult::PASSED: - $printer->write("{+$style}.{-$style}"); - break; - case TestResult::SKIPPED: - $printer->write("{+$style}-{-$style}"); - break; - case TestResult::PENDING: - $printer->write("{+$style}P{-$style}"); - break; - case StepResult::UNDEFINED: - $printer->write("{+$style}U{-$style}"); - break; - case TestResult::FAILED: - $printer->write("{+$style}F{-$style}"); - break; - } - - if (++$this->stepsPrinted % 70 == 0) { - $printer->writeln(' ' . $this->stepsPrinted); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ScenarioPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ScenarioPrinter.php deleted file mode 100644 index 0260c41..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/ScenarioPrinter.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Prints scenario headers and footers. - * - * @author Konstantin Kudryashov - */ -interface ScenarioPrinter -{ - /** - * Prints scenario header using provided printer. - * - * @param Formatter $formatter - * @param FeatureNode $feature - * @param Scenario $scenario - */ - public function printHeader(Formatter $formatter, FeatureNode $feature, Scenario $scenario); - - /** - * Prints scenario footer using provided printer. - * - * @param Formatter $formatter - * @param TestResult $result - */ - public function printFooter(Formatter $formatter, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/SetupPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/SetupPrinter.php deleted file mode 100644 index 5a06527..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/SetupPrinter.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Behat setup printer interface. - * - * @author Konstantin Kudryashov - */ -interface SetupPrinter -{ - /** - * Prints setup state. - * - * @param Formatter $formatter - * @param Setup $setup - */ - public function printSetup(Formatter $formatter, Setup $setup); - - /** - * Prints teardown state. - * - * @param Formatter $formatter - * @param Teardown $teardown - */ - public function printTeardown(Formatter $formatter, Teardown $teardown); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/StatisticsPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/StatisticsPrinter.php deleted file mode 100644 index 7999a20..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/StatisticsPrinter.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Behat\Output\Statistics\Statistics; -use Behat\Testwork\Output\Formatter; - -/** - * Prints exercise statistics. - * - * @author Konstantin Kudryashov - */ -interface StatisticsPrinter -{ - /** - * Prints test suite statistics after run. - * - * @param Formatter $formatter - * @param Statistics $statistics - */ - public function printStatistics(Formatter $formatter, Statistics $statistics); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/StepPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/StepPrinter.php deleted file mode 100644 index 7b03c4b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/StepPrinter.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\ScenarioLikeInterface as Scenario; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Output\Formatter; - -/** - * Prints step with optional results. - * - * @author Konstantin Kudryashov - */ -interface StepPrinter -{ - /** - * Prints step using provided printer. - * - * @param Formatter $formatter - * @param Scenario $scenario - * @param StepNode $step - * @param StepResult $result - */ - public function printStep(Formatter $formatter, Scenario $scenario, StepNode $step, StepResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/SuitePrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/SuitePrinter.php deleted file mode 100644 index 58b8ef9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Node/Printer/SuitePrinter.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Node\Printer; - -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Suite\Suite; - -/** - * Prints suite headers and footers. - * - * @author Wouter J - */ -interface SuitePrinter -{ - /** - * Prints suite header using provided formatter. - * - * @param Formatter $formatter - * @param Suite $suite - */ - public function printHeader(Formatter $formatter, Suite $suite); - - /** - * Prints suite footer using provided printer. - * - * @param Formatter $formatter - * @param Suite $suite - */ - public function printFooter(Formatter $formatter, Suite $suite); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Printer/ConsoleOutputFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Printer/ConsoleOutputFactory.php deleted file mode 100644 index 4764e17..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Printer/ConsoleOutputFactory.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Printer; - -use Behat\Behat\Output\Printer\Formatter\ConsoleFormatter; -use Behat\Testwork\Output\Printer\Factory\ConsoleOutputFactory as BaseFactory; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; - -/** - * Extends default printer with default styles. - * - * @author Konstantin Kudryashov - */ -final class ConsoleOutputFactory extends BaseFactory -{ - /** - * {@inheritDoc} - */ - protected function createOutputFormatter() - { - $formatter = new ConsoleFormatter($this->isOutputDecorated()); - - foreach ($this->getDefaultStyles() as $name => $style) { - $formatter->setStyle($name, $style); - } - - return $formatter; - } - - /** - * Returns default styles. - * - * @return OutputFormatterStyle[string] - */ - private function getDefaultStyles() - { - return array( - 'keyword' => new OutputFormatterStyle(null, null, array('bold')), - 'stdout' => new OutputFormatterStyle(null, null, array()), - 'exception' => new OutputFormatterStyle('red'), - 'undefined' => new OutputFormatterStyle('yellow'), - 'pending' => new OutputFormatterStyle('yellow'), - 'pending_param' => new OutputFormatterStyle('yellow', null, array('bold')), - 'failed' => new OutputFormatterStyle('red'), - 'failed_param' => new OutputFormatterStyle('red', null, array('bold')), - 'passed' => new OutputFormatterStyle('green'), - 'passed_param' => new OutputFormatterStyle('green', null, array('bold')), - 'skipped' => new OutputFormatterStyle('cyan'), - 'skipped_param' => new OutputFormatterStyle('cyan', null, array('bold')), - 'comment' => new OutputFormatterStyle('black'), - 'tag' => new OutputFormatterStyle('cyan') - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Printer/Formatter/ConsoleFormatter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Printer/Formatter/ConsoleFormatter.php deleted file mode 100644 index 57d3ef3..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Printer/Formatter/ConsoleFormatter.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Printer\Formatter; - -use Symfony\Component\Console\Formatter\OutputFormatter as BaseOutputFormatter; - -/** - * Symfony2 Console output formatter extended with custom highlighting tokens support. - * - * @author Konstantin Kudryashov - */ -final class ConsoleFormatter extends BaseOutputFormatter -{ - public const CUSTOM_PATTERN = '/{\+([a-z-_]+)}(.*?){\-\\1}/si'; - - /** - * Formats a message according to the given styles. - * - * @param string $message The message to style - * - * @return string The styled message - */ - public function format($message): string - { - return preg_replace_callback(self::CUSTOM_PATTERN, array($this, 'replaceStyle'), $message); - } - - /** - * Replaces style of the output. - * - * @param array $match - * - * @return string The replaced style - */ - private function replaceStyle($match) - { - if (!$this->isDecorated()) { - return $match[2]; - } - - if ($this->hasStyle($match[1])) { - $style = $this->getStyle($match[1]); - } else { - return $match[0]; - } - - return $style->apply($match[2]); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php deleted file mode 100644 index c28d2cd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/JUnitFormatterFactory.php +++ /dev/null @@ -1,184 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\ServiceContainer\Formatter; - -use Behat\Testwork\Exception\ServiceContainer\ExceptionExtension; -use Behat\Testwork\Output\ServiceContainer\Formatter\FormatterFactory; -use Behat\Testwork\Output\ServiceContainer\OutputExtension; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Behat junit formatter factory. - * - * @author Wouter J - */ -final class JUnitFormatterFactory implements FormatterFactory -{ - /* - * Available services - */ - public const ROOT_LISTENER_ID = 'output.node.listener.junit'; - public const RESULT_TO_STRING_CONVERTER_ID = 'output.node.printer.result_to_string'; - - /** - * {@inheritdoc} - */ - public function buildFormatter(ContainerBuilder $container) - { - $this->loadRootNodeListener($container); - $this->loadPrinterHelpers($container); - $this->loadCorePrinters($container); - $this->loadFormatter($container); - } - - /** - * {@inheritdoc} - */ - public function processFormatter(ContainerBuilder $container) - { - } - - /** - * Loads printer helpers. - * - * @param ContainerBuilder $container - */ - private function loadPrinterHelpers(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter'); - $container->setDefinition(self::RESULT_TO_STRING_CONVERTER_ID, $definition); - } - - /** - * Loads the printers used to print the basic JUnit report. - * - * @param ContainerBuilder $container - */ - private function loadCorePrinters(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\JUnit\JUnitSuitePrinter', array( - new Reference('output.junit.statistics'), - )); - $container->setDefinition('output.node.printer.junit.suite', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\JUnit\JUnitFeaturePrinter', array( - new Reference('output.junit.statistics'), - new Reference('output.node.listener.junit.duration') - )); - $container->setDefinition('output.node.printer.junit.feature', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\JUnit\JUnitScenarioPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference('output.node.listener.junit.outline'), - new Reference('output.node.listener.junit.duration') - )); - $container->setDefinition('output.node.printer.junit.scenario', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\JUnit\JUnitStepPrinter', array( - new Reference(ExceptionExtension::PRESENTER_ID), - )); - $container->setDefinition('output.node.printer.junit.step', $definition); - - $definition = new Definition( - 'Behat\Behat\Output\Node\Printer\JUnit\JUnitSetupPrinter', array( - new Reference(ExceptionExtension::PRESENTER_ID), - ) - ); - $container->setDefinition('output.node.printer.junit.setup', $definition); - } - - /** - * Loads the node listeners required for JUnit printers to work. - * - * @param ContainerBuilder $container - */ - private function loadRootNodeListener(ContainerBuilder $container) - { - - $definition = new Definition('Behat\Behat\Output\Node\EventListener\JUnit\JUnitOutlineStoreListener', array( - new Reference('output.node.printer.junit.suite') - ) - ); - $container->setDefinition('output.node.listener.junit.outline', $definition); - - $definition = new Definition( - 'Behat\Behat\Output\Node\EventListener\JUnit\JUnitDurationListener' - ); - - $container->setDefinition('output.node.listener.junit.duration', $definition); - - $definition = new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( - array( - new Reference('output.node.listener.junit.duration'), - new Reference('output.node.listener.junit.outline'), - new Definition('Behat\Behat\Output\Node\EventListener\JUnit\JUnitFeatureElementListener', array( - new Reference('output.node.printer.junit.feature'), - new Reference('output.node.printer.junit.scenario'), - new Reference('output.node.printer.junit.step'), - new Reference('output.node.printer.junit.setup'), - )), - ), - )); - $container->setDefinition(self::ROOT_LISTENER_ID, $definition); - } - - /** - * Loads formatter itself. - * - * @param ContainerBuilder $container - */ - private function loadFormatter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Statistics\PhaseStatistics'); - $container->setDefinition('output.junit.statistics', $definition); - - $definition = new Definition('Behat\Testwork\Output\NodeEventListeningFormatter', array( - 'junit', - 'Outputs the failures in JUnit compatible files.', - array( - 'timer' => true, - ), - $this->createOutputPrinterDefinition(), - new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( - array( - new Reference(self::ROOT_LISTENER_ID), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\ScenarioStatsListener', array( - new Reference('output.junit.statistics') - )), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\StepStatsListener', array( - new Reference('output.junit.statistics'), - new Reference(ExceptionExtension::PRESENTER_ID) - )), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\HookStatsListener', array( - new Reference('output.junit.statistics'), - new Reference(ExceptionExtension::PRESENTER_ID) - )), - ), - )), - )); - $definition->addTag(OutputExtension::FORMATTER_TAG, array('priority' => 100)); - $container->setDefinition(OutputExtension::FORMATTER_TAG . '.junit', $definition); - } - - /** - * Creates output printer definition. - * - * @return Definition - */ - private function createOutputPrinterDefinition() - { - return new Definition('Behat\Testwork\Output\Printer\JUnitOutputPrinter', array( - new Definition('Behat\Testwork\Output\Printer\Factory\FilesystemOutputFactory'), - )); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php deleted file mode 100644 index b737ef2..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/PrettyFormatterFactory.php +++ /dev/null @@ -1,470 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\ServiceContainer\Formatter; - -use Behat\Behat\Definition\ServiceContainer\DefinitionExtension; -use Behat\Behat\EventDispatcher\Event\BackgroundTested; -use Behat\Behat\EventDispatcher\Event\OutlineTested; -use Behat\Behat\EventDispatcher\Event\ScenarioTested; -use Behat\Testwork\Exception\ServiceContainer\ExceptionExtension; -use Behat\Testwork\Output\ServiceContainer\Formatter\FormatterFactory; -use Behat\Testwork\Output\ServiceContainer\OutputExtension; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Behat pretty formatter factory. - * - * @author Konstantin Kudryashov - */ -class PrettyFormatterFactory implements FormatterFactory -{ - /** - * @var ServiceProcessor - */ - private $processor; - - /* - * Available services - */ - public const ROOT_LISTENER_ID = 'output.node.listener.pretty'; - public const RESULT_TO_STRING_CONVERTER_ID = 'output.node.printer.result_to_string'; - - /* - * Available extension points - */ - public const ROOT_LISTENER_WRAPPER_TAG = 'output.node.listener.pretty.wrapper'; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function buildFormatter(ContainerBuilder $container) - { - $this->loadRootNodeListener($container); - - $this->loadCorePrinters($container); - $this->loadTableOutlinePrinter($container); - $this->loadExpandedOutlinePrinter($container); - $this->loadHookPrinters($container); - $this->loadStatisticsPrinter($container); - $this->loadPrinterHelpers($container); - - $this->loadFormatter($container); - } - - /** - * {@inheritdoc} - */ - public function processFormatter(ContainerBuilder $container) - { - $this->processListenerWrappers($container); - } - - /** - * Loads pretty formatter node event listener. - * - * @param ContainerBuilder $container - */ - protected function loadRootNodeListener(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( - array( - new Definition('Behat\Behat\Output\Node\EventListener\AST\SuiteListener', array( - new Reference('output.node.printer.pretty.suite_setup') - )), - new Definition('Behat\Behat\Output\Node\EventListener\AST\FeatureListener', array( - new Reference('output.node.printer.pretty.feature'), - new Reference('output.node.printer.pretty.feature_setup') - )), - $this->proxySiblingEvents( - BackgroundTested::BEFORE, - BackgroundTested::AFTER, - array( - new Definition('Behat\Behat\Output\Node\EventListener\AST\ScenarioNodeListener', array( - BackgroundTested::AFTER_SETUP, - BackgroundTested::AFTER, - new Reference('output.node.printer.pretty.scenario') - )), - new Definition('Behat\Behat\Output\Node\EventListener\AST\StepListener', array( - new Reference('output.node.printer.pretty.step'), - new Reference('output.node.printer.pretty.step_setup') - )), - ) - ), - $this->proxySiblingEvents( - ScenarioTested::BEFORE, - ScenarioTested::AFTER, - array( - new Definition('Behat\Behat\Output\Node\EventListener\AST\ScenarioNodeListener', array( - ScenarioTested::AFTER_SETUP, - ScenarioTested::AFTER, - new Reference('output.node.printer.pretty.scenario'), - new Reference('output.node.printer.pretty.scenario_setup') - )), - new Definition('Behat\Behat\Output\Node\EventListener\AST\StepListener', array( - new Reference('output.node.printer.pretty.step'), - new Reference('output.node.printer.pretty.step_setup') - )), - ) - ), - $this->proxySiblingEvents( - OutlineTested::BEFORE, - OutlineTested::AFTER, - array( - $this->proxyEventsIfParameterIsSet( - 'expand', - false, - new Definition('Behat\Behat\Output\Node\EventListener\AST\OutlineTableListener', array( - new Reference('output.node.printer.pretty.outline_table'), - new Reference('output.node.printer.pretty.example_row'), - new Reference('output.node.printer.pretty.example_setup'), - new Reference('output.node.printer.pretty.example_step_setup') - )) - ), - $this->proxyEventsIfParameterIsSet( - 'expand', - true, - new Definition('Behat\Behat\Output\Node\EventListener\AST\OutlineListener', array( - new Reference('output.node.printer.pretty.outline'), - new Reference('output.node.printer.pretty.example'), - new Reference('output.node.printer.pretty.example_step'), - new Reference('output.node.printer.pretty.example_setup'), - new Reference('output.node.printer.pretty.example_step_setup') - )) - ) - ) - ), - ) - )); - $container->setDefinition(self::ROOT_LISTENER_ID, $definition); - } - - /** - * Loads formatter itself. - * - * @param ContainerBuilder $container - */ - protected function loadFormatter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Statistics\TotalStatistics'); - $container->setDefinition('output.pretty.statistics', $definition); - - $definition = new Definition('Behat\Testwork\Output\NodeEventListeningFormatter', array( - 'pretty', - 'Prints the feature as is.', - array( - 'timer' => true, - 'expand' => false, - 'paths' => true, - 'multiline' => true, - ), - $this->createOutputPrinterDefinition(), - new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( - array( - $this->rearrangeBackgroundEvents( - new Reference(self::ROOT_LISTENER_ID) - ), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\StatisticsListener', array( - new Reference('output.pretty.statistics'), - new Reference('output.node.printer.pretty.statistics') - )), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\ScenarioStatsListener', array( - new Reference('output.pretty.statistics') - )), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\StepStatsListener', array( - new Reference('output.pretty.statistics'), - new Reference(ExceptionExtension::PRESENTER_ID) - )), - ) - ) - ) - )); - $definition->addTag(OutputExtension::FORMATTER_TAG, array('priority' => 100)); - $container->setDefinition(OutputExtension::FORMATTER_TAG . '.pretty', $definition); - } - - /** - * Loads feature, scenario and step printers. - * - * @param ContainerBuilder $container - */ - protected function loadCorePrinters(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyFeaturePrinter'); - $container->setDefinition('output.node.printer.pretty.feature', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyPathPrinter', array( - new Reference('output.node.printer.pretty.width_calculator'), - '%paths.base%' - )); - $container->setDefinition('output.node.printer.pretty.path', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyScenarioPrinter', array( - new Reference('output.node.printer.pretty.path'), - )); - $container->setDefinition('output.node.printer.pretty.scenario', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyStepPrinter', array( - new Reference('output.node.printer.pretty.step_text_painter'), - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference('output.node.printer.pretty.path'), - new Reference(ExceptionExtension::PRESENTER_ID) - )); - $container->setDefinition('output.node.printer.pretty.step', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySkippedStepPrinter', array( - new Reference('output.node.printer.pretty.step_text_painter'), - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference('output.node.printer.pretty.path'), - )); - $container->setDefinition('output.node.printer.pretty.skipped_step', $definition); - } - - /** - * Loads table outline printer. - * - * @param ContainerBuilder $container - */ - protected function loadTableOutlinePrinter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyOutlineTablePrinter', array( - new Reference('output.node.printer.pretty.scenario'), - new Reference('output.node.printer.pretty.skipped_step'), - new Reference(self::RESULT_TO_STRING_CONVERTER_ID) - )); - $container->setDefinition('output.node.printer.pretty.outline_table', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyExampleRowPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID) - )); - $container->setDefinition('output.node.printer.pretty.example_row', $definition); - } - - /** - * Loads expanded outline printer. - * - * @param ContainerBuilder $container - */ - protected function loadExpandedOutlinePrinter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyOutlinePrinter', array( - new Reference('output.node.printer.pretty.scenario'), - new Reference('output.node.printer.pretty.skipped_step'), - new Reference(self::RESULT_TO_STRING_CONVERTER_ID) - )); - $container->setDefinition('output.node.printer.pretty.outline', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyExamplePrinter', array( - new Reference('output.node.printer.pretty.path'), - )); - $container->setDefinition('output.node.printer.pretty.example', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyStepPrinter', array( - new Reference('output.node.printer.pretty.step_text_painter'), - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference('output.node.printer.pretty.path'), - new Reference(ExceptionExtension::PRESENTER_ID), - 8 - )); - $container->setDefinition('output.node.printer.pretty.example_step', $definition); - } - - /** - * Loads hook printers. - * - * @param ContainerBuilder $container - */ - protected function loadHookPrinters(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - 0, - true, - true - )); - $container->setDefinition('output.node.printer.pretty.suite_setup', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - 0, - false, - true - )); - $container->setDefinition('output.node.printer.pretty.feature_setup', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - 2 - )); - $container->setDefinition('output.node.printer.pretty.scenario_setup', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - 4 - )); - $container->setDefinition('output.node.printer.pretty.step_setup', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - 8 - )); - $container->setDefinition('output.node.printer.pretty.example_step_setup', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettySetupPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - 6 - )); - $container->setDefinition('output.node.printer.pretty.example_setup', $definition); - } - - /** - * Loads statistics printer. - * - * @param ContainerBuilder $container - */ - protected function loadStatisticsPrinter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\CounterPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID), - )); - $container->setDefinition('output.node.printer.counter', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\ListPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID), - '%paths.base%' - )); - $container->setDefinition('output.node.printer.list', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Pretty\PrettyStatisticsPrinter', array( - new Reference('output.node.printer.counter'), - new Reference('output.node.printer.list') - )); - $container->setDefinition('output.node.printer.pretty.statistics', $definition); - } - - /** - * Loads printer helpers. - * - * @param ContainerBuilder $container - */ - protected function loadPrinterHelpers(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\Helper\WidthCalculator'); - $container->setDefinition('output.node.printer.pretty.width_calculator', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Helper\StepTextPainter', array( - new Reference(DefinitionExtension::PATTERN_TRANSFORMER_ID), - new Reference(self::RESULT_TO_STRING_CONVERTER_ID) - )); - $container->setDefinition('output.node.printer.pretty.step_text_painter', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter'); - $container->setDefinition(self::RESULT_TO_STRING_CONVERTER_ID, $definition); - } - - /** - * Creates output printer definition. - * - * @return Definition - */ - protected function createOutputPrinterDefinition() - { - return new Definition('Behat\Testwork\Output\Printer\StreamOutputPrinter', array( - new Definition('Behat\Behat\Output\Printer\ConsoleOutputFactory'), - )); - } - - /** - * Creates root listener definition. - * - * @param mixed $listener - * - * @return Definition - */ - protected function rearrangeBackgroundEvents($listener) - { - return new Definition('Behat\Behat\Output\Node\EventListener\Flow\FirstBackgroundFiresFirstListener', array( - new Definition('Behat\Behat\Output\Node\EventListener\Flow\OnlyFirstBackgroundFiresListener', array( - $listener - )) - )); - } - - /** - * Creates contextual proxy listener. - * - * @param string $beforeEventName - * @param string $afterEventName - * @param Definition[] $listeners - * - * @return Definition - */ - protected function proxySiblingEvents($beforeEventName, $afterEventName, array $listeners) - { - return new Definition('Behat\Behat\Output\Node\EventListener\Flow\FireOnlySiblingsListener', - array( - $beforeEventName, - $afterEventName, - new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array($listeners)) - ) - ); - } - - /** - * Creates contextual proxy listener. - * - * @param string $name - * @param mixed $value - * @param mixed $listener - * - * @return Definition - */ - protected function proxyEventsIfParameterIsSet($name, $value, Definition $listener) - { - return new Definition('Behat\Testwork\Output\Node\EventListener\Flow\FireOnlyIfFormatterParameterListener', - array($name, $value, $listener) - ); - } - - /** - * Processes all registered pretty formatter node listener wrappers. - * - * @param ContainerBuilder $container - */ - protected function processListenerWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::ROOT_LISTENER_ID, self::ROOT_LISTENER_WRAPPER_TAG); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/ProgressFormatterFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/ProgressFormatterFactory.php deleted file mode 100644 index 3e02154..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/ServiceContainer/Formatter/ProgressFormatterFactory.php +++ /dev/null @@ -1,195 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\ServiceContainer\Formatter; - -use Behat\Testwork\Exception\ServiceContainer\ExceptionExtension; -use Behat\Testwork\Output\ServiceContainer\Formatter\FormatterFactory; -use Behat\Testwork\Output\ServiceContainer\OutputExtension; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Behat progress formatter factory. - * - * @author Konstantin Kudryashov - */ -class ProgressFormatterFactory implements FormatterFactory -{ - /** - * @var ServiceProcessor - */ - private $processor; - - /* - * Available services - */ - public const ROOT_LISTENER_ID = 'output.node.listener.progress'; - public const RESULT_TO_STRING_CONVERTER_ID = 'output.node.printer.result_to_string'; - - /* - * Available extension points - */ - public const ROOT_LISTENER_WRAPPER_TAG = 'output.node.listener.progress.wrapper'; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function buildFormatter(ContainerBuilder $container) - { - $this->loadRootNodeListener($container); - $this->loadCorePrinters($container); - $this->loadPrinterHelpers($container); - $this->loadFormatter($container); - } - - /** - * {@inheritdoc} - */ - public function processFormatter(ContainerBuilder $container) - { - $this->processListenerWrappers($container); - } - - /** - * Loads progress formatter node event listener. - * - * @param ContainerBuilder $container - */ - protected function loadRootNodeListener(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\EventListener\AST\StepListener', array( - new Reference('output.node.printer.progress.step') - )); - $container->setDefinition(self::ROOT_LISTENER_ID, $definition); - } - - /** - * Loads feature, scenario and step printers. - * - * @param ContainerBuilder $container - */ - protected function loadCorePrinters(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\CounterPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID), - )); - $container->setDefinition('output.node.printer.counter', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\ListPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID), - new Reference(ExceptionExtension::PRESENTER_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID), - '%paths.base%' - )); - $container->setDefinition('output.node.printer.list', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Progress\ProgressStepPrinter', array( - new Reference(self::RESULT_TO_STRING_CONVERTER_ID) - )); - $container->setDefinition('output.node.printer.progress.step', $definition); - - $definition = new Definition('Behat\Behat\Output\Node\Printer\Progress\ProgressStatisticsPrinter', array( - new Reference('output.node.printer.counter'), - new Reference('output.node.printer.list') - )); - $container->setDefinition('output.node.printer.progress.statistics', $definition); - } - - /** - * Loads printer helpers. - * - * @param ContainerBuilder $container - */ - protected function loadPrinterHelpers(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Node\Printer\Helper\ResultToStringConverter'); - $container->setDefinition(self::RESULT_TO_STRING_CONVERTER_ID, $definition); - } - - /** - * Loads formatter itself. - * - * @param ContainerBuilder $container - */ - protected function loadFormatter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Output\Statistics\TotalStatistics'); - $container->setDefinition('output.progress.statistics', $definition); - - $definition = new Definition('Behat\Testwork\Output\NodeEventListeningFormatter', array( - 'progress', - 'Prints one character per step.', - array( - 'timer' => true - ), - $this->createOutputPrinterDefinition(), - new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array( - array( - new Reference(self::ROOT_LISTENER_ID), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\StatisticsListener', array( - new Reference('output.progress.statistics'), - new Reference('output.node.printer.progress.statistics') - )), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\ScenarioStatsListener', array( - new Reference('output.progress.statistics') - )), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\StepStatsListener', array( - new Reference('output.progress.statistics'), - new Reference(ExceptionExtension::PRESENTER_ID) - )), - new Definition('Behat\Behat\Output\Node\EventListener\Statistics\HookStatsListener', array( - new Reference('output.progress.statistics'), - new Reference(ExceptionExtension::PRESENTER_ID) - )), - ) - ) - ) - )); - $definition->addTag(OutputExtension::FORMATTER_TAG, array('priority' => 100)); - $container->setDefinition(OutputExtension::FORMATTER_TAG . '.progress', $definition); - } - - /** - * Creates output printer definition. - * - * @return Definition - */ - protected function createOutputPrinterDefinition() - { - return new Definition('Behat\Testwork\Output\Printer\StreamOutputPrinter', array( - new Definition('Behat\Behat\Output\Printer\ConsoleOutputFactory'), - )); - } - - /** - * Processes all registered pretty formatter node listener wrappers. - * - * @param ContainerBuilder $container - */ - protected function processListenerWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::ROOT_LISTENER_ID, self::ROOT_LISTENER_WRAPPER_TAG); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/HookStat.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/HookStat.php deleted file mode 100644 index e8afc31..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/HookStat.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Statistics; - -/** - * Represents hook stat. - * - * @author Konstantin Kudryashov - */ -final class HookStat -{ - /** - * @var string - */ - private $name; - /** - * @var string - */ - private $path; - /** - * @var string|null - */ - private $error; - /** - * @var string|null - */ - private $stdOut; - - /** - * Initializes hook stat. - * - * @param string $name - * @param string $path - * @param null|string $error - * @param null|string $stdOut - */ - public function __construct($name, $path, $error = null, $stdOut = null) - { - $this->name = $name; - $this->path = $path; - $this->error = $error; - $this->stdOut = $stdOut; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function isSuccessful() - { - return null === $this->error; - } - - /** - * Returns hook standard output (if has some). - * - * @return null|string - */ - public function getStdOut() - { - return $this->stdOut; - } - - /** - * Returns hook exception. - * - * @return string - */ - public function getError() - { - return $this->error; - } - - /** - * Returns hook path. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/PhaseStatistics.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/PhaseStatistics.php deleted file mode 100644 index c21e942..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/PhaseStatistics.php +++ /dev/null @@ -1,179 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Statistics; - -use Behat\Testwork\Counter\Timer; -use Behat\Testwork\Counter\Memory; - -/** - * A TotalStatistics decorator to get statistics per phase. - * - * This is useful to show the amount of failures - * in a single suite for instance. - * - * @author Wouter J - */ -final class PhaseStatistics implements Statistics -{ - /** - * @var TotalStatistics - */ - private $statistics; - - public function __construct() - { - $this->statistics = new TotalStatistics(); - } - - /** - * Resets the statistics. - */ - public function reset() - { - $this->statistics = new TotalStatistics(); - } - - /** - * Starts timer. - */ - public function startTimer() - { - $this->statistics->startTimer(); - } - - /** - * Stops timer. - */ - public function stopTimer() - { - $this->statistics->stopTimer(); - } - - /** - * Returns timer object. - * - * @return Timer - */ - public function getTimer() - { - return $this->statistics->getTimer(); - } - - /** - * Returns memory usage object. - * - * @return Memory - */ - public function getMemory() - { - return $this->statistics->getMemory(); - } - - /** - * Registers scenario stat. - * - * @param ScenarioStat $stat - */ - public function registerScenarioStat(ScenarioStat $stat) - { - $this->statistics->registerScenarioStat($stat); - } - - /** - * Registers step stat. - * - * @param StepStat $stat - */ - public function registerStepStat(StepStat $stat) - { - $this->statistics->registerStepStat($stat); - } - - /** - * Registers hook stat. - * - * @param HookStat $stat - */ - public function registerHookStat(HookStat $stat) - { - $this->statistics->registerHookStat($stat); - } - - /** - * Returns counters for different scenario result codes. - * - * @return array[] - */ - public function getScenarioStatCounts() - { - return $this->statistics->getScenarioStatCounts(); - } - - /** - * Returns skipped scenario stats. - * - * @return ScenarioStat[] - */ - public function getSkippedScenarios() - { - return $this->statistics->getSkippedScenarios(); - } - - /** - * Returns failed scenario stats. - * - * @return ScenarioStat[] - */ - public function getFailedScenarios() - { - return $this->statistics->getFailedScenarios(); - } - - /** - * Returns counters for different step result codes. - * - * @return array[] - */ - public function getStepStatCounts() - { - return $this->statistics->getStepStatCounts(); - } - - /** - * Returns failed step stats. - * - * @return StepStat[] - */ - public function getFailedSteps() - { - return $this->statistics->getFailedSteps(); - } - - /** - * Returns pending step stats. - * - * @return StepStat[] - */ - public function getPendingSteps() - { - return $this->statistics->getPendingSteps(); - } - - /** - * Returns failed hook stats. - * - * @return HookStat[] - */ - public function getFailedHookStats() - { - return $this->statistics->getFailedHookStats(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/ScenarioStat.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/ScenarioStat.php deleted file mode 100644 index 0af5005..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/ScenarioStat.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Statistics; - -/** - * Behat scenario stat. - * - * @author Konstantin Kudryashov - */ -final class ScenarioStat -{ - /** - * @var string - */ - private $title; - /** - * @var string - */ - private $path; - /** - * @var integer - */ - private $resultCode; - - /** - * Initializes scenario stat. - * - * @param string $title - * @param string $path - * @param integer $resultCode - */ - public function __construct($title, $path, $resultCode) - { - $this->title = $title; - $this->path = $path; - $this->resultCode = $resultCode; - } - - /** - * Returns scenario title. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Returns scenario path. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Returns scenario result code. - * - * @return integer - */ - public function getResultCode() - { - return $this->resultCode; - } - - /** - * Returns string representation for a stat. - * - * @return string - */ - public function __toString() - { - return $this->getPath(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/Statistics.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/Statistics.php deleted file mode 100644 index 4d20de9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/Statistics.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Statistics; - -use Behat\Testwork\Counter\Memory; -use Behat\Testwork\Counter\Timer; - - -/** - * Collects and provided exercise statistics. - * - * @author Wouter J - */ -interface Statistics -{ - /** - * Starts timer. - */ - public function startTimer(); - - /** - * Stops timer. - */ - public function stopTimer(); - - /** - * Returns timer object. - * - * @return Timer - */ - public function getTimer(); - - /** - * Returns memory usage object. - * - * @return Memory - */ - public function getMemory(); - - /** - * Registers scenario stat. - * - * @param ScenarioStat $stat - */ - public function registerScenarioStat(ScenarioStat $stat); - - /** - * Registers step stat. - * - * @param StepStat $stat - */ - public function registerStepStat(StepStat $stat); - - /** - * Registers hook stat. - * - * @param HookStat $stat - */ - public function registerHookStat(HookStat $stat); - - /** - * Returns counters for different scenario result codes. - * - * @return array[] - */ - public function getScenarioStatCounts(); - - /** - * Returns skipped scenario stats. - * - * @return ScenarioStat[] - */ - public function getSkippedScenarios(); - - /** - * Returns failed scenario stats. - * - * @return ScenarioStat[] - */ - public function getFailedScenarios(); - - /** - * Returns counters for different step result codes. - * - * @return array[] - */ - public function getStepStatCounts(); - - /** - * Returns failed step stats. - * - * @return StepStat[] - */ - public function getFailedSteps(); - - /** - * Returns pending step stats. - * - * @return StepStat[] - */ - public function getPendingSteps(); - - /** - * Returns failed hook stats. - * - * @return HookStat[] - */ - public function getFailedHookStats(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/StepStat.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/StepStat.php deleted file mode 100644 index 320d287..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/StepStat.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Statistics; - -/** - * Behat step stat. - * - * @author Konstantin Kudryashov - * - * @deprecated in favour of StepStatV2 and to be removed in 4.0 - */ -class StepStat -{ - /** - * @var string - */ - private $text; - /** - * @var string - */ - private $path; - /** - * @var integer - */ - private $resultCode; - /** - * @var null|string - */ - private $error; - /** - * @var null|string - */ - private $stdOut; - - /** - * Initializes step stat. - * - * @param string $text - * @param string $path - * @param integer $resultCode - * @param null|string $error - * @param null|string $stdOut - */ - public function __construct($text, $path, $resultCode, $error = null, $stdOut = null) - { - $this->text = $text; - $this->path = $path; - $this->resultCode = $resultCode; - $this->error = $error; - $this->stdOut = $stdOut; - } - - /** - * Returns step text. - * - * @return string - */ - public function getText() - { - return $this->text; - } - - /** - * Returns step path. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Returns step result code. - * - * @return integer - */ - public function getResultCode() - { - return $this->resultCode; - } - - /** - * Returns step error (if has one). - * - * @return null|string - */ - public function getError() - { - return $this->error; - } - - /** - * Returns step output (if has one). - * - * @return null|string - */ - public function getStdOut() - { - return $this->stdOut; - } - - /** - * Returns string representation for a stat. - * - * @return string - */ - public function __toString() - { - return $this->getPath(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/StepStatV2.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/StepStatV2.php deleted file mode 100644 index ae13fc6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/StepStatV2.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Statistics; - -/** - * Second iteration of Behat step stat, with a scenario information. - * - * @author Konstantin Kudryashov - */ -final class StepStatV2 extends StepStat -{ - /** - * @var string - */ - private $scenarioTitle; - /** - * @var string - */ - private $scenarioPath; - /** - * @var string - */ - private $stepText; - /** - * @var string - */ - private $stepPath; - /** - * @var integer - */ - private $resultCode; - /** - * @var null|string - */ - private $error; - /** - * @var null|string - */ - private $stdOut; - - /** - * Initializes step stat. - * - * @param string $scenarioTitle - * @param string $scenarioPath - * @param string $stepText - * @param string $stepPath - * @param integer $resultCode - * @param null|string $error - * @param null|string $stdOut - */ - public function __construct($scenarioTitle, $scenarioPath, $stepText, $stepPath, $resultCode, $error = null, $stdOut = null) - { - parent::__construct($stepText, $stepPath, $resultCode, $error, $stdOut); - - $this->scenarioTitle = $scenarioTitle; - $this->scenarioPath = $scenarioPath; - $this->stepText = $stepText; - $this->stepPath = $stepPath; - $this->resultCode = $resultCode; - $this->error = $error; - $this->stdOut = $stdOut; - } - - /** - * Returns associated scenario text. - * - * @return string - */ - public function getScenarioText() - { - return $this->scenarioTitle; - } - - /** - * Returns associated scenario path. - * - * @return string - */ - public function getScenarioPath() - { - return $this->scenarioPath; - } - - /** - * Returns step text. - * - * @return string - */ - public function getStepText() - { - return $this->stepText; - } - - /** - * Returns step path. - * - * @return string - */ - public function getStepPath() - { - return $this->stepPath; - } - - /** - * Returns step result code. - * - * @return integer - */ - public function getResultCode() - { - return $this->resultCode; - } - - /** - * Returns step error (if has one). - * - * @return null|string - */ - public function getError() - { - return $this->error; - } - - /** - * Returns step output (if has one). - * - * @return null|string - */ - public function getStdOut() - { - return $this->stdOut; - } - - /** - * Returns string representation for a stat. - * - * @return string - */ - public function __toString() - { - return $this->getPath(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/TotalStatistics.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/TotalStatistics.php deleted file mode 100644 index 1b89e87..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Output/Statistics/TotalStatistics.php +++ /dev/null @@ -1,244 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Output\Statistics; - -use Behat\Behat\Tester\Result\StepResult; -use Behat\Testwork\Counter\Memory; -use Behat\Testwork\Counter\Timer; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestResults; - -/** - * Collects and provided exercise statistics. - * - * @author Konstantin Kudryashov - */ -final class TotalStatistics implements Statistics -{ - /** - * @var Timer - */ - private $timer; - /** - * @var Memory - */ - private $memory; - /** - * @var array - */ - private $scenarioCounters = array(); - /** - * @var array - */ - private $stepCounters = array(); - /** - * @var ScenarioStat[] - */ - private $failedScenarioStats = array(); - /** - * @var ScenarioStat[] - */ - private $skippedScenarioStats = array(); - /** - * @var StepStat[] - */ - private $failedStepStats = array(); - /** - * @var StepStat[] - */ - private $pendingStepStats = array(); - /** - * @var HookStat[] - */ - private $failedHookStats = array(); - - /** - * Initializes statistics. - */ - public function __construct() - { - $this->resetAllCounters(); - - $this->timer = new Timer(); - $this->memory = new Memory(); - } - - public function resetAllCounters() - { - $this->scenarioCounters = $this->stepCounters = array( - TestResult::PASSED => 0, - TestResult::FAILED => 0, - StepResult::UNDEFINED => 0, - TestResult::PENDING => 0, - TestResult::SKIPPED => 0 - ); - } - - /** - * Starts timer. - */ - public function startTimer() - { - $this->timer->start(); - } - - /** - * Stops timer. - */ - public function stopTimer() - { - $this->timer->stop(); - } - - /** - * Returns timer object. - * - * @return Timer - */ - public function getTimer() - { - return $this->timer; - } - - /** - * Returns memory usage object. - * - * @return Memory - */ - public function getMemory() - { - return $this->memory; - } - - /** - * Registers scenario stat. - * - * @param ScenarioStat $stat - */ - public function registerScenarioStat(ScenarioStat $stat) - { - if (TestResults::NO_TESTS === $stat->getResultCode()) { - return; - } - - $this->scenarioCounters[$stat->getResultCode()]++; - - if (TestResult::FAILED === $stat->getResultCode()) { - $this->failedScenarioStats[] = $stat; - } - - if (TestResult::SKIPPED === $stat->getResultCode()) { - $this->skippedScenarioStats[] = $stat; - } - } - - /** - * Registers step stat. - * - * @param StepStat $stat - */ - public function registerStepStat(StepStat $stat) - { - $this->stepCounters[$stat->getResultCode()]++; - - if (TestResult::FAILED === $stat->getResultCode()) { - $this->failedStepStats[] = $stat; - } - - if (TestResult::PENDING === $stat->getResultCode()) { - $this->pendingStepStats[] = $stat; - } - } - - /** - * Registers hook stat. - * - * @param HookStat $stat - */ - public function registerHookStat(HookStat $stat) - { - if ($stat->isSuccessful()) { - return; - } - - $this->failedHookStats[] = $stat; - } - - /** - * Returns counters for different scenario result codes. - * - * @return array[] - */ - public function getScenarioStatCounts() - { - return $this->scenarioCounters; - } - - /** - * Returns skipped scenario stats. - * - * @return ScenarioStat[] - */ - public function getSkippedScenarios() - { - return $this->skippedScenarioStats; - } - - /** - * Returns failed scenario stats. - * - * @return ScenarioStat[] - */ - public function getFailedScenarios() - { - return $this->failedScenarioStats; - } - - /** - * Returns counters for different step result codes. - * - * @return array[] - */ - public function getStepStatCounts() - { - return $this->stepCounters; - } - - /** - * Returns failed step stats. - * - * @return StepStat[] - */ - public function getFailedSteps() - { - return $this->failedStepStats; - } - - /** - * Returns pending step stats. - * - * @return StepStat[] - */ - public function getPendingSteps() - { - return $this->pendingStepStats; - } - - /** - * Returns failed hook stats. - * - * @return HookStat[] - */ - public function getFailedHookStats() - { - return $this->failedHookStats; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/AggregateSnippet.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/AggregateSnippet.php deleted file mode 100644 index c63e8f1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/AggregateSnippet.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet; - -use Behat\Behat\Context\Snippet\ContextSnippet; -use Behat\Gherkin\Node\StepNode; - -/** - * Aggregates multiple similar snippets with different targets and steps. - * - * @author Konstantin Kudryashov - */ -final class AggregateSnippet -{ - /** - * @var Snippet[] - */ - private $snippets; - - /** - * Initializes snippet. - * - * @param Snippet[] $snippets - */ - public function __construct(array $snippets) - { - $this->snippets = $snippets; - } - - /** - * Returns snippet type. - * - * @return string - */ - public function getType() - { - return current($this->snippets)->getType(); - } - - /** - * Returns snippet unique ID (step type independent). - * - * @return string - */ - public function getHash() - { - return current($this->snippets)->getHash(); - } - - /** - * Returns definition snippet text. - * - * @return string - */ - public function getSnippet() - { - return current($this->snippets)->getSnippet(); - } - - /** - * Returns all steps interested in this snippet. - * - * @return StepNode[] - */ - public function getSteps() - { - return array_unique( - array_map( - function (Snippet $snippet) { - return $snippet->getStep(); - }, - $this->snippets - ), - SORT_REGULAR - ); - } - - /** - * Returns all snippet targets. - * - * @return string[] - */ - public function getTargets() - { - return array_unique( - array_map( - function (Snippet $snippet) { - return $snippet->getTarget(); - }, - $this->snippets - ) - ); - } - - /** - * Returns the classes used in the snippet which should be imported. - * - * @return string[] - */ - public function getUsedClasses() - { - if (empty($this->snippets)) { - return array(); - } - - return array_unique( - array_merge( - ...array_map( - function (Snippet $snippet) { - if (!$snippet instanceof ContextSnippet) { - return array(); - } - - return $snippet->getUsedClasses(); - }, - $this->snippets - ) - ) - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Appender/SnippetAppender.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Appender/SnippetAppender.php deleted file mode 100644 index 863d88f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Appender/SnippetAppender.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet\Appender; - -use Behat\Behat\Snippet\AggregateSnippet; -use Behat\Behat\Snippet\SnippetWriter; - -/** - * Appends snippets to its targets. Used by SnippetWriter. - * - * @see SnippetWriter - * - * @author Konstantin Kudryashov - */ -interface SnippetAppender -{ - /** - * Checks if appender supports snippet. - * - * @param AggregateSnippet $snippet - * - * @return bool - */ - public function supportsSnippet(AggregateSnippet $snippet); - - /** - * Appends snippet to the source. - * - * @param AggregateSnippet $snippet - */ - public function appendSnippet(AggregateSnippet $snippet); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Cli/SnippetsController.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Cli/SnippetsController.php deleted file mode 100644 index 8ecdac5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Cli/SnippetsController.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet\Cli; - -use Behat\Behat\EventDispatcher\Event\AfterStepTested; -use Behat\Behat\EventDispatcher\Event\StepTested; -use Behat\Behat\Snippet\Printer\ConsoleSnippetPrinter; -use Behat\Behat\Snippet\SnippetRegistry; -use Behat\Behat\Snippet\SnippetWriter; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Appends and prints snippets. - * - * @author Konstantin Kudryashov - */ -final class SnippetsController implements Controller -{ - /** - * @var SnippetRegistry - */ - private $registry; - /** - * @var SnippetWriter - */ - private $writer; - /** - * @var ConsoleSnippetPrinter - */ - private $printer; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - /** - * @var OutputInterface - */ - private $output; - - /** - * Initializes controller. - * - * @param SnippetRegistry $registry - * @param SnippetWriter $writer - * @param ConsoleSnippetPrinter $printer - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct( - SnippetRegistry $registry, - SnippetWriter $writer, - ConsoleSnippetPrinter $printer, - EventDispatcherInterface $eventDispatcher - ) { - $this->registry = $registry; - $this->writer = $writer; - $this->printer = $printer; - $this->eventDispatcher = $eventDispatcher; - } - - /** - * Configures command to be executable by the controller. - * - * @param Command $command - */ - public function configure(Command $command) - { - $command - ->addOption( - '--append-snippets', null, InputOption::VALUE_NONE, - "Appends snippets for undefined steps into main context." - ) - ->addOption( - '--no-snippets', null, InputOption::VALUE_NONE, - "Do not print snippets for undefined steps after stats." - ); - } - - /** - * Executes controller. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return null|integer - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $this->eventDispatcher->addListener(StepTested::AFTER, array($this, 'registerUndefinedStep'), -999); - $this->output = $output; - - if ($input->getOption('append-snippets')) { - $this->eventDispatcher->addListener(ExerciseCompleted::AFTER, array($this, 'appendAllSnippets'), -999); - } - - if (!$input->getOption('no-snippets') && !$input->getOption('append-snippets')) { - $this->eventDispatcher->addListener(ExerciseCompleted::AFTER, array($this, 'printAllSnippets'), -999); - } - - if (!$input->getOption('no-snippets')) { - $this->eventDispatcher->addListener(ExerciseCompleted::AFTER, array($this, 'printUndefinedSteps'), -995); - } - } - - /** - * Registers undefined step. - * - * @param AfterStepTested $event - */ - public function registerUndefinedStep(AfterStepTested $event) - { - if (StepResult::UNDEFINED === $event->getTestResult()->getResultCode()) { - $this->registry->registerUndefinedStep($event->getEnvironment(), $event->getStep()); - } - } - - /** - * Appends all snippets to corresponding targets. - */ - public function appendAllSnippets() - { - $snippets = $this->registry->getSnippets(); - count($snippets) && $this->output->writeln(''); - - $this->writer->appendSnippets($snippets); - } - - /** - * Prints all snippets. - */ - public function printAllSnippets() - { - $snippets = $this->registry->getSnippets(); - count($snippets) && $this->output->writeln(''); - - $this->writer->printSnippets($this->printer, $snippets); - } - - /** - * Prints all undefined steps. - */ - public function printUndefinedSteps() - { - $undefined = $this->registry->getUndefinedSteps(); - count($undefined) && $this->output->writeln(''); - - $this->writer->printUndefinedSteps($this->printer, $undefined); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Exception/EnvironmentSnippetGenerationException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Exception/EnvironmentSnippetGenerationException.php deleted file mode 100644 index 5b01e2f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Exception/EnvironmentSnippetGenerationException.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet\Exception; - -use Behat\Testwork\Environment\Environment; -use RuntimeException; - -/** - * Represents exception caused by an attempt to generate snippet for unsupported environment. - * - * @author Konstantin Kudryashov - */ -final class EnvironmentSnippetGenerationException extends RuntimeException implements SnippetException -{ - /** - * @var Environment - */ - private $environment; - - /** - * Initializes exception. - * - * @param string $message - * @param Environment $environment - */ - public function __construct($message, Environment $environment) - { - $this->environment = $environment; - - parent::__construct($message); - } - - /** - * Returns environment that caused exception. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Exception/SnippetException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Exception/SnippetException.php deleted file mode 100644 index f3b23ae..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Exception/SnippetException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * All snippet exceptions should implement this interface. - * - * @author Konstantin Kudryashov - */ -interface SnippetException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php deleted file mode 100644 index 09bbd11..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Generator/SnippetGenerator.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet\Generator; - -use Behat\Behat\Snippet\Snippet; -use Behat\Behat\Snippet\SnippetRegistry; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; - -/** - * Generates snippet for a specific step in a specific environment. - * - * @see SnippetRegistry - * - * @author Konstantin Kudryashov - */ -interface SnippetGenerator -{ - /** - * Checks if generator supports search query. - * - * @param Environment $environment - * @param StepNode $step - * - * @return bool - */ - public function supportsEnvironmentAndStep(Environment $environment, StepNode $step); - - /** - * Generates snippet from search. - * - * @param Environment $environment - * @param StepNode $step - * - * @return Snippet - */ - public function generateSnippet(Environment $environment, StepNode $step); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php deleted file mode 100644 index 4112b69..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Printer/ConsoleSnippetPrinter.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet\Printer; - -use Behat\Behat\Definition\Translator\TranslatorInterface; -use Behat\Behat\Snippet\AggregateSnippet; -use Behat\Gherkin\Node\StepNode; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Behat console-based snippet printer. - * - * Extends default printer with default styles. - * - * @author Konstantin Kudryashov - */ -class ConsoleSnippetPrinter implements SnippetPrinter -{ - /** - * @var OutputInterface - */ - private $output; - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * Initializes printer. - * - * @param OutputInterface $output - * @param TranslatorInterface $translator - */ - public function __construct(OutputInterface $output, TranslatorInterface $translator) - { - $this->output = $output; - $this->translator = $translator; - - $output->getFormatter()->setStyle('snippet_keyword', new OutputFormatterStyle(null, null, array('bold'))); - $output->getFormatter()->setStyle('snippet_undefined', new OutputFormatterStyle('yellow')); - } - - /** - * Prints snippets of specific target. - * - * @param string $targetName - * @param AggregateSnippet[] $snippets - */ - public function printSnippets($targetName, array $snippets) - { - $message = $this->translator->trans('snippet_proposal_title', array('%count%' => $targetName), 'output'); - - $this->output->writeln('--- ' . $message . PHP_EOL); - - foreach ($snippets as $snippet) { - $this->output->writeln(sprintf('%s', $snippet->getSnippet()) . PHP_EOL); - } - } - - /** - * Prints undefined steps of specific suite. - * - * @param string $suiteName - * @param StepNode[] $steps - */ - public function printUndefinedSteps($suiteName, array $steps) - { - $message = $this->translator->trans('snippet_missing_title', array('%count%' => $suiteName), 'output'); - - $this->output->writeln('--- ' . $message . PHP_EOL); - - foreach ($steps as $step) { - $this->output->writeln(sprintf(' %s %s', $step->getKeyword(), $step->getText())); - } - - $this->output->writeln(''); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Printer/SnippetPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Printer/SnippetPrinter.php deleted file mode 100644 index a0050af..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Printer/SnippetPrinter.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet\Printer; - -use Behat\Behat\Snippet\AggregateSnippet; -use Behat\Gherkin\Node\StepNode; - -/** - * Prints all snippets for a target. - * - * @author Konstantin Kudryashov - */ -interface SnippetPrinter -{ - /** - * Prints snippets of the specific target. - * - * @param string $targetName - * @param AggregateSnippet[] $snippets - */ - public function printSnippets($targetName, array $snippets); - - /** - * Prints undefined steps of the specific suite. - * - * @param string $suiteName - * @param StepNode[] $steps - */ - public function printUndefinedSteps($suiteName, array $steps); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/ServiceContainer/SnippetExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/ServiceContainer/SnippetExtension.php deleted file mode 100644 index 6c68821..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/ServiceContainer/SnippetExtension.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides snippet generation, printing and appending functionality. - * - * @author Konstantin Kudryashov - */ -class SnippetExtension implements Extension -{ - /* - * Available services - */ - public const REGISTRY_ID = 'snippet.registry'; - public const WRITER_ID = 'snippet.writer'; - - /* - * Available extension points - */ - public const GENERATOR_TAG = 'snippet.generator'; - public const APPENDER_TAG = 'snippet.appender'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'snippets'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadController($container); - $this->loadRegistry($container); - $this->loadWriter($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processGenerators($container); - $this->processAppenders($container); - } - - /** - * @param ContainerBuilder $container - */ - protected function loadController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Snippet\Printer\ConsoleSnippetPrinter', array( - new Reference(CliExtension::OUTPUT_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID) - )); - $container->setDefinition('snippet.printer', $definition); - - $definition = new Definition('Behat\Behat\Snippet\Cli\SnippetsController', array( - new Reference(self::REGISTRY_ID), - new Reference(self::WRITER_ID), - new Reference('snippet.printer'), - new Reference(EventDispatcherExtension::DISPATCHER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 400)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.snippet', $definition); - } - - /** - * @param ContainerBuilder $container - */ - protected function loadRegistry(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Snippet\SnippetRegistry'); - $container->setDefinition(self::REGISTRY_ID, $definition); - } - - /** - * @param ContainerBuilder $container - */ - protected function loadWriter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Snippet\SnippetWriter'); - $container->setDefinition(self::WRITER_ID, $definition); - } - - /** - * @param ContainerBuilder $container - */ - protected function processGenerators(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::GENERATOR_TAG); - $definition = $container->getDefinition(self::REGISTRY_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerSnippetGenerator', array($reference)); - } - } - - /** - * @param ContainerBuilder $container - */ - protected function processAppenders(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::APPENDER_TAG); - $definition = $container->getDefinition(self::WRITER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerSnippetAppender', array($reference)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Snippet.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Snippet.php deleted file mode 100644 index b96e445..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/Snippet.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet; - -use Behat\Gherkin\Node\StepNode; - -/** - * Step definition snippet. - * - * @author Konstantin Kudryashov - */ -interface Snippet -{ - /** - * Returns snippet type. - * - * @return string - */ - public function getType(); - - /** - * Returns snippet unique ID (step type independent). - * - * @return string - */ - public function getHash(); - - /** - * Returns definition snippet text. - * - * @return string - */ - public function getSnippet(); - - /** - * Returns step which asked for this snippet. - * - * @return StepNode - */ - public function getStep(); - - /** - * Returns snippet target. - * - * @return string - */ - public function getTarget(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetRegistry.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetRegistry.php deleted file mode 100644 index 7b92572..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetRegistry.php +++ /dev/null @@ -1,143 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet; - -use Behat\Behat\Snippet\Generator\SnippetGenerator; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; - -/** - * Acts like a snippet repository by producing snippets from registered undefined steps using snippet generators. - * - * @author Konstantin Kudryashov - */ -final class SnippetRegistry implements SnippetRepository -{ - /** - * @var SnippetGenerator[] - */ - private $generators = array(); - /** - * @var UndefinedStep[] - */ - private $undefinedSteps = array(); - /** - * @var AggregateSnippet[] - */ - private $snippets = array(); - /** - * @var bool - */ - private $snippetsGenerated = false; - - /** - * Registers snippet generator. - * - * @param SnippetGenerator $generator - */ - public function registerSnippetGenerator(SnippetGenerator $generator) - { - $this->generators[] = $generator; - $this->snippetsGenerated = false; - } - - /** - * Generates and registers snippet. - * - * @param Environment $environment - * @param StepNode $step - * - * @return null|Snippet - */ - public function registerUndefinedStep(Environment $environment, StepNode $step) - { - $this->undefinedSteps[] = new UndefinedStep($environment, $step); - $this->snippetsGenerated = false; - } - - /** - * Returns all generated snippets. - * - * @return AggregateSnippet[] - */ - public function getSnippets() - { - $this->generateSnippets(); - - return $this->snippets; - } - - /** - * Returns steps for which there was no snippet generated. - * - * @return UndefinedStep[] - */ - public function getUndefinedSteps() - { - $this->generateSnippets(); - - return $this->undefinedSteps; - } - - /** - * Generates snippets for undefined steps. - */ - private function generateSnippets() - { - if ($this->snippetsGenerated) { - return null; - } - - $snippetsSet = array(); - foreach ($this->undefinedSteps as $i => $undefinedStep) { - $snippet = $this->generateSnippet($undefinedStep->getEnvironment(), $undefinedStep->getStep()); - - if (!$snippet) { - continue; - } - - if (!isset($snippetsSet[$snippet->getHash()])) { - $snippetsSet[$snippet->getHash()] = array(); - } - - $snippetsSet[$snippet->getHash()][] = $snippet; - unset($this->undefinedSteps[$i]); - } - - $this->snippets = array_values( - array_map( - function (array $snippets) { - return new AggregateSnippet($snippets); - }, - $snippetsSet - ) - ); - $this->undefinedSteps = array_values($this->undefinedSteps); - $this->snippetsGenerated = true; - } - - /** - * @param Environment $environment - * @param StepNode $step - * - * @return null|Snippet - */ - private function generateSnippet(Environment $environment, StepNode $step) - { - foreach ($this->generators as $generator) { - if ($generator->supportsEnvironmentAndStep($environment, $step)) { - return $generator->generateSnippet($environment, $step); - } - } - - return null; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetRepository.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetRepository.php deleted file mode 100644 index 0305c4c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetRepository.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet; - -/** - * Provides snippets. - * - * @author Konstantin Kudryashov - */ -interface SnippetRepository -{ - /** - * Returns all generated snippets. - * - * @return AggregateSnippet[] - */ - public function getSnippets(); - - /** - * Returns steps for which there was no snippet generated. - * - * @return UndefinedStep[] - */ - public function getUndefinedSteps(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetWriter.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetWriter.php deleted file mode 100644 index 62d6e96..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/SnippetWriter.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet; - -use Behat\Behat\Snippet\Appender\SnippetAppender; -use Behat\Behat\Snippet\Printer\SnippetPrinter; - -/** - * Prints or appends snippets to a specific environment using registered appenders and printers. - * - * @author Konstantin Kudryashov - */ -final class SnippetWriter -{ - /** - * @var SnippetAppender[] - */ - private $appenders = array(); - - /** - * Registers snippet appender. - * - * @param SnippetAppender $appender - */ - public function registerSnippetAppender(SnippetAppender $appender) - { - $this->appenders[] = $appender; - } - - /** - * Appends snippets to appropriate targets. - * - * @param AggregateSnippet[] $snippets - */ - public function appendSnippets(array $snippets) - { - foreach ($snippets as $snippet) { - $this->appendSnippet($snippet); - } - } - - /** - * Prints snippets using provided printer. - * - * @param SnippetPrinter $printer - * @param AggregateSnippet[] $snippets - */ - public function printSnippets(SnippetPrinter $printer, array $snippets) - { - $printableSnippets = array(); - foreach ($snippets as $snippet) { - foreach ($snippet->getTargets() as $target) { - $targetSnippets = array(); - - if (isset($printableSnippets[$target])) { - $targetSnippets = $printableSnippets[$target]; - } - - $targetSnippets[] = $snippet; - $printableSnippets[$target] = $targetSnippets; - } - } - - foreach ($printableSnippets as $target => $targetSnippets) { - $printer->printSnippets($target, $targetSnippets); - } - } - - /** - * Prints undefined steps using provided printer. - * - * @param SnippetPrinter $printer - * @param UndefinedStep[] $undefinedSteps - */ - public function printUndefinedSteps(SnippetPrinter $printer, array $undefinedSteps) - { - $printableSteps = array(); - foreach ($undefinedSteps as $undefinedStep) { - $suiteName = $undefinedStep->getEnvironment()->getSuite()->getName(); - $step = $undefinedStep->getStep(); - - if (!isset($printableSteps[$suiteName])) { - $printableSteps[$suiteName] = array(); - } - - $printableSteps[$suiteName][$step->getText()] = $step; - } - - foreach ($printableSteps as $suiteName => $steps) { - $printer->printUndefinedSteps($suiteName, array_values($steps)); - } - } - - /** - * Appends snippet to appropriate targets. - * - * @param AggregateSnippet $snippet - */ - private function appendSnippet(AggregateSnippet $snippet) - { - foreach ($this->appenders as $appender) { - if (!$appender->supportsSnippet($snippet)) { - continue; - } - - $appender->appendSnippet($snippet); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/UndefinedStep.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/UndefinedStep.php deleted file mode 100644 index 58e3ddd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Snippet/UndefinedStep.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Snippet; - -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; - -/** - * Represents an undefined step in a specific environment. - * - * @author Konstantin Kudryashov - */ -final class UndefinedStep -{ - /** - * @var Environment - */ - private $environment; - /** - * @var StepNode - */ - private $step; - - /** - * Initializes undefined step. - * - * @param Environment $environment - * @param StepNode $step - */ - public function __construct(Environment $environment, StepNode $step) - { - $this->environment = $environment; - $this->step = $step; - } - - /** - * Returns environment that needs this step. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Returns undefined step node. - * - * @return StepNode - */ - public function getStep() - { - return $this->step; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/BackgroundTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/BackgroundTester.php deleted file mode 100644 index 10086c7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/BackgroundTester.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Prepares and tests background from a provided feature object against provided environment. - * - * @author Konstantin Kudryashov - */ -interface BackgroundTester -{ - /** - * Sets up background for a test. - * - * @param Environment $env - * @param FeatureNode $feature - * @param bool $skip - * - * @return Setup - */ - public function setUp(Environment $env, FeatureNode $feature, $skip); - - /** - * Tests background. - * - * @param Environment $env - * @param FeatureNode $feature - * @param bool $skip - * - * @return TestResult - */ - public function test(Environment $env, FeatureNode $feature, $skip); - - /** - * Tears down background after a test. - * - * @param Environment $env - * @param FeatureNode $feature - * @param bool $skip - * @param TestResult $result - * - * @return Teardown - */ - public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Cli/RerunController.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Cli/RerunController.php deleted file mode 100644 index 93bd84f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Cli/RerunController.php +++ /dev/null @@ -1,185 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Cli; - -use Behat\Behat\EventDispatcher\Event\AfterScenarioTested; -use Behat\Behat\EventDispatcher\Event\ExampleTested; -use Behat\Behat\EventDispatcher\Event\ScenarioTested; -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted; -use Behat\Testwork\Tester\Result\TestResult; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Caches failed scenarios and reruns only them if `--rerun` option provided. - * - * @author Konstantin Kudryashov - */ -final class RerunController implements Controller -{ - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - /** - * @var null|string - */ - private $cachePath; - /** - * @var string - */ - private $key; - /** - * @var string[] - */ - private $lines = array(); - /** - * @var string - */ - private $basepath; - - /** - * Initializes controller. - * - * @param EventDispatcherInterface $eventDispatcher - * @param null|string $cachePath - * @param string $basepath - */ - public function __construct(EventDispatcherInterface $eventDispatcher, $cachePath, $basepath) - { - $this->eventDispatcher = $eventDispatcher; - $this->cachePath = null !== $cachePath ? rtrim($cachePath, DIRECTORY_SEPARATOR) : null; - $this->basepath = $basepath; - } - - /** - * Configures command to be executable by the controller. - * - * @param Command $command - */ - public function configure(Command $command) - { - $command->addOption('--rerun', null, InputOption::VALUE_NONE, - 'Re-run scenarios that failed during last execution.' - ); - } - - /** - * Executes controller. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return null|integer - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $this->eventDispatcher->addListener(ScenarioTested::AFTER, array($this, 'collectFailedScenario'), -50); - $this->eventDispatcher->addListener(ExampleTested::AFTER, array($this, 'collectFailedScenario'), -50); - $this->eventDispatcher->addListener(ExerciseCompleted::AFTER, array($this, 'writeCache'), -50); - - $this->key = $this->generateKey($input); - - if (!$input->getOption('rerun')) { - return; - } - - if (!$this->getFileName() || !file_exists($this->getFileName())) { - return; - } - - $input->setArgument('paths', $this->getFileName()); - } - - /** - * Records scenario if it is failed. - * - * @param AfterScenarioTested $event - */ - public function collectFailedScenario(AfterScenarioTested $event) - { - if (!$this->getFileName()) { - return; - } - - if ($event->getTestResult()->getResultCode() !== TestResult::FAILED) { - return; - } - - $feature = $event->getFeature(); - $scenario = $event->getScenario(); - $suitename = $event->getSuite()->getName(); - - $this->lines[$suitename][] = $feature->getFile() . ':' . $scenario->getLine(); - } - - /** - * Writes failed scenarios cache. - */ - public function writeCache() - { - if (!$this->getFileName()) { - return; - } - - if (file_exists($this->getFileName())) { - unlink($this->getFileName()); - } - - if (0 === count($this->lines)) { - return; - } - - file_put_contents($this->getFileName(), json_encode($this->lines)); - } - - /** - * Generates cache key. - * - * @param InputInterface $input - * - * @return string - */ - private function generateKey(InputInterface $input) - { - return md5( - $input->getParameterOption(array('--profile', '-p')) . - $input->getOption('suite') . - implode(' ', $input->getOption('name')) . - implode(' ', $input->getOption('tags')) . - $input->getOption('role') . - $input->getArgument('paths') . - $this->basepath - ); - } - - /** - * Returns cache filename (if exists). - * - * @return null|string - */ - private function getFileName() - { - if (null === $this->cachePath || null === $this->key) { - return null; - } - - if (!is_dir($this->cachePath)) { - mkdir($this->cachePath, 0777); - } - - return $this->cachePath . DIRECTORY_SEPARATOR . $this->key . '.rerun'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/FeatureHasNoBackgroundException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/FeatureHasNoBackgroundException.php deleted file mode 100644 index 6d31eb1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/FeatureHasNoBackgroundException.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Exception; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Exception\TestworkException; -use RuntimeException; - -/** - * Represents exception throw during attempt to test non-existent feature background. - * - * @author Konstantin Kudryashov - */ -final class FeatureHasNoBackgroundException extends RuntimeException implements TestworkException -{ - /** - * @var FeatureNode - */ - private $feature; - - /** - * Initializes exception. - * - * @param string $message - * @param FeatureNode $feature - */ - public function __construct($message, FeatureNode $feature) - { - $this->feature = $feature; - - parent::__construct($message); - } - - /** - * Returns feature that caused exception. - * - * @return FeatureNode - */ - public function getFeature() - { - return $this->feature; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/PendingException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/PendingException.php deleted file mode 100644 index c328bd1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/PendingException.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Exception; - -use Behat\Testwork\Tester\Exception\TesterException; -use RuntimeException; - -/** - * Represents a pending exception. - * - * @author Konstantin Kudryashov - */ -final class PendingException extends RuntimeException implements TesterException -{ - /** - * Initializes pending exception. - * - * @param string $text - */ - public function __construct($text = 'TODO: write pending definition') - { - parent::__construct($text); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/Stringer/PendingExceptionStringer.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/Stringer/PendingExceptionStringer.php deleted file mode 100644 index ef299ce..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Exception/Stringer/PendingExceptionStringer.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Exception\Stringer; - -use Behat\Behat\Tester\Exception\PendingException; -use Behat\Testwork\Exception\Stringer\ExceptionStringer; -use Exception; - -/** - * Strings pending exceptions. - * - * @author Konstantin Kudryashov - */ -class PendingExceptionStringer implements ExceptionStringer -{ - /** - * {@inheritdoc} - */ - public function supportsException(Exception $exception) - { - return $exception instanceof PendingException; - } - - /** - * {@inheritdoc} - */ - public function stringException(Exception $exception, $verbosity) - { - return trim($exception->getMessage()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/OutlineTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/OutlineTester.php deleted file mode 100644 index 43b45e6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/OutlineTester.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Prepares and tests provided outline object against provided environment. - * - * @author Konstantin Kudryashov - */ -interface OutlineTester -{ - /** - * Sets up background for a test. - * - * @param Environment $env - * @param FeatureNode $feature - * @param OutlineNode $outline - * @param bool $skip - * - * @return Setup - */ - public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip); - - /** - * Tests outline. - * - * @param Environment $env - * @param FeatureNode $feature - * @param OutlineNode $outline - * @param bool $skip - * - * @return TestResult - */ - public function test(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip); - - /** - * Sets up background for a test. - * - * @param Environment $env - * @param FeatureNode $feature - * @param OutlineNode $outline - * @param bool $skip - * @param TestResult $result - * - * @return Teardown - */ - public function tearDown(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/DefinedStepResult.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/DefinedStepResult.php deleted file mode 100644 index ba0c935..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/DefinedStepResult.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Result; - -use Behat\Behat\Definition\Definition; - -/** - * Represents a step result that contains step definition. - * - * @author Konstantin Kudryashov - */ -interface DefinedStepResult extends StepResult -{ - /** - * Returns found step definition. - * - * @return null|Definition - */ - public function getStepDefinition(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/ExecutedStepResult.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/ExecutedStepResult.php deleted file mode 100644 index 40633ec..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/ExecutedStepResult.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Result; - -use Behat\Behat\Definition\SearchResult; -use Behat\Behat\Tester\Exception\PendingException; -use Behat\Testwork\Call\CallResult; -use Behat\Testwork\Tester\Result\ExceptionResult; - -/** - * Represents an executed (successfully or not) step result. - * - * @author Konstantin Kudryashov - */ -final class ExecutedStepResult implements StepResult, DefinedStepResult, ExceptionResult -{ - /** - * @var SearchResult - */ - private $searchResult; - /** - * @var null|CallResult - */ - private $callResult; - - /** - * Initialize test result. - * - * @param SearchResult $searchResult - * @param CallResult $callResult - */ - public function __construct(SearchResult $searchResult, CallResult $callResult) - { - $this->searchResult = $searchResult; - $this->callResult = $callResult; - } - - /** - * Returns definition search result. - * - * @return SearchResult - */ - public function getSearchResult() - { - return $this->searchResult; - } - - /** - * Returns definition call result or null if no call were made. - * - * @return CallResult - */ - public function getCallResult() - { - return $this->callResult; - } - - /** - * {@inheritdoc} - */ - public function getStepDefinition() - { - return $this->searchResult->getMatchedDefinition(); - } - - /** - * {@inheritdoc} - */ - public function hasException() - { - return null !== $this->getException(); - } - - /** - * {@inheritdoc} - */ - public function getException() - { - return $this->callResult->getException(); - } - - /** - * {@inheritdoc} - */ - public function getResultCode() - { - if ($this->callResult->hasException() && $this->callResult->getException() instanceof PendingException) { - return self::PENDING; - } - - if ($this->callResult->hasException()) { - return self::FAILED; - } - - return self::PASSED; - } - - /** - * {@inheritdoc} - */ - public function isPassed() - { - return self::PASSED == $this->getResultCode(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/FailedStepSearchResult.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/FailedStepSearchResult.php deleted file mode 100644 index 94fe072..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/FailedStepSearchResult.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Result; - -use Behat\Behat\Definition\Exception\SearchException; -use Behat\Testwork\Tester\Result\ExceptionResult; - -/** - * Represents a step test result with a failed definition search. - * - * @author Konstantin Kudryashov - */ -final class FailedStepSearchResult implements StepResult, ExceptionResult -{ - /** - * @var SearchException - */ - private $searchException; - - /** - * Initializes result. - * - * @param SearchException $searchException - */ - public function __construct(SearchException $searchException) - { - $this->searchException = $searchException; - } - - /** - * {@inheritdoc} - */ - public function hasException() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function getException() - { - return $this->searchException; - } - - /** - * {@inheritdoc} - */ - public function isPassed() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getResultCode() - { - return self::FAILED; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/SkippedStepResult.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/SkippedStepResult.php deleted file mode 100644 index 4788d24..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/SkippedStepResult.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Result; - -use Behat\Behat\Definition\SearchResult; - -/** - * Represents a skipped step result. - * - * @author Konstantin Kudryashov - */ -final class SkippedStepResult implements StepResult, DefinedStepResult -{ - /** - * @var SearchResult - */ - private $searchResult; - - /** - * Initializes step result. - * - * @param SearchResult $searchResult - */ - public function __construct(SearchResult $searchResult) - { - $this->searchResult = $searchResult; - } - - /** - * Returns definition search result. - * - * @return SearchResult - */ - public function getSearchResult() - { - return $this->searchResult; - } - - /** - * {@inheritdoc} - */ - public function getStepDefinition() - { - return $this->searchResult->getMatchedDefinition(); - } - - /** - * {@inheritdoc} - */ - public function isPassed() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getResultCode() - { - return self::SKIPPED; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/StepResult.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/StepResult.php deleted file mode 100644 index 87cec35..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/StepResult.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Result; - -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Extends Testwork test result with support for undefined status. - * - * @author Konstantin Kudryashov - */ -interface StepResult extends TestResult -{ - public const UNDEFINED = 30; -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/UndefinedStepResult.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/UndefinedStepResult.php deleted file mode 100644 index 1268cb7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Result/UndefinedStepResult.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Result; - -/** - * Represents an undefined step result. - * - * @author Konstantin Kudryashov - */ -final class UndefinedStepResult implements StepResult -{ - /** - * {@inheritdoc} - */ - public function isPassed() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function getResultCode() - { - return self::UNDEFINED; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/IsolatingScenarioTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/IsolatingScenarioTester.php deleted file mode 100644 index f526b70..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/IsolatingScenarioTester.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Runtime; - -use Behat\Behat\Tester\ScenarioTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface as Scenario; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\EnvironmentManager; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestWithSetupResult; -use Behat\Testwork\Tester\Setup\SuccessfulSetup; -use Behat\Testwork\Tester\Setup\SuccessfulTeardown; - -/** - * Scenario tester that isolates the environment for each scenario. - * - * @author Konstantin Kudryashov - */ -final class IsolatingScenarioTester implements ScenarioTester -{ - /** - * @var ScenarioTester - */ - private $decoratedTester; - /** - * @var EnvironmentManager - */ - private $envManager; - - /** - * Initialises tester. - * - * @param ScenarioTester $decoratedTester - * @param EnvironmentManager $envManager - */ - public function __construct(ScenarioTester $decoratedTester, EnvironmentManager $envManager) - { - $this->decoratedTester = $decoratedTester; - $this->envManager = $envManager; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario, $skip) - { - return new SuccessfulSetup(); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, Scenario $scenario, $skip) - { - $isolatedEnvironment = $this->envManager->isolateEnvironment($env, $scenario); - - $setup = $this->decoratedTester->setUp($isolatedEnvironment, $feature, $scenario, $skip); - $localSkip = !$setup->isSuccessful() || $skip; - $testResult = $this->decoratedTester->test($isolatedEnvironment, $feature, $scenario, $localSkip); - $teardown = $this->decoratedTester->tearDown($isolatedEnvironment, $feature, $scenario, $localSkip, $testResult); - - $integerResult = new IntegerTestResult($testResult->getResultCode()); - - return new TestWithSetupResult($setup, $integerResult, $teardown); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result) - { - return new SuccessfulTeardown(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeBackgroundTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeBackgroundTester.php deleted file mode 100644 index 72d5c9d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeBackgroundTester.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Runtime; - -use Behat\Behat\Tester\BackgroundTester; -use Behat\Behat\Tester\Exception\FeatureHasNoBackgroundException; -use Behat\Behat\Tester\StepContainerTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestResults; -use Behat\Testwork\Tester\Setup\SuccessfulSetup; -use Behat\Testwork\Tester\Setup\SuccessfulTeardown; - -/** - * Tester executing background tests in the runtime. - * - * @author Konstantin Kudryashov - */ -final class RuntimeBackgroundTester implements BackgroundTester -{ - /** - * @var StepContainerTester - */ - private $containerTester; - - /** - * Initializes tester. - * - * @param StepContainerTester $containerTester - */ - public function __construct(StepContainerTester $containerTester) - { - $this->containerTester = $containerTester; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, $skip) - { - return new SuccessfulSetup(); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, $skip) - { - $background = $feature->getBackground(); - - if (null === $background) { - throw new FeatureHasNoBackgroundException(sprintf( - 'Feature `%s` has no background that could be tested.', - $feature->getFile() - ), $feature); - } - - if (!$background->hasSteps()) { - return new IntegerTestResult(TestResult::PASSED); - } - - $results = $this->containerTester->test($env, $feature, $background, $skip); - - return new TestResults($results); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, $skip, TestResult $result) - { - return new SuccessfulTeardown(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php deleted file mode 100644 index dcafc7e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeFeatureTester.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Runtime; - -use Behat\Behat\Tester\OutlineTester; -use Behat\Behat\Tester\ScenarioTester; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\EnvironmentManager; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestResults; -use Behat\Testwork\Tester\Result\TestWithSetupResult; -use Behat\Testwork\Tester\Setup\SuccessfulSetup; -use Behat\Testwork\Tester\Setup\SuccessfulTeardown; -use Behat\Testwork\Tester\SpecificationTester; - -/** - * Tester executing feature tests in the runtime. - * - * @author Konstantin Kudryashov - */ -final class RuntimeFeatureTester implements SpecificationTester -{ - /** - * @var ScenarioTester - */ - private $scenarioTester; - /** - * @var OutlineTester - */ - private $outlineTester; - /** - * @var EnvironmentManager - */ - private $envManager; - - /** - * Initializes tester. - * - * @param ScenarioTester $scenarioTester - * @param OutlineTester $outlineTester - * @param EnvironmentManager $envManager - * - * TODO: Remove EnvironmentManager parameter in next major - */ - public function __construct( - ScenarioTester $scenarioTester, - OutlineTester $outlineTester, - EnvironmentManager $envManager - ) { - $this->scenarioTester = $scenarioTester; - $this->outlineTester = $outlineTester; - $this->envManager = $envManager; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, $spec, $skip) - { - return new SuccessfulSetup(); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, $feature, $skip = false) - { - $results = array(); - foreach ($feature->getScenarios() as $scenario) { - $tester = $scenario instanceof OutlineNode ? $this->outlineTester : $this->scenarioTester; - - $setup = $tester->setUp($env, $feature, $scenario, $skip); - $localSkip = !$setup->isSuccessful() || $skip; - $testResult = $tester->test($env, $feature, $scenario, $localSkip); - $teardown = $tester->tearDown($env, $feature, $scenario, $localSkip, $testResult); - - $integerResult = new IntegerTestResult($testResult->getResultCode()); - $results[] = new TestWithSetupResult($setup, $integerResult, $teardown); - } - - return new TestResults($results); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, $spec, $skip, TestResult $result) - { - return new SuccessfulTeardown(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeOutlineTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeOutlineTester.php deleted file mode 100644 index 1c1c38b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeOutlineTester.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Runtime; - -use Behat\Behat\Tester\OutlineTester; -use Behat\Behat\Tester\ScenarioTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestResults; -use Behat\Testwork\Tester\Result\TestWithSetupResult; -use Behat\Testwork\Tester\Setup\SuccessfulSetup; -use Behat\Testwork\Tester\Setup\SuccessfulTeardown; - -/** - * Tester executing outline tests in the runtime. - * - * @author Konstantin Kudryashov - */ -final class RuntimeOutlineTester implements OutlineTester -{ - /** - * @var ScenarioTester - */ - private $scenarioTester; - - /** - * Initializes tester. - * - * @param ScenarioTester $scenarioTester - */ - public function __construct(ScenarioTester $scenarioTester) - { - $this->scenarioTester = $scenarioTester; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip) - { - return new SuccessfulSetup(); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip = false) - { - $results = array(); - foreach ($outline->getExamples() as $example) { - $setup = $this->scenarioTester->setUp($env, $feature, $example, $skip); - $localSkip = !$setup->isSuccessful() || $skip; - $testResult = $this->scenarioTester->test($env, $feature, $example, $localSkip); - $teardown = $this->scenarioTester->tearDown($env, $feature, $example, $localSkip, $testResult); - - $integerResult = new IntegerTestResult($testResult->getResultCode()); - $results[] = new TestWithSetupResult($setup, $integerResult, $teardown); - } - - return new TestResults($results); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, OutlineNode $outline, $skip, TestResult $result) - { - return new SuccessfulTeardown(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php deleted file mode 100644 index 08b8ca9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeScenarioTester.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Runtime; - -use Behat\Behat\Tester\BackgroundTester; -use Behat\Behat\Tester\StepContainerTester; -use Behat\Behat\Tester\ScenarioTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface as Scenario; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestResults; -use Behat\Testwork\Tester\Result\TestWithSetupResult; -use Behat\Testwork\Tester\Setup\SuccessfulSetup; -use Behat\Testwork\Tester\Setup\SuccessfulTeardown; - -/** - * Tester executing scenario or example tests in the runtime. - * - * @author Konstantin Kudryashov - */ -final class RuntimeScenarioTester implements ScenarioTester -{ - /** - * @var StepContainerTester - */ - private $containerTester; - /** - * @var BackgroundTester - */ - private $backgroundTester; - - /** - * Initializes tester. - * - * @param StepContainerTester $containerTester - * @param BackgroundTester $backgroundTester - */ - public function __construct(StepContainerTester $containerTester, BackgroundTester $backgroundTester) - { - $this->containerTester = $containerTester; - $this->backgroundTester = $backgroundTester; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, Scenario $example, $skip) - { - return new SuccessfulSetup(); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, Scenario $scenario, $skip = false) - { - $results = array(); - - if ($feature->hasBackground()) { - $backgroundResult = $this->testBackground($env, $feature, $skip); - $skip = !$backgroundResult->isPassed() || $skip; - - $results[] = $backgroundResult; - } - - $results = array_merge($results, $this->containerTester->test($env, $feature, $scenario, $skip)); - - return new TestResults($results); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result) - { - return new SuccessfulTeardown(); - } - - /** - * Tests background of the provided feature against provided environment. - * - * @param Environment $env - * @param FeatureNode $feature - * @param bool $skip - * - * @return TestResult - */ - private function testBackground(Environment $env, FeatureNode $feature, $skip) - { - $setup = $this->backgroundTester->setUp($env, $feature, $skip); - $skipSetup = !$setup->isSuccessful() || $skip; - $testResult = $this->backgroundTester->test($env, $feature, $skipSetup); - $teardown = $this->backgroundTester->tearDown($env, $feature, $skipSetup, $testResult); - - $integerResult = new IntegerTestResult($testResult->getResultCode()); - - return new TestWithSetupResult($setup, $integerResult, $teardown); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php deleted file mode 100644 index 46959f6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/Runtime/RuntimeStepTester.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\Runtime; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Definition\DefinitionFinder; -use Behat\Behat\Definition\Exception\SearchException; -use Behat\Behat\Definition\SearchResult; -use Behat\Behat\Tester\Result\ExecutedStepResult; -use Behat\Behat\Tester\Result\FailedStepSearchResult; -use Behat\Behat\Tester\Result\SkippedStepResult; -use Behat\Behat\Tester\Result\StepResult; -use Behat\Behat\Tester\Result\UndefinedStepResult; -use Behat\Behat\Tester\StepTester; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Setup\SuccessfulSetup; -use Behat\Testwork\Tester\Setup\SuccessfulTeardown; - -/** - * Tester executing step tests in the runtime. - * - * @author Konstantin Kudryashov - */ -final class RuntimeStepTester implements StepTester -{ - /** - * @var DefinitionFinder - */ - private $definitionFinder; - /** - * @var CallCenter - */ - private $callCenter; - - /** - * Initialize tester. - * - * @param DefinitionFinder $definitionFinder - * @param CallCenter $callCenter - */ - public function __construct(DefinitionFinder $definitionFinder, CallCenter $callCenter) - { - $this->definitionFinder = $definitionFinder; - $this->callCenter = $callCenter; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip) - { - return new SuccessfulSetup(); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, FeatureNode $feature, StepNode $step, $skip = false) - { - try { - $search = $this->searchDefinition($env, $feature, $step); - $result = $this->testDefinition($env, $feature, $step, $search, $skip); - } catch (SearchException $exception) { - $result = new FailedStepSearchResult($exception); - } - - return $result; - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result) - { - return new SuccessfulTeardown(); - } - - /** - * Searches for a definition. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * - * @return SearchResult - */ - private function searchDefinition(Environment $env, FeatureNode $feature, StepNode $step) - { - return $this->definitionFinder->findDefinition($env, $feature, $step); - } - - /** - * Tests found definition. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * @param SearchResult $search - * @param bool $skip - * - * @return StepResult - */ - private function testDefinition(Environment $env, FeatureNode $feature, StepNode $step, SearchResult $search, $skip) - { - if (!$search->hasMatch()) { - return new UndefinedStepResult(); - } - - if ($skip) { - return new SkippedStepResult($search); - } - - $call = $this->createDefinitionCall($env, $feature, $search, $step); - $result = $this->callCenter->makeCall($call); - - return new ExecutedStepResult($search, $result); - } - - /** - * Creates definition call. - * - * @param Environment $env - * @param FeatureNode $feature - * @param SearchResult $search - * @param StepNode $step - * - * @return DefinitionCall - */ - private function createDefinitionCall(Environment $env, FeatureNode $feature, SearchResult $search, StepNode $step) - { - $definition = $search->getMatchedDefinition(); - $arguments = $search->getMatchedArguments(); - - return new DefinitionCall($env, $feature, $step, $definition, $arguments); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php deleted file mode 100644 index 601e4f6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface as Scenario; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Prepares and tests provided scenario object against provided environment. - * - * @author Konstantin Kudryashov - */ -interface ScenarioTester -{ - /** - * Sets up example for a test. - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - * @param bool $skip - * - * @return Setup - */ - public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario, $skip); - - /** - * Tests example. - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - * @param bool $skip - * - * @return TestResult - */ - public function test(Environment $env, FeatureNode $feature, Scenario $scenario, $skip); - - /** - * Tears down example after a test. - * - * @param Environment $env - * @param FeatureNode $feature - * @param Scenario $scenario - * @param bool $skip - * @param TestResult $result - * - * @return Teardown - */ - public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/ServiceContainer/TesterExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/ServiceContainer/TesterExtension.php deleted file mode 100644 index e8ba129..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/ServiceContainer/TesterExtension.php +++ /dev/null @@ -1,315 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester\ServiceContainer; - -use Behat\Behat\Definition\ServiceContainer\DefinitionExtension; -use Behat\Testwork\Call\ServiceContainer\CallExtension; -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; -use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension; -use Behat\Testwork\Exception\ServiceContainer\ExceptionExtension; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Tester\ServiceContainer\TesterExtension as BaseExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides gherkin testers. - * - * @author Konstantin Kudryashov - */ -class TesterExtension extends BaseExtension -{ - /* - * Available services - */ - public const SCENARIO_TESTER_ID = 'tester.scenario'; - public const OUTLINE_TESTER_ID = 'tester.outline'; - public const EXAMPLE_TESTER_ID = 'tester.example'; - public const BACKGROUND_TESTER_ID = 'tester.background'; - public const STEP_TESTER_ID = 'tester.step'; - - /** - * Available extension points - */ - public const SCENARIO_TESTER_WRAPPER_TAG = 'tester.scenario.wrapper'; - public const OUTLINE_TESTER_WRAPPER_TAG = 'tester.outline.wrapper'; - public const EXAMPLE_TESTER_WRAPPER_TAG = 'tester.example.wrapper'; - public const BACKGROUND_TESTER_WRAPPER_TAG = 'tester.background.wrapper'; - public const STEP_TESTER_WRAPPER_TAG = 'tester.step.wrapper'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - - parent::__construct($this->processor); - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - parent::configure($builder); - - $builder - ->children() - ->scalarNode('rerun_cache') - ->info('Sets the rerun cache path') - ->defaultValue( - is_writable(sys_get_temp_dir()) - ? sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat_rerun_cache' - : null - ) - ->end() - ->end() - ; - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - parent::load($container, $config); - - $this->loadRerunController($container, $config['rerun_cache']); - $this->loadPendingExceptionStringer($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - parent::process($container); - - $this->processScenarioTesterWrappers($container); - $this->processOutlineTesterWrappers($container); - $this->processExampleTesterWrappers($container); - $this->processBackgroundTesterWrappers($container); - $this->processStepTesterWrappers($container); - } - - /** - * Loads specification tester. - * - * @param ContainerBuilder $container - */ - protected function loadSpecificationTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Tester\Runtime\RuntimeFeatureTester', array( - new Reference(self::SCENARIO_TESTER_ID), - new Reference(self::OUTLINE_TESTER_ID), - new Reference(EnvironmentExtension::MANAGER_ID) - )); - $container->setDefinition(self::SPECIFICATION_TESTER_ID, $definition); - - $this->loadScenarioTester($container); - $this->loadOutlineTester($container); - $this->loadBackgroundTester($container); - $this->loadStepTester($container); - } - - /** - * Loads scenario tester. - * - * @param ContainerBuilder $container - */ - protected function loadScenarioTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Tester\StepContainerTester', array( - new Reference(self::STEP_TESTER_ID) - )); - $container->setDefinition('tester.step_container', $definition); - - $definition = new Definition('Behat\Behat\Tester\Runtime\RuntimeScenarioTester', array( - new Reference('tester.step_container'), - new Reference(self::BACKGROUND_TESTER_ID) - )); - $container->setDefinition(self::SCENARIO_TESTER_ID, $definition); - - // Proper isolation for scenarios - $definition = new Definition('Behat\Behat\Tester\Runtime\IsolatingScenarioTester', array( - new Reference(self::SCENARIO_TESTER_ID), - new Reference(EnvironmentExtension::MANAGER_ID) - ) - ); - $definition->addTag(self::SCENARIO_TESTER_WRAPPER_TAG, array('priority' => -999999)); - $container->setDefinition(self::SCENARIO_TESTER_WRAPPER_TAG . '.isolating', $definition); - } - - /** - * Loads outline tester. - * - * @param ContainerBuilder $container - */ - protected function loadOutlineTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Tester\Runtime\RuntimeOutlineTester', array( - new Reference(self::EXAMPLE_TESTER_ID) - )); - $container->setDefinition(self::OUTLINE_TESTER_ID, $definition); - - $this->loadExampleTester($container); - } - - /** - * Loads example tester. - * - * @param ContainerBuilder $container - */ - protected function loadExampleTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Tester\StepContainerTester', array( - new Reference(self::STEP_TESTER_ID) - )); - $container->setDefinition('tester.step_container', $definition); - - $definition = new Definition('Behat\Behat\Tester\Runtime\RuntimeScenarioTester', array( - new Reference('tester.step_container'), - new Reference(self::BACKGROUND_TESTER_ID) - )); - $container->setDefinition(self::EXAMPLE_TESTER_ID, $definition); - - // Proper isolation for examples - $definition = new Definition('Behat\Behat\Tester\Runtime\IsolatingScenarioTester', array( - new Reference(self::EXAMPLE_TESTER_ID), - new Reference(EnvironmentExtension::MANAGER_ID) - ) - ); - $definition->addTag(self::EXAMPLE_TESTER_WRAPPER_TAG, array('priority' => -999999)); - $container->setDefinition(self::EXAMPLE_TESTER_WRAPPER_TAG . '.isolating', $definition); - } - - /** - * Loads background tester. - * - * @param ContainerBuilder $container - */ - protected function loadBackgroundTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Tester\StepContainerTester', array( - new Reference(self::STEP_TESTER_ID) - )); - $container->setDefinition('tester.step_container', $definition); - - $definition = new Definition('Behat\Behat\Tester\Runtime\RuntimeBackgroundTester', array( - new Reference('tester.step_container') - )); - $container->setDefinition(self::BACKGROUND_TESTER_ID, $definition); - } - - /** - * Loads step tester. - * - * @param ContainerBuilder $container - */ - protected function loadStepTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Tester\Runtime\RuntimeStepTester', array( - new Reference(DefinitionExtension::FINDER_ID), - new Reference(CallExtension::CALL_CENTER_ID) - )); - $container->setDefinition(self::STEP_TESTER_ID, $definition); - } - - /** - * Loads rerun controller. - * - * @param ContainerBuilder $container - * @param null|string $cachePath - */ - protected function loadRerunController(ContainerBuilder $container, $cachePath) - { - $definition = new Definition('Behat\Behat\Tester\Cli\RerunController', array( - new Reference(EventDispatcherExtension::DISPATCHER_ID), - $cachePath, - $container->getParameter('paths.base') - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 200)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.rerun', $definition); - } - - /** - * Loads pending exception stringer. - * - * @param ContainerBuilder $container - */ - protected function loadPendingExceptionStringer(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Tester\Exception\Stringer\PendingExceptionStringer'); - $definition->addTag(ExceptionExtension::STRINGER_TAG); - $container->setDefinition(ExceptionExtension::STRINGER_TAG . '.pending', $definition); - } - - /** - * Processes all registered scenario tester wrappers. - * - * @param ContainerBuilder $container - */ - protected function processScenarioTesterWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::SCENARIO_TESTER_ID, self::SCENARIO_TESTER_WRAPPER_TAG); - } - - /** - * Processes all registered outline tester wrappers. - * - * @param ContainerBuilder $container - */ - protected function processOutlineTesterWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::OUTLINE_TESTER_ID, self::OUTLINE_TESTER_WRAPPER_TAG); - } - - /** - * Processes all registered example tester wrappers. - * - * @param ContainerBuilder $container - */ - protected function processExampleTesterWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::EXAMPLE_TESTER_ID, self::EXAMPLE_TESTER_WRAPPER_TAG); - } - - /** - * Processes all registered background tester wrappers. - * - * @param ContainerBuilder $container - */ - protected function processBackgroundTesterWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::BACKGROUND_TESTER_ID, self::BACKGROUND_TESTER_WRAPPER_TAG); - } - - /** - * Processes all registered step tester wrappers. - * - * @param ContainerBuilder $container - */ - protected function processStepTesterWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::STEP_TESTER_ID, self::STEP_TESTER_WRAPPER_TAG); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/StepContainerTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/StepContainerTester.php deleted file mode 100644 index d7364a9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/StepContainerTester.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepContainerInterface; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestWithSetupResult; - -/** - * Tests provided collection of steps against provided environment. - * - * @author Konstantin Kudryashov - */ -final class StepContainerTester -{ - /** - * @var StepTester - */ - private $stepTester; - - /** - * Initializes tester. - * - * @param StepTester $stepTester - */ - public function __construct(StepTester $stepTester) - { - $this->stepTester = $stepTester; - } - - /** - * Tests container. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepContainerInterface $container - * @param bool $skip - * - * @return TestResult[] - */ - public function test(Environment $env, FeatureNode $feature, StepContainerInterface $container, $skip) - { - $results = array(); - foreach ($container->getSteps() as $step) { - $setup = $this->stepTester->setUp($env, $feature, $step, $skip); - $skipSetup = !$setup->isSuccessful() || $skip; - - $testResult = $this->stepTester->test($env, $feature, $step, $skipSetup); - $skip = !$testResult->isPassed() || $skip; - - $teardown = $this->stepTester->tearDown($env, $feature, $step, $skipSetup, $testResult); - $skip = $skip || $skipSetup || !$teardown->isSuccessful(); - - $integerResult = new IntegerTestResult($testResult->getResultCode()); - $results[] = new TestWithSetupResult($setup, $integerResult, $teardown); - } - - return $results; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php deleted file mode 100644 index 94d7357..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Tester/StepTester.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Tester; - -use Behat\Behat\Tester\Result\StepResult; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Prepares and tests provided step object against provided environment. - * - * @author Konstantin Kudryashov - */ -interface StepTester -{ - /** - * Sets up step for a test. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * @param bool $skip - * - * @return Setup - */ - public function setUp(Environment $env, FeatureNode $feature, StepNode $step, $skip); - - /** - * Tests step. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * @param bool $skip - * - * @return StepResult - */ - public function test(Environment $env, FeatureNode $feature, StepNode $step, $skip); - - /** - * Tears down step after a test. - * - * @param Environment $env - * @param FeatureNode $feature - * @param StepNode $step - * @param bool $skip - * @param StepResult $result - * - * @return Teardown - */ - public function tearDown(Environment $env, FeatureNode $feature, StepNode $step, $skip, StepResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/Filter/DefinitionArgumentsTransformer.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/Filter/DefinitionArgumentsTransformer.php deleted file mode 100644 index d6cde91..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/Filter/DefinitionArgumentsTransformer.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Call\Filter; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Transformation\Exception\UnsupportedCallException; -use Behat\Behat\Transformation\Transformer\ArgumentTransformer; -use Behat\Testwork\Call\Call; -use Behat\Testwork\Call\Filter\CallFilter; - -/** - * Handles definition calls by intercepting them and transforming their arguments using transformations. - * - * @author Konstantin Kudryashov - */ -final class DefinitionArgumentsTransformer implements CallFilter -{ - /** - * @var ArgumentTransformer[] - */ - private $argumentTransformers = array(); - - /** - * Registers new argument transformer. - * - * @param ArgumentTransformer $transformer - */ - public function registerArgumentTransformer(ArgumentTransformer $transformer) - { - $this->argumentTransformers[] = $transformer; - } - - /** - * {@inheritdoc} - */ - public function supportsCall(Call $call) - { - return $call instanceof DefinitionCall; - } - - /** - * {@inheritdoc} - */ - public function filterCall(Call $definitionCall) - { - if (!$definitionCall instanceof DefinitionCall) { - throw new UnsupportedCallException(sprintf( - 'DefinitionArgumentTransformer can not filter `%s` call.', - get_class($definitionCall) - ), $definitionCall); - } - - $newArguments = array(); - $transformed = false; - foreach ($definitionCall->getArguments() as $index => $value) { - $newValue = $this->transformArgument($definitionCall, $index, $value); - - if ($newValue !== $value) { - $transformed = true; - } - - $newArguments[$index] = $newValue; - } - - if (!$transformed) { - return $definitionCall; - } - - return new DefinitionCall( - $definitionCall->getEnvironment(), - $definitionCall->getFeature(), - $definitionCall->getStep(), - $definitionCall->getCallee(), - $newArguments, - $definitionCall->getErrorReportingLevel() - ); - } - - /** - * Transforms call argument using registered transformers. - * - * @param DefinitionCall $definitionCall - * @param integer|string $index - * @param mixed $value - * - * @return mixed - */ - private function transformArgument(DefinitionCall $definitionCall, $index, $value) - { - foreach ($this->argumentTransformers as $transformer) { - if (!$transformer->supportsDefinitionAndArgument($definitionCall, $index, $value)) { - continue; - } - - return $transformer->transformArgument($definitionCall, $index, $value); - } - - return $value; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/RuntimeTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/RuntimeTransformation.php deleted file mode 100644 index 5a51955..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/RuntimeTransformation.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Call; - -use Behat\Behat\Transformation\Transformation; -use Behat\Testwork\Call\RuntimeCallee; - -/** - * Transformation that is created and executed in the runtime. - * - * @deprecated Will be removed in 4.0. Use specific transformations instead - * - * @author Konstantin Kudryashov - */ -final class RuntimeTransformation extends RuntimeCallee implements Transformation -{ - /** - * @var string - */ - private $pattern; - - /** - * Initializes transformation. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - $this->pattern = $pattern; - - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return 'Transform ' . $this->getPattern(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/TransformationCall.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/TransformationCall.php deleted file mode 100644 index 8b57d0b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Call/TransformationCall.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Call; - -use Behat\Behat\Definition\Definition; -use Behat\Behat\Transformation\Transformation; -use Behat\Testwork\Environment\Call\EnvironmentCall; -use Behat\Testwork\Environment\Environment; - -/** - * Call extended with transformation information. - * - * @author Konstantin Kudryashov - */ -final class TransformationCall extends EnvironmentCall -{ - /** - * @var Definition - */ - private $definition; - - /** - * Initializes call. - * - * @param Environment $environment - * @param Definition $definition - * @param Transformation $transformation - * @param array $arguments - */ - public function __construct( - Environment $environment, - Definition $definition, - Transformation $transformation, - array $arguments - ) { - parent::__construct($environment, $transformation, $arguments); - - $this->definition = $definition; - } - - /** - * Returns transformed definition. - * - * @return Definition - */ - public function getDefinition() - { - return $this->definition; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Context/Annotation/TransformationAnnotationReader.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Context/Annotation/TransformationAnnotationReader.php deleted file mode 100644 index 680d196..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Context/Annotation/TransformationAnnotationReader.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Context\Annotation; - -use Behat\Behat\Context\Annotation\AnnotationReader; -use Behat\Behat\Transformation\Transformation\PatternTransformation; -use Behat\Behat\Transformation\Transformation; -use ReflectionMethod; - -/** - * Step transformation annotation reader. - * - * Reads step transformations from a context method annotation. - * - * @author Konstantin Kudryashov - */ -class TransformationAnnotationReader implements AnnotationReader -{ - /** - * @var string - */ - private static $regex = '/^\@transform\s*+(.*+)$/i'; - - /** - * Loads step callees (if exist) associated with specific method. - * - * @param string $contextClass - * @param ReflectionMethod $method - * @param string $docLine - * @param string $description - * - * @return null|Transformation - */ - public function readCallee($contextClass, ReflectionMethod $method, $docLine, $description) - { - if (!preg_match(self::$regex, $docLine, $match)) { - return null; - } - - $pattern = $match[1]; - $callable = array($contextClass, $method->getName()); - - foreach ($this->simpleTransformations() as $transformation) { - if ($transformation::supportsPatternAndMethod($pattern, $method)) { - return new $transformation($pattern, $callable, $description); - } - } - - return new PatternTransformation($pattern, $callable, $description); - } - - /** - * Returns list of default transformations. - * - * @return array - */ - private function simpleTransformations() - { - return array( - 'Behat\Behat\Transformation\Transformation\RowBasedTableTransformation', - 'Behat\Behat\Transformation\Transformation\ColumnBasedTableTransformation', - 'Behat\Behat\Transformation\Transformation\TableRowTransformation', - 'Behat\Behat\Transformation\Transformation\TokenNameAndReturnTypeTransformation', - 'Behat\Behat\Transformation\Transformation\ReturnTypeTransformation', - 'Behat\Behat\Transformation\Transformation\TokenNameTransformation' - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Exception/TransformationException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Exception/TransformationException.php deleted file mode 100644 index f5aef3e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Exception/TransformationException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * Represents an exception caused by a transformation. - * - * @author Konstantin Kudryashov - */ -interface TransformationException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Exception/UnsupportedCallException.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Exception/UnsupportedCallException.php deleted file mode 100644 index 40d0ab2..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Exception/UnsupportedCallException.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Exception; - -use Behat\Testwork\Call\Call; -use InvalidArgumentException; - -/** - * Represents an exception caused by an attempt to filter an unsupported call. - * - * @author Konstantin Kudryashov - */ -final class UnsupportedCallException extends InvalidArgumentException implements TransformationException -{ - /** - * @var Call - */ - private $call; - - /** - * Initializes exception. - * - * @param string $message - * @param Call $call - */ - public function __construct($message, Call $call) - { - parent::__construct($message); - - $this->call = $call; - } - - /** - * Returns a call that caused exception. - * - * @return Call - */ - public function getCall() - { - return $this->call; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/RegexGenerator.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/RegexGenerator.php deleted file mode 100644 index 4a7000e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/RegexGenerator.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation; - -/** - * Regular expression generator. - * - * @author Konstantin Kudryashov - */ -interface RegexGenerator -{ - /** - * Generates regular expression using provided parameters. - * - * @param string $suiteName - * @param string $pattern - * @param string $language - * - * @return string - */ - public function generateRegex($suiteName, $pattern, $language); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php deleted file mode 100644 index 9c767b9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/ServiceContainer/TransformationExtension.php +++ /dev/null @@ -1,183 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\ServiceContainer; - -use Behat\Behat\Context\ServiceContainer\ContextExtension; -use Behat\Behat\Definition\ServiceContainer\DefinitionExtension; -use Behat\Testwork\Call\ServiceContainer\CallExtension; -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides definition arguments transformation functionality. - * - * @author Konstantin Kudryashov - */ -class TransformationExtension implements Extension -{ - /* - * Available services - */ - public const REPOSITORY_ID = 'transformation.repository'; - - /* - * Available extension points - */ - public const ARGUMENT_TRANSFORMER_TAG = 'transformation.argument_transformer'; - - protected const DEFINITION_ARGUMENT_TRANSFORMER_ID = CallExtension::CALL_FILTER_TAG . '.definition_argument_transformer'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ?: new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'transformations'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadDefinitionArgumentsTransformer($container); - $this->loadDefaultTransformers($container); - $this->loadAnnotationReader($container); - $this->loadRepository($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processArgumentsTransformers($container); - } - - /** - * Loads definition arguments transformer. - * - * @param ContainerBuilder $container - */ - protected function loadDefinitionArgumentsTransformer(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Transformation\Call\Filter\DefinitionArgumentsTransformer'); - $definition->addTag(CallExtension::CALL_FILTER_TAG, array('priority' => 200)); - $container->setDefinition(self::DEFINITION_ARGUMENT_TRANSFORMER_ID, $definition); - } - - /** - * Loads default transformers. - * - * @param ContainerBuilder $container - */ - protected function loadDefaultTransformers(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Transformation\Transformer\RepositoryArgumentTransformer', array( - new Reference(self::REPOSITORY_ID), - new Reference(CallExtension::CALL_CENTER_ID), - new Reference(DefinitionExtension::PATTERN_TRANSFORMER_ID), - new Reference(TranslatorExtension::TRANSLATOR_ID) - )); - $definition->addTag(self::ARGUMENT_TRANSFORMER_TAG, array('priority' => 50)); - $container->setDefinition(self::ARGUMENT_TRANSFORMER_TAG . '.repository', $definition); - } - - /** - * Loads transformation context annotation reader. - * - * @param ContainerBuilder $container - */ - protected function loadAnnotationReader(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Transformation\Context\Annotation\TransformationAnnotationReader'); - $definition->addTag(ContextExtension::ANNOTATION_READER_TAG, array('priority' => 50)); - $container->setDefinition(ContextExtension::ANNOTATION_READER_TAG . '.transformation', $definition); - } - - /** - * Loads transformations repository. - * - * @param ContainerBuilder $container - */ - protected function loadRepository(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Transformation\TransformationRepository', array( - new Reference(EnvironmentExtension::MANAGER_ID) - )); - $container->setDefinition(self::REPOSITORY_ID, $definition); - } - - /** - * Processes all available argument transformers. - * - * @param ContainerBuilder $container - */ - protected function processArgumentsTransformers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::ARGUMENT_TRANSFORMER_TAG); - $definition = $container->getDefinition(self::DEFINITION_ARGUMENT_TRANSFORMER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerArgumentTransformer', array($reference)); - } - } - - /** - * Returns definition argument transformer service id. - * - * @return string - * - * @deprecated Use DEFINITION_ARGUMENT_TRANSFORMER_ID constant instead - * - * @todo Remove method in next major version - */ - protected function getDefinitionArgumentTransformerId() - { - return self::DEFINITION_ARGUMENT_TRANSFORMER_ID; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php deleted file mode 100644 index 16530c3..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/SimpleArgumentTransformation.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Testwork\Call\CallCenter; -use ReflectionMethod; - -/** - * Represents a simple self-contained transformation capable of changing a single argument. - * - * @author Konstantin Kudryashov - */ -interface SimpleArgumentTransformation extends Transformation -{ - /** - * Checks if transformation supports given pattern. - * - * @param string $pattern - * @param ReflectionMethod $method - * - * @return bool - */ - static public function supportsPatternAndMethod($pattern, ReflectionMethod $method); - - /** - * Returns transformation priority. - * - * @return integer - */ - public function getPriority(); - - /** - * Checks if transformation supports argument. - * - * @param DefinitionCall $definitionCall - * @param integer|string $argumentIndex - * @param mixed $argumentValue - * - * @return bool - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue); - - /** - * Transforms argument value using transformation and returns a new one. - * - * @param CallCenter $callCenter - * @param DefinitionCall $definitionCall - * @param integer|string $argumentIndex - * @param mixed $argumentValue - * - * @return mixed - */ - public function transformArgument(CallCenter $callCenter, DefinitionCall $definitionCall, $argumentIndex, $argumentValue); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation.php deleted file mode 100644 index e82190c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation; - -use Behat\Testwork\Call\Callee; - -/** - * Step transformation interface. - * - * @author Konstantin Kudryashov - */ -interface Transformation extends Callee -{ - /** - * Returns transformation pattern exactly as it was defined. - * - * @deprecated Will be removed in 4.0. - * - * @return string - */ - public function getPattern(); - - /** - * Represents transformation as a string. - * - * @return string - */ - public function __toString(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/ColumnBasedTableTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/ColumnBasedTableTransformation.php deleted file mode 100644 index c26df56..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/ColumnBasedTableTransformation.php +++ /dev/null @@ -1,114 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformation; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Transformation\Call\TransformationCall; -use Behat\Behat\Transformation\SimpleArgumentTransformation; -use Behat\Gherkin\Node\TableNode; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\RuntimeCallee; -use ReflectionMethod; - -/** - * Column-based table transformation. - * - * @author Konstantin Kudryashov - */ -final class ColumnBasedTableTransformation extends RuntimeCallee implements SimpleArgumentTransformation -{ - public const PATTERN_REGEX = '/^table\:(?:\*|[[:print:]]+)$/'; - - /** - * @var string - */ - private $pattern; - - /** - * {@inheritdoc} - */ - static public function supportsPatternAndMethod($pattern, ReflectionMethod $method) - { - return 1 === preg_match(self::PATTERN_REGEX, $pattern); - } - - /** - * Initializes transformation. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - $this->pattern = $pattern; - - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - if (!$argumentValue instanceof TableNode) { - return false; - }; - - return $this->pattern === 'table:' . implode(',', $argumentValue->getRow(0)) - || $this->pattern === 'table:*'; - } - - /** - * {@inheritdoc} - */ - public function transformArgument(CallCenter $callCenter, DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - $call = new TransformationCall( - $definitionCall->getEnvironment(), - $definitionCall->getCallee(), - $this, - array($argumentValue) - ); - - $result = $callCenter->makeCall($call); - - if ($result->hasException()) { - throw $result->getException(); - } - - return $result->getReturn(); - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 50; - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return 'ColumnTableTransform ' . $this->pattern; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/PatternTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/PatternTransformation.php deleted file mode 100644 index 5054901..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/PatternTransformation.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformation; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Transformation\Call\TransformationCall; -use Behat\Behat\Transformation\RegexGenerator; -use Behat\Behat\Transformation\Transformation; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\RuntimeCallee; -use Exception; - -/** - * Pattern-based transformation. - * - * @author Konstantin Kudryashov - */ -final class PatternTransformation extends RuntimeCallee implements Transformation -{ - /** - * @var string - */ - private $pattern; - - /** - * Initializes transformation. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - $this->pattern = $pattern; - - parent::__construct($callable, $description); - } - - /** - * Checks if transformer supports argument. - * - * @param RegexGenerator $regexGenerator - * @param DefinitionCall $definitionCall - * @param mixed $argumentValue - * - * @return bool - */ - public function supportsDefinitionAndArgument( - RegexGenerator $regexGenerator, - DefinitionCall $definitionCall, - $argumentValue - ) { - $regex = $regexGenerator->generateRegex( - $definitionCall->getEnvironment()->getSuite()->getName(), - $this->pattern, - $definitionCall->getFeature()->getLanguage() - ); - - return $this->match($regex, $argumentValue, $match); - } - - /** - * Transforms argument value using transformation and returns a new one. - * - * @param RegexGenerator $regexGenerator - * @param CallCenter $callCenter - * @param DefinitionCall $definitionCall - * @param mixed $argumentValue - * - * @return mixed - * - * @throws Exception If transformation throws exception - */ - public function transformArgument( - RegexGenerator $regexGenerator, - CallCenter $callCenter, - DefinitionCall $definitionCall, - $argumentValue - ) { - $regex = $regexGenerator->generateRegex( - $definitionCall->getEnvironment()->getSuite()->getName(), - $this->pattern, - $definitionCall->getFeature()->getLanguage() - ); - - $this->match($regex, $argumentValue, $arguments); - - $call = new TransformationCall( - $definitionCall->getEnvironment(), - $definitionCall->getCallee(), - $this, - $arguments - ); - - $result = $callCenter->makeCall($call); - - if ($result->hasException()) { - throw $result->getException(); - } - - return $result->getReturn(); - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return 'PatternTransform ' . $this->pattern; - } - - /** - * @param $regexPattern - * @param $argumentValue - * @param $match - * - * @return bool - */ - private function match($regexPattern, $argumentValue, &$match) - { - if (is_string($argumentValue) && preg_match($regexPattern, $argumentValue, $match)) { - // take arguments from capture groups if there are some - if (count($match) > 1) { - $match = array_slice($match, 1); - } - - return true; - } - - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php deleted file mode 100644 index dd2e9c0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/ReturnTypeTransformation.php +++ /dev/null @@ -1,243 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformation; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Transformation\Call\TransformationCall; -use Behat\Behat\Transformation\SimpleArgumentTransformation; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\RuntimeCallee; -use Closure; -use ReflectionClass; -use ReflectionException; -use ReflectionFunctionAbstract; -use ReflectionMethod; -use ReflectionParameter; -use ReflectionNamedType; - -/** - * By-type object transformation. - * - * @author Konstantin Kudryashov - */ -final class ReturnTypeTransformation extends RuntimeCallee implements SimpleArgumentTransformation -{ - - /** - * {@inheritdoc} - */ - static public function supportsPatternAndMethod($pattern, ReflectionMethod $method) - { - $returnClass = self::getReturnClass($method); - - if (null === $returnClass) { - return false; - } - - return '' === $pattern; - } - - /** - * Initializes transformation. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - $returnClass = self::getReturnClass($this->getReflection()); - - if (null === $returnClass) { - return false; - } - - $parameterClass = $this->getParameterClassNameByIndex($definitionCall, $argumentIndex); - - return $parameterClass === $returnClass; - } - - /** - * {@inheritdoc} - */ - public function transformArgument(CallCenter $callCenter, DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - $call = new TransformationCall( - $definitionCall->getEnvironment(), - $definitionCall->getCallee(), - $this, - array($argumentValue) - ); - - $result = $callCenter->makeCall($call); - - if ($result->hasException()) { - throw $result->getException(); - } - - return $result->getReturn(); - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 80; - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return null; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return 'ReturnTypeTransform'; - } - - /** - * Extracts parameters from provided definition call. - * - * @param ReflectionFunctionAbstract $reflection - * - * @return null|string - */ - static private function getReturnClass(ReflectionFunctionAbstract $reflection) - { - $type = $reflection->getReturnType(); - - // Skip ReflectionUnionType as they can't be relied on for a transform - if (null === $type || !($type instanceof \ReflectionNamedType) || $type->isBuiltin()) { - return null; - } - - if ($type instanceof ReflectionNamedType) { - return $type->getName(); - } - - return (string) $type; - } - - /** - * Attempts to get definition parameter using its index (parameter position or name). - * - * @param DefinitionCall $definitionCall - * @param string|integer $argumentIndex - * - * @return null|string - */ - private function getParameterClassNameByIndex(DefinitionCall $definitionCall, $argumentIndex) - { - $parameters = array_filter( - array_filter($this->getCallParameters($definitionCall), - $this->hasIndex($argumentIndex) - ), - $this->getClassReflection() - ); - - if (count($parameters) == 0) { - return null; - } - - return ($this->getClassReflection())(current($parameters))->getName(); - } - - /** - * Extracts parameters from provided definition call. - * - * @param DefinitionCall $definitionCall - * - * @return ReflectionParameter[] - */ - private function getCallParameters(DefinitionCall $definitionCall) - { - return $definitionCall->getCallee()->getReflection()->getParameters(); - } - - /** - * Returns appropriate closure for filtering parameter by index. - * - * @param string|integer $index - * - * @return Closure - */ - private function hasIndex($index) - { - return is_string($index) ? $this->hasName($index) : $this->hasPosition($index); - } - - /** - * Returns closure to filter parameter by name. - * - * @param string $index - * - * @return Closure - */ - private function hasName($index) - { - return function (ReflectionParameter $parameter) use ($index) { - return $index === $parameter->getName(); - }; - } - - /** - * Returns closure to filter parameter by position. - * - * @param integer $index - * - * @return Closure - */ - private function hasPosition($index) - { - return function (ReflectionParameter $parameter) use ($index) { - return $index === $parameter->getPosition(); - }; - } - - /** - * Returns closure to filter parameter by typehinted class. - * - * @return Closure - */ - private function getClassReflection() : closure - { - return function (ReflectionParameter $parameter) : ?ReflectionClass - { - $t = $parameter->getType(); - - if ($t instanceof ReflectionNamedType) { - try { - return new ReflectionClass($t->getName()); - } - catch (ReflectionException $t) { - return null; - } - } - - return null; - }; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/RowBasedTableTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/RowBasedTableTransformation.php deleted file mode 100644 index a5b1c51..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/RowBasedTableTransformation.php +++ /dev/null @@ -1,130 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformation; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Transformation\Call\TransformationCall; -use Behat\Behat\Transformation\SimpleArgumentTransformation; -use Behat\Gherkin\Exception\NodeException; -use Behat\Gherkin\Node\TableNode; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\RuntimeCallee; -use ReflectionMethod; - -/** - * Row-based table transformation. - * - * @author Konstantin Kudryashov - */ -final class RowBasedTableTransformation extends RuntimeCallee implements SimpleArgumentTransformation -{ - public const PATTERN_REGEX = '/^rowtable\:[[:print:]]+$/'; - - /** - * @var string - */ - private $pattern; - - /** - * {@inheritdoc} - */ - static public function supportsPatternAndMethod($pattern, ReflectionMethod $method) - { - return 1 === preg_match(self::PATTERN_REGEX, $pattern); - } - - /** - * Initializes transformation. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - $this->pattern = $pattern; - - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $value) - { - if (!$value instanceof TableNode) { - return false; - }; - - // What we're doing here is checking that we have a 2 column table. - // This bit checks we have two columns - try { - $value->getColumn(1); - } catch (NodeException $e) { - return false; - } - - // And here we check we don't have a 3rd column - try { - $value->getColumn(2); - } catch (NodeException $e) { - // Once we know the table could be a row table, we check against the pattern. - return $this->pattern === 'rowtable:' . implode(',', $value->getColumn(0)); - } - - return false; - } - - /** - * {@inheritdoc} - */ - public function transformArgument(CallCenter $callCenter, DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - $call = new TransformationCall( - $definitionCall->getEnvironment(), - $definitionCall->getCallee(), - $this, - array($argumentValue) - ); - - $result = $callCenter->makeCall($call); - - if ($result->hasException()) { - throw $result->getException(); - } - - return $result->getReturn(); - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 50; - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return 'RowTableTransform ' . $this->pattern; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TableRowTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TableRowTransformation.php deleted file mode 100644 index 1a71c0b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TableRowTransformation.php +++ /dev/null @@ -1,118 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformation; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Transformation\Call\TransformationCall; -use Behat\Behat\Transformation\SimpleArgumentTransformation; -use Behat\Gherkin\Node\TableNode; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\RuntimeCallee; -use ReflectionMethod; - -/** - * Table row transformation. - * - * @author Konstantin Kudryashov - */ -final class TableRowTransformation extends RuntimeCallee implements SimpleArgumentTransformation -{ - public const PATTERN_REGEX = '/^row\:[[:print:]]+$/'; - - /** - * @var string - */ - private $pattern; - - /** - * {@inheritdoc} - */ - static public function supportsPatternAndMethod($pattern, ReflectionMethod $method) - { - return 1 === preg_match(self::PATTERN_REGEX, $pattern); - } - - /** - * Initializes transformation. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - $this->pattern = $pattern; - - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - if (!$argumentValue instanceof TableNode) { - return false; - }; - - return $this->pattern === 'row:' . implode(',', $argumentValue->getRow(0)); - } - - /** - * {@inheritdoc} - */ - public function transformArgument(CallCenter $callCenter, DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - $rows = array(); - foreach ($argumentValue as $row) { - $call = new TransformationCall( - $definitionCall->getEnvironment(), - $definitionCall->getCallee(), - $this, - array($row) - ); - - $result = $callCenter->makeCall($call); - - if ($result->hasException()) { - throw $result->getException(); - } - - $rows[] = $result->getReturn(); - } - - return $rows; - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 50; - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return 'TableRowTransform ' . $this->pattern; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TokenNameAndReturnTypeTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TokenNameAndReturnTypeTransformation.php deleted file mode 100644 index 32f954d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TokenNameAndReturnTypeTransformation.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformation; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Transformation\Call\TransformationCall; -use Behat\Behat\Transformation\SimpleArgumentTransformation; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\RuntimeCallee; -use ReflectionMethod; - -/** - * Name and return type object transformation. - * - * @author Konstantin Kudryashov - */ -final class TokenNameAndReturnTypeTransformation extends RuntimeCallee implements SimpleArgumentTransformation -{ - /** - * @var TokenNameTransformation - */ - private $tokenTransformation; - /** - * @var ReturnTypeTransformation - */ - private $returnTransformation; - - /** - * {@inheritdoc} - */ - static public function supportsPatternAndMethod($pattern, ReflectionMethod $method) - { - return TokenNameTransformation::supportsPatternAndMethod($pattern, $method) - && ReturnTypeTransformation::supportsPatternAndMethod('', $method); - } - - /** - * Initializes transformation. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - $this->tokenTransformation = new TokenNameTransformation($pattern, $callable, $description); - $this->returnTransformation = new ReturnTypeTransformation('', $callable, $description); - - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - return $this->tokenTransformation->supportsDefinitionAndArgument($definitionCall, $argumentIndex, $argumentValue) - && $this->returnTransformation->supportsDefinitionAndArgument($definitionCall, $argumentIndex, $argumentValue); - } - - /** - * {@inheritdoc} - */ - public function transformArgument(CallCenter $callCenter, DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - $call = new TransformationCall( - $definitionCall->getEnvironment(), - $definitionCall->getCallee(), - $this, - array($argumentValue) - ); - - $result = $callCenter->makeCall($call); - - if ($result->hasException()) { - throw $result->getException(); - } - - return $result->getReturn(); - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 100; - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->tokenTransformation->getPattern(); - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return 'NamedReturnTypeTransform ' . $this->getPattern(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TokenNameTransformation.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TokenNameTransformation.php deleted file mode 100644 index a64d86e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformation/TokenNameTransformation.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformation; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Transformation\Call\TransformationCall; -use Behat\Behat\Transformation\SimpleArgumentTransformation; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\RuntimeCallee; -use ReflectionMethod; - -/** - * Token name based transformation. - * - * @author Konstantin Kudryashov - */ -final class TokenNameTransformation extends RuntimeCallee implements SimpleArgumentTransformation -{ - public const PATTERN_REGEX = '/^\:\w+$/'; - - /** - * @var string - */ - private $pattern; - - - /** - * {@inheritdoc} - */ - static public function supportsPatternAndMethod($pattern, ReflectionMethod $method) - { - return 1 === preg_match(self::PATTERN_REGEX, $pattern); - } - - /** - * Initializes transformation. - * - * @param string $pattern - * @param callable $callable - * @param null|string $description - */ - public function __construct($pattern, $callable, $description = null) - { - $this->pattern = $pattern; - - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - return ':' . $argumentIndex === $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function transformArgument(CallCenter $callCenter, DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - $call = new TransformationCall( - $definitionCall->getEnvironment(), - $definitionCall->getCallee(), - $this, - array($argumentValue) - ); - - $result = $callCenter->makeCall($call); - - if ($result->hasException()) { - throw $result->getException(); - } - - return $result->getReturn(); - } - - /** - * {@inheritdoc} - */ - public function getPriority() - { - return 50; - } - - /** - * {@inheritdoc} - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return 'TokenNameTransform ' . $this->pattern; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/TransformationRepository.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/TransformationRepository.php deleted file mode 100644 index 2fb0ff5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/TransformationRepository.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation; - -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\EnvironmentManager; - -/** - * Provides transformations using environment manager. - * - * @author Konstantin Kudryashov - */ -final class TransformationRepository -{ - /** - * @var EnvironmentManager - */ - private $environmentManager; - - /** - * Initializes repository. - * - * @param EnvironmentManager $environmentManager - */ - public function __construct(EnvironmentManager $environmentManager) - { - $this->environmentManager = $environmentManager; - } - - /** - * Returns all available definitions for a specific environment. - * - * @param Environment $environment - * - * @return Transformation[] - */ - public function getEnvironmentTransformations(Environment $environment) - { - return array_filter( - $this->environmentManager->readEnvironmentCallees($environment), - function (Callee $callee) { - return $callee instanceof Transformation; - } - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php deleted file mode 100644 index 4457d83..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformer/ArgumentTransformer.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformer; - -use Behat\Behat\Definition\Call\DefinitionCall; - -/** - * Transforms a single argument value. - * - * @author Konstantin Kudryashov - */ -interface ArgumentTransformer -{ - /** - * Checks if transformer supports argument. - * - * @param DefinitionCall $definitionCall - * @param integer|string $argumentIndex - * @param mixed $argumentValue - * - * @return bool - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue); - - /** - * Transforms argument value using transformation and returns a new one. - * - * @param DefinitionCall $definitionCall - * @param integer|string $argumentIndex - * @param mixed $argumentValue - * - * @return mixed - */ - public function transformArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php deleted file mode 100644 index 4bdca23..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Transformation/Transformer/RepositoryArgumentTransformer.php +++ /dev/null @@ -1,194 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Transformation\Transformer; - -use Behat\Behat\Definition\Call\DefinitionCall; -use Behat\Behat\Definition\Pattern\PatternTransformer; -use Behat\Behat\Definition\Translator\TranslatorInterface; -use Behat\Behat\Transformation\SimpleArgumentTransformation; -use Behat\Behat\Transformation\Transformation\PatternTransformation; -use Behat\Behat\Transformation\RegexGenerator; -use Behat\Behat\Transformation\Transformation; -use Behat\Behat\Transformation\TransformationRepository; -use Behat\Gherkin\Node\ArgumentInterface; -use Behat\Testwork\Call\CallCenter; - -/** - * Argument transformer based on transformations repository. - * - * @author Konstantin Kudryashov - */ -final class RepositoryArgumentTransformer implements ArgumentTransformer, RegexGenerator -{ - /** - * @var TransformationRepository - */ - private $repository; - /** - * @var CallCenter - */ - private $callCenter; - /** - * @var PatternTransformer - */ - private $patternTransformer; - /** - * @var TranslatorInterface - */ - private $translator; - - /** - * Initializes transformer. - * - * @param TransformationRepository $repository - * @param CallCenter $callCenter - * @param PatternTransformer $patternTransformer - * @param TranslatorInterface $translator - */ - public function __construct( - TransformationRepository $repository, - CallCenter $callCenter, - PatternTransformer $patternTransformer, - TranslatorInterface $translator - ) { - $this->repository = $repository; - $this->callCenter = $callCenter; - $this->patternTransformer = $patternTransformer; - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function supportsDefinitionAndArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - return count($this->repository->getEnvironmentTransformations($definitionCall->getEnvironment())) > 0; - } - - /** - * {@inheritdoc} - */ - public function transformArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) - { - $environment = $definitionCall->getEnvironment(); - list($simpleTransformations, $normalTransformations) = $this->splitSimpleAndNormalTransformations( - $this->repository->getEnvironmentTransformations($environment) - ); - - $newValue = $this->applySimpleTransformations($simpleTransformations, $definitionCall, $argumentIndex, $argumentValue); - $newValue = $this->applyNormalTransformations($normalTransformations, $definitionCall, $argumentIndex, $newValue); - - return $newValue; - } - - /** - * {@inheritdoc} - */ - public function generateRegex($suiteName, $pattern, $language) - { - $translatedPattern = $this->translator->trans($pattern, array(), $suiteName, $language); - if ($pattern == $translatedPattern) { - return $this->patternTransformer->transformPatternToRegex($pattern); - } - - return $this->patternTransformer->transformPatternToRegex($translatedPattern); - } - - /** - * Apply simple argument transformations in priority order. - * - * @param SimpleArgumentTransformation[] $transformations - * @param DefinitionCall $definitionCall - * @param integer|string $index - * @param mixed $value - * - * @return mixed - */ - private function applySimpleTransformations(array $transformations, DefinitionCall $definitionCall, $index, $value) - { - usort($transformations, function (SimpleArgumentTransformation $t1, SimpleArgumentTransformation $t2) { - return $t2->getPriority() <=> $t1->getPriority(); - }); - - $newValue = $value; - foreach ($transformations as $transformation) { - $newValue = $this->transform($definitionCall, $transformation, $index, $newValue); - } - - return $newValue; - } - - /** - * Apply normal (non-simple) argument transformations. - * - * @param Transformation[] $transformations - * @param DefinitionCall $definitionCall - * @param integer|string $index - * @param mixed $value - * - * @return mixed - */ - private function applyNormalTransformations(array $transformations, DefinitionCall $definitionCall, $index, $value) - { - $newValue = $value; - foreach ($transformations as $transformation) { - $newValue = $this->transform($definitionCall, $transformation, $index, $newValue); - } - - return $newValue; - } - - /** - * Transforms argument value using registered transformers. - * - * @param Transformation $transformation - * @param DefinitionCall $definitionCall - * @param integer|string $index - * @param mixed $value - * - * @return mixed - */ - private function transform(DefinitionCall $definitionCall, Transformation $transformation, $index, $value) - { - if (is_object($value) && !$value instanceof ArgumentInterface) { - return $value; - } - - if ($transformation instanceof SimpleArgumentTransformation && - $transformation->supportsDefinitionAndArgument($definitionCall, $index, $value)) { - return $transformation->transformArgument($this->callCenter, $definitionCall, $index, $value); - } - - if ($transformation instanceof PatternTransformation && - $transformation->supportsDefinitionAndArgument($this, $definitionCall, $value)) { - return $transformation->transformArgument($this, $this->callCenter, $definitionCall, $value); - } - - return $value; - } - - /** - * Splits transformations into simple and normal ones. - * - * @param Transformation[] $transformations - * - * @return array - */ - private function splitSimpleAndNormalTransformations(array $transformations) - { - return array_reduce($transformations, function ($acc, $t) { - return array( - $t instanceof SimpleArgumentTransformation ? array_merge($acc[0], array($t)) : $acc[0], - !$t instanceof SimpleArgumentTransformation ? array_merge($acc[1], array($t)) : $acc[1], - ); - }, array(array(), array())); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Translator/Cli/GherkinTranslationsController.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Translator/Cli/GherkinTranslationsController.php deleted file mode 100644 index 439ad09..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Translator/Cli/GherkinTranslationsController.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Translator\Cli; - -use Behat\Testwork\Cli\Controller; -use Symfony\Component\Console\Command\Command as SymfonyCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Translation\Translator; - -/** - * Configures translator service and loads default translations. - * - * @author Konstantin Kudryashov - */ -final class GherkinTranslationsController implements Controller -{ - /** - * @var Translator - */ - private $translator; - - /** - * Initializes controller. - * - * @param Translator $translator - */ - public function __construct(Translator $translator) - { - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function configure(SymfonyCommand $command) - { - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $i18nPath = dirname(dirname(dirname(dirname(dirname(__DIR__))))) . DIRECTORY_SEPARATOR . 'i18n.php'; - - foreach (require($i18nPath) as $lang => $messages) { - $this->translator->addResource('array', $messages, $lang, 'output'); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Behat/Translator/ServiceContainer/GherkinTranslationsExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Behat/Translator/ServiceContainer/GherkinTranslationsExtension.php deleted file mode 100644 index f4af2a5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Behat/Translator/ServiceContainer/GherkinTranslationsExtension.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Behat\Translator\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\Translator\ServiceContainer\TranslatorExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Extends translator service with knowledge about gherkin translations. - * - * @author Konstantin Kudryashov - */ -final class GherkinTranslationsExtension implements Extension -{ - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'gherkin_translations'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadController($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - } - - /** - * Loads translator controller. - * - * @param ContainerBuilder $container - */ - private function loadController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Behat\Translator\Cli\GherkinTranslationsController', array( - new Reference(TranslatorExtension::TRANSLATOR_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 9999)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.gherkin_translations', $definition); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ApplicationFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ApplicationFactory.php deleted file mode 100644 index ff60404..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ApplicationFactory.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork; - -use Behat\Testwork\Cli\Application; -use Behat\Testwork\ServiceContainer\Configuration\ConfigurationLoader; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; - -/** - * Defines the way application is created. - * - * Extend and implement this class to create an entry point for your framework. - * - * @author Konstantin Kudryashov - */ -abstract class ApplicationFactory -{ - /** - * Returns application name. - * - * @return string - */ - abstract protected function getName(); - - /** - * Returns current application version. - * - * @return string - */ - abstract protected function getVersion(); - - /** - * Returns list of extensions enabled by default. - * - * @return Extension[] - */ - abstract protected function getDefaultExtensions(); - - /** - * Returns the name of configuration environment variable. - * - * @return string - */ - abstract protected function getEnvironmentVariableName(); - - /** - * Returns user config path. - * - * @return null|string - */ - abstract protected function getConfigPath(); - - /** - * Creates application instance. - * - * @return Application - */ - public function createApplication() - { - $configurationLoader = $this->createConfigurationLoader(); - $extensionManager = $this->createExtensionManager(); - - return new Application($this->getName(), $this->getVersion(), $configurationLoader, $extensionManager); - } - - /** - * Creates configuration loader. - * - * @return ConfigurationLoader - */ - protected function createConfigurationLoader() - { - return new ConfigurationLoader($this->getEnvironmentVariableName(), $this->getConfigPath()); - } - - /** - * Creates extension manager. - * - * @return ExtensionManager - */ - protected function createExtensionManager() - { - return new ExtensionManager($this->getDefaultExtensions()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ArgumentOrganiser.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ArgumentOrganiser.php deleted file mode 100644 index 8659631..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ArgumentOrganiser.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Argument; - -use ReflectionFunctionAbstract; - -/** - * Organises function arguments using its reflection. - * - * @author Konstantin Kudryashov - */ -interface ArgumentOrganiser -{ - /** - * Organises arguments using function reflection. - * - * @param ReflectionFunctionAbstract $function - * @param mixed[] $arguments - * - * @return mixed[] - */ - public function organiseArguments(ReflectionFunctionAbstract $function, array $arguments); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ConstructorArgumentOrganiser.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ConstructorArgumentOrganiser.php deleted file mode 100644 index 5ab6127..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ConstructorArgumentOrganiser.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Argument; - -use Behat\Testwork\Argument\Exception\UnknownParameterValueException; -use Behat\Testwork\Argument\Exception\UnsupportedFunctionException; -use ReflectionFunctionAbstract; -use ReflectionMethod; - -/** - * Organises constructor arguments. - * - * @author Konstantin Kudryashov - */ -final class ConstructorArgumentOrganiser implements ArgumentOrganiser -{ - /** - * @var ArgumentOrganiser - */ - private $baseOrganiser; - - /** - * Initializes organiser. - * - * @param ArgumentOrganiser $organiser - */ - public function __construct(ArgumentOrganiser $organiser) - { - $this->baseOrganiser = $organiser; - } - - /** - * {@inheritdoc} - */ - public function organiseArguments(ReflectionFunctionAbstract $constructor, array $arguments) - { - if (!$constructor instanceof ReflectionMethod) { - throw new UnsupportedFunctionException(sprintf( - 'ConstructorArgumentOrganiser can only work with ReflectionMethod, but `%s` given.', - get_class($constructor) - )); - } - - $organisedArguments = $this->baseOrganiser->organiseArguments( - $constructor, - $arguments - ); - - $this->validateArguments($constructor, $arguments, $organisedArguments); - - return $organisedArguments; - } - - /** - * Checks that all provided constructor arguments are present in the constructor. - * - * @param ReflectionMethod $constructor - * @param mixed[] $passedArguments - * @param mixed[] $organisedArguments - * - * @throws UnknownParameterValueException - */ - private function validateArguments( - ReflectionMethod $constructor, - array $passedArguments, - array $organisedArguments - ) { - foreach ($passedArguments as $key => $val) { - if (array_key_exists($key, $organisedArguments)) { - continue; - } - - throw new UnknownParameterValueException( - sprintf( - '`%s::__construct()` does not expect argument `$%s`.', - $constructor->getDeclaringClass()->getName(), - $key - ) - ); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/ArgumentException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/ArgumentException.php deleted file mode 100644 index fdcf310..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/ArgumentException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Argument\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * All argument exceptions extend this interface. - * - * @author Konstantin Kudryashov - */ -interface ArgumentException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/UnknownParameterValueException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/UnknownParameterValueException.php deleted file mode 100644 index b83958b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/UnknownParameterValueException.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Argument\Exception; - -use BadMethodCallException; - -/** - * Represents an exception caused by an unknown function parameter value. - * - * Exception is thrown if provided function parameter value is unknown or missing. - * - * @author Wouter J - */ -final class UnknownParameterValueException extends BadMethodCallException implements ArgumentException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/UnsupportedFunctionException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/UnsupportedFunctionException.php deleted file mode 100644 index 688c939..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/Exception/UnsupportedFunctionException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Argument\Exception; - -use InvalidArgumentException; - -/** - * Represents an attempt to organise unsupported function arguments. - * - * @author Konstantin Kudryashov - */ -final class UnsupportedFunctionException extends InvalidArgumentException implements ArgumentException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php deleted file mode 100644 index f9a6a4b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/MixedArgumentOrganiser.php +++ /dev/null @@ -1,473 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Argument; - -use ReflectionFunctionAbstract; -use ReflectionClass; -use ReflectionParameter; -use ReflectionException; - -/** - * Organises function arguments using its reflection. - * - * @author Konstantin Kudryashov - */ -final class MixedArgumentOrganiser implements ArgumentOrganiser -{ - private $definedArguments = array(); - - /** - * Organises arguments using function reflection. - * - * @param ReflectionFunctionAbstract $function - * @param mixed[] $arguments - * - * @return mixed[] - */ - public function organiseArguments(ReflectionFunctionAbstract $function, array $arguments) - { - return $this->prepareArguments($function->getParameters(), $arguments); - } - - /** - * Prepares arguments based on provided parameters. - * - * @param ReflectionParameter[] $parameters - * @param mixed[] $arguments - * - * @return mixed[] - */ - private function prepareArguments(array $parameters, array $arguments) - { - $this->markAllArgumentsUndefined(); - - list($named, $typehinted, $numbered) = $this->splitArguments($parameters, $arguments); - - $arguments = - $this->prepareNamedArguments($parameters, $named) + - $this->prepareTypehintedArguments($parameters, $typehinted) + - $this->prepareNumberedArguments($parameters, $numbered) + - $this->prepareDefaultArguments($parameters); - - return $this->reorderArguments($parameters, $arguments); - } - - /** - * Splits arguments into three separate arrays - named, numbered and typehinted. - * - * @param ReflectionParameter[] $parameters - * @param mixed[] $arguments - * - * @return array - */ - private function splitArguments(array $parameters, array $arguments) - { - $parameterNames = array_map( - function (ReflectionParameter $parameter) { - return $parameter->getName(); - }, - $parameters - ); - - $namedArguments = array(); - $numberedArguments = array(); - $typehintedArguments = array(); - foreach ($arguments as $key => $val) { - if ($this->isStringKeyAndExistsInParameters($key, $parameterNames)) { - $namedArguments[$key] = $val; - } elseif ($this->isParameterTypehintedInArgumentList($parameters, $val)) { - $typehintedArguments[] = $val; - } else { - $numberedArguments[] = $val; - } - } - - return array($namedArguments, $typehintedArguments, $numberedArguments); - } - - /** - * Checks that provided argument key is a string and it matches some parameter name. - * - * @param mixed $argumentKey - * @param string[] $parameterNames - * - * @return bool - */ - private function isStringKeyAndExistsInParameters($argumentKey, $parameterNames) - { - return is_string($argumentKey) && in_array($argumentKey, $parameterNames); - } - - /** - * Check if a given value is typehinted in the argument list. - * - * @param ReflectionParameter[] $parameters - * @param mixed $value - * - * @return bool - */ - private function isParameterTypehintedInArgumentList(array $parameters, $value) - { - if (!is_object($value)) { - return false; - } - - foreach ($parameters as $parameter) { - if ($this->isValueMatchesTypehintedParameter($value, $parameter)) { - return true; - } - } - - return false; - } - - /** - * Checks if value matches typehint of provided parameter. - */ - private function isValueMatchesTypehintedParameter($value, ReflectionParameter $parameter) : bool - { - foreach($this->getReflectionClassesFromParameter($parameter) as $typehintRefl) { - if($typehintRefl->isInstance($value)) { - return true; - } - } - - return false; - } - - /** - * Captures argument values based on their respective names. - * - * @param ReflectionParameter[] $parameters - * @param mixed[] $namedArguments - * - * @return mixed[] - */ - private function prepareNamedArguments(array $parameters, array $namedArguments) - { - $arguments = array(); - - foreach ($parameters as $num => $parameter) { - $name = $parameter->getName(); - - if (array_key_exists($name, $namedArguments)) { - $arguments[$name] = $namedArguments[$name]; - $this->markArgumentDefined($num); - } - } - - return $arguments; - } - - /** - * Captures argument values for typehinted arguments based on the given candidates. - * - * This method attempts to match up the best fitting arguments to each constructor argument. - * - * This case specifically fixes the issue where a constructor asks for a parent and child class, - * as separate arguments, but both arguments could satisfy the first argument, - * so they would both be passed in (overwriting each other). - * - * This will ensure that the children (exact class matches) are mapped first, and then other dependencies - * are mapped sequentially (to arguments which they are an `instanceof`). - * - * As such, this requires two passes of the $parameters array to ensure it is mapped as accurately as possible. - * - * @param ReflectionParameter[] $parameters Reflection Parameters (constructor argument requirements) - * @param mixed[] $typehintedArguments Resolved arguments - * - * @return mixed[] Ordered list of arguments, index is the constructor argument position, value is what will be injected - */ - private function prepareTypehintedArguments(array $parameters, array $typehintedArguments) - { - $arguments = array(); - - $candidates = $typehintedArguments; - - $this->applyPredicateToTypehintedArguments( - $parameters, - $candidates, - $arguments, - array($this, 'classMatchingPredicateForTypehintedArguments') - ); - - // This iteration maps up everything else, providing the argument is an instanceof the parameter. - $this->applyPredicateToTypehintedArguments( - $parameters, - $candidates, - $arguments, - array($this, 'isInstancePredicateForTypehintedArguments') - ); - - return $arguments; - } - - /** - * Filtered out superfluous parameters for matching up typehinted arguments. - * - * @param ReflectionParameter[] $parameters Constructor Arguments - * @return ReflectionParameter[] Filtered $parameters - */ - private function filterApplicableTypehintedParameters(array $parameters) : array - { - return array_filter($parameters, - function($parameter, $num) { - return !$this->isArgumentDefined($num) - && $this->getReflectionClassesFromParameter($parameter); - }, - ARRAY_FILTER_USE_BOTH - ); - - } - - /** - * @return ReflectionClass[] - */ - private function getReflectionClassesFromParameter(\ReflectionParameter $parameter): array - { - $classes = []; - - if (!$parameter->hasType()) { - return $classes; - } - - $type = $parameter->getType(); - - /** - * @psalm-suppress UndefinedClass (ReflectionUnionType) - */ - if ($type instanceof \ReflectionNamedType) { - $types = [$type]; - } - elseif ($parameter->getType() instanceof \ReflectionUnionType) { - $types = $type->getTypes(); - } - else { - $types = []; - } - - foreach ($types as $type) { - - // ReflectionUnionType::getTypes is only documented as returning ReflectionType[] - if (!$type instanceof \ReflectionNamedType) { - continue; - } - - $typeString = $type->getName(); - - if ($typeString == 'self') { - $typeString = $parameter->getDeclaringClass(); - } elseif ($typeString == 'parent') { - $typeString = $parameter->getDeclaringClass()->getParentClass(); - } - - try { - $classes[] = new ReflectionClass($typeString); - } catch (ReflectionException $e) { - continue; - } - } - - return $classes; - } - - /** - * Applies a predicate for each candidate when matching up typehinted arguments. - * This passes through to another loop of the candidates in @matchParameterToCandidateUsingPredicate, - * because this method is "too complex" with two loops... - * - * @param ReflectionParameter[] $parameters Reflection Parameters (constructor argument requirements) - * @param mixed[] &$candidates Resolved arguments - * @param mixed[] &$arguments Argument mapping - * @param callable $predicate Callable predicate to apply to each candidate - * @return void - */ - private function applyPredicateToTypehintedArguments( - array $parameters, - array &$candidates, - array &$arguments, - $predicate - ) { - $filtered = $this->filterApplicableTypehintedParameters($parameters); - - foreach ($filtered as $num => $parameter) { - $this->matchParameterToCandidateUsingPredicate($parameter, $candidates, $arguments, $predicate); - } - } - - /** - * Applies a predicate for each candidate when matching up typehinted arguments. - * This helps to avoid repetition when looping them, as multiple passes are needed over the parameters / candidates. - * - * @param ReflectionParameter $parameter Reflection Parameter (constructor argument requirements) - * @param mixed[] &$candidates Resolved arguments - * @param mixed[] &$arguments Argument mapping - * @param callable $predicate Callable predicate to apply to each candidate - * @return bool Returns true if a candidate has been matched to the given parameter, otherwise false - */ - public function matchParameterToCandidateUsingPredicate( - ReflectionParameter $parameter, - array &$candidates, - array &$arguments, - $predicate - ) { - foreach ($candidates as $candidateIndex => $candidate) { - foreach($this->getReflectionClassesFromParameter($parameter) as $class) { - if ($predicate($class, $candidate)) { - $num = $parameter->getPosition(); - - $arguments[$num] = $candidate; - - $this->markArgumentDefined($num); - - unset($candidates[$candidateIndex]); - - return true; - } - } - } - - return false; - } - - /** - * Typehinted argument predicate to check if the argument and parameter classes match equally. - * - * @param ReflectionClass $reflectionClass Typehinted argument - * @param mixed $candidate Resolved argument - * @return bool - */ - private function classMatchingPredicateForTypehintedArguments(ReflectionClass $reflectionClass, $candidate) - { - return $reflectionClass->getName() === get_class($candidate); - } - - /** - * Typehinted argument predicate to check if the argument is an instance of the parameter. - * - * @param ReflectionClass $reflectionClass Typehinted argument - * @param mixed $candidate Resolved argument - * @return bool - */ - private function isInstancePredicateForTypehintedArguments(ReflectionClass $reflectionClass, $candidate) - { - return $reflectionClass->isInstance($candidate); - } - - /** - * Captures argument values for undefined arguments based on their respective numbers. - * - * @param ReflectionParameter[] $parameters - * @param mixed[] $numberedArguments - * - * @return mixed[] - */ - private function prepareNumberedArguments(array $parameters, array $numberedArguments) - { - $arguments = array(); - - $increment = 0; - foreach ($parameters as $num => $parameter) { - if ($this->isArgumentDefined($num)) { - continue; - } - - if (array_key_exists($increment, $numberedArguments)) { - $arguments[$num] = $numberedArguments[$increment++]; - $this->markArgumentDefined($num); - } - } - - return $arguments; - } - - /** - * Captures argument values for undefined arguments based on parameters defaults. - * - * @param ReflectionParameter[] $parameters - * - * @return mixed[] - */ - private function prepareDefaultArguments(array $parameters) - { - $arguments = array(); - - foreach ($parameters as $num => $parameter) { - if ($this->isArgumentDefined($num)) { - continue; - } - - if ($parameter->isDefaultValueAvailable()) { - $arguments[$num] = $parameter->getDefaultValue(); - $this->markArgumentDefined($num); - } - } - - return $arguments; - } - - /** - * Reorders arguments based on their respective parameters order. - * - * @param ReflectionParameter[] $parameters - * @param array $arguments - * - * @return mixed[] - */ - private function reorderArguments(array $parameters, array $arguments) - { - $orderedArguments = array(); - - foreach ($parameters as $num => $parameter) { - $name = $parameter->getName(); - - if (array_key_exists($num, $arguments)) { - $orderedArguments[$num] = $arguments[$num]; - } elseif (array_key_exists($name, $arguments)) { - $orderedArguments[$name] = $arguments[$name]; - } - } - - return $orderedArguments; - } - - /** - * Marks arguments at all positions as undefined. - * - * This is used to share state between get*Arguments() methods. - */ - private function markAllArgumentsUndefined() - { - $this->definedArguments = array(); - } - - /** - * Marks an argument at provided position as defined. - * - * @param integer $position - */ - private function markArgumentDefined($position) - { - $this->definedArguments[$position] = true; - } - - /** - * Checks if an argument at provided position is defined. - * - * @param integer $position - * - * @return bool - */ - private function isArgumentDefined($position) - { - return isset($this->definedArguments[$position]); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php deleted file mode 100644 index 8a03b88..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/PregMatchArgumentOrganiser.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Argument; - -use ReflectionFunctionAbstract; - -/** - * Organises arguments coming from preg_match results. - * - * @author Konstantin Kudryashov - */ -final class PregMatchArgumentOrganiser implements ArgumentOrganiser -{ - /** - * @var ArgumentOrganiser - */ - private $baseOrganiser; - - /** - * Initialises organiser. - * - * @param ArgumentOrganiser $organiser - */ - public function __construct(ArgumentOrganiser $organiser) - { - $this->baseOrganiser = $organiser; - } - - /** - * {@inheritdoc} - */ - public function organiseArguments(ReflectionFunctionAbstract $function, array $match) - { - $arguments = $this->cleanupMatchDuplicates($match); - - return $this->baseOrganiser->organiseArguments($function, $arguments); - } - - /** - * Cleans up provided preg_match match into a list of arguments. - * - * `preg_match` matches named arguments with named indexes and also - * represents all arguments with numbered indexes. This method removes - * duplication and also drops the first full match element from the - * array. - * - * @param array $match - * - * @return mixed[] - */ - private function cleanupMatchDuplicates(array $match) - { - $cleanMatch = array_slice($match, 1); - $arguments = array(); - - $keys = array_keys($cleanMatch); - for ($keyIndex = 0; $keyIndex < count($keys); $keyIndex++) { - $key = $keys[$keyIndex]; - - $arguments[$key] = $cleanMatch[$key]; - - if ($this->isKeyAStringAndNexOneIsAnInteger($keyIndex, $keys)) { - $keyIndex += 1; - } - } - - return $arguments; - } - - /** - * Checks if key at provided index is a string and next key in the array is an integer. - * - * @param integer $keyIndex - * @param mixed[] $keys - * - * @return bool - */ - private function isKeyAStringAndNexOneIsAnInteger($keyIndex, array $keys) - { - $keyIsAString = is_string($keys[$keyIndex]); - $nextKeyIsAnInteger = isset($keys[$keyIndex + 1]) && is_integer($keys[$keyIndex + 1]); - - return $keyIsAString && $nextKeyIsAnInteger; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ServiceContainer/ArgumentExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ServiceContainer/ArgumentExtension.php deleted file mode 100644 index 88172a9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Argument/ServiceContainer/ArgumentExtension.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Argument\ServiceContainer; - -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Enables argument organisers for Testwork. - * - * @author Konstantin Kudryashov - */ -final class ArgumentExtension implements Extension -{ - /* - * Available services - */ - public const MIXED_ARGUMENT_ORGANISER_ID = 'argument.mixed_organiser'; - public const PREG_MATCH_ARGUMENT_ORGANISER_ID = 'argument.preg_match_organiser'; - public const CONSTRUCTOR_ARGUMENT_ORGANISER_ID = 'argument.constructor_organiser'; - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'argument'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $definition = new Definition('Behat\Testwork\Argument\MixedArgumentOrganiser'); - $container->setDefinition(self::MIXED_ARGUMENT_ORGANISER_ID, $definition); - - $definition = new Definition('Behat\Testwork\Argument\PregMatchArgumentOrganiser', array( - new Reference(self::MIXED_ARGUMENT_ORGANISER_ID) - )); - $container->setDefinition(self::PREG_MATCH_ARGUMENT_ORGANISER_ID, $definition); - - $definition = new Definition('Behat\Testwork\Argument\ConstructorArgumentOrganiser', array( - new Reference(self::MIXED_ARGUMENT_ORGANISER_ID) - )); - $container->setDefinition(self::CONSTRUCTOR_ARGUMENT_ORGANISER_ID, $definition); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Autoloader/Cli/AutoloaderController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Autoloader/Cli/AutoloaderController.php deleted file mode 100644 index 70ebe94..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Autoloader/Cli/AutoloaderController.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Autoloader\Cli; - -use Behat\Testwork\Cli\Controller; -use Composer\Autoload\ClassLoader; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Registers Testwork autoloader. - * - * @author Konstantin Kudryashov - */ -final class AutoloaderController implements Controller -{ - /** - * @var ClassLoader - */ - private $loader; - - /** - * Initializes controller - * - * @param ClassLoader $loader - */ - public function __construct(ClassLoader $loader) - { - $this->loader = $loader; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $this->loader->register(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php deleted file mode 100644 index 3908e0f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Autoloader/ServiceContainer/AutoloaderExtension.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Autoloader\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Extends Testwork with class-loading services. - * - * @author Konstantin Kudryashov - */ -final class AutoloaderExtension implements Extension -{ - /* - * Available services - */ - public const CLASS_LOADER_ID = 'class_loader'; - - /** - * @var array - */ - private $defaultPaths = array(); - - /** - * Initializes extension. - * - * @param array $defaultPaths - */ - public function __construct(array $defaultPaths = array()) - { - $this->defaultPaths = $defaultPaths; - } - - /** - * Returns the extension config key. - * - * @return string - */ - public function getConfigKey() - { - return 'autoload'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - $builder - ->beforeNormalization() - ->ifString()->then(function ($path) { - return array('' => $path); - }) - ->end() - - ->defaultValue($this->defaultPaths) - ->treatTrueLike($this->defaultPaths) - ->treatNullLike(array()) - ->treatFalseLike(array()) - - ->prototype('scalar')->end() - ; - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadAutoloader($container); - $this->loadController($container); - $this->setLoaderPrefixes($container, $config); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processLoaderPrefixes($container); - } - - /** - * Loads Symfony2 autoloader. - * - * @param ContainerBuilder $container - */ - private function loadAutoloader(ContainerBuilder $container) - { - $definition = new Definition('Composer\Autoload\ClassLoader'); - $container->setDefinition(self::CLASS_LOADER_ID, $definition); - } - - /** - * Loads controller. - * - * @param ContainerBuilder $container - */ - private function loadController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Autoloader\Cli\AutoloaderController', array( - new Reference(self::CLASS_LOADER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 9999)); - - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.autoloader', $definition); - } - - /** - * Sets provided prefixes to container. - * - * @param ContainerBuilder $container - * @param array $prefixes - */ - private function setLoaderPrefixes(ContainerBuilder $container, array $prefixes) - { - $container->setParameter('class_loader.prefixes', $prefixes); - } - - /** - * Processes container loader prefixes. - * - * @param ContainerBuilder $container - */ - private function processLoaderPrefixes(ContainerBuilder $container) - { - $loaderDefinition = $container->getDefinition(self::CLASS_LOADER_ID); - $prefixes = $container->getParameter('class_loader.prefixes'); - - foreach ($prefixes as $prefix => $path) { - $loaderDefinition->addMethodCall('add', array($prefix, $path)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Call.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Call.php deleted file mode 100644 index efa04de..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Call.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call; - -/** - * Represents any call made inside testwork. - * - * @author Konstantin Kudryashov - */ -interface Call -{ - /** - * Returns callee. - * - * @return Callee - */ - public function getCallee(); - - /** - * Returns bound callable. - * - * @return callable - */ - public function getBoundCallable(); - - /** - * Returns call arguments. - * - * @return array - */ - public function getArguments(); - - /** - * Returns call error reporting level. - * - * @return null|integer - */ - public function getErrorReportingLevel(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php deleted file mode 100644 index 2798acf..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallCenter.php +++ /dev/null @@ -1,190 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call; - -use Behat\Testwork\Call\Exception\CallHandlingException; -use Behat\Testwork\Call\Exception\FatalThrowableError; -use Behat\Testwork\Call\Filter\CallFilter; -use Behat\Testwork\Call\Filter\ResultFilter; -use Behat\Testwork\Call\Handler\CallHandler; -use Behat\Testwork\Call\Handler\ExceptionHandler; -use Exception; -use Throwable; - -/** - * Makes calls and handles results using registered handlers. - * - * @author Konstantin Kudryashov - */ -final class CallCenter -{ - /** - * @var CallFilter[] - */ - private $callFilters = array(); - /** - * @var CallHandler[] - */ - private $callHandlers = array(); - /** - * @var ResultFilter[] - */ - private $resultFilters = array(); - /** - * @var ExceptionHandler[] - */ - private $exceptionHandlers = array(); - - /** - * Registers call filter. - * - * @param CallFilter $filter - */ - public function registerCallFilter(CallFilter $filter) - { - $this->callFilters[] = $filter; - } - - /** - * Registers call handler. - * - * @param CallHandler $handler - */ - public function registerCallHandler(CallHandler $handler) - { - $this->callHandlers[] = $handler; - } - - /** - * Registers call result filter. - * - * @param ResultFilter $filter - */ - public function registerResultFilter(ResultFilter $filter) - { - $this->resultFilters[] = $filter; - } - - /** - * Registers result exception handler. - * - * @param ExceptionHandler $handler - */ - public function registerExceptionHandler(ExceptionHandler $handler) - { - $this->exceptionHandlers[] = $handler; - } - - /** - * Handles call and its result using registered filters and handlers. - * - * @param Call $call - * - * @return CallResult - */ - public function makeCall(Call $call) - { - try { - return $this->filterResult($this->handleCall($this->filterCall($call))); - } catch (Throwable $exception) { - return new CallResult($call, null, $this->handleException($exception), null); - } - } - - /** - * Filters call using registered filters and returns a filtered one. - * - * @param Call $call - * - * @return Call - */ - private function filterCall(Call $call) - { - foreach ($this->callFilters as $filter) { - if (!$filter->supportsCall($call)) { - continue; - } - - $call = $filter->filterCall($call); - } - - return $call; - } - - /** - * Handles call using registered call handlers. - * - * @param Call $call - * - * @return CallResult - * - * @throws CallHandlingException If call handlers didn't produce call result - */ - private function handleCall(Call $call) - { - foreach ($this->callHandlers as $handler) { - if (!$handler->supportsCall($call)) { - continue; - } - - return $handler->handleCall($call); - } - - throw new CallHandlingException(sprintf( - 'None of the registered call handlers could handle a `%s` call.', - $call->getCallee()->getPath() - ), $call); - } - - /** - * Filters call result using registered filters and returns a filtered one. - * - * @param CallResult $result - * - * @return CallResult - */ - private function filterResult(CallResult $result) - { - foreach ($this->resultFilters as $filter) { - if (!$filter->supportsResult($result)) { - continue; - } - - $result = $filter->filterResult($result); - } - - return $result; - } - - /** - * Handles exception using registered handlers and returns a handled one. - * - * @param Throwable $exception - * - * @return Throwable - */ - private function handleException($exception) - { - foreach ($this->exceptionHandlers as $handler) { - if (!$handler->supportsException($exception)) { - continue; - } - - $exception = $handler->handleException($exception); - } - - if ($exception instanceof Throwable) { - return new FatalThrowableError($exception); - } - - return $exception; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallResult.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallResult.php deleted file mode 100644 index 4ee808b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallResult.php +++ /dev/null @@ -1,117 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call; - -use Exception; - -/** - * Represents result of the call. - * - * @author Konstantin Kudryashov - */ -final class CallResult -{ - /** - * @var Call - */ - private $call; - /** - * @var mixed - */ - private $return; - /** - * @var null|Exception - */ - private $exception; - /** - * @var null|string - */ - private $stdOut; - - /** - * Initializes call result. - * - * @param Call $call - * @param mixed $return - * @param null|Exception $exception - * @param null|string $stdOut - */ - public function __construct(Call $call, $return, Exception $exception = null, $stdOut = null) - { - $this->call = $call; - $this->return = $return; - $this->exception = $exception; - $this->stdOut = $stdOut; - } - - /** - * Returns call. - * - * @return Call - */ - public function getCall() - { - return $this->call; - } - - /** - * Returns call return value. - * - * @return mixed - */ - public function getReturn() - { - return $this->return; - } - - /** - * Check if call thrown exception. - * - * @psalm-assert-if-true Exception $this->exception - * @psalm-assert-if-true Exception $this->getException() - * - * @return bool - */ - public function hasException() - { - return null !== $this->exception; - } - - /** - * Returns exception thrown by call (if any). - * - * @return null|Exception - */ - public function getException() - { - return $this->exception; - } - - /** - * Checks if call produced stdOut. - * - * @return bool - */ - public function hasStdOut() - { - return null !== $this->stdOut; - } - - /** - * Returns stdOut produced by call (if any). - * - * @return null|string - */ - public function getStdOut() - { - return $this->stdOut; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallResults.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallResults.php deleted file mode 100644 index 6bc3e8b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/CallResults.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call; - -use ArrayIterator; -use Countable; -use IteratorAggregate; - -/** - * Aggregates multiple call results into a collection and provides an informational API on top of that. - * - * @author Konstantin Kudryashov - */ -final class CallResults implements Countable, IteratorAggregate -{ - /** - * @var CallResult[] - */ - private $results; - - /** - * Initializes call results collection. - * - * @param CallResult[] $results - */ - public function __construct(array $results = array()) - { - $this->results = $results; - } - - /** - * Merges results from provided collection into the current one. - * - * @param CallResults $first - * @param CallResults $second - * - * @return CallResults - */ - public static function merge(CallResults $first, CallResults $second) - { - return new static(array_merge($first->toArray(), $second->toArray())); - } - - /** - * Checks if any call in collection throws an exception. - * - * @return bool - */ - public function hasExceptions() - { - foreach ($this->results as $result) { - if ($result->hasException()) { - return true; - } - } - - return false; - } - - /** - * Checks if any call in collection produces an output. - * - * @return bool - */ - public function hasStdOuts() - { - foreach ($this->results as $result) { - if ($result->hasStdOut()) { - return true; - } - } - - return false; - } - - /** - * Returns amount of results. - * - * @return integer - */ - public function count(): int - { - return count($this->results); - } - - /** - * Returns collection iterator. - * - * @return ArrayIterator - */ - public function getIterator(): ArrayIterator - { - return new ArrayIterator($this->results); - } - - /** - * Returns call results array. - * - * @return CallResult[] - */ - public function toArray() - { - return $this->results; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Callee.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Callee.php deleted file mode 100644 index 17ed0f5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Callee.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call; - -use ReflectionFunctionAbstract; - -/** - * Represents callable object. - * - * @author Konstantin Kudryashov - */ -interface Callee -{ - /** - * Returns callee definition path. - * - * @return string - */ - public function getPath(); - - /** - * Returns callee description. - * - * @return string - */ - public function getDescription(); - - /** - * Returns true if callee is a method, false otherwise. - * - * @return bool - */ - public function isAMethod(); - - /** - * Returns true if callee is an instance (non-static) method, false otherwise. - * - * @return bool - */ - public function isAnInstanceMethod(); - - /** - * Returns callable. - * - * @return callable - */ - public function getCallable(); - - /** - * Returns callable reflection. - * - * @return ReflectionFunctionAbstract - */ - public function getReflection(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/BadCallbackException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/BadCallbackException.php deleted file mode 100644 index de56b4e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/BadCallbackException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Exception; - -use InvalidArgumentException; - -/** - * Represents exception caused by a bad callback. - * - * @author Konstantin Kudryashov - */ -final class BadCallbackException extends InvalidArgumentException implements CallException -{ - /** - * @var callable - */ - private $callable; - - /** - * Initializes exception. - * - * @param string $message - * @param callable $callable - */ - public function __construct($message, $callable) - { - $this->callable = $callable; - - parent::__construct($message); - } - - /** - * Returns callback that caused exception. - * - * @return callable - */ - public function getCallable() - { - return $this->callable; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallErrorException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallErrorException.php deleted file mode 100644 index 1622f0f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallErrorException.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Exception; - -use ErrorException; - -/** - * Represents catchable errors raised during call execution. - * - * @author Konstantin Kudryashov - */ -final class CallErrorException extends ErrorException -{ - private $levels = array( - E_WARNING => 'Warning', - E_NOTICE => 'Notice', - E_USER_ERROR => 'User Error', - E_USER_WARNING => 'User Warning', - E_USER_NOTICE => 'User Notice', - E_STRICT => 'Runtime Notice', - E_RECOVERABLE_ERROR => 'Catchable Fatal Error', - ); - - /** - * Initializes error handler exception. - * - * @param integer $level error level - * @param string $message error message - * @param string $file error file - * @param integer $line error line - */ - public function __construct($level, $message, $file, $line) - { - parent::__construct( - sprintf( - '%s: %s in %s line %d', - $this->levels[$level] ?? $level, - $message, - $file, - $line - ) - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallException.php deleted file mode 100644 index 1e3db97..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * All call exceptions should implement this interface. - * - * @author Konstantin Kudryashov - */ -interface CallException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallHandlingException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallHandlingException.php deleted file mode 100644 index f8e670e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/CallHandlingException.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Exception; - -use Behat\Testwork\Call\Call; -use RuntimeException; - -/** - * Represents exceptions thrown during call handling phase. - * - * @author Konstantin Kudryashov - */ -final class CallHandlingException extends RuntimeException implements CallException -{ - /** - * @var Call - */ - private $call; - - /** - * Initializes exception. - * - * @param string $message - * @param Call $callable - */ - public function __construct($message, Call $callable) - { - $this->call = $callable; - - parent::__construct($message); - } - - /** - * Returns call that caused exception. - * - * @return Call - */ - public function getCall() - { - return $this->call; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/FatalThrowableError.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/FatalThrowableError.php deleted file mode 100644 index 52958b9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Exception/FatalThrowableError.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Exception; - -use ErrorException; -use ParseError; -use Throwable; -use TypeError; - -/** - * Fatal Throwable Error. - * - * @author Nicolas Grekas - */ -class FatalThrowableError extends ErrorException -{ - 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 = 'Fatal error: '.$e->getMessage(); - $severity = E_ERROR; - } - - parent::__construct( - $message, - $e->getCode(), - $severity, - $e->getFile(), - $e->getLine() - ); - - $this->setTrace($e->getTrace()); - } - - private function setTrace($trace) - { - $traceReflector = new \ReflectionProperty('Exception', 'trace'); - $traceReflector->setAccessible(true); - $traceReflector->setValue($this, $trace); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Filter/CallFilter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Filter/CallFilter.php deleted file mode 100644 index 1519823..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Filter/CallFilter.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Filter; - -use Behat\Testwork\Call\Call; -use Behat\Testwork\Call\CallCenter; - -/** - * Filters call before its being made and returns a new call. - * - * @see CallCenter - * - * @author Konstantin Kudryashov - */ -interface CallFilter -{ - /** - * Checks if filter supports a call. - * - * @param Call $call - * - * @return bool - */ - public function supportsCall(Call $call); - - /** - * Filters a call and returns a new one. - * - * @param Call $call - * - * @return Call - */ - public function filterCall(Call $call); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Filter/ResultFilter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Filter/ResultFilter.php deleted file mode 100644 index 0226702..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Filter/ResultFilter.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Filter; - -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\CallResult; - -/** - * Filters call results and produces new ones. - * - * @see CallCenter - * - * @author Konstantin Kudryashov - */ -interface ResultFilter -{ - /** - * Checks if filter supports call result. - * - * @param CallResult $result - * - * @return bool - */ - public function supportsResult(CallResult $result); - - /** - * Filters call result and returns a new result. - * - * @param CallResult $result - * - * @return CallResult - */ - public function filterResult(CallResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/CallHandler.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/CallHandler.php deleted file mode 100644 index 9396613..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/CallHandler.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Handler; - -use Behat\Testwork\Call\Call; -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\CallResult; - -/** - * Handles calls and produces call results. - * - * @see CallCenter - * - * @author Konstantin Kudryashov - */ -interface CallHandler -{ - /** - * Checks if handler supports call. - * - * @param Call $call - * - * @return bool - */ - public function supportsCall(Call $call); - - /** - * Handles call and returns call result. - * - * @param Call $call - * - * @return CallResult - */ - public function handleCall(Call $call); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/Exception/ClassNotFoundHandler.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/Exception/ClassNotFoundHandler.php deleted file mode 100644 index 6ddeee2..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/Exception/ClassNotFoundHandler.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Handler\Exception; - -use Behat\Testwork\Call\Handler\ExceptionHandler; -use Error; - -/** - * Handles class not found exceptions. - * - * @see ExceptionHandler - * - * @author Konstantin Kudryashov - */ -abstract class ClassNotFoundHandler implements ExceptionHandler -{ - public const PATTERN = "/^Class (?:'|\")([^'\"]+)(?:'|\") not found$/"; - - /** - * {@inheritdoc} - */ - final public function supportsException($exception) - { - if (!$exception instanceof Error) { - return false; - } - - return null !== $this->extractNonExistentClass($exception); - } - - /** - * {@inheritdoc} - */ - final public function handleException($exception) - { - $this->handleNonExistentClass($this->extractNonExistentClass($exception)); - - return $exception; - } - - /** - * Override to handle non-existent class name. - * - * @param string $class - */ - abstract public function handleNonExistentClass($class); - - /** - * Extracts missing class name from the exception. - * - * @param Error $exception - * - * @return null|string - */ - private function extractNonExistentClass(Error $exception) - { - if (1 === preg_match(self::PATTERN, $exception->getMessage(), $matches)) { - return $matches[1]; - } - - return null; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/Exception/MethodNotFoundHandler.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/Exception/MethodNotFoundHandler.php deleted file mode 100644 index f358909..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/Exception/MethodNotFoundHandler.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Handler\Exception; - -use Behat\Testwork\Call\Handler\ExceptionHandler; -use Error; - -/** - * Handles method not found exceptions. - * - * @see ExceptionHandler - * - * @author Konstantin Kudryashov - */ -abstract class MethodNotFoundHandler implements ExceptionHandler -{ - public const PATTERN = '/^Call to undefined method ([^:]+)::([^\)]+)\(\)$/'; - - /** - * {@inheritdoc} - */ - final public function supportsException($exception) - { - if (!$exception instanceof Error) { - return false; - } - - return null !== $this->extractNonExistentCallable($exception); - } - - /** - * {@inheritdoc} - */ - final public function handleException($exception) - { - $this->handleNonExistentMethod($this->extractNonExistentCallable($exception)); - - return $exception; - } - - /** - * Override to handle non-existent method. - * - * @param array $callable - */ - abstract public function handleNonExistentMethod(array $callable); - - /** - * Extract callable from exception. - * - * @param Error $exception - * - * @return null|array - */ - private function extractNonExistentCallable(Error $exception) - { - if (1 === preg_match(self::PATTERN, $exception->getMessage(), $matches)) { - return array($matches[1], $matches[2]); - } - - return null; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/ExceptionHandler.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/ExceptionHandler.php deleted file mode 100644 index 53a35f7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/ExceptionHandler.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Handler; - -/** - * Handles exceptions. - * - * @see CallCenter - * - * @author Konstantin Kudryashov - */ -interface ExceptionHandler -{ - /** - * Checks if handler supports exception. - * - * @param \Throwable $exception - * - * @return bool - */ - public function supportsException($exception); - - /** - * Handles exception and returns new one if necessary. - * - * @param \Throwable $exception - * - * @return \Throwable - */ - public function handleException($exception); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php deleted file mode 100644 index 9f51cd0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/Handler/RuntimeCallHandler.php +++ /dev/null @@ -1,164 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\Handler; - -use Behat\Testwork\Argument\Validator; -use Behat\Testwork\Call\Call; -use Behat\Testwork\Call\CallResult; -use Behat\Testwork\Call\Exception\CallErrorException; -use Exception; - -/** - * Handles calls in the current runtime. - * - * @author Konstantin Kudryashov - */ -final class RuntimeCallHandler implements CallHandler -{ - /** - * @var integer - */ - private $errorReportingLevel; - /** - * @var bool - */ - private $obStarted = false; - /** - * @var Validator - */ - private $validator; - - /** - * Initializes executor. - * - * @param integer $errorReportingLevel - */ - public function __construct($errorReportingLevel = E_ALL) - { - $this->errorReportingLevel = $errorReportingLevel; - $this->validator = new Validator(); - } - - /** - * {@inheritdoc} - */ - public function supportsCall(Call $call) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function handleCall(Call $call) - { - $this->startErrorAndOutputBuffering($call); - $result = $this->executeCall($call); - $this->stopErrorAndOutputBuffering(); - - return $result; - } - - /** - * Used as a custom error handler when step is running. - * - * @see set_error_handler() - * - * @param integer $level - * @param string $message - * @param string $file - * @param integer $line - * - * @return bool - * - * @throws CallErrorException - */ - public function handleError($level, $message, $file, $line) - { - if ($this->errorLevelIsNotReportable($level)) { - return false; - } - - throw new CallErrorException($level, $message, $file, $line); - } - - /** - * Executes single call. - * - * @param Call $call - * - * @return CallResult - */ - private function executeCall(Call $call) - { - $reflection = $call->getCallee()->getReflection(); - $callable = $call->getBoundCallable(); - $arguments = $call->getArguments(); - $return = $exception = null; - - try { - $arguments = array_values($arguments); - $this->validator->validateArguments($reflection, $arguments); - $return = $callable(...$arguments); - } catch (Exception $caught) { - $exception = $caught; - } - - $stdOut = $this->getBufferedStdOut(); - - return new CallResult($call, $return, $exception, $stdOut); - } - - /** - * Returns buffered stdout. - * - * @return null|string - */ - private function getBufferedStdOut() - { - return ob_get_length() ? ob_get_contents() : null; - } - - /** - * Starts error handler and stdout buffering. - * - * @param Call $call - */ - private function startErrorAndOutputBuffering(Call $call) - { - $errorReporting = $call->getErrorReportingLevel() ? : $this->errorReportingLevel; - set_error_handler(array($this, 'handleError'), $errorReporting); - $this->obStarted = ob_start(); - } - - /** - * Stops error handler and stdout buffering. - */ - private function stopErrorAndOutputBuffering() - { - if ($this->obStarted) { - ob_end_clean(); - } - restore_error_handler(); - } - - /** - * Checks if provided error level is not reportable. - * - * @param integer $level - * - * @return bool - */ - private function errorLevelIsNotReportable($level) - { - return !(error_reporting() & $level); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/RuntimeCallee.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/RuntimeCallee.php deleted file mode 100644 index fa232f8..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/RuntimeCallee.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call; - -use Behat\Testwork\Call\Exception\BadCallbackException; -use ReflectionFunction; -use ReflectionFunctionAbstract; -use ReflectionMethod; - -/** - * Represents callee created and executed in the runtime. - * - * @author Konstantin Kudryashov - */ -class RuntimeCallee implements Callee -{ - /** - * @var callable - */ - private $callable; - /** - * @var null|string - */ - private $description; - /** - * @var ReflectionFunctionAbstract - */ - private $reflection; - /** - * @var string - */ - private $path; - - /** - * Initializes callee. - * - * @param callable $callable - * @param null|string $description - * - * @throws BadCallbackException If invalid callback provided - */ - public function __construct($callable, $description = null) - { - if (!is_array($callable) && !is_callable($callable)) { - throw new BadCallbackException(sprintf( - '%s expects a valid callable, but `%s` given', - get_class($this), - gettype($callable) - ), $callable); - } - - if (is_array($callable)) { - $this->reflection = new ReflectionMethod($callable[0], $callable[1]); - $this->path = $callable[0] . '::' . $callable[1] . '()'; - } else { - $this->reflection = new ReflectionFunction($callable); - $this->path = $this->reflection->getFileName() . ':' . $this->reflection->getStartLine(); - } - - $this->callable = $callable; - $this->description = $description; - } - - /** - * Returns callee description. - * - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Returns callee definition path. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Returns callable. - * - * @return callable - */ - public function getCallable() - { - return $this->callable; - } - - /** - * Returns callable reflection. - * - * @return ReflectionFunctionAbstract - */ - public function getReflection() - { - return $this->reflection; - } - - /** - * Returns true if callee is a method, false otherwise. - * - * @return bool - */ - public function isAMethod() - { - return $this->reflection instanceof ReflectionMethod; - } - - /** - * Returns true if callee is an instance (non-static) method, false otherwise. - * - * @return bool - */ - public function isAnInstanceMethod() - { - return $this->reflection instanceof ReflectionMethod - && !$this->reflection->isStatic(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/ServiceContainer/CallExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/ServiceContainer/CallExtension.php deleted file mode 100644 index 81bf258..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Call/ServiceContainer/CallExtension.php +++ /dev/null @@ -1,189 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Call\ServiceContainer; - -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; - -/** - * Provides call services for testwork. - * - * @author Konstantin Kudryashov - */ -final class CallExtension implements Extension -{ - /* - * Available services - */ - public const CALL_CENTER_ID = 'call.center'; - - /* - * Available extension points - */ - public const CALL_FILTER_TAG = 'call.call_filter'; - public const CALL_HANDLER_TAG = 'call.call_handler'; - public const RESULT_FILTER_TAG = 'call.result_filter'; - public const EXCEPTION_HANDLER_TAG = 'call.exception_handler'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'calls'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - $builder - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('error_reporting') - ->info('Call executor will catch exceptions matching this level') - ->defaultValue(E_ALL | E_STRICT) - ->end() - ->end() - ; - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadCallCenter($container); - $this->loadCallHandlers($container, $config['error_reporting']); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processCallFilters($container); - $this->processCallHandlers($container); - $this->processResultFilters($container); - $this->processExceptionHandlers($container); - } - - /** - * Loads call center service. - * - * @param ContainerBuilder $container - */ - protected function loadCallCenter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Call\CallCenter'); - $container->setDefinition(self::CALL_CENTER_ID, $definition); - } - - /** - * Loads prebuilt call handlers. - * - * @param ContainerBuilder $container - * @param integer $errorReporting - */ - protected function loadCallHandlers(ContainerBuilder $container, $errorReporting) - { - $definition = new Definition('Behat\Testwork\Call\Handler\RuntimeCallHandler', array($errorReporting)); - $definition->addTag(self::CALL_HANDLER_TAG, array('priority' => 50)); - $container->setDefinition(self::CALL_HANDLER_TAG . '.runtime', $definition); - } - - /** - * Registers all call filters to the CallCenter. - * - * @param ContainerBuilder $container - */ - protected function processCallFilters(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, CallExtension::CALL_FILTER_TAG); - $definition = $container->getDefinition(CallExtension::CALL_CENTER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerCallFilter', array($reference)); - } - } - - /** - * Registers all call handlers to the CallCenter. - * - * @param ContainerBuilder $container - */ - protected function processCallHandlers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, CallExtension::CALL_HANDLER_TAG); - $definition = $container->getDefinition(CallExtension::CALL_CENTER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerCallHandler', array($reference)); - } - } - - /** - * Registers all call result filters to the CallCenter. - * - * @param ContainerBuilder $container - */ - protected function processResultFilters(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, CallExtension::RESULT_FILTER_TAG); - $definition = $container->getDefinition(CallExtension::CALL_CENTER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerResultFilter', array($reference)); - } - } - - /** - * Registers all exception handlers to the CallCenter. - * - * @param ContainerBuilder $container - */ - private function processExceptionHandlers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, CallExtension::EXCEPTION_HANDLER_TAG); - $definition = $container->getDefinition(CallExtension::CALL_CENTER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerExceptionHandler', array($reference)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php deleted file mode 100644 index ad57803..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php +++ /dev/null @@ -1,236 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Cli; - -use Behat\Testwork\ServiceContainer\Configuration\ConfigurationLoader; -use Behat\Testwork\ServiceContainer\ContainerLoader; -use Behat\Testwork\ServiceContainer\Exception\ConfigurationLoadingException; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Symfony\Component\Console\Application as BaseApplication; -use Symfony\Component\Console\Command\Command as SymfonyCommand; -use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Extends Symfony console application with testwork functionality. - * - * @author Konstantin Kudryashov - */ -final class Application extends BaseApplication -{ - /** - * @var ConfigurationLoader - */ - private $configurationLoader; - /** - * @var ExtensionManager - */ - private $extensionManager; - - /** - * Initializes application. - * - * @param string $name - * @param string $version - * @param ConfigurationLoader $configLoader - * @param ExtensionManager $extensionManager - */ - public function __construct($name, $version, ConfigurationLoader $configLoader, ExtensionManager $extensionManager) - { - putenv('COLUMNS=9999'); - - $this->configurationLoader = $configLoader; - $this->extensionManager = $extensionManager; - - parent::__construct($name, $version); - } - - /** - * Gets the default input definition. - * - * @return InputDefinition An InputDefinition instance - */ - public function getDefaultInputDefinition(): InputDefinition - { - return new InputDefinition(array( - new InputOption('--profile', '-p', InputOption::VALUE_REQUIRED, 'Specify config profile to use.'), - new InputOption('--config', '-c', InputOption::VALUE_REQUIRED, 'Specify config file to use.'), - new InputOption( - '--verbose', '-v', InputOption::VALUE_OPTIONAL, - 'Increase verbosity of exceptions.' . PHP_EOL . - 'Use -vv or --verbose=2 to display backtraces in addition to exceptions.' - ), - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'), - new InputOption('--config-reference', null, InputOption::VALUE_NONE, 'Display the configuration reference.'), - new InputOption('--debug', null, InputOption::VALUE_NONE, 'Provide debugging information about current environment.'), - new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display version.'), - new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question.'), - new InputOption( - '--colors', null, InputOption::VALUE_NONE, - 'Force ANSI color in the output. By default color support is' . PHP_EOL . - 'guessed based on your platform and the output if not specified.' - ), - new InputOption('--no-colors', null, InputOption::VALUE_NONE, 'Force no ANSI color in the output.'), - )); - } - - /** - * Runs the current application. - * - * @param InputInterface $input An Input instance - * @param OutputInterface $output An Output instance - * - * @return integer 0 if everything went fine, or an error code - */ - public function doRun(InputInterface $input, OutputInterface $output) - { - // xdebug's default nesting level of 100 is not enough - if (extension_loaded('xdebug') - && false === strpos(ini_get('disable_functions'), 'ini_set') - ) { - $oldValue = ini_get('xdebug.max_nesting_level'); - if ($oldValue === false || $oldValue < 256) { - ini_set('xdebug.max_nesting_level', 256); - } - } - - if ($input->hasParameterOption(array('--config-reference'))) { - $input = new ArrayInput(array('--config-reference' => true)); - } - - if ($path = $input->getParameterOption(array('--config', '-c'))) { - if (!is_file($path)) { - throw new ConfigurationLoadingException("The requested config file does not exist"); - } - - $this->configurationLoader->setConfigurationFilePath($path); - } - - $this->add($this->createCommand($input, $output)); - - return parent::doRun($input, $output); - } - - protected function getDefaultCommands(): array - { - $commands = parent::getDefaultCommands(); - - $commands[] = new DumpReferenceCommand($this->extensionManager); - $commands[] = new DebugCommand($this, $this->configurationLoader, $this->extensionManager); - - return $commands; - } - - /** - * Configures container based on provided config file and profile. - * - * @param InputInterface $input - * - * @return array - */ - private function loadConfiguration(InputInterface $input) - { - $profile = $input->getParameterOption(array('--profile', '-p')) ? : 'default'; - - return $this->configurationLoader->loadConfiguration($profile); - } - - /** - * Creates main command for application. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return SymfonyCommand - */ - private function createCommand(InputInterface $input, OutputInterface $output) - { - return $this->createContainer($input, $output)->get('cli.command'); - } - - /** - * Creates container instance, loads extensions and freezes it. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return ContainerInterface - */ - private function createContainer(InputInterface $input, OutputInterface $output) - { - $basePath = rtrim($this->getBasePath(), DIRECTORY_SEPARATOR); - - $container = new ContainerBuilder(); - - $container->setParameter('cli.command.name', $this->getName()); - $container->setParameter('paths.base', $basePath); - - $container->set('cli.input', $input); - $container->set('cli.output', $output); - - $extension = new ContainerLoader($this->extensionManager); - $extension->load($container, $this->loadConfiguration($input)); - $container->addObjectResource($extension); - $container->compile(true); - - return $container; - } - - /** - * Returns base path. - * - * @return string - */ - private function getBasePath() - { - if ($configPath = $this->configurationLoader->getConfigurationFilePath()) { - return realpath(dirname($configPath)); - } - - return realpath(getcwd()); - } - - /** - * Gets the name of the command based on input. - * - * @param InputInterface $input The input interface - * - * @return string The command name - */ - protected function getCommandName(InputInterface $input): string - { - if ($input->hasParameterOption(array('--config-reference'))) { - return 'dump-reference'; - } - - if ($input->hasParameterOption(array('--debug'))) { - return 'debug'; - } - - return $this->getName(); - } - - protected function configureIO(InputInterface $input, OutputInterface $output) - { - if (true === $input->hasParameterOption(array('--colors'))) { - $output->setDecorated(true); - } elseif (true === $input->hasParameterOption(array('--no-colors'))) { - $output->setDecorated(false); - } - - parent::configureIO($input, $output); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Command.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Command.php deleted file mode 100644 index ae53dfa..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Command.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Cli; - -use Symfony\Component\Console\Command\Command as BaseCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Extends Symfony console command with a controller-based delegation. - * - * @author Konstantin Kudryashov - */ -final class Command extends BaseCommand -{ - /** - * @var Controller[] - */ - private $controllers = array(); - - /** - * Initializes command. - * - * @param string $commandName - * @param Controller[] $controllers - */ - public function __construct($commandName, array $controllers) - { - $this->controllers = $controllers; - - parent::__construct($commandName); - } - - /** - * Configures the command by running controllers prepare(). - */ - protected function configure() - { - foreach ($this->controllers as $controller) { - $controller->configure($this); - } - } - - /** - * Executes the current command by executing all controllers action(). - * - * @param InputInterface $input An InputInterface instance - * @param OutputInterface $output An OutputInterface instance - * - * @return integer Return code of one of the processors or 0 if none of them returned integer - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - foreach ($this->controllers as $controller) { - if (is_int($return = $controller->execute($input, $output))) { - return $return; - } - } - - return 0; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Controller.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Controller.php deleted file mode 100644 index e604d67..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/Controller.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Cli; - -use Symfony\Component\Console\Command\Command as SymfonyCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Represents Testwork Console Controller. - * - * All testwork console controllers should implement this interface. - * - * @author Konstantin Kudryashov - */ -interface Controller -{ - /** - * Configures command to be executable by the controller. - * - * @param SymfonyCommand $command - */ - public function configure(SymfonyCommand $command); - - /** - * Executes controller. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return null|integer - */ - public function execute(InputInterface $input, OutputInterface $output); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/DebugCommand.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/DebugCommand.php deleted file mode 100644 index d24ffd5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/DebugCommand.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Cli; - -use Behat\Testwork\ServiceContainer\Configuration\ConfigurationLoader; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Symfony\Component\Console\Command\Command as BaseCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Provides debug information about the current environment. - * - * @author Konstantin Kudryashov - */ -final class DebugCommand extends BaseCommand -{ - /** - * @var Application - */ - private $application; - /** - * @var ConfigurationLoader - */ - private $configurationLoader; - /** - * @var ExtensionManager - */ - private $extensionManager; - - /** - * Initialises command. - * - * @param Application $application - * @param ConfigurationLoader $configurationLoader - * @param ExtensionManager $extensionManager - */ - public function __construct( - Application $application, - ConfigurationLoader $configurationLoader, - ExtensionManager $extensionManager - ) { - $this->application = $application; - $this->configurationLoader = $configurationLoader; - $this->extensionManager = $extensionManager; - - parent::__construct('debug'); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $output->writeln(sprintf('%s version %s', $this->application->getName(), $this->application->getVersion())); - - $output->writeln(''); - - $debug = $this->configurationLoader->debugInformation(); - $output->writeln('--- configuration'); - $output->writeln(sprintf(' environment variable (%s): %s', $debug['environment_variable_name'], $debug['environment_variable_content'])); - $output->writeln(sprintf(' configuration file: %s', $debug['configuration_file_path'])); - - $output->writeln(''); - - $debug = $this->extensionManager->debugInformation(); - $output->writeln('--- extensions'); - $output->writeln(sprintf(' extensions loaded: %s', count($debug['extensions_list']) ? implode(', ', $debug['extensions_list']) : 'none')); - - $output->writeln(''); - - return 0; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/DumpReferenceCommand.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/DumpReferenceCommand.php deleted file mode 100644 index e4242bb..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/DumpReferenceCommand.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Cli; - -use Behat\Testwork\ServiceContainer\Configuration\ConfigurationTree; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper; -use Symfony\Component\Config\Definition\ReferenceDumper; -use Symfony\Component\Console\Command\Command as BaseCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Extends Symfony console application with testwork functionality. - * - * @author Christophe Coevoet - */ -final class DumpReferenceCommand extends BaseCommand -{ - /** - * @var ExtensionManager - */ - private $extensionManager; - - /** - * Initializes dumper. - * - * @param ExtensionManager $extensionManager - */ - public function __construct(ExtensionManager $extensionManager) - { - $this->extensionManager = $extensionManager; - - parent::__construct('dump-reference'); - } - - /** - * {@inheritdoc} - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - $dumper = new YamlReferenceDumper(); - $configTree = new ConfigurationTree(); - - $output->writeln($dumper->dumpNode($configTree->getConfigTree($this->extensionManager->getExtensions()))); - - return 0; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php deleted file mode 100644 index faca4ce..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Cli/ServiceContainer/CliExtension.php +++ /dev/null @@ -1,123 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Cli\ServiceContainer; - -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; - -/** - * Provides console services for testwork. - * - * @author Konstantin Kudryashov - */ -final class CliExtension implements Extension -{ - /* - * Available services - */ - public const COMMAND_ID = 'cli.command'; - public const INPUT_ID = 'cli.input'; - public const OUTPUT_ID = 'cli.output'; - - /* - * Available extension points - */ - public const CONTROLLER_TAG = 'cli.controller'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ?: new ServiceProcessor(); - } - - /** - * Returns the extension config key. - * - * @return string - */ - public function getConfigKey() - { - return 'cli'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadCommand($container); - $this->loadSyntheticServices($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processControllers($container); - } - - /** - * Loads application command. - * - * @param ContainerBuilder $container - */ - protected function loadCommand(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Cli\Command', array('%cli.command.name%', array())); - $definition->setPublic(true); - $container->setDefinition(self::COMMAND_ID, $definition); - } - - protected function loadSyntheticServices(ContainerBuilder $container) - { - $container->register(self::INPUT_ID)->setSynthetic(true)->setPublic(true); - $container->register(self::OUTPUT_ID)->setSynthetic(true)->setPublic(true); - } - - /** - * Processes all controllers in container. - * - * @param ContainerBuilder $container - */ - protected function processControllers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::CONTROLLER_TAG); - $container->getDefinition(self::COMMAND_ID)->replaceArgument(1, $references); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Exception/TimerException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Exception/TimerException.php deleted file mode 100644 index 72238fd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Exception/TimerException.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Counter\Exception; - -use Behat\Testwork\Exception\TestworkException; -use LogicException; - -/** - * Represents exception caused by timer handling. - * - * @author Konstantin Kudryashov - */ -final class TimerException extends LogicException implements TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Memory.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Memory.php deleted file mode 100644 index f7d8605..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Memory.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Counter; - -/** - * Counts amount of system memory being used. - * - * @author Konstantin Kudryashov - */ -final class Memory -{ - /** - * @var string[] - */ - private $units = array('B', 'Kb', 'Mb', 'Gb', 'Tb'); - - /** - * Returns current memory usage. - * - * @return integer - */ - public function getMemoryUsage() - { - return memory_get_usage(); - } - - /** - * Presents memory usage in human-readable form. - * - * @return string - */ - public function __toString() - { - return $this->humanize($this->getMemoryUsage()); - } - - /** - * Humanizes usage information. - * - * @param integer $bytes - * - * @return string - */ - private function humanize($bytes) - { - $e = intval(floor(log($bytes) / log(1024))); - - if (!isset($this->units[$e])) { - return 'Can not calculate memory usage'; - } - - return sprintf('%.2f%s', ($bytes / pow(1024, floor($e))), $this->units[$e]); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Timer.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Timer.php deleted file mode 100644 index 65025a3..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Counter/Timer.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Counter; - -use Behat\Testwork\Counter\Exception\TimerException; - -/** - * Provides time counting functionality. - * - * @author Konstantin Kudryashov - */ -final class Timer -{ - /** - * @var null|float - */ - private $starTime; - /** - * @var null|float - */ - private $stopTime; - - /** - * Starts timer. - */ - public function start() - { - $this->starTime = microtime(true); - } - - /** - * Stops timer. - * - * @throws TimerException If timer has not been started - */ - public function stop() - { - if (!$this->starTime) { - throw new TimerException('You can not stop timer that has not been started.'); - } - - $this->stopTime = microtime(true); - } - - /** - * @return null|float - * - * @throws TimerException If timer has not been started - */ - public function getTime() - { - if (!$this->starTime) { - throw new TimerException('You can not get time from timer that never been started.'); - } - - $stopTime = $this->stopTime; - if (!$this->stopTime) { - $stopTime = microtime(true); - } - - return $stopTime - $this->starTime; - } - - /** - * Returns number of minutes passed. - * - * @return integer - */ - public function getMinutes() - { - return intval(floor($this->getTime() / 60)); - } - - /** - * Returns number of seconds passed. - * - * @return float - */ - public function getSeconds() - { - return round($this->getTime() - ($this->getMinutes() * 60), 3); - } - - /** - * Returns string representation of time passed. - * - * @return string - */ - public function __toString() - { - if (!$this->starTime || !$this->stopTime) { - return '0m0s'; - } - - return sprintf('%dm%.2fs', $this->getMinutes(), $this->getSeconds()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Call/EnvironmentCall.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Call/EnvironmentCall.php deleted file mode 100644 index 39d34f7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Call/EnvironmentCall.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\Call; - -use Behat\Testwork\Call\Call; -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Environment\Environment; - -/** - * Represents environment-based call. - * - * @author Konstantin Kudryashov - */ -class EnvironmentCall implements Call -{ - /** - * @var Environment - */ - private $environment; - /** - * @var Callee - */ - private $callee; - /** - * @var array - */ - private $arguments; - /** - * @var null|integer - */ - private $errorReportingLevel; - - /** - * Initializes call. - * - * @param Environment $environment - * @param Callee $callee - * @param array $arguments - * @param null|integer $errorReportingLevel - */ - public function __construct( - Environment $environment, - Callee $callee, - array $arguments, - $errorReportingLevel = null - ) { - $this->environment = $environment; - $this->callee = $callee; - $this->arguments = $arguments; - $this->errorReportingLevel = $errorReportingLevel; - } - - /** - * Returns environment this call is executed from. - * - * @return Environment - */ - final public function getEnvironment() - { - return $this->environment; - } - - /** - * {@inheritdoc} - */ - final public function getCallee() - { - return $this->callee; - } - - /** - * {@inheritdoc} - */ - final public function getBoundCallable() - { - return $this->environment->bindCallee($this->callee); - } - - /** - * {@inheritdoc} - */ - final public function getArguments() - { - return $this->arguments; - } - - /** - * {@inheritdoc} - */ - final public function getErrorReportingLevel() - { - return $this->errorReportingLevel; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Environment.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Environment.php deleted file mode 100644 index 0850015..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Environment.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment; - -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Suite\Suite; - -/** - * Represents Testwork test environment. - * - * @author Konstantin Kudryashov - */ -interface Environment -{ - /** - * Returns environment suite. - * - * @return Suite - */ - public function getSuite(); - - /** - * Creates callable using provided Callee. - * - * @param Callee $callee - * - * @return callable - */ - public function bindCallee(Callee $callee); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/EnvironmentManager.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/EnvironmentManager.php deleted file mode 100644 index b1dda50..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/EnvironmentManager.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment; - -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Environment\Exception\EnvironmentBuildException; -use Behat\Testwork\Environment\Exception\EnvironmentIsolationException; -use Behat\Testwork\Environment\Handler\EnvironmentHandler; -use Behat\Testwork\Environment\Reader\EnvironmentReader; -use Behat\Testwork\Suite\Suite; - -/** - * Builds, isolates and reads environments using registered handlers and readers. - * - * @author Konstantin Kudryashov - */ -final class EnvironmentManager -{ - /** - * @var EnvironmentHandler[] - */ - private $handlers = array(); - /** - * @var EnvironmentReader[] - */ - private $readers = array(); - - /** - * Registers environment handler. - * - * @param EnvironmentHandler $handler - */ - public function registerEnvironmentHandler(EnvironmentHandler $handler) - { - $this->handlers[] = $handler; - } - - /** - * Registers environment reader. - * - * @param EnvironmentReader $reader - */ - public function registerEnvironmentReader(EnvironmentReader $reader) - { - $this->readers[] = $reader; - } - - /** - * Builds new environment for provided test suite. - * - * @param Suite $suite - * - * @return Environment - * - * @throws EnvironmentBuildException - */ - public function buildEnvironment(Suite $suite) - { - foreach ($this->handlers as $handler) { - if ($handler->supportsSuite($suite)) { - return $handler->buildEnvironment($suite); - } - } - - throw new EnvironmentBuildException(sprintf( - 'None of the registered environment handlers seem to support `%s` suite.', - $suite->getName() - ), $suite); - } - - /** - * Creates new isolated test environment using built one. - * - * @param Environment $environment - * @param mixed $testSubject - * - * @return Environment - * - * @throws EnvironmentIsolationException If appropriate environment handler is not found - */ - public function isolateEnvironment(Environment $environment, $testSubject = null) - { - foreach ($this->handlers as $handler) { - if ($handler->supportsEnvironmentAndSubject($environment, $testSubject)) { - return $handler->isolateEnvironment($environment, $testSubject); - } - } - - throw new EnvironmentIsolationException(sprintf( - 'None of the registered environment handlers seem to support `%s` environment.', - get_class($environment) - ), $environment, $testSubject); - } - - /** - * Reads all callees from environment using registered environment readers. - * - * @param Environment $environment - * - * @return Callee[] - */ - public function readEnvironmentCallees(Environment $environment) - { - $callees = array(); - foreach ($this->readers as $reader) { - if ($reader->supportsEnvironment($environment)) { - $callees = array_merge($callees, $reader->readEnvironmentCallees($environment)); - } - } - - return $callees; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentBuildException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentBuildException.php deleted file mode 100644 index 4c3bb92..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentBuildException.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\Exception; - -use Behat\Testwork\Suite\Suite; -use RuntimeException; - -/** - * Represents exception thrown during an environment build process. - * - * @author Konstantin Kudryashov - */ -final class EnvironmentBuildException extends RuntimeException implements EnvironmentException -{ - /** - * @var Suite - */ - private $suite; - - /** - * Initializes exception. - * - * @param string $message - * @param Suite $suite - */ - public function __construct($message, Suite $suite) - { - $this->suite = $suite; - - parent::__construct($message); - } - - /** - * Returns suite that caused exception. - * - * @return Suite - */ - public function getSuite() - { - return $this->suite; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentException.php deleted file mode 100644 index 4b8579f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * All environment exceptions should implement this interface. - * - * @author Konstantin Kudryashov - */ -interface EnvironmentException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentIsolationException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentIsolationException.php deleted file mode 100644 index 6f517ae..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentIsolationException.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\Exception; - -use Behat\Testwork\Environment\Environment; -use RuntimeException; - -/** - * Represents exception thrown during environment isolation process. - * - * @author Konstantin Kudryashov - */ -final class EnvironmentIsolationException extends RuntimeException implements EnvironmentException -{ - /** - * @var Environment - */ - private $environment; - /** - * @var mixed - */ - private $subject; - - /** - * Initializes exception. - * - * @param string $message - * @param Environment $environment - * @param mixed $testSubject - */ - public function __construct($message, Environment $environment, $testSubject = null) - { - $this->environment = $environment; - $this->subject = $testSubject; - - parent::__construct($message); - } - - /** - * Returns environment that caused exception. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * Returns test subject that caused exception. - * - * @return mixed - */ - public function getSubject() - { - return $this->subject; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentReadException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentReadException.php deleted file mode 100644 index 07ed513..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Exception/EnvironmentReadException.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\Exception; - -use Behat\Testwork\Environment\Environment; -use RuntimeException; - -/** - * Represents exception thrown during an environment read. - * - * @author Konstantin Kudryashov - */ -final class EnvironmentReadException extends RuntimeException implements EnvironmentException -{ - /** - * @var Environment - */ - private $environment; - - /** - * Initializes exception. - * - * @param string $message - * @param Environment $environment - */ - public function __construct($message, Environment $environment) - { - $this->environment = $environment; - - parent::__construct($message); - } - - /** - * Returns environment that caused exception. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php deleted file mode 100644 index 1b43589..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Handler/EnvironmentHandler.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\Handler; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\EnvironmentManager; -use Behat\Testwork\Suite\Suite; - -/** - * Handles test environment building and isolation. - * - * @see EnvironmentManager - * - * @author Konstantin Kudryashov - */ -interface EnvironmentHandler -{ - /** - * Checks if handler supports provided suite. - * - * @param Suite $suite - * - * @return bool - */ - public function supportsSuite(Suite $suite); - - /** - * Builds environment object based on provided suite. - * - * @param Suite $suite - * - * @return Environment - */ - public function buildEnvironment(Suite $suite); - - /** - * Checks if handler supports provided environment. - * - * @param Environment $environment - * @param mixed $testSubject - * - * @return bool - */ - public function supportsEnvironmentAndSubject(Environment $environment, $testSubject = null); - - /** - * Isolates provided environment. - * - * @param Environment $environment - * @param mixed $testSubject - * - * @return Environment - */ - public function isolateEnvironment(Environment $environment, $testSubject = null); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Handler/StaticEnvironmentHandler.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Handler/StaticEnvironmentHandler.php deleted file mode 100644 index 6b399cc..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Handler/StaticEnvironmentHandler.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\Handler; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\StaticEnvironment; -use Behat\Testwork\Suite\Suite; - -/** - * Represents environment handler based on static calls (without any isolation). - * - * @author Konstantin Kudryashov - */ -final class StaticEnvironmentHandler implements EnvironmentHandler -{ - /** - * {@inheritdoc} - */ - public function supportsSuite(Suite $suite) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function buildEnvironment(Suite $suite) - { - return new StaticEnvironment($suite); - } - - /** - * {@inheritdoc} - */ - public function supportsEnvironmentAndSubject(Environment $environment, $testSubject = null) - { - return $environment instanceof StaticEnvironment; - } - - /** - * {@inheritdoc} - */ - public function isolateEnvironment(Environment $environment, $testSubject = null) - { - return $environment; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php deleted file mode 100644 index 39cd467..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/Reader/EnvironmentReader.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\Reader; - -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\EnvironmentManager; - -/** - * Reads callees from a provided environment. - * - * @see EnvironmentManager - * - * @author Konstantin Kudryashov - */ -interface EnvironmentReader -{ - /** - * Checks if reader supports an environment. - * - * @param Environment $environment - * - * @return bool - */ - public function supportsEnvironment(Environment $environment); - - /** - * Reads callees from an environment. - * - * @param Environment $environment - * - * @return Callee[] - */ - public function readEnvironmentCallees(Environment $environment); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/ServiceContainer/EnvironmentExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/ServiceContainer/EnvironmentExtension.php deleted file mode 100644 index 389b361..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/ServiceContainer/EnvironmentExtension.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment\ServiceContainer; - -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; - -/** - * Testwork test environment extension. - * - * Extends testwork with environment services. - * - * @author Konstantin Kudryashov - */ -final class EnvironmentExtension implements Extension -{ - /* - * Available services - */ - public const MANAGER_ID = 'environment.manager'; - - /* - * Available extension points - */ - public const HANDLER_TAG = 'environment.handler'; - public const READER_TAG = 'environment.reader'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'environments'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadManager($container); - $this->loadStaticEnvironmentHandler($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processHandlers($container); - $this->processReaders($container); - } - - /** - * Loads environment manager. - * - * @param ContainerBuilder $container - */ - protected function loadManager(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Environment\EnvironmentManager'); - $container->setDefinition(self::MANAGER_ID, $definition); - } - - /** - * Loads static environments handler. - * - * @param ContainerBuilder $container - */ - protected function loadStaticEnvironmentHandler(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Environment\Handler\StaticEnvironmentHandler'); - $definition->addTag(self::HANDLER_TAG, array('priority' => 0)); - $container->setDefinition(self::HANDLER_TAG . '.static', $definition); - } - - /** - * Processes all environment handlers. - * - * @param ContainerBuilder $container - */ - protected function processHandlers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::HANDLER_TAG); - $definition = $container->getDefinition(self::MANAGER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerEnvironmentHandler', array($reference)); - } - } - - /** - * Processes all environment readers. - * - * @param ContainerBuilder $container - */ - protected function processReaders(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::READER_TAG); - $definition = $container->getDefinition(self::MANAGER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerEnvironmentReader', array($reference)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/StaticEnvironment.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/StaticEnvironment.php deleted file mode 100644 index 3396b63..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Environment/StaticEnvironment.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Environment; - -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Suite\Suite; - -/** - * Represents static calls environment. - * - * @author Konstantin Kudryashov - */ -class StaticEnvironment implements Environment -{ - /** - * @var Suite - */ - private $suite; - - /** - * Initializes environment. - * - * @param Suite $suite - */ - public function __construct(Suite $suite) - { - $this->suite = $suite; - } - - /** - * {@inheritdoc} - */ - final public function getSuite() - { - return $this->suite; - } - - /** - * {@inheritdoc} - */ - final public function bindCallee(Callee $callee) - { - return $callee->getCallable(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php deleted file mode 100644 index f0d7d2c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Cli; - -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\EventDispatcher\Event\AfterExerciseAborted; -use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Aborts exercise on SIGINT signal. - * - * @author Konstantin Kudryashov - */ -final class SigintController implements Controller -{ - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * Initializes controller. - * - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(EventDispatcherInterface $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - if (function_exists('pcntl_signal')) { - pcntl_async_signals(true); - - /** - * @psalm-suppress UndefinedConstant (SIGINT is defined in pcntl) - */ - pcntl_signal(SIGINT, array($this, 'abortExercise')); - } - } - - /** - * Dispatches AFTER exercise event and exits program. - */ - public function abortExercise() - { - $this->eventDispatcher->dispatch(new AfterExerciseAborted(), ExerciseCompleted::AFTER); - - exit(1); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseAborted.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseAborted.php deleted file mode 100644 index 18c9aae..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseAborted.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -/** - * Represents an event in which exercise was aborted. - * - * @author Konstantin Kudryashov - */ -final class AfterExerciseAborted extends ExerciseCompleted -{ - /** - * {@inheritdoc} - */ - public function getSpecificationIterators() - { - return array(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseCompleted.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseCompleted.php deleted file mode 100644 index b2eec9f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseCompleted.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents an event in which exercise was completed. - * - * @author Konstantin Kudryashov - */ -final class AfterExerciseCompleted extends ExerciseCompleted implements AfterTested -{ - /** - * @var SpecificationIterator[] - */ - private $specificationIterators; - /** - * @var TestResult - */ - private $result; - /** - * @var Teardown - */ - private $teardown; - - /** - * Initializes event. - * - * @param SpecificationIterator[] $specificationIterators - * @param TestResult $result - * @param Teardown $teardown - */ - public function __construct(array $specificationIterators, TestResult $result, Teardown $teardown) - { - $this->specificationIterators = $specificationIterators; - $this->result = $result; - $this->teardown = $teardown; - } - - /** - * Returns specification iterators. - * - * @return SpecificationIterator[] - */ - public function getSpecificationIterators() - { - return $this->specificationIterators; - } - - /** - * Returns exercise test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } - - /** - * Returns exercise teardown result. - * - * @return Teardown - */ - public function getTeardown() - { - return $this->teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseSetup.php deleted file mode 100644 index b77de06..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterExerciseSetup.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents an event in which exercise is prepared to be executed. - * - * @author Konstantin Kudryashov - */ -final class AfterExerciseSetup extends ExerciseCompleted implements AfterSetup -{ - /** - * @var SpecificationIterator[] - */ - private $specificationIterators; - /** - * @var Setup - */ - private $setup; - - /** - * Initializes event. - * - * @param SpecificationIterator[] $specificationIterators - * @param Setup $setup - */ - public function __construct(array $specificationIterators, Setup $setup) - { - $this->specificationIterators = $specificationIterators; - $this->setup = $setup; - } - - /** - * Returns specification iterators. - * - * @return SpecificationIterator[] - */ - public function getSpecificationIterators() - { - return $this->specificationIterators; - } - - /** - * Returns exercise setup result. - * - * @return Setup - */ - public function getSetup() - { - return $this->setup; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSetup.php deleted file mode 100644 index f820caf..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSetup.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents an event right after a test setup. - * - * @author Konstantin Kudryashov - */ -interface AfterSetup -{ - /** - * Returns current test setup. - * - * @return Setup - */ - public function getSetup(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteAborted.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteAborted.php deleted file mode 100644 index 97c8a7a..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteAborted.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Specification\NoSpecificationsIterator; - -/** - * Represents an event in which suite was aborted. - * - * @author Konstantin Kudryashov - */ -final class AfterSuiteAborted extends SuiteTested -{ - /** - * {@inheritdoc} - */ - public function getSpecificationIterator() - { - return new NoSpecificationsIterator($this->getSuite()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteSetup.php deleted file mode 100644 index 591e54b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteSetup.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents an event right after a suite setup. - * - * @author Konstantin Kudryashov - */ -final class AfterSuiteSetup extends SuiteTested implements AfterSetup -{ - /** - * @var SpecificationIterator - */ - private $iterator; - /** - * @var Setup - */ - private $setup; - - /** - * Initializes event. - * - * @param Environment $env - * @param SpecificationIterator $iterator - * @param Setup $setup - */ - public function __construct(Environment $env, SpecificationIterator $iterator, Setup $setup) - { - parent::__construct($env); - - $this->iterator = $iterator; - $this->setup = $setup; - } - - /** - * Returns specification iterator. - * - * @return SpecificationIterator - */ - public function getSpecificationIterator() - { - return $this->iterator; - } - - /** - * Returns current test setup. - * - * @return Setup - */ - public function getSetup() - { - return $this->setup; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteTested.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteTested.php deleted file mode 100644 index b68a4ec..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterSuiteTested.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents an event in which suite was tested. - * - * @author Konstantin Kudryashov - */ -final class AfterSuiteTested extends SuiteTested implements AfterTested -{ - /** - * @var SpecificationIterator - */ - private $iterator; - /** - * @var TestResult - */ - private $result; - /** - * @var Teardown - */ - private $teardown; - - /** - * Initializes event. - * - * @param Environment $env - * @param SpecificationIterator $iterator - * @param TestResult $result - * @param Teardown $teardown - */ - public function __construct( - Environment $env, - SpecificationIterator $iterator, - TestResult $result, - Teardown $teardown - ) { - parent::__construct($env); - - $this->iterator = $iterator; - $this->result = $result; - $this->teardown = $teardown; - } - - /** - * Returns specification iterator. - * - * @return SpecificationIterator - */ - public function getSpecificationIterator() - { - return $this->iterator; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } - - /** - * Returns current test teardown. - * - * @return Teardown - */ - public function getTeardown() - { - return $this->teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterTested.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterTested.php deleted file mode 100644 index 1bec416..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/AfterTested.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents an event right after a test was completed. - * - * @author Konstantin Kudryashov - */ -interface AfterTested -{ - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult(); - - /** - * Returns current test teardown. - * - * @return Teardown - */ - public function getTeardown(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeExerciseCompleted.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeExerciseCompleted.php deleted file mode 100644 index dc0a22c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeExerciseCompleted.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Specification\SpecificationIterator; - -/** - * Represents an event in which exercise is prepared to be executed. - * - * @author Konstantin Kudryashov - */ -final class BeforeExerciseCompleted extends ExerciseCompleted implements BeforeTested -{ - /** - * @var SpecificationIterator[] - */ - private $specificationIterators; - - /** - * Initializes event. - * - * @param SpecificationIterator[] $specificationIterators - */ - public function __construct(array $specificationIterators) - { - $this->specificationIterators = $specificationIterators; - } - - /** - * Returns specification iterators. - * - * @return SpecificationIterator[] - */ - public function getSpecificationIterators() - { - return $this->specificationIterators; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeExerciseTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeExerciseTeardown.php deleted file mode 100644 index 5892a08..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeExerciseTeardown.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an event right before exercise teardown. - * - * @author Konstantin Kudryashov - */ -final class BeforeExerciseTeardown extends ExerciseCompleted implements BeforeTeardown -{ - /** - * @var SpecificationIterator[] - */ - private $specificationIterators; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes event. - * - * @param SpecificationIterator[] $specificationIterators - * @param TestResult $result - */ - public function __construct(array $specificationIterators, TestResult $result) - { - $this->specificationIterators = $specificationIterators; - $this->result = $result; - } - - /** - * Returns specification iterators. - * - * @return SpecificationIterator[] - */ - public function getSpecificationIterators() - { - return $this->specificationIterators; - } - - /** - * Returns exercise test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeSuiteTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeSuiteTeardown.php deleted file mode 100644 index 3138217..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeSuiteTeardown.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an event right before suite teardown. - * - * @author Konstantin Kudryashov - */ -final class BeforeSuiteTeardown extends SuiteTested implements BeforeTeardown -{ - /** - * @var SpecificationIterator - */ - private $iterator; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes event. - * - * @param Environment $env - * @param SpecificationIterator $iterator - * @param TestResult $result - */ - public function __construct(Environment $env, SpecificationIterator $iterator, TestResult $result) - { - parent::__construct($env); - - $this->iterator = $iterator; - $this->result = $result; - } - - /** - * Returns specification iterator. - * - * @return SpecificationIterator - */ - public function getSpecificationIterator() - { - return $this->iterator; - } - - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeSuiteTested.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeSuiteTested.php deleted file mode 100644 index 819be30..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeSuiteTested.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Specification\SpecificationIterator; - -/** - * Represents an event in which suite is prepared to be tested. - * - * @author Konstantin Kudryashov - */ -final class BeforeSuiteTested extends SuiteTested implements BeforeTested -{ - /** - * @var SpecificationIterator - */ - private $iterator; - - /** - * Initializes event. - * - * @param Environment $env - * @param SpecificationIterator $iterator - */ - public function __construct(Environment $env, SpecificationIterator $iterator) - { - parent::__construct($env); - - $this->iterator = $iterator; - } - - /** - * Returns specification iterator. - * - * @return SpecificationIterator - */ - public function getSpecificationIterator() - { - return $this->iterator; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeTeardown.php deleted file mode 100644 index 66a82c6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeTeardown.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents an event right before a teardown. - * - * @author Konstantin Kudryashov - */ -interface BeforeTeardown -{ - /** - * Returns current test result. - * - * @return TestResult - */ - public function getTestResult(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeTested.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeTested.php deleted file mode 100644 index 27e9728..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/BeforeTested.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -/** - * Represents an event just before test setup is started. - * - * @author Konstantin Kudryashov - */ -interface BeforeTested -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/ExerciseCompleted.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/ExerciseCompleted.php deleted file mode 100644 index 4a88dfb..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/ExerciseCompleted.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Event\Event; -use Behat\Testwork\Specification\SpecificationIterator; - - -/** - * Represents an exercise event. - * - * @author Konstantin Kudryashov - */ -abstract class ExerciseCompleted extends Event -{ - public const BEFORE = 'tester.exercise_completed.before'; - public const AFTER_SETUP = 'tester.exercise_completed.after_setup'; - public const BEFORE_TEARDOWN = 'tester.exercise_completed.before_teardown'; - public const AFTER = 'tester.exercise_completed.after'; - - /** - * Returns specification iterators. - * - * @return SpecificationIterator[] - */ - abstract public function getSpecificationIterators(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/LifecycleEvent.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/LifecycleEvent.php deleted file mode 100644 index b2867f0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/LifecycleEvent.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Suite\Suite; - -/** - * Represents an event which holds references to current suite and environment. - * - * @author Konstantin Kudryashov - */ -abstract class LifecycleEvent extends Event -{ - /** - * @var Environment - */ - private $environment; - - /** - * Initializes scenario event. - * - * @param Environment $env - */ - public function __construct(Environment $env) - { - $this->environment = $env; - } - - /** - * Returns suite in which this event was fired. - * - * @return Suite - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * Returns environment in which this event was fired. - * - * @return Environment - */ - public function getEnvironment() - { - return $this->environment; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/SuiteTested.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/SuiteTested.php deleted file mode 100644 index de56d07..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Event/SuiteTested.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Event; - -use Behat\Testwork\Specification\SpecificationIterator; - -/** - * Represents a suite event. - * - * @author Konstantin Kudryashov - */ -abstract class SuiteTested extends LifecycleEvent -{ - public const BEFORE = 'tester.suite_tested.before'; - public const AFTER_SETUP = 'tester.suite_tested.after_setup'; - public const BEFORE_TEARDOWN = 'tester.suite_tested.before_teardown'; - public const AFTER = 'tester.suite_tested.after'; - - /** - * Returns specification iterator. - * - * @return SpecificationIterator - */ - abstract public function getSpecificationIterator(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/ServiceContainer/EventDispatcherExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/ServiceContainer/EventDispatcherExtension.php deleted file mode 100644 index 502740a..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/ServiceContainer/EventDispatcherExtension.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Tester\ServiceContainer\TesterExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides event dispatching service. - * - * @author Konstantin Kudryashov - */ -class EventDispatcherExtension implements Extension -{ - /* - * Available services - */ - public const DISPATCHER_ID = 'event_dispatcher'; - - /* - * Available extension points - */ - public const SUBSCRIBER_TAG = 'event_dispatcher.subscriber'; - - /** - * @var ServiceProcessor - */ - protected $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'events'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadSigintController($container); - $this->loadEventDispatcher($container); - $this->loadEventDispatchingExercise($container); - $this->loadEventDispatchingSuiteTester($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processSubscribers($container); - } - - /** - * Loads sigint controller - * - * @param ContainerBuilder $container - */ - protected function loadSigintController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\EventDispatcher\Cli\SigintController', array( - new Reference(EventDispatcherExtension::DISPATCHER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 9999)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.sigint', $definition); - } - - /** - * Loads event dispatcher. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatcher(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\EventDispatcher\TestworkEventDispatcher'); - $container->setDefinition(self::DISPATCHER_ID, $definition); - } - - /** - * Loads event-dispatching exercise. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingExercise(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\EventDispatcher\Tester\EventDispatchingExercise', array( - new Reference(TesterExtension::EXERCISE_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::EXERCISE_WRAPPER_TAG); - $container->setDefinition(TesterExtension::EXERCISE_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Loads event-dispatching suite tester. - * - * @param ContainerBuilder $container - */ - protected function loadEventDispatchingSuiteTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\EventDispatcher\Tester\EventDispatchingSuiteTester', array( - new Reference(TesterExtension::SUITE_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::SUITE_TESTER_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::SUITE_TESTER_WRAPPER_TAG . '.event_dispatching', $definition); - } - - /** - * Registers all available event subscribers. - * - * @param ContainerBuilder $container - */ - protected function processSubscribers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::SUBSCRIBER_TAG); - $definition = $container->getDefinition(self::DISPATCHER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('addSubscriber', array($reference)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php deleted file mode 100644 index 9c31976..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingExercise.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Tester; - -use Behat\Testwork\EventDispatcher\Event\AfterExerciseCompleted; -use Behat\Testwork\EventDispatcher\Event\AfterExerciseSetup; -use Behat\Testwork\EventDispatcher\Event\BeforeExerciseCompleted; -use Behat\Testwork\EventDispatcher\Event\BeforeExerciseTeardown; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Behat\Testwork\Tester\Exercise; -use Behat\Testwork\Tester\Result\TestResult; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Exercise dispatching BEFORE/AFTER events during its execution. - * - * @author Konstantin Kudryashov - */ -final class EventDispatchingExercise implements Exercise -{ - /** - * @var Exercise - */ - private $baseExercise; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * Initializes exercise. - * - * @param Exercise $baseExercise - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(Exercise $baseExercise, EventDispatcherInterface $eventDispatcher) - { - $this->baseExercise = $baseExercise; - $this->eventDispatcher = $eventDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(array $iterators, $skip) - { - $event = new BeforeExerciseCompleted($iterators); - - $this->eventDispatcher->dispatch($event, $event::BEFORE); - - $setup = $this->baseExercise->setUp($iterators, $skip); - - $event = new AfterExerciseSetup($iterators, $setup); - - $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP); - - return $setup; - } - - /** - * {@inheritdoc} - */ - public function test(array $iterators, $skip = false) - { - return $this->baseExercise->test($iterators, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(array $iterators, $skip, TestResult $result) - { - $event = new BeforeExerciseTeardown($iterators, $result); - - $this->eventDispatcher->dispatch($event, $event::BEFORE_TEARDOWN); - - $teardown = $this->baseExercise->tearDown($iterators, $skip, $result); - - $event = new AfterExerciseCompleted($iterators, $result, $teardown); - - $this->eventDispatcher->dispatch($event, $event::AFTER); - - return $teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php deleted file mode 100644 index acfef27..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Tester/EventDispatchingSuiteTester.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher\Tester; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\EventDispatcher\Event\AfterSuiteSetup; -use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested; -use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTeardown; -use Behat\Testwork\EventDispatcher\Event\BeforeSuiteTested; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\SuiteTester; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Suite tester dispatching BEFORE/AFTER events during testing. - * - * @author Konstantin Kudryashov - */ -final class EventDispatchingSuiteTester implements SuiteTester -{ - /** - * @var SuiteTester - */ - private $baseTester; - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - /** - * Initializes tester. - * - * @param SuiteTester $baseTester - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(SuiteTester $baseTester, EventDispatcherInterface $eventDispatcher) - { - $this->baseTester = $baseTester; - $this->eventDispatcher = $eventDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, SpecificationIterator $iterator, $skip) - { - $event = new BeforeSuiteTested($env, $iterator); - - $this->eventDispatcher->dispatch($event, $event::BEFORE); - - $setup = $this->baseTester->setUp($env, $iterator, $skip); - - $event = new AfterSuiteSetup($env, $iterator, $setup); - - $this->eventDispatcher->dispatch($event, $event::AFTER_SETUP); - - return $setup; - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, SpecificationIterator $iterator, $skip = false) - { - return $this->baseTester->test($env, $iterator, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result) - { - $event = new BeforeSuiteTeardown($env, $iterator, $result); - $this->eventDispatcher->dispatch( $event, $event::BEFORE_TEARDOWN); - - $teardown = $this->baseTester->tearDown($env, $iterator, $skip, $result); - - $event = new AfterSuiteTested($env, $iterator, $result, $teardown); - - $this->eventDispatcher->dispatch( $event, $event::AFTER); - - return $teardown; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php deleted file mode 100644 index cf96c5d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/EventDispatcher/TestworkEventDispatcher.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\EventDispatcher; - -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Contracts\EventDispatcher\Event; - -/** - * Extends Symfony2 event dispatcher with catch-all listeners. - * - * @author Konstantin Kudryashov - */ -final class TestworkEventDispatcher extends EventDispatcher -{ - public const BEFORE_ALL_EVENTS = '*~'; - public const AFTER_ALL_EVENTS = '~*'; - public const DISPATCHER_VERSION = 2; - - /** - * {@inheritdoc} - * - * @param string|null $eventName - */ - public function getListeners($eventName = null): array - { - if (null === $eventName || self::BEFORE_ALL_EVENTS === $eventName) { - return parent::getListeners($eventName); - } - - return array_merge( - parent::getListeners(self::BEFORE_ALL_EVENTS), - parent::getListeners($eventName), - parent::getListeners(self::AFTER_ALL_EVENTS) - ); - } - - public function dispatch($event, $eventName = null): object - { - if (is_object($event)) { - return $this->bcAwareDispatch($event, $eventName); - } - - return $this->bcAwareDispatch($eventName, $event); - } - - private function bcAwareDispatch(object $event, $eventName) - { - if (null === $event) { - $event = new Event(); - } - - if (method_exists($event, 'setName')) { - $event->setName($eventName); - } - - return parent::dispatch($event, $eventName); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Cli/VerbosityController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Cli/VerbosityController.php deleted file mode 100644 index bc86fb5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Cli/VerbosityController.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Exception\Cli; - -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\Exception\ExceptionPresenter; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Controls exception default verbosity level. - * - * @author Konstantin Kudryashov - */ -final class VerbosityController implements Controller -{ - /** - * @var ExceptionPresenter - */ - private $exceptionPresenter; - - /** - * Initializes controller. - * - * @param ExceptionPresenter $exceptionPresenter - */ - public function __construct(ExceptionPresenter $exceptionPresenter) - { - $this->exceptionPresenter = $exceptionPresenter; - } - - /** - * Configures command to be executable by the controller. - * - * @param Command $command - */ - public function configure(Command $command) - { - } - - /** - * Executes controller. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return null|integer - */ - public function execute(InputInterface $input, OutputInterface $output) - { - if ($output->getVerbosity() !== OutputInterface::VERBOSITY_NORMAL) { - $this->exceptionPresenter->setDefaultVerbosity($output->getVerbosity()); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/ExceptionPresenter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/ExceptionPresenter.php deleted file mode 100644 index 9ad0d14..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/ExceptionPresenter.php +++ /dev/null @@ -1,151 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Exception; - -use Behat\Testwork\Exception\Stringer\ExceptionStringer; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Exception; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Presents exceptions as strings using registered stringers. - * - * @author Konstantin Kudryashov - */ -final class ExceptionPresenter -{ - /** - * @var string - */ - private $basePath; - - /** - * @var ExceptionStringer[] - */ - private $stringers = array(); - /** - * @var integer - */ - private $defaultVerbosity = OutputPrinter::VERBOSITY_NORMAL; - - /** - * Initializes presenter. - * - * @param string $basePath - * @param integer $defaultVerbosity - */ - public function __construct($basePath = null, $defaultVerbosity = OutputPrinter::VERBOSITY_NORMAL) - { - if (null !== $basePath) { - $realBasePath = realpath($basePath); - - if ($realBasePath) { - $basePath = $realBasePath; - } - } - - $this->basePath = $basePath; - $this->defaultVerbosity = $defaultVerbosity; - } - - /** - * Registers exception stringer. - * - * @param ExceptionStringer $stringer - */ - public function registerExceptionStringer(ExceptionStringer $stringer) - { - $this->stringers[] = $stringer; - } - - /** - * Sets default verbosity to a specified level. - * - * @param integer $defaultVerbosity - */ - public function setDefaultVerbosity($defaultVerbosity) - { - $this->defaultVerbosity = $defaultVerbosity; - } - - /** - * Presents exception as a string. - * - * @param Exception $exception - * @param integer $verbosity - * - * @return string - */ - public function presentException(Exception $exception, $verbosity = null) - { - $verbosity = $verbosity ?: $this->defaultVerbosity; - - foreach ($this->stringers as $stringer) { - if ($stringer->supportsException($exception)) { - return $this->relativizePaths($stringer->stringException($exception, $verbosity)); - } - } - - if (OutputInterface::VERBOSITY_VERY_VERBOSE <= $verbosity) { - if (OutputInterface::VERBOSITY_DEBUG > $verbosity) { - $exception = $this->removeBehatCallsFromTrace($exception); - } - - return $this->relativizePaths(trim($exception)); - } - - return trim($this->relativizePaths($exception->getMessage()) . ' (' . get_class($exception) . ')'); - } - - private function removeBehatCallsFromTrace(Exception $exception) - { - $traceOutput = ''; - foreach ($exception->getTrace() as $i => $trace) { - if (isset($trace['file']) && false !== strpos(str_replace('\\', '/', $trace['file']), 'Behat/Testwork/Call/Handler/RuntimeCallHandler')) { - break; - } - - $traceOutput .= sprintf( - '#%d %s: %s()'.PHP_EOL, - $i, - isset($trace['file']) ? $trace['file'].'('.$trace['line'].')' : '[internal function]', - isset($trace['class']) ? $trace['class'].$trace['type'].$trace['function'] : $trace['function'] - ); - } - - return sprintf( - "%s: %s in %s:%d%sStack trace:%s%s", - get_class($exception), - $exception->getMessage(), - $exception->getFile(), - $exception->getLine(), - PHP_EOL, - PHP_EOL, - $traceOutput - ); - } - - /** - * Relativizes absolute paths in the text. - * - * @param string $text - * - * @return string - */ - private function relativizePaths($text) - { - if (!$this->basePath) { - return $text; - } - - return str_replace($this->basePath . DIRECTORY_SEPARATOR, '', $text); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/ServiceContainer/ExceptionExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/ServiceContainer/ExceptionExtension.php deleted file mode 100644 index 92ae6af..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/ServiceContainer/ExceptionExtension.php +++ /dev/null @@ -1,169 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Exception\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\Output\Printer\OutputPrinter; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides exception handling services. - * - * @author Konstantin Kudryashov - */ -final class ExceptionExtension implements Extension -{ - /* - * Available services - */ - public const PRESENTER_ID = 'exception.presenter'; - - /* - * Available extension points - */ - public const STRINGER_TAG = 'exception.stringer'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'exceptions'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - $builder - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('verbosity') - ->info('Output verbosity') - ->example(sprintf('%d, %d, %d, %d', - OutputPrinter::VERBOSITY_NORMAL, - OutputPrinter::VERBOSITY_VERBOSE, - OutputPrinter::VERBOSITY_VERY_VERBOSE, - OutputPrinter::VERBOSITY_DEBUG - )) - ->defaultValue(OutputPrinter::VERBOSITY_NORMAL) - ->end() - ->end() - ; - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadPresenter($container, $config['verbosity']); - $this->loadDefaultStringers($container); - $this->loadVerbosityController($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processStringers($container); - } - - /** - * Loads exception presenter. - * - * @param ContainerBuilder $container - * @param integer $verbosity - */ - protected function loadPresenter(ContainerBuilder $container, $verbosity) - { - $definition = new Definition('Behat\Testwork\Exception\ExceptionPresenter', array( - '%paths.base%', - $verbosity - )); - $container->setDefinition(self::PRESENTER_ID, $definition); - } - - /** - * Loads default stringer. - * - * @param ContainerBuilder $container - */ - protected function loadDefaultStringers(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Exception\Stringer\PHPUnitExceptionStringer'); - $definition->addTag(self::STRINGER_TAG, array('priority' => 50)); - $container->setDefinition(self::STRINGER_TAG . '.phpunit', $definition); - - $definition = new Definition('Behat\Testwork\Exception\Stringer\TestworkExceptionStringer'); - $definition->addTag(self::STRINGER_TAG, array('priority' => 50)); - $container->setDefinition(self::STRINGER_TAG . '.testwork', $definition); - } - - /** - * Processes all available exception stringers. - * - * @param ContainerBuilder $container - */ - protected function processStringers(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::STRINGER_TAG); - $definition = $container->getDefinition(self::PRESENTER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerExceptionStringer', array($reference)); - } - } - - /** - * Loads verbosity controller. - * - * @param ContainerBuilder $container - */ - protected function loadVerbosityController($container) - { - $definition = new Definition('Behat\Testwork\Exception\Cli\VerbosityController', array( - new Reference(self::PRESENTER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 9999)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.exception_verbosity', $definition); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php deleted file mode 100644 index 5f8de15..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/ExceptionStringer.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Exception\Stringer; - -use Behat\Testwork\Exception\ExceptionPresenter; -use Exception; - -/** - * Finds a best way to present as a string particular. - * - * @see ExceptionPresenter - * - * @author Konstantin Kudryashov - */ -interface ExceptionStringer -{ - /** - * Checks if stringer supports provided exception. - * - * @param Exception $exception - * - * @return bool - */ - public function supportsException(Exception $exception); - - /** - * Strings provided exception. - * - * @param Exception $exception - * @param integer $verbosity - * - * @return string - */ - public function stringException(Exception $exception, $verbosity); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/PHPUnitExceptionStringer.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/PHPUnitExceptionStringer.php deleted file mode 100644 index 17343f1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/PHPUnitExceptionStringer.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Exception\Stringer; - -use Exception; - -/** - * Strings PHPUnit assertion exceptions. - * - * @see ExceptionPresenter - * - * @author Konstantin Kudryashov - */ -final class PHPUnitExceptionStringer implements ExceptionStringer -{ - /** - * {@inheritdoc} - */ - public function supportsException(Exception $exception) - { - return $exception instanceof \PHPUnit_Framework_Exception - || $exception instanceof \PHPUnit\Framework\Exception; - } - - /** - * {@inheritdoc} - */ - public function stringException(Exception $exception, $verbosity) - { - if (class_exists('PHPUnit\\Util\\ThrowableToStringMapper')) { - return trim(\PHPUnit\Util\ThrowableToStringMapper::map($exception)); - } - - if (!class_exists('PHPUnit\\Framework\\TestFailure')) { - return trim(\PHPUnit_Framework_TestFailure::exceptionToString($exception)); - } - - // PHPUnit assertion exceptions do not include expected / observed info in their - // messages, but expect the test listeners to format that info like the following - // (see e.g. PHPUnit_TextUI_ResultPrinter::printDefectTrace) - return trim(\PHPUnit\Framework\TestFailure::exceptionToString($exception)); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/TestworkExceptionStringer.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/TestworkExceptionStringer.php deleted file mode 100644 index 5a5e599..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/Stringer/TestworkExceptionStringer.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Exception\Stringer; - -use Behat\Testwork\Call\Exception\CallErrorException; -use Behat\Testwork\Exception\TestworkException; -use Exception; - -/** - * Strings Testwork exceptions. - * - * @author Konstantin Kudryashov - */ -final class TestworkExceptionStringer implements ExceptionStringer -{ - /** - * {@inheritdoc} - */ - public function supportsException(Exception $exception) - { - return $exception instanceof TestworkException || $exception instanceof CallErrorException; - } - - /** - * {@inheritdoc} - */ - public function stringException(Exception $exception, $verbosity) - { - return trim($exception->getMessage()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/TestworkException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/TestworkException.php deleted file mode 100644 index a140b00..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Exception/TestworkException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Exception; - -/** - * All testwork exceptions implement this interface. - * - * @author Konstantin Kudryashov - */ -interface TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/ConsoleFilesystemLogger.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/ConsoleFilesystemLogger.php deleted file mode 100644 index d08c498..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/ConsoleFilesystemLogger.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Filesystem; - -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Logs filesystem operations to the console. - * - * @author Konstantin Kudryashov - */ -final class ConsoleFilesystemLogger implements FilesystemLogger -{ - /** - * @var string - */ - private $basePath; - /** - * @var OutputInterface - */ - private $output; - - /** - * Initializes logger. - * - * @param string $basePath - * @param OutputInterface $output - */ - public function __construct($basePath, OutputInterface $output) - { - $this->basePath = $basePath; - $this->output = $output; - } - - /** - * {@inheritdoc} - */ - public function directoryCreated($path, $reason) - { - $this->output->writeln( - sprintf( - '+d %s - %s', - str_replace($this->basePath . DIRECTORY_SEPARATOR, '', realpath($path)), - $reason - ) - ); - } - - /** - * {@inheritdoc} - */ - public function fileCreated($path, $reason) - { - $this->output->writeln( - sprintf( - '+f %s - %s', - str_replace($this->basePath . DIRECTORY_SEPARATOR, '', realpath($path)), - $reason - ) - ); - } - - /** - * {@inheritdoc} - */ - public function fileUpdated($path, $reason) - { - $this->output->writeln( - sprintf( - 'u %s - %s', - str_replace($this->basePath . DIRECTORY_SEPARATOR, '', realpath($path)), - $reason - ) - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/FilesystemLogger.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/FilesystemLogger.php deleted file mode 100644 index 77f0a75..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/FilesystemLogger.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Filesystem; - -/** - * Logs filesystem operations. - * - * @author Konstantin Kudryashov - */ -interface FilesystemLogger -{ - /** - * Logs directory creation. - * - * @param string $path - * @param string $reason - */ - public function directoryCreated($path, $reason); - - /** - * Logs file creation. - * - * @param string $path - * @param string $reason - */ - public function fileCreated($path, $reason); - - /** - * Logs file update. - * - * @param string $path - * @param string $reason - */ - public function fileUpdated($path, $reason); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/ServiceContainer/FilesystemExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/ServiceContainer/FilesystemExtension.php deleted file mode 100644 index 0d668ff..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Filesystem/ServiceContainer/FilesystemExtension.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Filesystem\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides filesystem services for testwork. - * - * @author Konstantin Kudryashov - */ -final class FilesystemExtension implements Extension -{ - /* - * Available services - */ - public const LOGGER_ID = 'filesystem.logger'; - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'filesystem'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadFilesystemLogger($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - } - - /** - * Loads filesystem logger. - * - * @param ContainerBuilder $container - */ - protected function loadFilesystemLogger(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Filesystem\ConsoleFilesystemLogger', array( - '%paths.base%', - new Reference(CliExtension::OUTPUT_ID) - )); - $container->setDefinition(self::LOGGER_ID, $definition); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/AfterSuite.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/AfterSuite.php deleted file mode 100644 index 0154d59..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/AfterSuite.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Call; - -use Behat\Testwork\Hook\Scope\SuiteScope; - -/** - * Represents AfterSuite hook. - * - * @author Konstantin Kudryashov - */ -final class AfterSuite extends RuntimeSuiteHook -{ - /** - * Initializes hook. - * - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($filterString, $callable, $description = null) - { - parent::__construct(SuiteScope::AFTER, $filterString, $callable, $description); - } - - /** - * Returns hook name. - * - * @return string - */ - public function getName() - { - return 'AfterSuite'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/BeforeSuite.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/BeforeSuite.php deleted file mode 100644 index e06fb44..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/BeforeSuite.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Call; - -use Behat\Testwork\Hook\Scope\SuiteScope; - -/** - * Represents BeforeSuite hook. - * - * @author Konstantin Kudryashov - */ -final class BeforeSuite extends RuntimeSuiteHook -{ - /** - * Initializes hook. - * - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($filterString, $callable, $description = null) - { - parent::__construct(SuiteScope::BEFORE, $filterString, $callable, $description); - } - - /** - * Returns hook name. - * - * @return string - */ - public function getName() - { - return 'BeforeSuite'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/HookCall.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/HookCall.php deleted file mode 100644 index 38b7a0d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/HookCall.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Call; - -use Behat\Testwork\Environment\Call\EnvironmentCall; -use Behat\Testwork\Hook\Hook; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents a hook call. - * - * @author Konstantin Kudryashov - */ -final class HookCall extends EnvironmentCall -{ - /** - * @var HookScope - */ - private $scope; - - /** - * Initializes hook call. - * - * @param HookScope $scope - * @param Hook $hook - * @param null|integer $errorReportingLevel - */ - public function __construct(HookScope $scope, Hook $hook, $errorReportingLevel = null) - { - parent::__construct($scope->getEnvironment(), $hook, array($scope), $errorReportingLevel); - - $this->scope = $scope; - } - - /** - * Returns hook scope. - * - * @return HookScope - */ - public function getScope() - { - return $this->scope; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeFilterableHook.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeFilterableHook.php deleted file mode 100644 index a8d392c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeFilterableHook.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Call; - -use Behat\Testwork\Hook\FilterableHook; - -/** - * Represents runtime hook, filterable by filter string. - * - * @author Konstantin Kudryashov - */ -abstract class RuntimeFilterableHook extends RuntimeHook implements FilterableHook -{ - /** - * @var null|string - */ - private $filterString; - - /** - * Initializes hook. - * - * @param string $scopeName - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - */ - public function __construct($scopeName, $filterString, $callable, $description = null) - { - $this->filterString = $filterString; - - parent::__construct($scopeName, $callable, $description); - } - - /** - * Returns hook filter string (if has one). - * - * @return null|string - */ - public function getFilterString() - { - return $this->filterString; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return trim($this->getName() . ' ' . $this->getFilterString()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeHook.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeHook.php deleted file mode 100644 index 5242fa8..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeHook.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Call; - -use Behat\Testwork\Call\RuntimeCallee; -use Behat\Testwork\Hook\Hook; - -/** - * Represents a hook executed during the execution runtime. - * - * @author Konstantin Kudryashov - */ -abstract class RuntimeHook extends RuntimeCallee implements Hook -{ - /** - * @var string - */ - private $scopeName; - - /** - * Initializes hook. - * - * @param string $scopeName - * @param callable $callable - * @param null|string $description - */ - public function __construct($scopeName, $callable, $description = null) - { - $this->scopeName = $scopeName; - - parent::__construct($callable, $description); - } - - /** - * {@inheritdoc} - */ - public function getScopeName() - { - return $this->scopeName; - } - - /** - * {@inheritdoc} - */ - public function __toString() - { - return $this->getName(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php deleted file mode 100644 index 44b7f65..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Call/RuntimeSuiteHook.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Call; - -use Behat\Testwork\Call\Exception\BadCallbackException; -use Behat\Testwork\Hook\Scope\HookScope; -use Behat\Testwork\Hook\Scope\SuiteScope; -use Behat\Testwork\Suite\Suite; - -/** - * Represents suite hook executed in the runtime. - * - * @author Konstantin Kudryashov - */ -abstract class RuntimeSuiteHook extends RuntimeFilterableHook -{ - /** - * Initializes hook. - * - * @param string $scopeName - * @param null|string $filterString - * @param callable $callable - * @param null|string $description - * - * @throws BadCallbackException If callback is method, but not a static one - */ - public function __construct($scopeName, $filterString, $callable, $description = null) - { - parent::__construct($scopeName, $filterString, $callable, $description); - - if ($this->isAnInstanceMethod()) { - throw new BadCallbackException(sprintf( - 'Suite hook callback: %s::%s() must be a static method', - $callable[0], - $callable[1] - ), $callable); - } - } - - /** - * {@inheritdoc} - */ - public function filterMatches(HookScope $scope) - { - if (!$scope instanceof SuiteScope) { - return false; - } - if (null === ($filterString = $this->getFilterString())) { - return true; - } - - if (!empty($filterString)) { - return $this->isSuiteMatch($scope->getSuite(), $filterString); - } - - return false; - } - - /** - * Checks if Feature matches specified filter. - * - * @param Suite $suite - * @param string $filterString - * - * @return bool - */ - private function isSuiteMatch(Suite $suite, $filterString) - { - if ('/' === $filterString[0]) { - return 1 === preg_match($filterString, $suite->getName()); - } - - return false !== mb_strpos($suite->getName(), $filterString, 0, 'utf8'); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/FilterableHook.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/FilterableHook.php deleted file mode 100644 index a241ff8..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/FilterableHook.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook; - -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Represents hook that is filterable by the provided scope. - * - * @author Konstantin Kudryashov - */ -interface FilterableHook extends Hook -{ - /** - * Checks that current hook matches provided hook scope. - * - * @param HookScope $scope - * - * @return bool - */ - public function filterMatches(HookScope $scope); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Hook.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Hook.php deleted file mode 100644 index 19719ec..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Hook.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook; - -use Behat\Testwork\Call\Callee; - -/** - * Represents a Testwork hook. - * - * @author Konstantin Kudryashov - */ -interface Hook extends Callee -{ - /** - * Returns hook name. - * - * @return string - */ - public function getName(); - - /** - * Returns hook scope name. - * - * @return string - */ - public function getScopeName(); - - /** - * Represents hook as a string. - * - * @return string - */ - public function __toString(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php deleted file mode 100644 index 0dd7508..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/HookDispatcher.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook; - -use Behat\Testwork\Call\CallCenter; -use Behat\Testwork\Call\CallResult; -use Behat\Testwork\Call\CallResults; -use Behat\Testwork\Hook\Call\HookCall; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Dispatches registered hooks for provided events. - * - * @author Konstantin Kudryashov - */ -final class HookDispatcher -{ - /** - * @var HookRepository - */ - private $repository; - /** - * @var CallCenter - */ - private $callCenter; - - /** - * Initializes hook dispatcher. - * - * @param HookRepository $repository - * @param CallCenter $callCenter - */ - public function __construct(HookRepository $repository, CallCenter $callCenter) - { - $this->repository = $repository; - $this->callCenter = $callCenter; - } - - /** - * Dispatches hooks for a specified event. - * - * @param HookScope $scope - * - * @return CallResults - */ - public function dispatchScopeHooks(HookScope $scope) - { - $results = array(); - foreach ($this->repository->getScopeHooks($scope) as $hook) { - $results[] = $this->dispatchHook($scope, $hook); - } - - return new CallResults($results); - } - - /** - * Dispatches single event hook. - * - * @param HookScope $scope - * @param Hook $hook - * - * @return CallResult - */ - private function dispatchHook(HookScope $scope, Hook $hook) - { - return $this->callCenter->makeCall(new HookCall($scope, $hook)); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/HookRepository.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/HookRepository.php deleted file mode 100644 index 527a11a..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/HookRepository.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook; - -use Behat\Testwork\Call\Callee; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Environment\EnvironmentManager; -use Behat\Testwork\Hook\Scope\HookScope; - -/** - * Finds hooks using provided environments or scopes. - * - * @author Konstantin Kudryashov - */ -final class HookRepository -{ - /** - * @var EnvironmentManager - */ - private $environmentManager; - - /** - * Initializes repository. - * - * @param EnvironmentManager $environmentManager - */ - public function __construct(EnvironmentManager $environmentManager) - { - $this->environmentManager = $environmentManager; - } - - /** - * Returns all available hooks for a specific environment. - * - * @param Environment $environment - * - * @return Hook[] - */ - public function getEnvironmentHooks(Environment $environment) - { - return array_filter( - $this->environmentManager->readEnvironmentCallees($environment), - function (Callee $callee) { - return $callee instanceof Hook; - } - ); - } - - /** - * Returns hooks for a specific event. - * - * @param HookScope $scope - * - * @return Hook[] - */ - public function getScopeHooks(HookScope $scope) - { - return array_filter( - $this->getEnvironmentHooks($scope->getEnvironment()), - function (Hook $hook) use ($scope) { - if ($scope->getName() !== $hook->getScopeName()) { - return false; - } - - return !($hook instanceof FilterableHook && !$hook->filterMatches($scope)); - } - ); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/AfterSuiteScope.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/AfterSuiteScope.php deleted file mode 100644 index 59b07c7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/AfterSuiteScope.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Scope; - -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents a scope for AfterSuite hook. - * - * @author Konstantin Kudryashov - */ -final class AfterSuiteScope implements SuiteScope, AfterTestScope -{ - /** - * @var Environment - */ - private $environment; - /** - * @var SpecificationIterator - */ - private $iterator; - /** - * @var TestResult - */ - private $result; - - /** - * Initializes scope. - * - * @param Environment $environment - * @param SpecificationIterator $iterator - * @param TestResult $result - */ - public function __construct(Environment $environment, SpecificationIterator $iterator, TestResult $result) - { - $this->environment = $environment; - $this->iterator = $iterator; - $this->result = $result; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return self::AFTER; - } - - /** - * {@inheritdoc} - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * {@inheritdoc} - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * {@inheritdoc} - */ - public function getSpecificationIterator() - { - return $this->iterator; - } - - /** - * {@inheritdoc} - */ - public function getTestResult() - { - return $this->result; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/AfterTestScope.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/AfterTestScope.php deleted file mode 100644 index 30c5fd5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/AfterTestScope.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Scope; - -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Represents a hook scope for After* hooks. - * - * @author Konstantin Kudryashov - */ -interface AfterTestScope extends HookScope -{ - /** - * Returns test result. - * - * @return TestResult - */ - public function getTestResult(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/BeforeSuiteScope.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/BeforeSuiteScope.php deleted file mode 100644 index 5c982cb..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/BeforeSuiteScope.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Scope; - -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Environment\Environment; - -/** - * Represents a scope for BeforeSuite hook. - * - * @author Konstantin Kudryashov - */ -final class BeforeSuiteScope implements SuiteScope -{ - /** - * @var Environment - */ - private $environment; - /** - * @var SpecificationIterator - */ - private $iterator; - - /** - * Initializes scope. - * - * @param Environment $env - * @param SpecificationIterator $iterator - */ - public function __construct(Environment $env, SpecificationIterator $iterator) - { - $this->environment = $env; - $this->iterator = $iterator; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return self::BEFORE; - } - - /** - * {@inheritdoc} - */ - public function getSuite() - { - return $this->environment->getSuite(); - } - - /** - * {@inheritdoc} - */ - public function getEnvironment() - { - return $this->environment; - } - - /** - * {@inheritdoc} - */ - public function getSpecificationIterator() - { - return $this->iterator; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/HookScope.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/HookScope.php deleted file mode 100644 index d7014fd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/HookScope.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Scope; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Hook\HookDispatcher; -use Behat\Testwork\Hook\HookRepository; -use Behat\Testwork\Suite\Suite; - -/** - * Represents an object used to find appropriate hooks. - * - * @see HookDispatcher - * @see HookRepository - * - * @author Konstantin Kudryashov - */ -interface HookScope -{ - /** - * Returns hook scope name. - * - * @return string - */ - public function getName(); - - /** - * Returns hook suite. - * - * @return Suite - */ - public function getSuite(); - - /** - * Returns hook environment. - * - * @return Environment - */ - public function getEnvironment(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/SuiteScope.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/SuiteScope.php deleted file mode 100644 index 659a8f6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Scope/SuiteScope.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Scope; - -use Behat\Testwork\Specification\SpecificationIterator; - -/** - * Represents a suite hook. - * - * @author Konstantin Kudryashov - */ -interface SuiteScope extends HookScope -{ - public const BEFORE = 'suite.before'; - public const AFTER = 'suite.after'; - - /** - * Returns specification iterator. - * - * @return SpecificationIterator - */ - public function getSpecificationIterator(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/ServiceContainer/HookExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/ServiceContainer/HookExtension.php deleted file mode 100644 index 9697c98..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/ServiceContainer/HookExtension.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\ServiceContainer; - -use Behat\Behat\Tester\ServiceContainer\TesterExtension; -use Behat\Testwork\Call\ServiceContainer\CallExtension; -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides test hooking services for testwork. - * - * @author Konstantin Kudryashov - */ -class HookExtension implements Extension -{ - /* - * Available services - */ - public const DISPATCHER_ID = 'hook.dispatcher'; - public const REPOSITORY_ID = 'hook.repository'; - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'hooks'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadDispatcher($container); - $this->loadRepository($container); - $this->loadHookableTesters($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - } - - /** - * Loads hook dispatcher. - * - * @param ContainerBuilder $container - */ - protected function loadDispatcher(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Hook\HookDispatcher', array( - new Reference(self::REPOSITORY_ID), - new Reference(CallExtension::CALL_CENTER_ID) - )); - $container->setDefinition(self::DISPATCHER_ID, $definition); - } - - /** - * Loads hook repository. - * - * @param ContainerBuilder $container - */ - protected function loadRepository(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Hook\HookRepository', array( - new Reference(EnvironmentExtension::MANAGER_ID) - )); - $container->setDefinition(self::REPOSITORY_ID, $definition); - } - - /** - * Loads hookable testers. - * - * @param ContainerBuilder $container - */ - protected function loadHookableTesters(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Hook\Tester\HookableSuiteTester', array( - new Reference(TesterExtension::SUITE_TESTER_ID), - new Reference(self::DISPATCHER_ID) - )); - $definition->addTag(TesterExtension::SUITE_TESTER_WRAPPER_TAG, array('priority' => 9999)); - $container->setDefinition(TesterExtension::SUITE_TESTER_WRAPPER_TAG . '.hookable', $definition); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php deleted file mode 100644 index 1277e82..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/HookableSuiteTester.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Tester; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Hook\HookDispatcher; -use Behat\Testwork\Hook\Scope\AfterSuiteScope; -use Behat\Testwork\Hook\Scope\BeforeSuiteScope; -use Behat\Testwork\Hook\Tester\Setup\HookedSetup; -use Behat\Testwork\Hook\Tester\Setup\HookedTeardown; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\SuiteTester; - -/** - * Suite tester which dispatches hooks during its execution. - * - * @author Konstantin Kudryashov - */ -final class HookableSuiteTester implements SuiteTester -{ - /** - * @var SuiteTester - */ - private $baseTester; - /** - * @var HookDispatcher - */ - private $hookDispatcher; - - /** - * Initializes tester. - * - * @param SuiteTester $baseTester - * @param HookDispatcher $hookDispatcher - */ - public function __construct(SuiteTester $baseTester, HookDispatcher $hookDispatcher) - { - $this->baseTester = $baseTester; - $this->hookDispatcher = $hookDispatcher; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, SpecificationIterator $iterator, $skip) - { - $setup = $this->baseTester->setUp($env, $iterator, $skip); - - if ($skip) { - return $setup; - } - - $scope = new BeforeSuiteScope($env, $iterator); - $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope); - - return new HookedSetup($setup, $hookCallResults); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, SpecificationIterator $iterator, $skip) - { - return $this->baseTester->test($env, $iterator, $skip); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result) - { - $teardown = $this->baseTester->tearDown($env, $iterator, $skip, $result); - - if ($skip) { - return $teardown; - } - - $scope = new AfterSuiteScope($env, $iterator, $result); - $hookCallResults = $this->hookDispatcher->dispatchScopeHooks($scope); - - return new HookedTeardown($teardown, $hookCallResults); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedSetup.php deleted file mode 100644 index 3ba4478..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedSetup.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Tester\Setup; - -use Behat\Testwork\Call\CallResults; -use Behat\Testwork\Tester\Setup\Setup; - -/** - * Represents hooked test setup. - * - * @author Konstantin Kudryashov - */ -final class HookedSetup implements Setup -{ - /** - * @var Setup - */ - private $setup; - /** - * @var CallResults - */ - private $hookCallResults; - - /** - * Initializes setup. - * - * @param Setup $setup - * @param CallResults $hookCallResults - */ - public function __construct(Setup $setup, CallResults $hookCallResults) - { - $this->setup = $setup; - $this->hookCallResults = $hookCallResults; - } - - /** - * {@inheritdoc} - */ - public function isSuccessful() - { - if ($this->hookCallResults->hasExceptions()) { - return false; - } - - return $this->setup->isSuccessful(); - } - - /** - * {@inheritdoc} - */ - public function hasOutput() - { - return $this->hookCallResults->hasStdOuts() || $this->hookCallResults->hasExceptions(); - } - - /** - * Returns hook call results. - * - * @return CallResults - */ - public function getHookCallResults() - { - return $this->hookCallResults; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedTeardown.php deleted file mode 100644 index 5400be9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Hook/Tester/Setup/HookedTeardown.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Hook\Tester\Setup; - -use Behat\Testwork\Call\CallResults; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents hooked test teardown. - * - * @author Konstantin Kudryashov - */ -final class HookedTeardown implements Teardown -{ - /** - * @var Teardown - */ - private $teardown; - /** - * @var CallResults - */ - private $hookCallResults; - - /** - * Initializes setup. - * - * @param Teardown $teardown - * @param CallResults $hookCallResults - */ - public function __construct(Teardown $teardown, CallResults $hookCallResults) - { - $this->teardown = $teardown; - $this->hookCallResults = $hookCallResults; - } - - /** - * {@inheritdoc} - */ - public function isSuccessful() - { - if ($this->hookCallResults->hasExceptions()) { - return false; - } - - return $this->teardown->isSuccessful(); - } - - /** - * {@inheritdoc} - */ - public function hasOutput() - { - return $this->hookCallResults->hasStdOuts() || $this->hookCallResults->hasExceptions(); - } - - /** - * Returns hook call results. - * - * @return CallResults - */ - public function getHookCallResults() - { - return $this->hookCallResults; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Cli/OrderController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Cli/OrderController.php deleted file mode 100644 index 12edd91..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Cli/OrderController.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Ordering\Cli; - -use Behat\Testwork\Ordering\Exception\InvalidOrderException; -use Behat\Testwork\Ordering\OrderedExercise; -use Behat\Testwork\Ordering\Orderer\Orderer; -use Behat\Testwork\Cli\Controller; -use Symfony\Component\Console\Command\Command as SymfonyCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Preloads scenarios and then modifies the order when --order is passed - * - * @author Ciaran McNulty - */ -final class OrderController implements Controller -{ - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - /** - * @var OrderedExercise - */ - private $exercise; - /** - * @var array - */ - private $orderers = array(); - - /** - * Initializes controller. - * - * @param EventDispatcherInterface $eventDispatcher - * @param OrderedExercise $exercise - */ - public function __construct(EventDispatcherInterface $eventDispatcher, OrderedExercise $exercise) - { - $this->eventDispatcher = $eventDispatcher; - $this->exercise = $exercise; - } - - /** - * Configures command to be executable by the controller. - * - * @param SymfonyCommand $command - */ - public function configure(SymfonyCommand $command) - { - $command->addOption('--order', null, InputOption::VALUE_REQUIRED, - 'Set an order in which to execute the specifications (this will result in slower feedback).' - ); - } - - /** - * Executes controller. - * - * @param InputInterface $input - * @param OutputInterface $output - * - * @return null|integer - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $orderer = $input->getOption('order'); - - if (!$orderer) { - return; - } - - if (!array_key_exists($orderer, $this->orderers)) { - throw new InvalidOrderException(sprintf("Order option '%s' was not recognised", $orderer)); - } - - $this->exercise->setOrderer($this->orderers[$orderer]); - } - - /** - * Register a new available controller - * - * @param Orderer $orderer - */ - public function registerOrderer(Orderer $orderer) - { - $this->orderers[$orderer->getName()] = $orderer; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Exception/InvalidOrderException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Exception/InvalidOrderException.php deleted file mode 100644 index 8d9cd32..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Exception/InvalidOrderException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Ordering\Exception; - -use Behat\Testwork\Exception\TestworkException; -use RuntimeException; - -/** - * Represents exception throw during attempt to prioritise execution with a non-existent algorithm - * - * @author Ciaran McNulty - */ -final class InvalidOrderException extends RuntimeException implements TestworkException -{} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php deleted file mode 100644 index aba9ba8..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/OrderedExercise.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Ordering; - -use Behat\Testwork\Ordering\Orderer\NoopOrderer; -use Behat\Testwork\Ordering\Orderer\Orderer; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Exercise; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Exercise that is ordered according to a specified algorithm - * - * @author Ciaran McNulty - */ -final class OrderedExercise implements Exercise -{ - /** - * @var Orderer - */ - private $orderer; - - /** - * @var SpecificationIterator[] - */ - private $unordered; - - /** - * @var SpecificationIterator[] - */ - private $ordered; - - /** - * @var Exercise - */ - private $decoratedExercise; - - /** - * @param Exercise $decoratedExercise - */ - public function __construct(Exercise $decoratedExercise) - { - $this->orderer = new NoopOrderer(); - $this->decoratedExercise = $decoratedExercise; - } - - /** - * Sets up exercise for a test. - * - * @param SpecificationIterator[] $iterators - * @param bool $skip - * - * @return Setup - */ - public function setUp(array $iterators, $skip) - { - return $this->decoratedExercise->setUp($this->order($iterators), $skip); - } - - /** - * Tests suites specifications. - * - * @param SpecificationIterator[] $iterators - * @param bool $skip - * - * @return TestResult - */ - public function test(array $iterators, $skip) - { - return $this->decoratedExercise->test($this->order($iterators), $skip); - } - - /** - * Tears down exercise after a test. - * - * @param SpecificationIterator[] $iterators - * @param bool $skip - * @param TestResult $result - * - * @return Teardown - */ - public function tearDown(array $iterators, $skip, TestResult $result) - { - return $this->decoratedExercise->tearDown($this->order($iterators), $skip, $result); - } - - /** - * Replace the algorithm being used for prioritisation - * - * @param Orderer $orderer - */ - public function setOrderer(Orderer $orderer) - { - $this->orderer = $orderer; - } - - /** - * @param SpecificationIterator[] $iterators - * @return SpecificationIterator[] - */ - private function order(array $iterators) - { - if (!$this->ordered || $this->unordered != $iterators) { - $this->unordered = $iterators; - $this->ordered = $this->orderer->order($iterators); - } - - return $this->ordered; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/NoopOrderer.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/NoopOrderer.php deleted file mode 100644 index a2257f9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/NoopOrderer.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Ordering\Orderer; - -use Behat\Testwork\Specification\SpecificationIterator; - -/** - * Null implementation of Orderer that does no ordering - * - * @author Ciaran McNulty - */ -final class NoopOrderer implements Orderer -{ - - /** - * @param SpecificationIterator[] $scenarioIterators - * @return SpecificationIterator[] - */ - public function order(array $scenarioIterators) - { - return $scenarioIterators; - } - - /** - * @return string - */ - public function getName() - { - return 'null'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/Orderer.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/Orderer.php deleted file mode 100644 index 1f29c52..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/Orderer.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Ordering\Orderer; - -use Behat\Testwork\Specification\SpecificationIterator; - -/** - * Algorithm for prioritising Specification execution - * - * @author Ciaran McNulty - */ -interface Orderer -{ - /** - * @param SpecificationIterator[] $scenarioIterators - * @return SpecificationIterator[] - */ - public function order(array $scenarioIterators); - - /** - * @return string - */ - public function getName(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/RandomOrderer.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/RandomOrderer.php deleted file mode 100644 index 8dc9c9e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/RandomOrderer.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Ordering\Orderer; - -use Behat\Testwork\Specification\SpecificationArrayIterator; -use Behat\Testwork\Specification\SpecificationIterator; - -/** - * Prioritises Suites and Features into random order - * - * @author Ciaran McNulty - */ -final class RandomOrderer implements Orderer -{ - /** - * @param SpecificationIterator[] $scenarioIterators - * @return SpecificationIterator[] - */ - public function order(array $scenarioIterators) - { - $orderedFeatures = $this->orderFeatures($scenarioIterators); - shuffle($orderedFeatures); - - return $orderedFeatures; - } - - /** - * @param array $scenarioIterators - * @return array - */ - private function orderFeatures(array $scenarioIterators) - { - $orderedSuites = array(); - - foreach ($scenarioIterators as $scenarioIterator) { - $orderedSpecifications = iterator_to_array($scenarioIterator); - shuffle($orderedSpecifications); - $orderedSuites[] = new SpecificationArrayIterator( - $scenarioIterator->getSuite(), - $orderedSpecifications - ); - } - - return $orderedSuites; - } - - /** - * @return string - */ - public function getName() - { - return 'random'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/ReverseOrderer.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/ReverseOrderer.php deleted file mode 100644 index 9a23a4d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/Orderer/ReverseOrderer.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Ordering\Orderer; - -use Behat\Testwork\Specification\SpecificationArrayIterator; -use Behat\Testwork\Specification\SpecificationIterator; - -/** - * Prioritises Suites and Features into reverse order - * - * @author Ciaran McNulty - */ -final class ReverseOrderer implements Orderer -{ - /** - * @param SpecificationIterator[] $scenarioIterators - * @return SpecificationIterator[] - */ - public function order(array $scenarioIterators) - { - $orderedFeatures = $this->orderFeatures($scenarioIterators); - $orderedSuites = $this->orderSuites($orderedFeatures); - - return $orderedSuites; - } - - /** - * @param array $scenarioIterators - * @return array - */ - private function orderFeatures(array $scenarioIterators) - { - $orderedSuites = array(); - - foreach ($scenarioIterators as $scenarioIterator) { - $orderedSpecifications = array_reverse(iterator_to_array($scenarioIterator)); - $orderedSuites[] = new SpecificationArrayIterator( - $scenarioIterator->getSuite(), - $orderedSpecifications - ); - } - - return $orderedSuites; - } - - /** - * @param $orderedSuites - * @return array - */ - private function orderSuites($orderedSuites) - { - return array_reverse($orderedSuites); - } - - /** - * @return string - */ - public function getName() - { - return 'reverse'; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/ServiceContainer/OrderingExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/ServiceContainer/OrderingExtension.php deleted file mode 100644 index 3292273..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Ordering/ServiceContainer/OrderingExtension.php +++ /dev/null @@ -1,156 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Ordering\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Tester\ServiceContainer\TesterExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides specification execution ordering. - * - * @author Ciaran McNulty - */ -final class OrderingExtension implements Extension -{ - public const ORDERER_TAG = 'tester.orderer'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ?: new ServiceProcessor(); - } - - /** - * You can modify the container here before it is dumped to PHP code. - * - * @param ContainerBuilder $container - * - * @api - */ - public function process(ContainerBuilder $container) - { - $definition = $container->getDefinition(CliExtension::CONTROLLER_TAG . '.order'); - $references = $this->processor->findAndSortTaggedServices($container, self::ORDERER_TAG); - - foreach ($references as $reference) { - $definition->addMethodCall('registerOrderer', array($reference)); - } - } - - /** - * Returns the extension config key. - * - * @return string - */ - public function getConfigKey() - { - return 'ordering'; - } - - /** - * Initializes other extensions. - * - * This method is called immediately after all extensions are activated but - * before any extension `configure()` method is called. This allows extensions - * to hook into the configuration of other extensions providing such an - * extension point. - * - * @param ExtensionManager $extensionManager - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * Setups configuration for the extension. - * - * @param ArrayNodeDefinition $builder - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * Loads extension services into temporary container. - * - * @param ContainerBuilder $container - * @param array $config - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadOrderController($container); - $this->loadOrderedExercise($container); - $this->loadDefaultOrderers($container); - } - - /** - * Loads order controller. - * - * @param ContainerBuilder $container - */ - private function loadOrderController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Ordering\Cli\OrderController', array( - new Reference(EventDispatcherExtension::DISPATCHER_ID), - new Reference(TesterExtension::EXERCISE_WRAPPER_TAG . '.ordering') - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 250)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.order', $definition); - } - - /** - * Loads exercise wrapper that enables ordering - * - * @param ContainerBuilder $container - */ - private function loadOrderedExercise(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Ordering\OrderedExercise', array( - new Reference(TesterExtension::EXERCISE_ID) - )); - $definition->addTag(TesterExtension::EXERCISE_WRAPPER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::EXERCISE_WRAPPER_TAG . '.ordering', $definition); - } - - /** - * Defines default orderers - * - * @param ContainerBuilder $container - */ - private function loadDefaultOrderers(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Ordering\Orderer\ReverseOrderer'); - $definition->addTag(self::ORDERER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::EXERCISE_WRAPPER_TAG . '.ordering.reverse', $definition); - - - $definition = new Definition('Behat\Testwork\Ordering\Orderer\RandomOrderer'); - $definition->addTag(self::ORDERER_TAG, array('priority' => -9999)); - $container->setDefinition(TesterExtension::EXERCISE_WRAPPER_TAG . '.ordering.random', $definition); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Cli/OutputController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Cli/OutputController.php deleted file mode 100644 index bf8f944..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Cli/OutputController.php +++ /dev/null @@ -1,253 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Cli; - -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\OutputManager; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Configures formatters based on user input. - * - * @author Konstantin Kudryashov - */ -class OutputController implements Controller -{ - /** - * @var OutputManager - */ - private $manager; - - /** - * Initializes controller. - * - * @param OutputManager $manager - */ - public function __construct(OutputManager $manager) - { - $this->manager = $manager; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - $command - ->addOption( - '--format', '-f', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, - 'How to format tests output. pretty is default.' . PHP_EOL . - 'Available formats are:' . PHP_EOL . $this->getFormatterDescriptions() . - 'You can use multiple formats at the same time.' - ) - ->addOption( - '--out', '-o', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, - 'Write format output to a file/directory instead of' . PHP_EOL . - 'STDOUT (output_path). You can also provide different' . PHP_EOL . - 'outputs to multiple formats.' - ) - ->addOption( - '--format-settings', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, - 'Set formatters parameters using json object.' . PHP_EOL . - 'Keys are parameter names, values are values.' - ); - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $formats = $input->getOption('format'); - $outputs = $input->getOption('out'); - - $this->configureFormatters($formats, $input, $output); - $this->configureOutputs($formats, $outputs, $output->isDecorated()); - } - - /** - * Configures formatters based on container, input and output configurations. - * - * @param array $formats - * @param InputInterface $input - * @param OutputInterface $output - */ - protected function configureFormatters(array $formats, InputInterface $input, OutputInterface $output) - { - $this->enableFormatters($formats); - $this->setFormattersParameters($input, $output); - } - - /** - * Enables formatters. - * - * @param array $formats - */ - protected function enableFormatters(array $formats) - { - if (count($formats)) { - $this->manager->disableAllFormatters(); - foreach ($formats as $format) { - $this->manager->enableFormatter($format); - } - } - } - - /** - * Sets formatters parameters based on input & output. - * - * @param InputInterface $input - * @param OutputInterface $output - */ - protected function setFormattersParameters(InputInterface $input, OutputInterface $output) - { - $this->manager->setFormattersParameter('output_decorate', $output->isDecorated()); - - if ($input->getOption('format-settings')) { - foreach ($input->getOption('format-settings') as $jsonSettings) { - $this->loadJsonSettings($jsonSettings); - } - } - } - - /** - * Locates output path from relative one. - * - * @param string $path - * - * @return string - */ - protected function locateOutputPath($path) - { - if ($this->isAbsolutePath($path)) { - return $path; - } - - $path = getcwd() . DIRECTORY_SEPARATOR . $path; - - if (!file_exists($path)) { - touch($path); - $path = realpath($path); - unlink($path); - } else { - $path = realpath($path); - } - - return $path; - } - - /** - * Initializes multiple formatters with different outputs. - * - * @param array $formats - * @param array $outputs - * @param bool $decorated - */ - private function configureOutputs(array $formats, array $outputs, $decorated = false) - { - if (1 == count($outputs) && !$this->isStandardOutput($outputs[0])) { - $outputPath = $this->locateOutputPath($outputs[0]); - - $this->manager->setFormattersParameter('output_path', $outputPath); - $this->manager->setFormattersParameter('output_decorate', $decorated); - - return; - } - - foreach ($outputs as $i => $out) { - if ($this->isStandardOutput($out)) { - continue; - } - - $outputPath = $this->locateOutputPath($out); - if (isset($formats[$i])) { - $this->manager->setFormatterParameter($formats[$i], 'output_path', $outputPath); - $this->manager->setFormatterParameter($formats[$i], 'output_decorate', $decorated); - } - } - } - - /** - * Checks if provided output identifier represents standard output. - * - * @param string $outputId - * - * @return bool - */ - private function isStandardOutput($outputId) - { - return 'std' === $outputId || 'null' === $outputId || 'false' === $outputId; - } - - /** - * Returns whether the file path is an absolute path. - * - * @param string $file A file path - * - * @return bool - */ - private function isAbsolutePath($file) - { - if ($file[0] == '/' || $file[0] == '\\' - || (strlen($file) > 3 && ctype_alpha($file[0]) - && $file[1] == ':' - && ($file[2] == '\\' || $file[2] == '/') - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ) { - return true; - } - - return false; - } - - /** - * Returns formatters description. - * - * @return string - */ - private function getFormatterDescriptions() - { - return implode( - PHP_EOL, - array_map( - function (Formatter $formatter) { - $comment = '- ' . $formatter->getName() . ': '; - $comment .= $formatter->getDescription(); - - return $comment; - }, $this->manager->getFormatters() - ) - ) . PHP_EOL; - } - - /** - * Loads JSON settings as formatter parameters. - * - * @param string $jsonSettings - */ - private function loadJsonSettings($jsonSettings) - { - $settings = @json_decode($jsonSettings, true); - - if (!is_array($settings)) { - return; - } - - foreach ($settings as $name => $value) { - $this->manager->setFormattersParameter($name, $value); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/BadOutputPathException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/BadOutputPathException.php deleted file mode 100644 index edd773c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/BadOutputPathException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception thrown because user provided bad output path. - * - * @author Konstantin Kudryashov - */ -class BadOutputPathException extends InvalidArgumentException implements PrinterException -{ - /** - * @var string - */ - private $path; - - /** - * Initializes exception. - * - * @param string $message - * @param string $path - */ - public function __construct($message, $path) - { - $this->path = $path; - - parent::__construct($message); - } - - /** - * Returns exception causing path. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/FormatterNotFoundException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/FormatterNotFoundException.php deleted file mode 100644 index 43b3371..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/FormatterNotFoundException.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Exception; - -use InvalidArgumentException; - -/** - * Represents an exception thrown because requested formatter is not found. - * - * @author Konstantin Kudryashov - */ -class FormatterNotFoundException extends InvalidArgumentException implements OutputException -{ - /** - * @var string - */ - private $name; - - /** - * Initializes exception. - * - * @param string $message - * @param string $name - */ - public function __construct($message, $name) - { - parent::__construct($message); - } - - /** - * Returns formatter name. - * - * @return string - */ - public function getName() - { - return $this->name; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/OutputException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/OutputException.php deleted file mode 100644 index cba1a7d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/OutputException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * Represents an output exception. - * - * @author Konstantin Kudryashov - */ -interface OutputException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/PrinterException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/PrinterException.php deleted file mode 100644 index 283ed14..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Exception/PrinterException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Exception; - -/** - * Represents a printer exception. - * - * @author Konstantin Kudryashov - */ -interface PrinterException extends OutputException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Formatter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Formatter.php deleted file mode 100644 index 23a87c6..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Formatter.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output; - -use Behat\Testwork\Output\Printer\OutputPrinter; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Represents Testwork output formatter. - * - * @see OutputManager - * - * @author Konstantin Kudryashov - */ -interface Formatter extends EventSubscriberInterface -{ - /** - * Returns formatter name. - * - * @return string - */ - public function getName(); - - /** - * Returns formatter description. - * - * @return string - */ - public function getDescription(); - - /** - * Returns formatter output printer. - * - * @return OutputPrinter - */ - public function getOutputPrinter(); - - /** - * Sets formatter parameter. - * - * @param string $name - * @param mixed $value - */ - public function setParameter($name, $value); - - /** - * Returns parameter name. - * - * @param string $name - * - * @return mixed - */ - public function getParameter($name); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php deleted file mode 100644 index 2fb8d44..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/ChainEventListener.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Node\EventListener; - -use ArrayIterator; -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Countable; -use IteratorAggregate; - -/** - * Used to compose formatter event listeners. - * - * @author Konstantin Kudryashov - */ -class ChainEventListener implements EventListener, Countable, IteratorAggregate -{ - /** - * @var EventListener[] - */ - private $listeners; - - /** - * Initializes collection. - * - * @param EventListener[] $listeners - */ - public function __construct(array $listeners) - { - $this->listeners = $listeners; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - foreach ($this->listeners as $listener) { - $listener->listenEvent($formatter, $event, $eventName); - } - } - - /** - * {@inheritdoc} - */ - public function count(): int - { - return count($this->listeners); - } - - /** - * {@inheritdoc} - */ - public function getIterator(): ArrayIterator - { - return new ArrayIterator($this->listeners); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/EventListener.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/EventListener.php deleted file mode 100644 index 2faaef9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/EventListener.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Node\EventListener; - -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; - -/** - * Used to define formatter event listeners. - * - * @author Konstantin Kudryashov - */ -interface EventListener -{ - /** - * Notifies listener about an event. - * - * @param Formatter $formatter - * @param Event $event - * @param string $eventName - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php deleted file mode 100644 index 3c91718..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Node/EventListener/Flow/FireOnlyIfFormatterParameterListener.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Node\EventListener\Flow; - -use Behat\Testwork\Event\Event; -use Behat\Testwork\Output\Formatter; -use Behat\Testwork\Output\Node\EventListener\EventListener; - -/** - * Catches all events, but proxies them only if formatter has specific parameter set to a specific value. - * - * @author Konstantin Kudryashov - */ -class FireOnlyIfFormatterParameterListener implements EventListener -{ - /** - * @var string - */ - private $name; - /** - * @var mixed - */ - private $value; - /** - * @var EventListener - */ - private $descendant; - - /** - * Initializes listener. - * - * @param string $name - * @param mixed $value - * @param EventListener $descendant - */ - public function __construct($name, $value, EventListener $descendant) - { - $this->name = $name; - $this->value = $value; - $this->descendant = $descendant; - } - - /** - * {@inheritdoc} - */ - public function listenEvent(Formatter $formatter, Event $event, $eventName) - { - if ($this->value !== $formatter->getParameter($this->name)) { - return; - } - - $this->descendant->listenEvent($formatter, $event, $eventName); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/NodeEventListeningFormatter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/NodeEventListeningFormatter.php deleted file mode 100644 index 4ecdd20..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/NodeEventListeningFormatter.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output; - -use Behat\Testwork\Event\Event; -use Behat\Testwork\EventDispatcher\TestworkEventDispatcher; -use Behat\Testwork\Output\Node\EventListener\EventListener; -use Behat\Testwork\Output\Printer\OutputPrinter; - -/** - * Formatter built around the idea of event delegation and composition. - * - * @author Konstantin Kudryashov - */ -final class NodeEventListeningFormatter implements Formatter -{ - /** - * @var OutputPrinter - */ - private $printer; - /** - * @var array - */ - private $parameters; - /** - * @var EventListener - */ - private $listener; - /** - * @var string - */ - private $name; - /** - * @var string - */ - private $description; - - /** - * Initializes formatter. - * - * @param string $name - * @param string $description - * @param array $parameters - * @param OutputPrinter $printer - * @param EventListener $listener - */ - public function __construct($name, $description, array $parameters, OutputPrinter $printer, EventListener $listener) - { - $this->name = $name; - $this->description = $description; - $this->parameters = $parameters; - $this->printer = $printer; - $this->listener = $listener; - } - - /** - * Returns an array of event names this subscriber wants to listen to. - * - * @return array The event names to listen to - */ - public static function getSubscribedEvents() - { - return array(TestworkEventDispatcher::BEFORE_ALL_EVENTS => 'listenEvent'); - } - - /** - * Proxies event to the listener. - * - * @param Event $event - * @param null|string $eventName - */ - public function listenEvent(Event $event, $eventName = null) - { - if (null === $eventName) { - if (method_exists($event, 'getName')) { - $eventName = $event->getName(); - } else { - $eventName = get_class($event); - } - } - - $this->listener->listenEvent($this, $event, $eventName); - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return $this->name; - } - - /** - * {@inheritdoc} - */ - public function getDescription() - { - return $this->description; - } - - /** - * {@inheritdoc} - */ - public function getOutputPrinter() - { - return $this->printer; - } - - /** - * {@inheritdoc} - */ - public function setParameter($name, $value) - { - $this->parameters[$name] = $value; - } - - /** - * {@inheritdoc} - */ - public function getParameter($name) - { - return $this->parameters[$name] ?? null; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/OutputManager.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/OutputManager.php deleted file mode 100644 index ede7b57..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/OutputManager.php +++ /dev/null @@ -1,208 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output; - -use Behat\Testwork\Output\Exception\FormatterNotFoundException; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; - -/** - * Manages formatters and their configuration. - * - * @author Konstantin Kudryashov - */ -final class OutputManager -{ - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - /** - * @var Formatter[] - */ - private $formatters = array(); - - /** - * Initializes manager. - * - * @param EventDispatcherInterface $eventDispatcher - */ - public function __construct(EventDispatcherInterface $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - } - - /** - * Registers formatter. - * - * @param Formatter $formatter - */ - public function registerFormatter(Formatter $formatter) - { - if (isset($this->formatters[$formatter->getName()])) { - $this->disableFormatter($formatter->getName()); - } - - $this->formatters[$formatter->getName()] = $formatter; - } - - /** - * Checks if formatter is registered. - * - * @param string $name - * - * @return bool - */ - public function isFormatterRegistered($name) - { - return isset($this->formatters[$name]); - } - - /** - * Returns formatter by name provided. - * - * @param string $name - * - * @return Formatter - * - * @throws FormatterNotFoundException - */ - public function getFormatter($name) - { - if (!$this->isFormatterRegistered($name)) { - throw new FormatterNotFoundException(sprintf( - '`%s` formatter is not found or has not been properly registered. Registered formatters: `%s`.', - $name, - implode('`, `', array_keys($this->formatters)) - ), $name); - } - - return $this->formatters[$name]; - } - - /** - * Returns all registered formatters. - * - * @return Formatter[] - */ - public function getFormatters() - { - return $this->formatters; - } - - /** - * Enable formatter by name provided. - * - * @param string $formatter - */ - public function enableFormatter($formatter) - { - if (!$this->isFormatterRegistered($formatter) && class_exists($formatter)) { - $formatterInstance = new $formatter(); - $formatter = $formatterInstance->getName(); - - if (!$this->isFormatterRegistered($formatter)) { - $this->registerFormatter($formatterInstance); - } - } - - $this->eventDispatcher->addSubscriber($this->getFormatter($formatter)); - } - - /** - * Disable formatter by name provided. - * - * @param string $formatter - */ - public function disableFormatter($formatter) - { - $this->eventDispatcher->removeSubscriber($this->getFormatter($formatter)); - } - - /** - * Disable all registered formatters. - */ - public function disableAllFormatters() - { - array_map(array($this, 'disableFormatter'), array_keys($this->formatters)); - } - - /** - * Sets provided parameter to said formatter. - * - * @param string $formatter - * @param string $parameterName - * @param mixed $parameterValue - */ - public function setFormatterParameter($formatter, $parameterName, $parameterValue) - { - $formatter = $this->getFormatter($formatter); - $printer = $formatter->getOutputPrinter(); - - switch ($parameterName) { - case 'output_verbosity': - $printer->setOutputVerbosity($parameterValue); - - return; - case 'output_path': - $printer->setOutputPath($parameterValue); - - return; - case 'output_decorate': - $printer->setOutputDecorated($parameterValue); - - return; - case 'output_styles': - $printer->setOutputStyles($parameterValue); - - return; - } - - $formatter->setParameter($parameterName, $parameterValue); - } - - /** - * Sets provided formatter parameters. - * - * @param string $formatter - * @param array $parameters - */ - public function setFormatterParameters($formatter, array $parameters) - { - foreach ($parameters as $key => $val) { - $this->setFormatterParameter($formatter, $key, $val); - } - } - - /** - * Sets provided parameter to all registered formatters. - * - * @param string $parameterName - * @param mixed $parameterValue - */ - public function setFormattersParameter($parameterName, $parameterValue) - { - foreach (array_keys($this->formatters) as $formatter) { - $this->setFormatterParameter($formatter, $parameterName, $parameterValue); - } - } - - /** - * Sets provided parameters to all registered formatters. - * - * @param array $parameters - */ - public function setFormattersParameters(array $parameters) - { - foreach ($parameters as $key => $val) { - $this->setFormattersParameter($key, $val); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/ConsoleOutputFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/ConsoleOutputFactory.php deleted file mode 100644 index e1d22ee..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/ConsoleOutputFactory.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Printer\Factory; - -use Behat\Testwork\Output\Exception\BadOutputPathException; -use Symfony\Component\Console\Formatter\OutputFormatter; -use Symfony\Component\Console\Formatter\OutputFormatterStyle; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Output\StreamOutput; - -/** - * Creates an output stream for the console. - * - * @author Wouter J - * @author Konstantin Kudryashov - */ -class ConsoleOutputFactory extends OutputFactory -{ - /** - * Creates output formatter that is used to create a stream. - * - * @return OutputFormatter - */ - protected function createOutputFormatter() - { - return new OutputFormatter(); - } - - /** - * Configure output stream parameters. - * - * @param OutputInterface $output - */ - protected function configureOutputStream(OutputInterface $output) - { - $verbosity = $this->getOutputVerbosity() ? OutputInterface::VERBOSITY_VERBOSE : OutputInterface::VERBOSITY_NORMAL; - $output->setVerbosity($verbosity); - - if (null !== $this->isOutputDecorated()) { - $output->getFormatter()->setDecorated($this->isOutputDecorated()); - } - } - - /** - * Returns new output stream. - * - * Override this method & call flush() to write output in another stream - * - * @return resource - * - * @throws BadOutputPathException - */ - protected function createOutputStream() - { - if (null === $this->getOutputPath()) { - $stream = fopen('php://stdout', 'w'); - } elseif (!is_dir($this->getOutputPath())) { - $stream = fopen($this->getOutputPath(), 'w'); - } else { - throw new BadOutputPathException(sprintf( - 'Filename expected as `output_path` parameter, but got `%s`.', - $this->getOutputPath() - ), $this->getOutputPath()); - } - - return $stream; - } - - /** - * {@inheritdoc} - */ - public function createOutput($stream = null) - { - $stream = $stream ? : $this->createOutputStream(); - $format = $this->createOutputFormatter(); - - // set user-defined styles - foreach ($this->getOutputStyles() as $name => $options) { - $style = new OutputFormatterStyle(); - - if (isset($options[0])) { - $style->setForeground($options[0]); - } - if (isset($options[1])) { - $style->setBackground($options[1]); - } - if (isset($options[2])) { - $style->setOptions($options[2]); - } - - $format->setStyle($name, $style); - } - - $output = new StreamOutput( - $stream, - StreamOutput::VERBOSITY_NORMAL, - $this->isOutputDecorated(), - $format - ); - $this->configureOutputStream($output); - - return $output; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/FilesystemOutputFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/FilesystemOutputFactory.php deleted file mode 100644 index af98202..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/FilesystemOutputFactory.php +++ /dev/null @@ -1,71 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Printer\Factory; - -use Behat\Testwork\Output\Exception\BadOutputPathException; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Output\StreamOutput; - -/** - * Creates an output stream for the filesystem. - * - * @author Wouter J - */ -class FilesystemOutputFactory extends OutputFactory -{ - private $fileName; - - public function setFileName($fileName) - { - $this->fileName = $fileName; - } - - /** - * Configure output stream parameters. - * - * @param OutputInterface $output - */ - protected function configureOutputStream(OutputInterface $output) - { - $verbosity = $this->getOutputVerbosity() ? OutputInterface::VERBOSITY_VERBOSE : OutputInterface::VERBOSITY_NORMAL; - $output->setVerbosity($verbosity); - } - - /** - * {@inheritDoc} - */ - public function createOutput($stream = null) - { - if (is_file($this->getOutputPath())) { - throw new BadOutputPathException( - 'Directory expected for the `output_path` option, but a filename was given.', - $this->getOutputPath() - ); - } elseif (!is_dir($this->getOutputPath())) { - mkdir($this->getOutputPath(), 0777, true); - } - - if (null === $this->fileName) { - throw new \LogicException('Unable to create file, no file name specified'); - } - - $filePath = $this->getOutputPath().'/'.$this->fileName; - - $stream = new StreamOutput( - fopen($filePath, 'w'), - StreamOutput::VERBOSITY_NORMAL, - false // a file is never decorated - ); - $this->configureOutputStream($stream); - - return $stream; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php deleted file mode 100644 index e65f7f1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/Factory/OutputFactory.php +++ /dev/null @@ -1,129 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Printer\Factory; - -use Symfony\Component\Console\Output\OutputInterface; - -/** - * @author Wouter J - * @author Konstantin Kudryashov - */ -abstract class OutputFactory -{ - public const VERBOSITY_NORMAL = 1; - public const VERBOSITY_VERBOSE = 2; - public const VERBOSITY_VERY_VERBOSE = 3; - public const VERBOSITY_DEBUG = 4; - - /** - * @var null|string - */ - private $outputPath; - /** - * @var array - */ - private $outputStyles = array(); - /** - * @var null|bool - */ - private $outputDecorated = null; - /** - * @var integer - */ - private $verbosityLevel = 0; - - /** - * Sets output path. - * - * @param string $path - */ - public function setOutputPath($path) - { - $this->outputPath = $path; - } - - /** - * Returns output path. - * - * @return null|string - */ - public function getOutputPath() - { - return $this->outputPath; - } - - /** - * Sets output styles. - * - * @param array $styles - */ - public function setOutputStyles(array $styles) - { - $this->outputStyles = $styles; - } - - /** - * Returns output styles. - * - * @return array - */ - public function getOutputStyles() - { - return $this->outputStyles; - } - - /** - * Forces output to be decorated. - * - * @param bool $decorated - */ - public function setOutputDecorated($decorated) - { - $this->outputDecorated = $decorated; - } - - /** - * Returns output decoration status. - * - * @return null|bool - */ - public function isOutputDecorated() - { - return $this->outputDecorated; - } - - /** - * Sets output verbosity level. - * - * @param integer $level - */ - public function setOutputVerbosity($level) - { - $this->verbosityLevel = intval($level); - } - - /** - * Returns output verbosity level. - * - * @return integer - */ - public function getOutputVerbosity() - { - return $this->verbosityLevel; - } - - /** - * Returns a new output stream. - * - * @return OutputInterface - */ - abstract public function createOutput(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php deleted file mode 100644 index ce1371c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/JUnitOutputPrinter.php +++ /dev/null @@ -1,153 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Printer; - -use Behat\Testwork\Output\Exception\MissingExtensionException; -use Behat\Testwork\Output\Printer\Factory\FilesystemOutputFactory; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * A convenient wrapper around the ConsoleOutputPrinter to write valid JUnit - * reports. - * - * @author Wouter J - * @author James Watson - */ -final class JUnitOutputPrinter extends StreamOutputPrinter -{ - public const XML_VERSION = '1.0'; - public const XML_ENCODING = 'UTF-8'; - - /** - * @var \DOMDocument - */ - private $domDocument; - /** - * @var \DOMElement - */ - private $currentTestsuite; - /** - * @var \DOMElement - */ - private $currentTestcase; - /** - * @var \DOMElement - */ - private $testSuites; - - public function __construct(FilesystemOutputFactory $outputFactory) - { - parent::__construct($outputFactory); - } - - /** - * Creates a new JUnit file. - * - * The file will be initialized with an XML definition and the root element. - * - * @param string $name The filename (without extension) and default value of the name attribute - * @param array $testsuitesAttributes Attributes for the root element - */ - public function createNewFile($name, array $testsuitesAttributes = array()) - { - // This requires the DOM extension to be enabled. - if (!extension_loaded('dom')) { - throw new MissingExtensionException('The PHP DOM extension is required to generate JUnit reports.'); - } - $this->setFileName(strtolower(trim(preg_replace('/[^[:alnum:]_]+/', '_', $name), '_'))); - - $this->domDocument = new \DOMDocument(self::XML_VERSION, self::XML_ENCODING); - $this->domDocument->formatOutput = true; - - $this->testSuites = $this->domDocument->createElement('testsuites'); - $this->domDocument->appendChild($this->testSuites); - $this->addAttributesToNode($this->testSuites, array_merge(array('name' => $name), $testsuitesAttributes)); - $this->flush(); - } - - /** - * Adds a new node. - * - * @param array $testsuiteAttributes - */ - public function addTestsuite(array $testsuiteAttributes = array()) - { - $this->currentTestsuite = $this->domDocument->createElement('testsuite'); - $this->testSuites->appendChild($this->currentTestsuite); - $this->addAttributesToNode($this->currentTestsuite, $testsuiteAttributes); - } - - - /** - * Adds a new node. - * - * @param array $testcaseAttributes - */ - public function addTestcase(array $testcaseAttributes = array()) - { - $this->currentTestcase = $this->domDocument->createElement('testcase'); - $this->currentTestsuite->appendChild($this->currentTestcase); - $this->addAttributesToNode($this->currentTestcase, $testcaseAttributes); - } - - /** - * Add a testcase child element. - * - * @param string $nodeName - * @param array $nodeAttributes - * @param string $nodeValue - */ - public function addTestcaseChild($nodeName, array $nodeAttributes = array(), $nodeValue = null) - { - $childNode = $this->domDocument->createElement($nodeName, $nodeValue ?? ''); - $this->currentTestcase->appendChild($childNode); - $this->addAttributesToNode($childNode, $nodeAttributes); - } - - private function addAttributesToNode(\DOMElement $node, array $attributes) - { - foreach ($attributes as $name => $value){ - $node->setAttribute($name, $value ?? ''); - } - } - - /** - * Sets file name. - * - * @param string $fileName - * @param string $extension The file extension, defaults to "xml" - */ - public function setFileName($fileName, $extension = 'xml') - { - if ('.'.$extension !== substr($fileName, strlen($extension) + 1)) { - $fileName .= '.'.$extension; - } - - $this->getOutputFactory()->setFileName($fileName); - $this->flush(); - } - - /** - * Generate XML from the DOMDocument and parse to the the writing stream - */ - public function flush() - { - if($this->domDocument instanceof \DOMDocument){ - $this->getWritingStream()->write( - $this->domDocument->saveXML(null, LIBXML_NOEMPTYTAG), - false, - OutputInterface::OUTPUT_RAW - ); - } - - parent::flush(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/OutputPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/OutputPrinter.php deleted file mode 100644 index 6ef9074..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/OutputPrinter.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Printer; - -/** - * Isolates all console/filesystem writing. - * - * @author Konstantin Kudryashov - */ -interface OutputPrinter -{ - /** - * @deprecated since 3.1, to be removed in 4.0 - */ - public const VERBOSITY_NORMAL = 1; - /** - * @deprecated since 3.1, to be removed in 4.0 - */ - public const VERBOSITY_VERBOSE = 2; - /** - * @deprecated since 3.1, to be removed in 4.0 - */ - public const VERBOSITY_VERY_VERBOSE = 3; - /** - * @deprecated since 3.1, to be removed in 4.0 - */ - public const VERBOSITY_DEBUG = 4; - - /** - * Sets output path. - * - * @param string $path - */ - public function setOutputPath($path); - - /** - * Returns output path. - * - * @return null|string - * - * @deprecated since 3.1, to be removed in 4.0 - */ - public function getOutputPath(); - - /** - * Sets output styles. - * - * @param array $styles - */ - public function setOutputStyles(array $styles); - - /** - * Returns output styles. - * - * @return array - * - * @deprecated since 3.1, to be removed in 4.0 - */ - public function getOutputStyles(); - - /** - * Forces output to be decorated. - * - * @param bool $decorated - */ - public function setOutputDecorated($decorated); - - /** - * Returns output decoration status. - * - * @return null|bool - * - * @deprecated since 3.1, to be removed in 4.0 - */ - public function isOutputDecorated(); - - /** - * Sets output verbosity level. - * - * @param integer $level - */ - public function setOutputVerbosity($level); - - /** - * Returns output verbosity level. - * - * @return integer - * - * @deprecated since 3.1, to be removed in 4.0 - */ - public function getOutputVerbosity(); - - /** - * Writes message(s) to output stream. - * - * @param string|array $messages message or array of messages - */ - public function write($messages); - - /** - * Writes newlined message(s) to output stream. - * - * @param string|array $messages message or array of messages - */ - public function writeln($messages = ''); - - /** - * Clear output stream, so on next write formatter will need to init (create) it again. - */ - public function flush(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/StreamOutputPrinter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/StreamOutputPrinter.php deleted file mode 100644 index 6b3fb4e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/Printer/StreamOutputPrinter.php +++ /dev/null @@ -1,149 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\Printer; - -use Behat\Testwork\Output\Printer\Factory\OutputFactory; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * @author Wouter J - * @author Konstantin Kudryashov - */ -class StreamOutputPrinter implements OutputPrinter -{ - /** - * @var OutputInterface - */ - private $output; - /** - * @var OutputFactory - */ - private $outputFactory; - - public function __construct(OutputFactory $outputFactory) - { - $this->outputFactory = $outputFactory; - } - - /** - * @return OutputFactory - */ - protected function getOutputFactory() - { - return $this->outputFactory; - } - - /** - * {@inheritdoc} - */ - public function setOutputPath($path) - { - $this->outputFactory->setOutputPath($path); - $this->flush(); - } - - /** - * {@inheritdoc} - */ - public function getOutputPath() - { - return $this->outputFactory->getOutputPath(); - } - - /** - * {@inheritdoc} - */ - public function setOutputStyles(array $styles) - { - $this->outputFactory->setOutputStyles($styles); - $this->flush(); - } - - /** - * {@inheritdoc} - */ - public function getOutputStyles() - { - return $this->outputFactory->getOutputStyles(); - } - - /** - * {@inheritdoc} - */ - public function setOutputDecorated($decorated) - { - $this->outputFactory->setOutputDecorated($decorated); - $this->flush(); - } - - /** - * {@inheritdoc} - */ - public function isOutputDecorated() - { - return $this->outputFactory->isOutputDecorated(); - } - - /** - * {@inheritdoc} - */ - public function setOutputVerbosity($level) - { - $this->outputFactory->setOutputVerbosity($level); - $this->flush(); - } - - /** - * {@inheritdoc} - */ - public function getOutputVerbosity() - { - return $this->outputFactory->getOutputVerbosity(); - } - - /** - * {@inheritdoc} - */ - public function write($messages) - { - $this->getWritingStream()->write($messages, false); - } - - /** - * {@inheritdoc} - */ - public function writeln($messages = '') - { - $this->getWritingStream()->write($messages, true); - } - - /** - * {@inheritdoc} - */ - public function flush() - { - $this->output = null; - } - - /** - * Returns output instance, prepared to write. - * - * @return OutputInterface - */ - final protected function getWritingStream() - { - if (null === $this->output) { - $this->output = $this->outputFactory->createOutput(); - } - - return $this->output; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/ServiceContainer/Formatter/FormatterFactory.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/ServiceContainer/Formatter/FormatterFactory.php deleted file mode 100644 index c80b552..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/ServiceContainer/Formatter/FormatterFactory.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\ServiceContainer\Formatter; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Provides a way to easily define custom formatters. - * - * @author Konstantin Kudryashov - */ -interface FormatterFactory -{ - /** - * Builds formatter configuration. - * - * @param ContainerBuilder $container - */ - public function buildFormatter(ContainerBuilder $container); - - /** - * Processes formatter configuration. - * - * @param ContainerBuilder $container - */ - public function processFormatter(ContainerBuilder $container); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/ServiceContainer/OutputExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/ServiceContainer/OutputExtension.php deleted file mode 100644 index dff83fd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Output/ServiceContainer/OutputExtension.php +++ /dev/null @@ -1,223 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Output\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension; -use Behat\Testwork\Output\ServiceContainer\Formatter\FormatterFactory; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides output management services for testwork. - * - * @author Konstantin Kudryashov - */ -final class OutputExtension implements Extension -{ - /* - * Available services - */ - public const MANAGER_ID = 'output.manager'; - - /* - * Available extension points - */ - public const FORMATTER_TAG = 'output.formatter'; - - /** - * @var string - */ - private $defaultFormatter; - /** - * @var FormatterFactory[] - */ - private $factories; - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param string $defaultFormatter - * @param FormatterFactory[] $formatterFactories - * @param null|ServiceProcessor $processor - */ - public function __construct($defaultFormatter, array $formatterFactories, ServiceProcessor $processor = null) - { - $this->defaultFormatter = $defaultFormatter; - $this->factories = $formatterFactories; - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * Registers formatter factory. - * - * @param FormatterFactory $factory - */ - public function registerFormatterFactory(FormatterFactory $factory) - { - $this->factories[] = $factory; - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'formatters'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - $builder - ->defaultValue(array($this->defaultFormatter => array('enabled' => true))) - ->useAttributeAsKey('name') - ->prototype('array') - ->beforeNormalization() - ->ifTrue(function ($a) { - return is_array($a) && !isset($a['enabled']); - }) - ->then(function ($a) { - return array_merge($a, array('enabled' => true)); - }) - ->end() - ->useAttributeAsKey('name') - ->treatTrueLike(array('enabled' => true)) - ->treatNullLike(array('enabled' => true)) - ->treatFalseLike(array('enabled' => false)) - ->prototype('variable')->end() - ->end() - ; - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadOutputController($container); - $this->loadFormatters($container); - $this->loadManager($container, $config); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processFormatters($container); - $this->processDynamicallyRegisteredFormatters($container); - } - - /** - * Loads output controller. - * - * @param ContainerBuilder $container - */ - private function loadOutputController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Output\Cli\OutputController', array( - new Reference(self::MANAGER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 1000)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.output', $definition); - } - - /** - * Loads output manager. - * - * @param ContainerBuilder $container - * @param array $formatters - */ - private function loadManager(ContainerBuilder $container, array $formatters) - { - $definition = new Definition('Behat\Testwork\Output\OutputManager', array( - new Reference(EventDispatcherExtension::DISPATCHER_ID) - )); - - foreach ($formatters as $name => $parameters) { - if ($parameters['enabled']) { - $definition->addMethodCall('enableFormatter', array($name)); - } else { - $definition->addMethodCall('disableFormatter', array($name)); - } - - unset($parameters['enabled']); - $definition->addMethodCall('setFormatterParameters', array($name, $parameters)); - } - - $container->setDefinition(self::MANAGER_ID, $definition); - } - - /** - * Loads default formatters using registered factories. - * - * @param ContainerBuilder $container - */ - private function loadFormatters(ContainerBuilder $container) - { - foreach ($this->factories as $factory) { - $factory->buildFormatter($container); - } - } - - /** - * Processes formatters using registered factories. - * - * @param ContainerBuilder $container - */ - private function processFormatters(ContainerBuilder $container) - { - foreach ($this->factories as $factory) { - $factory->processFormatter($container); - } - } - - /** - * Processes all available output formatters. - * - * @param ContainerBuilder $container - */ - private function processDynamicallyRegisteredFormatters(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::FORMATTER_TAG); - $definition = $container->getDefinition(self::MANAGER_ID); - - $previousCalls = $definition->getMethodCalls(); - $definition->setMethodCalls(); - - foreach ($references as $reference) { - $definition->addMethodCall('registerFormatter', array($reference)); - } - - foreach ($previousCalls as $call) { - $definition->addMethodCall($call[0], $call[1]); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php deleted file mode 100644 index dfc02eb..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationLoader.php +++ /dev/null @@ -1,282 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer\Configuration; - -use Behat\Testwork\ServiceContainer\Exception\ConfigurationLoadingException; -use Symfony\Component\Yaml\Yaml; - -/** - * Loads configuration from different sources. - * - * @author Konstantin Kudryashov - */ -final class ConfigurationLoader -{ - /** - * @var null|string - */ - private $configurationPath; - /** - * @var null|string - */ - private $environmentVariable; - /** - * @var bool - */ - private $profileFound; - /** - * @var array - */ - private $debugInformation = array( - 'environment_variable_name' => 'none', - 'environment_variable_content' => 'none', - 'configuration_file_path' => 'none' - ); - - /** - * Constructs reader. - * - * @param string $environmentVariableName Environment variable name - * @param string $configurationPath Configuration file path - */ - public function __construct($environmentVariableName = null, $configurationPath = null) - { - $this->environmentVariable = $environmentVariableName; - $this->configurationPath = $configurationPath; - } - - /** - * Sets environment variable name. - * - * @param null|string $variable - */ - public function setEnvironmentVariableName($variable) - { - $this->environmentVariable = $variable; - } - - /** - * Returns environment variable name. - * - * @return null|string - */ - public function getEnvironmentVariableName() - { - return $this->environmentVariable; - } - - /** - * Sets configuration file path. - * - * @param null|string $path - */ - public function setConfigurationFilePath($path) - { - $this->configurationPath = $path; - } - - /** - * Returns configuration file path. - * - * @return null|string - */ - public function getConfigurationFilePath() - { - return $this->configurationPath; - } - - /** - * Reads configuration sequence for specific profile. - * - * @param string $profile Profile name - * - * @return array - * - * @throws ConfigurationLoadingException - */ - public function loadConfiguration($profile = 'default') - { - $configs = array(); - $this->profileFound = false; - - // first is ENV config - foreach ($this->loadEnvironmentConfiguration() as $config) { - $configs[] = $config; - } - - // second is file configuration (if there is some) - if ($this->configurationPath) { - $this->debugInformation['configuration_file_path'] = $this->configurationPath; - - foreach ($this->loadFileConfiguration($this->configurationPath, $profile) as $config) { - $configs[] = $config; - } - } - - // if specific profile has not been found - if ('default' !== $profile && !$this->profileFound) { - throw new ConfigurationLoadingException(sprintf( - 'Can not find configuration for `%s` profile.', - $profile - )); - } - - return $configs; - } - - /** - * Returns array with configuration debug information. - * - * @return array - */ - public function debugInformation() - { - return $this->debugInformation; - } - - /** - * Loads information from environment variable. - * - * @return array - * - * @throws ConfigurationLoadingException If environment variable environment var is set to invalid JSON - */ - protected function loadEnvironmentConfiguration() - { - $configs = array(); - - if (!$this->environmentVariable) { - return $configs; - } - - $this->debugInformation['environment_variable_name'] = $this->environmentVariable; - - if ($envConfig = getenv($this->environmentVariable)) { - $config = @json_decode($envConfig, true); - - $this->debugInformation['environment_variable_content'] = $envConfig; - - if (!$config) { - throw new ConfigurationLoadingException(sprintf( - 'Environment variable `%s` should contain a valid JSON, but it is set to `%s`.', - $this->environmentVariable, - $envConfig - )); - } - - $configs[] = $config; - } - - return $configs; - } - - /** - * Loads information from YAML configuration file. - * - * @param string $configPath Config file path - * @param string $profile Profile name - * - * @return array - * - * @throws ConfigurationLoadingException If config file is not found - */ - protected function loadFileConfiguration($configPath, $profile) - { - if (!is_file($configPath) || !is_readable($configPath)) { - throw new ConfigurationLoadingException(sprintf('Configuration file `%s` not found.', $configPath)); - } - - $basePath = rtrim(dirname($configPath), DIRECTORY_SEPARATOR); - $config = (array) Yaml::parse(file_get_contents($configPath)); - - return $this->loadConfigs($basePath, $config, $profile); - } - - /** - * Loads configs for provided config and profile. - * - * @param string $basePath - * @param array $config - * @param string $profile - * - * @return array - */ - private function loadConfigs($basePath, array $config, $profile) - { - $configs = array(); - - // first load default profile from current config, but only if custom profile requested - if ('default' !== $profile && isset($config['default'])) { - $configs[] = $config['default']; - } - - // then recursively load profiles from imports - if (isset($config['imports']) && is_array($config['imports'])) { - $configs = array_merge($configs, $this->loadImports($basePath, $config['imports'], $profile)); - } - - // then load specific profile from current config - if (isset($config[$profile])) { - $configs[] = $config[$profile]; - $this->profileFound = true; - } - - return $configs; - } - - /** - * Loads all provided imports. - * - * @param string $basePath - * @param array $paths - * @param string $profile - * - * @return array - */ - private function loadImports($basePath, array $paths, $profile) - { - $configs = array(); - foreach ($paths as $path) { - foreach ($this->parseImport($basePath, $path, $profile) as $importConfig) { - $configs[] = $importConfig; - } - } - - return $configs; - } - - /** - * Parses import. - * - * @param string $basePath - * @param string $path - * @param string $profile - * - * @return array - * - * @throws ConfigurationLoadingException If import file not found - */ - private function parseImport($basePath, $path, $profile) - { - if (!file_exists($path) && file_exists($basePath . DIRECTORY_SEPARATOR . $path)) { - $path = $basePath . DIRECTORY_SEPARATOR . $path; - } - - if (!file_exists($path)) { - throw new ConfigurationLoadingException(sprintf( - 'Can not import `%s` configuration file. File not found.', - $path - )); - } - - return $this->loadFileConfiguration($path, $profile); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php deleted file mode 100644 index f5b215f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Configuration/ConfigurationTree.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer\Configuration; - -use Behat\Testwork\ServiceContainer\Extension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\Config\Definition\Builder\TreeBuilder; -use Symfony\Component\Config\Definition\NodeInterface; - -/** - * Builds configuration tree using provided lists of core and custom extensions. - * - * @author Konstantin Kudryashov - */ -final class ConfigurationTree -{ - /** - * Generates the configuration tree. - * - * @param Extension[] $extensions - * - * @return NodeInterface - */ - public function getConfigTree(array $extensions) - { - $treeBuilder = new TreeBuilder('testwork'); - /** @var ArrayNodeDefinition $rootNode */ - $rootNode = $treeBuilder->getRootNode(); - - foreach ($extensions as $extension) { - $extension->configure($rootNode->children()->arrayNode($extension->getConfigKey())); - } - - return $treeBuilder->buildTree(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ContainerLoader.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ContainerLoader.php deleted file mode 100644 index a723777..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ContainerLoader.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer; - -use Behat\Testwork\ServiceContainer\Configuration\ConfigurationTree; -use Behat\Testwork\ServiceContainer\Exception\ExtensionException; -use Symfony\Component\Config\Definition\Processor; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; - -/** - * Loads Symfony DI container with testwork extension services. - * - * @author Konstantin Kudryashov - */ -final class ContainerLoader -{ - /** - * @var ExtensionManager - */ - private $extensionManager; - /** - * @var ConfigurationTree - */ - private $configuration; - /** - * @var Processor - */ - private $processor; - - /** - * Initialize extension. - * - * @param ExtensionManager $extensionManager - * @param null|ConfigurationTree $configuration - * @param null|Processor $processor - */ - public function __construct( - ExtensionManager $extensionManager, - ConfigurationTree $configuration = null, - Processor $processor = null - ) { - $this->extensionManager = $extensionManager; - $this->configuration = $configuration ? : new ConfigurationTree(); - $this->processor = $processor ? : new Processor(); - } - - /** - * Loads container extension. - * - * @param ContainerBuilder $container - * @param array $configs - */ - public function load(ContainerBuilder $container, array $configs) - { - $configs = $this->initializeExtensions($container, $configs); - $config = $this->processConfig($configs); - - $this->loadExtensions($container, $config); - } - - /** - * Processes config against extensions. - * - * @param array $configs - * - * @return array - */ - private function processConfig(array $configs) - { - $tree = $this->configuration->getConfigTree($this->extensionManager->getExtensions()); - - return $this->processor->process($tree, $configs); - } - - /** - * Initializes extensions using provided config. - * - * @param ContainerBuilder $container - * @param array $configs - * - * @return array - */ - private function initializeExtensions(ContainerBuilder $container, array $configs) - { - foreach ($configs as $i => $config) { - if (isset($config['extensions'])) { - foreach ($config['extensions'] as $extensionLocator => $extensionConfig) { - $extension = $this->extensionManager->activateExtension($extensionLocator); - $configs[$i][$extension->getConfigKey()] = $extensionConfig; - } - - unset($configs[$i]['extensions']); - } - } - - $this->extensionManager->initializeExtensions(); - - $container->setParameter('extensions', $this->extensionManager->getExtensionClasses()); - - return $configs; - } - - /** - * Loads all extensions into container using provided config. - * - * @param ContainerBuilder $container - * @param array $config - * - * @throws ExtensionException - */ - private function loadExtensions(ContainerBuilder $container, array $config) - { - // Load default extensions first - foreach ($this->extensionManager->getExtensions() as $extension) { - $extensionConfig = array(); - if (isset($config[$extension->getConfigKey()])) { - $extensionConfig = $config[$extension->getConfigKey()]; - unset($config[$extension->getConfigKey()]); - } - - $this->loadExtension($container, $extension, $extensionConfig); - } - - // Load activated extensions - foreach ($config as $extensionConfigKey => $extensionConfig) { - if (null === $extension = $this->extensionManager->getExtension($extensionConfigKey)) { - throw new ExtensionException( - sprintf('None of the activated extensions use `%s` config section.', $extensionConfigKey), $extensionConfigKey - ); - } - - $this->loadExtension($container, $extension, $extensionConfig); - } - } - - /** - * Loads extension configuration. - * - * @param ContainerBuilder $container - * @param Extension $extension - * @param array $config - */ - private function loadExtension(ContainerBuilder $container, Extension $extension, array $config) - { - $tempContainer = new ContainerBuilder(new ParameterBag(array( - 'paths.base' => $container->getParameter('paths.base'), - 'extensions' => $container->getParameter('extensions'), - ))); - $tempContainer->addObjectResource($extension); - $extension->load($container, $config); - $container->merge($tempContainer); - $container->addCompilerPass($extension); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ConfigurationLoadingException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ConfigurationLoadingException.php deleted file mode 100644 index be18620..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ConfigurationLoadingException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer\Exception; - -use InvalidArgumentException; - -/** - * Represents exception thrown during configuration load. - * - * @author Konstantin Kudryashov - */ -final class ConfigurationLoadingException extends InvalidArgumentException implements ServiceContainerException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ExtensionException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ExtensionException.php deleted file mode 100644 index eb4e16d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ExtensionException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer\Exception; - -use RuntimeException; - -/** - * Extension exception. - * - * @author Konstantin Kudryashov - */ -class ExtensionException extends RuntimeException implements ServiceContainerException -{ - /** - * @var string - */ - private $extensionName; - - /** - * Initializes exception. - * - * @param string $message - * @param string $extensionName - */ - public function __construct($message, $extensionName) - { - $this->extensionName = $extensionName; - - parent::__construct($message); - } - - /** - * Returns name of the extension that caused exception. - * - * @return string - */ - public function getExtensionName() - { - return $this->extensionName; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ExtensionInitializationException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ExtensionInitializationException.php deleted file mode 100644 index b57aa66..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ExtensionInitializationException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer\Exception; - -/** - * Represents exception thrown during extension initialization phase. - * - * @author Konstantin Kudryashov - */ -final class ExtensionInitializationException extends ExtensionException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ProcessingException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ProcessingException.php deleted file mode 100644 index b5da8b4..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ProcessingException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer\Exception; - -use RuntimeException; - -/** - * Represents an exception thrown during processing phase. - * - * @author Konstantin Kudryashov - */ -final class ProcessingException extends RuntimeException implements ServiceContainerException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ServiceContainerException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ServiceContainerException.php deleted file mode 100644 index a7035c5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Exception/ServiceContainerException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer\Exception; - -use Behat\Testwork\Exception\TestworkException; - -/** - * Represents service container exception. - * - * @author Konstantin Kudryashov - */ -interface ServiceContainerException extends TestworkException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Extension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Extension.php deleted file mode 100644 index 68e62f5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/Extension.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer; - -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Represents Testwork extension mechanism. - * - * Extensions are the core entities in Testwork. Almost all framework functionality in Testwork and its different - * implementations is provided through extensions. - * - * @author Konstantin Kudryashov - */ -interface Extension extends CompilerPassInterface -{ - /** - * Returns the extension config key. - * - * @return string - */ - public function getConfigKey(); - - /** - * Initializes other extensions. - * - * This method is called immediately after all extensions are activated but - * before any extension `configure()` method is called. This allows extensions - * to hook into the configuration of other extensions providing such an - * extension point. - * - * @param ExtensionManager $extensionManager - */ - public function initialize(ExtensionManager $extensionManager); - - /** - * Setups configuration for the extension. - * - * @param ArrayNodeDefinition $builder - */ - public function configure(ArrayNodeDefinition $builder); - - /** - * Loads extension services into temporary container. - * - * @param ContainerBuilder $container - * @param array $config - */ - public function load(ContainerBuilder $container, array $config); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ExtensionManager.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ExtensionManager.php deleted file mode 100644 index ad49484..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ExtensionManager.php +++ /dev/null @@ -1,231 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer; - -use Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException; - -/** - * Manages both default and 3rd-party extensions. - * - * @author Konstantin Kudryashov - */ -final class ExtensionManager -{ - /** - * @var string - */ - private $extensionsPath; - /** - * @var Extension[] - */ - private $extensions = array(); - /** - * @var Extension[string] - */ - private $locatedExtensions = array(); - private $debugInformation = array( - 'extensions_list' => array() - ); - - /** - * Initializes manager. - * - * @param Extension[] $extensions List of default extensions - * @param null|string $extensionsPath Base path where to search custom extension files - */ - public function __construct(array $extensions, $extensionsPath = null) - { - foreach ($extensions as $extension) { - $this->extensions[$extension->getConfigKey()] = $extension; - } - - $this->extensionsPath = $extensionsPath; - } - - /** - * Sets path to directory in which manager will try to find extension files. - * - * @param null|string $path - */ - public function setExtensionsPath($path) - { - $this->extensionsPath = $path; - } - - /** - * Activate extension by its locator. - * - * @param string $locator phar file name, php file name, class name - * - * @return Extension - */ - public function activateExtension($locator) - { - $extension = $this->initialize($locator); - - $this->debugInformation['extensions_list'][] = $extension->getConfigKey(); - - return $this->extensions[$extension->getConfigKey()] = $extension; - } - - /** - * Returns specific extension by its name. - * - * @param string $key - * - * @return Extension|null - */ - public function getExtension($key) - { - return $this->extensions[$key] ?? null; - } - - /** - * Returns all available extensions. - * - * @return Extension[] - */ - public function getExtensions() - { - return $this->extensions; - } - - /** - * Returns activated extension names. - * - * @return array - */ - public function getExtensionClasses() - { - return array_map('get_class', array_values($this->extensions)); - } - - /** - * Initializes all activated and predefined extensions. - */ - public function initializeExtensions() - { - foreach ($this->extensions as $extension) { - $extension->initialize($this); - } - } - - /** - * Returns array with extensions debug information. - * - * @return array - */ - public function debugInformation() - { - return $this->debugInformation; - } - - /** - * Attempts to guess full extension class from relative. - * - * @param string $locator - * - * @return string - */ - private function getFullExtensionClass($locator) - { - $parts = explode('\\', $locator); - $name = preg_replace('/Extension$/', '', end($parts)) . 'Extension'; - - return $locator . '\\ServiceContainer\\' . $name; - } - - /** - * Initializes extension by id. - * - * @param string $locator - * - * @return Extension - * - * @throws ExtensionInitializationException - */ - private function initialize($locator) - { - if (isset($this->locatedExtensions[$locator])) { - return $this->locatedExtensions[$locator]; - } - - $extension = $this->instantiateExtension($locator); - $this->validateExtensionInstance($extension, $locator); - - return $this->locatedExtensions[$locator] = $extension; - } - - /** - * Instantiates extension from its locator. - * - * @param string $locator - * - * @return Extension - * - * @throws ExtensionInitializationException - */ - private function instantiateExtension($locator) - { - if (class_exists($class = $locator)) { - return new $class; - } - - if (class_exists($class = $this->getFullExtensionClass($locator))) { - return new $class; - } - - if (file_exists($locator)) { - return require($locator); - } - - if (file_exists($path = $this->extensionsPath . DIRECTORY_SEPARATOR . $locator)) { - return require($path); - } - - throw new ExtensionInitializationException(sprintf( - '`%s` extension file or class could not be located.', - $locator - ), $locator); - } - - /** - * Validates extension instance. - * - * @param Extension $extension - * @param string $locator - * - * @throws ExtensionInitializationException - */ - private function validateExtensionInstance($extension, $locator) - { - if (null === $extension) { - throw new ExtensionInitializationException(sprintf( - '`%s` extension could not be found.', - $locator - ), $locator); - } - - if (!is_object($extension)) { - throw new ExtensionInitializationException(sprintf( - '`%s` extension could not be initialized.', - $locator - ), $locator); - } - - if (!$extension instanceof Extension) { - throw new ExtensionInitializationException(sprintf( - '`%s` extension class should implement Testwork Extension interface.', - get_class($extension) - ), $locator); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ServiceProcessor.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ServiceProcessor.php deleted file mode 100644 index a57810e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/ServiceContainer/ServiceProcessor.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\ServiceContainer; - -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides additional service finding functionality. - * - * @author Konstantin Kudryashov - * @author Christophe Coevoet - */ -final class ServiceProcessor -{ - /** - * Finds and sorts (by priority) service references by provided tag. - * - * @param ContainerBuilder $container - * @param string $tag - * - * @return Reference[] - */ - public function findAndSortTaggedServices(ContainerBuilder $container, $tag) - { - $serviceTags = array(); - foreach ($container->findTaggedServiceIds($tag) as $id => $tags) { - $firstTags = current($tags); - - $serviceTags[] = array_merge(array('priority' => 0), $firstTags, array('id' => $id)); - } - - usort($serviceTags, function ($tag1, $tag2) { return $tag2['priority'] - $tag1['priority']; }); - $serviceReferences = array_map(function ($tag) { return new Reference($tag['id']); }, $serviceTags); - - return $serviceReferences; - } - - /** - * Processes wrappers of a service, found by provided tag. - * - * The wrappers are applied by descending priority. - * The first argument of the wrapper service receives the inner service. - * - * @param ContainerBuilder $container - * @param string $target The id of the service being decorated - * @param string $wrapperTag The tag used by wrappers - */ - public function processWrapperServices(ContainerBuilder $container, $target, $wrapperTag) - { - $references = $this->findAndSortTaggedServices($container, $wrapperTag); - - foreach ($references as $reference) { - $id = (string) $reference; - $renamedId = $id . '.inner'; - - // This logic is based on Symfony\Component\DependencyInjection\Compiler\DecoratorServicePass - - // we create a new alias/service for the service we are replacing - // to be able to reference it in the new one - if ($container->hasAlias($target)) { - $alias = $container->getAlias($target); - $public = $alias->isPublic(); - $container->setAlias($renamedId, new Alias((string) $alias, false)); - } else { - $definition = $container->getDefinition($target); - $public = $definition->isPublic(); - $definition->setPublic(false); - $container->setDefinition($renamedId, $definition); - } - - $container->setAlias($target, new Alias($id, $public)); - // Replace the reference so that users don't need to bother about the way the inner service is referenced - $wrappingService = $container->getDefinition($id); - $wrappingService->replaceArgument(0, new Reference($renamedId)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/GroupedSpecificationIterator.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/GroupedSpecificationIterator.php deleted file mode 100644 index 8975040..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/GroupedSpecificationIterator.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Specification; - -use Behat\Testwork\Suite\Suite; - -/** - * Iterates over specification iterators grouped by their suite. - * - * @author Konstantin Kudryashov - */ -final class GroupedSpecificationIterator implements SpecificationIterator -{ - /** - * @var Suite - */ - private $suite; - /** - * @var SpecificationIterator[] - */ - private $iterators; - /** - * @var integer - */ - private $position = 0; - - /** - * Initializes iterator. - * - * @param Suite $suite - * @param SpecificationIterator[] $specificationIterators - */ - public function __construct(Suite $suite, array $specificationIterators) - { - $this->suite = $suite; - $this->iterators = $specificationIterators; - } - - /** - * Groups specifications by their suite. - * - * @param SpecificationIterator[] $specificationIterators - * - * @return GroupedSpecificationIterator[] - */ - public static function group(array $specificationIterators) - { - $groupedSpecifications = array(); - foreach ($specificationIterators as $specificationIterator) { - $groupedSpecifications[$specificationIterator->getSuite()->getName()][] = $specificationIterator; - } - - return array_map( - function ($iterator) { - return new GroupedSpecificationIterator($iterator[0]->getSuite(), $iterator); - }, - $groupedSpecifications - ); - } - - /** - * {@inheritdoc} - */ - public function getSuite() - { - return $this->suite; - } - - /** - * {@inheritdoc} - */ - public function rewind(): void - { - $this->position = 0; - while (isset($this->iterators[$this->position])) { - $this->iterators[$this->position]->rewind(); - - if ($this->iterators[$this->position]->valid()) { - break; - } - $this->position++; - } - } - - /** - * {@inheritdoc} - */ - public function next(): void - { - if (!isset($this->iterators[$this->position])) { - return; - } - - $this->iterators[$this->position]->next(); - while (!$this->iterators[$this->position]->valid()) { - $this->position++; - - if (!isset($this->iterators[$this->position])) { - break; - } - - $this->iterators[$this->position]->rewind(); - } - } - - /** - * {@inheritdoc} - */ - public function valid(): bool - { - return isset($this->iterators[$this->position]) && $this->iterators[$this->position]->valid(); - } - - /** - * {@inheritdoc} - */ - #[\ReturnTypeWillChange] - public function current() - { - return $this->iterators[$this->position]->current(); - } - - /** - * {@inheritdoc} - */ - public function key(): int - { - return $this->position + $this->iterators[$this->position]->key(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/Locator/SpecificationLocator.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/Locator/SpecificationLocator.php deleted file mode 100644 index 372fbea..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/Locator/SpecificationLocator.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Specification\Locator; - -use Behat\Testwork\Specification\SpecificationFinder; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Suite\Suite; - -/** - * Provides a custom way to locate specification by provided suite and locator string. - * - * @see SpecificationFinder - * - * @author Konstantin Kudryashov - */ -interface SpecificationLocator -{ - /** - * Returns array of strings representing examples of supported specification locators. - * - * @return string[] - */ - public function getLocatorExamples(); - - /** - * Locates specifications and wraps them into iterator. - * - * @param Suite $suite - * @param string $locator - * - * @return SpecificationIterator - */ - public function locateSpecifications(Suite $suite, $locator); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/NoSpecificationsIterator.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/NoSpecificationsIterator.php deleted file mode 100644 index 95cfc6a..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/NoSpecificationsIterator.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Specification; - -use Behat\Testwork\Suite\Suite; -use EmptyIterator; - -/** - * Represents empty specification iterator. - * - * Return an instance of this class from locator if no specifications are found. - * - * @author Konstantin Kudryashov - */ -final class NoSpecificationsIterator extends EmptyIterator implements SpecificationIterator -{ - /** - * @var Suite - */ - private $suite; - - /** - * Initializes iterator. - * - * @param Suite $suite - */ - public function __construct(Suite $suite) - { - $this->suite = $suite; - } - - /** - * Returns suite that was used to load subjects. - * - * @return Suite - */ - public function getSuite() - { - return $this->suite; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/ServiceContainer/SpecificationExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/ServiceContainer/SpecificationExtension.php deleted file mode 100644 index d369d45..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/ServiceContainer/SpecificationExtension.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Specification\ServiceContainer; - -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; - -/** - * Extends testwork with test specification services. - * - * @author Konstantin Kudryashov - */ -final class SpecificationExtension implements Extension -{ - /* - * Available services - */ - public const FINDER_ID = 'specifications.finder'; - - /* - * Available extension points - */ - public const LOCATOR_TAG = 'specifications.locator'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'specifications'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadFinder($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processLocators($container); - } - - /** - * Loads specification finder. - * - * @param ContainerBuilder $container - */ - private function loadFinder(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Specification\SpecificationFinder'); - $container->setDefinition(self::FINDER_ID, $definition); - } - - /** - * Processes specification locators. - * - * @param ContainerBuilder $container - */ - private function processLocators(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::LOCATOR_TAG); - $definition = $container->getDefinition(self::FINDER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerSpecificationLocator', array($reference)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationArrayIterator.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationArrayIterator.php deleted file mode 100644 index c48292d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationArrayIterator.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Specification; - -use ArrayIterator; -use Behat\Testwork\Suite\Suite; - -/** - * Iterates over specifications array. - * - * Return instance of this class from locator if specifications cannot be searched lazily. - * - * @author Christophe Coevoet - */ -final class SpecificationArrayIterator extends ArrayIterator implements SpecificationIterator -{ - /** - * @var Suite - */ - private $suite; - - /** - * Initializes iterator. - * - * @param Suite $suite - * @param mixed[] $specifications - */ - public function __construct(Suite $suite, $specifications = array()) - { - $this->suite = $suite; - - parent::__construct($specifications); - } - - /** - * {@inheritdoc} - */ - public function getSuite() - { - return $this->suite; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationFinder.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationFinder.php deleted file mode 100644 index 5204bd5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationFinder.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Specification; - -use Behat\Testwork\Specification\Locator\SpecificationLocator; -use Behat\Testwork\Suite\Suite; - -/** - * Finds test specifications for provided suites using registered locators. - * - * @author Konstantin Kudryashov - */ -final class SpecificationFinder -{ - /** - * @var SpecificationLocator[] - */ - private $specificationLocators = array(); - - /** - * Registers specification locator. - * - * @param SpecificationLocator $locator - */ - public function registerSpecificationLocator(SpecificationLocator $locator) - { - $this->specificationLocators[] = $locator; - } - - /** - * Returns array of strings representing examples of supported specification locators. - * - * @return string[] - */ - public function getExampleLocators() - { - $examples = array(); - foreach ($this->specificationLocators as $locator) { - $examples = array_merge($examples, $locator->getLocatorExamples()); - } - - return $examples; - } - - /** - * Finds all specifications for all provided suites matching provided locator and wraps them into a spec iterator. - * - * @param Suite[] $suites - * @param null|string $locator - * - * @return SpecificationIterator[] - */ - public function findSuitesSpecifications(array $suites, $locator = null) - { - $iterators = array(); - foreach ($suites as $suite) { - $iterators = array_merge($iterators, $this->findSuiteSpecifications($suite, $locator)); - } - - return $iterators; - } - - /** - * Creates suite specification iterator for provided locator. - * - * @param Suite $suite - * @param null|string $locator - * - * @return SpecificationIterator[] - */ - private function findSuiteSpecifications(Suite $suite, $locator = null) - { - $iterators = array(); - foreach ($this->specificationLocators as $specificationLocator) { - $iterators[] = $specificationLocator->locateSpecifications($suite, $locator); - } - - return $iterators; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationIterator.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationIterator.php deleted file mode 100644 index c96ad6c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Specification/SpecificationIterator.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Specification; - -use Behat\Testwork\Suite\Suite; -use Iterator; - -/** - * Iterates over test specifications. - * - * @author Konstantin Kudryashov - */ -interface SpecificationIterator extends Iterator -{ - /** - * Returns suite that was used to load specifications. - * - * @return Suite - */ - public function getSuite(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Cli/InitializationController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Cli/InitializationController.php deleted file mode 100644 index dc8ac0c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Cli/InitializationController.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Cli; - -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\Suite\SuiteBootstrapper; -use Behat\Testwork\Suite\SuiteRepository; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Initializes registered test suites. - * - * @author Konstantin Kudryashov - */ -final class InitializationController implements Controller -{ - /** - * @var SuiteRepository - */ - private $repository; - /** - * @var SuiteBootstrapper - */ - private $bootstrapper; - - /** - * Initializes controller. - * - * @param SuiteRepository $repository - * @param SuiteBootstrapper $bootstrapper - */ - public function __construct(SuiteRepository $repository, SuiteBootstrapper $bootstrapper) - { - $this->repository = $repository; - $this->bootstrapper = $bootstrapper; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - $command->addOption('--init', null, InputOption::VALUE_NONE, - 'Initialize all registered test suites.' - ); - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - if (!$input->getOption('init')) { - return null; - } - - $suites = $this->repository->getSuites(); - $this->bootstrapper->bootstrapSuites($suites); - - $output->write(PHP_EOL); - - return 0; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Cli/SuiteController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Cli/SuiteController.php deleted file mode 100644 index ea1a23a..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Cli/SuiteController.php +++ /dev/null @@ -1,83 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Cli; - -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\Suite\Exception\SuiteNotFoundException; -use Behat\Testwork\Suite\SuiteRegistry; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Sets up registered test suites. - * - * @author Konstantin Kudryashov - */ -final class SuiteController implements Controller -{ - /** - * @var SuiteRegistry - */ - private $registry; - /** - * @var array - */ - private $suiteConfigurations = array(); - - /** - * Initializes controller. - * - * @param SuiteRegistry $registry - * @param array $suiteConfigurations - */ - public function __construct(SuiteRegistry $registry, array $suiteConfigurations) - { - $this->registry = $registry; - $this->suiteConfigurations = $suiteConfigurations; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - $command->addOption('--suite', '-s', InputOption::VALUE_REQUIRED, - 'Only execute a specific suite.' - ); - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $exerciseSuiteName = $input->getOption('suite'); - - if (null !== $exerciseSuiteName && !isset($this->suiteConfigurations[$exerciseSuiteName])) { - throw new SuiteNotFoundException(sprintf( - '`%s` suite is not found or has not been properly registered.', - $exerciseSuiteName - ), $exerciseSuiteName); - } - - foreach ($this->suiteConfigurations as $name => $config) { - if (null !== $exerciseSuiteName && $exerciseSuiteName !== $name) { - continue; - } - - $this->registry->registerSuiteConfiguration( - $name, $config['type'], $config['settings'] - ); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/ParameterNotFoundException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/ParameterNotFoundException.php deleted file mode 100644 index 5005884..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/ParameterNotFoundException.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Exception; - -/** - * Represents an exception thrown when user tries to access non-existent suite parameter. - * - * @author Konstantin Kudryashov - */ -final class ParameterNotFoundException extends SuiteException -{ - /** - * @var string - */ - private $parameter; - - /** - * Initializes exception. - * - * @param string $message - * @param string $name - * @param string $parameter - */ - public function __construct($message, $name, $parameter) - { - $this->parameter = $parameter; - - parent::__construct($message, $name); - } - - /** - * Returns parameter that caused exception. - * - * @return string - */ - public function getParameter() - { - return $this->parameter; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteConfigurationException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteConfigurationException.php deleted file mode 100644 index 73f366c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteConfigurationException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Exception; - -/** - * Represents an exception throw during suite configuration phase. - * - * @author Konstantin Kudryashov - */ -final class SuiteConfigurationException extends SuiteException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteException.php deleted file mode 100644 index 2027089..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteException.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Exception; - -use Behat\Testwork\Exception\TestworkException; -use Exception; -use InvalidArgumentException; - -/** - * Represents a suite exception. - * - * @author Konstantin Kudryashov - */ -class SuiteException extends InvalidArgumentException implements TestworkException -{ - /** - * @var string - */ - private $name; - - /** - * Initializes exception. - * - * @param string $message - * @param string $name - * @param Exception|null $previous - */ - public function __construct($message, $name, Exception $previous = null) - { - $this->name = $name; - - parent::__construct($message, 0, $previous); - } - - /** - * Returns name of the suite that caused exception. - * - * @return string - */ - public function getSuiteName() - { - return $this->name; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteGenerationException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteGenerationException.php deleted file mode 100644 index d6b418b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteGenerationException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Exception; - -/** - * Represents a suite exception thrown during suite generation phase. - * - * @author Konstantin Kudryashov - */ -final class SuiteGenerationException extends SuiteException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteNotFoundException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteNotFoundException.php deleted file mode 100644 index 95e0244..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteNotFoundException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Exception; - -/** - * Represents an exception thrown when trying to access non-registered suite. - * - * @author Konstantin Kudryashov - */ -final class SuiteNotFoundException extends SuiteException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteSetupException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteSetupException.php deleted file mode 100644 index 5ceeb7e..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Exception/SuiteSetupException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Exception; - -/** - * Represents a suite exception thrown during a suite setup phase. - * - * @author Konstantin Kudryashov - */ -final class SuiteSetupException extends SuiteException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Generator/GenericSuiteGenerator.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Generator/GenericSuiteGenerator.php deleted file mode 100644 index 36f6141..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Generator/GenericSuiteGenerator.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Generator; - -use Behat\Testwork\Suite\GenericSuite; - -/** - * Generates generic test suites. - * - * @author Konstantin Kudryashov - */ -final class GenericSuiteGenerator implements SuiteGenerator -{ - /** - * @var array - */ - private $defaultSettings = array(); - - /** - * Initializes suite generator. - * - * @param array $defaultSettings - */ - public function __construct(array $defaultSettings = array()) - { - $this->defaultSettings = $defaultSettings; - } - - /** - * {@inheritdoc} - */ - public function supportsTypeAndSettings($type, array $settings) - { - return null === $type; - } - - /** - * {@inheritdoc} - */ - public function generateSuite($suiteName, array $settings) - { - return new GenericSuite($suiteName, $this->mergeDefaultSettings($settings)); - } - - /** - * Merges provided settings into default ones. - * - * @param array $settings - * - * @return array - */ - private function mergeDefaultSettings(array $settings) - { - return array_merge($this->defaultSettings, $settings); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php deleted file mode 100644 index 5d89346..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Generator/SuiteGenerator.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Generator; - -use Behat\Testwork\Suite\Suite; -use Behat\Testwork\Suite\SuiteRegistry; - -/** - * Generates a suite using provided name, settings and parameters. - * - * @see SuiteRegistry - * - * @author Konstantin Kudryashov - */ -interface SuiteGenerator -{ - /** - * Checks if generator support provided suite type and settings. - * - * @param string $type - * @param array $settings - * - * @return bool - */ - public function supportsTypeAndSettings($type, array $settings); - - /** - * Generate suite with provided name and settings. - * - * @param string $suiteName - * @param array $settings - * - * @return Suite - */ - public function generateSuite($suiteName, array $settings); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/GenericSuite.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/GenericSuite.php deleted file mode 100644 index 1c6702b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/GenericSuite.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite; - -use Behat\Testwork\Suite\Exception\ParameterNotFoundException; - -/** - * Represents generic (no specific attributes) test suite. - * - * @author Konstantin Kudryashov - */ -final class GenericSuite implements Suite -{ - /** - * @var string - */ - private $name; - /** - * @var array - */ - private $settings = array(); - - /** - * Initializes suite. - * - * @param string $name - * @param array $settings - */ - public function __construct($name, array $settings) - { - $this->name = $name; - $this->settings = $settings; - } - - /** - * Returns unique suite name. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Returns suite settings. - * - * @return array - */ - public function getSettings() - { - return $this->settings; - } - - /** - * Checks if a setting with provided name exists. - * - * @param string $key - * - * @return bool - */ - public function hasSetting($key) - { - return array_key_exists($key, $this->settings); - } - - /** - * Returns setting value by its key. - * - * @param string $key - * - * @return mixed - * - * @throws ParameterNotFoundException If setting is not set - */ - public function getSetting($key) - { - if (!$this->hasSetting($key)) { - throw new ParameterNotFoundException(sprintf( - '`%s` suite does not have a `%s` setting.', - $this->getName(), - $key - ), $this->getName(), $key); - } - - return $this->settings[$key]; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/ServiceContainer/SuiteExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/ServiceContainer/SuiteExtension.php deleted file mode 100644 index 804cb92..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/ServiceContainer/SuiteExtension.php +++ /dev/null @@ -1,272 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Extends testwork with suite-related services. - * - * @author Konstantin Kudryashov - */ -final class SuiteExtension implements Extension -{ - /* - * Available services - */ - public const REGISTRY_ID = 'suite.registry'; - public const BOOTSTRAPPER_ID = 'suite.bootstrapper'; - - /* - * Available extension points - */ - public const GENERATOR_TAG = 'suite.generator'; - public const SETUP_TAG = 'suite.setup'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'suites'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - $builder - ->defaultValue(array('default' => array( - 'enabled' => true, - 'type' => null, - 'settings' => array() - ))) - ->treatNullLike(array()) - ->treatFalseLike(array()) - ->useAttributeAsKey('name') - ->normalizeKeys(false) - ->prototype('array') - ->beforeNormalization() - ->ifTrue(function ($suite) { - return is_array($suite) && count($suite); - }) - ->then(function ($suite) { - $suite['settings'] = $suite['settings'] ?? array(); - - foreach ($suite as $key => $val) { - $suiteKeys = array('enabled', 'type', 'settings'); - if (!in_array($key, $suiteKeys)) { - $suite['settings'][$key] = $val; - unset($suite[$key]); - } - } - - return $suite; - }) - ->end() - ->normalizeKeys(false) - ->addDefaultsIfNotSet() - ->treatTrueLike(array('enabled' => true)) - ->treatNullLike(array('enabled' => true)) - ->treatFalseLike(array('enabled' => false)) - ->children() - ->booleanNode('enabled') - ->info('Enables/disables suite') - ->defaultTrue() - ->end() - ->scalarNode('type') - ->info('Specifies suite type') - ->defaultValue(null) - ->end() - ->arrayNode('settings') - ->info('Specifies suite extra settings') - ->defaultValue(array()) - ->useAttributeAsKey('name') - ->prototype('variable')->end() - ->end() - ->end() - ->end() - ; - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->setSuiteConfigurations($container, $config); - $this->loadRegistryController($container); - $this->loadBootstrapController($container); - $this->loadRegistry($container); - $this->loadBootstrapper($container); - $this->loadGenericSuiteGenerator($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processGenerators($container); - $this->processSetups($container); - } - - /** - * Generates and sets suites parameter to container. - * - * @param ContainerBuilder $container - * @param array $suites - */ - private function setSuiteConfigurations(ContainerBuilder $container, array $suites) - { - $configuredSuites = array(); - foreach ($suites as $name => $config) { - if (!$config['enabled']) { - continue; - } - - $configuredSuites[$name] = array( - 'type' => $config['type'], - 'settings' => $config['settings'], - ); - } - - $container->setParameter('suite.configurations', $configuredSuites); - } - - /** - * Loads suite registry controller. - * - * @param ContainerBuilder $container - */ - private function loadRegistryController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Suite\Cli\SuiteController', array( - new Reference(self::REGISTRY_ID), - '%suite.configurations%' - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 1100)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.suite', $definition); - } - - /** - * Loads suite bootstrap controller. - * - * @param ContainerBuilder $container - */ - private function loadBootstrapController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Suite\Cli\InitializationController', array( - new Reference(self::REGISTRY_ID), - new Reference(self::BOOTSTRAPPER_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 900)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.initialization', $definition); - } - - /** - * Loads suite registry. - * - * @param ContainerBuilder $container - */ - private function loadRegistry(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Suite\SuiteRegistry'); - $container->setDefinition(self::REGISTRY_ID, $definition); - } - - /** - * Loads suite bootstrapper. - * - * @param ContainerBuilder $container - */ - private function loadBootstrapper(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Suite\SuiteBootstrapper'); - $container->setDefinition(self::BOOTSTRAPPER_ID, $definition); - } - - /** - * Loads generic suite generator. - * - * @param ContainerBuilder $container - */ - private function loadGenericSuiteGenerator(ContainerBuilder $container) - { - $container->setParameter('suite.generic.default_settings', array()); - - $definition = new Definition('Behat\Testwork\Suite\Generator\GenericSuiteGenerator', array( - '%suite.generic.default_settings%' - )); - $definition->addTag(SuiteExtension::GENERATOR_TAG, array('priority' => 50)); - $container->setDefinition(SuiteExtension::GENERATOR_TAG . '.generic', $definition); - } - - /** - * Processes suite generators. - * - * @param ContainerBuilder $container - */ - private function processGenerators(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::GENERATOR_TAG); - $definition = $container->getDefinition(self::REGISTRY_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerSuiteGenerator', array($reference)); - } - } - - /** - * Processes suite setups. - * - * @param ContainerBuilder $container - */ - private function processSetups(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::SETUP_TAG); - $definition = $container->getDefinition(self::BOOTSTRAPPER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerSuiteSetup', array($reference)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Setup/SuiteSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Setup/SuiteSetup.php deleted file mode 100644 index 75eef7c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Setup/SuiteSetup.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite\Setup; - -use Behat\Testwork\Suite\Suite; -use Behat\Testwork\Suite\SuiteBootstrapper; - -/** - * Sets up supported test suite. - * - * @see SuiteBootstrapper - * - * @author Konstantin Kudryashov - */ -interface SuiteSetup -{ - /** - * Checks if setup supports provided suite. - * - * @param Suite $suite - * - * @return bool - */ - public function supportsSuite(Suite $suite); - - /** - * Sets up provided suite. - * - * @param Suite $suite - */ - public function setupSuite(Suite $suite); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Suite.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Suite.php deleted file mode 100644 index e26c161..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/Suite.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite; - -/** - * Represents a Testwork suite. Suite is a collection of tests. - * - * @author Konstantin Kudryashov - */ -interface Suite -{ - /** - * Returns unique suite name. - * - * @return string - */ - public function getName(); - - /** - * Returns suite settings. - * - * @return array - */ - public function getSettings(); - - /** - * Checks if a setting with provided name exists. - * - * @param string $key - * - * @return bool - */ - public function hasSetting($key); - - /** - * Returns setting value by its key. - * - * @param string $key - * - * @return mixed - */ - public function getSetting($key); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteBootstrapper.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteBootstrapper.php deleted file mode 100644 index 28d0af1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteBootstrapper.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite; - -use Behat\Testwork\Suite\Setup\SuiteSetup; - -/** - * Configures provided suites using registered suite setups. - * - * @author Konstantin Kudryashov - */ -final class SuiteBootstrapper -{ - /** - * @var SuiteSetup[] - */ - private $setups = array(); - - /** - * Registers suite setup. - * - * @param SuiteSetup $setup - */ - public function registerSuiteSetup(SuiteSetup $setup) - { - $this->setups[] = $setup; - } - - /** - * Bootstraps provided suites using registered setups. - * - * @param Suite[] $suites - */ - public function bootstrapSuites(array $suites) - { - array_map(array($this, 'bootstrapSuite'), $suites); - } - - /** - * Bootstraps provided suite using registered setup. - * - * @param Suite $suite - */ - public function bootstrapSuite(Suite $suite) - { - foreach ($this->setups as $setup) { - if ($setup->supportsSuite($suite)) { - $setup->setupSuite($suite); - } - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteRegistry.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteRegistry.php deleted file mode 100644 index b5f90df..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteRegistry.php +++ /dev/null @@ -1,125 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite; - -use Behat\Testwork\Suite\Exception\SuiteConfigurationException; -use Behat\Testwork\Suite\Exception\SuiteGenerationException; -use Behat\Testwork\Suite\Generator\SuiteGenerator; - -/** - * Acts like a suite repository by auto-generating suites for registered suite configurations using registered - * generators. - * - * @author Konstantin Kudryashov - */ -final class SuiteRegistry implements SuiteRepository -{ - /** - * @var bool - */ - private $suitesGenerated = false; - /** - * @var SuiteGenerator[] - */ - private $generators = array(); - /** - * @var array - */ - private $suiteConfigurations = array(); - /** - * @var Suite[] - */ - private $suites = array(); - - /** - * Registers suite generator. - * - * @param SuiteGenerator $generator - */ - public function registerSuiteGenerator(SuiteGenerator $generator) - { - $this->generators[] = $generator; - $this->suitesGenerated = false; - } - - /** - * Registers suite using provided name, type & parameters. - * - * @param string $name - * @param string $type - * @param array $settings - * - * @throws SuiteConfigurationException - */ - public function registerSuiteConfiguration($name, $type, array $settings) - { - if (isset($this->suiteConfigurations[$name])) { - throw new SuiteConfigurationException(sprintf( - 'Suite configuration for a suite "%s" is already registered.', - $name - ), $name); - } - - $this->suiteConfigurations[$name] = array($type, $settings); - $this->suitesGenerated = false; - } - - /** - * Returns all available suites. - * - * @return Suite[] - */ - public function getSuites() - { - if ($this->suitesGenerated) { - return $this->suites; - } - - $this->suites = array(); - foreach ($this->suiteConfigurations as $name => $configuration) { - list($type, $settings) = $configuration; - - $this->suites[] = $this->generateSuite($name, $type, $settings); - } - - $this->suitesGenerated = true; - - return $this->suites; - } - - /** - * Generates suite using registered generators. - * - * @param string $name - * @param string $type - * @param array $settings - * - * @return Suite - * - * @throws SuiteGenerationException If no appropriate generator found - */ - private function generateSuite($name, $type, array $settings) - { - foreach ($this->generators as $generator) { - if (!$generator->supportsTypeAndSettings($type, $settings)) { - continue; - } - - return $generator->generateSuite($name, $settings); - } - - throw new SuiteGenerationException(sprintf( - 'Can not find suite generator for a suite `%s` of type `%s`.', - $name, - $type - ), $name); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteRepository.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteRepository.php deleted file mode 100644 index 7795cc9..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Suite/SuiteRepository.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Suite; - -/** - * Represents a way to retrieve suites. - * - * @author Konstantin Kudryashov - */ -interface SuiteRepository -{ - /** - * Returns all available suites. - * - * @return Suite[] - */ - public function getSuites(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php deleted file mode 100644 index 2fc5642..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/ExerciseController.php +++ /dev/null @@ -1,179 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Cli; - -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\Specification\SpecificationFinder; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Suite\Suite; -use Behat\Testwork\Suite\SuiteRepository; -use Behat\Testwork\Tester\Exception\WrongPathsException; -use Behat\Testwork\Tester\Exercise; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\ResultInterpreter; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestResults; -use Behat\Testwork\Tester\Result\TestWithSetupResult; -use Symfony\Component\Console\Command\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; - -/** - * Executes exercise. - * - * @author Konstantin Kudryashov - */ -final class ExerciseController implements Controller -{ - /** - * @var SuiteRepository - */ - private $suiteRepository; - /** - * @var SpecificationFinder - */ - private $specificationFinder; - /** - * @var Exercise - */ - private $exercise; - /** - * @var ResultInterpreter - */ - private $resultInterpreter; - /** - * @var bool - */ - private $skip; - - /** - * Initializes controller. - * - * @param SuiteRepository $suiteRepository - * @param SpecificationFinder $specificationFinder - * @param Exercise $exercise - * @param ResultInterpreter $resultInterpreter - * @param bool $skip - */ - public function __construct( - SuiteRepository $suiteRepository, - SpecificationFinder $specificationFinder, - Exercise $exercise, - ResultInterpreter $resultInterpreter, - $skip = false - ) { - $this->suiteRepository = $suiteRepository; - $this->specificationFinder = $specificationFinder; - $this->exercise = $exercise; - $this->resultInterpreter = $resultInterpreter; - $this->skip = $skip; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - $locatorsExamples = implode(PHP_EOL, array_map( - function ($locator) { - return '- ' . $locator; - }, $this->specificationFinder->getExampleLocators() - )); - - $command - ->addArgument('paths', InputArgument::OPTIONAL, - 'Optional path(s) to execute. Could be:' . PHP_EOL . $locatorsExamples - ) - ->addOption('--dry-run', null, InputOption::VALUE_NONE, - 'Invokes formatters without executing the tests and hooks.' - ); - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - $specs = $this->findSpecifications($input); - $result = $this->testSpecifications($input, $specs); - - if ($input->getArgument('paths') && TestResults::NO_TESTS === $result->getResultCode()) { - throw new WrongPathsException( - sprintf( - 'No specifications found at path(s) `%s`. This might be because of incorrect paths configuration in your `suites`.', - $input->getArgument('paths') - ), - $input->getArgument('paths') - ); - } - - return $this->resultInterpreter->interpretResult($result); - } - - /** - * Finds exercise specifications. - * - * @param InputInterface $input - * - * @return SpecificationIterator[] - */ - private function findSpecifications(InputInterface $input) - { - return $this->findSuitesSpecifications($this->getAvailableSuites(), $input->getArgument('paths')); - } - - /** - * Tests exercise specifications. - * - * @param InputInterface $input - * @param SpecificationIterator[] $specifications - * - * @return TestResult - */ - private function testSpecifications(InputInterface $input, array $specifications) - { - $skip = $input->getOption('dry-run') || $this->skip; - - $setup = $this->exercise->setUp($specifications, $skip); - $skip = !$setup->isSuccessful() || $skip; - $testResult = $this->exercise->test($specifications, $skip); - $teardown = $this->exercise->tearDown($specifications, $skip, $testResult); - - $result = new IntegerTestResult($testResult->getResultCode()); - - return new TestWithSetupResult($setup, $result, $teardown); - } - - /** - * Returns all currently available suites. - * - * @return Suite[] - */ - private function getAvailableSuites() - { - return $this->suiteRepository->getSuites(); - } - - /** - * Finds specification iterators for all provided suites using locator. - * - * @param Suite[] $suites - * @param null|string $locator - * - * @return SpecificationIterator[] - */ - private function findSuitesSpecifications($suites, $locator) - { - return $this->specificationFinder->findSuitesSpecifications($suites, $locator); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/StrictController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/StrictController.php deleted file mode 100644 index 697b881..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Cli/StrictController.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Cli; - -use Behat\Testwork\Cli\Controller; -use Behat\Testwork\Tester\Result\Interpretation\StrictInterpretation; -use Behat\Testwork\Tester\Result\ResultInterpreter; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Configures Testwork to interpret test results strictly. - * - * @author Konstantin Kudryashov - */ -final class StrictController implements Controller -{ - /** - * @var ResultInterpreter - */ - private $resultInterpreter; - /** - * @var bool - */ - private $strict; - - /** - * Initializes controller. - * - * @param ResultInterpreter $resultInterpreter - * @param bool $strict - */ - public function __construct(ResultInterpreter $resultInterpreter, $strict = false) - { - $this->resultInterpreter = $resultInterpreter; - $this->strict = $strict; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - $command->addOption('--strict', null, InputOption::VALUE_NONE, - 'Passes only if all tests are explicitly passing.' - ); - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - if (!$this->strict && !$input->getOption('strict')) { - return; - } - - $this->resultInterpreter->registerResultInterpretation(new StrictInterpretation()); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exception/TesterException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exception/TesterException.php deleted file mode 100644 index 2bede7c..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exception/TesterException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Exception; - -/** - * Represents an exception caused by a tester. - * - * @author Konstantin Kudryashov - */ -interface TesterException -{ -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exception/WrongPathsException.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exception/WrongPathsException.php deleted file mode 100644 index c429957..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exception/WrongPathsException.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Exception; - -use Symfony\Component\DependencyInjection\Exception\RuntimeException; - -/** - * Represents exception caused by a wrong paths argument. - * - * @author Konstantin Kudryashov - */ -final class WrongPathsException extends RuntimeException implements TesterException -{ - /** - * @var string - */ - private $path; - - /** - * Initializes exception. - * - * @param string $message - * @param string $path - */ - public function __construct($message, $path) - { - parent::__construct($message); - - $this->path = $path; - } - - /** - * Returns path that caused exception. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exercise.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exercise.php deleted file mode 100644 index e63883d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Exercise.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester; - -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Prepares and tests provided exercise specifications. - * - * @author Konstantin Kudryashov - */ -interface Exercise -{ - /** - * Sets up exercise for a test. - * - * @param SpecificationIterator[] $iterators - * @param bool $skip - * - * @return Setup - */ - public function setUp(array $iterators, $skip); - - /** - * Tests suites specifications. - * - * @param SpecificationIterator[] $iterators - * @param bool $skip - * - * @return TestResult - */ - public function test(array $iterators, $skip); - - /** - * Tears down exercise after a test. - * - * @param SpecificationIterator[] $iterators - * @param bool $skip - * @param TestResult $result - * - * @return Teardown - */ - public function tearDown(array $iterators, $skip, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/ExceptionResult.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/ExceptionResult.php deleted file mode 100644 index 1b724f5..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/ExceptionResult.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result; - -use Exception; - -/** - * Represents a result, that possibly produced an exception. - * - * @author Konstantin Kudryashov - */ -interface ExceptionResult extends TestResult -{ - /** - * Checks that the test result has exception. - * - * @return bool - */ - public function hasException(); - - /** - * Returns exception that test result has. - * - * @return null|Exception - */ - public function getException(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/IntegerTestResult.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/IntegerTestResult.php deleted file mode 100644 index 8dad2fc..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/IntegerTestResult.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result; - -/** - * Represents an integer test result. - * - * @author Konstantin Kudryashov - */ -final class IntegerTestResult implements TestResult -{ - /** - * @var integer - */ - private $resultCode; - - /** - * Initializes test result. - * - * @param integer $resultCode - */ - public function __construct($resultCode) - { - $this->resultCode = $resultCode; - } - - /** - * {@inheritdoc} - */ - public function isPassed() - { - return self::PASSED == $this->getResultCode(); - } - - /** - * {@inheritdoc} - */ - public function getResultCode() - { - return $this->resultCode; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php deleted file mode 100644 index cc92509..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/ResultInterpretation.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result\Interpretation; - -use Behat\Testwork\Tester\Result\ResultInterpreter; -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Interprets particular test result by saying if it's failure or not. - * - * @see ResultInterpreter - * - * @author Konstantin Kudryashov - */ -interface ResultInterpretation -{ - /** - * Checks if provided test result should be considered as a failure. - * - * @param TestResult $result - * - * @return bool - */ - public function isFailure(TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/SoftInterpretation.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/SoftInterpretation.php deleted file mode 100644 index fca891b..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/SoftInterpretation.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result\Interpretation; - -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Interprets test results softly - everything that is not an explicit failure is a pass. - * - * @author Konstantin Kudryashov - */ -final class SoftInterpretation implements ResultInterpretation -{ - /** - * {@inheritdoc} - */ - public function isFailure(TestResult $result) - { - return TestResult::FAILED <= $result->getResultCode(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/StrictInterpretation.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/StrictInterpretation.php deleted file mode 100644 index 0a43d8d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/Interpretation/StrictInterpretation.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result\Interpretation; - -use Behat\Testwork\Tester\Result\TestResult; - -/** - * Interprets test results strictly - everything that is not an explicit pass is a failure. - * - * @author Konstantin Kudryashov - */ -final class StrictInterpretation implements ResultInterpretation -{ - /** - * {@inheritdoc} - */ - public function isFailure(TestResult $result) - { - return !$result->isPassed(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/ResultInterpreter.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/ResultInterpreter.php deleted file mode 100644 index 5ea9ad1..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/ResultInterpreter.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result; - -use Behat\Testwork\Tester\Result\Interpretation\ResultInterpretation; - -/** - * Interprets provided test result (as 1 or 0) using registered interpretations. - * - * @author Konstantin Kudryashov - */ -final class ResultInterpreter -{ - /** - * @var ResultInterpretation[] - */ - private $interpretations = array(); - - /** - * Registers result interpretation. - * - * @param ResultInterpretation $interpretation - */ - public function registerResultInterpretation(ResultInterpretation $interpretation) - { - $this->interpretations[] = $interpretation; - } - - /** - * Interprets result as a UNIX return code (0 for success, 1 for failure). - * - * @param TestResult $result - * - * @return integer - */ - public function interpretResult(TestResult $result) - { - foreach ($this->interpretations as $interpretation) { - if ($interpretation->isFailure($result)) { - return 1; - } - } - - return 0; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestResult.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestResult.php deleted file mode 100644 index 7c3df6f..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestResult.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result; - -/** - * Represents a test result. - * - * @author Konstantin Kudryashov - */ -interface TestResult -{ - public const PASSED = 0; - public const SKIPPED = 10; - public const PENDING = 20; - public const FAILED = 99; - - /** - * Checks that test has passed. - * - * @return bool - */ - public function isPassed(); - - /** - * Returns tester result code. - * - * @return integer - */ - public function getResultCode(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestResults.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestResults.php deleted file mode 100644 index cf8e4aa..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestResults.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result; - -use ArrayIterator; -use Countable; -use IteratorAggregate; - -/** - * Aggregates multiple test results into a collection and provides informational API on top of that. - * - * @author Konstantin Kudryashov - */ -final class TestResults implements TestResult, Countable, IteratorAggregate -{ - public const NO_TESTS = -100; - - /** - * @var TestResult[] - */ - private $results; - - /** - * Initializes test results collection. - * - * @param TestResult[] $results - */ - public function __construct(array $results = array()) - { - $this->results = $results; - } - - /** - * {@inheritdoc} - */ - public function isPassed() - { - return self::PASSED == $this->getResultCode(); - } - - /** - * {@inheritdoc} - */ - public function getResultCode() - { - $resultCode = static::NO_TESTS; - foreach ($this->results as $result) { - $resultCode = max($resultCode, $result->getResultCode()); - } - - return $resultCode; - } - - /** - * {@inheritdoc} - */ - public function count(): int - { - return count($this->results); - } - - /** - * {@inheritdoc} - */ - public function getIterator(): ArrayIterator - { - return new ArrayIterator($this->results); - } - - /** - * Returns test results array. - * - * @return TestResult[] - */ - public function toArray() - { - return $this->results; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestWithSetupResult.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestWithSetupResult.php deleted file mode 100644 index e9fa4f7..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Result/TestWithSetupResult.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Result; - -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Represents a test result with both setup and teardown attached. - * - * @author Konstantin Kudryashov - */ -final class TestWithSetupResult implements TestResult -{ - /** - * @var Setup - */ - private $setup; - /** - * @var TestResult - */ - private $result; - /** - * @var Teardown - */ - private $teardown; - - /** - * Initializes test result. - * - * @param Setup $setup - * @param TestResult $result - * @param Teardown $teardown - */ - public function __construct(Setup $setup, TestResult $result, Teardown $teardown) - { - $this->setup = $setup; - $this->result = $result; - $this->teardown = $teardown; - } - - /** - * {@inheritdoc} - */ - public function isPassed() - { - return self::PASSED == $this->getResultCode(); - } - - /** - * {@inheritdoc} - */ - public function getResultCode() - { - if (!$this->setup->isSuccessful()) { - return self::FAILED; - } - - if (!$this->teardown->isSuccessful()) { - return self::FAILED; - } - - return $this->result->getResultCode(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php deleted file mode 100644 index 2f831dd..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeExercise.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Runtime; - -use Behat\Testwork\Environment\EnvironmentManager; -use Behat\Testwork\Specification\GroupedSpecificationIterator; -use Behat\Testwork\Tester\Exercise; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestResults; -use Behat\Testwork\Tester\Result\TestWithSetupResult; -use Behat\Testwork\Tester\Setup\SuccessfulSetup; -use Behat\Testwork\Tester\Setup\SuccessfulTeardown; -use Behat\Testwork\Tester\SuiteTester; - -/** - * Tester executing exercises in the runtime. - * - * @author Konstantin Kudryashov - */ -final class RuntimeExercise implements Exercise -{ - /** - * @var EnvironmentManager - */ - private $envManager; - /** - * @var SuiteTester - */ - private $suiteTester; - - /** - * Initializes tester. - * - * @param EnvironmentManager $envManager - * @param SuiteTester $suiteTester - */ - public function __construct(EnvironmentManager $envManager, SuiteTester $suiteTester) - { - $this->envManager = $envManager; - $this->suiteTester = $suiteTester; - } - - /** - * {@inheritdoc} - */ - public function setUp(array $iterators, $skip) - { - return new SuccessfulSetup(); - } - - /** - * {@inheritdoc} - */ - public function test(array $iterators, $skip = false) - { - $results = array(); - foreach (GroupedSpecificationIterator::group($iterators) as $iterator) { - $environment = $this->envManager->buildEnvironment($iterator->getSuite()); - - $setup = $this->suiteTester->setUp($environment, $iterator, $skip); - $localSkip = !$setup->isSuccessful() || $skip; - $testResult = $this->suiteTester->test($environment, $iterator, $localSkip); - $teardown = $this->suiteTester->tearDown($environment, $iterator, $localSkip, $testResult); - - $integerResult = new IntegerTestResult($testResult->getResultCode()); - $results[] = new TestWithSetupResult($setup, $integerResult, $teardown); - } - - return new TestResults($results); - } - - /** - * {@inheritdoc} - */ - public function tearDown(array $iterators, $skip, TestResult $result) - { - return new SuccessfulTeardown(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php deleted file mode 100644 index b67838d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Runtime/RuntimeSuiteTester.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Runtime; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\IntegerTestResult; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Result\TestResults; -use Behat\Testwork\Tester\Result\TestWithSetupResult; -use Behat\Testwork\Tester\Setup\SuccessfulSetup; -use Behat\Testwork\Tester\Setup\SuccessfulTeardown; -use Behat\Testwork\Tester\SpecificationTester; -use Behat\Testwork\Tester\SuiteTester; - -/** - * Tester executing suite tests in the runtime. - * - * @author Konstantin Kudryashov - */ -final class RuntimeSuiteTester implements SuiteTester -{ - /** - * @var SpecificationTester - */ - private $specTester; - - /** - * Initializes tester. - * - * @param SpecificationTester $specTester - */ - public function __construct(SpecificationTester $specTester) - { - $this->specTester = $specTester; - } - - /** - * {@inheritdoc} - */ - public function setUp(Environment $env, SpecificationIterator $iterator, $skip) - { - return new SuccessfulSetup(); - } - - /** - * {@inheritdoc} - */ - public function test(Environment $env, SpecificationIterator $iterator, $skip = false) - { - $results = array(); - foreach ($iterator as $specification) { - $setup = $this->specTester->setUp($env, $specification, $skip); - $localSkip = !$setup->isSuccessful() || $skip; - $testResult = $this->specTester->test($env, $specification, $localSkip); - $teardown = $this->specTester->tearDown($env, $specification, $localSkip, $testResult); - - $integerResult = new IntegerTestResult($testResult->getResultCode()); - $results[] = new TestWithSetupResult($setup, $integerResult, $teardown); - } - - return new TestResults($results); - } - - /** - * {@inheritdoc} - */ - public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result) - { - return new SuccessfulTeardown(); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php deleted file mode 100644 index 8892992..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/ServiceContainer/TesterExtension.php +++ /dev/null @@ -1,250 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\Environment\ServiceContainer\EnvironmentExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Behat\Testwork\ServiceContainer\ServiceProcessor; -use Behat\Testwork\Specification\ServiceContainer\SpecificationExtension; -use Behat\Testwork\Suite\ServiceContainer\SuiteExtension; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides tester services. - * - * @author Konstantin Kudryashov - */ -abstract class TesterExtension implements Extension -{ - /* - * Available services - */ - public const EXERCISE_ID = 'tester.exercise'; - public const SUITE_TESTER_ID = 'tester.suite'; - public const SPECIFICATION_TESTER_ID = 'tester.specification'; - public const RESULT_INTERPRETER_ID = 'tester.result.interpreter'; - - /** - * Available extension points - */ - public const EXERCISE_WRAPPER_TAG = 'tester.exercise.wrapper'; - public const SUITE_TESTER_WRAPPER_TAG = 'tester.suite.wrapper'; - public const SPECIFICATION_TESTER_WRAPPER_TAG = 'tester.specification.wrapper'; - public const RESULT_INTERPRETATION_TAG = 'test.result.interpretation'; - - /** - * @var ServiceProcessor - */ - private $processor; - - /** - * Initializes extension. - * - * @param null|ServiceProcessor $processor - */ - public function __construct(ServiceProcessor $processor = null) - { - $this->processor = $processor ? : new ServiceProcessor(); - } - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'testers'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - $builder - ->addDefaultsIfNotSet() - ->children() - ->booleanNode('strict') - ->info('Sets the strict mode for result interpretation') - ->defaultFalse() - ->end() - ->booleanNode('skip') - ->info('Tells tester to skip all tests') - ->defaultFalse() - ->end() - ->end() - ; - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadExerciseController($container, $config['skip']); - $this->loadStrictController($container, $config['strict']); - $this->loadResultInterpreter($container); - $this->loadExercise($container); - $this->loadSuiteTester($container); - $this->loadSpecificationTester($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - $this->processExerciseWrappers($container); - $this->processSuiteTesterWrappers($container); - $this->processSpecificationTesterWrappers($container); - $this->processResultInterpretations($container); - } - - /** - * Loads exercise cli controllers. - * - * @param ContainerBuilder $container - * @param bool $skip - */ - protected function loadExerciseController(ContainerBuilder $container, $skip = false) - { - $definition = new Definition('Behat\Testwork\Tester\Cli\ExerciseController', array( - new Reference(SuiteExtension::REGISTRY_ID), - new Reference(SpecificationExtension::FINDER_ID), - new Reference(self::EXERCISE_ID), - new Reference(self::RESULT_INTERPRETER_ID), - $skip - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 0)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.exercise', $definition); - } - - /** - * Loads exercise cli controllers. - * - * @param ContainerBuilder $container - * @param bool $strict - */ - protected function loadStrictController(ContainerBuilder $container, $strict = false) - { - $definition = new Definition('Behat\Testwork\Tester\Cli\StrictController', array( - new Reference(self::RESULT_INTERPRETER_ID), - $strict - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 300)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.strict', $definition); - } - - /** - * Loads result interpreter controller - * - * @param ContainerBuilder $container - */ - protected function loadResultInterpreter(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Tester\Result\ResultInterpreter'); - $container->setDefinition(self::RESULT_INTERPRETER_ID, $definition); - - $definition = new Definition('Behat\Testwork\Tester\Result\Interpretation\SoftInterpretation'); - $definition->addTag(self::RESULT_INTERPRETATION_TAG); - $container->setDefinition(self::RESULT_INTERPRETATION_TAG . '.soft', $definition); - } - - /** - * Loads exercise tester. - * - * @param ContainerBuilder $container - */ - protected function loadExercise(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Tester\Runtime\RuntimeExercise', array( - new Reference(EnvironmentExtension::MANAGER_ID), - new Reference(self::SUITE_TESTER_ID) - )); - $container->setDefinition(self::EXERCISE_ID, $definition); - } - - /** - * Loads suite tester. - * - * @param ContainerBuilder $container - */ - protected function loadSuiteTester(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Tester\Runtime\RuntimeSuiteTester', array( - new Reference(self::SPECIFICATION_TESTER_ID) - )); - $container->setDefinition(self::SUITE_TESTER_ID, $definition); - } - - /** - * Loads specification tester. - * - * @param ContainerBuilder $container - */ - abstract protected function loadSpecificationTester(ContainerBuilder $container); - - /** - * Processes all registered exercise wrappers. - * - * @param ContainerBuilder $container - */ - protected function processExerciseWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::EXERCISE_ID, self::EXERCISE_WRAPPER_TAG); - } - - /** - * Processes all registered suite tester wrappers. - * - * @param ContainerBuilder $container - */ - protected function processSuiteTesterWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::SUITE_TESTER_ID, self::SUITE_TESTER_WRAPPER_TAG); - } - - /** - * Processes all registered specification tester wrappers. - * - * @param ContainerBuilder $container - */ - protected function processSpecificationTesterWrappers(ContainerBuilder $container) - { - $this->processor->processWrapperServices($container, self::SPECIFICATION_TESTER_ID, self::SPECIFICATION_TESTER_WRAPPER_TAG); - } - - /** - * Processes all registered result interpretations. - * - * @param ContainerBuilder $container - */ - protected function processResultInterpretations(ContainerBuilder $container) - { - $references = $this->processor->findAndSortTaggedServices($container, self::RESULT_INTERPRETATION_TAG); - $definition = $container->getDefinition(self::RESULT_INTERPRETER_ID); - - foreach ($references as $reference) { - $definition->addMethodCall('registerResultInterpretation', array($reference)); - } - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/FailedSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/FailedSetup.php deleted file mode 100644 index 2130cd3..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/FailedSetup.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Setup; - -/** - * Represents a failed setup. - * - * @author Konstantin Kudryashov - */ -final class FailedSetup implements Setup -{ - /** - * {@inheritdoc} - */ - public function isSuccessful() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function hasOutput() - { - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/FailedTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/FailedTeardown.php deleted file mode 100644 index 7fdc74d..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/FailedTeardown.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Setup; - -/** - * Represents a failed teardown. - * - * @author Konstantin Kudryashov - */ -final class FailedTeardown implements Teardown -{ - /** - * {@inheritdoc} - */ - public function isSuccessful() - { - return false; - } - - /** - * {@inheritdoc} - */ - public function hasOutput() - { - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/Setup.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/Setup.php deleted file mode 100644 index 5f6fd45..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/Setup.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Setup; - -/** - * Represents a result of test setUp action. - * - * @author Konstantin Kudryashov - */ -interface Setup -{ - /** - * Returns true if fixtures have been handled successfully. - * - * @return bool - */ - public function isSuccessful(); - - /** - * Checks if setup has produced any output. - * - * @return bool - */ - public function hasOutput(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/SuccessfulSetup.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/SuccessfulSetup.php deleted file mode 100644 index 56686d0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/SuccessfulSetup.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Setup; - -/** - * Represents successful setup. - * - * @author Konstantin Kudryashov - */ -final class SuccessfulSetup implements Setup -{ - /** - * {@inheritdoc} - */ - public function isSuccessful() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function hasOutput() - { - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/SuccessfulTeardown.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/SuccessfulTeardown.php deleted file mode 100644 index 8a94d15..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/SuccessfulTeardown.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Setup; - -/** - * Represents successful teardown. - * - * @author Konstantin Kudryashov - */ -final class SuccessfulTeardown implements Teardown -{ - /** - * {@inheritdoc} - */ - public function isSuccessful() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function hasOutput() - { - return false; - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/Teardown.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/Teardown.php deleted file mode 100644 index 7ff2531..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/Setup/Teardown.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester\Setup; - -/** - * Represents a result of test tearDown action. - * - * @author Konstantin Kudryashov - */ -interface Teardown -{ - /** - * Returns true if fixtures have been handled successfully. - * - * @return bool - */ - public function isSuccessful(); - - /** - * Checks if tear down has produced any output. - * - * @return bool - */ - public function hasOutput(); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/SpecificationTester.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/SpecificationTester.php deleted file mode 100644 index b6e06ff..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/SpecificationTester.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Prepares and tests provided specification against provided environment. - * - * @author Konstantin Kudryashov - */ -interface SpecificationTester -{ - /** - * Sets up specification for a test. - * - * @param Environment $env - * @param mixed $spec - * @param bool $skip - * - * @return Setup - */ - public function setUp(Environment $env, $spec, $skip); - - /** - * Tests provided specification. - * - * @param Environment $env - * @param mixed $spec - * @param bool $skip - * - * @return TestResult - */ - public function test(Environment $env, $spec, $skip); - - /** - * Tears down specification after a test. - * - * @param Environment $env - * @param mixed $spec - * @param bool $skip - * @param TestResult $result - * - * @return Teardown - */ - public function tearDown(Environment $env, $spec, $skip, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/SuiteTester.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/SuiteTester.php deleted file mode 100644 index 61dffad..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Tester/SuiteTester.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Tester; - -use Behat\Testwork\Environment\Environment; -use Behat\Testwork\Specification\SpecificationIterator; -use Behat\Testwork\Tester\Result\TestResult; -use Behat\Testwork\Tester\Setup\Setup; -use Behat\Testwork\Tester\Setup\Teardown; - -/** - * Prepares and tests provided suite specifications against provided environment. - * - * @author Konstantin Kudryashov - */ -interface SuiteTester -{ - /** - * Sets up suite for a test. - * - * @param Environment $env - * @param SpecificationIterator $iterator - * @param bool $skip - * - * @return Setup - */ - public function setUp(Environment $env, SpecificationIterator $iterator, $skip); - - /** - * Tests provided suite specifications. - * - * @param Environment $env - * @param SpecificationIterator $iterator - * @param bool $skip - * - * @return TestResult - */ - public function test(Environment $env, SpecificationIterator $iterator, $skip); - - /** - * Tears down suite after a test. - * - * @param Environment $env - * @param SpecificationIterator $iterator - * @param bool $skip - * @param TestResult $result - * - * @return Teardown - */ - public function tearDown(Environment $env, SpecificationIterator $iterator, $skip, TestResult $result); -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Translator/Cli/LanguageController.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Translator/Cli/LanguageController.php deleted file mode 100644 index 676b891..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Translator/Cli/LanguageController.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Translator\Cli; - -use Behat\Testwork\Cli\Controller; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Translation\Translator; - -/** - * Configures translator service to use custom locale. - * - * @author Konstantin Kudryashov - */ -final class LanguageController implements Controller -{ - /** - * @var Translator - */ - private $translator; - - /** - * Initializes controller. - * - * @param Translator $translator - */ - public function __construct(Translator $translator) - { - $this->translator = $translator; - } - - /** - * {@inheritdoc} - */ - public function configure(Command $command) - { - $command->addOption('--lang', null, InputOption::VALUE_REQUIRED, - 'Print output in particular language.' - ); - } - - /** - * {@inheritdoc} - */ - public function execute(InputInterface $input, OutputInterface $output) - { - if (!$input->getOption('lang')) { - return; - } - - $this->translator->setLocale($input->getOption('lang')); - } -} diff --git a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Translator/ServiceContainer/TranslatorExtension.php b/tests/integration/vendor/behat/behat/src/Behat/Testwork/Translator/ServiceContainer/TranslatorExtension.php deleted file mode 100644 index 5fc53f0..0000000 --- a/tests/integration/vendor/behat/behat/src/Behat/Testwork/Translator/ServiceContainer/TranslatorExtension.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Testwork\Translator\ServiceContainer; - -use Behat\Testwork\Cli\ServiceContainer\CliExtension; -use Behat\Testwork\ServiceContainer\Extension; -use Behat\Testwork\ServiceContainer\ExtensionManager; -use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Provides translator service. - * - * @author Konstantin Kudryashov - */ -final class TranslatorExtension implements Extension -{ - /* - * Available services - */ - public const TRANSLATOR_ID = 'translator'; - - /** - * {@inheritdoc} - */ - public function getConfigKey() - { - return 'translation'; - } - - /** - * {@inheritdoc} - */ - public function initialize(ExtensionManager $extensionManager) - { - } - - /** - * {@inheritdoc} - */ - public function configure(ArrayNodeDefinition $builder) - { - $defaultLanguage = $this->getDefaultLanguage() ?: 'en'; - - $builder - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('locale') - ->info('Sets output locale for the tester') - ->defaultValue($defaultLanguage) - ->end() - ->scalarNode('fallback_locale') - ->info('Sets fallback output locale for the tester') - ->defaultValue('en') - ->end() - ->end(); - } - - /** - * {@inheritdoc} - */ - public function load(ContainerBuilder $container, array $config) - { - $this->loadTranslator($container, $config['locale'], $config['fallback_locale']); - $this->loadController($container); - } - - /** - * {@inheritdoc} - */ - public function process(ContainerBuilder $container) - { - } - - /** - * Loads translator service. - * - * @param ContainerBuilder $container - * @param string $locale - * @param string $fallbackLocale - */ - private function loadTranslator(ContainerBuilder $container, $locale, $fallbackLocale) - { - $definition = new Definition('Behat\Behat\Definition\Translator\Translator', array($locale)); - $container->setDefinition(self::TRANSLATOR_ID, $definition); - - $definition->addMethodCall('setFallbackLocales', array(array($fallbackLocale))); - $definition->addMethodCall( - 'addLoader', array( - 'xliff', - new Definition('Symfony\Component\Translation\Loader\XliffFileLoader') - ) - ); - $definition->addMethodCall( - 'addLoader', array( - 'yaml', - new Definition('Symfony\Component\Translation\Loader\YamlFileLoader') - ) - ); - $definition->addMethodCall( - 'addLoader', array( - 'php', - new Definition('Symfony\Component\Translation\Loader\PhpFileLoader') - ) - ); - $definition->addMethodCall( - 'addLoader', array( - 'array', - new Definition('Symfony\Component\Translation\Loader\ArrayLoader') - ) - ); - $container->setDefinition(self::TRANSLATOR_ID, $definition); - } - - /** - * Loads translator controller. - * - * @param ContainerBuilder $container - */ - private function loadController(ContainerBuilder $container) - { - $definition = new Definition('Behat\Testwork\Translator\Cli\LanguageController', array( - new Reference(self::TRANSLATOR_ID) - )); - $definition->addTag(CliExtension::CONTROLLER_TAG, array('priority' => 800)); - $container->setDefinition(CliExtension::CONTROLLER_TAG . '.translator', $definition); - } - - /** - * Tries to guess default user cli language. - * - * @return null|string - */ - private function getDefaultLanguage() - { - $defaultLanguage = null; - if (($locale = getenv('LANG')) && preg_match('/^([a-z]{2})/', $locale, $matches)) { - $defaultLanguage = $matches[1]; - - return $defaultLanguage; - } - - return $defaultLanguage; - } -} diff --git a/tests/integration/vendor/behat/gherkin/CHANGES.md b/tests/integration/vendor/behat/gherkin/CHANGES.md deleted file mode 100644 index 4533536..0000000 --- a/tests/integration/vendor/behat/gherkin/CHANGES.md +++ /dev/null @@ -1,442 +0,0 @@ -4.9.0 / 2021-10-12 -================== - -* Simplify the boolean condition for the tag matching by @stof in https://github.com/Behat/Gherkin/pull/219 -* Remove symfony phpunit bridge by @ciaranmcnulty in https://github.com/Behat/Gherkin/pull/220 -* Ignore the bin folder in archives by @stof in https://github.com/Behat/Gherkin/pull/226 -* Cast table node exceptions into ParserExceptions when throwing by @ciaranmcnulty in https://github.com/Behat/Gherkin/pull/216 -* Cucumber changelog in PRs and using correct hash by @ciaranmcnulty in https://github.com/Behat/Gherkin/pull/225 -* Support alternative docstrings format (```) by @ciaranmcnulty in https://github.com/Behat/Gherkin/pull/214 -* Fix DocBlocks (Boolean -> bool) by @simonhammes in https://github.com/Behat/Gherkin/pull/237 -* Tag parsing by @ciaranmcnulty in https://github.com/Behat/Gherkin/pull/215 -* Remove test - cucumber added an example with Rule which is not supported by @ciaranmcnulty in https://github.com/Behat/Gherkin/pull/239 -* Add PHP 8.1 support by @javer in https://github.com/Behat/Gherkin/pull/242 -* Fix main branch alias version by @mvorisek in https://github.com/Behat/Gherkin/pull/244 - -4.8.0 / 2021-02-04 -================== - -* Drop support for PHP before version 7.2 - -4.7.3 / 2021-02-04 -================== - -* Refactored comments parsing to avoid Maximum function nesting level errors - -4.7.2 / 2021-02-03 -================== - -* Issue where Scenario Outline title was not populated into Examples -* Updated translations from cucumber 16.0.0 - -4.7.1 / 2021-01-26 -================== - -* Issue parsing comments before scenarios when following an Examples table - -4.7.0 / 2021-01-24 -================== - - * Provides better messages for TableNode construct errors - * Now allows single character steps - * Supports multiple Example Tables with tags - -4.6.2 / 2020-03-17 -================== - - * Fixed issues due to incorrect cache key - -4.6.1 / 2020-02-27 -================== - - * Fix AZ translations - * Correctly filter features, now that the base path is correctly set - -4.6.0 / 2019-01-16 -================== - - * Updated translations (including 'Example' as synonym for 'Scenario' in `en`) - -4.5.1 / 2017-08-30 -================== - - * Fix regression in `PathsFilter` - -4.5.0 / 2017-08-30 -================== - - * Sync i18n with Cucumber Gherkin - * Drop support for HHVM tests on Travis - * Add `TableNode::fromList()` method (thanks @TravisCarden) - * Add `ExampleNode::getOutlineTitle()` method (thanks @duxet) - * Use realpath, so the feature receives the cwd prefixed (thanks @glennunipro) - * Explicitly handle non-two-dimensional arrays in TableNode (thanks @TravisCarden) - * Fix to line/linefilter scenario runs which take relative paths to files (thanks @generalconsensus) - -4.4.5 / 2016-10-30 -================== - - * Fix partial paths matching in `PathsFilter` - -4.4.4 / 2016-09-18 -================== - - * Provide clearer exception for non-writeable cache directories - -4.4.3 / 2016-09-18 -================== - - * Ensure we reset tags between features - -4.4.2 / 2016-09-03 -================== - - * Sync 18n with gherkin 3 - -4.4.1 / 2015-12-30 -================== - - * Ensure keywords are trimmed when syncing translations - * Sync 18n with cucumber - -4.4.0 / 2015-09-19 -================== - - * Added validation enforcing that all rows of a `TableNode` have the same number of columns - * Added `TableNode::getColumn` to get a column from the table - * Sync 18n with cucumber - -4.3.0 / 2014-06-06 -================== - - * Added `setFilters(array)` method to `Gherkin` class - * Added `NarrativeFilter` for non-english `RoleFilter` lovers - -4.2.1 / 2014-06-06 -================== - - * Fix parsing of features without line feed at the end - -4.2.0 / 2014-05-27 -================== - - * Added `getKeyword()` and `getKeywordType()` methods to `StepNode`, deprecated `getType()`. - Thanks to @kibao - -4.1.3 / 2014-05-25 -================== - - * Properly handle tables with rows terminating in whitespace - -4.1.2 / 2014-05-14 -================== - - * Handle case where Gherkin cache is broken - -4.1.1 / 2014-05-05 -================== - - * Fixed the compatibility with PHP 5.6-beta by avoiding to use the broken PHP array function - * The YamlFileLoader no longer extend from ArrayLoader but from AbstractFileLoader - -4.1.0 / 2014-04-20 -================== - - * Fixed scenario tag filtering - * Do not allow multiple multiline step arguments - * Sync 18n with cucumber - -4.0.0 / 2014-01-05 -================== - - * Changed the behavior when no loader can be found for the resource. Instead of throwing an exception, the - Gherkin class now returns an empty array. - -3.1.3 / 2014-01-04 -================== - - * Dropped the dependency on the Symfony Finder by using SPL iterators directly - * Added testing on HHVM on Travis. HHVM is officially supported (previous release was actually already compatible) - -3.1.2 / 2014-01-01 -================== - - * All paths passed to PathsFilter are converted using realpath - -3.1.1 / 2013-12-31 -================== - - * Add `ComplexFilterInterace` that has complex behavior for scenarios and requires to pass - feature too - * `TagFilter` is an instance of a `ComplexFilterInterace` now - -3.1.0 / 2013-12-31 -================== - - * Example node is a scenario - * Nodes do not have uprefs (memory usage fix) - * Scenario filters do not depend on feature nodes - -3.0.5 / 2014-01-01 -================== - - * All paths passed to PathsFilter are converted using realpath - -3.0.4 / 2013-12-31 -================== - - * TableNode is now traversable using foreach - * All possibly thrown exceptions implement Gherkin\Exception interface - * Sync i18n with cucumber - -3.0.3 / 2013-09-15 -================== - - * Extend ExampleNode with additional methods - -3.0.2 / 2013-09-14 -================== - - * Extract `KeywordNodeInterface` and `ScenarioLikeInterface` - * Add `getIndex()` methods to scenarios, outlines, steps and examples - * Throw proper exception for fractured node tree - -3.0.1 / 2013-09-14 -================== - - * Use versioned subfolder in FileCache - -3.0.0 / 2013-09-14 -================== - - * A lot of optimizations in Parser and Lexer - * Node tree is now immutable by nature (no setters) - * Example nodes are now part of the node tree. They are lazily generated by Outline node - * Sync with latest cucumber i18n - -2.3.4 / 2013-08-11 -================== - - * Fix leaks in memory cache - -2.3.3 / 2013-08-11 -================== - - * Fix encoding bug introduced with previous release - * Sync i18n with cucumber - -2.3.2 / 2013-08-11 -================== - - * Explicitly use utf8 encoding - -2.3.1 / 2013-08-10 -================== - - * Support `an` prefix with RoleFilter - -2.3.0 / 2013-08-04 -================== - - * Add RoleFilter - * Add PathsFilter - * Add MemoryCache - -2.2.9 / 2013-03-02 -================== - - * Fix dependency version requirement - -2.2.8 / 2013-03-02 -================== - - * Features filtering behavior change. Now emptified (by filtering) features - that do not match filter themselves are removed from resultset. - * Small potential bug fix in TableNode - -2.2.7 / 2013-01-27 -================== - - * Fixed bug in i18n syncing script - * Resynced Gherkin i18n - -2.2.6 / 2013-01-26 -================== - - * Support long row hashes in tables ([see](https://github.com/Behat/Gherkin/issues/40)) - * Synced Gherkin i18n - -2.2.5 / 2012-09-26 -================== - - * Fixed issue with loading empty features - * Synced Gherkin i18n - -2.2.4 / 2012-08-03 -================== - - * Fixed exception message for "no loader found" - -2.2.3 / 2012-08-03 -================== - - * Fixed minor loader bug with empty base path - * Synced Gherkin i18n - -2.2.2 / 2012-07-01 -================== - - * Added ability to filter outline scenarios by line and range filters - * Synced Gherkin i18n - * Refactored table parser to read row line numbers too - -2.2.1 / 2012-05-04 -================== - - * Fixed StepNode `getLanguage()` and `getFile()` - -2.2.0 / 2012-05-03 -================== - - * Features freeze after parsing - * Implemented GherkinDumper (@Halleck45) - * Synced i18n with Cucumber - * Updated inline documentation - -2.1.1 / 2012-03-09 -================== - - * Fixed caching bug, where `isFresh()` always returned false - -2.1.0 / 2012-03-09 -================== - - * Added parser caching layer - * Added support for table delimiter escaping (use `\|` for that) - * Added LineRangeFilter (thanks @headrevision) - * Synced i18n dictionary with cucumber/gherkin - -2.0.2 / 2012-02-04 -================== - - * Synced i18n dictionary with cucumber/gherkin - -2.0.1 / 2012-01-26 -================== - - * Fixed issue about parsing features without indentation - -2.0.0 / 2012-01-19 -================== - - * Background titles support - * Correct parsing of titles/descriptions (hirarchy lexing) - * Migration to the cucumber/gherkin i18n dictionary - * Speed optimizations - * Refactored KeywordsDumper - * New loaders - * Bugfixes - -1.1.4 / 2012-01-08 -================== - - * Read feature description even if it looks like a step - -1.1.3 / 2011-12-14 -================== - - * Removed file loading routines from Parser (fixes `is_file()` issue on some systems - thanks - @flodocteurklein) - -1.1.2 / 2011-12-01 -================== - - * Updated spanish trasnaltion (@anbotero) - * Integration with Composer and Travis CI - -1.1.1 / 2011-07-29 -================== - - * Updated pt language step types (@danielcsgomes) - * Updated vendors - -1.1.0 / 2011-07-16 -================== - - * Return all tags, including inherited in `Scenario::getTags()` - * New `Feature::getOwnTags()` and `Scenario::getOwnTags()` method added, - which returns only own tags - -1.0.8 / 2011-06-29 -================== - - * Fixed comments parsing. - You can’t have comments at the end of a line # like this - # But you can still have comments at the beginning of a line - -1.0.7 / 2011-06-28 -================== - - * Added `getRaw()` method to PyStringNode - * Updated vendors - -1.0.6 / 2011-06-17 -================== - - * Updated vendors - -1.0.5 / 2011-06-10 -================== - - * Fixed bug, introduced with 1.0.4 - hash in PyStrings - -1.0.4 / 2011-06-10 -================== - - * Fixed inability to comment pystrings - -1.0.3 / 2011-04-21 -================== - - * Fixed introduced with 1.0.2 pystring parsing bug - -1.0.2 / 2011-04-18 -================== - - * Fixed bugs in text with comments parsing - -1.0.1 / 2011-04-01 -================== - - * Updated vendors - -1.0.0 / 2011-03-08 -================== - - * Updated vendors - -1.0.0RC2 / 2011-02-25 -===================== - - * Windows support - * Missing phpunit config - -1.0.0RC1 / 2011-02-15 -===================== - - * Huge optimizations to Lexer & Parser - * Additional loaders (Yaml, Array, Directory) - * Filters (Tag, Name, Line) - * Code refactoring - * Nodes optimizations - * Additional tests for exceptions and translations - * Keywords dumper - -0.2.0 / 2011-01-05 -================== - - * New Parser & Lexer (based on AST) - * New verbose parsing exception handling - * New translation mechanics - * 47 brand new translations (see i18n) - * Full test suite for everything from AST nodes to translations diff --git a/tests/integration/vendor/behat/gherkin/CONTRIBUTING.md b/tests/integration/vendor/behat/gherkin/CONTRIBUTING.md deleted file mode 100644 index 6869f76..0000000 --- a/tests/integration/vendor/behat/gherkin/CONTRIBUTING.md +++ /dev/null @@ -1,33 +0,0 @@ -Contributing ------------- - -Gherkin is an open source, community-driven project. If you'd like to contribute, feel free to do this, but remember to follow this few simple rules: - -- Make your feature addition or bug fix, -- Always use the `master` branch as base for your changes (all new development happens in `master`), -- Add tests for those changes (please look into `tests/` folder for some examples). This is important so we don't break it in a future version unintentionally, -- Commit your code, but do not mess with `CHANGES.md`, -- __Remember__: when you create Pull Request, always select `master` branch as target (done by default), otherwise it will be closed. - -Running tests -------------- - -Make sure that you don't break anything with your changes by running: - -```bash -$> phpunit -``` - -Contributing to Gherkin Translations ------------------------------------- - -Gherkin supports →40 different languages and you could add more! You might notice -`i18n.php` file in the root of the library. This file is downloaded and **autogenerated** -from original [cucumber/gherkin translations](https://github.com/cucumber/cucumber/blob/master/gherkin/gherkin-languages.json). -So, in order to fix/update/add some translation, you should send Pull Request to the -`cucumber/gherkin` repository. `Behat\Gherkin` will redownload/regenerate translations -from there before each release. - -It might sounds difficult, but this way of dictionary sharing gives you ability to -migrate your `*.feature` files from language to language and library to library without -the need to rewrite/modify them - same dictionary (Gherkin) used everywhere. diff --git a/tests/integration/vendor/behat/gherkin/LICENSE b/tests/integration/vendor/behat/gherkin/LICENSE deleted file mode 100644 index 14f15e8..0000000 --- a/tests/integration/vendor/behat/gherkin/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2011-2013 Konstantin Kudryashov - -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. diff --git a/tests/integration/vendor/behat/gherkin/README.md b/tests/integration/vendor/behat/gherkin/README.md deleted file mode 100644 index 0e26384..0000000 --- a/tests/integration/vendor/behat/gherkin/README.md +++ /dev/null @@ -1,64 +0,0 @@ -Behat Gherkin Parser -==================== - -This is the php Gherkin parser for Behat. It comes bundled with more than 40 native languages -(see `i18n.php`) support & clean architecture. - -Useful Links ------------- - -- Official Google Group is at [http://groups.google.com/group/behat](http://groups.google.com/group/behat) -- IRC channel on [#freenode](http://freenode.net/) is `#behat` -- [Note on Patches/Pull Requests](CONTRIBUTING.md) - -Usage Example -------------- - -``` php - array( - 'feature' => 'Feature', - 'background' => 'Background', - 'scenario' => 'Scenario', - 'scenario_outline' => 'Scenario Outline|Scenario Template', - 'examples' => 'Examples|Scenarios', - 'given' => 'Given', - 'when' => 'When', - 'then' => 'Then', - 'and' => 'And', - 'but' => 'But' - ), - 'en-pirate' => array( - 'feature' => 'Ahoy matey!', - 'background' => 'Yo-ho-ho', - 'scenario' => 'Heave to', - 'scenario_outline' => 'Shiver me timbers', - 'examples' => 'Dead men tell no tales', - 'given' => 'Gangway!', - 'when' => 'Blimey!', - 'then' => 'Let go and haul', - 'and' => 'Aye', - 'but' => 'Avast!' - ) -)); -$lexer = new Behat\Gherkin\Lexer($keywords); -$parser = new Behat\Gherkin\Parser($lexer); - -$feature = $parser->parse(file_get_contents('some.feature')); -``` - -Installing Dependencies ------------------------ - -``` bash -$> curl http://getcomposer.org/installer | php -$> php composer.phar update -``` - -Contributors ------------- - -* Konstantin Kudryashov [everzet](http://github.com/everzet) [lead developer] -* Other [awesome developers](https://github.com/Behat/Gherkin/graphs/contributors) diff --git a/tests/integration/vendor/behat/gherkin/composer.json b/tests/integration/vendor/behat/gherkin/composer.json deleted file mode 100644 index 039c064..0000000 --- a/tests/integration/vendor/behat/gherkin/composer.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "behat/gherkin", - "description": "Gherkin DSL parser for PHP", - "keywords": ["BDD", "parser", "DSL", "Behat", "Gherkin", "Cucumber"], - "homepage": "http://behat.org/", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - - "require": { - "php": "~7.2|~8.0" - }, - - "require-dev": { - "symfony/yaml": "~3|~4|~5", - "phpunit/phpunit": "~8|~9", - "cucumber/cucumber": "dev-gherkin-22.0.0" - }, - - "suggest": { - "symfony/yaml": "If you want to parse features, represented in YAML files" - }, - - "autoload": { - "psr-0": { - "Behat\\Gherkin": "src/" - } - }, - - "autoload-dev": { - "psr-4": { - "Tests\\Behat\\": "tests/Behat/" - } - }, - - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - - "repositories": [ - { - "type": "package", - "package": { - "name": "cucumber/cucumber", - "version": "dev-gherkin-22.0.0", - "source": { - "type": "git", - "url": "https://github.com/cucumber/cucumber.git", - "reference": "379280b6b98ee9a1bf79444e7c75e23265ccb3e0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cucumber/cucumber/zipball/379280b6b98ee9a1bf79444e7c75e23265ccb3e0", - "reference": "379280b6b98ee9a1bf79444e7c75e23265ccb3e0" - } - } - } - ] -} diff --git a/tests/integration/vendor/behat/gherkin/i18n.php b/tests/integration/vendor/behat/gherkin/i18n.php deleted file mode 100644 index 7f7c2e1..0000000 --- a/tests/integration/vendor/behat/gherkin/i18n.php +++ /dev/null @@ -1,1245 +0,0 @@ - - array ( - 'and' => 'And|*', - 'background' => 'Background', - 'but' => 'But|*', - 'examples' => 'Scenarios|Examples', - 'feature' => 'Business Need|Ability|Feature', - 'given' => 'Given|*', - 'name' => 'English', - 'native' => 'English', - 'rule' => 'Rule', - 'scenario' => 'Scenario|Example', - 'scenario_outline' => 'Scenario Template|Scenario Outline', - 'then' => 'Then|*', - 'when' => 'When|*', - ), - 'af' => - array ( - 'and' => 'En|*', - 'background' => 'Agtergrond', - 'but' => 'Maar|*', - 'examples' => 'Voorbeelde', - 'feature' => 'Besigheid Behoefte|Funksie|Vermoë', - 'given' => 'Gegewe|*', - 'name' => 'Afrikaans', - 'native' => 'Afrikaans', - 'rule' => 'Regel', - 'scenario' => 'Voorbeeld|Situasie', - 'scenario_outline' => 'Situasie Uiteensetting', - 'then' => 'Dan|*', - 'when' => 'Wanneer|*', - ), - 'am' => - array ( - 'and' => 'Եվ|*', - 'background' => 'Կոնտեքստ', - 'but' => 'Բայց|*', - 'examples' => 'Օրինակներ', - 'feature' => 'Ֆունկցիոնալություն|Հատկություն', - 'given' => 'Դիցուք|*', - 'name' => 'Armenian', - 'native' => 'հայերեն', - 'rule' => 'Rule', - 'scenario' => 'Սցենար|Օրինակ', - 'scenario_outline' => 'Սցենարի կառուցվացքը', - 'then' => 'Ապա|*', - 'when' => 'Եթե|Երբ|*', - ), - 'an' => - array ( - 'and' => '*|E|Y', - 'background' => 'Antecedents', - 'but' => 'Pero|*', - 'examples' => 'Eixemplos', - 'feature' => 'Caracteristica', - 'given' => 'Dadas|Dada|Daus|Dau|*', - 'name' => 'Aragonese', - 'native' => 'Aragonés', - 'rule' => 'Rule', - 'scenario' => 'Eixemplo|Caso', - 'scenario_outline' => 'Esquema del caso', - 'then' => 'Antonces|Alavez|Allora|*', - 'when' => 'Cuan|*', - ), - 'ar' => - array ( - 'and' => '*|و', - 'background' => 'الخلفية', - 'but' => 'لكن|*', - 'examples' => 'امثلة', - 'feature' => 'خاصية', - 'given' => 'بفرض|*', - 'name' => 'Arabic', - 'native' => 'العربية', - 'rule' => 'Rule', - 'scenario' => 'سيناريو|مثال', - 'scenario_outline' => 'سيناريو مخطط', - 'then' => 'اذاً|ثم|*', - 'when' => 'عندما|متى|*', - ), - 'ast' => - array ( - 'and' => 'Ya|*|Y', - 'background' => 'Antecedentes', - 'but' => 'Peru|*', - 'examples' => 'Exemplos', - 'feature' => 'Carauterística', - 'given' => 'Dada|Daes|Daos|Dáu|*', - 'name' => 'Asturian', - 'native' => 'asturianu', - 'rule' => 'Rule', - 'scenario' => 'Exemplo|Casu', - 'scenario_outline' => 'Esbozu del casu', - 'then' => 'Entós|*', - 'when' => 'Cuando|*', - ), - 'az' => - array ( - 'and' => 'Həm|Və|*', - 'background' => 'Kontekst|Keçmiş', - 'but' => 'Ancaq|Amma|*', - 'examples' => 'Nümunələr', - 'feature' => 'Özəllik', - 'given' => 'Tutaq ki|Verilir|*', - 'name' => 'Azerbaijani', - 'native' => 'Azərbaycanca', - 'rule' => 'Rule', - 'scenario' => 'Ssenari|Nümunə', - 'scenario_outline' => 'Ssenarinin strukturu', - 'then' => 'O halda|*', - 'when' => 'Nə vaxt ki|Əgər|*', - ), - 'bg' => - array ( - 'and' => '*|И', - 'background' => 'Предистория', - 'but' => 'Но|*', - 'examples' => 'Примери', - 'feature' => 'Функционалност', - 'given' => 'Дадено|*', - 'name' => 'Bulgarian', - 'native' => 'български', - 'rule' => 'Rule', - 'scenario' => 'Сценарий|Пример', - 'scenario_outline' => 'Рамка на сценарий', - 'then' => 'То|*', - 'when' => 'Когато|*', - ), - 'bm' => - array ( - 'and' => 'Dan|*', - 'background' => 'Latar Belakang', - 'but' => 'Tetapi|Tapi|*', - 'examples' => 'Contoh', - 'feature' => 'Fungsi', - 'given' => 'Diberi|Bagi|*', - 'name' => 'Malay', - 'native' => 'Bahasa Melayu', - 'rule' => 'Rule', - 'scenario' => 'Keadaan|Senario|Situasi', - 'scenario_outline' => 'Garis Panduan Senario|Kerangka Keadaan|Kerangka Senario|Kerangka Situasi', - 'then' => 'Kemudian|Maka|*', - 'when' => 'Apabila|*', - ), - 'bs' => - array ( - 'and' => '*|A|I', - 'background' => 'Pozadina', - 'but' => 'Ali|*', - 'examples' => 'Primjeri', - 'feature' => 'Karakteristika', - 'given' => 'Dato|*', - 'name' => 'Bosnian', - 'native' => 'Bosanski', - 'rule' => 'Rule', - 'scenario' => 'Scenariju|Scenario|Primjer', - 'scenario_outline' => 'Scenario-outline|Scenariju-obris', - 'then' => 'Zatim|*', - 'when' => 'Kada|*', - ), - 'ca' => - array ( - 'and' => '*|I', - 'background' => 'Antecedents|Rerefons', - 'but' => 'Però|*', - 'examples' => 'Exemples', - 'feature' => 'Característica|Funcionalitat', - 'given' => 'Donada|Atesa|Donat|Atès|*', - 'name' => 'Catalan', - 'native' => 'català', - 'rule' => 'Rule', - 'scenario' => 'Escenari|Exemple', - 'scenario_outline' => 'Esquema de l\'escenari', - 'then' => 'Aleshores|Cal|*', - 'when' => 'Quan|*', - ), - 'cs' => - array ( - 'and' => 'A také|*|A', - 'background' => 'Kontext|Pozadí', - 'but' => 'Ale|*', - 'examples' => 'Příklady', - 'feature' => 'Požadavek', - 'given' => 'Za předpokladu|Pokud|*', - 'name' => 'Czech', - 'native' => 'Česky', - 'rule' => 'Pravidlo', - 'scenario' => 'Příklad|Scénář', - 'scenario_outline' => 'Osnova scénáře|Náčrt Scénáře', - 'then' => 'Pak|*', - 'when' => 'Když|*', - ), - 'cy-GB' => - array ( - 'and' => '*|A', - 'background' => 'Cefndir', - 'but' => 'Ond|*', - 'examples' => 'Enghreifftiau', - 'feature' => 'Arwedd', - 'given' => 'Anrhegedig a|*', - 'name' => 'Welsh', - 'native' => 'Cymraeg', - 'rule' => 'Rule', - 'scenario' => 'Enghraifft|Scenario', - 'scenario_outline' => 'Scenario Amlinellol', - 'then' => 'Yna|*', - 'when' => 'Pryd|*', - ), - 'da' => - array ( - 'and' => 'Og|*', - 'background' => 'Baggrund', - 'but' => 'Men|*', - 'examples' => 'Eksempler', - 'feature' => 'Egenskab', - 'given' => 'Givet|*', - 'name' => 'Danish', - 'native' => 'dansk', - 'rule' => 'Rule', - 'scenario' => 'Eksempel|Scenarie', - 'scenario_outline' => 'Abstrakt Scenario', - 'then' => 'Så|*', - 'when' => 'Når|*', - ), - 'de' => - array ( - 'and' => 'Und|*', - 'background' => 'Voraussetzungen|Vorbedingungen|Hintergrund|Grundlage', - 'but' => 'Aber|*', - 'examples' => 'Beispiele', - 'feature' => 'Funktionalität|Funktion', - 'given' => 'Gegeben seien|Gegeben sei|Angenommen|*', - 'name' => 'German', - 'native' => 'Deutsch', - 'rule' => 'Regel|Rule', - 'scenario' => 'Beispiel|Szenario', - 'scenario_outline' => 'Szenariogrundriss|Szenarien', - 'then' => 'Dann|*', - 'when' => 'Wenn|*', - ), - 'el' => - array ( - 'and' => 'Και|*', - 'background' => 'Υπόβαθρο', - 'but' => 'Αλλά|*', - 'examples' => 'Παραδείγματα|Σενάρια', - 'feature' => 'Δυνατότητα|Λειτουργία', - 'given' => 'Δεδομένου|*', - 'name' => 'Greek', - 'native' => 'Ελληνικά', - 'rule' => 'Rule', - 'scenario' => 'Παράδειγμα|Σενάριο', - 'scenario_outline' => 'Περίγραμμα Σεναρίου|Περιγραφή Σεναρίου', - 'then' => 'Τότε|*', - 'when' => 'Όταν|*', - ), - 'em' => - array ( - 'and' => '😂<|*', - 'background' => '💤', - 'but' => '😔<|*', - 'examples' => '📓', - 'feature' => '📚', - 'given' => '😐<|*', - 'name' => 'Emoji', - 'native' => '😀', - 'rule' => 'Rule', - 'scenario' => '📕|🥒', - 'scenario_outline' => '📖', - 'then' => '🙏<|*', - 'when' => '🎬<|*', - ), - 'en-Scouse' => - array ( - 'and' => 'An|*', - 'background' => 'Dis is what went down', - 'but' => 'Buh|*', - 'examples' => 'Examples', - 'feature' => 'Feature', - 'given' => 'Youse know when youse got|Givun|*', - 'name' => 'Scouse', - 'native' => 'Scouse', - 'rule' => 'Rule', - 'scenario' => 'The thing of it is', - 'scenario_outline' => 'Wharrimean is', - 'then' => 'Den youse gotta|Dun|*', - 'when' => 'Youse know like when|Wun|*', - ), - 'en-au' => - array ( - 'and' => 'Too right|*', - 'background' => 'First off', - 'but' => 'Yeah nah|*', - 'examples' => 'You\'ll wanna', - 'feature' => 'Pretty much', - 'given' => 'Y\'know|*', - 'name' => 'Australian', - 'native' => 'Australian', - 'rule' => 'Rule', - 'scenario' => 'Awww, look mate', - 'scenario_outline' => 'Reckon it\'s like', - 'then' => 'But at the end of the day I reckon|*', - 'when' => 'It\'s just unbelievable|*', - ), - 'en-lol' => - array ( - 'and' => 'AN|*', - 'background' => 'B4', - 'but' => 'BUT|*', - 'examples' => 'EXAMPLZ', - 'feature' => 'OH HAI', - 'given' => 'I CAN HAZ|*', - 'name' => 'LOLCAT', - 'native' => 'LOLCAT', - 'rule' => 'Rule', - 'scenario' => 'MISHUN', - 'scenario_outline' => 'MISHUN SRSLY', - 'then' => 'DEN|*', - 'when' => 'WEN|*', - ), - 'en-old' => - array ( - 'and' => 'Ond|*|7', - 'background' => 'Aer|Ær', - 'but' => 'Ac|*', - 'examples' => 'Se the|Se ðe|Se þe', - 'feature' => 'Hwaet|Hwæt', - 'given' => 'Thurh|Ðurh|Þurh|*', - 'name' => 'Old English', - 'native' => 'Englisc', - 'rule' => 'Rule', - 'scenario' => 'Swa', - 'scenario_outline' => 'Swa hwaer swa|Swa hwær swa', - 'then' => 'Tha the|Ða ðe|Þa þe|Tha|Ða|Þa|*', - 'when' => 'Tha|Ða|Þa|*', - ), - 'en-pirate' => - array ( - 'and' => 'Aye|*', - 'background' => 'Yo-ho-ho', - 'but' => 'Avast!|*', - 'examples' => 'Dead men tell no tales', - 'feature' => 'Ahoy matey!', - 'given' => 'Gangway!|*', - 'name' => 'Pirate', - 'native' => 'Pirate', - 'rule' => 'Rule', - 'scenario' => 'Heave to', - 'scenario_outline' => 'Shiver me timbers', - 'then' => 'Let go and haul|*', - 'when' => 'Blimey!|*', - ), - 'en-tx' => - array ( - 'and' => 'Come hell or high water', - 'background' => 'Lemme tell y\'all a story', - 'but' => 'Well now hold on, I\'ll you what', - 'examples' => 'Now that\'s a story longer than a cattle drive in July', - 'feature' => 'This ain’t my first rodeo|All gussied up', - 'given' => 'All git out|Fixin\' to', - 'name' => 'Texas', - 'native' => 'Texas', - 'rule' => 'Rule ', - 'scenario' => 'All hat and no cattle', - 'scenario_outline' => 'Busy as a hound in flea season|Serious as a snake bite', - 'then' => 'There’s no tree but bears some fruit', - 'when' => 'Quick out of the chute', - ), - 'eo' => - array ( - 'and' => 'Kaj|*', - 'background' => 'Fono', - 'but' => 'Sed|*', - 'examples' => 'Ekzemploj', - 'feature' => 'Trajto', - 'given' => 'Donitaĵo|Komence|*', - 'name' => 'Esperanto', - 'native' => 'Esperanto', - 'rule' => 'Rule', - 'scenario' => 'Ekzemplo|Scenaro|Kazo', - 'scenario_outline' => 'Konturo de la scenaro|Kazo-skizo|Skizo', - 'then' => 'Do|*', - 'when' => 'Se|*', - ), - 'es' => - array ( - 'and' => '*|E|Y', - 'background' => 'Antecedentes', - 'but' => 'Pero|*', - 'examples' => 'Ejemplos', - 'feature' => 'Necesidad del negocio|Característica|Requisito', - 'given' => 'Dadas|Dados|Dada|Dado|*', - 'name' => 'Spanish', - 'native' => 'español', - 'rule' => 'Regla de negocio|Regla', - 'scenario' => 'Escenario|Ejemplo', - 'scenario_outline' => 'Esquema del escenario', - 'then' => 'Entonces|*', - 'when' => 'Cuando|*', - ), - 'et' => - array ( - 'and' => 'Ja|*', - 'background' => 'Taust', - 'but' => 'Kuid|*', - 'examples' => 'Juhtumid', - 'feature' => 'Omadus', - 'given' => 'Eeldades|*', - 'name' => 'Estonian', - 'native' => 'eesti keel', - 'rule' => 'Reegel', - 'scenario' => 'Stsenaarium|Juhtum', - 'scenario_outline' => 'Raamstsenaarium|Raamjuhtum', - 'then' => 'Siis|*', - 'when' => 'Kui|*', - ), - 'fa' => - array ( - 'and' => '*|و', - 'background' => 'زمینه', - 'but' => 'اما|*', - 'examples' => 'نمونه ها', - 'feature' => 'وِیژگی', - 'given' => 'با فرض|*', - 'name' => 'Persian', - 'native' => 'فارسی', - 'rule' => 'Rule', - 'scenario' => 'سناریو|مثال', - 'scenario_outline' => 'الگوی سناریو', - 'then' => 'آنگاه|*', - 'when' => 'هنگامی|*', - ), - 'fi' => - array ( - 'and' => 'Ja|*', - 'background' => 'Tausta', - 'but' => 'Mutta|*', - 'examples' => 'Tapaukset', - 'feature' => 'Ominaisuus', - 'given' => 'Oletetaan|*', - 'name' => 'Finnish', - 'native' => 'suomi', - 'rule' => 'Rule', - 'scenario' => 'Tapaus', - 'scenario_outline' => 'Tapausaihio', - 'then' => 'Niin|*', - 'when' => 'Kun|*', - ), - 'fr' => - array ( - 'and' => 'Et qu\'<|Et que|Et|*', - 'background' => 'Contexte', - 'but' => 'Mais qu\'<|Mais que|Mais|*', - 'examples' => 'Exemples', - 'feature' => 'Fonctionnalité', - 'given' => 'Etant donné qu\'<|Étant donné qu\'<|Etant donné que|Étant donné que|Etant données|Étant données|Etant donnée|Etant donnés|Sachant qu\'<|Étant donnée|Étant donnés|Etant donné|Sachant que|Étant donné|Sachant|Soit|*', - 'name' => 'French', - 'native' => 'français', - 'rule' => 'Règle', - 'scenario' => 'Scénario|Exemple', - 'scenario_outline' => 'Plan du Scénario|Plan du scénario', - 'then' => 'Alors|Donc|*', - 'when' => 'Lorsqu\'<|Lorsque|Quand|*', - ), - 'ga' => - array ( - 'and' => 'Agus<|*', - 'background' => 'Cúlra', - 'but' => 'Ach<|*', - 'examples' => 'Samplaí', - 'feature' => 'Gné', - 'given' => 'Cuir i gcás nach<|Cuir i gcás gur<|Cuir i gcás nár<|Cuir i gcás go<|*', - 'name' => 'Irish', - 'native' => 'Gaeilge', - 'rule' => 'Rule', - 'scenario' => 'Sampla|Cás', - 'scenario_outline' => 'Cás Achomair', - 'then' => 'Ansin<|*', - 'when' => 'Nuair nach<|Nuair nár<|Nuair ba<|Nuair a<|*', - ), - 'gj' => - array ( - 'and' => 'અને|*', - 'background' => 'બેકગ્રાઉન્ડ', - 'but' => 'પણ|*', - 'examples' => 'ઉદાહરણો', - 'feature' => 'વ્યાપાર જરૂર|ક્ષમતા|લક્ષણ', - 'given' => 'આપેલ છે|*', - 'name' => 'Gujarati', - 'native' => 'ગુજરાતી', - 'rule' => 'Rule', - 'scenario' => 'ઉદાહરણ|સ્થિતિ', - 'scenario_outline' => 'પરિદ્દશ્ય રૂપરેખા|પરિદ્દશ્ય ઢાંચો', - 'then' => 'પછી|*', - 'when' => 'ક્યારે|*', - ), - 'gl' => - array ( - 'and' => '*|E', - 'background' => 'Contexto', - 'but' => 'Mais|Pero|*', - 'examples' => 'Exemplos', - 'feature' => 'Característica', - 'given' => 'Dadas|Dados|Dada|Dado|*', - 'name' => 'Galician', - 'native' => 'galego', - 'rule' => 'Rule', - 'scenario' => 'Escenario|Exemplo', - 'scenario_outline' => 'Esbozo do escenario', - 'then' => 'Entón|Logo|*', - 'when' => 'Cando|*', - ), - 'he' => - array ( - 'and' => 'וגם|*', - 'background' => 'רקע', - 'but' => 'אבל|*', - 'examples' => 'דוגמאות', - 'feature' => 'תכונה', - 'given' => 'בהינתן|*', - 'name' => 'Hebrew', - 'native' => 'עברית', - 'rule' => 'כלל', - 'scenario' => 'דוגמא|תרחיש', - 'scenario_outline' => 'תבנית תרחיש', - 'then' => 'אזי|אז|*', - 'when' => 'כאשר|*', - ), - 'hi' => - array ( - 'and' => 'तथा|और|*', - 'background' => 'पृष्ठभूमि', - 'but' => 'किन्तु|परन्तु|पर|*', - 'examples' => 'उदाहरण', - 'feature' => 'रूप लेख', - 'given' => 'चूंकि|अगर|यदि|*', - 'name' => 'Hindi', - 'native' => 'हिंदी', - 'rule' => 'नियम', - 'scenario' => 'परिदृश्य', - 'scenario_outline' => 'परिदृश्य रूपरेखा', - 'then' => 'तदा|तब|*', - 'when' => 'कदा|जब|*', - ), - 'hr' => - array ( - 'and' => '*|I', - 'background' => 'Pozadina', - 'but' => 'Ali|*', - 'examples' => 'Scenariji|Primjeri', - 'feature' => 'Mogucnost|Mogućnost|Osobina', - 'given' => 'Ukoliko|Zadani|Zadano|Zadan|*', - 'name' => 'Croatian', - 'native' => 'hrvatski', - 'rule' => 'Rule', - 'scenario' => 'Scenarij|Primjer', - 'scenario_outline' => 'Koncept|Skica', - 'then' => 'Onda|*', - 'when' => 'Kada|Kad|*', - ), - 'ht' => - array ( - 'and' => 'Epi|Ak|*|E', - 'background' => 'Istorik|Kontèks', - 'but' => 'Men|*', - 'examples' => 'Egzanp', - 'feature' => 'Fonksyonalite|Karakteristik|Mak', - 'given' => 'Sipoze Ke|Sipoze ke|Sipoze|*', - 'name' => 'Creole', - 'native' => 'kreyòl', - 'rule' => 'Rule', - 'scenario' => 'Senaryo', - 'scenario_outline' => 'Senaryo Deskripsyon|Senaryo deskripsyon|Dyagram Senaryo|Dyagram senaryo|Plan Senaryo|Plan senaryo', - 'then' => 'Le sa a|Lè sa a|*', - 'when' => 'Le|Lè|*', - ), - 'hu' => - array ( - 'and' => 'És|*', - 'background' => 'Háttér', - 'but' => 'De|*', - 'examples' => 'Példák', - 'feature' => 'Jellemző', - 'given' => 'Amennyiben|Adott|*', - 'name' => 'Hungarian', - 'native' => 'magyar', - 'rule' => 'Szabály', - 'scenario' => 'Forgatókönyv|Példa', - 'scenario_outline' => 'Forgatókönyv vázlat', - 'then' => 'Akkor|*', - 'when' => 'Amikor|Majd|Ha|*', - ), - 'id' => - array ( - 'and' => 'Dan|*', - 'background' => 'Latar Belakang|Dasar', - 'but' => 'Tetapi|Tapi|*', - 'examples' => 'Contoh|Misal', - 'feature' => 'Fitur', - 'given' => 'Diasumsikan|Diketahui|Dengan|Bila|Jika|*', - 'name' => 'Indonesian', - 'native' => 'Bahasa Indonesia', - 'rule' => 'Aturan|Rule', - 'scenario' => 'Skenario', - 'scenario_outline' => 'Garis-Besar Skenario|Skenario konsep', - 'then' => 'Kemudian|Maka|*', - 'when' => 'Ketika|*', - ), - 'is' => - array ( - 'and' => 'Og|*', - 'background' => 'Bakgrunnur', - 'but' => 'En|*', - 'examples' => 'Atburðarásir|Dæmi', - 'feature' => 'Eiginleiki', - 'given' => 'Ef|*', - 'name' => 'Icelandic', - 'native' => 'Íslenska', - 'rule' => 'Rule', - 'scenario' => 'Atburðarás', - 'scenario_outline' => 'Lýsing Atburðarásar|Lýsing Dæma', - 'then' => 'Þá|*', - 'when' => 'Þegar|*', - ), - 'it' => - array ( - 'and' => '*|E', - 'background' => 'Contesto', - 'but' => 'Ma|*', - 'examples' => 'Esempi', - 'feature' => 'Esigenza di Business|Funzionalità|Abilità', - 'given' => 'Data|Date|Dati|Dato|*', - 'name' => 'Italian', - 'native' => 'italiano', - 'rule' => 'Regola', - 'scenario' => 'Scenario|Esempio', - 'scenario_outline' => 'Schema dello scenario', - 'then' => 'Allora|*', - 'when' => 'Quando|*', - ), - 'ja' => - array ( - 'and' => 'かつ<|*', - 'background' => '背景', - 'but' => 'しかし<|ただし<|但し<|*', - 'examples' => 'サンプル|例', - 'feature' => 'フィーチャ|機能', - 'given' => '前提<|*', - 'name' => 'Japanese', - 'native' => '日本語', - 'rule' => 'Rule', - 'scenario' => 'シナリオ', - 'scenario_outline' => 'シナリオアウトライン|シナリオテンプレート|シナリオテンプレ|テンプレ', - 'then' => 'ならば<|*', - 'when' => 'もし<|*', - ), - 'jv' => - array ( - 'and' => 'Lan|*', - 'background' => 'Dasar', - 'but' => 'Ananging|Nanging|Tapi|*', - 'examples' => 'Contone|Conto', - 'feature' => 'Fitur', - 'given' => 'Nalikaning|Nalika|*', - 'name' => 'Javanese', - 'native' => 'Basa Jawa', - 'rule' => 'Rule', - 'scenario' => 'Skenario', - 'scenario_outline' => 'Konsep skenario', - 'then' => 'Banjur|Njuk|*', - 'when' => 'Manawa|Menawa|*', - ), - 'ka' => - array ( - 'and' => 'და<|*', - 'background' => 'კონტექსტი', - 'but' => 'მაგ­რამ<|*', - 'examples' => 'მაგალითები', - 'feature' => 'თვისება', - 'given' => 'მოცემული<|*', - 'name' => 'Georgian', - 'native' => 'ქართველი', - 'rule' => 'Rule', - 'scenario' => 'მაგალითად|სცენარის', - 'scenario_outline' => 'სცენარის ნიმუში', - 'then' => 'მაშინ<|*', - 'when' => 'როდესაც<|*', - ), - 'kn' => - array ( - 'and' => 'ಮತ್ತು|*', - 'background' => 'ಹಿನ್ನೆಲೆ', - 'but' => 'ಆದರೆ|*', - 'examples' => 'ಉದಾಹರಣೆಗಳು', - 'feature' => 'ಹೆಚ್ಚಳ', - 'given' => 'ನೀಡಿದ|*', - 'name' => 'Kannada', - 'native' => 'ಕನ್ನಡ', - 'rule' => 'Rule', - 'scenario' => 'ಕಥಾಸಾರಾಂಶ|ಉದಾಹರಣೆ', - 'scenario_outline' => 'ವಿವರಣೆ', - 'then' => 'ನಂತರ|*', - 'when' => 'ಸ್ಥಿತಿಯನ್ನು|*', - ), - 'ko' => - array ( - 'and' => '그리고<|*', - 'background' => '배경', - 'but' => '하지만<|단<|*', - 'examples' => '예', - 'feature' => '기능', - 'given' => '먼저<|조건<|*', - 'name' => 'Korean', - 'native' => '한국어', - 'rule' => 'Rule', - 'scenario' => '시나리오', - 'scenario_outline' => '시나리오 개요', - 'then' => '그러면<|*', - 'when' => '만약<|만일<|*', - ), - 'lt' => - array ( - 'and' => 'Ir|*', - 'background' => 'Kontekstas', - 'but' => 'Bet|*', - 'examples' => 'Pavyzdžiai|Scenarijai|Variantai', - 'feature' => 'Savybė', - 'given' => 'Duota|*', - 'name' => 'Lithuanian', - 'native' => 'lietuvių kalba', - 'rule' => 'Rule', - 'scenario' => 'Scenarijus|Pavyzdys', - 'scenario_outline' => 'Scenarijaus šablonas', - 'then' => 'Tada|*', - 'when' => 'Kai|*', - ), - 'lu' => - array ( - 'and' => 'an|*|a', - 'background' => 'Hannergrond', - 'but' => 'awer|mä|*', - 'examples' => 'Beispiller', - 'feature' => 'Funktionalitéit', - 'given' => 'ugeholl|*', - 'name' => 'Luxemburgish', - 'native' => 'Lëtzebuergesch', - 'rule' => 'Rule', - 'scenario' => 'Beispill|Szenario', - 'scenario_outline' => 'Plang vum Szenario', - 'then' => 'dann|*', - 'when' => 'wann|*', - ), - 'lv' => - array ( - 'and' => 'Un|*', - 'background' => 'Konteksts|Situācija', - 'but' => 'Bet|*', - 'examples' => 'Paraugs|Piemēri', - 'feature' => 'Funkcionalitāte|Fīča', - 'given' => 'Kad|*', - 'name' => 'Latvian', - 'native' => 'latviešu', - 'rule' => 'Rule', - 'scenario' => 'Scenārijs|Piemērs', - 'scenario_outline' => 'Scenārijs pēc parauga', - 'then' => 'Tad|*', - 'when' => 'Ja|*', - ), - 'mk-Cyrl' => - array ( - 'and' => '*|И', - 'background' => 'Контекст|Содржина', - 'but' => 'Но|*', - 'examples' => 'Сценарија|Примери', - 'feature' => 'Бизнис потреба|Функционалност|Можност', - 'given' => 'Дадена|Дадено|*', - 'name' => 'Macedonian', - 'native' => 'Македонски', - 'rule' => 'Rule', - 'scenario' => 'На пример|Сценарио|Пример', - 'scenario_outline' => 'Преглед на сценарија|Концепт|Скица', - 'then' => 'Тогаш|*', - 'when' => 'Кога|*', - ), - 'mk-Latn' => - array ( - 'and' => '*|I', - 'background' => 'Sodrzhina|Kontekst', - 'but' => 'No|*', - 'examples' => 'Scenaria|Primeri', - 'feature' => 'Biznis potreba|Funkcionalnost|Mozhnost', - 'given' => 'Dadena|Dadeno|*', - 'name' => 'Macedonian (Latin)', - 'native' => 'Makedonski (Latinica)', - 'rule' => 'Rule', - 'scenario' => 'Na primer|Scenario', - 'scenario_outline' => 'Pregled na scenarija|Koncept|Skica', - 'then' => 'Togash|*', - 'when' => 'Koga|*', - ), - 'mn' => - array ( - 'and' => 'Тэгээд|Мөн|*', - 'background' => 'Агуулга', - 'but' => 'Гэхдээ|Харин|*', - 'examples' => 'Тухайлбал', - 'feature' => 'Функционал|Функц', - 'given' => 'Өгөгдсөн нь|Анх|*', - 'name' => 'Mongolian', - 'native' => 'монгол', - 'rule' => 'Rule', - 'scenario' => 'Сценар', - 'scenario_outline' => 'Сценарын төлөвлөгөө', - 'then' => 'Үүний дараа|Тэгэхэд|*', - 'when' => 'Хэрэв|*', - ), - 'mr' => - array ( - 'and' => 'तसेच|आणि|*', - 'background' => 'पार्श्वभूमी', - 'but' => 'परंतु|पण|*', - 'examples' => 'उदाहरण', - 'feature' => 'वैशिष्ट्य|सुविधा', - 'given' => 'दिलेल्या प्रमाणे|जर<|*', - 'name' => 'Marathi', - 'native' => 'मराठी', - 'rule' => 'नियम', - 'scenario' => 'परिदृश्य', - 'scenario_outline' => 'परिदृश्य रूपरेखा', - 'then' => 'तेव्हा|मग|*', - 'when' => 'जेव्हा|*', - ), - 'ne' => - array ( - 'and' => 'अनी|*|र', - 'background' => 'पृष्ठभूमी', - 'but' => 'तर|*', - 'examples' => 'उदाहरणहरु|उदाहरण', - 'feature' => 'विशेषता|सुविधा', - 'given' => 'दिइएको|दिएको|यदि|*', - 'name' => 'Nepali', - 'native' => 'नेपाली', - 'rule' => 'नियम', - 'scenario' => 'परिदृश्य', - 'scenario_outline' => 'परिदृश्य रूपरेखा', - 'then' => 'त्यसपछि|अनी|*', - 'when' => 'जब|*', - ), - 'nl' => - array ( - 'and' => 'En|*', - 'background' => 'Achtergrond', - 'but' => 'Maar|*', - 'examples' => 'Voorbeelden', - 'feature' => 'Functionaliteit', - 'given' => 'Gegeven|Stel|*', - 'name' => 'Dutch', - 'native' => 'Nederlands', - 'rule' => 'Rule', - 'scenario' => 'Voorbeeld|Scenario', - 'scenario_outline' => 'Abstract Scenario', - 'then' => 'Dan|*', - 'when' => 'Wanneer|Als|*', - ), - 'no' => - array ( - 'and' => 'Og|*', - 'background' => 'Bakgrunn', - 'but' => 'Men|*', - 'examples' => 'Eksempler', - 'feature' => 'Egenskap', - 'given' => 'Gitt|*', - 'name' => 'Norwegian', - 'native' => 'norsk', - 'rule' => 'Regel', - 'scenario' => 'Eksempel|Scenario', - 'scenario_outline' => 'Abstrakt Scenario|Scenariomal', - 'then' => 'Så|*', - 'when' => 'Når|*', - ), - 'pa' => - array ( - 'and' => 'ਅਤੇ|*', - 'background' => 'ਪਿਛੋਕੜ', - 'but' => 'ਪਰ|*', - 'examples' => 'ਉਦਾਹਰਨਾਂ', - 'feature' => 'ਨਕਸ਼ ਨੁਹਾਰ|ਮੁਹਾਂਦਰਾ|ਖਾਸੀਅਤ', - 'given' => 'ਜਿਵੇਂ ਕਿ|ਜੇਕਰ|*', - 'name' => 'Panjabi', - 'native' => 'ਪੰਜਾਬੀ', - 'rule' => 'Rule', - 'scenario' => 'ਉਦਾਹਰਨ|ਪਟਕਥਾ', - 'scenario_outline' => 'ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ|ਪਟਕਥਾ ਢਾਂਚਾ', - 'then' => 'ਤਦ|*', - 'when' => 'ਜਦੋਂ|*', - ), - 'pl' => - array ( - 'and' => 'Oraz|*|I', - 'background' => 'Założenia', - 'but' => 'Ale|*', - 'examples' => 'Przykłady', - 'feature' => 'Potrzeba biznesowa|Właściwość|Funkcja|Aspekt', - 'given' => 'Zakładając, że|Zakładając|Mając|*', - 'name' => 'Polish', - 'native' => 'polski', - 'rule' => 'Reguła|Zasada', - 'scenario' => 'Scenariusz|Przykład', - 'scenario_outline' => 'Szablon scenariusza', - 'then' => 'Wtedy|*', - 'when' => 'Jeżeli|Jeśli|Kiedy|Gdy|*', - ), - 'pt' => - array ( - 'and' => '*|E', - 'background' => 'Cenario de Fundo|Cenário de Fundo|Contexto|Fundo', - 'but' => 'Mas|*', - 'examples' => 'Cenarios|Cenários|Exemplos', - 'feature' => 'Caracteristica|Característica|Funcionalidade', - 'given' => 'Dadas|Dados|Dada|Dado|*', - 'name' => 'Portuguese', - 'native' => 'português', - 'rule' => 'Regra', - 'scenario' => 'Cenario|Cenário|Exemplo', - 'scenario_outline' => 'Delineacao do Cenario|Delineação do Cenário|Esquema do Cenario|Esquema do Cenário', - 'then' => 'Entao|Então|*', - 'when' => 'Quando|*', - ), - 'ro' => - array ( - 'and' => 'Si|Şi|Și|*', - 'background' => 'Context', - 'but' => 'Dar|*', - 'examples' => 'Exemple', - 'feature' => 'Functionalitate|Funcţionalitate|Funcționalitate', - 'given' => 'Dată fiind<|Date fiind|Dati fiind|Daţi fiind|Dați fiind|Dat fiind|*', - 'name' => 'Romanian', - 'native' => 'română', - 'rule' => 'Rule', - 'scenario' => 'Scenariu|Exemplu', - 'scenario_outline' => 'Structura scenariu|Structură scenariu', - 'then' => 'Atunci|*', - 'when' => 'Cand|Când|*', - ), - 'ru' => - array ( - 'and' => 'К тому же|Также|*|И', - 'background' => 'Предыстория|Контекст', - 'but' => 'Иначе|Но|*|А', - 'examples' => 'Примеры', - 'feature' => 'Функциональность|Функционал|Свойство|Функция', - 'given' => 'Допустим|Пусть|Дано|*', - 'name' => 'Russian', - 'native' => 'русский', - 'rule' => 'Правило', - 'scenario' => 'Сценарий|Пример', - 'scenario_outline' => 'Структура сценария|Шаблон сценария', - 'then' => 'Затем|Тогда|То|*', - 'when' => 'Когда|Если|*', - ), - 'sk' => - array ( - 'and' => 'A taktiež|A zároveň|A tiež|*|A', - 'background' => 'Pozadie', - 'but' => 'Ale|*', - 'examples' => 'Príklady', - 'feature' => 'Požiadavka|Vlastnosť|Funkcia', - 'given' => 'Za predpokladu|Pokiaľ|*', - 'name' => 'Slovak', - 'native' => 'Slovensky', - 'rule' => 'Rule', - 'scenario' => 'Príklad|Scenár', - 'scenario_outline' => 'Osnova Scenára|Náčrt Scenára|Náčrt Scenáru', - 'then' => 'Potom|Tak|*', - 'when' => 'Keď|Ak|*', - ), - 'sl' => - array ( - 'and' => 'Ter|In', - 'background' => 'Kontekst|Osnova|Ozadje', - 'but' => 'Vendar|Ampak|Toda', - 'examples' => 'Scenariji|Primeri', - 'feature' => 'Funkcionalnost|Značilnost|Funkcija|Lastnost|Moznosti|Možnosti', - 'given' => 'Privzeto|Podano|Zaradi|Dano', - 'name' => 'Slovenian', - 'native' => 'Slovenski', - 'rule' => 'Rule', - 'scenario' => 'Scenarij|Primer', - 'scenario_outline' => 'Struktura scenarija|Oris scenarija|Koncept|Osnutek|Skica', - 'then' => 'Takrat|Potem|Nato', - 'when' => 'Kadar|Ce|Ko|Če', - ), - 'sr-Cyrl' => - array ( - 'and' => '*|И', - 'background' => 'Контекст|Позадина|Основа', - 'but' => 'Али|*', - 'examples' => 'Сценарији|Примери', - 'feature' => 'Функционалност|Могућност|Особина', - 'given' => 'За дате|За дати|За дато|*', - 'name' => 'Serbian', - 'native' => 'Српски', - 'rule' => 'Правило', - 'scenario' => 'Сценарио|Пример|Пример', - 'scenario_outline' => 'Структура сценарија|Концепт|Скица', - 'then' => 'Онда|*', - 'when' => 'Када|Кад|*', - ), - 'sr-Latn' => - array ( - 'and' => '*|I', - 'background' => 'Kontekst|Pozadina|Osnova', - 'but' => 'Ali|*', - 'examples' => 'Scenariji|Primeri', - 'feature' => 'Funkcionalnost|Mogucnost|Mogućnost|Osobina', - 'given' => 'Za date|Za dati|Za dato|*', - 'name' => 'Serbian (Latin)', - 'native' => 'Srpski (Latinica)', - 'rule' => 'Pravilo', - 'scenario' => 'Scenario|Primer', - 'scenario_outline' => 'Struktura scenarija|Koncept|Skica', - 'then' => 'Onda|*', - 'when' => 'Kada|Kad|*', - ), - 'sv' => - array ( - 'and' => 'Och|*', - 'background' => 'Bakgrund', - 'but' => 'Men|*', - 'examples' => 'Exempel', - 'feature' => 'Egenskap', - 'given' => 'Givet|*', - 'name' => 'Swedish', - 'native' => 'Svenska', - 'rule' => 'Regel', - 'scenario' => 'Scenario', - 'scenario_outline' => 'Abstrakt Scenario|Scenariomall', - 'then' => 'Så|*', - 'when' => 'När|*', - ), - 'ta' => - array ( - 'and' => 'மற்றும்|மேலும்|*', - 'background' => 'பின்னணி', - 'but' => 'ஆனால்|*', - 'examples' => 'எடுத்துக்காட்டுகள்|நிலைமைகளில்|காட்சிகள்', - 'feature' => 'வணிக தேவை|அம்சம்|திறன்', - 'given' => 'கொடுக்கப்பட்ட|*', - 'name' => 'Tamil', - 'native' => 'தமிழ்', - 'rule' => 'Rule', - 'scenario' => 'உதாரணமாக|காட்சி', - 'scenario_outline' => 'காட்சி வார்ப்புரு|காட்சி சுருக்கம்', - 'then' => 'அப்பொழுது|*', - 'when' => 'எப்போது|*', - ), - 'te' => - array ( - 'and' => 'మరియు|*', - 'background' => 'నేపథ్యం', - 'but' => 'కాని|*', - 'examples' => 'ఉదాహరణలు', - 'feature' => 'గుణము', - 'given' => 'చెప్పబడినది|*', - 'name' => 'Telugu', - 'native' => 'తెలుగు', - 'rule' => 'Rule', - 'scenario' => 'సన్నివేశం|ఉదాహరణ', - 'scenario_outline' => 'కథనం', - 'then' => 'అప్పుడు|*', - 'when' => 'ఈ పరిస్థితిలో|*', - ), - 'th' => - array ( - 'and' => 'และ|*', - 'background' => 'แนวคิด', - 'but' => 'แต่|*', - 'examples' => 'ชุดของเหตุการณ์|ชุดของตัวอย่าง', - 'feature' => 'ความต้องการทางธุรกิจ|ความสามารถ|โครงหลัก', - 'given' => 'กำหนดให้|*', - 'name' => 'Thai', - 'native' => 'ไทย', - 'rule' => 'Rule', - 'scenario' => 'เหตุการณ์', - 'scenario_outline' => 'โครงสร้างของเหตุการณ์|สรุปเหตุการณ์', - 'then' => 'ดังนั้น|*', - 'when' => 'เมื่อ|*', - ), - 'tlh' => - array ( - 'and' => 'latlh|\'ej|*', - 'background' => 'mo\'', - 'but' => '\'ach|\'a|*', - 'examples' => 'ghantoH|lutmey', - 'feature' => 'poQbogh malja\'|Qu\'meH \'ut|perbogh|Qap|laH', - 'given' => 'DaH ghu\' bejlu\'|ghu\' noblu\'|*', - 'name' => 'Klingon', - 'native' => 'tlhIngan', - 'rule' => 'Rule', - 'scenario' => 'lut', - 'scenario_outline' => 'lut chovnatlh', - 'then' => 'vaj|*', - 'when' => 'qaSDI\'|*', - ), - 'tr' => - array ( - 'and' => 'Ve|*', - 'background' => 'Geçmiş', - 'but' => 'Fakat|Ama|*', - 'examples' => 'Örnekler', - 'feature' => 'Özellik', - 'given' => 'Diyelim ki|*', - 'name' => 'Turkish', - 'native' => 'Türkçe', - 'rule' => 'Kural', - 'scenario' => 'Senaryo|Örnek', - 'scenario_outline' => 'Senaryo taslağı', - 'then' => 'O zaman|*', - 'when' => 'Eğer ki|*', - ), - 'tt' => - array ( - 'and' => 'Һәм|Вә|*', - 'background' => 'Кереш', - 'but' => 'Ләкин|Әмма|*', - 'examples' => 'Мисаллар|Үрнәкләр', - 'feature' => 'Үзенчәлеклелек|Мөмкинлек', - 'given' => 'Әйтик|*', - 'name' => 'Tatar', - 'native' => 'Татарча', - 'rule' => 'Rule', - 'scenario' => 'Сценарий', - 'scenario_outline' => 'Сценарийның төзелеше', - 'then' => 'Нәтиҗәдә|*', - 'when' => 'Әгәр|*', - ), - 'uk' => - array ( - 'and' => 'А також|Та|*|І', - 'background' => 'Передумова', - 'but' => 'Але|*', - 'examples' => 'Приклади', - 'feature' => 'Функціонал', - 'given' => 'Припустимо, що|Припустимо|Нехай|Дано|*', - 'name' => 'Ukrainian', - 'native' => 'Українська', - 'rule' => 'Rule', - 'scenario' => 'Сценарій|Приклад', - 'scenario_outline' => 'Структура сценарію', - 'then' => 'Тоді|То|*', - 'when' => 'Коли|Якщо|*', - ), - 'ur' => - array ( - 'and' => 'اور|*', - 'background' => 'پس منظر', - 'but' => 'لیکن|*', - 'examples' => 'مثالیں', - 'feature' => 'کاروبار کی ضرورت|خصوصیت|صلاحیت', - 'given' => 'فرض کیا|بالفرض|اگر|*', - 'name' => 'Urdu', - 'native' => 'اردو', - 'rule' => 'Rule', - 'scenario' => 'منظرنامہ', - 'scenario_outline' => 'منظر نامے کا خاکہ', - 'then' => 'پھر|تب|*', - 'when' => 'جب|*', - ), - 'uz' => - array ( - 'and' => 'Ва|*', - 'background' => 'Тарих', - 'but' => 'Бирок|Лекин|Аммо|*', - 'examples' => 'Мисоллар', - 'feature' => 'Функционал', - 'given' => 'Агар|*', - 'name' => 'Uzbek', - 'native' => 'Узбекча', - 'rule' => 'Rule', - 'scenario' => 'Сценарий', - 'scenario_outline' => 'Сценарий структураси', - 'then' => 'Унда|*', - 'when' => 'Агар|*', - ), - 'vi' => - array ( - 'and' => 'Và|*', - 'background' => 'Bối cảnh', - 'but' => 'Nhưng|*', - 'examples' => 'Dữ liệu', - 'feature' => 'Tính năng', - 'given' => 'Biết|Cho|*', - 'name' => 'Vietnamese', - 'native' => 'Tiếng Việt', - 'rule' => 'Rule', - 'scenario' => 'Tình huống|Kịch bản', - 'scenario_outline' => 'Khung tình huống|Khung kịch bản', - 'then' => 'Thì|*', - 'when' => 'Khi|*', - ), - 'zh-CN' => - array ( - 'and' => '同时<|并且<|而且<|*', - 'background' => '背景', - 'but' => '但是<|*', - 'examples' => '例子', - 'feature' => '功能', - 'given' => '假如<|假定<|假设<|*', - 'name' => 'Chinese simplified', - 'native' => '简体中文', - 'rule' => 'Rule', - 'scenario' => '剧本|场景', - 'scenario_outline' => '剧本大纲|场景大纲', - 'then' => '那么<|*', - 'when' => '当<|*', - ), - 'zh-TW' => - array ( - 'and' => '並且<|同時<|而且<|*', - 'background' => '背景', - 'but' => '但是<|*', - 'examples' => '例子', - 'feature' => '功能', - 'given' => '假如<|假定<|假設<|*', - 'name' => 'Chinese traditional', - 'native' => '繁體中文', - 'rule' => 'Rule', - 'scenario' => '劇本|場景', - 'scenario_outline' => '劇本大綱|場景大綱', - 'then' => '那麼<|*', - 'when' => '當<|*', - ), -); \ No newline at end of file diff --git a/tests/integration/vendor/behat/gherkin/libpath.php b/tests/integration/vendor/behat/gherkin/libpath.php deleted file mode 100644 index 35379fe..0000000 --- a/tests/integration/vendor/behat/gherkin/libpath.php +++ /dev/null @@ -1,3 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Cache; - -use Behat\Gherkin\Node\FeatureNode; - -/** - * Parser cache interface. - * - * @author Konstantin Kudryashov - */ -interface CacheInterface -{ - /** - * Checks that cache for feature exists and is fresh. - * - * @param string $path Feature path - * @param integer $timestamp The last time feature was updated - * - * @return bool - */ - public function isFresh($path, $timestamp); - - /** - * Reads feature cache from path. - * - * @param string $path Feature path - * - * @return FeatureNode - */ - public function read($path); - - /** - * Caches feature node. - * - * @param string $path Feature path - * @param FeatureNode $feature Feature instance - */ - public function write($path, FeatureNode $feature); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/FileCache.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/FileCache.php deleted file mode 100644 index 44707c2..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/FileCache.php +++ /dev/null @@ -1,109 +0,0 @@ - -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ - -namespace Behat\Gherkin\Cache; - -use Behat\Gherkin\Exception\CacheException; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Gherkin; - -/** - * File cache. - * Caches feature into a file. - * - * @author Konstantin Kudryashov - */ -class FileCache implements CacheInterface -{ - private $path; - - /** - * Initializes file cache. - * - * @param string $path Path to the folder where to store caches. - * - * @throws CacheException - */ - public function __construct($path) - { - $this->path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'v'.Gherkin::VERSION; - - if (!is_dir($this->path)) { - @mkdir($this->path, 0777, true); - } - - if (!is_writeable($this->path)) { - throw new CacheException(sprintf('Cache path "%s" is not writeable. Check your filesystem permissions or disable Gherkin file cache.', $this->path)); - } - } - - /** - * Checks that cache for feature exists and is fresh. - * - * @param string $path Feature path - * @param integer $timestamp The last time feature was updated - * - * @return bool - */ - public function isFresh($path, $timestamp) - { - $cachePath = $this->getCachePathFor($path); - - if (!file_exists($cachePath)) { - return false; - } - - return filemtime($cachePath) > $timestamp; - } - - /** - * Reads feature cache from path. - * - * @param string $path Feature path - * - * @return FeatureNode - * - * @throws CacheException - */ - public function read($path) - { - $cachePath = $this->getCachePathFor($path); - $feature = unserialize(file_get_contents($cachePath)); - - if (!$feature instanceof FeatureNode) { - throw new CacheException(sprintf('Can not load cache for a feature "%s" from "%s".', $path, $cachePath )); - } - - return $feature; - } - - /** - * Caches feature node. - * - * @param string $path Feature path - * @param FeatureNode $feature Feature instance - */ - public function write($path, FeatureNode $feature) - { - file_put_contents($this->getCachePathFor($path), serialize($feature)); - } - - /** - * Returns feature cache file path from features path. - * - * @param string $path Feature path - * - * @return string - */ - protected function getCachePathFor($path) - { - return $this->path.'/'.md5($path).'.feature.cache'; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/MemoryCache.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/MemoryCache.php deleted file mode 100644 index 12d56ff..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Cache/MemoryCache.php +++ /dev/null @@ -1,66 +0,0 @@ - -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ - -namespace Behat\Gherkin\Cache; - -use Behat\Gherkin\Node\FeatureNode; - -/** - * Memory cache. - * Caches feature into a memory. - * - * @author Konstantin Kudryashov - */ -class MemoryCache implements CacheInterface -{ - private $features = array(); - private $timestamps = array(); - - /** - * Checks that cache for feature exists and is fresh. - * - * @param string $path Feature path - * @param integer $timestamp The last time feature was updated - * - * @return bool - */ - public function isFresh($path, $timestamp) - { - if (!isset($this->features[$path])) { - return false; - } - - return $this->timestamps[$path] > $timestamp; - } - - /** - * Reads feature cache from path. - * - * @param string $path Feature path - * - * @return FeatureNode - */ - public function read($path) - { - return $this->features[$path]; - } - - /** - * Caches feature node. - * - * @param string $path Feature path - * @param FeatureNode $feature Feature instance - */ - public function write($path, FeatureNode $feature) - { - $this->features[$path] = $feature; - $this->timestamps[$path] = time(); - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/CacheException.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/CacheException.php deleted file mode 100644 index f8b9214..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/CacheException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Exception; - -use RuntimeException; - -/** - * Cache exception. - * - * @author Konstantin Kudryashov - */ -class CacheException extends RuntimeException implements Exception -{ -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/Exception.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/Exception.php deleted file mode 100644 index f377e30..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/Exception.php +++ /dev/null @@ -1,15 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Exception; - -interface Exception -{ -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/LexerException.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/LexerException.php deleted file mode 100644 index 476d81f..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/LexerException.php +++ /dev/null @@ -1,17 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Exception; - -use RuntimeException; - -class LexerException extends RuntimeException implements Exception -{ -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/NodeException.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/NodeException.php deleted file mode 100644 index b7d7a4c..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/NodeException.php +++ /dev/null @@ -1,17 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Exception; - -use RuntimeException; - -class NodeException extends RuntimeException implements Exception -{ -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/ParserException.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/ParserException.php deleted file mode 100644 index f835e72..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Exception/ParserException.php +++ /dev/null @@ -1,17 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Exception; - -use RuntimeException; - -class ParserException extends RuntimeException implements Exception -{ -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/ComplexFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/ComplexFilter.php deleted file mode 100644 index a3a3b08..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/ComplexFilter.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; - -/** - * Abstract filter class. - * - * @author Konstantin Kudryashov - */ -abstract class ComplexFilter implements ComplexFilterInterface -{ - /** - * Filters feature according to the filter. - * - * @param FeatureNode $feature - * - * @return FeatureNode - */ - public function filterFeature(FeatureNode $feature) - { - $scenarios = array(); - foreach ($feature->getScenarios() as $scenario) { - if (!$this->isScenarioMatch($feature, $scenario)) { - continue; - } - - $scenarios[] = $scenario; - } - - return new FeatureNode( - $feature->getTitle(), - $feature->getDescription(), - $feature->getTags(), - $feature->getBackground(), - $scenarios, - $feature->getKeyword(), - $feature->getLanguage(), - $feature->getFile(), - $feature->getLine() - ); - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/ComplexFilterInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/ComplexFilterInterface.php deleted file mode 100644 index 82addd0..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/ComplexFilterInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filter interface. - * - * @author Konstantin Kudryashov - */ -interface ComplexFilterInterface extends FeatureFilterInterface -{ - /** - * Checks if scenario or outline matches specified filter. - * - * @param FeatureNode $feature Feature node instance - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return bool - */ - public function isScenarioMatch(FeatureNode $feature, ScenarioInterface $scenario); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/FeatureFilterInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/FeatureFilterInterface.php deleted file mode 100644 index 6994b31..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/FeatureFilterInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; - -/** - * Feature filter interface. - * - * @author Konstantin Kudryashov - */ -interface FeatureFilterInterface -{ - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return bool - */ - public function isFeatureMatch(FeatureNode $feature); - - /** - * Filters feature according to the filter and returns new one. - * - * @param FeatureNode $feature - * - * @return FeatureNode - */ - public function filterFeature(FeatureNode $feature); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/FilterInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/FilterInterface.php deleted file mode 100644 index 469cb3c..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/FilterInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filter interface. - * - * @author Konstantin Kudryashov - */ -interface FilterInterface extends FeatureFilterInterface -{ - /** - * Checks if scenario or outline matches specified filter. - * - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return bool - */ - public function isScenarioMatch(ScenarioInterface $scenario); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/LineFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/LineFilter.php deleted file mode 100644 index 9cf6b30..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/LineFilter.php +++ /dev/null @@ -1,124 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\ExampleTableNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filters scenarios by definition line number. - * - * @author Konstantin Kudryashov - */ -class LineFilter implements FilterInterface -{ - protected $filterLine; - - /** - * Initializes filter. - * - * @param string $filterLine Line of the scenario to filter on - */ - public function __construct($filterLine) - { - $this->filterLine = intval($filterLine); - } - - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return bool - */ - public function isFeatureMatch(FeatureNode $feature) - { - return $this->filterLine === $feature->getLine(); - } - - /** - * Checks if scenario or outline matches specified filter. - * - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return bool - */ - public function isScenarioMatch(ScenarioInterface $scenario) - { - if ($this->filterLine === $scenario->getLine()) { - return true; - } - - if ($scenario instanceof OutlineNode && $scenario->hasExamples()) { - return $this->filterLine === $scenario->getLine() - || in_array($this->filterLine, $scenario->getExampleTable()->getLines()); - } - - return false; - } - - /** - * Filters feature according to the filter and returns new one. - * - * @param FeatureNode $feature - * - * @return FeatureNode - */ - public function filterFeature(FeatureNode $feature) - { - $scenarios = array(); - foreach ($feature->getScenarios() as $scenario) { - if (!$this->isScenarioMatch($scenario)) { - continue; - } - - if ($scenario instanceof OutlineNode && $scenario->hasExamples()) { - foreach ($scenario->getExampleTables() as $exampleTable) { - $table = $exampleTable->getTable(); - $lines = array_keys($table); - - if (in_array($this->filterLine, $lines)) { - $filteredTable = array($lines[0] => $table[$lines[0]]); - - if ($lines[0] !== $this->filterLine) { - $filteredTable[$this->filterLine] = $table[$this->filterLine]; - } - - $scenario = new OutlineNode( - $scenario->getTitle(), - $scenario->getTags(), - $scenario->getSteps(), - array(new ExampleTableNode($filteredTable, $exampleTable->getKeyword(), $exampleTable->getTags())), - $scenario->getKeyword(), - $scenario->getLine() - ); - } - } - } - - $scenarios[] = $scenario; - } - - return new FeatureNode( - $feature->getTitle(), - $feature->getDescription(), - $feature->getTags(), - $feature->getBackground(), - $scenarios, - $feature->getKeyword(), - $feature->getLanguage(), - $feature->getFile(), - $feature->getLine() - ); - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/LineRangeFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/LineRangeFilter.php deleted file mode 100644 index e73d12d..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/LineRangeFilter.php +++ /dev/null @@ -1,143 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\ExampleTableNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filters scenarios by definition line number range. - * - * @author Fabian Kiss - */ -class LineRangeFilter implements FilterInterface -{ - protected $filterMinLine; - protected $filterMaxLine; - - /** - * Initializes filter. - * - * @param string $filterMinLine Minimum line of a scenario to filter on - * @param string $filterMaxLine Maximum line of a scenario to filter on - */ - public function __construct($filterMinLine, $filterMaxLine) - { - $this->filterMinLine = intval($filterMinLine); - if ($filterMaxLine == '*') { - $this->filterMaxLine = PHP_INT_MAX; - } else { - $this->filterMaxLine = intval($filterMaxLine); - } - } - - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return bool - */ - public function isFeatureMatch(FeatureNode $feature) - { - return $this->filterMinLine <= $feature->getLine() - && $this->filterMaxLine >= $feature->getLine(); - } - - /** - * Checks if scenario or outline matches specified filter. - * - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return bool - */ - public function isScenarioMatch(ScenarioInterface $scenario) - { - if ($this->filterMinLine <= $scenario->getLine() && $this->filterMaxLine >= $scenario->getLine()) { - return true; - } - - if ($scenario instanceof OutlineNode && $scenario->hasExamples()) { - foreach ($scenario->getExampleTable()->getLines() as $line) { - if ($this->filterMinLine <= $line && $this->filterMaxLine >= $line) { - return true; - } - } - } - - return false; - } - - /** - * Filters feature according to the filter. - * - * @param FeatureNode $feature - * - * @return FeatureNode - */ - public function filterFeature(FeatureNode $feature) - { - $scenarios = array(); - foreach ($feature->getScenarios() as $scenario) { - if (!$this->isScenarioMatch($scenario)) { - continue; - } - - if ($scenario instanceof OutlineNode && $scenario->hasExamples()) { - // first accumulate examples and then create scenario - $exampleTableNodes = array(); - - foreach ($scenario->getExampleTables() as $exampleTable) { - $table = $exampleTable->getTable(); - $lines = array_keys($table); - - $filteredTable = array($lines[0] => $table[$lines[0]]); - unset($table[$lines[0]]); - - foreach ($table as $line => $row) { - if ($this->filterMinLine <= $line && $this->filterMaxLine >= $line) { - $filteredTable[$line] = $row; - } - } - - if (count($filteredTable) > 1) { - $exampleTableNodes[] = new ExampleTableNode($filteredTable, $exampleTable->getKeyword(), $exampleTable->getTags()); - } - } - - $scenario = new OutlineNode( - $scenario->getTitle(), - $scenario->getTags(), - $scenario->getSteps(), - $exampleTableNodes, - $scenario->getKeyword(), - $scenario->getLine() - ); - } - - $scenarios[] = $scenario; - } - - return new FeatureNode( - $feature->getTitle(), - $feature->getDescription(), - $feature->getTags(), - $feature->getBackground(), - $scenarios, - $feature->getKeyword(), - $feature->getLanguage(), - $feature->getFile(), - $feature->getLine() - ); - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/NameFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/NameFilter.php deleted file mode 100644 index 80974d1..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/NameFilter.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filters scenarios by feature/scenario name. - * - * @author Konstantin Kudryashov - */ -class NameFilter extends SimpleFilter -{ - protected $filterString; - - /** - * Initializes filter. - * - * @param string $filterString Name filter string - */ - public function __construct($filterString) - { - $this->filterString = trim($filterString); - } - - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return bool - */ - public function isFeatureMatch(FeatureNode $feature) - { - if (null === $feature->getTitle()) { - return false; - } - - if ('/' === $this->filterString[0]) { - return 1 === preg_match($this->filterString, $feature->getTitle()); - } - - return false !== mb_strpos($feature->getTitle(), $this->filterString, 0, 'utf8'); - } - - /** - * Checks if scenario or outline matches specified filter. - * - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return bool - */ - public function isScenarioMatch(ScenarioInterface $scenario) - { - if (null === $scenario->getTitle()) { - return false; - } - - if ('/' === $this->filterString[0] && 1 === preg_match($this->filterString, $scenario->getTitle())) { - return true; - } elseif (false !== mb_strpos($scenario->getTitle(), $this->filterString, 0, 'utf8')) { - return true; - } - - return false; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/NarrativeFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/NarrativeFilter.php deleted file mode 100644 index eb5ae48..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/NarrativeFilter.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\ScenarioInterface; -use Behat\Gherkin\Node\FeatureNode; - -/** - * Filters features by their narrative using regular expression. - * - * @author Konstantin Kudryashov - */ -class NarrativeFilter extends SimpleFilter -{ - /** - * @var string - */ - private $regex; - - /** - * Initializes filter. - * - * @param string $regex - */ - public function __construct($regex) - { - $this->regex = $regex; - } - - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return bool - */ - public function isFeatureMatch(FeatureNode $feature) - { - return 1 === preg_match($this->regex, $feature->getDescription() ?? ''); - } - - /** - * Checks if scenario or outline matches specified filter. - * - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return bool - */ - public function isScenarioMatch(ScenarioInterface $scenario) - { - return false; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/PathsFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/PathsFilter.php deleted file mode 100644 index f928597..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/PathsFilter.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filters features by their paths. - * - * @author Konstantin Kudryashov - */ -class PathsFilter extends SimpleFilter -{ - protected $filterPaths = array(); - - /** - * Initializes filter. - * - * @param string[] $paths List of approved paths - */ - public function __construct(array $paths) - { - $this->filterPaths = array_map( - function ($realpath) { - return rtrim($realpath, DIRECTORY_SEPARATOR) . - (is_dir($realpath) ? DIRECTORY_SEPARATOR : ''); - }, - array_filter( - array_map('realpath', $paths) - ) - ); - } - - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return bool - */ - public function isFeatureMatch(FeatureNode $feature) - { - foreach ($this->filterPaths as $path) { - if (0 === strpos(realpath($feature->getFile()), $path)) { - return true; - } - } - - return false; - } - - /** - * Checks if scenario or outline matches specified filter. - * - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return false This filter is designed to work only with features - */ - public function isScenarioMatch(ScenarioInterface $scenario) - { - return false; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/RoleFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/RoleFilter.php deleted file mode 100644 index 0ad3a29..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/RoleFilter.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filters features by their actors role. - * - * @author Konstantin Kudryashov - */ -class RoleFilter extends SimpleFilter -{ - protected $pattern; - - /** - * Initializes filter. - * - * @param string $role Approved role wildcard - */ - public function __construct($role) - { - $this->pattern = '/as an? ' . strtr(preg_quote($role, '/'), array( - '\*' => '.*', - '\?' => '.', - '\[' => '[', - '\]' => ']' - )) . '[$\n]/i'; - } - - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return bool - */ - public function isFeatureMatch(FeatureNode $feature) - { - return 1 === preg_match($this->pattern, $feature->getDescription() ?? ''); - } - - /** - * Checks if scenario or outline matches specified filter. - * - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return false This filter is designed to work only with features - */ - public function isScenarioMatch(ScenarioInterface $scenario) - { - return false; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/SimpleFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/SimpleFilter.php deleted file mode 100644 index 10bee8f..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/SimpleFilter.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; - -/** - * Abstract filter class. - * - * @author Konstantin Kudryashov - */ -abstract class SimpleFilter implements FilterInterface -{ - /** - * Filters feature according to the filter. - * - * @param FeatureNode $feature - * - * @return FeatureNode - */ - public function filterFeature(FeatureNode $feature) - { - if ($this->isFeatureMatch($feature)) { - return $feature; - } - - $scenarios = array(); - foreach ($feature->getScenarios() as $scenario) { - if (!$this->isScenarioMatch($scenario)) { - continue; - } - - $scenarios[] = $scenario; - } - - return new FeatureNode( - $feature->getTitle(), - $feature->getDescription(), - $feature->getTags(), - $feature->getBackground(), - $scenarios, - $feature->getKeyword(), - $feature->getLanguage(), - $feature->getFile(), - $feature->getLine() - ); - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/TagFilter.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/TagFilter.php deleted file mode 100644 index 579ed4e..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Filter/TagFilter.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Filter; - -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\ScenarioInterface; - -/** - * Filters scenarios by feature/scenario tag. - * - * @author Konstantin Kudryashov - */ -class TagFilter extends ComplexFilter -{ - protected $filterString; - - /** - * Initializes filter. - * - * @param string $filterString Name filter string - */ - public function __construct($filterString) - { - $this->filterString = trim($filterString); - - if(preg_match('/\s/u', $this->filterString)) { - trigger_error( - "Tags with whitespace are deprecated and may be removed in a future version", - E_USER_DEPRECATED - ); - } - } - - /** - * Filters feature according to the filter. - * - * @param FeatureNode $feature - * - * @return FeatureNode - */ - public function filterFeature(FeatureNode $feature) - { - $scenarios = array(); - foreach ($feature->getScenarios() as $scenario) { - if (!$this->isScenarioMatch($feature, $scenario)) { - continue; - } - - if ($scenario instanceof OutlineNode && $scenario->hasExamples()) { - - $exampleTables = array(); - - foreach ($scenario->getExampleTables() as $exampleTable) { - if ($this->isTagsMatchCondition(array_merge($feature->getTags(), $scenario->getTags(), $exampleTable->getTags()))) { - $exampleTables[] = $exampleTable; - } - } - - $scenario = new OutlineNode( - $scenario->getTitle(), - $scenario->getTags(), - $scenario->getSteps(), - $exampleTables, - $scenario->getKeyword(), - $scenario->getLine() - ); - } - - $scenarios[] = $scenario; - } - - return new FeatureNode( - $feature->getTitle(), - $feature->getDescription(), - $feature->getTags(), - $feature->getBackground(), - $scenarios, - $feature->getKeyword(), - $feature->getLanguage(), - $feature->getFile(), - $feature->getLine() - ); - } - - /** - * Checks if Feature matches specified filter. - * - * @param FeatureNode $feature Feature instance - * - * @return bool - */ - public function isFeatureMatch(FeatureNode $feature) - { - return $this->isTagsMatchCondition($feature->getTags()); - } - - /** - * Checks if scenario or outline matches specified filter. - * - * @param FeatureNode $feature Feature node instance - * @param ScenarioInterface $scenario Scenario or Outline node instance - * - * @return bool - */ - public function isScenarioMatch(FeatureNode $feature, ScenarioInterface $scenario) - { - if ($scenario instanceof OutlineNode && $scenario->hasExamples()) { - foreach ($scenario->getExampleTables() as $example) { - if ($this->isTagsMatchCondition(array_merge($feature->getTags(), $scenario->getTags(), $example->getTags()))) { - return true; - } - } - - return false; - } - - return $this->isTagsMatchCondition(array_merge($feature->getTags(), $scenario->getTags())); - } - - /** - * Checks that node matches condition. - * - * @param string[] $tags - * - * @return bool - */ - protected function isTagsMatchCondition($tags) - { - $satisfies = true; - - foreach (explode('&&', $this->filterString) as $andTags) { - $satisfiesComma = false; - - foreach (explode(',', $andTags) as $tag) { - $tag = str_replace('@', '', trim($tag)); - - if ('~' === $tag[0]) { - $tag = mb_substr($tag, 1, mb_strlen($tag, 'utf8') - 1, 'utf8'); - $satisfiesComma = !in_array($tag, $tags) || $satisfiesComma; - } else { - $satisfiesComma = in_array($tag, $tags) || $satisfiesComma; - } - } - - $satisfies = $satisfiesComma && $satisfies; - } - - return $satisfies; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Gherkin.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Gherkin.php deleted file mode 100644 index c3cc5c0..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Gherkin.php +++ /dev/null @@ -1,142 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin; - -use Behat\Gherkin\Filter\FeatureFilterInterface; -use Behat\Gherkin\Filter\LineFilter; -use Behat\Gherkin\Filter\LineRangeFilter; -use Behat\Gherkin\Loader\FileLoaderInterface; -use Behat\Gherkin\Loader\LoaderInterface; - -/** - * Gherkin manager. - * - * @author Konstantin Kudryashov - */ -class Gherkin -{ - const VERSION = '4.8.0'; - - /** - * @var LoaderInterface[] - */ - protected $loaders = array(); - /** - * @var FeatureFilterInterface[] - */ - protected $filters = array(); - - /** - * Adds loader to manager. - * - * @param LoaderInterface $loader Feature loader - */ - public function addLoader(LoaderInterface $loader) - { - $this->loaders[] = $loader; - } - - /** - * Adds filter to manager. - * - * @param FeatureFilterInterface $filter Feature filter - */ - public function addFilter(FeatureFilterInterface $filter) - { - $this->filters[] = $filter; - } - - /** - * Sets filters to the parser. - * - * @param FeatureFilterInterface[] $filters - */ - public function setFilters(array $filters) - { - $this->filters = array(); - array_map(array($this, 'addFilter'), $filters); - } - - /** - * Sets base features path. - * - * @param string $path Loaders base path - */ - public function setBasePath($path) - { - foreach ($this->loaders as $loader) { - if ($loader instanceof FileLoaderInterface) { - $loader->setBasePath($path); - } - } - } - - /** - * Loads & filters resource with added loaders. - * - * @param mixed $resource Resource to load - * @param FeatureFilterInterface[] $filters Additional filters - * - * @return array - */ - public function load($resource, array $filters = array()) - { - $filters = array_merge($this->filters, $filters); - - $matches = array(); - if (preg_match('/^(.*)\:(\d+)-(\d+|\*)$/', $resource, $matches)) { - $resource = $matches[1]; - $filters[] = new LineRangeFilter($matches[2], $matches[3]); - } elseif (preg_match('/^(.*)\:(\d+)$/', $resource, $matches)) { - $resource = $matches[1]; - $filters[] = new LineFilter($matches[2]); - } - - $loader = $this->resolveLoader($resource); - - if (null === $loader) { - return array(); - } - - $features = array(); - foreach ($loader->load($resource) as $feature) { - foreach ($filters as $filter) { - $feature = $filter->filterFeature($feature); - - if (!$feature->hasScenarios() && !$filter->isFeatureMatch($feature)) { - continue 2; - } - } - - $features[] = $feature; - } - - return $features; - } - - /** - * Resolves loader by resource. - * - * @param mixed $resource Resource to load - * - * @return LoaderInterface - */ - public function resolveLoader($resource) - { - foreach ($this->loaders as $loader) { - if ($loader->supports($resource)) { - return $loader; - } - } - - return null; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/ArrayKeywords.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/ArrayKeywords.php deleted file mode 100644 index 2aa6b30..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/ArrayKeywords.php +++ /dev/null @@ -1,200 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Keywords; - -/** - * Array initializable keywords holder. - * - * $keywords = new Behat\Gherkin\Keywords\ArrayKeywords(array( - * 'en' => array( - * 'feature' => 'Feature', - * 'background' => 'Background', - * 'scenario' => 'Scenario', - * 'scenario_outline' => 'Scenario Outline|Scenario Template', - * 'examples' => 'Examples|Scenarios', - * 'given' => 'Given', - * 'when' => 'When', - * 'then' => 'Then', - * 'and' => 'And', - * 'but' => 'But' - * ), - * 'ru' => array( - * 'feature' => 'Функционал', - * 'background' => 'Предыстория', - * 'scenario' => 'Сценарий', - * 'scenario_outline' => 'Структура сценария', - * 'examples' => 'Примеры', - * 'given' => 'Допустим', - * 'when' => 'Если', - * 'then' => 'То', - * 'and' => 'И', - * 'but' => 'Но' - * ) - * )); - * - * @author Konstantin Kudryashov - */ -class ArrayKeywords implements KeywordsInterface -{ - private $keywords = array(); - private $keywordString = array(); - private $language; - - /** - * Initializes holder with keywords. - * - * @param array $keywords Keywords array - */ - public function __construct(array $keywords) - { - $this->keywords = $keywords; - } - - /** - * Sets keywords holder language. - * - * @param string $language Language name - */ - public function setLanguage($language) - { - if (!isset($this->keywords[$language])) { - $this->language = 'en'; - } else { - $this->language = $language; - } - } - - /** - * Returns Feature keywords (splitted by "|"). - * - * @return string - */ - public function getFeatureKeywords() - { - return $this->keywords[$this->language]['feature']; - } - - /** - * Returns Background keywords (splitted by "|"). - * - * @return string - */ - public function getBackgroundKeywords() - { - return $this->keywords[$this->language]['background']; - } - - /** - * Returns Scenario keywords (splitted by "|"). - * - * @return string - */ - public function getScenarioKeywords() - { - return $this->keywords[$this->language]['scenario']; - } - - /** - * Returns Scenario Outline keywords (splitted by "|"). - * - * @return string - */ - public function getOutlineKeywords() - { - return $this->keywords[$this->language]['scenario_outline']; - } - - /** - * Returns Examples keywords (splitted by "|"). - * - * @return string - */ - public function getExamplesKeywords() - { - return $this->keywords[$this->language]['examples']; - } - - /** - * Returns Given keywords (splitted by "|"). - * - * @return string - */ - public function getGivenKeywords() - { - return $this->keywords[$this->language]['given']; - } - - /** - * Returns When keywords (splitted by "|"). - * - * @return string - */ - public function getWhenKeywords() - { - return $this->keywords[$this->language]['when']; - } - - /** - * Returns Then keywords (splitted by "|"). - * - * @return string - */ - public function getThenKeywords() - { - return $this->keywords[$this->language]['then']; - } - - /** - * Returns And keywords (splitted by "|"). - * - * @return string - */ - public function getAndKeywords() - { - return $this->keywords[$this->language]['and']; - } - - /** - * Returns But keywords (splitted by "|"). - * - * @return string - */ - public function getButKeywords() - { - return $this->keywords[$this->language]['but']; - } - - /** - * Returns all step keywords (Given, When, Then, And, But). - * - * @return string - */ - public function getStepKeywords() - { - if (!isset($this->keywordString[$this->language])) { - $keywords = array_merge( - explode('|', $this->getGivenKeywords()), - explode('|', $this->getWhenKeywords()), - explode('|', $this->getThenKeywords()), - explode('|', $this->getAndKeywords()), - explode('|', $this->getButKeywords()) - ); - - usort($keywords, function ($keyword1, $keyword2) { - return mb_strlen($keyword2, 'utf8') - mb_strlen($keyword1, 'utf8'); - }); - - $this->keywordString[$this->language] = implode('|', $keywords); - } - - return $this->keywordString[$this->language]; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/CachedArrayKeywords.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/CachedArrayKeywords.php deleted file mode 100644 index 871f196..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/CachedArrayKeywords.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Keywords; - -/** - * File initializable keywords holder. - * - * $keywords = new Behat\Gherkin\Keywords\CachedArrayKeywords($file); - * - * @author Konstantin Kudryashov - */ -class CachedArrayKeywords extends ArrayKeywords -{ - /** - * Initializes holder with file. - * - * @param string $file Cached array path - */ - public function __construct($file) - { - parent::__construct(include($file)); - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/CucumberKeywords.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/CucumberKeywords.php deleted file mode 100644 index 2a54396..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/CucumberKeywords.php +++ /dev/null @@ -1,121 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Keywords; - -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Yaml; - -/** - * Cucumber-translations reader. - * - * $keywords = new Behat\Gherkin\Keywords\CucumberKeywords($i18nYmlPath); - * - * @author Konstantin Kudryashov - */ -class CucumberKeywords extends ArrayKeywords -{ - /** - * Initializes holder with yaml string OR file. - * - * @param string $yaml Yaml string or file path - */ - public function __construct($yaml) - { - // Handle filename explicitly for BC reasons, as Symfony Yaml 3.0 does not do it anymore - $file = null; - if (strpos($yaml, "\n") === false && is_file($yaml)) { - if (false === is_readable($yaml)) { - throw new ParseException(sprintf('Unable to parse "%s" as the file is not readable.', $yaml)); - } - - $file = $yaml; - $yaml = file_get_contents($file); - } - - try { - $content = Yaml::parse($yaml); - } catch (ParseException $e) { - if ($file) { - $e->setParsedFile($file); - } - - throw $e; - } - - parent::__construct($content); - } - - /** - * Returns Feature keywords (splitted by "|"). - * - * @return string - */ - public function getGivenKeywords() - { - return $this->prepareStepString(parent::getGivenKeywords()); - } - - /** - * Returns When keywords (splitted by "|"). - * - * @return string - */ - public function getWhenKeywords() - { - return $this->prepareStepString(parent::getWhenKeywords()); - } - - /** - * Returns Then keywords (splitted by "|"). - * - * @return string - */ - public function getThenKeywords() - { - return $this->prepareStepString(parent::getThenKeywords()); - } - - /** - * Returns And keywords (splitted by "|"). - * - * @return string - */ - public function getAndKeywords() - { - return $this->prepareStepString(parent::getAndKeywords()); - } - - /** - * Returns But keywords (splitted by "|"). - * - * @return string - */ - public function getButKeywords() - { - return $this->prepareStepString(parent::getButKeywords()); - } - - /** - * Trim *| from the begining of the list. - * - * @param string $keywordsString Keywords string - * - * @return string - */ - private function prepareStepString($keywordsString) - { - if (0 === mb_strpos($keywordsString, '*|', 0, 'UTF-8')) { - $keywordsString = mb_substr($keywordsString, 2, mb_strlen($keywordsString, 'utf8') - 2, 'utf8'); - } - - return $keywordsString; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/KeywordsDumper.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/KeywordsDumper.php deleted file mode 100644 index 3254a3a..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Keywords/KeywordsDumper.php +++ /dev/null @@ -1,365 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Keywords; - -/** - * Gherkin keywords dumper. - * - * @author Konstantin Kudryashov - */ -class KeywordsDumper -{ - private $keywords; - private $keywordsDumper; - - /** - * Initializes dumper. - * - * @param KeywordsInterface $keywords Keywords instance - */ - public function __construct(KeywordsInterface $keywords) - { - $this->keywords = $keywords; - $this->keywordsDumper = array($this, 'dumpKeywords'); - } - - /** - * Sets keywords mapper function. - * - * Callable should accept 2 arguments (array $keywords and bool $isShort) - * - * @param callable $mapper Mapper function - */ - public function setKeywordsDumperFunction($mapper) - { - $this->keywordsDumper = $mapper; - } - - /** - * Defaults keywords dumper. - * - * @param array $keywords Keywords list - * @param bool $isShort Is short version - * - * @return string - */ - public function dumpKeywords(array $keywords, $isShort) - { - if ($isShort) { - return 1 < count($keywords) ? '(' . implode('|', $keywords) . ')' : $keywords[0]; - } - - return $keywords[0]; - } - - /** - * Dumps keyworded feature into string. - * - * @param string $language Keywords language - * @param bool $short Dump short version - * @param bool $excludeAsterisk - * - * @return string|array String for short version and array of features for extended - */ - public function dump($language, $short = true, $excludeAsterisk = false) - { - $this->keywords->setLanguage($language); - $languageComment = ''; - if ('en' !== $language) { - $languageComment = "# language: $language\n"; - } - - $keywords = explode('|', $this->keywords->getFeatureKeywords()); - - if ($short) { - $keywords = call_user_func($this->keywordsDumper, $keywords, $short); - - return trim($languageComment . $this->dumpFeature($keywords, $short, $excludeAsterisk)); - } - - $features = array(); - foreach ($keywords as $keyword) { - $keyword = call_user_func($this->keywordsDumper, array($keyword), $short); - $features[] = trim($languageComment . $this->dumpFeature($keyword, $short, $excludeAsterisk)); - } - - return $features; - } - - /** - * Dumps feature example. - * - * @param string $keyword Item keyword - * @param bool $short Dump short version? - * - * @return string - */ - protected function dumpFeature($keyword, $short = true, $excludeAsterisk = false) - { - $dump = <<keywords->getBackgroundKeywords()); - if ($short) { - $keywords = call_user_func($this->keywordsDumper, $keywords, $short); - $dump .= $this->dumpBackground($keywords, $short, $excludeAsterisk); - } else { - $keyword = call_user_func($this->keywordsDumper, array($keywords[0]), $short); - $dump .= $this->dumpBackground($keyword, $short, $excludeAsterisk); - } - - // Scenario - $keywords = explode('|', $this->keywords->getScenarioKeywords()); - if ($short) { - $keywords = call_user_func($this->keywordsDumper, $keywords, $short); - $dump .= $this->dumpScenario($keywords, $short, $excludeAsterisk); - } else { - foreach ($keywords as $keyword) { - $keyword = call_user_func($this->keywordsDumper, array($keyword), $short); - $dump .= $this->dumpScenario($keyword, $short, $excludeAsterisk); - } - } - - // Outline - $keywords = explode('|', $this->keywords->getOutlineKeywords()); - if ($short) { - $keywords = call_user_func($this->keywordsDumper, $keywords, $short); - $dump .= $this->dumpOutline($keywords, $short, $excludeAsterisk); - } else { - foreach ($keywords as $keyword) { - $keyword = call_user_func($this->keywordsDumper, array($keyword), $short); - $dump .= $this->dumpOutline($keyword, $short, $excludeAsterisk); - } - } - - return $dump; - } - - /** - * Dumps background example. - * - * @param string $keyword Item keyword - * @param bool $short Dump short version? - * - * @return string - */ - protected function dumpBackground($keyword, $short = true, $excludeAsterisk = false) - { - $dump = <<dumpStep( - $this->keywords->getGivenKeywords(), - 'there is agent A', - $short, - $excludeAsterisk - ); - - // And - $dump .= $this->dumpStep( - $this->keywords->getAndKeywords(), - 'there is agent B', - $short, - $excludeAsterisk - ); - - return $dump . "\n"; - } - - /** - * Dumps scenario example. - * - * @param string $keyword Item keyword - * @param bool $short Dump short version? - * - * @return string - */ - protected function dumpScenario($keyword, $short = true, $excludeAsterisk = false) - { - $dump = <<dumpStep( - $this->keywords->getGivenKeywords(), - 'there is agent J', - $short, - $excludeAsterisk - ); - - // And - $dump .= $this->dumpStep( - $this->keywords->getAndKeywords(), - 'there is agent K', - $short, - $excludeAsterisk - ); - - // When - $dump .= $this->dumpStep( - $this->keywords->getWhenKeywords(), - 'I erase agent K\'s memory', - $short, - $excludeAsterisk - ); - - // Then - $dump .= $this->dumpStep( - $this->keywords->getThenKeywords(), - 'there should be agent J', - $short, - $excludeAsterisk - ); - - // But - $dump .= $this->dumpStep( - $this->keywords->getButKeywords(), - 'there should not be agent K', - $short, - $excludeAsterisk - ); - - return $dump . "\n"; - } - - /** - * Dumps outline example. - * - * @param string $keyword Item keyword - * @param bool $short Dump short version? - * - * @return string - */ - protected function dumpOutline($keyword, $short = true, $excludeAsterisk = false) - { - $dump = <<dumpStep( - $this->keywords->getGivenKeywords(), - 'there is agent ', - $short, - $excludeAsterisk - ); - - // And - $dump .= $this->dumpStep( - $this->keywords->getAndKeywords(), - 'there is agent ', - $short, - $excludeAsterisk - ); - - // When - $dump .= $this->dumpStep( - $this->keywords->getWhenKeywords(), - 'I erase agent \'s memory', - $short, - $excludeAsterisk - ); - - // Then - $dump .= $this->dumpStep( - $this->keywords->getThenKeywords(), - 'there should be agent ', - $short, - $excludeAsterisk - ); - - // But - $dump .= $this->dumpStep( - $this->keywords->getButKeywords(), - 'there should not be agent ', - $short, - $excludeAsterisk - ); - - $keywords = explode('|', $this->keywords->getExamplesKeywords()); - if ($short) { - $keyword = call_user_func($this->keywordsDumper, $keywords, $short); - } else { - $keyword = call_user_func($this->keywordsDumper, array($keywords[0]), $short); - } - - $dump .= <<keywordsDumper, $keywords, $short); - $dump .= <<keywordsDumper, array($keyword), $short); - $dump .= << - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Keywords; - -/** - * Keywords holder interface. - * - * @author Konstantin Kudryashov - */ -interface KeywordsInterface -{ - /** - * Sets keywords holder language. - * - * @param string $language Language name - */ - public function setLanguage($language); - - /** - * Returns Feature keywords (splitted by "|"). - * - * @return string - */ - public function getFeatureKeywords(); - - /** - * Returns Background keywords (splitted by "|"). - * - * @return string - */ - public function getBackgroundKeywords(); - - /** - * Returns Scenario keywords (splitted by "|"). - * - * @return string - */ - public function getScenarioKeywords(); - - /** - * Returns Scenario Outline keywords (splitted by "|"). - * - * @return string - */ - public function getOutlineKeywords(); - - /** - * Returns Examples keywords (splitted by "|"). - * - * @return string - */ - public function getExamplesKeywords(); - - /** - * Returns Given keywords (splitted by "|"). - * - * @return string - */ - public function getGivenKeywords(); - - /** - * Returns When keywords (splitted by "|"). - * - * @return string - */ - public function getWhenKeywords(); - - /** - * Returns Then keywords (splitted by "|"). - * - * @return string - */ - public function getThenKeywords(); - - /** - * Returns And keywords (splitted by "|"). - * - * @return string - */ - public function getAndKeywords(); - - /** - * Returns But keywords (splitted by "|"). - * - * @return string - */ - public function getButKeywords(); - - /** - * Returns all step keywords (splitted by "|"). - * - * @return string - */ - public function getStepKeywords(); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Lexer.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Lexer.php deleted file mode 100644 index 1f3b3c4..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Lexer.php +++ /dev/null @@ -1,653 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin; - -use Behat\Gherkin\Exception\LexerException; -use Behat\Gherkin\Keywords\KeywordsInterface; - -/** - * Gherkin lexer. - * - * @author Konstantin Kudryashov - */ -class Lexer -{ - private $language; - private $lines; - private $linesCount; - private $line; - private $trimmedLine; - private $lineNumber; - private $eos; - private $keywords; - private $keywordsCache = array(); - private $stepKeywordTypesCache = array(); - private $deferredObjects = array(); - private $deferredObjectsCount = 0; - private $stashedToken; - private $inPyString = false; - private $pyStringSwallow = 0; - private $featureStarted = false; - private $allowMultilineArguments = false; - private $allowSteps = false; - private $pyStringDelimiter = null; - - /** - * Initializes lexer. - * - * @param KeywordsInterface $keywords Keywords holder - */ - public function __construct(KeywordsInterface $keywords) - { - $this->keywords = $keywords; - } - - /** - * Sets lexer input. - * - * @param string $input Input string - * @param string $language Language name - * - * @throws Exception\LexerException - */ - public function analyse($input, $language = 'en') - { - // try to detect unsupported encoding - if ('UTF-8' !== mb_detect_encoding($input, 'UTF-8', true)) { - throw new LexerException('Feature file is not in UTF8 encoding'); - } - - $input = strtr($input, array("\r\n" => "\n", "\r" => "\n")); - - $this->lines = explode("\n", $input); - $this->linesCount = count($this->lines); - $this->line = $this->lines[0]; - $this->lineNumber = 1; - $this->trimmedLine = null; - $this->eos = false; - - $this->deferredObjects = array(); - $this->deferredObjectsCount = 0; - $this->stashedToken = null; - $this->inPyString = false; - $this->pyStringSwallow = 0; - - $this->featureStarted = false; - $this->allowMultilineArguments = false; - $this->allowSteps = false; - - $this->keywords->setLanguage($this->language = $language); - $this->keywordsCache = array(); - $this->stepKeywordTypesCache = array(); - } - - /** - * Returns current lexer language. - * - * @return string - */ - public function getLanguage() - { - return $this->language; - } - - /** - * Returns next token or previously stashed one. - * - * @return array - */ - public function getAdvancedToken() - { - return $this->getStashedToken() ?: $this->getNextToken(); - } - - /** - * Defers token. - * - * @param array $token Token to defer - */ - public function deferToken(array $token) - { - $token['deferred'] = true; - $this->deferredObjects[] = $token; - ++$this->deferredObjectsCount; - } - - /** - * Predicts the upcoming token without passing over it. - * - * @return array - */ - public function predictToken() - { - if (null === $this->stashedToken) { - $this->stashedToken = $this->getNextToken(); - } - - return $this->stashedToken; - } - - /** - * Skips over the currently-predicted token, if any. - * - * @return void - */ - public function skipPredictedToken() - { - $this->stashedToken = null; - } - - /** - * Constructs token with specified parameters. - * - * @param string $type Token type - * @param string $value Token value - * - * @return array - */ - public function takeToken($type, $value = null) - { - return array( - 'type' => $type, - 'line' => $this->lineNumber, - 'value' => $value ?: null, - 'deferred' => false - ); - } - - /** - * Consumes line from input & increments line counter. - */ - protected function consumeLine() - { - ++$this->lineNumber; - - if (($this->lineNumber - 1) === $this->linesCount) { - $this->eos = true; - - return; - } - - $this->line = $this->lines[$this->lineNumber - 1]; - $this->trimmedLine = null; - } - - /** - * Consumes first part of line from input without incrementing the line number - */ - protected function consumeLineUntil(int $trimmedOffset) - { - $this->line = mb_substr(ltrim($this->line), $trimmedOffset, null, 'utf-8'); - $this->trimmedLine = null; - } - - /** - * Returns trimmed version of line. - * - * @return string - */ - protected function getTrimmedLine() - { - return null !== $this->trimmedLine ? $this->trimmedLine : $this->trimmedLine = trim($this->line); - } - - /** - * Returns stashed token or null if hasn't. - * - * @return array|null - */ - protected function getStashedToken() - { - $stashedToken = $this->stashedToken; - $this->stashedToken = null; - - return $stashedToken; - } - - /** - * Returns deferred token or null if hasn't. - * - * @return array|null - */ - protected function getDeferredToken() - { - if (!$this->deferredObjectsCount) { - return null; - } - - --$this->deferredObjectsCount; - - return array_shift($this->deferredObjects); - } - - /** - * Returns next token from input. - * - * @return array - */ - protected function getNextToken() - { - return $this->getDeferredToken() - ?: $this->scanEOS() - ?: $this->scanLanguage() - ?: $this->scanComment() - ?: $this->scanPyStringOp() - ?: $this->scanPyStringContent() - ?: $this->scanStep() - ?: $this->scanScenario() - ?: $this->scanBackground() - ?: $this->scanOutline() - ?: $this->scanExamples() - ?: $this->scanFeature() - ?: $this->scanTags() - ?: $this->scanTableRow() - ?: $this->scanNewline() - ?: $this->scanText(); - } - - /** - * Scans for token with specified regex. - * - * @param string $regex Regular expression - * @param string $type Expected token type - * - * @return null|array - */ - protected function scanInput($regex, $type) - { - if (!preg_match($regex, $this->line, $matches)) { - return null; - } - - $token = $this->takeToken($type, $matches[1]); - $this->consumeLine(); - - return $token; - } - - /** - * Scans for token with specified keywords. - * - * @param string $keywords Keywords (splitted with |) - * @param string $type Expected token type - * - * @return null|array - */ - protected function scanInputForKeywords($keywords, $type) - { - if (!preg_match('/^(\s*)(' . $keywords . '):\s*(.*)/u', $this->line, $matches)) { - return null; - } - - $token = $this->takeToken($type, $matches[3]); - $token['keyword'] = $matches[2]; - $token['indent'] = mb_strlen($matches[1], 'utf8'); - - $this->consumeLine(); - - // turn off language searching - if ('Feature' === $type) { - $this->featureStarted = true; - } - - // turn off PyString and Table searching - if ('Feature' === $type || 'Scenario' === $type || 'Outline' === $type) { - $this->allowMultilineArguments = false; - } elseif ('Examples' === $type) { - $this->allowMultilineArguments = true; - } - - // turn on steps searching - if ('Scenario' === $type || 'Background' === $type || 'Outline' === $type) { - $this->allowSteps = true; - } - - return $token; - } - - /** - * Scans EOS from input & returns it if found. - * - * @return null|array - */ - protected function scanEOS() - { - if (!$this->eos) { - return null; - } - - return $this->takeToken('EOS'); - } - - /** - * Returns keywords for provided type. - * - * @param string $type Keyword type - * - * @return string - */ - protected function getKeywords($type) - { - if (!isset($this->keywordsCache[$type])) { - $getter = 'get' . $type . 'Keywords'; - $keywords = $this->keywords->$getter(); - - if ('Step' === $type) { - $padded = array(); - foreach (explode('|', $keywords) as $keyword) { - $padded[] = false !== mb_strpos($keyword, '<', 0, 'utf8') - ? preg_quote(mb_substr($keyword, 0, -1, 'utf8'), '/') . '\s*' - : preg_quote($keyword, '/') . '\s+'; - } - - $keywords = implode('|', $padded); - } - - $this->keywordsCache[$type] = $keywords; - } - - return $this->keywordsCache[$type]; - } - - /** - * Scans Feature from input & returns it if found. - * - * @return null|array - */ - protected function scanFeature() - { - return $this->scanInputForKeywords($this->getKeywords('Feature'), 'Feature'); - } - - /** - * Scans Background from input & returns it if found. - * - * @return null|array - */ - protected function scanBackground() - { - return $this->scanInputForKeywords($this->getKeywords('Background'), 'Background'); - } - - /** - * Scans Scenario from input & returns it if found. - * - * @return null|array - */ - protected function scanScenario() - { - return $this->scanInputForKeywords($this->getKeywords('Scenario'), 'Scenario'); - } - - /** - * Scans Scenario Outline from input & returns it if found. - * - * @return null|array - */ - protected function scanOutline() - { - return $this->scanInputForKeywords($this->getKeywords('Outline'), 'Outline'); - } - - /** - * Scans Scenario Outline Examples from input & returns it if found. - * - * @return null|array - */ - protected function scanExamples() - { - return $this->scanInputForKeywords($this->getKeywords('Examples'), 'Examples'); - } - - /** - * Scans Step from input & returns it if found. - * - * @return null|array - */ - protected function scanStep() - { - if (!$this->allowSteps) { - return null; - } - - $keywords = $this->getKeywords('Step'); - if (!preg_match('/^\s*(' . $keywords . ')([^\s].*)/u', $this->line, $matches)) { - return null; - } - - $keyword = trim($matches[1]); - $token = $this->takeToken('Step', $keyword); - $token['keyword_type'] = $this->getStepKeywordType($keyword); - $token['text'] = $matches[2]; - - $this->consumeLine(); - $this->allowMultilineArguments = true; - - return $token; - } - - /** - * Scans PyString from input & returns it if found. - * - * @return null|array - */ - protected function scanPyStringOp() - { - if (!$this->allowMultilineArguments) { - return null; - } - - if(!preg_match('/^\s*(?"""|```)/u', $this->line, $matches, PREG_OFFSET_CAPTURE)) { - return null; - } - - ['delimiter' => [0 => $delimiter, 1 => $indent]] = $matches; - - if ($this->inPyString) { - if ($this->pyStringDelimiter !== $delimiter) { - return null; - } - $this->pyStringDelimiter = null; - } - else { - $this->pyStringDelimiter= $delimiter; - } - - $this->inPyString = !$this->inPyString; - $token = $this->takeToken('PyStringOp'); - $this->pyStringSwallow = $indent; - - $this->consumeLine(); - - return $token; - } - - /** - * Scans PyString content. - * - * @return null|array - */ - protected function scanPyStringContent() - { - if (!$this->inPyString) { - return null; - } - - $token = $this->scanText(); - // swallow trailing spaces - $token['value'] = preg_replace('/^\s{0,' . $this->pyStringSwallow . '}/u', '', $token['value'] ?? ''); - - return $token; - } - - /** - * Scans Table Row from input & returns it if found. - * - * @return null|array - */ - protected function scanTableRow() - { - if (!$this->allowMultilineArguments) { - return null; - } - - $line = $this->getTrimmedLine(); - if (!isset($line[0]) || '|' !== $line[0] || '|' !== substr($line, -1)) { - return null; - } - - $token = $this->takeToken('TableRow'); - $line = mb_substr($line, 1, mb_strlen($line, 'utf8') - 2, 'utf8'); - $columns = array_map(function ($column) { - return trim(str_replace('\\|', '|', $column)); - }, preg_split('/(?consumeLine(); - - return $token; - } - - /** - * Scans Tags from input & returns it if found. - * - * @return null|array - */ - protected function scanTags() - { - $line = $this->getTrimmedLine(); - - if (!isset($line[0]) || '@' !== $line[0]) { - return null; - } - - if(preg_match('/^(?.*)\s+#.*$/', $line, $matches)) { - ['line' => $line] = $matches; - $this->consumeLineUntil(mb_strlen($line, 'utf-8')); - } else { - $this->consumeLine(); - } - - $token = $this->takeToken('Tag'); - $tags = explode('@', mb_substr($line, 1, mb_strlen($line, 'utf8') - 1, 'utf8')); - $tags = array_map('trim', $tags); - $token['tags'] = $tags; - - - return $token; - } - - /** - * Scans Language specifier from input & returns it if found. - * - * @return null|array - */ - protected function scanLanguage() - { - if ($this->featureStarted) { - return null; - } - - if ($this->inPyString) { - return null; - } - - if (0 !== mb_strpos(ltrim($this->line), '#', 0, 'utf8')) { - return null; - } - - return $this->scanInput('/^\s*\#\s*language:\s*([\w_\-]+)\s*$/', 'Language'); - } - - /** - * Scans Comment from input & returns it if found. - * - * @return null|array - */ - protected function scanComment() - { - if ($this->inPyString) { - return null; - } - - $line = $this->getTrimmedLine(); - if (0 !== mb_strpos($line, '#', 0, 'utf8')) { - return null; - } - - $token = $this->takeToken('Comment', $line); - $this->consumeLine(); - - return $token; - } - - /** - * Scans Newline from input & returns it if found. - * - * @return null|array - */ - protected function scanNewline() - { - if ('' !== $this->getTrimmedLine()) { - return null; - } - - $token = $this->takeToken('Newline', mb_strlen($this->line, 'utf8')); - $this->consumeLine(); - - return $token; - } - - /** - * Scans text from input & returns it if found. - * - * @return null|array - */ - protected function scanText() - { - $token = $this->takeToken('Text', $this->line); - $this->consumeLine(); - - return $token; - } - - /** - * Returns step type keyword (Given, When, Then, etc.). - * - * @param string $native Step keyword in provided language - * @return string - */ - private function getStepKeywordType($native) - { - // Consider "*" as a AND keyword so that it is normalized to the previous step type - if ('*' === $native) { - return 'And'; - } - - if (empty($this->stepKeywordTypesCache)) { - $this->stepKeywordTypesCache = array( - 'Given' => explode('|', $this->keywords->getGivenKeywords()), - 'When' => explode('|', $this->keywords->getWhenKeywords()), - 'Then' => explode('|', $this->keywords->getThenKeywords()), - 'And' => explode('|', $this->keywords->getAndKeywords()), - 'But' => explode('|', $this->keywords->getButKeywords()) - ); - } - - foreach ($this->stepKeywordTypesCache as $type => $keywords) { - if (in_array($native, $keywords) || in_array($native . '<', $keywords)) { - return $type; - } - } - - return 'Given'; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/AbstractFileLoader.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/AbstractFileLoader.php deleted file mode 100644 index 20932c1..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/AbstractFileLoader.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Loader; - -/** - * Abstract filesystem loader. - * - * @author Konstantin Kudryashov - */ -abstract class AbstractFileLoader implements FileLoaderInterface -{ - protected $basePath; - - /** - * Sets base features path. - * - * @param string $path Base loader path - */ - public function setBasePath($path) - { - $this->basePath = realpath($path); - } - - /** - * Finds relative path for provided absolute (relative to base features path). - * - * @param string $path Absolute path - * - * @return string - */ - protected function findRelativePath($path) - { - if (null !== $this->basePath) { - return strtr($path, array($this->basePath . DIRECTORY_SEPARATOR => '')); - } - - return $path; - } - - /** - * Finds absolute path for provided relative (relative to base features path). - * - * @param string $path Relative path - * - * @return string - */ - protected function findAbsolutePath($path) - { - if (is_file($path) || is_dir($path)) { - return realpath($path); - } - - if (null === $this->basePath) { - return false; - } - - if (is_file($this->basePath . DIRECTORY_SEPARATOR . $path) - || is_dir($this->basePath . DIRECTORY_SEPARATOR . $path)) { - return realpath($this->basePath . DIRECTORY_SEPARATOR . $path); - } - - return false; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/ArrayLoader.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/ArrayLoader.php deleted file mode 100644 index 145bed9..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/ArrayLoader.php +++ /dev/null @@ -1,312 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Loader; - -use Behat\Gherkin\Node\BackgroundNode; -use Behat\Gherkin\Node\ExampleTableNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\PyStringNode; -use Behat\Gherkin\Node\ScenarioNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Gherkin\Node\TableNode; - -/** - * From-array loader. - * - * @author Konstantin Kudryashov - */ -class ArrayLoader implements LoaderInterface -{ - /** - * Checks if current loader supports provided resource. - * - * @param mixed $resource Resource to load - * - * @return bool - */ - public function supports($resource) - { - return is_array($resource) && (isset($resource['features']) || isset($resource['feature'])); - } - - /** - * Loads features from provided resource. - * - * @param mixed $resource Resource to load - * - * @return FeatureNode[] - */ - public function load($resource) - { - $features = array(); - - if (isset($resource['features'])) { - foreach ($resource['features'] as $iterator => $hash) { - $feature = $this->loadFeatureHash($hash, $iterator); - $features[] = $feature; - } - } elseif (isset($resource['feature'])) { - $feature = $this->loadFeatureHash($resource['feature']); - $features[] = $feature; - } - - return $features; - } - - /** - * Loads feature from provided feature hash. - * - * @param array $hash Feature hash - * @param integer $line - * - * @return FeatureNode - */ - protected function loadFeatureHash(array $hash, $line = 0) - { - $hash = array_merge( - array( - 'title' => null, - 'description' => null, - 'tags' => array(), - 'keyword' => 'Feature', - 'language' => 'en', - 'line' => $line, - 'scenarios' => array(), - ), - $hash - ); - $background = isset($hash['background']) ? $this->loadBackgroundHash($hash['background']) : null; - - $scenarios = array(); - foreach ((array) $hash['scenarios'] as $scenarioIterator => $scenarioHash) { - if (isset($scenarioHash['type']) && 'outline' === $scenarioHash['type']) { - $scenarios[] = $this->loadOutlineHash($scenarioHash, $scenarioIterator); - } else { - $scenarios[] = $this->loadScenarioHash($scenarioHash, $scenarioIterator); - } - } - - return new FeatureNode($hash['title'], $hash['description'], $hash['tags'], $background, $scenarios, $hash['keyword'], $hash['language'], null, $hash['line']); - } - - /** - * Loads background from provided hash. - * - * @param array $hash Background hash - * - * @return BackgroundNode - */ - protected function loadBackgroundHash(array $hash) - { - $hash = array_merge( - array( - 'title' => null, - 'keyword' => 'Background', - 'line' => 0, - 'steps' => array(), - ), - $hash - ); - - $steps = $this->loadStepsHash($hash['steps']); - - return new BackgroundNode($hash['title'], $steps, $hash['keyword'], $hash['line']); - } - - /** - * Loads scenario from provided scenario hash. - * - * @param array $hash Scenario hash - * @param integer $line Scenario definition line - * - * @return ScenarioNode - */ - protected function loadScenarioHash(array $hash, $line = 0) - { - $hash = array_merge( - array( - 'title' => null, - 'tags' => array(), - 'keyword' => 'Scenario', - 'line' => $line, - 'steps' => array(), - ), - $hash - ); - - $steps = $this->loadStepsHash($hash['steps']); - - return new ScenarioNode($hash['title'], $hash['tags'], $steps, $hash['keyword'], $hash['line']); - } - - /** - * Loads outline from provided outline hash. - * - * @param array $hash Outline hash - * @param integer $line Outline definition line - * - * @return OutlineNode - */ - protected function loadOutlineHash(array $hash, $line = 0) - { - $hash = array_merge( - array( - 'title' => null, - 'tags' => array(), - 'keyword' => 'Scenario Outline', - 'line' => $line, - 'steps' => array(), - 'examples' => array(), - ), - $hash - ); - - $steps = $this->loadStepsHash($hash['steps']); - - if (isset($hash['examples']['keyword'])) { - $examplesKeyword = $hash['examples']['keyword']; - unset($hash['examples']['keyword']); - } else { - $examplesKeyword = 'Examples'; - } - - $exHash = $hash['examples']; - $examples = array(); - - if ($this->examplesAreInArray($exHash)) { - $examples = $this->processExamplesArray($exHash, $examplesKeyword, $examples); - } else { - // examples as a single table - we create an array with the only one element - $examples[] = new ExampleTableNode($exHash, $examplesKeyword);; - } - - return new OutlineNode($hash['title'], $hash['tags'], $steps, $examples, $hash['keyword'], $hash['line']); - } - - /** - * Loads steps from provided hash. - * - * @param array $hash - * - * @return StepNode[] - */ - private function loadStepsHash(array $hash) - { - $steps = array(); - foreach ($hash as $stepIterator => $stepHash) { - $steps[] = $this->loadStepHash($stepHash, $stepIterator); - } - - return $steps; - } - - /** - * Loads step from provided hash. - * - * @param array $hash Step hash - * @param integer $line Step definition line - * - * @return StepNode - */ - protected function loadStepHash(array $hash, $line = 0) - { - $hash = array_merge( - array( - 'keyword_type' => 'Given', - 'type' => 'Given', - 'text' => null, - 'keyword' => 'Scenario', - 'line' => $line, - 'arguments' => array(), - ), - $hash - ); - - $arguments = array(); - foreach ($hash['arguments'] as $argumentHash) { - if ('table' === $argumentHash['type']) { - $arguments[] = $this->loadTableHash($argumentHash['rows']); - } elseif ('pystring' === $argumentHash['type']) { - $arguments[] = $this->loadPyStringHash($argumentHash, $hash['line'] + 1); - } - } - - return new StepNode($hash['type'], $hash['text'], $arguments, $hash['line'], $hash['keyword_type']); - } - - /** - * Loads table from provided hash. - * - * @param array $hash Table hash - * - * @return TableNode - */ - protected function loadTableHash(array $hash) - { - return new TableNode($hash); - } - - /** - * Loads PyString from provided hash. - * - * @param array $hash PyString hash - * @param integer $line - * - * @return PyStringNode - */ - protected function loadPyStringHash(array $hash, $line = 0) - { - $line = isset($hash['line']) ? $hash['line'] : $line; - - $strings = array(); - foreach (explode("\n", $hash['text']) as $string) { - $strings[] = $string; - } - - return new PyStringNode($strings, $line); - } - - /** - * Checks if examples node is an array - * @param $exHash object hash - * @return bool - */ - private function examplesAreInArray($exHash) - { - return isset($exHash[0]); - } - - /** - * Processes cases when examples are in the form of array of arrays - * OR in the form of array of objects - * - * @param $exHash array hash - * @param $examplesKeyword string - * @param $examples array - * @return array - */ - private function processExamplesArray($exHash, $examplesKeyword, $examples) - { - for ($i = 0; $i < count($exHash); $i++) { - if (isset($exHash[$i]['table'])) { - // we have examples as objects, hence there could be tags - $exHashTags = isset($exHash[$i]['tags']) ? $exHash[$i]['tags'] : array(); - $examples[] = new ExampleTableNode($exHash[$i]['table'], $examplesKeyword, $exHashTags); - } else { - // we have examples as arrays - $examples[] = new ExampleTableNode($exHash[$i], $examplesKeyword); - } - } - - return $examples; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/DirectoryLoader.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/DirectoryLoader.php deleted file mode 100644 index e0e65fc..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/DirectoryLoader.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Loader; - -use Behat\Gherkin\Gherkin; -use Behat\Gherkin\Node\FeatureNode; -use RecursiveDirectoryIterator; -use RecursiveIteratorIterator; - -/** - * Directory contents loader. - * - * @author Konstantin Kudryashov - */ -class DirectoryLoader extends AbstractFileLoader -{ - protected $gherkin; - - /** - * Initializes loader. - * - * @param Gherkin $gherkin Gherkin manager - */ - public function __construct(Gherkin $gherkin) - { - $this->gherkin = $gherkin; - } - - /** - * Checks if current loader supports provided resource. - * - * @param mixed $path Resource to load - * - * @return bool - */ - public function supports($path) - { - return is_string($path) - && is_dir($this->findAbsolutePath($path)); - } - - /** - * Loads features from provided resource. - * - * @param string $path Resource to load - * - * @return FeatureNode[] - */ - public function load($path) - { - $path = $this->findAbsolutePath($path); - - $iterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS) - ); - $paths = array_map('strval', iterator_to_array($iterator)); - uasort($paths, 'strnatcasecmp'); - - $features = array(); - - foreach ($paths as $path) { - $path = (string) $path; - $loader = $this->gherkin->resolveLoader($path); - - if (null !== $loader) { - $features = array_merge($features, $loader->load($path)); - } - } - - return $features; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/FileLoaderInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/FileLoaderInterface.php deleted file mode 100644 index f18f19a..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/FileLoaderInterface.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Loader; - -/** - * File Loader interface. - * - * @author Konstantin Kudryashov - */ -interface FileLoaderInterface extends LoaderInterface -{ - /** - * Sets base features path. - * - * @param string $path Base loader path - */ - public function setBasePath($path); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/GherkinFileLoader.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/GherkinFileLoader.php deleted file mode 100644 index b2554f7..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/GherkinFileLoader.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Loader; - -use Behat\Gherkin\Cache\CacheInterface; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Parser; - -/** - * Gherkin *.feature files loader. - * - * @author Konstantin Kudryashov - */ -class GherkinFileLoader extends AbstractFileLoader -{ - protected $parser; - protected $cache; - - /** - * Initializes loader. - * - * @param Parser $parser Parser - * @param CacheInterface $cache Cache layer - */ - public function __construct(Parser $parser, CacheInterface $cache = null) - { - $this->parser = $parser; - $this->cache = $cache; - } - - /** - * Sets cache layer. - * - * @param CacheInterface $cache Cache layer - */ - public function setCache(CacheInterface $cache) - { - $this->cache = $cache; - } - - /** - * Checks if current loader supports provided resource. - * - * @param mixed $path Resource to load - * - * @return bool - */ - public function supports($path) - { - return is_string($path) - && is_file($absolute = $this->findAbsolutePath($path)) - && 'feature' === pathinfo($absolute, PATHINFO_EXTENSION); - } - - /** - * Loads features from provided resource. - * - * @param string $path Resource to load - * - * @return FeatureNode[] - */ - public function load($path) - { - $path = $this->findAbsolutePath($path); - - if ($this->cache) { - if ($this->cache->isFresh($path, filemtime($path))) { - $feature = $this->cache->read($path); - } elseif (null !== $feature = $this->parseFeature($path)) { - $this->cache->write($path, $feature); - } - } else { - $feature = $this->parseFeature($path); - } - - return null !== $feature ? array($feature) : array(); - } - - /** - * Parses feature at provided absolute path. - * - * @param string $path Feature path - * - * @return FeatureNode - */ - protected function parseFeature($path) - { - $content = file_get_contents($path); - $feature = $this->parser->parse($content, $path); - - return $feature; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/LoaderInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/LoaderInterface.php deleted file mode 100644 index 322ce6c..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/LoaderInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Loader; - -use Behat\Gherkin\Node\FeatureNode; - -/** - * Loader interface. - * - * @author Konstantin Kudryashov - */ -interface LoaderInterface -{ - /** - * Checks if current loader supports provided resource. - * - * @param mixed $resource Resource to load - * - * @return bool - */ - public function supports($resource); - - /** - * Loads features from provided resource. - * - * @param mixed $resource Resource to load - * - * @return FeatureNode[] - */ - public function load($resource); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/YamlFileLoader.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/YamlFileLoader.php deleted file mode 100644 index 88193aa..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Loader/YamlFileLoader.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Loader; - -use Behat\Gherkin\Node\FeatureNode; -use Symfony\Component\Yaml\Yaml; - -/** - * Yaml files loader. - * - * @author Konstantin Kudryashov - */ -class YamlFileLoader extends AbstractFileLoader -{ - private $loader; - - public function __construct() - { - $this->loader = new ArrayLoader(); - } - - /** - * Checks if current loader supports provided resource. - * - * @param mixed $path Resource to load - * - * @return bool - */ - public function supports($path) - { - return is_string($path) - && is_file($absolute = $this->findAbsolutePath($path)) - && 'yml' === pathinfo($absolute, PATHINFO_EXTENSION); - } - - /** - * Loads features from provided resource. - * - * @param string $path Resource to load - * - * @return FeatureNode[] - */ - public function load($path) - { - $path = $this->findAbsolutePath($path); - $hash = Yaml::parse(file_get_contents($path)); - - $features = $this->loader->load($hash); - - return array_map(function (FeatureNode $feature) use ($path) { - return new FeatureNode( - $feature->getTitle(), - $feature->getDescription(), - $feature->getTags(), - $feature->getBackground(), - $feature->getScenarios(), - $feature->getKeyword(), - $feature->getLanguage(), - $path, - $feature->getLine() - ); - }, $features); - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ArgumentInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ArgumentInterface.php deleted file mode 100644 index 4457f18..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ArgumentInterface.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Gherkin arguments interface. - * - * @author Konstantin Kudryashov - */ -interface ArgumentInterface extends NodeInterface -{ -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/BackgroundNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/BackgroundNode.php deleted file mode 100644 index 6104486..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/BackgroundNode.php +++ /dev/null @@ -1,112 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Represents Gherkin Background. - * - * @author Konstantin Kudryashov - */ -class BackgroundNode implements ScenarioLikeInterface -{ - /** - * @var string - */ - private $title; - /** - * @var StepNode[] - */ - private $steps = array(); - /** - * @var string - */ - private $keyword; - /** - * @var integer - */ - private $line; - - /** - * Initializes background. - * - * @param null|string $title - * @param StepNode[] $steps - * @param string $keyword - * @param integer $line - */ - public function __construct($title, array $steps, $keyword, $line) - { - $this->title = $title; - $this->steps = $steps; - $this->keyword = $keyword; - $this->line = $line; - } - - /** - * Returns node type string - * - * @return string - */ - public function getNodeType() - { - return 'Background'; - } - - /** - * Returns background title. - * - * @return null|string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Checks if background has steps. - * - * @return bool - */ - public function hasSteps() - { - return 0 < count($this->steps); - } - - /** - * Returns background steps. - * - * @return StepNode[] - */ - public function getSteps() - { - return $this->steps; - } - - /** - * Returns background keyword. - * - * @return string - */ - public function getKeyword() - { - return $this->keyword; - } - - /** - * Returns background declaration line number. - * - * @return integer - */ - public function getLine() - { - return $this->line; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ExampleNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ExampleNode.php deleted file mode 100644 index 59d9705..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ExampleNode.php +++ /dev/null @@ -1,274 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Represents Gherkin Outline Example. - * - * @author Konstantin Kudryashov - */ -class ExampleNode implements ScenarioInterface -{ - /** - * @var string - */ - private $title; - /** - * @var string[] - */ - private $tags; - /** - * @var StepNode[] - */ - private $outlineSteps; - /** - * @var string[] - */ - private $tokens; - /** - * @var integer - */ - private $line; - /** - * @var null|StepNode[] - */ - private $steps; - /** - * @var string - */ - private $outlineTitle; - - /** - * Initializes outline. - * - * @param string $title - * @param string[] $tags - * @param StepNode[] $outlineSteps - * @param string[] $tokens - * @param integer $line - * @param string|null $outlineTitle - */ - public function __construct($title, array $tags, $outlineSteps, array $tokens, $line, $outlineTitle = null) - { - $this->title = $title; - $this->tags = $tags; - $this->outlineSteps = $outlineSteps; - $this->tokens = $tokens; - $this->line = $line; - $this->outlineTitle = $outlineTitle; - } - - /** - * Returns node type string - * - * @return string - */ - public function getNodeType() - { - return 'Example'; - } - - /** - * Returns node keyword. - * - * @return string - */ - public function getKeyword() - { - return $this->getNodeType(); - } - - /** - * Returns example title. - * - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Checks if outline is tagged with tag. - * - * @param string $tag - * - * @return bool - */ - public function hasTag($tag) - { - return in_array($tag, $this->getTags()); - } - - /** - * Checks if outline has tags (both inherited from feature and own). - * - * @return bool - */ - public function hasTags() - { - return 0 < count($this->getTags()); - } - - /** - * Returns outline tags (including inherited from feature). - * - * @return string[] - */ - public function getTags() - { - return $this->tags; - } - - /** - * Checks if outline has steps. - * - * @return bool - */ - public function hasSteps() - { - return 0 < count($this->outlineSteps); - } - - /** - * Returns outline steps. - * - * @return StepNode[] - */ - public function getSteps() - { - return $this->steps = $this->steps ? : $this->createExampleSteps(); - } - - /** - * Returns example tokens. - * - * @return string[] - */ - public function getTokens() - { - return $this->tokens; - } - - /** - * Returns outline declaration line number. - * - * @return integer - */ - public function getLine() - { - return $this->line; - } - - /** - * Returns outline title. - * - * @return string - */ - public function getOutlineTitle() - { - return $this->outlineTitle; - } - - /** - * Creates steps for this example from abstract outline steps. - * - * @return StepNode[] - */ - protected function createExampleSteps() - { - $steps = array(); - foreach ($this->outlineSteps as $outlineStep) { - $keyword = $outlineStep->getKeyword(); - $keywordType = $outlineStep->getKeywordType(); - $text = $this->replaceTextTokens($outlineStep->getText()); - $args = $this->replaceArgumentsTokens($outlineStep->getArguments()); - $line = $outlineStep->getLine(); - - $steps[] = new StepNode($keyword, $text, $args, $line, $keywordType); - } - - return $steps; - } - - /** - * Replaces tokens in arguments with row values. - * - * @param ArgumentInterface[] $arguments - * - * @return ArgumentInterface[] - */ - protected function replaceArgumentsTokens(array $arguments) - { - foreach ($arguments as $num => $argument) { - if ($argument instanceof TableNode) { - $arguments[$num] = $this->replaceTableArgumentTokens($argument); - } - if ($argument instanceof PyStringNode) { - $arguments[$num] = $this->replacePyStringArgumentTokens($argument); - } - } - - return $arguments; - } - - /** - * Replaces tokens in table with row values. - * - * @param TableNode $argument - * - * @return TableNode - */ - protected function replaceTableArgumentTokens(TableNode $argument) - { - $table = $argument->getTable(); - foreach ($table as $line => $row) { - foreach (array_keys($row) as $col) { - $table[$line][$col] = $this->replaceTextTokens($table[$line][$col]); - } - } - - return new TableNode($table); - } - - /** - * Replaces tokens in PyString with row values. - * - * @param PyStringNode $argument - * - * @return PyStringNode - */ - protected function replacePyStringArgumentTokens(PyStringNode $argument) - { - $strings = $argument->getStrings(); - foreach ($strings as $line => $string) { - $strings[$line] = $this->replaceTextTokens($strings[$line]); - } - - return new PyStringNode($strings, $argument->getLine()); - } - - /** - * Replaces tokens in text with row values. - * - * @param string $text - * - * @return string - */ - protected function replaceTextTokens($text) - { - foreach ($this->tokens as $key => $val) { - $text = str_replace('<' . $key . '>', $val, $text); - } - - return $text; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ExampleTableNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ExampleTableNode.php deleted file mode 100644 index 9175351..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ExampleTableNode.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Represents Gherkin Outline Example Table. - * - * @author Konstantin Kudryashov - */ -class ExampleTableNode extends TableNode -{ - /** - * @var string[] - */ - private $tags; - - /** - * @var string - */ - private $keyword; - - /** - * Initializes example table. - * - * @param array $table Table in form of [$rowLineNumber => [$val1, $val2, $val3]] - * @param string $keyword - * @param string[] $tags - */ - public function __construct(array $table, $keyword, array $tags = array()) - { - $this->keyword = $keyword; - $this->tags = $tags; - - parent::__construct($table); - } - - /** - * Returns node type string - * - * @return string - */ - public function getNodeType() - { - return 'ExampleTable'; - } - - /** - * Returns attached tags - * @return \string[] - */ - public function getTags() - { - return $this->tags; - } - - /** - * Returns example table keyword. - * - * @return string - */ - public function getKeyword() - { - return $this->keyword; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/FeatureNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/FeatureNode.php deleted file mode 100644 index d53b97c..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/FeatureNode.php +++ /dev/null @@ -1,271 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Represents Gherkin Feature. - * - * @author Konstantin Kudryashov - */ -class FeatureNode implements KeywordNodeInterface, TaggedNodeInterface -{ - /** - * @var null|string - */ - private $title; - /** - * @var null|string - */ - private $description; - /** - * @var string[] - */ - private $tags = array(); - /** - * @var null|BackgroundNode - */ - private $background; - /** - * @var ScenarioInterface[] - */ - private $scenarios = array(); - /** - * @var string - */ - private $keyword; - /** - * @var string - */ - private $language; - /** - * @var null|string - */ - private $file; - /** - * @var integer - */ - private $line; - - /** - * Initializes feature. - * - * @param null|string $title - * @param null|string $description - * @param string[] $tags - * @param null|BackgroundNode $background - * @param ScenarioInterface[] $scenarios - * @param string $keyword - * @param string $language - * @param null|string $file The absolute path to the feature file. - * @param integer $line - */ - public function __construct( - $title, - $description, - array $tags, - BackgroundNode $background = null, - array $scenarios, - $keyword, - $language, - $file, - $line - ) { - // Verify that the feature file is an absolute path. - if (!empty($file) && !$this->isAbsolutePath($file)) { - throw new \InvalidArgumentException('The file should be an absolute path.'); - } - $this->title = $title; - $this->description = $description; - $this->tags = $tags; - $this->background = $background; - $this->scenarios = $scenarios; - $this->keyword = $keyword; - $this->language = $language; - $this->file = $file; - $this->line = $line; - } - - /** - * Returns node type string - * - * @return string - */ - public function getNodeType() - { - return 'Feature'; - } - - /** - * Returns feature title. - * - * @return null|string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Checks if feature has a description. - * - * @return bool - */ - public function hasDescription() - { - return !empty($this->description); - } - - /** - * Returns feature description. - * - * @return null|string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Checks if feature is tagged with tag. - * - * @param string $tag - * - * @return bool - */ - public function hasTag($tag) - { - return in_array($tag, $this->tags); - } - - /** - * Checks if feature has tags. - * - * @return bool - */ - public function hasTags() - { - return 0 < count($this->tags); - } - - /** - * Returns feature tags. - * - * @return string[] - */ - public function getTags() - { - return $this->tags; - } - - /** - * Checks if feature has background. - * - * @return bool - */ - public function hasBackground() - { - return null !== $this->background; - } - - /** - * Returns feature background. - * - * @return null|BackgroundNode - */ - public function getBackground() - { - return $this->background; - } - - /** - * Checks if feature has scenarios. - * - * @return bool - */ - public function hasScenarios() - { - return 0 < count($this->scenarios); - } - - /** - * Returns feature scenarios. - * - * @return ScenarioInterface[] - */ - public function getScenarios() - { - return $this->scenarios; - } - - /** - * Returns feature keyword. - * - * @return string - */ - public function getKeyword() - { - return $this->keyword; - } - - /** - * Returns feature language. - * - * @return string - */ - public function getLanguage() - { - return $this->language; - } - - /** - * Returns feature file as an absolute path. - * - * @return null|string - */ - public function getFile() - { - return $this->file; - } - - /** - * Returns feature declaration line number. - * - * @return integer - */ - public function getLine() - { - return $this->line; - } - - /** - * Returns whether the file path is an absolute path. - * - * @param string $file A file path - * - * @return bool - * - * @see https://github.com/symfony/filesystem/blob/master/Filesystem.php - */ - protected 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 strspn($file, '/\\', 0, 1) - || (\strlen($file) > 3 && ctype_alpha($file[0]) - && ':' === $file[1] - && strspn($file, '/\\', 2, 1) - ) - || null !== parse_url($file, PHP_URL_SCHEME) - ; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/KeywordNodeInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/KeywordNodeInterface.php deleted file mode 100644 index e6e412f..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/KeywordNodeInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Gherkin keyword node interface. - * - * @author Konstantin Kudryashov - */ -interface KeywordNodeInterface extends NodeInterface -{ - /** - * Returns node keyword. - * - * @return string - */ - public function getKeyword(); - - /** - * Returns node title. - * - * @return null|string - */ - public function getTitle(); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/NodeInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/NodeInterface.php deleted file mode 100644 index eabe61a..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/NodeInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Gherkin node interface. - * - * @author Konstantin Kudryashov - */ -interface NodeInterface -{ - /** - * Returns node type string - * - * @return string - */ - public function getNodeType(); - - /** - * Returns feature declaration line number. - * - * @return integer - */ - public function getLine(); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/OutlineNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/OutlineNode.php deleted file mode 100644 index 8e68b25..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/OutlineNode.php +++ /dev/null @@ -1,246 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Represents Gherkin Outline. - * - * @author Konstantin Kudryashov - */ -class OutlineNode implements ScenarioInterface -{ - /** - * @var string - */ - private $title; - /** - * @var string[] - */ - private $tags; - /** - * @var StepNode[] - */ - private $steps; - /** - * @var ExampleTableNode|ExampleTableNode[] - */ - private $tables; - /** - * @var string - */ - private $keyword; - /** - * @var integer - */ - private $line; - /** - * @var null|ExampleNode[] - */ - private $examples; - - /** - * Initializes outline. - * - * @param null|string $title - * @param string[] $tags - * @param StepNode[] $steps - * @param ExampleTableNode|ExampleTableNode[] $tables - * @param string $keyword - * @param integer $line - */ - public function __construct( - $title, - array $tags, - array $steps, - $tables, - $keyword, - $line - ) { - $this->title = $title; - $this->tags = $tags; - $this->steps = $steps; - $this->keyword = $keyword; - $this->line = $line; - if (!is_array($tables)) { - $this->tables = array($tables); - } else { - $this->tables = $tables; - } - } - - /** - * Returns node type string - * - * @return string - */ - public function getNodeType() - { - return 'Outline'; - } - - /** - * Returns outline title. - * - * @return null|string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Checks if outline is tagged with tag. - * - * @param string $tag - * - * @return bool - */ - public function hasTag($tag) - { - return in_array($tag, $this->getTags()); - } - - /** - * Checks if outline has tags (both inherited from feature and own). - * - * @return bool - */ - public function hasTags() - { - return 0 < count($this->getTags()); - } - - /** - * Returns outline tags (including inherited from feature). - * - * @return string[] - */ - public function getTags() - { - return $this->tags; - } - - /** - * Checks if outline has steps. - * - * @return bool - */ - public function hasSteps() - { - return 0 < count($this->steps); - } - - /** - * Returns outline steps. - * - * @return StepNode[] - */ - public function getSteps() - { - return $this->steps; - } - - /** - * Checks if outline has examples. - * - * @return bool - */ - public function hasExamples() - { - return 0 < count($this->tables); - } - - /** - * Builds and returns examples table for the outline. - * - * WARNING: it returns a merged table with tags lost. - * - * @deprecated use getExampleTables instead - * @return ExampleTableNode - */ - public function getExampleTable() - { - $table = array(); - foreach ($this->tables[0]->getTable() as $k => $v) { - $table[$k] = $v; - } - - /** @var ExampleTableNode $exampleTableNode */ - $exampleTableNode = new ExampleTableNode($table, $this->tables[0]->getKeyword()); - for ($i = 1; $i < count($this->tables); $i++) { - $exampleTableNode->mergeRowsFromTable($this->tables[$i]); - } - return $exampleTableNode; - } - - /** - * Returns list of examples for the outline. - * @return ExampleNode[] - */ - public function getExamples() - { - return $this->examples = $this->examples ?: $this->createExamples(); - } - - /** - * Returns examples tables array for the outline. - * @return ExampleTableNode[] - */ - public function getExampleTables() - { - return $this->tables; - } - - /** - * Returns outline keyword. - * - * @return string - */ - public function getKeyword() - { - return $this->keyword; - } - - /** - * Returns outline declaration line number. - * - * @return integer - */ - public function getLine() - { - return $this->line; - } - - /** - * Creates examples for this outline using examples table. - * - * @return ExampleNode[] - */ - protected function createExamples() - { - $examples = array(); - - foreach ($this->getExampleTables() as $exampleTable) { - foreach ($exampleTable->getColumnsHash() as $rowNum => $row) { - $examples[] = new ExampleNode( - $exampleTable->getRowAsString($rowNum + 1), - array_merge($this->tags, $exampleTable->getTags()), - $this->getSteps(), - $row, - $exampleTable->getRowLine($rowNum + 1), - $this->getTitle() - ); - } - } - - return $examples; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/PyStringNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/PyStringNode.php deleted file mode 100644 index f0e8948..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/PyStringNode.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Represents Gherkin PyString argument. - * - * @author Konstantin Kudryashov - */ -class PyStringNode implements ArgumentInterface -{ - /** - * @var array - */ - private $strings = array(); - /** - * @var integer - */ - private $line; - - /** - * Initializes PyString. - * - * @param array $strings String in form of [$stringLine] - * @param integer $line Line number where string been started - */ - public function __construct(array $strings, $line) - { - $this->strings = $strings; - $this->line = $line; - } - - /** - * Returns node type. - * - * @return string - */ - public function getNodeType() - { - return 'PyString'; - } - - /** - * Returns entire PyString lines set. - * - * @return array - */ - public function getStrings() - { - return $this->strings; - } - - /** - * Returns raw string. - * - * @return string - */ - public function getRaw() - { - return implode("\n", $this->strings); - } - - /** - * Converts PyString into string. - * - * @return string - */ - public function __toString() - { - return $this->getRaw(); - } - - /** - * Returns line number at which PyString was started. - * - * @return integer - */ - public function getLine() - { - return $this->line; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioInterface.php deleted file mode 100644 index fb29843..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioInterface.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Gherkin scenario interface. - * - * @author Konstantin Kudryashov - */ -interface ScenarioInterface extends ScenarioLikeInterface, TaggedNodeInterface -{ -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioLikeInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioLikeInterface.php deleted file mode 100644 index 88f7934..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioLikeInterface.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Gherkin scenario-like interface. - * - * @author Konstantin Kudryashov - */ -interface ScenarioLikeInterface extends KeywordNodeInterface, StepContainerInterface -{ -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioNode.php deleted file mode 100644 index 277ab96..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/ScenarioNode.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Represents Gherkin Scenario. - * - * @author Konstantin Kudryashov - */ -class ScenarioNode implements ScenarioInterface -{ - /** - * @var string - */ - private $title; - /** - * @var array - */ - private $tags = array(); - /** - * @var StepNode[] - */ - private $steps = array(); - /** - * @var string - */ - private $keyword; - /** - * @var integer - */ - private $line; - - /** - * Initializes scenario. - * - * @param null|string $title - * @param array $tags - * @param StepNode[] $steps - * @param string $keyword - * @param integer $line - */ - public function __construct($title, array $tags, array $steps, $keyword, $line) - { - $this->title = $title; - $this->tags = $tags; - $this->steps = $steps; - $this->keyword = $keyword; - $this->line = $line; - } - - /** - * Returns node type string - * - * @return string - */ - public function getNodeType() - { - return 'Scenario'; - } - - /** - * Returns scenario title. - * - * @return null|string - */ - public function getTitle() - { - return $this->title; - } - - /** - * Checks if scenario is tagged with tag. - * - * @param string $tag - * - * @return bool - */ - public function hasTag($tag) - { - return in_array($tag, $this->getTags()); - } - - /** - * Checks if scenario has tags (both inherited from feature and own). - * - * @return bool - */ - public function hasTags() - { - return 0 < count($this->getTags()); - } - - /** - * Returns scenario tags (including inherited from feature). - * - * @return array - */ - public function getTags() - { - return $this->tags; - } - - /** - * Checks if scenario has steps. - * - * @return bool - */ - public function hasSteps() - { - return 0 < count($this->steps); - } - - /** - * Returns scenario steps. - * - * @return StepNode[] - */ - public function getSteps() - { - return $this->steps; - } - - /** - * Returns scenario keyword. - * - * @return string - */ - public function getKeyword() - { - return $this->keyword; - } - - /** - * Returns scenario declaration line number. - * - * @return integer - */ - public function getLine() - { - return $this->line; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/StepContainerInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/StepContainerInterface.php deleted file mode 100644 index ebec3c4..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/StepContainerInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Gherkin step container interface. - * - * @author Konstantin Kudryashov - */ -interface StepContainerInterface extends NodeInterface -{ - /** - * Checks if container has steps. - * - * @return bool - */ - public function hasSteps(); - - /** - * Returns container steps. - * - * @return StepNode[] - */ - public function getSteps(); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/StepNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/StepNode.php deleted file mode 100644 index 77113bb..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/StepNode.php +++ /dev/null @@ -1,152 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -use Behat\Gherkin\Exception\NodeException; - -/** - * Represents Gherkin Step. - * - * @author Konstantin Kudryashov - */ -class StepNode implements NodeInterface -{ - /** - * @var string - */ - private $keyword; - /** - * @var string - */ - private $keywordType; - /** - * @var string - */ - private $text; - /** - * @var ArgumentInterface[] - */ - private $arguments = array(); - /** - * @var integer - */ - private $line; - - /** - * Initializes step. - * - * @param string $keyword - * @param string $text - * @param ArgumentInterface[] $arguments - * @param integer $line - * @param string $keywordType - */ - public function __construct($keyword, $text, array $arguments, $line, $keywordType = null) - { - if (count($arguments) > 1) { - throw new NodeException(sprintf( - 'Steps could have only one argument, but `%s %s` have %d.', - $keyword, - $text, - count($arguments) - )); - } - - $this->keyword = $keyword; - $this->text = $text; - $this->arguments = $arguments; - $this->line = $line; - $this->keywordType = $keywordType ?: 'Given'; - } - - /** - * Returns node type string - * - * @return string - */ - public function getNodeType() - { - return 'Step'; - } - - /** - * Returns step keyword in provided language (Given, When, Then, etc.). - * - * @return string - * - * @deprecated use getKeyword() instead - */ - public function getType() - { - return $this->getKeyword(); - } - - /** - * Returns step keyword in provided language (Given, When, Then, etc.). - * - * @return string - * - */ - public function getKeyword() - { - return $this->keyword; - } - - /** - * Returns step type keyword (Given, When, Then, etc.). - * - * @return string - */ - public function getKeywordType() - { - return $this->keywordType; - } - - /** - * Returns step text. - * - * @return string - */ - public function getText() - { - return $this->text; - } - - /** - * Checks if step has arguments. - * - * @return bool - */ - public function hasArguments() - { - return 0 < count($this->arguments); - } - - /** - * Returns step arguments. - * - * @return ArgumentInterface[] - */ - public function getArguments() - { - return $this->arguments; - } - - /** - * Returns step declaration line number. - * - * @return integer - */ - public function getLine() - { - return $this->line; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/TableNode.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/TableNode.php deleted file mode 100644 index 4099f64..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/TableNode.php +++ /dev/null @@ -1,383 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -use ArrayIterator; -use Behat\Gherkin\Exception\NodeException; -use Iterator; -use IteratorAggregate; -use ReturnTypeWillChange; - -/** - * Represents Gherkin Table argument. - * - * @author Konstantin Kudryashov - */ -class TableNode implements ArgumentInterface, IteratorAggregate -{ - /** - * @var array - */ - private $table; - /** - * @var integer - */ - private $maxLineLength = array(); - - /** - * Initializes table. - * - * @param array $table Table in form of [$rowLineNumber => [$val1, $val2, $val3]] - * - * @throws NodeException If the given table is invalid - */ - public function __construct(array $table) - { - $this->table = $table; - $columnCount = null; - - foreach ($this->getRows() as $ridx => $row) { - - if (!is_array($row)) { - throw new NodeException(sprintf( - "Table row '%s' is expected to be array, got %s", - $ridx, - gettype($row) - )); - } - - if ($columnCount === null) { - $columnCount = count($row); - } - - if (count($row) !== $columnCount) { - throw new NodeException(sprintf( - "Table row '%s' is expected to have %s columns, got %s", - $ridx, - $columnCount, - count($row) - )); - } - - foreach ($row as $column => $string) { - if (!isset($this->maxLineLength[$column])) { - $this->maxLineLength[$column] = 0; - } - - if (!is_scalar($string)) { - throw new NodeException(sprintf( - "Table cell at row '%s', col '%s' is expected to be scalar, got %s", - $ridx, - $column, - gettype($string) - )); - } - - $this->maxLineLength[$column] = max($this->maxLineLength[$column], mb_strlen($string, 'utf8')); - } - } - } - - /** - * Creates a table from a given list. - * - * @param array $list One-dimensional array - * - * @return TableNode - * - * @throws NodeException If the given list is not a one-dimensional array - */ - public static function fromList(array $list) - { - if (count($list) !== count($list, COUNT_RECURSIVE)) { - throw new NodeException('List is not a one-dimensional array.'); - } - - array_walk($list, function (&$item) { - $item = array($item); - }); - return new self($list); - } - - /** - * Returns node type. - * - * @return string - */ - public function getNodeType() - { - return 'Table'; - } - - /** - * Returns table hash, formed by columns (ColumnsHash). - * - * @return array - */ - public function getHash() - { - return $this->getColumnsHash(); - } - - /** - * Returns table hash, formed by columns. - * - * @return array - */ - public function getColumnsHash() - { - $rows = $this->getRows(); - $keys = array_shift($rows); - - $hash = array(); - foreach ($rows as $row) { - $hash[] = array_combine($keys, $row); - } - - return $hash; - } - - /** - * Returns table hash, formed by rows. - * - * @return array - */ - public function getRowsHash() - { - $hash = array(); - - foreach ($this->getRows() as $row) { - $hash[array_shift($row)] = (1 == count($row)) ? $row[0] : $row; - } - - return $hash; - } - - /** - * Returns numerated table lines. - * Line numbers are keys, lines are values. - * - * @return array - */ - public function getTable() - { - return $this->table; - } - - /** - * Returns table rows. - * - * @return array - */ - public function getRows() - { - return array_values($this->table); - } - - /** - * Returns table definition lines. - * - * @return array - */ - public function getLines() - { - return array_keys($this->table); - } - - /** - * Returns specific row in a table. - * - * @param integer $index Row number - * - * @return array - * - * @throws NodeException If row with specified index does not exist - */ - public function getRow($index) - { - $rows = $this->getRows(); - - if (!isset($rows[$index])) { - throw new NodeException(sprintf('Rows #%d does not exist in table.', $index)); - } - - return $rows[$index]; - } - - /** - * Returns specific column in a table. - * - * @param integer $index Column number - * - * @return array - * - * @throws NodeException If column with specified index does not exist - */ - public function getColumn($index) - { - if ($index >= count($this->getRow(0))) { - throw new NodeException(sprintf('Column #%d does not exist in table.', $index)); - } - - $rows = $this->getRows(); - $column = array(); - - foreach ($rows as $row) { - $column[] = $row[$index]; - } - - return $column; - } - - /** - * Returns line number at which specific row was defined. - * - * @param integer $index - * - * @return integer - * - * @throws NodeException If row with specified index does not exist - */ - public function getRowLine($index) - { - $lines = array_keys($this->table); - - if (!isset($lines[$index])) { - throw new NodeException(sprintf('Rows #%d does not exist in table.', $index)); - } - - return $lines[$index]; - } - - /** - * Converts row into delimited string. - * - * @param integer $rowNum Row number - * - * @return string - */ - public function getRowAsString($rowNum) - { - $values = array(); - foreach ($this->getRow($rowNum) as $column => $value) { - $values[] = $this->padRight(' ' . $value . ' ', $this->maxLineLength[$column] + 2); - } - - return sprintf('|%s|', implode('|', $values)); - } - - /** - * Converts row into delimited string. - * - * @param integer $rowNum Row number - * @param callable $wrapper Wrapper function - * - * @return string - */ - public function getRowAsStringWithWrappedValues($rowNum, $wrapper) - { - $values = array(); - foreach ($this->getRow($rowNum) as $column => $value) { - $value = $this->padRight(' ' . $value . ' ', $this->maxLineLength[$column] + 2); - - $values[] = call_user_func($wrapper, $value, $column); - } - - return sprintf('|%s|', implode('|', $values)); - } - - /** - * Converts entire table into string - * - * @return string - */ - public function getTableAsString() - { - $lines = array(); - for ($i = 0; $i < count($this->getRows()); $i++) { - $lines[] = $this->getRowAsString($i); - } - - return implode("\n", $lines); - } - - /** - * Returns line number at which table was started. - * - * @return integer - */ - public function getLine() - { - return $this->getRowLine(0); - } - - /** - * Converts table into string - * - * @return string - */ - public function __toString() - { - return $this->getTableAsString(); - } - - /** - * Retrieves a hash iterator. - * - * @return Iterator - */ - #[ReturnTypeWillChange] - public function getIterator() - { - return new ArrayIterator($this->getHash()); - } - - /** - * Obtains and adds rows from another table to the current table. - * The second table should have the same structure as the current one. - * @param TableNode $node - * - * @deprecated remove together with OutlineNode::getExampleTable - */ - public function mergeRowsFromTable(TableNode $node) - { - // check structure - if ($this->getRow(0) !== $node->getRow(0)) { - throw new NodeException("Tables have different structure. Cannot merge one into another"); - } - - $firstLine = $node->getLine(); - foreach ($node->getTable() as $line => $value) { - if ($line === $firstLine) { - continue; - } - - $this->table[$line] = $value; - } - } - - /** - * Pads string right. - * - * @param string $text Text to pad - * @param integer $length Length - * - * @return string - */ - protected function padRight($text, $length) - { - while ($length > mb_strlen($text, 'utf8')) { - $text = $text . ' '; - } - - return $text; - } -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/TaggedNodeInterface.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/TaggedNodeInterface.php deleted file mode 100644 index 4afa6d1..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Node/TaggedNodeInterface.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin\Node; - -/** - * Gherkin tagged node interface. - * - * @author Konstantin Kudryashov - */ -interface TaggedNodeInterface extends NodeInterface -{ - /** - * Checks if node is tagged with tag. - * - * @param string $tag - * - * @return bool - */ - public function hasTag($tag); - - /** - * Checks if node has tags (both inherited from feature and own). - * - * @return bool - */ - public function hasTags(); - - /** - * Returns node tags (including inherited from feature). - * - * @return string[] - */ - public function getTags(); -} diff --git a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Parser.php b/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Parser.php deleted file mode 100644 index cdfe445..0000000 --- a/tests/integration/vendor/behat/gherkin/src/Behat/Gherkin/Parser.php +++ /dev/null @@ -1,771 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Behat\Gherkin; - -use Behat\Gherkin\Exception\LexerException; -use Behat\Gherkin\Exception\NodeException; -use Behat\Gherkin\Exception\ParserException; -use Behat\Gherkin\Node\BackgroundNode; -use Behat\Gherkin\Node\ExampleTableNode; -use Behat\Gherkin\Node\FeatureNode; -use Behat\Gherkin\Node\OutlineNode; -use Behat\Gherkin\Node\PyStringNode; -use Behat\Gherkin\Node\ScenarioInterface; -use Behat\Gherkin\Node\ScenarioNode; -use Behat\Gherkin\Node\StepNode; -use Behat\Gherkin\Node\TableNode; - -/** - * Gherkin parser. - * - * $lexer = new Behat\Gherkin\Lexer($keywords); - * $parser = new Behat\Gherkin\Parser($lexer); - * $featuresArray = $parser->parse('/path/to/feature.feature'); - * - * @author Konstantin Kudryashov - */ -class Parser -{ - private $lexer; - private $input; - private $file; - private $tags = array(); - private $languageSpecifierLine; - - private $passedNodesStack = array(); - - /** - * Initializes parser. - * - * @param Lexer $lexer Lexer instance - */ - public function __construct(Lexer $lexer) - { - $this->lexer = $lexer; - } - - /** - * Parses input & returns features array. - * - * @param string $input Gherkin string document - * @param string $file File name - * - * @return FeatureNode|null - * - * @throws ParserException - */ - public function parse($input, $file = null) - { - $this->languageSpecifierLine = null; - $this->input = $input; - $this->file = $file; - $this->tags = array(); - - try { - $this->lexer->analyse($this->input, 'en'); - } catch (LexerException $e) { - throw new ParserException( - sprintf('Lexer exception "%s" thrown for file %s', $e->getMessage(), $file), - 0, - $e - ); - } - - $feature = null; - while ('EOS' !== ($predicted = $this->predictTokenType())) { - $node = $this->parseExpression(); - - if (null === $node || "\n" === $node) { - continue; - } - - if (!$feature && $node instanceof FeatureNode) { - $feature = $node; - continue; - } - - if ($feature && $node instanceof FeatureNode) { - throw new ParserException(sprintf( - 'Only one feature is allowed per feature file. But %s got multiple.', - $this->file - )); - } - - if (is_string($node)) { - throw new ParserException(sprintf( - 'Expected Feature, but got text: "%s"%s', - $node, - $this->file ? ' in file: ' . $this->file : '' - )); - } - - if (!$node instanceof FeatureNode) { - throw new ParserException(sprintf( - 'Expected Feature, but got %s on line: %d%s', - $node->getKeyword(), - $node->getLine(), - $this->file ? ' in file: ' . $this->file : '' - )); - } - } - - return $feature; - } - - /** - * Returns next token if it's type equals to expected. - * - * @param string $type Token type - * - * @return array - * - * @throws Exception\ParserException - */ - protected function expectTokenType($type) - { - $types = (array) $type; - if (in_array($this->predictTokenType(), $types)) { - return $this->lexer->getAdvancedToken(); - } - - $token = $this->lexer->predictToken(); - - throw new ParserException(sprintf( - 'Expected %s token, but got %s on line: %d%s', - implode(' or ', $types), - $this->predictTokenType(), - $token['line'], - $this->file ? ' in file: ' . $this->file : '' - )); - } - - /** - * Returns next token if it's type equals to expected. - * - * @param string $type Token type - * - * @return null|array - */ - protected function acceptTokenType($type) - { - if ($type !== $this->predictTokenType()) { - return null; - } - - return $this->lexer->getAdvancedToken(); - } - - /** - * Returns next token type without real input reading (prediction). - * - * @return string - */ - protected function predictTokenType() - { - $token = $this->lexer->predictToken(); - - return $token['type']; - } - - /** - * Parses current expression & returns Node. - * - * @return string|FeatureNode|BackgroundNode|ScenarioNode|OutlineNode|TableNode|StepNode - * - * @throws ParserException - */ - protected function parseExpression() - { - $type = $this->predictTokenType(); - - while ($type === 'Comment') { - $this->expectTokenType('Comment'); - - $type = $this->predictTokenType(); - } - - switch ($type) { - case 'Feature': - return $this->parseFeature(); - case 'Background': - return $this->parseBackground(); - case 'Scenario': - return $this->parseScenario(); - case 'Outline': - return $this->parseOutline(); - case 'Examples': - return $this->parseExamples(); - case 'TableRow': - return $this->parseTable(); - case 'PyStringOp': - return $this->parsePyString(); - case 'Step': - return $this->parseStep(); - case 'Text': - return $this->parseText(); - case 'Newline': - return $this->parseNewline(); - case 'Tag': - return $this->parseTags(); - case 'Language': - return $this->parseLanguage(); - case 'EOS': - return ''; - } - - throw new ParserException(sprintf('Unknown token type: %s', $type)); - } - - /** - * Parses feature token & returns it's node. - * - * @return FeatureNode - * - * @throws ParserException - */ - protected function parseFeature() - { - $token = $this->expectTokenType('Feature'); - - $title = trim($token['value'] ?? ''); - $description = null; - $tags = $this->popTags(); - $background = null; - $scenarios = array(); - $keyword = $token['keyword']; - $language = $this->lexer->getLanguage(); - $file = $this->file; - $line = $token['line']; - - array_push($this->passedNodesStack, 'Feature'); - - // Parse description, background, scenarios & outlines - while ('EOS' !== $this->predictTokenType()) { - $node = $this->parseExpression(); - - if (is_string($node)) { - $text = preg_replace('/^\s{0,' . ($token['indent'] + 2) . '}|\s*$/', '', $node); - $description .= (null !== $description ? "\n" : '') . $text; - continue; - } - - if (!$background && $node instanceof BackgroundNode) { - $background = $node; - continue; - } - - if ($node instanceof ScenarioInterface) { - $scenarios[] = $node; - continue; - } - - if ($background instanceof BackgroundNode && $node instanceof BackgroundNode) { - throw new ParserException(sprintf( - 'Each Feature could have only one Background, but found multiple on lines %d and %d%s', - $background->getLine(), - $node->getLine(), - $this->file ? ' in file: ' . $this->file : '' - )); - } - - if (!$node instanceof ScenarioNode) { - throw new ParserException(sprintf( - 'Expected Scenario, Outline or Background, but got %s on line: %d%s', - $node->getNodeType(), - $node->getLine(), - $this->file ? ' in file: ' . $this->file : '' - )); - } - } - - return new FeatureNode( - rtrim($title) ?: null, - rtrim($description ?? '') ?: null, - $tags, - $background, - $scenarios, - $keyword, - $language, - $file, - $line - ); - } - - /** - * Parses background token & returns it's node. - * - * @return BackgroundNode - * - * @throws ParserException - */ - protected function parseBackground() - { - $token = $this->expectTokenType('Background'); - - $title = trim($token['value'] ?? ''); - $keyword = $token['keyword']; - $line = $token['line']; - - if (count($this->popTags())) { - throw new ParserException(sprintf( - 'Background can not be tagged, but it is on line: %d%s', - $line, - $this->file ? ' in file: ' . $this->file : '' - )); - } - - // Parse description and steps - $steps = array(); - $allowedTokenTypes = array('Step', 'Newline', 'Text', 'Comment'); - while (in_array($this->predictTokenType(), $allowedTokenTypes)) { - $node = $this->parseExpression(); - - if ($node instanceof StepNode) { - $steps[] = $this->normalizeStepNodeKeywordType($node, $steps); - continue; - } - - if (!count($steps) && is_string($node)) { - $text = preg_replace('/^\s{0,' . ($token['indent'] + 2) . '}|\s*$/', '', $node); - $title .= "\n" . $text; - continue; - } - - if ("\n" === $node) { - continue; - } - - if (is_string($node)) { - throw new ParserException(sprintf( - 'Expected Step, but got text: "%s"%s', - $node, - $this->file ? ' in file: ' . $this->file : '' - )); - } - - if (!$node instanceof StepNode) { - throw new ParserException(sprintf( - 'Expected Step, but got %s on line: %d%s', - $node->getNodeType(), - $node->getLine(), - $this->file ? ' in file: ' . $this->file : '' - )); - } - } - - return new BackgroundNode(rtrim($title) ?: null, $steps, $keyword, $line); - } - - /** - * Parses scenario token & returns it's node. - * - * @return ScenarioNode - * - * @throws ParserException - */ - protected function parseScenario() - { - $token = $this->expectTokenType('Scenario'); - - $title = trim($token['value'] ?? ''); - $tags = $this->popTags(); - $keyword = $token['keyword']; - $line = $token['line']; - - array_push($this->passedNodesStack, 'Scenario'); - - // Parse description and steps - $steps = array(); - while (in_array($this->predictTokenType(), array('Step', 'Newline', 'Text', 'Comment'))) { - $node = $this->parseExpression(); - - if ($node instanceof StepNode) { - $steps[] = $this->normalizeStepNodeKeywordType($node, $steps); - continue; - } - - if (!count($steps) && is_string($node)) { - $text = preg_replace('/^\s{0,' . ($token['indent'] + 2) . '}|\s*$/', '', $node); - $title .= "\n" . $text; - continue; - } - - if ("\n" === $node) { - continue; - } - - if (is_string($node)) { - throw new ParserException(sprintf( - 'Expected Step, but got text: "%s"%s', - $node, - $this->file ? ' in file: ' . $this->file : '' - )); - } - - if (!$node instanceof StepNode) { - throw new ParserException(sprintf( - 'Expected Step, but got %s on line: %d%s', - $node->getNodeType(), - $node->getLine(), - $this->file ? ' in file: ' . $this->file : '' - )); - } - } - - array_pop($this->passedNodesStack); - - return new ScenarioNode(rtrim($title) ?: null, $tags, $steps, $keyword, $line); - } - - /** - * Parses scenario outline token & returns it's node. - * - * @return OutlineNode - * - * @throws ParserException - */ - protected function parseOutline() - { - $token = $this->expectTokenType('Outline'); - - $title = trim($token['value'] ?? ''); - $tags = $this->popTags(); - $keyword = $token['keyword']; - - /** @var ExampleTableNode $examples */ - $examples = array(); - $line = $token['line']; - - // Parse description, steps and examples - $steps = array(); - - array_push($this->passedNodesStack, 'Outline'); - - while (in_array($nextTokenType = $this->predictTokenType(), array('Step', 'Examples', 'Newline', 'Text', 'Comment', 'Tag'))) { - if ($nextTokenType === 'Comment') { - $this->lexer->skipPredictedToken(); - continue; - } - - $node = $this->parseExpression(); - - if ($node instanceof StepNode) { - $steps[] = $this->normalizeStepNodeKeywordType($node, $steps); - continue; - } - - if ($node instanceof ExampleTableNode) { - $examples[] = $node; - - continue; - } - - if (!count($steps) && is_string($node)) { - $text = preg_replace('/^\s{0,' . ($token['indent'] + 2) . '}|\s*$/', '', $node); - $title .= "\n" . $text; - continue; - } - - if ("\n" === $node) { - continue; - } - - if (is_string($node)) { - throw new ParserException(sprintf( - 'Expected Step or Examples table, but got text: "%s"%s', - $node, - $this->file ? ' in file: ' . $this->file : '' - )); - } - - if (!$node instanceof StepNode) { - throw new ParserException(sprintf( - 'Expected Step or Examples table, but got %s on line: %d%s', - $node->getNodeType(), - $node->getLine(), - $this->file ? ' in file: ' . $this->file : '' - )); - } - } - - if (empty($examples)) { - throw new ParserException(sprintf( - 'Outline should have examples table, but got none for outline "%s" on line: %d%s', - rtrim($title), - $line, - $this->file ? ' in file: ' . $this->file : '' - )); - } - - return new OutlineNode(rtrim($title) ?: null, $tags, $steps, $examples, $keyword, $line); - } - - /** - * Parses step token & returns it's node. - * - * @return StepNode - */ - protected function parseStep() - { - $token = $this->expectTokenType('Step'); - - $keyword = $token['value']; - $keywordType = $token['keyword_type']; - $text = trim($token['text']); - $line = $token['line']; - - array_push($this->passedNodesStack, 'Step'); - - $arguments = array(); - while (in_array($predicted = $this->predictTokenType(), array('PyStringOp', 'TableRow', 'Newline', 'Comment'))) { - if ('Comment' === $predicted || 'Newline' === $predicted) { - $this->acceptTokenType($predicted); - continue; - } - - $node = $this->parseExpression(); - - if ($node instanceof PyStringNode || $node instanceof TableNode) { - $arguments[] = $node; - } - } - - array_pop($this->passedNodesStack); - - return new StepNode($keyword, $text, $arguments, $line, $keywordType); - } - - /** - * Parses examples table node. - * - * @return ExampleTableNode - */ - protected function parseExamples() - { - $keyword = ($this->expectTokenType('Examples'))['keyword']; - $tags = empty($this->tags) ? array() : $this->popTags(); - $table = $this->parseTableRows(); - - try { - return new ExampleTableNode($table, $keyword, $tags); - } catch(NodeException $e) { - $this->rethrowNodeException($e); - } - } - - /** - * Parses table token & returns it's node. - * - * @return TableNode - */ - protected function parseTable() - { - $table = $this->parseTableRows(); - - try { - return new TableNode($table); - } catch(NodeException $e) { - $this->rethrowNodeException($e); - } - } - - /** - * Parses PyString token & returns it's node. - * - * @return PyStringNode - */ - protected function parsePyString() - { - $token = $this->expectTokenType('PyStringOp'); - - $line = $token['line']; - - $strings = array(); - while ('PyStringOp' !== ($predicted = $this->predictTokenType()) && 'Text' === $predicted) { - $token = $this->expectTokenType('Text'); - - $strings[] = $token['value']; - } - - $this->expectTokenType('PyStringOp'); - - return new PyStringNode($strings, $line); - } - - /** - * Parses tags. - * - * @return BackgroundNode|FeatureNode|OutlineNode|ScenarioNode|StepNode|TableNode|string - */ - protected function parseTags() - { - $token = $this->expectTokenType('Tag'); - - $this->guardTags($token['tags']); - - $this->tags = array_merge($this->tags, $token['tags']); - - $possibleTransitions = array( - 'Outline' => array( - 'Examples', - 'Step' - ) - ); - - $currentType = '-1'; - // check if that is ok to go inside: - if (!empty($this->passedNodesStack)) { - $currentType = $this->passedNodesStack[count($this->passedNodesStack) - 1]; - } - - $nextType = $this->predictTokenType(); - if (!isset($possibleTransitions[$currentType]) || in_array($nextType, $possibleTransitions[$currentType])) { - return $this->parseExpression(); - } - - return "\n"; - } - - /** - * Returns current set of tags and clears tag buffer. - * - * @return array - */ - protected function popTags() - { - $tags = $this->tags; - $this->tags = array(); - - return $tags; - } - - /** - * Checks the tags fit the required format - * - * @param string[] $tags - */ - protected function guardTags(array $tags) - { - foreach ($tags as $tag) { - if (preg_match('/\s/', $tag)) { - trigger_error('Whitespace in tags is deprecated, found "$tag"', E_USER_DEPRECATED); - } - } - } - - /** - * Parses next text line & returns it. - * - * @return string - */ - protected function parseText() - { - $token = $this->expectTokenType('Text'); - - return $token['value']; - } - - /** - * Parses next newline & returns \n. - * - * @return string - */ - protected function parseNewline() - { - $this->expectTokenType('Newline'); - - return "\n"; - } - - /** - * Parses language block and updates lexer configuration based on it. - * - * @return BackgroundNode|FeatureNode|OutlineNode|ScenarioNode|StepNode|TableNode|string - * - * @throws ParserException - */ - protected function parseLanguage() - { - $token = $this->expectTokenType('Language'); - - if (null === $this->languageSpecifierLine) { - $this->lexer->analyse($this->input, $token['value']); - $this->languageSpecifierLine = $token['line']; - } elseif ($token['line'] !== $this->languageSpecifierLine) { - throw new ParserException(sprintf( - 'Ambiguous language specifiers on lines: %d and %d%s', - $this->languageSpecifierLine, - $token['line'], - $this->file ? ' in file: ' . $this->file : '' - )); - } - - return $this->parseExpression(); - } - - /** - * Parses the rows of a table - * - * @return string[][] - */ - private function parseTableRows() - { - $table = array(); - while (in_array($predicted = $this->predictTokenType(), array('TableRow', 'Newline', 'Comment'))) { - if ('Comment' === $predicted || 'Newline' === $predicted) { - $this->acceptTokenType($predicted); - continue; - } - - $token = $this->expectTokenType('TableRow'); - - $table[$token['line']] = $token['columns']; - } - - return $table; - } - - /** - * Changes step node type for types But, And to type of previous step if it exists else sets to Given - * - * @param StepNode $node - * @param StepNode[] $steps - * @return StepNode - */ - private function normalizeStepNodeKeywordType(StepNode $node, array $steps = array()) - { - if (in_array($node->getKeywordType(), array('And', 'But'))) { - if (($prev = end($steps))) { - $keywordType = $prev->getKeywordType(); - } else { - $keywordType = 'Given'; - } - - $node = new StepNode( - $node->getKeyword(), - $node->getText(), - $node->getArguments(), - $node->getLine(), - $keywordType - ); - } - return $node; - } - - private function rethrowNodeException(NodeException $e): void - { - throw new ParserException( - $e->getMessage() . ($this->file ? ' in file ' . $this->file : ''), - 0, - $e - ); - } -} diff --git a/tests/integration/vendor/behat/transliterator/CHANGELOG.md b/tests/integration/vendor/behat/transliterator/CHANGELOG.md deleted file mode 100644 index 8cd8573..0000000 --- a/tests/integration/vendor/behat/transliterator/CHANGELOG.md +++ /dev/null @@ -1,31 +0,0 @@ -# 1.5.0 / 2022-03-30 - -- Bump the min PHP version to 7.2 - -# 1.4.0 / 2022-03-30 - -- Updated Unicode bank files -- Add CI builds on PHP 8 and 8.1 - -# 1.3.0 / 2020-01-14 - -- Fix existing Travis CI builds -- Add CI builds for all PHP versions between 5.3 and 7.4 -- Add preliminary support for PHP 7.4 - -# 1.2.0 / 2017-04-04 - -- Stop Transliterator::postProcessText() breaking words containing apostrophes - -# 1.1.0 / 2015-09-28 - -- Updated unicode bank files -- Added a testsuite for the library - -# 1.0.1 / 2014-05-14 - -- fixed the regex used to replace non-word characters - -# 1.0.0 / 2014-01-12 - -- Initial release as a standalone component diff --git a/tests/integration/vendor/behat/transliterator/CONTRIBUTING.md b/tests/integration/vendor/behat/transliterator/CONTRIBUTING.md deleted file mode 100644 index 29d047f..0000000 --- a/tests/integration/vendor/behat/transliterator/CONTRIBUTING.md +++ /dev/null @@ -1,18 +0,0 @@ -Contributing to Behat Transliterator -==================================== - -Updating data -------------- - -Setup dependencies with [Composer](https://getcomposer.org): - -```bash -composer install -``` - -Run, char tables in Behat Transliterator will be synced from Perl library -using version defined in `\Behat\Transliterator\SyncTool::LIB_VERSION` - -```bash -bin/update-data -``` diff --git a/tests/integration/vendor/behat/transliterator/LICENSE b/tests/integration/vendor/behat/transliterator/LICENSE deleted file mode 100644 index 886394c..0000000 --- a/tests/integration/vendor/behat/transliterator/LICENSE +++ /dev/null @@ -1,128 +0,0 @@ - The "Artistic License" - - Preamble - -The intent of this document is to state the conditions under which a -Package may be copied, such that the Copyright Holder maintains some -semblance of artistic control over the development of the package, -while giving the users of the package the right to use and distribute -the Package in a more-or-less customary fashion, plus the right to make -reasonable modifications. - -Definitions: - - "Package" refers to the collection of files distributed by the - Copyright Holder, and derivatives of that collection of files - created through textual modification. - - "Standard Version" refers to such a Package if it has not been - modified, or has been modified in accordance with the wishes - of the Copyright Holder as specified below. - - "Copyright Holder" is whoever is named in the copyright or - copyrights for the package. - - "You" is you, if you're thinking about copying or distributing - this Package. - - "Reasonable copying fee" is whatever you can justify on the - basis of media cost, duplication charges, time of people involved, - and so on. (You will not be required to justify it to the - Copyright Holder, but only to the computing community at large - as a market that must bear the fee.) - - "Freely Available" means that no fee is charged for the item - itself, though there may be fees involved in handling the item. - It also means that recipients of the item may redistribute it - under the same conditions they received it. - -1. You may make and give away verbatim copies of the source form of the -Standard Version of this Package without restriction, provided that you -duplicate all of the original copyright notices and associated disclaimers. - -2. You may apply bug fixes, portability fixes and other modifications -derived from the Public Domain or from the Copyright Holder. A Package -modified in such a way shall still be considered the Standard Version. - -3. You may otherwise modify your copy of this Package in any way, provided -that you insert a prominent notice in each changed file stating how and -when you changed that file, and provided that you do at least ONE of the -following: - - a) place your modifications in the Public Domain or otherwise make them - Freely Available, such as by posting said modifications to Usenet or - an equivalent medium, or placing the modifications on a major archive - site such as uunet.uu.net, or by allowing the Copyright Holder to include - your modifications in the Standard Version of the Package. - - b) use the modified Package only within your corporation or organization. - - c) rename any non-standard executables so the names do not conflict - with standard executables, which must also be provided, and provide - a separate manual page for each non-standard executable that clearly - documents how it differs from the Standard Version. - - d) make other distribution arrangements with the Copyright Holder. - -4. You may distribute the programs of this Package in object code or -executable form, provided that you do at least ONE of the following: - - a) distribute a Standard Version of the executables and library files, - together with instructions (in the manual page or equivalent) on where - to get the Standard Version. - - b) accompany the distribution with the machine-readable source of - the Package with your modifications. - - c) give non-standard executables non-standard names, and clearly - document the differences in manual pages (or equivalent), together - with instructions on where to get the Standard Version. - - d) make other distribution arrangements with the Copyright Holder. - -5. You may charge a reasonable copying fee for any distribution of this -Package. You may charge any fee you choose for support of this -Package. You may not charge a fee for this Package itself. However, -you may distribute this Package in aggregate with other (possibly -commercial) programs as part of a larger (possibly commercial) software -distribution provided that you do not advertise this Package as a -product of your own. You may embed this Package's interpreter within -an executable of yours (by linking); this shall be construed as a mere -form of aggregation, provided that the complete Standard Version of the -interpreter is so embedded. - -6. The scripts and library files supplied as input to or produced as -output from the programs of this Package do not automatically fall -under the copyright of this Package, but belong to whoever generated -them, and may be sold commercially, and may be aggregated with this -Package. If such scripts or library files are aggregated with this -Package via the so-called "undump" or "unexec" methods of producing a -binary executable image, then distribution of such an image shall -neither be construed as a distribution of this Package nor shall it -fall under the restrictions of Paragraphs 3 and 4, provided that you do -not represent such an executable image as a Standard Version of this -Package. - -7. C subroutines (or comparably compiled subroutines in other -languages) supplied by you and linked into this Package in order to -emulate subroutines and variables of the language defined by this -Package shall not be considered part of this Package, but are the -equivalent of input as in Paragraph 6, provided these subroutines do -not change the language in any way that would cause it to fail the -regression tests for the language. - -8. Aggregation of this Package with a commercial distribution is always -permitted provided that the use of this Package is embedded; that is, -when no overt attempt is made to make this Package's interfaces visible -to the end user of the commercial distribution. Such use shall not be -construed as a distribution of this Package. - -9. The name of the Copyright Holder may not be used to endorse or promote -products derived from this software without specific prior written permission. - -10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - - The End - diff --git a/tests/integration/vendor/behat/transliterator/README.md b/tests/integration/vendor/behat/transliterator/README.md deleted file mode 100644 index 0685ae0..0000000 --- a/tests/integration/vendor/behat/transliterator/README.md +++ /dev/null @@ -1,24 +0,0 @@ -Behat Transliterator -==================== - -Behat Transliterator provides transliteration utilities for PHP. - -Transliteration data are ported from the [Perl Text-Unidecode module](https://metacpan.org/pod/Text::Unidecode). - -[![License](https://poser.pugx.org/behat/transliterator/license.svg)](https://packagist.org/packages/behat/transliterator) -[![CI](https://github.com/Behat/Transliterator/actions/workflows/ci.yml/badge.svg)](https://github.com/Behat/Transliterator/actions/workflows/ci.yml) -[![Total Downloads](https://poser.pugx.org/behat/transliterator/downloads.svg)](https://packagist.org/packages/behat/transliterator) - -Installation ------------- - -The easiest way to install Behat is by using [Composer](https://getcomposer.org): - -```bash -composer require behat/transliterator -``` - -Usage ------ - -All features of the library are exposed as static public methods in the [``Behat\Transliterator\Transliterator`` class](src/Behat/Transliterator/Transliterator.php). diff --git a/tests/integration/vendor/behat/transliterator/composer.json b/tests/integration/vendor/behat/transliterator/composer.json deleted file mode 100644 index e42c322..0000000 --- a/tests/integration/vendor/behat/transliterator/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "behat/transliterator", - "description": "String transliterator", - "keywords": [ - "transliterator", - "slug", - "i18n" - ], - "type": "library", - "license": "Artistic-1.0", - "require": { - "php": ">=7.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.25 || ^9.5.19", - "php-yaoi/php-yaoi": "^1.0", - "chuyskywalker/rolling-curl": "^3.1" - }, - "autoload": { - "psr-4": { - "Behat\\Transliterator\\": "src/Behat/Transliterator" - } - }, - "autoload-dev": { - "psr-4": { - "Behat\\Tests\\Transliterator\\": "tests" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - } -} diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/SyncTool.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/SyncTool.php deleted file mode 100644 index ce4a4c6..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/SyncTool.php +++ /dev/null @@ -1,213 +0,0 @@ - '}', - '\\\\' => '\\', - '\\{' => '{', - '\\@' => '@', - '\\$' => '$', - ); - - $this->tokenizer = new Parser(); - $this->tokenizer->addLineStopper('#'); - $this->tokenizer->addQuote('qq{', '}', $escape); - $this->tokenizer->addQuote('q{', '}', $escape); - $this->tokenizer->addQuote('"', '"'); - $this->tokenizer->addQuote("'", "'"); - $this->tokenizer->addBracket('[', ']'); - $this->tokenizer->addDelimiter(';'); - - $this->renderer = new Renderer(); - $this->renderer - ->setBindKey('-~z', 'z~-') - ->strip('#') - ->keepBoundaries('['); - } - - public static function setUpDefinition(Definition $definition, $options) - { - $definition->name = 'update-data'; - $definition->description = 'Tool for converting char tables for Behat/Transliterator from Perl to PHP'; - } - - public function performAction() - { - $rollingCurl = new RollingCurl(); - - foreach ($this->getPerlTablesUrlList() as $url) { - $rollingCurl->get($url); - } - - $rollingCurl->setCallback(function (Request $request, RollingCurl $rollingCurl) { - $this->response->addContent($request->getUrl()); - $content = $request->getResponseText(); - $this->parsePerlTable($content); - }) - ->execute(); - } - - private function removePhpCharTable($phpFilePath, $reason) - { - $this->response->addContent($reason); - if (file_exists($phpFilePath)) { - if (unlink($phpFilePath)) { - $this->response->success('Deleted'); - } else { - $this->response->error('Failed to delete'); - } - } else { - $this->response->success('No PHP file, skipped'); - } - } - - private function pushItem($item) - { - if ($this->itemIndex >= 16) { - $this->phpTable = trim($this->phpTable); - $this->phpTable .= "\n"; - $this->itemIndex = 0; - } - ++$this->itemIndex; - - $item = new StringValue($item); - if ($item->starts('\x') || $item->starts('\n')) { - $this->phpTable .= '"' . $item . '", '; - $this->nonQuestionBoxFound = true; - } else { - // TODO check if this hack should be removed for chinese letters - if ($item->value === '[?] ') { - $item->value = '[?]'; - } - // - - if ($item->value !== '[?]') { - $this->nonQuestionBoxFound = true; - } - - $this->phpTable .= "'" . str_replace(array('\\', '\''), array('\\\\', '\\\''), $item) . "', "; - } - } - - private function tokenizePerlTable($content) - { - $tokens = $this->tokenizer->tokenize($content); - - $expression = $this->renderer->getExpression($tokens); - $statement = $expression->getStatement(); - /** @var Parsed[] $binds */ - $binds = $expression->getBinds(); - - $parser = new StringParser($statement); - $block = (string)$parser->inner('$Text::Unidecode::Char[', ']'); - if (!$block) { - throw new \Exception('Block not found'); - } - $this->block = $this->renderer->getExpression($binds[$block])->getStatement(); - - $itemsBind = (string)$parser->inner('[', ']'); - - if (!$itemsBind) { - $items = array(); - } - else { - $items = $binds[$itemsBind]; - } - - return $items; - } - - private function parsePerlTable($content) - { - $items = $this->tokenizePerlTable($content); - - $phpFilePath = __DIR__ . '/data/' . substr($this->block, 1) . '.php'; - if (!$items) { - $this->removePhpCharTable($phpFilePath, 'Empty char table for block ' . $this->block); - return; - } - - $this->phpTable = <<block] = array( - -PHP; - - $itemsExpression = $this->renderer->getExpression($items); - $itemsStatement = $itemsExpression->getStatement(); - $itemsBinds = $itemsExpression->getBinds(); - - $itemsStatement = explode(',', $itemsStatement); - $this->itemIndex = 0; - $this->nonQuestionBoxFound = false; - foreach ($itemsStatement as $item) { - $item = trim($item); - if (!$item) { - break; - } - - if (isset($itemsBinds[$item])) { - /** @var Token $token */ - $token = $itemsBinds[$item]; - $item = $token->unEscapedContent; - } - - $this->pushItem($item); - } - - if ($this->nonQuestionBoxFound) { - $this->phpTable = trim($this->phpTable) . "\n" . ');' . "\n"; - if (file_put_contents($phpFilePath, $this->phpTable)) { - $this->response->success('Block ' . $this->block . ' converted to ' . $phpFilePath); - } else { - $this->response->error('Failed to save ' . $phpFilePath); - } - } else { - $this->removePhpCharTable($phpFilePath, 'Block ' . $this->block . ' contains only [?]'); - } - - } - - private function getPerlTablesUrlList() - { - $client = new Client(); - $list = array(); - $page = $client->fetch('https://st.aticpan.org/source/SBURKE/Text-Unidecode-' . self::LIB_VERSION . '/lib/Text/Unidecode/'); - foreach (StringParser::create($page)->innerAll('.pm\'>', '') as $xXXpm) { - $list[] = 'https://st.aticpan.org/source/SBURKE/Text-Unidecode-' . self::LIB_VERSION . '/lib/Text/Unidecode/' - . $xXXpm; - } - return $list; - } -} - diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/Transliterator.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/Transliterator.php deleted file mode 100644 index 5847993..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/Transliterator.php +++ /dev/null @@ -1,590 +0,0 @@ - - * @author Jonathan H. Wage - * @author - */ -abstract class Transliterator -{ - /** - * Checks whether a string has utf7 characters in it. - * - * By bmorel at ssi dot fr - * - * @param string $string - * - * @return bool - */ - public static function seemsUtf8($string) - { - $stringLength = strlen($string); - - for ($i = 0; $i < $stringLength; ++$i) { - if (ord($string[$i]) < 0x80) { // 0bbbbbbb - continue; - } elseif ((ord($string[$i]) & 0xE0) == 0xC0) { // 110bbbbb - $n = 1; - } elseif ((ord($string[$i]) & 0xF0) == 0xE0) { //1110bbbb - $n = 2; - } elseif ((ord($string[$i]) & 0xF8) == 0xF0) { // 11110bbb - $n = 3; - } elseif ((ord($string[$i]) & 0xFC) == 0xF8) { // 111110bb - $n = 4; - } elseif ((ord($string[$i]) & 0xFE) == 0xFC) { // 1111110b - $n = 5; - } else { - return false; // Does not match any model - } - - for ($j = 0; $j < $n; ++$j) { // n bytes matching 10bbbbbb follow ? - if (++$i === $stringLength || ((ord($string[$i]) & 0xC0) !== 0x80)) { - return false; - } - } - } - - return true; - } - - /** - * Replaces accentuated chars (and a few others) with their ASCII base char. - * - * @see Transliterator::utf8ToAscii for a full transliteration to ASCII - * - * @param string $string String to unaccent - * - * @return string Unaccented string - */ - public static function unaccent($string) - { - if (!preg_match('/[\x80-\xff]/', $string)) { - return $string; - } - - if (self::seemsUtf8($string)) { - $chars = array( - // Decompositions for Latin-1 Supplement - chr(195).chr(128) => 'A', - chr(195).chr(129) => 'A', - chr(195).chr(130) => 'A', - chr(195).chr(131) => 'A', - chr(195).chr(132) => 'A', - chr(195).chr(133) => 'A', - chr(195).chr(135) => 'C', - chr(195).chr(136) => 'E', - chr(195).chr(137) => 'E', - chr(195).chr(138) => 'E', - chr(195).chr(139) => 'E', - chr(195).chr(140) => 'I', - chr(195).chr(141) => 'I', - chr(195).chr(142) => 'I', - chr(195).chr(143) => 'I', - chr(195).chr(145) => 'N', - chr(195).chr(146) => 'O', - chr(195).chr(147) => 'O', - chr(195).chr(148) => 'O', - chr(195).chr(149) => 'O', - chr(195).chr(150) => 'O', - chr(195).chr(153) => 'U', - chr(195).chr(154) => 'U', - chr(195).chr(155) => 'U', - chr(195).chr(156) => 'U', - chr(195).chr(157) => 'Y', - chr(195).chr(159) => 's', - chr(195).chr(160) => 'a', - chr(195).chr(161) => 'a', - chr(195).chr(162) => 'a', - chr(195).chr(163) => 'a', - chr(195).chr(164) => 'a', - chr(195).chr(165) => 'a', - chr(195).chr(167) => 'c', - chr(195).chr(168) => 'e', - chr(195).chr(169) => 'e', - chr(195).chr(170) => 'e', - chr(195).chr(171) => 'e', - chr(195).chr(172) => 'i', - chr(195).chr(173) => 'i', - chr(195).chr(174) => 'i', - chr(195).chr(175) => 'i', - chr(195).chr(177) => 'n', - chr(195).chr(178) => 'o', - chr(195).chr(179) => 'o', - chr(195).chr(180) => 'o', - chr(195).chr(181) => 'o', - chr(195).chr(182) => 'o', - chr(195).chr(182) => 'o', - chr(195).chr(185) => 'u', - chr(195).chr(186) => 'u', - chr(195).chr(187) => 'u', - chr(195).chr(188) => 'u', - chr(195).chr(189) => 'y', - chr(195).chr(191) => 'y', - // Decompositions for Latin Extended-A - chr(196).chr(128) => 'A', - chr(196).chr(129) => 'a', - chr(196).chr(130) => 'A', - chr(196).chr(131) => 'a', - chr(196).chr(132) => 'A', - chr(196).chr(133) => 'a', - chr(196).chr(134) => 'C', - chr(196).chr(135) => 'c', - chr(196).chr(136) => 'C', - chr(196).chr(137) => 'c', - chr(196).chr(138) => 'C', - chr(196).chr(139) => 'c', - chr(196).chr(140) => 'C', - chr(196).chr(141) => 'c', - chr(196).chr(142) => 'D', - chr(196).chr(143) => 'd', - chr(196).chr(144) => 'D', - chr(196).chr(145) => 'd', - chr(196).chr(146) => 'E', - chr(196).chr(147) => 'e', - chr(196).chr(148) => 'E', - chr(196).chr(149) => 'e', - chr(196).chr(150) => 'E', - chr(196).chr(151) => 'e', - chr(196).chr(152) => 'E', - chr(196).chr(153) => 'e', - chr(196).chr(154) => 'E', - chr(196).chr(155) => 'e', - chr(196).chr(156) => 'G', - chr(196).chr(157) => 'g', - chr(196).chr(158) => 'G', - chr(196).chr(159) => 'g', - chr(196).chr(160) => 'G', - chr(196).chr(161) => 'g', - chr(196).chr(162) => 'G', - chr(196).chr(163) => 'g', - chr(196).chr(164) => 'H', - chr(196).chr(165) => 'h', - chr(196).chr(166) => 'H', - chr(196).chr(167) => 'h', - chr(196).chr(168) => 'I', - chr(196).chr(169) => 'i', - chr(196).chr(170) => 'I', - chr(196).chr(171) => 'i', - chr(196).chr(172) => 'I', - chr(196).chr(173) => 'i', - chr(196).chr(174) => 'I', - chr(196).chr(175) => 'i', - chr(196).chr(176) => 'I', - chr(196).chr(177) => 'i', - chr(196).chr(178) => 'IJ', - chr(196).chr(179) => 'ij', - chr(196).chr(180) => 'J', - chr(196).chr(181) => 'j', - chr(196).chr(182) => 'K', - chr(196).chr(183) => 'k', - chr(196).chr(184) => 'k', - chr(196).chr(185) => 'L', - chr(196).chr(186) => 'l', - chr(196).chr(187) => 'L', - chr(196).chr(188) => 'l', - chr(196).chr(189) => 'L', - chr(196).chr(190) => 'l', - chr(196).chr(191) => 'L', - chr(197).chr(128) => 'l', - chr(197).chr(129) => 'L', - chr(197).chr(130) => 'l', - chr(197).chr(131) => 'N', - chr(197).chr(132) => 'n', - chr(197).chr(133) => 'N', - chr(197).chr(134) => 'n', - chr(197).chr(135) => 'N', - chr(197).chr(136) => 'n', - chr(197).chr(137) => 'N', - chr(197).chr(138) => 'n', - chr(197).chr(139) => 'N', - chr(197).chr(140) => 'O', - chr(197).chr(141) => 'o', - chr(197).chr(142) => 'O', - chr(197).chr(143) => 'o', - chr(197).chr(144) => 'O', - chr(197).chr(145) => 'o', - chr(197).chr(146) => 'OE', - chr(197).chr(147) => 'oe', - chr(197).chr(148) => 'R', - chr(197).chr(149) => 'r', - chr(197).chr(150) => 'R', - chr(197).chr(151) => 'r', - chr(197).chr(152) => 'R', - chr(197).chr(153) => 'r', - chr(197).chr(154) => 'S', - chr(197).chr(155) => 's', - chr(197).chr(156) => 'S', - chr(197).chr(157) => 's', - chr(197).chr(158) => 'S', - chr(197).chr(159) => 's', - chr(197).chr(160) => 'S', - chr(197).chr(161) => 's', - chr(197).chr(162) => 'T', - chr(197).chr(163) => 't', - chr(197).chr(164) => 'T', - chr(197).chr(165) => 't', - chr(197).chr(166) => 'T', - chr(197).chr(167) => 't', - chr(197).chr(168) => 'U', - chr(197).chr(169) => 'u', - chr(197).chr(170) => 'U', - chr(197).chr(171) => 'u', - chr(197).chr(172) => 'U', - chr(197).chr(173) => 'u', - chr(197).chr(174) => 'U', - chr(197).chr(175) => 'u', - chr(197).chr(176) => 'U', - chr(197).chr(177) => 'u', - chr(197).chr(178) => 'U', - chr(197).chr(179) => 'u', - chr(197).chr(180) => 'W', - chr(197).chr(181) => 'w', - chr(197).chr(182) => 'Y', - chr(197).chr(183) => 'y', - chr(197).chr(184) => 'Y', - chr(197).chr(185) => 'Z', - chr(197).chr(186) => 'z', - chr(197).chr(187) => 'Z', - chr(197).chr(188) => 'z', - chr(197).chr(189) => 'Z', - chr(197).chr(190) => 'z', - chr(197).chr(191) => 's', - // Euro Sign - chr(226).chr(130).chr(172) => 'E', - // GBP (Pound) Sign - chr(194).chr(163) => '', - 'Ä' => 'Ae', - 'ä' => 'ae', - 'Ü' => 'Ue', - 'ü' => 'ue', - 'Ö' => 'Oe', - 'ö' => 'oe', - 'ß' => 'ss', - // Norwegian characters - 'Å' => 'Aa', - 'Æ' => 'Ae', - 'Ø' => 'O', - 'æ' => 'a', - 'ø' => 'o', - 'å' => 'aa', - ); - - $string = strtr($string, $chars); - } else { - $chars = array(); - // Assume ISO-8859-1 if not UTF-8 - $chars['in'] = chr(128).chr(131).chr(138).chr(142).chr(154).chr(158) - .chr(159).chr(162).chr(165).chr(181).chr(192).chr(193).chr(194) - .chr(195).chr(196).chr(197).chr(199).chr(200).chr(201).chr(202) - .chr(203).chr(204).chr(205).chr(206).chr(207).chr(209).chr(210) - .chr(211).chr(212).chr(213).chr(214).chr(216).chr(217).chr(218) - .chr(219).chr(220).chr(221).chr(224).chr(225).chr(226).chr(227) - .chr(228).chr(229).chr(231).chr(232).chr(233).chr(234).chr(235) - .chr(236).chr(237).chr(238).chr(239).chr(241).chr(242).chr(243) - .chr(244).chr(245).chr(246).chr(248).chr(249).chr(250).chr(251) - .chr(252).chr(253).chr(255); - - $chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'; - - $string = strtr($string, $chars['in'], $chars['out']); - - $doubleChars = array(); - $doubleChars['in'] = array( - chr(140), - chr(156), - chr(198), - chr(208), - chr(222), - chr(223), - chr(230), - chr(240), - chr(254), - ); - $doubleChars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); - $string = str_replace($doubleChars['in'], $doubleChars['out'], $string); - } - - return $string; - } - - /** - * Transliterates an UTF-8 string to ASCII. - * - * US-ASCII transliterations of Unicode text - * Ported Sean M. Burke's Text::Unidecode Perl module (He did all the hard work!) - * Warning: you should only pass this well formed UTF-8! - * Be aware it works by making a copy of the input string which it appends transliterated - * characters to - it uses a PHP output buffer to do this - it means, memory use will increase, - * requiring up to the same amount again as the input string. - * - * @see http://search.cpan.org/~sburke/Text-Unidecode-0.04/lib/Text/Unidecode.pm - * - * @author - * - * @param string $str UTF-8 string to convert - * @param string $unknown Character use if character unknown (default to ?) - * - * @return string US-ASCII string - */ - public static function utf8ToAscii($str, $unknown = '?') - { - static $UTF8_TO_ASCII; - - if (strlen($str) == 0) { - return ''; - } - - preg_match_all('/.{1}|[^\x00]{1,1}$/us', $str, $ar); - $chars = $ar[0]; - - foreach ($chars as $i => $c) { - if (ord($c[0]) >= 0 && ord($c[0]) <= 127) { - continue; - } // ASCII - next please - if (ord($c[0]) >= 192 && ord($c[0]) <= 223) { - $ord = (ord($c[0]) - 192) * 64 + (ord($c[1]) - 128); - } - if (ord($c[0]) >= 224 && ord($c[0]) <= 239) { - $ord = (ord($c[0]) - 224) * 4096 + (ord($c[1]) - 128) * 64 + (ord($c[2]) - 128); - } - if (ord($c[0]) >= 240 && ord($c[0]) <= 247) { - $ord = (ord($c[0]) - 240) * 262144 + (ord($c[1]) - 128) * 4096 + (ord($c[2]) - 128) * 64 + (ord($c[3]) - 128); - } - if (ord($c[0]) >= 248 && ord($c[0]) <= 251) { - $ord = (ord($c[0]) - 248) * 16777216 + (ord($c[1]) - 128) * 262144 + (ord($c[2]) - 128) * 4096 + (ord($c[3]) - 128) * 64 + (ord($c[4]) - 128); - } - if (ord($c[0]) >= 252 && ord($c[0]) <= 253) { - $ord = (ord($c[0]) - 252) * 1073741824 + (ord($c[1]) - 128) * 16777216 + (ord($c[2]) - 128) * 262144 + (ord($c[3]) - 128) * 4096 + (ord($c[4]) - 128) * 64 + (ord($c[5]) - 128); - } - if (ord($c[0]) >= 254 && ord($c[0]) <= 255) { - $chars[$i] = $unknown; - continue; - } //error - - $bank = $ord >> 8; - - if (!array_key_exists($bank, (array) $UTF8_TO_ASCII)) { - $bankfile = __DIR__.'/data/'.sprintf('x%02x', $bank).'.php'; - if (file_exists($bankfile)) { - include $bankfile; - } else { - $UTF8_TO_ASCII[$bank] = array(); - } - } - - $newchar = $ord & 255; - if (array_key_exists($newchar, $UTF8_TO_ASCII[$bank])) { - $chars[$i] = $UTF8_TO_ASCII[$bank][$newchar]; - } else { - $chars[$i] = $unknown; - } - } - - return implode('', $chars); - } - - /** - * Generates a slug of the text. - * - * Does not transliterate correctly eastern languages. - * - * @see Transliterator::unaccent for the transliteration logic - * - * @param string $text - * @param string $separator - * - * @return string - */ - public static function urlize($text, $separator = '-') - { - $text = self::unaccent($text); - - return self::postProcessText($text, $separator); - } - - /** - * Generates a slug of the text after transliterating the UTF-8 string to ASCII. - * - * Uses transliteration tables to convert any kind of utf8 character. - * - * @param string $text - * @param string $separator - * - * @return string $text - */ - public static function transliterate($text, $separator = '-') - { - if (preg_match('/[\x80-\xff]/', $text) && self::validUtf8($text)) { - $text = self::utf8ToAscii($text); - } - - return self::postProcessText($text, $separator); - } - - /** - * Tests a string as to whether it's valid UTF-8 and supported by the - * Unicode standard. - * - * Note: this function has been modified to simple return true or false - * - * @author - * - * @param string $str UTF-8 encoded string - * - * @return bool - * - * @see http://hsivonen.iki.fi/php-utf8/ - */ - public static function validUtf8($str) - { - $mState = 0; // cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mUcs4 = 0; // cached Unicode character - $mBytes = 1; // cached expected number of octets in the current sequence - - $len = strlen($str); - for ($i = 0; $i < $len; ++$i) { - $in = ord($str[$i]); - if ($mState == 0) { - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) { - // US-ASCII, pass straight through. - $mBytes = 1; - } elseif (0xC0 == (0xE0 & ($in))) { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - } elseif (0xE0 == (0xF0 & ($in))) { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - } elseif (0xF0 == (0xF8 & ($in))) { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - } elseif (0xF8 == (0xFC & ($in))) { - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - * Rather than trying to resynchronize, we will carry on until the end - * of the sequence and let the later error handling code catch it. - */ - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x03) << 24; - $mState = 4; - $mBytes = 5; - } elseif (0xFC == (0xFE & ($in))) { - // First octet of 6 octet sequence, see comments for 5 octet sequence. - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 1) << 30; - $mState = 5; - $mBytes = 6; - } else { - /* Current octet is neither in the US-ASCII range nor a legal first - * octet of a multi-octet sequence. - */ - return false; - } - } else { - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) { - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - /* - * End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - */ - if (0 == --$mState) { - /* - * Check for illegal sequences and codepoints. - */ - // From Unicode 3.1, non-shortest form is illegal - if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || - ((3 == $mBytes) && ($mUcs4 < 0x0800)) || - ((4 == $mBytes) && ($mUcs4 < 0x10000)) || - (4 < $mBytes) || - // From Unicode 3.2, surrogate characters are illegal - (($mUcs4 & 0xFFFFF800) == 0xD800) || - // Codepoints outside the Unicode range are illegal - ($mUcs4 > 0x10FFFF) - ) { - return false; - } - //initialize UTF8 cache - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - } else { - /* - *((0xC0 & (*in) != 0x80) && (mState != 0)) - * Incomplete multi-octet sequence. - */ - return false; - } - } - } - - return true; - } - - /** - * Cleans up the text and adds separator. - * - * @param string $text - * @param string $separator - * - * @return string - */ - private static function postProcessText($text, $separator) - { - if (function_exists('mb_strtolower')) { - $text = mb_strtolower($text); - } else { - $text = strtolower($text); - } - - // Remove apostrophes which are not used as quotes around a string - $text = preg_replace('/(\\w)\'(\\w)/', '${1}${2}', $text); - - // Replace all none word characters with a space - $text = preg_replace('/\W/', ' ', $text); - - // More stripping. Replace spaces with dashes - $text = strtolower(preg_replace('/[^A-Za-z0-9\/]+/', $separator, - preg_replace('/([a-z\d])([A-Z])/', '\1_\2', - preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1_\2', - preg_replace('/::/', '/', $text))))); - - return trim($text, $separator); - } -} diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x00.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x00.php deleted file mode 100644 index 9177c74..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x00.php +++ /dev/null @@ -1,19 +0,0 @@ -', '?', -'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', -'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', -'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', -'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', "\x7f", -'EUR', '', ',', 'f', ',,', '...', '+', '++', '^', '%0', 'S', '<', 'OE', '', 'Z', '', -'', '\'', '\'', '"', '"', '*', '-', '--', '~', 'tm', 's', '>', 'oe', '', 'z', 'Y', -' ', '!', 'C/', 'PS', '$?', 'Y=', '|', 'SS', '"', '(c)', 'a', '<<', '!', '', '(r)', '-', -'deg', '+-', '2', '3', '\'', 'u', 'P', '*', ',', '1', 'o', '>>', '1/4', '1/2', '3/4', '?', -'A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', -'D', 'N', 'O', 'O', 'O', 'O', 'O', 'x', 'O', 'U', 'U', 'U', 'U', 'Y', 'Th', 'ss', -'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', -'d', 'n', 'o', 'o', 'o', 'o', 'o', '/', 'o', 'u', 'u', 'u', 'u', 'y', 'th', 'y', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x01.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x01.php deleted file mode 100644 index d746817..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x01.php +++ /dev/null @@ -1,19 +0,0 @@ -', '^', 'V', '^', 'V', '\'', '-', '/', '\\', ',', '_', '\\', '/', -':', '.', '`', '\'', '^', 'V', '+', '-', 'V', '.', '@', ',', '~', '"', 'R', 'X', -'G', 'l', 's', 'x', '?', '5', '4', '3', '2', '1', '/', '\\\\', 'V', '=', '"', 'V', -'^', '<', '>', 'o', '`', '``', '//', '~', ':', '[-', '-]', '[_', '_]', '_', '_', '<', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x03.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x03.php deleted file mode 100644 index ed8572c..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x03.php +++ /dev/null @@ -1,19 +0,0 @@ -', '[?]', '[?]', '[?]', -'f', 'v', 'u', 'yr', 'y', 'w', 'th', 'th', 'a', 'o', 'ac', 'ae', 'o', 'o', 'o', 'oe', -'on', 'r', 'k', 'c', 'k', 'g', 'ng', 'g', 'g', 'w', 'h', 'h', 'h', 'h', 'n', 'n', -'n', 'i', 'e', 'j', 'g', 'ae', 'a', 'eo', 'p', 'z', 's', 's', 's', 'c', 'z', 't', -'t', 'd', 'b', 'b', 'p', 'p', 'e', 'm', 'm', 'm', 'l', 'l', 'ng', 'ng', 'd', 'o', -'ear', 'ior', 'qu', 'qu', 'qu', 's', 'yr', 'yr', 'yr', 'q', 'x', '.', ':', '+', '17', '18', -'19', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x17.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x17.php deleted file mode 100644 index 857b54d..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x17.php +++ /dev/null @@ -1,19 +0,0 @@ -', '.', '..', '...', '.', "\n", "\n\n", '', '', '', '', '', ' ', -'%0', '%00', '\'', '\'\'', '\'\'\'', '`', '``', '```', '^', '<', '>', '*', '!!', '!?', '-', '_', -'-', '^', '***', '--', '/', '-[', ']-', '[?]', '?!', '!?', '7', 'PP', '(]', '[)', '[?]', '[?]', -'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '', '', '', '', '', '', -'0', '', '', '', '4', '5', '6', '7', '8', '9', '+', '-', '=', '(', ')', 'n', -'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '-', '=', '(', ')', '[?]', -'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -'ECU', 'CL', 'Cr', 'FF', 'L', 'mil', 'N', 'Pts', 'Rs', 'W', 'NS', 'D', 'EUR', 'K', 'T', 'Dr', -'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x21.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x21.php deleted file mode 100644 index 045762b..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x21.php +++ /dev/null @@ -1,19 +0,0 @@ -', '>', '>', '>', '>', '>', 'V', 'V', 'V', 'V', -'<', '<', '<', '<', '<', '<', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', -'*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*', -'*', '*', '*', '*', '*', '*', '*', '#', '#', '#', '#', '#', '^', '^', '^', 'O', -'#', '#', '#', '#', 'O', 'O', 'O', 'O', '/', '\\\\', '\\\\', '#', '#', '#', '#', '/', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x26.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x26.php deleted file mode 100644 index 8fde2e1..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x26.php +++ /dev/null @@ -1,19 +0,0 @@ -', 'n', 't', 'q', -',', '*', '5', '<', '-', 'u', '8', 'v', '.', '%', '[', '$', '+', 'x', '!', '&', -';', ':', '4', '\\', '0', 'z', '7', '(', '_', '?', 'w', ']', '#', 'y', ')', '=', -'[d7]', '[d17]', '[d27]', '[d127]', '[d37]', '[d137]', '[d237]', '[d1237]', '[d47]', '[d147]', '[d247]', '[d1247]', '[d347]', '[d1347]', '[d2347]', '[d12347]', -'[d57]', '[d157]', '[d257]', '[d1257]', '[d357]', '[d1357]', '[d2357]', '[d12357]', '[d457]', '[d1457]', '[d2457]', '[d12457]', '[d3457]', '[d13457]', '[d23457]', '[d123457]', -'[d67]', '[d167]', '[d267]', '[d1267]', '[d367]', '[d1367]', '[d2367]', '[d12367]', '[d467]', '[d1467]', '[d2467]', '[d12467]', '[d3467]', '[d13467]', '[d23467]', '[d123467]', -'[d567]', '[d1567]', '[d2567]', '[d12567]', '[d3567]', '[d13567]', '[d23567]', '[d123567]', '[d4567]', '[d14567]', '[d24567]', '[d124567]', '[d34567]', '[d134567]', '[d234567]', '[d1234567]', -'[d8]', '[d18]', '[d28]', '[d128]', '[d38]', '[d138]', '[d238]', '[d1238]', '[d48]', '[d148]', '[d248]', '[d1248]', '[d348]', '[d1348]', '[d2348]', '[d12348]', -'[d58]', '[d158]', '[d258]', '[d1258]', '[d358]', '[d1358]', '[d2358]', '[d12358]', '[d458]', '[d1458]', '[d2458]', '[d12458]', '[d3458]', '[d13458]', '[d23458]', '[d123458]', -'[d68]', '[d168]', '[d268]', '[d1268]', '[d368]', '[d1368]', '[d2368]', '[d12368]', '[d468]', '[d1468]', '[d2468]', '[d12468]', '[d3468]', '[d13468]', '[d23468]', '[d123468]', -'[d568]', '[d1568]', '[d2568]', '[d12568]', '[d3568]', '[d13568]', '[d23568]', '[d123568]', '[d4568]', '[d14568]', '[d24568]', '[d124568]', '[d34568]', '[d134568]', '[d234568]', '[d1234568]', -'[d78]', '[d178]', '[d278]', '[d1278]', '[d378]', '[d1378]', '[d2378]', '[d12378]', '[d478]', '[d1478]', '[d2478]', '[d12478]', '[d3478]', '[d13478]', '[d23478]', '[d123478]', -'[d578]', '[d1578]', '[d2578]', '[d12578]', '[d3578]', '[d13578]', '[d23578]', '[d123578]', '[d4578]', '[d14578]', '[d24578]', '[d124578]', '[d34578]', '[d134578]', '[d234578]', '[d1234578]', -'[d678]', '[d1678]', '[d2678]', '[d12678]', '[d3678]', '[d13678]', '[d23678]', '[d123678]', '[d4678]', '[d14678]', '[d24678]', '[d124678]', '[d34678]', '[d134678]', '[d234678]', '[d1234678]', -'[d5678]', '[d15678]', '[d25678]', '[d125678]', '[d35678]', '[d135678]', '[d235678]', '[d1235678]', '[d45678]', '[d145678]', '[d245678]', '[d1245678]', '[d345678]', '[d1345678]', '[d2345678]', '[d12345678]', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x30.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x30.php deleted file mode 100644 index f8c13c4..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x30.php +++ /dev/null @@ -1,19 +0,0 @@ - ', '<<', '>> ', '[', '] ', '{', '} ', -'[(', ')] ', '@', 'X ', '[', '] ', '[[', ']] ', '((', ')) ', '[[', ']] ', '~ ', '``', '\'\'', ',,', -'@', '1', '2', '3', '4', '5', '6', '7', '8', '9', '', '', '', '', '', '', -'~', '+', '+', '+', '+', '', '@', ' // ', '+10+', '+20+', '+30+', '[?]', '[?]', '[?]', '', '', -'[?]', 'a', 'a', 'i', 'i', 'u', 'u', 'e', 'e', 'o', 'o', 'ka', 'ga', 'ki', 'gi', 'ku', -'gu', 'ke', 'ge', 'ko', 'go', 'sa', 'za', 'si', 'zi', 'su', 'zu', 'se', 'ze', 'so', 'zo', 'ta', -'da', 'ti', 'di', 'tu', 'tu', 'du', 'te', 'de', 'to', 'do', 'na', 'ni', 'nu', 'ne', 'no', 'ha', -'ba', 'pa', 'hi', 'bi', 'pi', 'hu', 'bu', 'pu', 'he', 'be', 'pe', 'ho', 'bo', 'po', 'ma', 'mi', -'mu', 'me', 'mo', 'ya', 'ya', 'yu', 'yu', 'yo', 'yo', 'ra', 'ri', 'ru', 're', 'ro', 'wa', 'wa', -'wi', 'we', 'wo', 'n', 'vu', '[?]', '[?]', '[?]', '[?]', '', '', '', '', '"', '"', '[?]', -'[?]', 'a', 'a', 'i', 'i', 'u', 'u', 'e', 'e', 'o', 'o', 'ka', 'ga', 'ki', 'gi', 'ku', -'gu', 'ke', 'ge', 'ko', 'go', 'sa', 'za', 'si', 'zi', 'su', 'zu', 'se', 'ze', 'so', 'zo', 'ta', -'da', 'ti', 'di', 'tu', 'tu', 'du', 'te', 'de', 'to', 'do', 'na', 'ni', 'nu', 'ne', 'no', 'ha', -'ba', 'pa', 'hi', 'bi', 'pi', 'hu', 'bu', 'pu', 'he', 'be', 'pe', 'ho', 'bo', 'po', 'ma', 'mi', -'mu', 'me', 'mo', 'ya', 'ya', 'yu', 'yu', 'yo', 'yo', 'ra', 'ri', 'ru', 're', 'ro', 'wa', 'wa', -'wi', 'we', 'wo', 'n', 'vu', 'ka', 'ke', 'va', 'vi', 've', 'vo', '', '', '"', '"', 'koto', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x31.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x31.php deleted file mode 100644 index 81e1cf0..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x31.php +++ /dev/null @@ -1,19 +0,0 @@ ->', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -'(g)', '(n)', '(d)', '(r)', '(m)', '(b)', '(s)', '()', '(j)', '(c)', '(k)', '(t)', '(p)', '(h)', '(ga)', '(na)', -'(da)', '(ra)', '(ma)', '(ba)', '(sa)', '(a)', '(ja)', '(ca)', '(ka)', '(ta)', '(pa)', '(ha)', '[?]', '[?]', '[?]', 'KIS ', -'(1) ', '(2) ', '(3) ', '(4) ', '(5) ', '(6) ', '(7) ', '(8) ', '(9) ', '(10) ', '(Yue) ', '(Huo) ', '(Shui) ', '(Mu) ', '(Jin) ', '(Tu) ', -'(Ri) ', '(Zhu) ', '(You) ', '(She) ', '(Ming) ', '(Te) ', '(Cai) ', '(Zhu) ', '(Lao) ', '(Mi) ', '(Nan) ', '(Nu) ', '(Shi) ', '(You) ', '(Yin) ', '(Zhu) ', -'(Xiang) ', '(Xiu) ', '(Xie) ', '(Zheng) ', '(Shang) ', '(Zhong) ', '(Xia) ', '(Zuo) ', '(You) ', '(Yi) ', '(Zong) ', '(Xue) ', '(Jian) ', '(Qi) ', '(Zi) ', '(Xie) ', -'(Ye) ', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', -'1M', '2M', '3M', '4M', '5M', '6M', '7M', '8M', '9M', '10M', '11M', '12M', '[?]', '[?]', '[?]', '[?]', -'a', 'i', 'u', 'u', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'si', 'su', 'se', 'so', 'ta', -'ti', 'tu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'hu', 'he', 'ho', 'ma', 'mi', -'mu', 'me', 'mo', 'ya', 'yu', 'yo', 'ra', 'ri', 'ru', 're', 'ro', 'wa', 'wi', 'we', 'wo', '[?]', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x33.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x33.php deleted file mode 100644 index acb1ac4..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/x33.php +++ /dev/null @@ -1,19 +0,0 @@ -> ', '<', -'> ', '[', '] ', '{', '}', '[?]', '[?]', '[?]', '[?]', '', '', '', '', '', '', '', -',', ',', '.', '', ';', ':', '?', '!', '-', '(', ')', '{', '}', '{', '}', '#', -'&', '*', '+', '-', '<', '>', '=', '', '\\', '$', '%', '@', '[?]', '[?]', '[?]', '[?]', -'', '', '', '[?]', '', '[?]', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', -'', '', '', '', '', '', '', '', '', '', '', '', '', '[?]', '[?]', '', -); diff --git a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xff.php b/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xff.php deleted file mode 100644 index b415a06..0000000 --- a/tests/integration/vendor/behat/transliterator/src/Behat/Transliterator/data/xff.php +++ /dev/null @@ -1,19 +0,0 @@ -', '?', -'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', -'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', -'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', -'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '[?]', -'[?]', '.', '[', ']', ',', '*', 'wo', 'a', 'i', 'u', 'e', 'o', 'ya', 'yu', 'yo', 'tu', -'+', 'a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'si', 'su', 'se', 'so', -'ta', 'ti', 'tu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'hu', 'he', 'ho', 'ma', -'mi', 'mu', 'me', 'mo', 'ya', 'yu', 'yo', 'ra', 'ri', 'ru', 're', 'ro', 'wa', 'n', ':', ';', -'', 'g', 'gg', 'gs', 'n', 'nj', 'nh', 'd', 'dd', 'r', 'lg', 'lm', 'lb', 'ls', 'lt', 'lp', -'rh', 'm', 'b', 'bb', 'bs', 's', 'ss', '', 'j', 'jj', 'c', 'k', 't', 'p', 'h', '[?]', -'[?]', '[?]', 'a', 'ae', 'ya', 'yae', 'eo', 'e', '[?]', '[?]', 'yeo', 'ye', 'o', 'wa', 'wae', 'oe', -'[?]', '[?]', 'yo', 'u', 'weo', 'we', 'wi', 'yu', '[?]', '[?]', 'eu', 'yi', 'i', '[?]', '[?]', '[?]', -'/C', 'PS', '!', '-', '|', 'Y=', 'W=', '[?]', '|', '-', '|', '-', '|', '#', 'O', '[?]', -'[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '[?]', '{', '|', '}', '', '', '', '', -); diff --git a/tests/integration/vendor/bin/behat b/tests/integration/vendor/bin/behat deleted file mode 100755 index c4503de..0000000 --- a/tests/integration/vendor/bin/behat +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env php -realpath = realpath($opened_path) ?: $opened_path; - $opened_path = $this->realpath; - $this->handle = fopen($this->realpath, $mode); - $this->position = 0; - - return (bool) $this->handle; - } - - public function stream_read($count) - { - $data = fread($this->handle, $count); - - if ($this->position === 0) { - $data = preg_replace('{^#!.*\r?\n}', '', $data); - } - - $this->position += strlen($data); - - return $data; - } - - public function stream_cast($castAs) - { - return $this->handle; - } - - public function stream_close() - { - fclose($this->handle); - } - - public function stream_lock($operation) - { - return $operation ? flock($this->handle, $operation) : true; - } - - public function stream_seek($offset, $whence) - { - if (0 === fseek($this->handle, $offset, $whence)) { - $this->position = ftell($this->handle); - return true; - } - - return false; - } - - public function stream_tell() - { - return $this->position; - } - - public function stream_eof() - { - return feof($this->handle); - } - - public function stream_stat() - { - return array(); - } - - public function stream_set_option($option, $arg1, $arg2) - { - return true; - } - - public function url_stat($path, $flags) - { - $path = substr($path, 17); - if (file_exists($path)) { - return stat($path); - } - - return false; - } - } - } - - if ( - (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true)) - || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) - ) { - return include("phpvfscomposer://" . __DIR__ . '/..'.'/behat/behat/bin/behat'); - } -} - -return include __DIR__ . '/..'.'/behat/behat/bin/behat'; diff --git a/tests/integration/vendor/composer/ClassLoader.php b/tests/integration/vendor/composer/ClassLoader.php deleted file mode 100644 index 7824d8f..0000000 --- a/tests/integration/vendor/composer/ClassLoader.php +++ /dev/null @@ -1,579 +0,0 @@ - - * Jordi Boggiano - * - * 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 - * @author Jordi Boggiano - * @see https://www.php-fig.org/psr/psr-0/ - * @see https://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - /** @var \Closure(string):void */ - private static $includeFile; - - /** @var string|null */ - private $vendorDir; - - // PSR-4 - /** - * @var array> - */ - private $prefixLengthsPsr4 = array(); - /** - * @var array> - */ - private $prefixDirsPsr4 = array(); - /** - * @var list - */ - private $fallbackDirsPsr4 = array(); - - // PSR-0 - /** - * List of PSR-0 prefixes - * - * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) - * - * @var array>> - */ - private $prefixesPsr0 = array(); - /** - * @var list - */ - private $fallbackDirsPsr0 = array(); - - /** @var bool */ - private $useIncludePath = false; - - /** - * @var array - */ - private $classMap = array(); - - /** @var bool */ - private $classMapAuthoritative = false; - - /** - * @var array - */ - private $missingClasses = array(); - - /** @var string|null */ - private $apcuPrefix; - - /** - * @var array - */ - private static $registeredLoaders = array(); - - /** - * @param string|null $vendorDir - */ - public function __construct($vendorDir = null) - { - $this->vendorDir = $vendorDir; - self::initializeIncludeClosure(); - } - - /** - * @return array> - */ - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); - } - - return array(); - } - - /** - * @return array> - */ - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - /** - * @return list - */ - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - /** - * @return list - */ - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - /** - * @return array Array of classname => path - */ - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - * - * @return void - */ - 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 list|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - * - * @return void - */ - public function add($prefix, $paths, $prepend = false) - { - $paths = (array) $paths; - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - $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 list|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - $paths = (array) $paths; - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - $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] = $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - $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 list|string $paths The PSR-0 base directories - * - * @return void - */ - 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 list|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - * - * @return void - */ - 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 - * - * @return void - */ - 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 - * - * @return void - */ - 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 - * - * @return void - */ - 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 - * - * @return void - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - - if (null === $this->vendorDir) { - return; - } - - if ($prepend) { - self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; - } else { - unset(self::$registeredLoaders[$this->vendorDir]); - self::$registeredLoaders[$this->vendorDir] = $this; - } - } - - /** - * Unregisters this instance as an autoloader. - * - * @return void - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - - if (null !== $this->vendorDir) { - unset(self::$registeredLoaders[$this->vendorDir]); - } - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return true|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - $includeFile = self::$includeFile; - $includeFile($file); - - return true; - } - - return null; - } - - /** - * 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; - } - - /** - * Returns the currently registered loaders keyed by their corresponding vendor directories. - * - * @return array - */ - public static function getRegisteredLoaders() - { - return self::$registeredLoaders; - } - - /** - * @param string $class - * @param string $ext - * @return string|false - */ - 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; - } - - /** - * @return void - */ - private static function initializeIncludeClosure() - { - if (self::$includeFile !== null) { - return; - } - - /** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - */ - self::$includeFile = \Closure::bind(static function($file) { - include $file; - }, null, null); - } -} diff --git a/tests/integration/vendor/composer/LICENSE b/tests/integration/vendor/composer/LICENSE deleted file mode 100644 index f27399a..0000000 --- a/tests/integration/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -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. - diff --git a/tests/integration/vendor/composer/autoload_classmap.php b/tests/integration/vendor/composer/autoload_classmap.php deleted file mode 100644 index 9bb846c..0000000 --- a/tests/integration/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,11 +0,0 @@ - $vendorDir . '/composer/InstalledVersions.php', - 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', -); diff --git a/tests/integration/vendor/composer/autoload_files.php b/tests/integration/vendor/composer/autoload_files.php deleted file mode 100644 index 44a04c8..0000000 --- a/tests/integration/vendor/composer/autoload_files.php +++ /dev/null @@ -1,22 +0,0 @@ - $vendorDir . '/symfony/deprecation-contracts/function.php', - '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', - 'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php', - '8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php', - '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', - '25072dd6e2470089de65ae7bf11d3109' => $vendorDir . '/symfony/polyfill-php72/bootstrap.php', - 'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php', - 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', - 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', - 'f598d06aa772fa33d905e87be6398fb1' => $vendorDir . '/symfony/polyfill-intl-idn/bootstrap.php', - 'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php', - '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', -); diff --git a/tests/integration/vendor/composer/autoload_namespaces.php b/tests/integration/vendor/composer/autoload_namespaces.php deleted file mode 100644 index aa95df0..0000000 --- a/tests/integration/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,10 +0,0 @@ - array($vendorDir . '/behat/gherkin/src'), -); diff --git a/tests/integration/vendor/composer/autoload_psr4.php b/tests/integration/vendor/composer/autoload_psr4.php deleted file mode 100644 index cae09c1..0000000 --- a/tests/integration/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,38 +0,0 @@ - array($vendorDir . '/symfony/polyfill-php72'), - 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), - 'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'), - 'Symfony\\Polyfill\\Intl\\Idn\\' => array($vendorDir . '/symfony/polyfill-intl-idn'), - 'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'), - 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), - 'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'), - 'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'), - 'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'), - 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), - 'Symfony\\Component\\VarExporter\\' => array($vendorDir . '/symfony/var-exporter'), - 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), - 'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'), - 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'), - 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), - 'Symfony\\Component\\DependencyInjection\\' => array($vendorDir . '/symfony/dependency-injection'), - 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), - 'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'), - 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), - 'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'), - 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), - 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), - 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), - 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), - 'Behat\\Transliterator\\' => array($vendorDir . '/behat/transliterator/src/Behat/Transliterator'), - 'Behat\\Testwork\\' => array($vendorDir . '/behat/behat/src/Behat/Testwork'), - 'Behat\\Step\\' => array($vendorDir . '/behat/behat/src/Behat/Step'), - 'Behat\\Hook\\' => array($vendorDir . '/behat/behat/src/Behat/Hook'), - 'Behat\\Behat\\' => array($vendorDir . '/behat/behat/src/Behat/Behat'), -); diff --git a/tests/integration/vendor/composer/autoload_real.php b/tests/integration/vendor/composer/autoload_real.php deleted file mode 100644 index cf96ab7..0000000 --- a/tests/integration/vendor/composer/autoload_real.php +++ /dev/null @@ -1,50 +0,0 @@ -register(true); - - $filesToLoad = \Composer\Autoload\ComposerStaticInit4f8b07a35c70428e29515b612a1c657a::$files; - $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - - require $file; - } - }, null, null); - foreach ($filesToLoad as $fileIdentifier => $file) { - $requireFile($fileIdentifier, $file); - } - - return $loader; - } -} diff --git a/tests/integration/vendor/composer/autoload_static.php b/tests/integration/vendor/composer/autoload_static.php deleted file mode 100644 index e8c8a2b..0000000 --- a/tests/integration/vendor/composer/autoload_static.php +++ /dev/null @@ -1,213 +0,0 @@ - __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', - '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', - '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - 'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php', - '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php', - '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', - '25072dd6e2470089de65ae7bf11d3109' => __DIR__ . '/..' . '/symfony/polyfill-php72/bootstrap.php', - 'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php', - 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', - 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', - 'f598d06aa772fa33d905e87be6398fb1' => __DIR__ . '/..' . '/symfony/polyfill-intl-idn/bootstrap.php', - 'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php', - '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', - ); - - public static $prefixLengthsPsr4 = array ( - 'S' => - array ( - 'Symfony\\Polyfill\\Php72\\' => 23, - 'Symfony\\Polyfill\\Mbstring\\' => 26, - 'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33, - 'Symfony\\Polyfill\\Intl\\Idn\\' => 26, - 'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31, - 'Symfony\\Polyfill\\Ctype\\' => 23, - 'Symfony\\Contracts\\Translation\\' => 30, - 'Symfony\\Contracts\\Service\\' => 26, - 'Symfony\\Contracts\\EventDispatcher\\' => 34, - 'Symfony\\Component\\Yaml\\' => 23, - 'Symfony\\Component\\VarExporter\\' => 30, - 'Symfony\\Component\\Translation\\' => 30, - 'Symfony\\Component\\String\\' => 25, - 'Symfony\\Component\\Filesystem\\' => 29, - 'Symfony\\Component\\EventDispatcher\\' => 34, - 'Symfony\\Component\\DependencyInjection\\' => 38, - 'Symfony\\Component\\Console\\' => 26, - 'Symfony\\Component\\Config\\' => 25, - ), - 'P' => - array ( - 'Psr\\Http\\Message\\' => 17, - 'Psr\\EventDispatcher\\' => 20, - 'Psr\\Container\\' => 14, - ), - 'G' => - array ( - 'GuzzleHttp\\Psr7\\' => 16, - 'GuzzleHttp\\Promise\\' => 19, - 'GuzzleHttp\\' => 11, - ), - 'B' => - array ( - 'Behat\\Transliterator\\' => 21, - 'Behat\\Testwork\\' => 15, - 'Behat\\Step\\' => 11, - 'Behat\\Hook\\' => 11, - 'Behat\\Behat\\' => 12, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'Symfony\\Polyfill\\Php72\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-php72', - ), - 'Symfony\\Polyfill\\Mbstring\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', - ), - 'Symfony\\Polyfill\\Intl\\Normalizer\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer', - ), - 'Symfony\\Polyfill\\Intl\\Idn\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-idn', - ), - 'Symfony\\Polyfill\\Intl\\Grapheme\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme', - ), - 'Symfony\\Polyfill\\Ctype\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', - ), - 'Symfony\\Contracts\\Translation\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/translation-contracts', - ), - 'Symfony\\Contracts\\Service\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/service-contracts', - ), - 'Symfony\\Contracts\\EventDispatcher\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts', - ), - 'Symfony\\Component\\Yaml\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/yaml', - ), - 'Symfony\\Component\\VarExporter\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/var-exporter', - ), - 'Symfony\\Component\\Translation\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/translation', - ), - 'Symfony\\Component\\String\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/string', - ), - 'Symfony\\Component\\Filesystem\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/filesystem', - ), - 'Symfony\\Component\\EventDispatcher\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/event-dispatcher', - ), - 'Symfony\\Component\\DependencyInjection\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/dependency-injection', - ), - 'Symfony\\Component\\Console\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/console', - ), - 'Symfony\\Component\\Config\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/config', - ), - 'Psr\\Http\\Message\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/http-message/src', - ), - 'Psr\\EventDispatcher\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/event-dispatcher/src', - ), - 'Psr\\Container\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/container/src', - ), - 'GuzzleHttp\\Psr7\\' => - array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', - ), - 'GuzzleHttp\\Promise\\' => - array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src', - ), - 'GuzzleHttp\\' => - array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', - ), - 'Behat\\Transliterator\\' => - array ( - 0 => __DIR__ . '/..' . '/behat/transliterator/src/Behat/Transliterator', - ), - 'Behat\\Testwork\\' => - array ( - 0 => __DIR__ . '/..' . '/behat/behat/src/Behat/Testwork', - ), - 'Behat\\Step\\' => - array ( - 0 => __DIR__ . '/..' . '/behat/behat/src/Behat/Step', - ), - 'Behat\\Hook\\' => - array ( - 0 => __DIR__ . '/..' . '/behat/behat/src/Behat/Hook', - ), - 'Behat\\Behat\\' => - array ( - 0 => __DIR__ . '/..' . '/behat/behat/src/Behat/Behat', - ), - ); - - public static $prefixesPsr0 = array ( - 'B' => - array ( - 'Behat\\Gherkin' => - array ( - 0 => __DIR__ . '/..' . '/behat/gherkin/src', - ), - ), - ); - - public static $classMap = array ( - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit4f8b07a35c70428e29515b612a1c657a::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit4f8b07a35c70428e29515b612a1c657a::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit4f8b07a35c70428e29515b612a1c657a::$prefixesPsr0; - $loader->classMap = ComposerStaticInit4f8b07a35c70428e29515b612a1c657a::$classMap; - - }, null, ClassLoader::class); - } -} diff --git a/tests/integration/vendor/composer/installed.json b/tests/integration/vendor/composer/installed.json deleted file mode 100644 index 9262a21..0000000 --- a/tests/integration/vendor/composer/installed.json +++ /dev/null @@ -1,2325 +0,0 @@ -{ - "packages": [ - { - "name": "behat/behat", - "version": "v3.13.0", - "version_normalized": "3.13.0.0", - "source": { - "type": "git", - "url": "https://github.com/Behat/Behat.git", - "reference": "9dd7cdb309e464ddeab095cd1a5151c2dccba4ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Behat/zipball/9dd7cdb309e464ddeab095cd1a5151c2dccba4ab", - "reference": "9dd7cdb309e464ddeab095cd1a5151c2dccba4ab", - "shasum": "" - }, - "require": { - "behat/gherkin": "^4.9.0", - "behat/transliterator": "^1.2", - "ext-mbstring": "*", - "php": "^7.2 || ^8.0", - "psr/container": "^1.0 || ^2.0", - "symfony/config": "^4.4 || ^5.0 || ^6.0", - "symfony/console": "^4.4 || ^5.0 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0", - "symfony/event-dispatcher": "^4.4 || ^5.0 || ^6.0", - "symfony/translation": "^4.4 || ^5.0 || ^6.0", - "symfony/yaml": "^4.4 || ^5.0 || ^6.0" - }, - "require-dev": { - "herrera-io/box": "~1.6.1", - "phpspec/prophecy": "^1.15", - "phpunit/phpunit": "^8.5 || ^9.0", - "symfony/process": "^4.4 || ^5.0 || ^6.0", - "vimeo/psalm": "^4.8" - }, - "suggest": { - "ext-dom": "Needed to output test results in JUnit format." - }, - "time": "2023-04-18T15:40:53+00:00", - "bin": [ - "bin/behat" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Behat\\Hook\\": "src/Behat/Hook/", - "Behat\\Step\\": "src/Behat/Step/", - "Behat\\Behat\\": "src/Behat/Behat/", - "Behat\\Testwork\\": "src/Behat/Testwork/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Scenario-oriented BDD framework for PHP", - "homepage": "http://behat.org/", - "keywords": [ - "Agile", - "BDD", - "ScenarioBDD", - "Scrum", - "StoryBDD", - "User story", - "business", - "development", - "documentation", - "examples", - "symfony", - "testing" - ], - "support": { - "issues": "https://github.com/Behat/Behat/issues", - "source": "https://github.com/Behat/Behat/tree/v3.13.0" - }, - "install-path": "../behat/behat" - }, - { - "name": "behat/gherkin", - "version": "v4.9.0", - "version_normalized": "4.9.0.0", - "source": { - "type": "git", - "url": "https://github.com/Behat/Gherkin.git", - "reference": "0bc8d1e30e96183e4f36db9dc79caead300beff4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Gherkin/zipball/0bc8d1e30e96183e4f36db9dc79caead300beff4", - "reference": "0bc8d1e30e96183e4f36db9dc79caead300beff4", - "shasum": "" - }, - "require": { - "php": "~7.2|~8.0" - }, - "require-dev": { - "cucumber/cucumber": "dev-gherkin-22.0.0", - "phpunit/phpunit": "~8|~9", - "symfony/yaml": "~3|~4|~5" - }, - "suggest": { - "symfony/yaml": "If you want to parse features, represented in YAML files" - }, - "time": "2021-10-12T13:05:09+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Behat\\Gherkin": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Gherkin DSL parser for PHP", - "homepage": "http://behat.org/", - "keywords": [ - "BDD", - "Behat", - "Cucumber", - "DSL", - "gherkin", - "parser" - ], - "support": { - "issues": "https://github.com/Behat/Gherkin/issues", - "source": "https://github.com/Behat/Gherkin/tree/v4.9.0" - }, - "install-path": "../behat/gherkin" - }, - { - "name": "behat/transliterator", - "version": "v1.5.0", - "version_normalized": "1.5.0.0", - "source": { - "type": "git", - "url": "https://github.com/Behat/Transliterator.git", - "reference": "baac5873bac3749887d28ab68e2f74db3a4408af" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Transliterator/zipball/baac5873bac3749887d28ab68e2f74db3a4408af", - "reference": "baac5873bac3749887d28ab68e2f74db3a4408af", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "require-dev": { - "chuyskywalker/rolling-curl": "^3.1", - "php-yaoi/php-yaoi": "^1.0", - "phpunit/phpunit": "^8.5.25 || ^9.5.19" - }, - "time": "2022-03-30T09:27:43+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Behat\\Transliterator\\": "src/Behat/Transliterator" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Artistic-1.0" - ], - "description": "String transliterator", - "keywords": [ - "i18n", - "slug", - "transliterator" - ], - "support": { - "issues": "https://github.com/Behat/Transliterator/issues", - "source": "https://github.com/Behat/Transliterator/tree/v1.5.0" - }, - "install-path": "../behat/transliterator" - }, - { - "name": "guzzlehttp/guzzle", - "version": "6.5.8", - "version_normalized": "6.5.8.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/a52f0440530b54fa079ce76e8c5d196a42cad981", - "reference": "a52f0440530b54fa079ce76e8c5d196a42cad981", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.9", - "php": ">=5.5", - "symfony/polyfill-intl-idn": "^1.17" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" - }, - "suggest": { - "psr/log": "Required for using the Log middleware" - }, - "time": "2022-06-20T22:16:07+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "support": { - "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/6.5.8" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", - "type": "tidelift" - } - ], - "install-path": "../guzzlehttp/guzzle" - }, - { - "name": "guzzlehttp/promises", - "version": "1.5.3", - "version_normalized": "1.5.3.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/67ab6e18aaa14d753cc148911d273f6e6cb6721e", - "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" - }, - "time": "2023-05-21T12:31:43+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "support": { - "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.3" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", - "type": "tidelift" - } - ], - "install-path": "../guzzlehttp/promises" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.9.1", - "version_normalized": "1.9.1.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/e4490cabc77465aaee90b20cfc9a770f8c04be6b", - "reference": "e4490cabc77465aaee90b20cfc9a770f8c04be6b", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "time": "2023-04-17T16:00:37+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/functions_include.php" - ], - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "support": { - "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.9.1" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://github.com/Nyholm", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", - "type": "tidelift" - } - ], - "install-path": "../guzzlehttp/psr7" - }, - { - "name": "psr/container", - "version": "2.0.2", - "version_normalized": "2.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "shasum": "" - }, - "require": { - "php": ">=7.4.0" - }, - "time": "2021-11-05T16:47:00+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" - }, - "install-path": "../psr/container" - }, - { - "name": "psr/event-dispatcher", - "version": "1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/event-dispatcher.git", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", - "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "time": "2019-01-08T18:20:26+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\EventDispatcher\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Standard interfaces for event handling.", - "keywords": [ - "events", - "psr", - "psr-14" - ], - "support": { - "issues": "https://github.com/php-fig/event-dispatcher/issues", - "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" - }, - "install-path": "../psr/event-dispatcher" - }, - { - "name": "psr/http-message", - "version": "1.1", - "version_normalized": "1.1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "time": "2023-04-04T09:50:52+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" - }, - "install-path": "../psr/http-message" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "version_normalized": "3.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "time": "2019-03-08T08:55:37+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "support": { - "issues": "https://github.com/ralouphie/getallheaders/issues", - "source": "https://github.com/ralouphie/getallheaders/tree/develop" - }, - "install-path": "../ralouphie/getallheaders" - }, - { - "name": "symfony/config", - "version": "v6.3.2", - "version_normalized": "6.3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "b47ca238b03e7b0d7880ffd1cf06e8d637ca1467" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/b47ca238b03e7b0d7880ffd1cf06e8d637ca1467", - "reference": "b47ca238b03e7b0d7880ffd1cf06e8d637ca1467", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/filesystem": "^5.4|^6.0", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/finder": "<5.4", - "symfony/service-contracts": "<2.5" - }, - "require-dev": { - "symfony/event-dispatcher": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", - "symfony/messenger": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^5.4|^6.0" - }, - "time": "2023-07-19T20:22:16+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/config/tree/v6.3.2" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/config" - }, - { - "name": "symfony/console", - "version": "v6.3.2", - "version_normalized": "6.3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/aa5d64ad3f63f2e48964fc81ee45cb318a723898", - "reference": "aa5d64ad3f63f2e48964fc81ee45cb318a723898", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" - }, - "provide": { - "psr/log-implementation": "1.0|2.0|3.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/event-dispatcher": "^5.4|^6.0", - "symfony/lock": "^5.4|^6.0", - "symfony/process": "^5.4|^6.0", - "symfony/var-dumper": "^5.4|^6.0" - }, - "time": "2023-07-19T20:17:28+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command-line", - "console", - "terminal" - ], - "support": { - "source": "https://github.com/symfony/console/tree/v6.3.2" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/console" - }, - { - "name": "symfony/dependency-injection", - "version": "v6.3.2", - "version_normalized": "6.3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "474cfbc46aba85a1ca11a27db684480d0db64ba7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/474cfbc46aba85a1ca11a27db684480d0db64ba7", - "reference": "474cfbc46aba85a1ca11a27db684480d0db64ba7", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/service-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.2.10" - }, - "conflict": { - "ext-psr": "<1.1|>=2", - "symfony/config": "<6.1", - "symfony/finder": "<5.4", - "symfony/proxy-manager-bridge": "<6.3", - "symfony/yaml": "<5.4" - }, - "provide": { - "psr/container-implementation": "1.1|2.0", - "symfony/service-implementation": "1.1|2.0|3.0" - }, - "require-dev": { - "symfony/config": "^6.1", - "symfony/expression-language": "^5.4|^6.0", - "symfony/yaml": "^5.4|^6.0" - }, - "time": "2023-07-19T20:17:28+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Allows you to standardize and centralize the way objects are constructed in your application", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.3.2" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/dependency-injection" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.3.0", - "version_normalized": "3.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "time": "2023-05-23T14:45:45+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/deprecation-contracts" - }, - { - "name": "symfony/event-dispatcher", - "version": "v6.3.2", - "version_normalized": "6.3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/adb01fe097a4ee930db9258a3cc906b5beb5cf2e", - "reference": "adb01fe097a4ee930db9258a3cc906b5beb5cf2e", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/event-dispatcher-contracts": "^2.5|^3" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/service-contracts": "<2.5" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0|3.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/error-handler": "^5.4|^6.0", - "symfony/expression-language": "^5.4|^6.0", - "symfony/http-foundation": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^5.4|^6.0" - }, - "time": "2023-07-06T06:56:43+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.3.2" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/event-dispatcher" - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v3.3.0", - "version_normalized": "3.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", - "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/event-dispatcher": "^1" - }, - "time": "2023-05-23T14:45:45+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Contracts\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to dispatching event", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/event-dispatcher-contracts" - }, - { - "name": "symfony/filesystem", - "version": "v6.3.1", - "version_normalized": "6.3.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", - "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8" - }, - "time": "2023-06-01T08:30:39+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides basic utilities for the filesystem", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.3.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/filesystem" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-ctype" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-intl-grapheme" - }, - { - "name": "symfony/polyfill-intl-idn", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "639084e360537a19f9ee352433b84ce831f3d2da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da", - "reference": "639084e360537a19f9ee352433b84ce831f3d2da", - "shasum": "" - }, - "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Trevor Rowbotham", - "email": "trevor.rowbotham@pm.me" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "idn", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-intl-idn" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-intl-normalizer" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-mbstring" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.27.0", - "version_normalized": "1.27.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", - "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "time": "2022-11-03T14:55:06+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/polyfill-php72" - }, - { - "name": "symfony/service-contracts", - "version": "v3.3.0", - "version_normalized": "3.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", - "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/container": "^2.0" - }, - "conflict": { - "ext-psr": "<1.1|>=2" - }, - "time": "2023-05-23T14:45:45+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/service-contracts" - }, - { - "name": "symfony/string", - "version": "v6.3.2", - "version_normalized": "6.3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "53d1a83225002635bca3482fcbf963001313fb68" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", - "reference": "53d1a83225002635bca3482fcbf963001313fb68", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.0", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/translation-contracts": "<2.5" - }, - "require-dev": { - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0" - }, - "time": "2023-07-05T08:41:27+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "Resources/functions.php" - ], - "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], - "support": { - "source": "https://github.com/symfony/string/tree/v6.3.2" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/string" - }, - { - "name": "symfony/translation", - "version": "v6.3.3", - "version_normalized": "6.3.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", - "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.5|^3.0" - }, - "conflict": { - "symfony/config": "<5.4", - "symfony/console": "<5.4", - "symfony/dependency-injection": "<5.4", - "symfony/http-client-contracts": "<2.5", - "symfony/http-kernel": "<5.4", - "symfony/service-contracts": "<2.5", - "symfony/twig-bundle": "<5.4", - "symfony/yaml": "<5.4" - }, - "provide": { - "symfony/translation-implementation": "2.3|3.0" - }, - "require-dev": { - "nikic/php-parser": "^4.13", - "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^2.5|^3.0", - "symfony/http-kernel": "^5.4|^6.0", - "symfony/intl": "^5.4|^6.0", - "symfony/polyfill-intl-icu": "^1.21", - "symfony/routing": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^5.4|^6.0" - }, - "time": "2023-07-31T07:08:24+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "Resources/functions.php" - ], - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools to internationalize your application", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/translation/tree/v6.3.3" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/translation" - }, - { - "name": "symfony/translation-contracts", - "version": "v3.3.0", - "version_normalized": "3.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation-contracts.git", - "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/02c24deb352fb0d79db5486c0c79905a85e37e86", - "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "time": "2023-05-30T17:17:10+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Test/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to translation", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.3.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/translation-contracts" - }, - { - "name": "symfony/var-exporter", - "version": "v6.3.2", - "version_normalized": "6.3.2.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-exporter.git", - "reference": "3400949782c0cb5b3e73aa64cfd71dde000beccc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/3400949782c0cb5b3e73aa64cfd71dde000beccc", - "reference": "3400949782c0cb5b3e73aa64cfd71dde000beccc", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "require-dev": { - "symfony/var-dumper": "^5.4|^6.0" - }, - "time": "2023-07-26T17:39:03+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\VarExporter\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Allows exporting any serializable PHP data structure to plain PHP code", - "homepage": "https://symfony.com", - "keywords": [ - "clone", - "construct", - "export", - "hydrate", - "instantiate", - "lazy-loading", - "proxy", - "serialize" - ], - "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.3.2" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/var-exporter" - }, - { - "name": "symfony/yaml", - "version": "v6.3.3", - "version_normalized": "6.3.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/e23292e8c07c85b971b44c1c4b87af52133e2add", - "reference": "e23292e8c07c85b971b44c1c4b87af52133e2add", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "symfony/console": "<5.4" - }, - "require-dev": { - "symfony/console": "^5.4|^6.0" - }, - "time": "2023-07-31T07:08:24+00:00", - "bin": [ - "Resources/bin/yaml-lint" - ], - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Loads and dumps YAML files", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/yaml/tree/v6.3.3" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "install-path": "../symfony/yaml" - } - ], - "dev": true, - "dev-package-names": [ - "behat/behat", - "behat/gherkin", - "behat/transliterator", - "psr/container", - "psr/event-dispatcher", - "symfony/config", - "symfony/console", - "symfony/dependency-injection", - "symfony/deprecation-contracts", - "symfony/event-dispatcher", - "symfony/event-dispatcher-contracts", - "symfony/filesystem", - "symfony/polyfill-ctype", - "symfony/polyfill-intl-grapheme", - "symfony/polyfill-mbstring", - "symfony/service-contracts", - "symfony/string", - "symfony/translation", - "symfony/translation-contracts", - "symfony/var-exporter", - "symfony/yaml" - ] -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/CHANGELOG.md b/tests/integration/vendor/guzzlehttp/guzzle/CHANGELOG.md deleted file mode 100644 index b053017..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ /dev/null @@ -1,1352 +0,0 @@ -# Change Log - -## 6.5.8 - 2022-06-20 - -* Fix change in port should be considered a change in origin -* Fix `CURLOPT_HTTPAUTH` option not cleared on change of origin - -## 6.5.7 - 2022-06-09 - -* Fix failure to strip Authorization header on HTTP downgrade -* Fix failure to strip the Cookie header on change in host or HTTP downgrade - -## 6.5.6 - 2022-05-25 - -* Fix cross-domain cookie leakage - -## 6.5.5 - 2020-06-16 - -* Unpin version constraint for `symfony/polyfill-intl-idn` [#2678](https://github.com/guzzle/guzzle/pull/2678) - -## 6.5.4 - 2020-05-25 - -* Fix various intl icu issues [#2626](https://github.com/guzzle/guzzle/pull/2626) - -## 6.5.3 - 2020-04-18 - -* Use Symfony intl-idn polyfill [#2550](https://github.com/guzzle/guzzle/pull/2550) -* Remove use of internal functions [#2548](https://github.com/guzzle/guzzle/pull/2548) - -## 6.5.2 - 2019-12-23 - -* idn_to_ascii() fix for old PHP versions [#2489](https://github.com/guzzle/guzzle/pull/2489) - -## 6.5.1 - 2019-12-21 - -* Better defaults for PHP installations with old ICU lib [#2454](https://github.com/guzzle/guzzle/pull/2454) -* IDN support for redirects [#2424](https://github.com/guzzle/guzzle/pull/2424) - -## 6.5.0 - 2019-12-07 - -* Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143) -* Improvement: Added support to pass arbitrary options to `curl_multi_init`. [#2287](https://github.com/guzzle/guzzle/pull/2287) -* Fix: Gracefully handle passing `null` to the `header` option. [#2132](https://github.com/guzzle/guzzle/pull/2132) -* Fix: `RetryMiddleware` did not do exponential delay between retries due unit mismatch. [#2132](https://github.com/guzzle/guzzle/pull/2132) - Previously, `RetryMiddleware` would sleep for 1 millisecond, then 2 milliseconds, then 4 milliseconds. - **After this change, `RetryMiddleware` will sleep for 1 second, then 2 seconds, then 4 seconds.** - `Middleware::retry()` accepts a second callback parameter to override the default timeouts if needed. -* Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348) -* Deprecated `ClientInterface::VERSION` - -## 6.4.1 - 2019-10-23 - -* No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that -* Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar` - -## 6.4.0 - 2019-10-23 - -* Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108) -* Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081) -* Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161) -* Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163) -* Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242) -* Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284) -* Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273) -* Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335) -* Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362) - -## 6.3.3 - 2018-04-22 - -* Fix: Default headers when decode_content is specified - - -## 6.3.2 - 2018-03-26 - -* Fix: Release process - - -## 6.3.1 - 2018-03-26 - -* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014) -* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012) -* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999) -* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998) -* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953) -* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915) -* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916) - -+ Minor code cleanups, documentation fixes and clarifications. - - -## 6.3.0 - 2017-06-22 - -* Feature: force IP resolution (ipv4 or ipv6) [#1608](https://github.com/guzzle/guzzle/pull/1608), [#1659](https://github.com/guzzle/guzzle/pull/1659) -* Improvement: Don't include summary in exception message when body is empty [#1621](https://github.com/guzzle/guzzle/pull/1621) -* Improvement: Handle `on_headers` option in MockHandler [#1580](https://github.com/guzzle/guzzle/pull/1580) -* Improvement: Added SUSE Linux CA path [#1609](https://github.com/guzzle/guzzle/issues/1609) -* Improvement: Use class reference for getting the name of the class instead of using hardcoded strings [#1641](https://github.com/guzzle/guzzle/pull/1641) -* Feature: Added `read_timeout` option [#1611](https://github.com/guzzle/guzzle/pull/1611) -* Bug fix: PHP 7.x fixes [#1685](https://github.com/guzzle/guzzle/pull/1685), [#1686](https://github.com/guzzle/guzzle/pull/1686), [#1811](https://github.com/guzzle/guzzle/pull/1811) -* Deprecation: BadResponseException instantiation without a response [#1642](https://github.com/guzzle/guzzle/pull/1642) -* Feature: Added NTLM auth [#1569](https://github.com/guzzle/guzzle/pull/1569) -* Feature: Track redirect HTTP status codes [#1711](https://github.com/guzzle/guzzle/pull/1711) -* Improvement: Check handler type during construction [#1745](https://github.com/guzzle/guzzle/pull/1745) -* Improvement: Always include the Content-Length if there's a body [#1721](https://github.com/guzzle/guzzle/pull/1721) -* Feature: Added convenience method to access a cookie by name [#1318](https://github.com/guzzle/guzzle/pull/1318) -* Bug fix: Fill `CURLOPT_CAPATH` and `CURLOPT_CAINFO` properly [#1684](https://github.com/guzzle/guzzle/pull/1684) -* Improvement: Use `\GuzzleHttp\Promise\rejection_for` function instead of object init [#1827](https://github.com/guzzle/guzzle/pull/1827) - - -+ Minor code cleanups, documentation fixes and clarifications. - -## 6.2.3 - 2017-02-28 - -* Fix deprecations with guzzle/psr7 version 1.4 - -## 6.2.2 - 2016-10-08 - -* Allow to pass nullable Response to delay callable -* Only add scheme when host is present -* Fix drain case where content-length is the literal string zero -* Obfuscate in-URL credentials in exceptions - -## 6.2.1 - 2016-07-18 - -* Address HTTP_PROXY security vulnerability, CVE-2016-5385: - https://httpoxy.org/ -* Fixing timeout bug with StreamHandler: - https://github.com/guzzle/guzzle/pull/1488 -* Only read up to `Content-Length` in PHP StreamHandler to avoid timeouts when - a server does not honor `Connection: close`. -* Ignore URI fragment when sending requests. - -## 6.2.0 - 2016-03-21 - -* Feature: added `GuzzleHttp\json_encode` and `GuzzleHttp\json_decode`. - https://github.com/guzzle/guzzle/pull/1389 -* Bug fix: Fix sleep calculation when waiting for delayed requests. - https://github.com/guzzle/guzzle/pull/1324 -* Feature: More flexible history containers. - https://github.com/guzzle/guzzle/pull/1373 -* Bug fix: defer sink stream opening in StreamHandler. - https://github.com/guzzle/guzzle/pull/1377 -* Bug fix: do not attempt to escape cookie values. - https://github.com/guzzle/guzzle/pull/1406 -* Feature: report original content encoding and length on decoded responses. - https://github.com/guzzle/guzzle/pull/1409 -* Bug fix: rewind seekable request bodies before dispatching to cURL. - https://github.com/guzzle/guzzle/pull/1422 -* Bug fix: provide an empty string to `http_build_query` for HHVM workaround. - https://github.com/guzzle/guzzle/pull/1367 - -## 6.1.1 - 2015-11-22 - -* Bug fix: Proxy::wrapSync() now correctly proxies to the appropriate handler - https://github.com/guzzle/guzzle/commit/911bcbc8b434adce64e223a6d1d14e9a8f63e4e4 -* Feature: HandlerStack is now more generic. - https://github.com/guzzle/guzzle/commit/f2102941331cda544745eedd97fc8fd46e1ee33e -* Bug fix: setting verify to false in the StreamHandler now disables peer - verification. https://github.com/guzzle/guzzle/issues/1256 -* Feature: Middleware now uses an exception factory, including more error - context. https://github.com/guzzle/guzzle/pull/1282 -* Feature: better support for disabled functions. - https://github.com/guzzle/guzzle/pull/1287 -* Bug fix: fixed regression where MockHandler was not using `sink`. - https://github.com/guzzle/guzzle/pull/1292 - -## 6.1.0 - 2015-09-08 - -* Feature: Added the `on_stats` request option to provide access to transfer - statistics for requests. https://github.com/guzzle/guzzle/pull/1202 -* Feature: Added the ability to persist session cookies in CookieJars. - https://github.com/guzzle/guzzle/pull/1195 -* Feature: Some compatibility updates for Google APP Engine - https://github.com/guzzle/guzzle/pull/1216 -* Feature: Added support for NO_PROXY to prevent the use of a proxy based on - a simple set of rules. https://github.com/guzzle/guzzle/pull/1197 -* Feature: Cookies can now contain square brackets. - https://github.com/guzzle/guzzle/pull/1237 -* Bug fix: Now correctly parsing `=` inside of quotes in Cookies. - https://github.com/guzzle/guzzle/pull/1232 -* Bug fix: Cusotm cURL options now correctly override curl options of the - same name. https://github.com/guzzle/guzzle/pull/1221 -* Bug fix: Content-Type header is now added when using an explicitly provided - multipart body. https://github.com/guzzle/guzzle/pull/1218 -* Bug fix: Now ignoring Set-Cookie headers that have no name. -* Bug fix: Reason phrase is no longer cast to an int in some cases in the - cURL handler. https://github.com/guzzle/guzzle/pull/1187 -* Bug fix: Remove the Authorization header when redirecting if the Host - header changes. https://github.com/guzzle/guzzle/pull/1207 -* Bug fix: Cookie path matching fixes - https://github.com/guzzle/guzzle/issues/1129 -* Bug fix: Fixing the cURL `body_as_string` setting - https://github.com/guzzle/guzzle/pull/1201 -* Bug fix: quotes are no longer stripped when parsing cookies. - https://github.com/guzzle/guzzle/issues/1172 -* Bug fix: `form_params` and `query` now always uses the `&` separator. - https://github.com/guzzle/guzzle/pull/1163 -* Bug fix: Adding a Content-Length to PHP stream wrapper requests if not set. - https://github.com/guzzle/guzzle/pull/1189 - -## 6.0.2 - 2015-07-04 - -* Fixed a memory leak in the curl handlers in which references to callbacks - were not being removed by `curl_reset`. -* Cookies are now extracted properly before redirects. -* Cookies now allow more character ranges. -* Decoded Content-Encoding responses are now modified to correctly reflect - their state if the encoding was automatically removed by a handler. This - means that the `Content-Encoding` header may be removed an the - `Content-Length` modified to reflect the message size after removing the - encoding. -* Added a more explicit error message when trying to use `form_params` and - `multipart` in the same request. -* Several fixes for HHVM support. -* Functions are now conditionally required using an additional level of - indirection to help with global Composer installations. - -## 6.0.1 - 2015-05-27 - -* Fixed a bug with serializing the `query` request option where the `&` - separator was missing. -* Added a better error message for when `body` is provided as an array. Please - use `form_params` or `multipart` instead. -* Various doc fixes. - -## 6.0.0 - 2015-05-26 - -* See the UPGRADING.md document for more information. -* Added `multipart` and `form_params` request options. -* Added `synchronous` request option. -* Added the `on_headers` request option. -* Fixed `expect` handling. -* No longer adding default middlewares in the client ctor. These need to be - present on the provided handler in order to work. -* Requests are no longer initiated when sending async requests with the - CurlMultiHandler. This prevents unexpected recursion from requests completing - while ticking the cURL loop. -* Removed the semantics of setting `default` to `true`. This is no longer - required now that the cURL loop is not ticked for async requests. -* Added request and response logging middleware. -* No longer allowing self signed certificates when using the StreamHandler. -* Ensuring that `sink` is valid if saving to a file. -* Request exceptions now include a "handler context" which provides handler - specific contextual information. -* Added `GuzzleHttp\RequestOptions` to allow request options to be applied - using constants. -* `$maxHandles` has been removed from CurlMultiHandler. -* `MultipartPostBody` is now part of the `guzzlehttp/psr7` package. - -## 5.3.0 - 2015-05-19 - -* Mock now supports `save_to` -* Marked `AbstractRequestEvent::getTransaction()` as public. -* Fixed a bug in which multiple headers using different casing would overwrite - previous headers in the associative array. -* Added `Utils::getDefaultHandler()` -* Marked `GuzzleHttp\Client::getDefaultUserAgent` as deprecated. -* URL scheme is now always lowercased. - -## 6.0.0-beta.1 - -* Requires PHP >= 5.5 -* Updated to use PSR-7 - * Requires immutable messages, which basically means an event based system - owned by a request instance is no longer possible. - * Utilizing the [Guzzle PSR-7 package](https://github.com/guzzle/psr7). - * Removed the dependency on `guzzlehttp/streams`. These stream abstractions - are available in the `guzzlehttp/psr7` package under the `GuzzleHttp\Psr7` - namespace. -* Added middleware and handler system - * Replaced the Guzzle event and subscriber system with a middleware system. - * No longer depends on RingPHP, but rather places the HTTP handlers directly - in Guzzle, operating on PSR-7 messages. - * Retry logic is now encapsulated in `GuzzleHttp\Middleware::retry`, which - means the `guzzlehttp/retry-subscriber` is now obsolete. - * Mocking responses is now handled using `GuzzleHttp\Handler\MockHandler`. -* Asynchronous responses - * No longer supports the `future` request option to send an async request. - Instead, use one of the `*Async` methods of a client (e.g., `requestAsync`, - `getAsync`, etc.). - * Utilizing `GuzzleHttp\Promise` instead of React's promise library to avoid - recursion required by chaining and forwarding react promises. See - https://github.com/guzzle/promises - * Added `requestAsync` and `sendAsync` to send request asynchronously. - * Added magic methods for `getAsync()`, `postAsync()`, etc. to send requests - asynchronously. -* Request options - * POST and form updates - * Added the `form_fields` and `form_files` request options. - * Removed the `GuzzleHttp\Post` namespace. - * The `body` request option no longer accepts an array for POST requests. - * The `exceptions` request option has been deprecated in favor of the - `http_errors` request options. - * The `save_to` request option has been deprecated in favor of `sink` request - option. -* Clients no longer accept an array of URI template string and variables for - URI variables. You will need to expand URI templates before passing them - into a client constructor or request method. -* Client methods `get()`, `post()`, `put()`, `patch()`, `options()`, etc. are - now magic methods that will send synchronous requests. -* Replaced `Utils.php` with plain functions in `functions.php`. -* Removed `GuzzleHttp\Collection`. -* Removed `GuzzleHttp\BatchResults`. Batched pool results are now returned as - an array. -* Removed `GuzzleHttp\Query`. Query string handling is now handled using an - associative array passed into the `query` request option. The query string - is serialized using PHP's `http_build_query`. If you need more control, you - can pass the query string in as a string. -* `GuzzleHttp\QueryParser` has been replaced with the - `GuzzleHttp\Psr7\parse_query`. - -## 5.2.0 - 2015-01-27 - -* Added `AppliesHeadersInterface` to make applying headers to a request based - on the body more generic and not specific to `PostBodyInterface`. -* Reduced the number of stack frames needed to send requests. -* Nested futures are now resolved in the client rather than the RequestFsm -* Finishing state transitions is now handled in the RequestFsm rather than the - RingBridge. -* Added a guard in the Pool class to not use recursion for request retries. - -## 5.1.0 - 2014-12-19 - -* Pool class no longer uses recursion when a request is intercepted. -* The size of a Pool can now be dynamically adjusted using a callback. - See https://github.com/guzzle/guzzle/pull/943. -* Setting a request option to `null` when creating a request with a client will - ensure that the option is not set. This allows you to overwrite default - request options on a per-request basis. - See https://github.com/guzzle/guzzle/pull/937. -* Added the ability to limit which protocols are allowed for redirects by - specifying a `protocols` array in the `allow_redirects` request option. -* Nested futures due to retries are now resolved when waiting for synchronous - responses. See https://github.com/guzzle/guzzle/pull/947. -* `"0"` is now an allowed URI path. See - https://github.com/guzzle/guzzle/pull/935. -* `Query` no longer typehints on the `$query` argument in the constructor, - allowing for strings and arrays. -* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle - specific exceptions if necessary. - -## 5.0.3 - 2014-11-03 - -This change updates query strings so that they are treated as un-encoded values -by default where the value represents an un-encoded value to send over the -wire. A Query object then encodes the value before sending over the wire. This -means that even value query string values (e.g., ":") are url encoded. This -makes the Query class match PHP's http_build_query function. However, if you -want to send requests over the wire using valid query string characters that do -not need to be encoded, then you can provide a string to Url::setQuery() and -pass true as the second argument to specify that the query string is a raw -string that should not be parsed or encoded (unless a call to getQuery() is -subsequently made, forcing the query-string to be converted into a Query -object). - -## 5.0.2 - 2014-10-30 - -* Added a trailing `\r\n` to multipart/form-data payloads. See - https://github.com/guzzle/guzzle/pull/871 -* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs. -* Status codes are now returned as integers. See - https://github.com/guzzle/guzzle/issues/881 -* No longer overwriting an existing `application/x-www-form-urlencoded` header - when sending POST requests, allowing for customized headers. See - https://github.com/guzzle/guzzle/issues/877 -* Improved path URL serialization. - - * No longer double percent-encoding characters in the path or query string if - they are already encoded. - * Now properly encoding the supplied path to a URL object, instead of only - encoding ' ' and '?'. - * Note: This has been changed in 5.0.3 to now encode query string values by - default unless the `rawString` argument is provided when setting the query - string on a URL: Now allowing many more characters to be present in the - query string without being percent encoded. See http://tools.ietf.org/html/rfc3986#appendix-A - -## 5.0.1 - 2014-10-16 - -Bugfix release. - -* Fixed an issue where connection errors still returned response object in - error and end events event though the response is unusable. This has been - corrected so that a response is not returned in the `getResponse` method of - these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867 -* Fixed an issue where transfer statistics were not being populated in the - RingBridge. https://github.com/guzzle/guzzle/issues/866 - -## 5.0.0 - 2014-10-12 - -Adding support for non-blocking responses and some minor API cleanup. - -### New Features - -* Added support for non-blocking responses based on `guzzlehttp/guzzle-ring`. -* Added a public API for creating a default HTTP adapter. -* Updated the redirect plugin to be non-blocking so that redirects are sent - concurrently. Other plugins like this can now be updated to be non-blocking. -* Added a "progress" event so that you can get upload and download progress - events. -* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers - requests concurrently using a capped pool size as efficiently as possible. -* Added `hasListeners()` to EmitterInterface. -* Removed `GuzzleHttp\ClientInterface::sendAll` and marked - `GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the - recommended way). - -### Breaking changes - -The breaking changes in this release are relatively minor. The biggest thing to -look out for is that request and response objects no longer implement fluent -interfaces. - -* Removed the fluent interfaces (i.e., `return $this`) from requests, - responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`, - `GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and - `GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of - why I did this: http://ocramius.github.io/blog/fluent-interfaces-are-evil/. - This also makes the Guzzle message interfaces compatible with the current - PSR-7 message proposal. -* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except - for the HTTP request functions from function.php, these functions are now - implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode` - moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to - `GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to - `GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be - `GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php - caused problems for many users: they aren't PSR-4 compliant, require an - explicit include, and needed an if-guard to ensure that the functions are not - declared multiple times. -* Rewrote adapter layer. - * Removing all classes from `GuzzleHttp\Adapter`, these are now - implemented as callables that are stored in `GuzzleHttp\Ring\Client`. - * Removed the concept of "parallel adapters". Sending requests serially or - concurrently is now handled using a single adapter. - * Moved `GuzzleHttp\Adapter\Transaction` to `GuzzleHttp\Transaction`. The - Transaction object now exposes the request, response, and client as public - properties. The getters and setters have been removed. -* Removed the "headers" event. This event was only useful for changing the - body a response once the headers of the response were known. You can implement - a similar behavior in a number of ways. One example might be to use a - FnStream that has access to the transaction being sent. For example, when the - first byte is written, you could check if the response headers match your - expectations, and if so, change the actual stream body that is being - written to. -* Removed the `asArray` parameter from - `GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header - value as an array, then use the newly added `getHeaderAsArray()` method of - `MessageInterface`. This change makes the Guzzle interfaces compatible with - the PSR-7 interfaces. -* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add - custom request options using double-dispatch (this was an implementation - detail). Instead, you should now provide an associative array to the - constructor which is a mapping of the request option name mapping to a - function that applies the option value to a request. -* Removed the concept of "throwImmediately" from exceptions and error events. - This control mechanism was used to stop a transfer of concurrent requests - from completing. This can now be handled by throwing the exception or by - cancelling a pool of requests or each outstanding future request individually. -* Updated to "GuzzleHttp\Streams" 3.0. - * `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a - `maxLen` parameter. This update makes the Guzzle streams project - compatible with the current PSR-7 proposal. - * `GuzzleHttp\Stream\Stream::__construct`, - `GuzzleHttp\Stream\Stream::factory`, and - `GuzzleHttp\Stream\Utils::create` no longer accept a size in the second - argument. They now accept an associative array of options, including the - "size" key and "metadata" key which can be used to provide custom metadata. - -## 4.2.2 - 2014-09-08 - -* Fixed a memory leak in the CurlAdapter when reusing cURL handles. -* No longer using `request_fulluri` in stream adapter proxies. -* Relative redirects are now based on the last response, not the first response. - -## 4.2.1 - 2014-08-19 - -* Ensuring that the StreamAdapter does not always add a Content-Type header -* Adding automated github releases with a phar and zip - -## 4.2.0 - 2014-08-17 - -* Now merging in default options using a case-insensitive comparison. - Closes https://github.com/guzzle/guzzle/issues/767 -* Added the ability to automatically decode `Content-Encoding` response bodies - using the `decode_content` request option. This is set to `true` by default - to decode the response body if it comes over the wire with a - `Content-Encoding`. Set this value to `false` to disable decoding the - response content, and pass a string to provide a request `Accept-Encoding` - header and turn on automatic response decoding. This feature now allows you - to pass an `Accept-Encoding` header in the headers of a request but still - disable automatic response decoding. - Closes https://github.com/guzzle/guzzle/issues/764 -* Added the ability to throw an exception immediately when transferring - requests in parallel. Closes https://github.com/guzzle/guzzle/issues/760 -* Updating guzzlehttp/streams dependency to ~2.1 -* No longer utilizing the now deprecated namespaced methods from the stream - package. - -## 4.1.8 - 2014-08-14 - -* Fixed an issue in the CurlFactory that caused setting the `stream=false` - request option to throw an exception. - See: https://github.com/guzzle/guzzle/issues/769 -* TransactionIterator now calls rewind on the inner iterator. - See: https://github.com/guzzle/guzzle/pull/765 -* You can now set the `Content-Type` header to `multipart/form-data` - when creating POST requests to force multipart bodies. - See https://github.com/guzzle/guzzle/issues/768 - -## 4.1.7 - 2014-08-07 - -* Fixed an error in the HistoryPlugin that caused the same request and response - to be logged multiple times when an HTTP protocol error occurs. -* Ensuring that cURL does not add a default Content-Type when no Content-Type - has been supplied by the user. This prevents the adapter layer from modifying - the request that is sent over the wire after any listeners may have already - put the request in a desired state (e.g., signed the request). -* Throwing an exception when you attempt to send requests that have the - "stream" set to true in parallel using the MultiAdapter. -* Only calling curl_multi_select when there are active cURL handles. This was - previously changed and caused performance problems on some systems due to PHP - always selecting until the maximum select timeout. -* Fixed a bug where multipart/form-data POST fields were not correctly - aggregated (e.g., values with "&"). - -## 4.1.6 - 2014-08-03 - -* Added helper methods to make it easier to represent messages as strings, - including getting the start line and getting headers as a string. - -## 4.1.5 - 2014-08-02 - -* Automatically retrying cURL "Connection died, retrying a fresh connect" - errors when possible. -* cURL implementation cleanup -* Allowing multiple event subscriber listeners to be registered per event by - passing an array of arrays of listener configuration. - -## 4.1.4 - 2014-07-22 - -* Fixed a bug that caused multi-part POST requests with more than one field to - serialize incorrectly. -* Paths can now be set to "0" -* `ResponseInterface::xml` now accepts a `libxml_options` option and added a - missing default argument that was required when parsing XML response bodies. -* A `save_to` stream is now created lazily, which means that files are not - created on disk unless a request succeeds. - -## 4.1.3 - 2014-07-15 - -* Various fixes to multipart/form-data POST uploads -* Wrapping function.php in an if-statement to ensure Guzzle can be used - globally and in a Composer install -* Fixed an issue with generating and merging in events to an event array -* POST headers are only applied before sending a request to allow you to change - the query aggregator used before uploading -* Added much more robust query string parsing -* Fixed various parsing and normalization issues with URLs -* Fixing an issue where multi-valued headers were not being utilized correctly - in the StreamAdapter - -## 4.1.2 - 2014-06-18 - -* Added support for sending payloads with GET requests - -## 4.1.1 - 2014-06-08 - -* Fixed an issue related to using custom message factory options in subclasses -* Fixed an issue with nested form fields in a multi-part POST -* Fixed an issue with using the `json` request option for POST requests -* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar` - -## 4.1.0 - 2014-05-27 - -* Added a `json` request option to easily serialize JSON payloads. -* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON. -* Added `setPort()` and `getPort()` to `GuzzleHttp\Message\RequestInterface`. -* Added the ability to provide an emitter to a client in the client constructor. -* Added the ability to persist a cookie session using $_SESSION. -* Added a trait that can be used to add event listeners to an iterator. -* Removed request method constants from RequestInterface. -* Fixed warning when invalid request start-lines are received. -* Updated MessageFactory to work with custom request option methods. -* Updated cacert bundle to latest build. - -4.0.2 (2014-04-16) ------------------- - -* Proxy requests using the StreamAdapter now properly use request_fulluri (#632) -* Added the ability to set scalars as POST fields (#628) - -## 4.0.1 - 2014-04-04 - -* The HTTP status code of a response is now set as the exception code of - RequestException objects. -* 303 redirects will now correctly switch from POST to GET requests. -* The default parallel adapter of a client now correctly uses the MultiAdapter. -* HasDataTrait now initializes the internal data array as an empty array so - that the toArray() method always returns an array. - -## 4.0.0 - 2014-03-29 - -* For more information on the 4.0 transition, see: - http://mtdowling.com/blog/2014/03/15/guzzle-4-rc/ -* For information on changes and upgrading, see: - https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 -* Added `GuzzleHttp\batch()` as a convenience function for sending requests in - parallel without needing to write asynchronous code. -* Restructured how events are added to `GuzzleHttp\ClientInterface::sendAll()`. - You can now pass a callable or an array of associative arrays where each - associative array contains the "fn", "priority", and "once" keys. - -## 4.0.0.rc-2 - 2014-03-25 - -* Removed `getConfig()` and `setConfig()` from clients to avoid confusion - around whether things like base_url, message_factory, etc. should be able to - be retrieved or modified. -* Added `getDefaultOption()` and `setDefaultOption()` to ClientInterface -* functions.php functions were renamed using snake_case to match PHP idioms -* Added support for `HTTP_PROXY`, `HTTPS_PROXY`, and - `GUZZLE_CURL_SELECT_TIMEOUT` environment variables -* Added the ability to specify custom `sendAll()` event priorities -* Added the ability to specify custom stream context options to the stream - adapter. -* Added a functions.php function for `get_path()` and `set_path()` -* CurlAdapter and MultiAdapter now use a callable to generate curl resources -* MockAdapter now properly reads a body and emits a `headers` event -* Updated Url class to check if a scheme and host are set before adding ":" - and "//". This allows empty Url (e.g., "") to be serialized as "". -* Parsing invalid XML no longer emits warnings -* Curl classes now properly throw AdapterExceptions -* Various performance optimizations -* Streams are created with the faster `Stream\create()` function -* Marked deprecation_proxy() as internal -* Test server is now a collection of static methods on a class - -## 4.0.0-rc.1 - 2014-03-15 - -* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40 - -## 3.8.1 - 2014-01-28 - -* Bug: Always using GET requests when redirecting from a 303 response -* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in - `Guzzle\Http\ClientInterface::setSslVerification()` -* Bug: RedirectPlugin now uses strict RFC 3986 compliance when combining a base URL with a relative URL -* Bug: The body of a request can now be set to `"0"` -* Sending PHP stream requests no longer forces `HTTP/1.0` -* Adding more information to ExceptionCollection exceptions so that users have more context, including a stack trace of - each sub-exception -* Updated the `$ref` attribute in service descriptions to merge over any existing parameters of a schema (rather than - clobbering everything). -* Merging URLs will now use the query string object from the relative URL (thus allowing custom query aggregators) -* Query strings are now parsed in a way that they do no convert empty keys with no value to have a dangling `=`. - For example `foo&bar=baz` is now correctly parsed and recognized as `foo&bar=baz` rather than `foo=&bar=baz`. -* Now properly escaping the regular expression delimiter when matching Cookie domains. -* Network access is now disabled when loading XML documents - -## 3.8.0 - 2013-12-05 - -* Added the ability to define a POST name for a file -* JSON response parsing now properly walks additionalProperties -* cURL error code 18 is now retried automatically in the BackoffPlugin -* Fixed a cURL error when URLs contain fragments -* Fixed an issue in the BackoffPlugin retry event where it was trying to access all exceptions as if they were - CurlExceptions -* CURLOPT_PROGRESS function fix for PHP 5.5 (69fcc1e) -* Added the ability for Guzzle to work with older versions of cURL that do not support `CURLOPT_TIMEOUT_MS` -* Fixed a bug that was encountered when parsing empty header parameters -* UriTemplate now has a `setRegex()` method to match the docs -* The `debug` request parameter now checks if it is truthy rather than if it exists -* Setting the `debug` request parameter to true shows verbose cURL output instead of using the LogPlugin -* Added the ability to combine URLs using strict RFC 3986 compliance -* Command objects can now return the validation errors encountered by the command -* Various fixes to cache revalidation (#437 and 29797e5) -* Various fixes to the AsyncPlugin -* Cleaned up build scripts - -## 3.7.4 - 2013-10-02 - -* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430) -* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp - (see https://github.com/aws/aws-sdk-php/issues/147) -* Bug fix: Cleaned up and fixed URL dot segment removal to properly resolve internal dots -* Minimum PHP version is now properly specified as 5.3.3 (up from 5.3.2) (#420) -* Updated the bundled cacert.pem (#419) -* OauthPlugin now supports adding authentication to headers or query string (#425) - -## 3.7.3 - 2013-09-08 - -* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and - `CommandTransferException`. -* Setting `additionalParameters` of a response to false is now honored when parsing responses with a service description -* Schemas are only injected into response models when explicitly configured. -* No longer guessing Content-Type based on the path of a request. Content-Type is now only guessed based on the path of - an EntityBody. -* Bug fix: ChunkedIterator can now properly chunk a \Traversable as well as an \Iterator. -* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`. -* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody() -* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin -* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests -* Bug fix: Properly parsing headers that contain commas contained in quotes -* Bug fix: mimetype guessing based on a filename is now case-insensitive - -## 3.7.2 - 2013-08-02 - -* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander - See https://github.com/guzzle/guzzle/issues/371 -* Bug fix: Cookie domains are now matched correctly according to RFC 6265 - See https://github.com/guzzle/guzzle/issues/377 -* Bug fix: GET parameters are now used when calculating an OAuth signature -* Bug fix: Fixed an issue with cache revalidation where the If-None-Match header was being double quoted -* `Guzzle\Common\AbstractHasDispatcher::dispatch()` now returns the event that was dispatched -* `Guzzle\Http\QueryString::factory()` now guesses the most appropriate query aggregator to used based on the input. - See https://github.com/guzzle/guzzle/issues/379 -* Added a way to add custom domain objects to service description parsing using the `operation.parse_class` event. See - https://github.com/guzzle/guzzle/pull/380 -* cURL multi cleanup and optimizations - -## 3.7.1 - 2013-07-05 - -* Bug fix: Setting default options on a client now works -* Bug fix: Setting options on HEAD requests now works. See #352 -* Bug fix: Moving stream factory before send event to before building the stream. See #353 -* Bug fix: Cookies no longer match on IP addresses per RFC 6265 -* Bug fix: Correctly parsing header parameters that are in `<>` and quotes -* Added `cert` and `ssl_key` as request options -* `Host` header can now diverge from the host part of a URL if the header is set manually -* `Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor` was rewritten to change from using SimpleXML to XMLWriter -* OAuth parameters are only added via the plugin if they aren't already set -* Exceptions are now thrown when a URL cannot be parsed -* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails -* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin - -## 3.7.0 - 2013-06-10 - -* See UPGRADING.md for more information on how to upgrade. -* Requests now support the ability to specify an array of $options when creating a request to more easily modify a - request. You can pass a 'request.options' configuration setting to a client to apply default request options to - every request created by a client (e.g. default query string variables, headers, curl options, etc.). -* Added a static facade class that allows you to use Guzzle with static methods and mount the class to `\Guzzle`. - See `Guzzle\Http\StaticClient::mount`. -* Added `command.request_options` to `Guzzle\Service\Command\AbstractCommand` to pass request options to requests - created by a command (e.g. custom headers, query string variables, timeout settings, etc.). -* Stream size in `Guzzle\Stream\PhpStreamRequestFactory` will now be set if Content-Length is returned in the - headers of a response -* Added `Guzzle\Common\Collection::setPath($path, $value)` to set a value into an array using a nested key - (e.g. `$collection->setPath('foo/baz/bar', 'test'); echo $collection['foo']['bar']['bar'];`) -* ServiceBuilders now support storing and retrieving arbitrary data -* CachePlugin can now purge all resources for a given URI -* CachePlugin can automatically purge matching cached items when a non-idempotent request is sent to a resource -* CachePlugin now uses the Vary header to determine if a resource is a cache hit -* `Guzzle\Http\Message\Response` now implements `\Serializable` -* Added `Guzzle\Cache\CacheAdapterFactory::fromCache()` to more easily create cache adapters -* `Guzzle\Service\ClientInterface::execute()` now accepts an array, single command, or Traversable -* Fixed a bug in `Guzzle\Http\Message\Header\Link::addLink()` -* Better handling of calculating the size of a stream in `Guzzle\Stream\Stream` using fstat() and caching the size -* `Guzzle\Common\Exception\ExceptionCollection` now creates a more readable exception message -* Fixing BC break: Added back the MonologLogAdapter implementation rather than extending from PsrLog so that older - Symfony users can still use the old version of Monolog. -* Fixing BC break: Added the implementation back in for `Guzzle\Http\Message\AbstractMessage::getTokenizedHeader()`. - Now triggering an E_USER_DEPRECATED warning when used. Use `$message->getHeader()->parseParams()`. -* Several performance improvements to `Guzzle\Common\Collection` -* Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: - createRequest, head, delete, put, patch, post, options, prepareRequest -* Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` -* Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` -* Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to - `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a - resource, string, or EntityBody into the $options parameter to specify the download location of the response. -* Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a - default `array()` -* Added `Guzzle\Stream\StreamInterface::isRepeatable` -* Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use - $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or - $client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))`. -* Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use $client->getConfig()->getPath('request.options/headers')`. -* Removed `Guzzle\Http\ClientInterface::expandTemplate()` -* Removed `Guzzle\Http\ClientInterface::setRequestFactory()` -* Removed `Guzzle\Http\ClientInterface::getCurlMulti()` -* Removed `Guzzle\Http\Message\RequestInterface::canCache` -* Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect` -* Removed `Guzzle\Http\Message\RequestInterface::isRedirect` -* Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. -* You can now enable E_USER_DEPRECATED warnings to see if you are using a deprecated method by setting - `Guzzle\Common\Version::$emitWarnings` to true. -* Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use - `$request->getResponseBody()->isRepeatable()` instead. -* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use - `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. -* Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use - `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. -* Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. -* Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. -* Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated -* Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. - These will work through Guzzle 4.0 -* Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use [request.options][params]. -* Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. -* Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use $client->getConfig()->getPath('request.options/headers')`. -* Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use $client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. -* Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. -* Marked `Guzzle\Common\Collection::inject()` as deprecated. -* Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');` -* CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a - CacheStorageInterface. These two objects and interface will be removed in a future version. -* Always setting X-cache headers on cached responses -* Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin -* `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface - $request, Response $response);` -* `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` -* `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` -* Added `CacheStorageInterface::purge($url)` -* `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin - $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, - CanCacheStrategyInterface $canCache = null)` -* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` - -## 3.6.0 - 2013-05-29 - -* ServiceDescription now implements ToArrayInterface -* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters -* Guzzle can now correctly parse incomplete URLs -* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. -* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution -* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). -* Specific header implementations can be created for complex headers. When a message creates a header, it uses a - HeaderFactory which can map specific headers to specific header classes. There is now a Link header and - CacheControl header implementation. -* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate -* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() -* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in - Guzzle\Http\Curl\RequestMediator -* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. -* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface -* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() -* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() -* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). -* All response header helper functions return a string rather than mixing Header objects and strings inconsistently -* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle - directly via interfaces -* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist - but are a no-op until removed. -* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a - `Guzzle\Service\Command\ArrayCommandInterface`. -* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response - on a request while the request is still being transferred -* The ability to case-insensitively search for header values -* Guzzle\Http\Message\Header::hasExactHeader -* Guzzle\Http\Message\Header::raw. Use getAll() -* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object - instead. -* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess -* Added the ability to cast Model objects to a string to view debug information. - -## 3.5.0 - 2013-05-13 - -* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times -* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove - itself from the EventDispatcher) -* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values -* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too -* Bug: Fixed an undefined index error when parsing nested JSON responses with a sentAs parameter that reference a - non-existent key -* Bug: All __call() method arguments are now required (helps with mocking frameworks) -* Deprecating Response::getRequest() and now using a shallow clone of a request object to remove a circular reference - to help with refcount based garbage collection of resources created by sending a request -* Deprecating ZF1 cache and log adapters. These will be removed in the next major version. -* Deprecating `Response::getPreviousResponse()` (method signature still exists, but it's deprecated). Use the - HistoryPlugin for a history. -* Added a `responseBody` alias for the `response_body` location -* Refactored internals to no longer rely on Response::getRequest() -* HistoryPlugin can now be cast to a string -* HistoryPlugin now logs transactions rather than requests and responses to more accurately keep track of the requests - and responses that are sent over the wire -* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects - -## 3.4.3 - 2013-04-30 - -* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response -* Added a check to re-extract the temp cacert bundle from the phar before sending each request - -## 3.4.2 - 2013-04-29 - -* Bug fix: Stream objects now work correctly with "a" and "a+" modes -* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present -* Bug fix: AsyncPlugin no longer forces HEAD requests -* Bug fix: DateTime timezones are now properly handled when using the service description schema formatter -* Bug fix: CachePlugin now properly handles stale-if-error directives when a request to the origin server fails -* Setting a response on a request will write to the custom request body from the response body if one is specified -* LogPlugin now writes to php://output when STDERR is undefined -* Added the ability to set multiple POST files for the same key in a single call -* application/x-www-form-urlencoded POSTs now use the utf-8 charset by default -* Added the ability to queue CurlExceptions to the MockPlugin -* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send) -* Configuration loading now allows remote files - -## 3.4.1 - 2013-04-16 - -* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti - handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost. -* Exceptions are now properly grouped when sending requests in parallel -* Redirects are now properly aggregated when a multi transaction fails -* Redirects now set the response on the original object even in the event of a failure -* Bug fix: Model names are now properly set even when using $refs -* Added support for PHP 5.5's CurlFile to prevent warnings with the deprecated @ syntax -* Added support for oauth_callback in OAuth signatures -* Added support for oauth_verifier in OAuth signatures -* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection - -## 3.4.0 - 2013-04-11 - -* Bug fix: URLs are now resolved correctly based on http://tools.ietf.org/html/rfc3986#section-5.2. #289 -* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289 -* Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263 -* Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264. -* Bug fix: Added `number` type to service descriptions. -* Bug fix: empty parameters are removed from an OAuth signature -* Bug fix: Revalidating a cache entry prefers the Last-Modified over the Date header -* Bug fix: Fixed "array to string" error when validating a union of types in a service description -* Bug fix: Removed code that attempted to determine the size of a stream when data is written to the stream -* Bug fix: Not including an `oauth_token` if the value is null in the OauthPlugin. -* Bug fix: Now correctly aggregating successful requests and failed requests in CurlMulti when a redirect occurs. -* The new default CURLOPT_TIMEOUT setting has been increased to 150 seconds so that Guzzle works on poor connections. -* Added a feature to EntityEnclosingRequest::setBody() that will automatically set the Content-Type of the request if - the Content-Type can be determined based on the entity body or the path of the request. -* Added the ability to overwrite configuration settings in a client when grabbing a throwaway client from a builder. -* Added support for a PSR-3 LogAdapter. -* Added a `command.after_prepare` event -* Added `oauth_callback` parameter to the OauthPlugin -* Added the ability to create a custom stream class when using a stream factory -* Added a CachingEntityBody decorator -* Added support for `additionalParameters` in service descriptions to define how custom parameters are serialized. -* The bundled SSL certificate is now provided in the phar file and extracted when running Guzzle from a phar. -* You can now send any EntityEnclosingRequest with POST fields or POST files and cURL will handle creating bodies -* POST requests using a custom entity body are now treated exactly like PUT requests but with a custom cURL method. This - means that the redirect behavior of POST requests with custom bodies will not be the same as POST requests that use - POST fields or files (the latter is only used when emulating a form POST in the browser). -* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest - -## 3.3.1 - 2013-03-10 - -* Added the ability to create PHP streaming responses from HTTP requests -* Bug fix: Running any filters when parsing response headers with service descriptions -* Bug fix: OauthPlugin fixes to allow for multi-dimensional array signing, and sorting parameters before signing -* Bug fix: Removed the adding of default empty arrays and false Booleans to responses in order to be consistent across - response location visitors. -* Bug fix: Removed the possibility of creating configuration files with circular dependencies -* RequestFactory::create() now uses the key of a POST file when setting the POST file name -* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set - -## 3.3.0 - 2013-03-03 - -* A large number of performance optimizations have been made -* Bug fix: Added 'wb' as a valid write mode for streams -* Bug fix: `Guzzle\Http\Message\Response::json()` now allows scalar values to be returned -* Bug fix: Fixed bug in `Guzzle\Http\Message\Response` where wrapping quotes were stripped from `getEtag()` -* BC: Removed `Guzzle\Http\Utils` class -* BC: Setting a service description on a client will no longer modify the client's command factories. -* BC: Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using - the 'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' -* BC: `Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getSteamType()` are no longer converted to - lowercase -* Operation parameter objects are now lazy loaded internally -* Added ErrorResponsePlugin that can throw errors for responses defined in service description operations' errorResponses -* Added support for instantiating responseType=class responseClass classes. Classes must implement - `Guzzle\Service\Command\ResponseClassInterface` -* Added support for additionalProperties for top-level parameters in responseType=model responseClasses. These - additional properties also support locations and can be used to parse JSON responses where the outermost part of the - JSON is an array -* Added support for nested renaming of JSON models (rename sentAs to name) -* CachePlugin - * Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error - * Debug headers can now added to cached response in the CachePlugin - -## 3.2.0 - 2013-02-14 - -* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients. -* URLs with no path no longer contain a "/" by default -* Guzzle\Http\QueryString does no longer manages the leading "?". This is now handled in Guzzle\Http\Url. -* BadResponseException no longer includes the full request and response message -* Adding setData() to Guzzle\Service\Description\ServiceDescriptionInterface -* Adding getResponseBody() to Guzzle\Http\Message\RequestInterface -* Various updates to classes to use ServiceDescriptionInterface type hints rather than ServiceDescription -* Header values can now be normalized into distinct values when multiple headers are combined with a comma separated list -* xmlEncoding can now be customized for the XML declaration of a XML service description operation -* Guzzle\Http\QueryString now uses Guzzle\Http\QueryAggregator\QueryAggregatorInterface objects to add custom value - aggregation and no longer uses callbacks -* The URL encoding implementation of Guzzle\Http\QueryString can now be customized -* Bug fix: Filters were not always invoked for array service description parameters -* Bug fix: Redirects now use a target response body rather than a temporary response body -* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded -* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives - -## 3.1.2 - 2013-01-27 - -* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the - response body. For example, the XmlVisitor now parses the XML response into an array in the before() method. -* Fixed an issue where cURL would not automatically decompress responses when the Accept-Encoding header was sent -* CURLOPT_SSL_VERIFYHOST is never set to 1 because it is deprecated (see 5e0ff2ef20f839e19d1eeb298f90ba3598784444) -* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse() -* Setting default headers on a client after setting the user-agent will not erase the user-agent setting - -## 3.1.1 - 2013-01-20 - -* Adding wildcard support to Guzzle\Common\Collection::getPath() -* Adding alias support to ServiceBuilder configs -* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface - -## 3.1.0 - 2013-01-12 - -* BC: CurlException now extends from RequestException rather than BadResponseException -* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse() -* Added getData to ServiceDescriptionInterface -* Added context array to RequestInterface::setState() -* Bug: Removing hard dependency on the BackoffPlugin from Guzzle\Http -* Bug: Adding required content-type when JSON request visitor adds JSON to a command -* Bug: Fixing the serialization of a service description with custom data -* Made it easier to deal with exceptions thrown when transferring commands or requests in parallel by providing - an array of successful and failed responses -* Moved getPath from Guzzle\Service\Resource\Model to Guzzle\Common\Collection -* Added Guzzle\Http\IoEmittingEntityBody -* Moved command filtration from validators to location visitors -* Added `extends` attributes to service description parameters -* Added getModels to ServiceDescriptionInterface - -## 3.0.7 - 2012-12-19 - -* Fixing phar detection when forcing a cacert to system if null or true -* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()` -* Cleaning up `Guzzle\Common\Collection::inject` method -* Adding a response_body location to service descriptions - -## 3.0.6 - 2012-12-09 - -* CurlMulti performance improvements -* Adding setErrorResponses() to Operation -* composer.json tweaks - -## 3.0.5 - 2012-11-18 - -* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin -* Bug: Response body can now be a string containing "0" -* Bug: Using Guzzle inside of a phar uses system by default but now allows for a custom cacert -* Bug: QueryString::fromString now properly parses query string parameters that contain equal signs -* Added support for XML attributes in service description responses -* DefaultRequestSerializer now supports array URI parameter values for URI template expansion -* Added better mimetype guessing to requests and post files - -## 3.0.4 - 2012-11-11 - -* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value -* Bug: Cookies can now be added that have a name, domain, or value set to "0" -* Bug: Using the system cacert bundle when using the Phar -* Added json and xml methods to Response to make it easier to parse JSON and XML response data into data structures -* Enhanced cookie jar de-duplication -* Added the ability to enable strict cookie jars that throw exceptions when invalid cookies are added -* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies -* Added the ability to create any sort of hash for a stream rather than just an MD5 hash - -## 3.0.3 - 2012-11-04 - -* Implementing redirects in PHP rather than cURL -* Added PECL URI template extension and using as default parser if available -* Bug: Fixed Content-Length parsing of Response factory -* Adding rewind() method to entity bodies and streams. Allows for custom rewinding of non-repeatable streams. -* Adding ToArrayInterface throughout library -* Fixing OauthPlugin to create unique nonce values per request - -## 3.0.2 - 2012-10-25 - -* Magic methods are enabled by default on clients -* Magic methods return the result of a command -* Service clients no longer require a base_url option in the factory -* Bug: Fixed an issue with URI templates where null template variables were being expanded - -## 3.0.1 - 2012-10-22 - -* Models can now be used like regular collection objects by calling filter, map, etc. -* Models no longer require a Parameter structure or initial data in the constructor -* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator` - -## 3.0.0 - 2012-10-15 - -* Rewrote service description format to be based on Swagger - * Now based on JSON schema - * Added nested input structures and nested response models - * Support for JSON and XML input and output models - * Renamed `commands` to `operations` - * Removed dot class notation - * Removed custom types -* Broke the project into smaller top-level namespaces to be more component friendly -* Removed support for XML configs and descriptions. Use arrays or JSON files. -* Removed the Validation component and Inspector -* Moved all cookie code to Guzzle\Plugin\Cookie -* Magic methods on a Guzzle\Service\Client now return the command un-executed. -* Calling getResult() or getResponse() on a command will lazily execute the command if needed. -* Now shipping with cURL's CA certs and using it by default -* Added previousResponse() method to response objects -* No longer sending Accept and Accept-Encoding headers on every request -* Only sending an Expect header by default when a payload is greater than 1MB -* Added/moved client options: - * curl.blacklist to curl.option.blacklist - * Added ssl.certificate_authority -* Added a Guzzle\Iterator component -* Moved plugins from Guzzle\Http\Plugin to Guzzle\Plugin -* Added a more robust backoff retry strategy (replaced the ExponentialBackoffPlugin) -* Added a more robust caching plugin -* Added setBody to response objects -* Updating LogPlugin to use a more flexible MessageFormatter -* Added a completely revamped build process -* Cleaning up Collection class and removing default values from the get method -* Fixed ZF2 cache adapters - -## 2.8.8 - 2012-10-15 - -* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did - -## 2.8.7 - 2012-09-30 - -* Bug: Fixed config file aliases for JSON includes -* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests -* Bug: Removing the path to a file when sending a Content-Disposition header on a POST upload -* Bug: Hardening request and response parsing to account for missing parts -* Bug: Fixed PEAR packaging -* Bug: Fixed Request::getInfo -* Bug: Fixed cases where CURLM_CALL_MULTI_PERFORM return codes were causing curl transactions to fail -* Adding the ability for the namespace Iterator factory to look in multiple directories -* Added more getters/setters/removers from service descriptions -* Added the ability to remove POST fields from OAuth signatures -* OAuth plugin now supports 2-legged OAuth - -## 2.8.6 - 2012-09-05 - -* Added the ability to modify and build service descriptions -* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command -* Added a `json` parameter location -* Now allowing dot notation for classes in the CacheAdapterFactory -* Using the union of two arrays rather than an array_merge when extending service builder services and service params -* Ensuring that a service is a string before doing strpos() checks on it when substituting services for references - in service builder config files. -* Services defined in two different config files that include one another will by default replace the previously - defined service, but you can now create services that extend themselves and merge their settings over the previous -* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like - '_default' with a default JSON configuration file. - -## 2.8.5 - 2012-08-29 - -* Bug: Suppressed empty arrays from URI templates -* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching -* Added support for HTTP responses that do not contain a reason phrase in the start-line -* AbstractCommand commands are now invokable -* Added a way to get the data used when signing an Oauth request before a request is sent - -## 2.8.4 - 2012-08-15 - -* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin -* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable. -* Added a StreamInterface, EntityBodyInterface, and added ftell() to Guzzle\Common\Stream -* Added an AbstractEntityBodyDecorator and a ReadLimitEntityBody decorator to transfer only a subset of a decorated stream -* Stream and EntityBody objects will now return the file position to the previous position after a read required operation (e.g. getContentMd5()) -* Added additional response status codes -* Removed SSL information from the default User-Agent header -* DELETE requests can now send an entity body -* Added an EventDispatcher to the ExponentialBackoffPlugin and added an ExponentialBackoffLogger to log backoff retries -* Added the ability of the MockPlugin to consume mocked request bodies -* LogPlugin now exposes request and response objects in the extras array - -## 2.8.3 - 2012-07-30 - -* Bug: Fixed a case where empty POST requests were sent as GET requests -* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body -* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new -* Added multiple inheritance to service description commands -* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()` -* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything -* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles - -## 2.8.2 - 2012-07-24 - -* Bug: Query string values set to 0 are no longer dropped from the query string -* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()` -* Bug: `+` is now treated as an encoded space when parsing query strings -* QueryString and Collection performance improvements -* Allowing dot notation for class paths in filters attribute of a service descriptions - -## 2.8.1 - 2012-07-16 - -* Loosening Event Dispatcher dependency -* POST redirects can now be customized using CURLOPT_POSTREDIR - -## 2.8.0 - 2012-07-15 - -* BC: Guzzle\Http\Query - * Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl) - * Changed isEncodingValues() and isEncodingFields() to isUrlEncoding() - * Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool) - * Changed the aggregation functions of QueryString to be static methods - * Can now use fromString() with querystrings that have a leading ? -* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters -* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body -* Cookies are no longer URL decoded by default -* Bug: URI template variables set to null are no longer expanded - -## 2.7.2 - 2012-07-02 - -* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser. -* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty() -* CachePlugin now allows for a custom request parameter function to check if a request can be cached -* Bug fix: CachePlugin now only caches GET and HEAD requests by default -* Bug fix: Using header glue when transferring headers over the wire -* Allowing deeply nested arrays for composite variables in URI templates -* Batch divisors can now return iterators or arrays - -## 2.7.1 - 2012-06-26 - -* Minor patch to update version number in UA string -* Updating build process - -## 2.7.0 - 2012-06-25 - -* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes. -* BC: Removed magic setX methods from commands -* BC: Magic methods mapped to service description commands are now inflected in the command factory rather than the client __call() method -* Verbose cURL options are no longer enabled by default. Set curl.debug to true on a client to enable. -* Bug: Now allowing colons in a response start-line (e.g. HTTP/1.1 503 Service Unavailable: Back-end server is at capacity) -* Guzzle\Service\Resource\ResourceIteratorApplyBatched now internally uses the Guzzle\Common\Batch namespace -* Added Guzzle\Service\Plugin namespace and a PluginCollectionPlugin -* Added the ability to set POST fields and files in a service description -* Guzzle\Http\EntityBody::factory() now accepts objects with a __toString() method -* Adding a command.before_prepare event to clients -* Added BatchClosureTransfer and BatchClosureDivisor -* BatchTransferException now includes references to the batch divisor and transfer strategies -* Fixed some tests so that they pass more reliably -* Added Guzzle\Common\Log\ArrayLogAdapter - -## 2.6.6 - 2012-06-10 - -* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin -* BC: Removing Guzzle\Service\Command\CommandSet -* Adding generic batching system (replaces the batch queue plugin and command set) -* Updating ZF cache and log adapters and now using ZF's composer repository -* Bug: Setting the name of each ApiParam when creating through an ApiCommand -* Adding result_type, result_doc, deprecated, and doc_url to service descriptions -* Bug: Changed the default cookie header casing back to 'Cookie' - -## 2.6.5 - 2012-06-03 - -* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource() -* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from -* BC: Guzzle\Http\Cookie is now used to manage Set-Cookie data, not Cookie data -* BC: Renaming methods in the CookieJarInterface -* Moving almost all cookie logic out of the CookiePlugin and into the Cookie or CookieJar implementations -* Making the default glue for HTTP headers ';' instead of ',' -* Adding a removeValue to Guzzle\Http\Message\Header -* Adding getCookies() to request interface. -* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber() - -## 2.6.4 - 2012-05-30 - -* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class. -* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand -* Bug: Fixing magic method command calls on clients -* Bug: Email constraint only validates strings -* Bug: Aggregate POST fields when POST files are present in curl handle -* Bug: Fixing default User-Agent header -* Bug: Only appending or prepending parameters in commands if they are specified -* Bug: Not requiring response reason phrases or status codes to match a predefined list of codes -* Allowing the use of dot notation for class namespaces when using instance_of constraint -* Added any_match validation constraint -* Added an AsyncPlugin -* Passing request object to the calculateWait method of the ExponentialBackoffPlugin -* Allowing the result of a command object to be changed -* Parsing location and type sub values when instantiating a service description rather than over and over at runtime - -## 2.6.3 - 2012-05-23 - -* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options. -* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields. -* You can now use an array of data when creating PUT request bodies in the request factory. -* Removing the requirement that HTTPS requests needed a Cache-Control: public directive to be cacheable. -* [Http] Adding support for Content-Type in multipart POST uploads per upload -* [Http] Added support for uploading multiple files using the same name (foo[0], foo[1]) -* Adding more POST data operations for easier manipulation of POST data. -* You can now set empty POST fields. -* The body of a request is only shown on EntityEnclosingRequest objects that do not use POST files. -* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate. -* CS updates - -## 2.6.2 - 2012-05-19 - -* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method. - -## 2.6.1 - 2012-05-19 - -* [BC] Removing 'path' support in service descriptions. Use 'uri'. -* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache. -* [BC] Removing Guzzle\Common\NullObject. Use https://github.com/mtdowling/NullObject if you need it. -* [BC] Removing Guzzle\Common\XmlElement. -* All commands, both dynamic and concrete, have ApiCommand objects. -* Adding a fix for CurlMulti so that if all of the connections encounter some sort of curl error, then the loop exits. -* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored. -* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible. - -## 2.6.0 - 2012-05-15 - -* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder -* [BC] Executing a Command returns the result of the command rather than the command -* [BC] Moving all HTTP parsing logic to Guzzle\Http\Parsers. Allows for faster C implementations if needed. -* [BC] Changing the Guzzle\Http\Message\Response::setProtocol() method to accept a protocol and version in separate args. -* [BC] Moving ResourceIterator* to Guzzle\Service\Resource -* [BC] Completely refactored ResourceIterators to iterate over a cloned command object -* [BC] Moved Guzzle\Http\UriTemplate to Guzzle\Http\Parser\UriTemplate\UriTemplate -* [BC] Guzzle\Guzzle is now deprecated -* Moving Guzzle\Common\Guzzle::inject to Guzzle\Common\Collection::inject -* Adding Guzzle\Version class to give version information about Guzzle -* Adding Guzzle\Http\Utils class to provide getDefaultUserAgent() and getHttpDate() -* Adding Guzzle\Curl\CurlVersion to manage caching curl_version() data -* ServiceDescription and ServiceBuilder are now cacheable using similar configs -* Changing the format of XML and JSON service builder configs. Backwards compatible. -* Cleaned up Cookie parsing -* Trimming the default Guzzle User-Agent header -* Adding a setOnComplete() method to Commands that is called when a command completes -* Keeping track of requests that were mocked in the MockPlugin -* Fixed a caching bug in the CacheAdapterFactory -* Inspector objects can be injected into a Command object -* Refactoring a lot of code and tests to be case insensitive when dealing with headers -* Adding Guzzle\Http\Message\HeaderComparison for easy comparison of HTTP headers using a DSL -* Adding the ability to set global option overrides to service builder configs -* Adding the ability to include other service builder config files from within XML and JSON files -* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method. - -## 2.5.0 - 2012-05-08 - -* Major performance improvements -* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated. -* [BC] Using a custom validation system that allows a flyweight implementation for much faster validation. No longer using Symfony2 Validation component. -* [BC] No longer supporting "{{ }}" for injecting into command or UriTemplates. Use "{}" -* Added the ability to passed parameters to all requests created by a client -* Added callback functionality to the ExponentialBackoffPlugin -* Using microtime in ExponentialBackoffPlugin to allow more granular backoff strategies. -* Rewinding request stream bodies when retrying requests -* Exception is thrown when JSON response body cannot be decoded -* Added configurable magic method calls to clients and commands. This is off by default. -* Fixed a defect that added a hash to every parsed URL part -* Fixed duplicate none generation for OauthPlugin. -* Emitting an event each time a client is generated by a ServiceBuilder -* Using an ApiParams object instead of a Collection for parameters of an ApiCommand -* cache.* request parameters should be renamed to params.cache.* -* Added the ability to set arbitrary curl options on requests (disable_wire, progress, etc.). See CurlHandle. -* Added the ability to disable type validation of service descriptions -* ServiceDescriptions and ServiceBuilders are now Serializable diff --git a/tests/integration/vendor/guzzlehttp/guzzle/LICENSE b/tests/integration/vendor/guzzlehttp/guzzle/LICENSE deleted file mode 100644 index fd2375d..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2011 Michael Dowling -Copyright (c) 2012 Jeremy Lindblom -Copyright (c) 2014 Graham Campbell -Copyright (c) 2015 Márk Sági-Kazár -Copyright (c) 2015 Tobias Schultze -Copyright (c) 2016 Tobias Nyholm -Copyright (c) 2016 George Mponos - -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. diff --git a/tests/integration/vendor/guzzlehttp/guzzle/README.md b/tests/integration/vendor/guzzlehttp/guzzle/README.md deleted file mode 100644 index bc98e1a..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/README.md +++ /dev/null @@ -1,97 +0,0 @@ -![Guzzle](.github/logo.png?raw=true) - -# Guzzle, PHP HTTP client - -[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases) -[![Build Status](https://img.shields.io/github/workflow/status/guzzle/guzzle/CI?label=ci%20build&style=flat-square)](https://github.com/guzzle/guzzle/actions?query=workflow%3ACI) -[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle) - -Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and -trivial to integrate with web services. - -- Simple interface for building query strings, POST requests, streaming large - uploads, streaming large downloads, using HTTP cookies, uploading JSON data, - etc... -- Can send both synchronous and asynchronous requests using the same interface. -- Uses PSR-7 interfaces for requests, responses, and streams. This allows you - to utilize other PSR-7 compatible libraries with Guzzle. -- Abstracts away the underlying HTTP transport, allowing you to write - environment and transport agnostic code; i.e., no hard dependency on cURL, - PHP streams, sockets, or non-blocking event loops. -- Middleware system allows you to augment and compose client behavior. - -```php -$client = new \GuzzleHttp\Client(); -$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle'); - -echo $response->getStatusCode(); # 200 -echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8' -echo $response->getBody(); # '{"id": 1420053, "name": "guzzle", ...}' - -# Send an asynchronous request. -$request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org'); -$promise = $client->sendAsync($request)->then(function ($response) { - echo 'I completed! ' . $response->getBody(); -}); - -$promise->wait(); -``` - -## Help and docs - -We use GitHub issues only to discuss bugs and new features. For support please refer to: - -- [Documentation](https://docs.guzzlephp.org) -- [Stack Overflow](https://stackoverflow.com/questions/tagged/guzzle) -- [#guzzle](https://app.slack.com/client/T0D2S9JCT/CE6UAAKL4) channel on [PHP-HTTP Slack](https://slack.httplug.io/) -- [Gitter](https://gitter.im/guzzle/guzzle) - - -## Installing Guzzle - -The recommended way to install Guzzle is through -[Composer](https://getcomposer.org/). - -```bash -# Install Composer -curl -sS https://getcomposer.org/installer | php -``` - -Next, run the Composer command to install the latest stable version of Guzzle: - -```bash -composer require guzzlehttp/guzzle -``` - -After installing, you need to require Composer's autoloader: - -```php -require 'vendor/autoload.php'; -``` - -You can then later update Guzzle using composer: - - ```bash -composer update - ``` - - -## Version Guidance - -| Version | Status | Packagist | Namespace | Repo | Docs | PSR-7 | PHP Version | -|---------|----------------|---------------------|--------------|---------------------|---------------------|-------|--------------| -| 3.x | EOL | `guzzle/guzzle` | `Guzzle` | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No | >=5.3.3,<7.0 | -| 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >=5.4,<7.0 | -| 5.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >=5.4,<7.4 | -| 6.x | Security fixes | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >=5.5,<8.0 | -| 7.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v7][guzzle-7-repo] | [v7][guzzle-7-docs] | Yes | >=7.2.5,<8.2 | - -[guzzle-3-repo]: https://github.com/guzzle/guzzle3 -[guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x -[guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3 -[guzzle-6-repo]: https://github.com/guzzle/guzzle/tree/6.5 -[guzzle-7-repo]: https://github.com/guzzle/guzzle -[guzzle-3-docs]: https://guzzle3.readthedocs.io/ -[guzzle-5-docs]: https://docs.guzzlephp.org/en/5.3/ -[guzzle-6-docs]: https://docs.guzzlephp.org/en/6.5/ -[guzzle-7-docs]: https://docs.guzzlephp.org/en/latest/ diff --git a/tests/integration/vendor/guzzlehttp/guzzle/UPGRADING.md b/tests/integration/vendor/guzzlehttp/guzzle/UPGRADING.md deleted file mode 100644 index 91d1dcc..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/UPGRADING.md +++ /dev/null @@ -1,1203 +0,0 @@ -Guzzle Upgrade Guide -==================== - -5.0 to 6.0 ----------- - -Guzzle now uses [PSR-7](http://www.php-fig.org/psr/psr-7/) for HTTP messages. -Due to the fact that these messages are immutable, this prompted a refactoring -of Guzzle to use a middleware based system rather than an event system. Any -HTTP message interaction (e.g., `GuzzleHttp\Message\Request`) need to be -updated to work with the new immutable PSR-7 request and response objects. Any -event listeners or subscribers need to be updated to become middleware -functions that wrap handlers (or are injected into a -`GuzzleHttp\HandlerStack`). - -- Removed `GuzzleHttp\BatchResults` -- Removed `GuzzleHttp\Collection` -- Removed `GuzzleHttp\HasDataTrait` -- Removed `GuzzleHttp\ToArrayInterface` -- The `guzzlehttp/streams` dependency has been removed. Stream functionality - is now present in the `GuzzleHttp\Psr7` namespace provided by the - `guzzlehttp/psr7` package. -- Guzzle no longer uses ReactPHP promises and now uses the - `guzzlehttp/promises` library. We use a custom promise library for three - significant reasons: - 1. React promises (at the time of writing this) are recursive. Promise - chaining and promise resolution will eventually blow the stack. Guzzle - promises are not recursive as they use a sort of trampolining technique. - Note: there has been movement in the React project to modify promises to - no longer utilize recursion. - 2. Guzzle needs to have the ability to synchronously block on a promise to - wait for a result. Guzzle promises allows this functionality (and does - not require the use of recursion). - 3. Because we need to be able to wait on a result, doing so using React - promises requires wrapping react promises with RingPHP futures. This - overhead is no longer needed, reducing stack sizes, reducing complexity, - and improving performance. -- `GuzzleHttp\Mimetypes` has been moved to a function in - `GuzzleHttp\Psr7\mimetype_from_extension` and - `GuzzleHttp\Psr7\mimetype_from_filename`. -- `GuzzleHttp\Query` and `GuzzleHttp\QueryParser` have been removed. Query - strings must now be passed into request objects as strings, or provided to - the `query` request option when creating requests with clients. The `query` - option uses PHP's `http_build_query` to convert an array to a string. If you - need a different serialization technique, you will need to pass the query - string in as a string. There are a couple helper functions that will make - working with query strings easier: `GuzzleHttp\Psr7\parse_query` and - `GuzzleHttp\Psr7\build_query`. -- Guzzle no longer has a dependency on RingPHP. Due to the use of a middleware - system based on PSR-7, using RingPHP and it's middleware system as well adds - more complexity than the benefits it provides. All HTTP handlers that were - present in RingPHP have been modified to work directly with PSR-7 messages - and placed in the `GuzzleHttp\Handler` namespace. This significantly reduces - complexity in Guzzle, removes a dependency, and improves performance. RingPHP - will be maintained for Guzzle 5 support, but will no longer be a part of - Guzzle 6. -- As Guzzle now uses a middleware based systems the event system and RingPHP - integration has been removed. Note: while the event system has been removed, - it is possible to add your own type of event system that is powered by the - middleware system. - - Removed the `Event` namespace. - - Removed the `Subscriber` namespace. - - Removed `Transaction` class - - Removed `RequestFsm` - - Removed `RingBridge` - - `GuzzleHttp\Subscriber\Cookie` is now provided by - `GuzzleHttp\Middleware::cookies` - - `GuzzleHttp\Subscriber\HttpError` is now provided by - `GuzzleHttp\Middleware::httpError` - - `GuzzleHttp\Subscriber\History` is now provided by - `GuzzleHttp\Middleware::history` - - `GuzzleHttp\Subscriber\Mock` is now provided by - `GuzzleHttp\Handler\MockHandler` - - `GuzzleHttp\Subscriber\Prepare` is now provided by - `GuzzleHttp\PrepareBodyMiddleware` - - `GuzzleHttp\Subscriber\Redirect` is now provided by - `GuzzleHttp\RedirectMiddleware` -- Guzzle now uses `Psr\Http\Message\UriInterface` (implements in - `GuzzleHttp\Psr7\Uri`) for URI support. `GuzzleHttp\Url` is now gone. -- Static functions in `GuzzleHttp\Utils` have been moved to namespaced - functions under the `GuzzleHttp` namespace. This requires either a Composer - based autoloader or you to include functions.php. -- `GuzzleHttp\ClientInterface::getDefaultOption` has been renamed to - `GuzzleHttp\ClientInterface::getConfig`. -- `GuzzleHttp\ClientInterface::setDefaultOption` has been removed. -- The `json` and `xml` methods of response objects has been removed. With the - migration to strictly adhering to PSR-7 as the interface for Guzzle messages, - adding methods to message interfaces would actually require Guzzle messages - to extend from PSR-7 messages rather then work with them directly. - -## Migrating to middleware - -The change to PSR-7 unfortunately required significant refactoring to Guzzle -due to the fact that PSR-7 messages are immutable. Guzzle 5 relied on an event -system from plugins. The event system relied on mutability of HTTP messages and -side effects in order to work. With immutable messages, you have to change your -workflow to become more about either returning a value (e.g., functional -middlewares) or setting a value on an object. Guzzle v6 has chosen the -functional middleware approach. - -Instead of using the event system to listen for things like the `before` event, -you now create a stack based middleware function that intercepts a request on -the way in and the promise of the response on the way out. This is a much -simpler and more predictable approach than the event system and works nicely -with PSR-7 middleware. Due to the use of promises, the middleware system is -also asynchronous. - -v5: - -```php -use GuzzleHttp\Event\BeforeEvent; -$client = new GuzzleHttp\Client(); -// Get the emitter and listen to the before event. -$client->getEmitter()->on('before', function (BeforeEvent $e) { - // Guzzle v5 events relied on mutation - $e->getRequest()->setHeader('X-Foo', 'Bar'); -}); -``` - -v6: - -In v6, you can modify the request before it is sent using the `mapRequest` -middleware. The idiomatic way in v6 to modify the request/response lifecycle is -to setup a handler middleware stack up front and inject the handler into a -client. - -```php -use GuzzleHttp\Middleware; -// Create a handler stack that has all of the default middlewares attached -$handler = GuzzleHttp\HandlerStack::create(); -// Push the handler onto the handler stack -$handler->push(Middleware::mapRequest(function (RequestInterface $request) { - // Notice that we have to return a request object - return $request->withHeader('X-Foo', 'Bar'); -})); -// Inject the handler into the client -$client = new GuzzleHttp\Client(['handler' => $handler]); -``` - -## POST Requests - -This version added the [`form_params`](http://guzzle.readthedocs.org/en/latest/request-options.html#form_params) -and `multipart` request options. `form_params` is an associative array of -strings or array of strings and is used to serialize an -`application/x-www-form-urlencoded` POST request. The -[`multipart`](http://guzzle.readthedocs.org/en/latest/request-options.html#multipart) -option is now used to send a multipart/form-data POST request. - -`GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add -POST files to a multipart/form-data request. - -The `body` option no longer accepts an array to send POST requests. Please use -`multipart` or `form_params` instead. - -The `base_url` option has been renamed to `base_uri`. - -4.x to 5.0 ----------- - -## Rewritten Adapter Layer - -Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send -HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor -is still supported, but it has now been renamed to `handler`. Instead of -passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP -`callable` that follows the RingPHP specification. - -## Removed Fluent Interfaces - -[Fluent interfaces were removed](http://ocramius.github.io/blog/fluent-interfaces-are-evil) -from the following classes: - -- `GuzzleHttp\Collection` -- `GuzzleHttp\Url` -- `GuzzleHttp\Query` -- `GuzzleHttp\Post\PostBody` -- `GuzzleHttp\Cookie\SetCookie` - -## Removed functions.php - -Removed "functions.php", so that Guzzle is truly PSR-4 compliant. The following -functions can be used as replacements. - -- `GuzzleHttp\json_decode` -> `GuzzleHttp\Utils::jsonDecode` -- `GuzzleHttp\get_path` -> `GuzzleHttp\Utils::getPath` -- `GuzzleHttp\Utils::setPath` -> `GuzzleHttp\set_path` -- `GuzzleHttp\Pool::batch` -> `GuzzleHttp\batch`. This function is, however, - deprecated in favor of using `GuzzleHttp\Pool::batch()`. - -The "procedural" global client has been removed with no replacement (e.g., -`GuzzleHttp\get()`, `GuzzleHttp\post()`, etc.). Use a `GuzzleHttp\Client` -object as a replacement. - -## `throwImmediately` has been removed - -The concept of "throwImmediately" has been removed from exceptions and error -events. This control mechanism was used to stop a transfer of concurrent -requests from completing. This can now be handled by throwing the exception or -by cancelling a pool of requests or each outstanding future request -individually. - -## headers event has been removed - -Removed the "headers" event. This event was only useful for changing the -body a response once the headers of the response were known. You can implement -a similar behavior in a number of ways. One example might be to use a -FnStream that has access to the transaction being sent. For example, when the -first byte is written, you could check if the response headers match your -expectations, and if so, change the actual stream body that is being -written to. - -## Updates to HTTP Messages - -Removed the `asArray` parameter from -`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header -value as an array, then use the newly added `getHeaderAsArray()` method of -`MessageInterface`. This change makes the Guzzle interfaces compatible with -the PSR-7 interfaces. - -3.x to 4.0 ----------- - -## Overarching changes: - -- Now requires PHP 5.4 or greater. -- No longer requires cURL to send requests. -- Guzzle no longer wraps every exception it throws. Only exceptions that are - recoverable are now wrapped by Guzzle. -- Various namespaces have been removed or renamed. -- No longer requiring the Symfony EventDispatcher. A custom event dispatcher - based on the Symfony EventDispatcher is - now utilized in `GuzzleHttp\Event\EmitterInterface` (resulting in significant - speed and functionality improvements). - -Changes per Guzzle 3.x namespace are described below. - -## Batch - -The `Guzzle\Batch` namespace has been removed. This is best left to -third-parties to implement on top of Guzzle's core HTTP library. - -## Cache - -The `Guzzle\Cache` namespace has been removed. (Todo: No suitable replacement -has been implemented yet, but hoping to utilize a PSR cache interface). - -## Common - -- Removed all of the wrapped exceptions. It's better to use the standard PHP - library for unrecoverable exceptions. -- `FromConfigInterface` has been removed. -- `Guzzle\Common\Version` has been removed. The VERSION constant can be found - at `GuzzleHttp\ClientInterface::VERSION`. - -### Collection - -- `getAll` has been removed. Use `toArray` to convert a collection to an array. -- `inject` has been removed. -- `keySearch` has been removed. -- `getPath` no longer supports wildcard expressions. Use something better like - JMESPath for this. -- `setPath` now supports appending to an existing array via the `[]` notation. - -### Events - -Guzzle no longer requires Symfony's EventDispatcher component. Guzzle now uses -`GuzzleHttp\Event\Emitter`. - -- `Symfony\Component\EventDispatcher\EventDispatcherInterface` is replaced by - `GuzzleHttp\Event\EmitterInterface`. -- `Symfony\Component\EventDispatcher\EventDispatcher` is replaced by - `GuzzleHttp\Event\Emitter`. -- `Symfony\Component\EventDispatcher\Event` is replaced by - `GuzzleHttp\Event\Event`, and Guzzle now has an EventInterface in - `GuzzleHttp\Event\EventInterface`. -- `AbstractHasDispatcher` has moved to a trait, `HasEmitterTrait`, and - `HasDispatcherInterface` has moved to `HasEmitterInterface`. Retrieving the - event emitter of a request, client, etc. now uses the `getEmitter` method - rather than the `getDispatcher` method. - -#### Emitter - -- Use the `once()` method to add a listener that automatically removes itself - the first time it is invoked. -- Use the `listeners()` method to retrieve a list of event listeners rather than - the `getListeners()` method. -- Use `emit()` instead of `dispatch()` to emit an event from an emitter. -- Use `attach()` instead of `addSubscriber()` and `detach()` instead of - `removeSubscriber()`. - -```php -$mock = new Mock(); -// 3.x -$request->getEventDispatcher()->addSubscriber($mock); -$request->getEventDispatcher()->removeSubscriber($mock); -// 4.x -$request->getEmitter()->attach($mock); -$request->getEmitter()->detach($mock); -``` - -Use the `on()` method to add a listener rather than the `addListener()` method. - -```php -// 3.x -$request->getEventDispatcher()->addListener('foo', function (Event $event) { /* ... */ } ); -// 4.x -$request->getEmitter()->on('foo', function (Event $event, $name) { /* ... */ } ); -``` - -## Http - -### General changes - -- The cacert.pem certificate has been moved to `src/cacert.pem`. -- Added the concept of adapters that are used to transfer requests over the - wire. -- Simplified the event system. -- Sending requests in parallel is still possible, but batching is no longer a - concept of the HTTP layer. Instead, you must use the `complete` and `error` - events to asynchronously manage parallel request transfers. -- `Guzzle\Http\Url` has moved to `GuzzleHttp\Url`. -- `Guzzle\Http\QueryString` has moved to `GuzzleHttp\Query`. -- QueryAggregators have been rewritten so that they are simply callable - functions. -- `GuzzleHttp\StaticClient` has been removed. Use the functions provided in - `functions.php` for an easy to use static client instance. -- Exceptions in `GuzzleHttp\Exception` have been updated to all extend from - `GuzzleHttp\Exception\TransferException`. - -### Client - -Calling methods like `get()`, `post()`, `head()`, etc. no longer create and -return a request, but rather creates a request, sends the request, and returns -the response. - -```php -// 3.0 -$request = $client->get('/'); -$response = $request->send(); - -// 4.0 -$response = $client->get('/'); - -// or, to mirror the previous behavior -$request = $client->createRequest('GET', '/'); -$response = $client->send($request); -``` - -`GuzzleHttp\ClientInterface` has changed. - -- The `send` method no longer accepts more than one request. Use `sendAll` to - send multiple requests in parallel. -- `setUserAgent()` has been removed. Use a default request option instead. You - could, for example, do something like: - `$client->setConfig('defaults/headers/User-Agent', 'Foo/Bar ' . $client::getDefaultUserAgent())`. -- `setSslVerification()` has been removed. Use default request options instead, - like `$client->setConfig('defaults/verify', true)`. - -`GuzzleHttp\Client` has changed. - -- The constructor now accepts only an associative array. You can include a - `base_url` string or array to use a URI template as the base URL of a client. - You can also specify a `defaults` key that is an associative array of default - request options. You can pass an `adapter` to use a custom adapter, - `batch_adapter` to use a custom adapter for sending requests in parallel, or - a `message_factory` to change the factory used to create HTTP requests and - responses. -- The client no longer emits a `client.create_request` event. -- Creating requests with a client no longer automatically utilize a URI - template. You must pass an array into a creational method (e.g., - `createRequest`, `get`, `put`, etc.) in order to expand a URI template. - -### Messages - -Messages no longer have references to their counterparts (i.e., a request no -longer has a reference to it's response, and a response no loger has a -reference to its request). This association is now managed through a -`GuzzleHttp\Adapter\TransactionInterface` object. You can get references to -these transaction objects using request events that are emitted over the -lifecycle of a request. - -#### Requests with a body - -- `GuzzleHttp\Message\EntityEnclosingRequest` and - `GuzzleHttp\Message\EntityEnclosingRequestInterface` have been removed. The - separation between requests that contain a body and requests that do not - contain a body has been removed, and now `GuzzleHttp\Message\RequestInterface` - handles both use cases. -- Any method that previously accepts a `GuzzleHttp\Response` object now accept a - `GuzzleHttp\Message\ResponseInterface`. -- `GuzzleHttp\Message\RequestFactoryInterface` has been renamed to - `GuzzleHttp\Message\MessageFactoryInterface`. This interface is used to create - both requests and responses and is implemented in - `GuzzleHttp\Message\MessageFactory`. -- POST field and file methods have been removed from the request object. You - must now use the methods made available to `GuzzleHttp\Post\PostBodyInterface` - to control the format of a POST body. Requests that are created using a - standard `GuzzleHttp\Message\MessageFactoryInterface` will automatically use - a `GuzzleHttp\Post\PostBody` body if the body was passed as an array or if - the method is POST and no body is provided. - -```php -$request = $client->createRequest('POST', '/'); -$request->getBody()->setField('foo', 'bar'); -$request->getBody()->addFile(new PostFile('file_key', fopen('/path/to/content', 'r'))); -``` - -#### Headers - -- `GuzzleHttp\Message\Header` has been removed. Header values are now simply - represented by an array of values or as a string. Header values are returned - as a string by default when retrieving a header value from a message. You can - pass an optional argument of `true` to retrieve a header value as an array - of strings instead of a single concatenated string. -- `GuzzleHttp\PostFile` and `GuzzleHttp\PostFileInterface` have been moved to - `GuzzleHttp\Post`. This interface has been simplified and now allows the - addition of arbitrary headers. -- Custom headers like `GuzzleHttp\Message\Header\Link` have been removed. Most - of the custom headers are now handled separately in specific - subscribers/plugins, and `GuzzleHttp\Message\HeaderValues::parseParams()` has - been updated to properly handle headers that contain parameters (like the - `Link` header). - -#### Responses - -- `GuzzleHttp\Message\Response::getInfo()` and - `GuzzleHttp\Message\Response::setInfo()` have been removed. Use the event - system to retrieve this type of information. -- `GuzzleHttp\Message\Response::getRawHeaders()` has been removed. -- `GuzzleHttp\Message\Response::getMessage()` has been removed. -- `GuzzleHttp\Message\Response::calculateAge()` and other cache specific - methods have moved to the CacheSubscriber. -- Header specific helper functions like `getContentMd5()` have been removed. - Just use `getHeader('Content-MD5')` instead. -- `GuzzleHttp\Message\Response::setRequest()` and - `GuzzleHttp\Message\Response::getRequest()` have been removed. Use the event - system to work with request and response objects as a transaction. -- `GuzzleHttp\Message\Response::getRedirectCount()` has been removed. Use the - Redirect subscriber instead. -- `GuzzleHttp\Message\Response::isSuccessful()` and other related methods have - been removed. Use `getStatusCode()` instead. - -#### Streaming responses - -Streaming requests can now be created by a client directly, returning a -`GuzzleHttp\Message\ResponseInterface` object that contains a body stream -referencing an open PHP HTTP stream. - -```php -// 3.0 -use Guzzle\Stream\PhpStreamRequestFactory; -$request = $client->get('/'); -$factory = new PhpStreamRequestFactory(); -$stream = $factory->fromRequest($request); -$data = $stream->read(1024); - -// 4.0 -$response = $client->get('/', ['stream' => true]); -// Read some data off of the stream in the response body -$data = $response->getBody()->read(1024); -``` - -#### Redirects - -The `configureRedirects()` method has been removed in favor of a -`allow_redirects` request option. - -```php -// Standard redirects with a default of a max of 5 redirects -$request = $client->createRequest('GET', '/', ['allow_redirects' => true]); - -// Strict redirects with a custom number of redirects -$request = $client->createRequest('GET', '/', [ - 'allow_redirects' => ['max' => 5, 'strict' => true] -]); -``` - -#### EntityBody - -EntityBody interfaces and classes have been removed or moved to -`GuzzleHttp\Stream`. All classes and interfaces that once required -`GuzzleHttp\EntityBodyInterface` now require -`GuzzleHttp\Stream\StreamInterface`. Creating a new body for a request no -longer uses `GuzzleHttp\EntityBody::factory` but now uses -`GuzzleHttp\Stream\Stream::factory` or even better: -`GuzzleHttp\Stream\create()`. - -- `Guzzle\Http\EntityBodyInterface` is now `GuzzleHttp\Stream\StreamInterface` -- `Guzzle\Http\EntityBody` is now `GuzzleHttp\Stream\Stream` -- `Guzzle\Http\CachingEntityBody` is now `GuzzleHttp\Stream\CachingStream` -- `Guzzle\Http\ReadLimitEntityBody` is now `GuzzleHttp\Stream\LimitStream` -- `Guzzle\Http\IoEmittyinEntityBody` has been removed. - -#### Request lifecycle events - -Requests previously submitted a large number of requests. The number of events -emitted over the lifecycle of a request has been significantly reduced to make -it easier to understand how to extend the behavior of a request. All events -emitted during the lifecycle of a request now emit a custom -`GuzzleHttp\Event\EventInterface` object that contains context providing -methods and a way in which to modify the transaction at that specific point in -time (e.g., intercept the request and set a response on the transaction). - -- `request.before_send` has been renamed to `before` and now emits a - `GuzzleHttp\Event\BeforeEvent` -- `request.complete` has been renamed to `complete` and now emits a - `GuzzleHttp\Event\CompleteEvent`. -- `request.sent` has been removed. Use `complete`. -- `request.success` has been removed. Use `complete`. -- `error` is now an event that emits a `GuzzleHttp\Event\ErrorEvent`. -- `request.exception` has been removed. Use `error`. -- `request.receive.status_line` has been removed. -- `curl.callback.progress` has been removed. Use a custom `StreamInterface` to - maintain a status update. -- `curl.callback.write` has been removed. Use a custom `StreamInterface` to - intercept writes. -- `curl.callback.read` has been removed. Use a custom `StreamInterface` to - intercept reads. - -`headers` is a new event that is emitted after the response headers of a -request have been received before the body of the response is downloaded. This -event emits a `GuzzleHttp\Event\HeadersEvent`. - -You can intercept a request and inject a response using the `intercept()` event -of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and -`GuzzleHttp\Event\ErrorEvent` event. - -See: http://docs.guzzlephp.org/en/latest/events.html - -## Inflection - -The `Guzzle\Inflection` namespace has been removed. This is not a core concern -of Guzzle. - -## Iterator - -The `Guzzle\Iterator` namespace has been removed. - -- `Guzzle\Iterator\AppendIterator`, `Guzzle\Iterator\ChunkedIterator`, and - `Guzzle\Iterator\MethodProxyIterator` are nice, but not a core requirement of - Guzzle itself. -- `Guzzle\Iterator\FilterIterator` is no longer needed because an equivalent - class is shipped with PHP 5.4. -- `Guzzle\Iterator\MapIterator` is not really needed when using PHP 5.5 because - it's easier to just wrap an iterator in a generator that maps values. - -For a replacement of these iterators, see https://github.com/nikic/iter - -## Log - -The LogPlugin has moved to https://github.com/guzzle/log-subscriber. The -`Guzzle\Log` namespace has been removed. Guzzle now relies on -`Psr\Log\LoggerInterface` for all logging. The MessageFormatter class has been -moved to `GuzzleHttp\Subscriber\Log\Formatter`. - -## Parser - -The `Guzzle\Parser` namespace has been removed. This was previously used to -make it possible to plug in custom parsers for cookies, messages, URI -templates, and URLs; however, this level of complexity is not needed in Guzzle -so it has been removed. - -- Cookie: Cookie parsing logic has been moved to - `GuzzleHttp\Cookie\SetCookie::fromString`. -- Message: Message parsing logic for both requests and responses has been moved - to `GuzzleHttp\Message\MessageFactory::fromMessage`. Message parsing is only - used in debugging or deserializing messages, so it doesn't make sense for - Guzzle as a library to add this level of complexity to parsing messages. -- UriTemplate: URI template parsing has been moved to - `GuzzleHttp\UriTemplate`. The Guzzle library will automatically use the PECL - URI template library if it is installed. -- Url: URL parsing is now performed in `GuzzleHttp\Url::fromString` (previously - it was `Guzzle\Http\Url::factory()`). If custom URL parsing is necessary, - then developers are free to subclass `GuzzleHttp\Url`. - -## Plugin - -The `Guzzle\Plugin` namespace has been renamed to `GuzzleHttp\Subscriber`. -Several plugins are shipping with the core Guzzle library under this namespace. - -- `GuzzleHttp\Subscriber\Cookie`: Replaces the old CookiePlugin. Cookie jar - code has moved to `GuzzleHttp\Cookie`. -- `GuzzleHttp\Subscriber\History`: Replaces the old HistoryPlugin. -- `GuzzleHttp\Subscriber\HttpError`: Throws errors when a bad HTTP response is - received. -- `GuzzleHttp\Subscriber\Mock`: Replaces the old MockPlugin. -- `GuzzleHttp\Subscriber\Prepare`: Prepares the body of a request just before - sending. This subscriber is attached to all requests by default. -- `GuzzleHttp\Subscriber\Redirect`: Replaces the RedirectPlugin. - -The following plugins have been removed (third-parties are free to re-implement -these if needed): - -- `GuzzleHttp\Plugin\Async` has been removed. -- `GuzzleHttp\Plugin\CurlAuth` has been removed. -- `GuzzleHttp\Plugin\ErrorResponse\ErrorResponsePlugin` has been removed. This - functionality should instead be implemented with event listeners that occur - after normal response parsing occurs in the guzzle/command package. - -The following plugins are not part of the core Guzzle package, but are provided -in separate repositories: - -- `Guzzle\Http\Plugin\BackoffPlugin` has been rewritten to be much simpler - to build custom retry policies using simple functions rather than various - chained classes. See: https://github.com/guzzle/retry-subscriber -- `Guzzle\Http\Plugin\Cache\CachePlugin` has moved to - https://github.com/guzzle/cache-subscriber -- `Guzzle\Http\Plugin\Log\LogPlugin` has moved to - https://github.com/guzzle/log-subscriber -- `Guzzle\Http\Plugin\Md5\Md5Plugin` has moved to - https://github.com/guzzle/message-integrity-subscriber -- `Guzzle\Http\Plugin\Mock\MockPlugin` has moved to - `GuzzleHttp\Subscriber\MockSubscriber`. -- `Guzzle\Http\Plugin\Oauth\OauthPlugin` has moved to - https://github.com/guzzle/oauth-subscriber - -## Service - -The service description layer of Guzzle has moved into two separate packages: - -- http://github.com/guzzle/command Provides a high level abstraction over web - services by representing web service operations using commands. -- http://github.com/guzzle/guzzle-services Provides an implementation of - guzzle/command that provides request serialization and response parsing using - Guzzle service descriptions. - -## Stream - -Stream have moved to a separate package available at -https://github.com/guzzle/streams. - -`Guzzle\Stream\StreamInterface` has been given a large update to cleanly take -on the responsibilities of `Guzzle\Http\EntityBody` and -`Guzzle\Http\EntityBodyInterface` now that they have been removed. The number -of methods implemented by the `StreamInterface` has been drastically reduced to -allow developers to more easily extend and decorate stream behavior. - -## Removed methods from StreamInterface - -- `getStream` and `setStream` have been removed to better encapsulate streams. -- `getMetadata` and `setMetadata` have been removed in favor of - `GuzzleHttp\Stream\MetadataStreamInterface`. -- `getWrapper`, `getWrapperData`, `getStreamType`, and `getUri` have all been - removed. This data is accessible when - using streams that implement `GuzzleHttp\Stream\MetadataStreamInterface`. -- `rewind` has been removed. Use `seek(0)` for a similar behavior. - -## Renamed methods - -- `detachStream` has been renamed to `detach`. -- `feof` has been renamed to `eof`. -- `ftell` has been renamed to `tell`. -- `readLine` has moved from an instance method to a static class method of - `GuzzleHttp\Stream\Stream`. - -## Metadata streams - -`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams -that contain additional metadata accessible via `getMetadata()`. -`GuzzleHttp\Stream\StreamInterface::getMetadata` and -`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed. - -## StreamRequestFactory - -The entire concept of the StreamRequestFactory has been removed. The way this -was used in Guzzle 3 broke the actual interface of sending streaming requests -(instead of getting back a Response, you got a StreamInterface). Streaming -PHP requests are now implemented through the `GuzzleHttp\Adapter\StreamAdapter`. - -3.6 to 3.7 ----------- - -### Deprecations - -- You can now enable E_USER_DEPRECATED warnings to see if you are using any deprecated methods.: - -```php -\Guzzle\Common\Version::$emitWarnings = true; -``` - -The following APIs and options have been marked as deprecated: - -- Marked `Guzzle\Http\Message\Request::isResponseBodyRepeatable()` as deprecated. Use `$request->getResponseBody()->isRepeatable()` instead. -- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. -- Marked `Guzzle\Http\Message\Request::canCache()` as deprecated. Use `Guzzle\Plugin\Cache\DefaultCanCacheStrategy->canCacheRequest()` instead. -- Marked `Guzzle\Http\Message\Request::setIsRedirect()` as deprecated. Use the HistoryPlugin instead. -- Marked `Guzzle\Http\Message\Request::isRedirect()` as deprecated. Use the HistoryPlugin instead. -- Marked `Guzzle\Cache\CacheAdapterFactory::factory()` as deprecated -- Marked `Guzzle\Service\Client::enableMagicMethods()` as deprecated. Magic methods can no longer be disabled on a Guzzle\Service\Client. -- Marked `Guzzle\Parser\Url\UrlParser` as deprecated. Just use PHP's `parse_url()` and percent encode your UTF-8. -- Marked `Guzzle\Common\Collection::inject()` as deprecated. -- Marked `Guzzle\Plugin\CurlAuth\CurlAuthPlugin` as deprecated. Use - `$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` or - `$client->setDefaultOption('auth', array('user', 'pass', 'Basic|Digest|NTLM|Any'));` - -3.7 introduces `request.options` as a parameter for a client configuration and as an optional argument to all creational -request methods. When paired with a client's configuration settings, these options allow you to specify default settings -for various aspects of a request. Because these options make other previous configuration options redundant, several -configuration options and methods of a client and AbstractCommand have been deprecated. - -- Marked `Guzzle\Service\Client::getDefaultHeaders()` as deprecated. Use `$client->getDefaultOption('headers')`. -- Marked `Guzzle\Service\Client::setDefaultHeaders()` as deprecated. Use `$client->setDefaultOption('headers/{header_name}', 'value')`. -- Marked 'request.params' for `Guzzle\Http\Client` as deprecated. Use `$client->setDefaultOption('params/{param_name}', 'value')` -- Marked 'command.headers', 'command.response_body' and 'command.on_complete' as deprecated for AbstractCommand. These will work through Guzzle 4.0 - - $command = $client->getCommand('foo', array( - 'command.headers' => array('Test' => '123'), - 'command.response_body' => '/path/to/file' - )); - - // Should be changed to: - - $command = $client->getCommand('foo', array( - 'command.request_options' => array( - 'headers' => array('Test' => '123'), - 'save_as' => '/path/to/file' - ) - )); - -### Interface changes - -Additions and changes (you will need to update any implementations or subclasses you may have created): - -- Added an `$options` argument to the end of the following methods of `Guzzle\Http\ClientInterface`: - createRequest, head, delete, put, patch, post, options, prepareRequest -- Added an `$options` argument to the end of `Guzzle\Http\Message\Request\RequestFactoryInterface::createRequest()` -- Added an `applyOptions()` method to `Guzzle\Http\Message\Request\RequestFactoryInterface` -- Changed `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $body = null)` to - `Guzzle\Http\ClientInterface::get($uri = null, $headers = null, $options = array())`. You can still pass in a - resource, string, or EntityBody into the $options parameter to specify the download location of the response. -- Changed `Guzzle\Common\Collection::__construct($data)` to no longer accepts a null value for `$data` but a - default `array()` -- Added `Guzzle\Stream\StreamInterface::isRepeatable` -- Made `Guzzle\Http\Client::expandTemplate` and `getUriTemplate` protected methods. - -The following methods were removed from interfaces. All of these methods are still available in the concrete classes -that implement them, but you should update your code to use alternative methods: - -- Removed `Guzzle\Http\ClientInterface::setDefaultHeaders(). Use - `$client->getConfig()->setPath('request.options/headers/{header_name}', 'value')`. or - `$client->getConfig()->setPath('request.options/headers', array('header_name' => 'value'))` or - `$client->setDefaultOption('headers/{header_name}', 'value')`. or - `$client->setDefaultOption('headers', array('header_name' => 'value'))`. -- Removed `Guzzle\Http\ClientInterface::getDefaultHeaders(). Use `$client->getConfig()->getPath('request.options/headers')`. -- Removed `Guzzle\Http\ClientInterface::expandTemplate()`. This is an implementation detail. -- Removed `Guzzle\Http\ClientInterface::setRequestFactory()`. This is an implementation detail. -- Removed `Guzzle\Http\ClientInterface::getCurlMulti()`. This is a very specific implementation detail. -- Removed `Guzzle\Http\Message\RequestInterface::canCache`. Use the CachePlugin. -- Removed `Guzzle\Http\Message\RequestInterface::setIsRedirect`. Use the HistoryPlugin. -- Removed `Guzzle\Http\Message\RequestInterface::isRedirect`. Use the HistoryPlugin. - -### Cache plugin breaking changes - -- CacheKeyProviderInterface and DefaultCacheKeyProvider are no longer used. All of this logic is handled in a - CacheStorageInterface. These two objects and interface will be removed in a future version. -- Always setting X-cache headers on cached responses -- Default cache TTLs are now handled by the CacheStorageInterface of a CachePlugin -- `CacheStorageInterface::cache($key, Response $response, $ttl = null)` has changed to `cache(RequestInterface - $request, Response $response);` -- `CacheStorageInterface::fetch($key)` has changed to `fetch(RequestInterface $request);` -- `CacheStorageInterface::delete($key)` has changed to `delete(RequestInterface $request);` -- Added `CacheStorageInterface::purge($url)` -- `DefaultRevalidation::__construct(CacheKeyProviderInterface $cacheKey, CacheStorageInterface $cache, CachePlugin - $plugin)` has changed to `DefaultRevalidation::__construct(CacheStorageInterface $cache, - CanCacheStrategyInterface $canCache = null)` -- Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)` - -3.5 to 3.6 ----------- - -* Mixed casing of headers are now forced to be a single consistent casing across all values for that header. -* Messages internally use a HeaderCollection object to delegate handling case-insensitive header resolution -* Removed the whole changedHeader() function system of messages because all header changes now go through addHeader(). - For example, setHeader() first removes the header using unset on a HeaderCollection and then calls addHeader(). - Keeping the Host header and URL host in sync is now handled by overriding the addHeader method in Request. -* Specific header implementations can be created for complex headers. When a message creates a header, it uses a - HeaderFactory which can map specific headers to specific header classes. There is now a Link header and - CacheControl header implementation. -* Moved getLinks() from Response to just be used on a Link header object. - -If you previously relied on Guzzle\Http\Message\Header::raw(), then you will need to update your code to use the -HeaderInterface (e.g. toArray(), getAll(), etc.). - -### Interface changes - -* Removed from interface: Guzzle\Http\ClientInterface::setUriTemplate -* Removed from interface: Guzzle\Http\ClientInterface::setCurlMulti() -* Removed Guzzle\Http\Message\Request::receivedRequestHeader() and implemented this functionality in - Guzzle\Http\Curl\RequestMediator -* Removed the optional $asString parameter from MessageInterface::getHeader(). Just cast the header to a string. -* Removed the optional $tryChunkedTransfer option from Guzzle\Http\Message\EntityEnclosingRequestInterface -* Removed the $asObjects argument from Guzzle\Http\Message\MessageInterface::getHeaders() - -### Removed deprecated functions - -* Removed Guzzle\Parser\ParserRegister::get(). Use getParser() -* Removed Guzzle\Parser\ParserRegister::set(). Use registerParser(). - -### Deprecations - -* The ability to case-insensitively search for header values -* Guzzle\Http\Message\Header::hasExactHeader -* Guzzle\Http\Message\Header::raw. Use getAll() -* Deprecated cache control specific methods on Guzzle\Http\Message\AbstractMessage. Use the CacheControl header object - instead. - -### Other changes - -* All response header helper functions return a string rather than mixing Header objects and strings inconsistently -* Removed cURL blacklist support. This is no longer necessary now that Expect, Accept, etc. are managed by Guzzle - directly via interfaces -* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist - but are a no-op until removed. -* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a - `Guzzle\Service\Command\ArrayCommandInterface`. -* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response - on a request while the request is still being transferred -* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess - -3.3 to 3.4 ----------- - -Base URLs of a client now follow the rules of http://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs. - -3.2 to 3.3 ----------- - -### Response::getEtag() quote stripping removed - -`Guzzle\Http\Message\Response::getEtag()` no longer strips quotes around the ETag response header - -### Removed `Guzzle\Http\Utils` - -The `Guzzle\Http\Utils` class was removed. This class was only used for testing. - -### Stream wrapper and type - -`Guzzle\Stream\Stream::getWrapper()` and `Guzzle\Stream\Stream::getStreamType()` are no longer converted to lowercase. - -### curl.emit_io became emit_io - -Emitting IO events from a RequestMediator is now a parameter that must be set in a request's curl options using the -'emit_io' key. This was previously set under a request's parameters using 'curl.emit_io' - -3.1 to 3.2 ----------- - -### CurlMulti is no longer reused globally - -Before 3.2, the same CurlMulti object was reused globally for each client. This can cause issue where plugins added -to a single client can pollute requests dispatched from other clients. - -If you still wish to reuse the same CurlMulti object with each client, then you can add a listener to the -ServiceBuilder's `service_builder.create_client` event to inject a custom CurlMulti object into each client as it is -created. - -```php -$multi = new Guzzle\Http\Curl\CurlMulti(); -$builder = Guzzle\Service\Builder\ServiceBuilder::factory('/path/to/config.json'); -$builder->addListener('service_builder.create_client', function ($event) use ($multi) { - $event['client']->setCurlMulti($multi); -} -}); -``` - -### No default path - -URLs no longer have a default path value of '/' if no path was specified. - -Before: - -```php -$request = $client->get('http://www.foo.com'); -echo $request->getUrl(); -// >> http://www.foo.com/ -``` - -After: - -```php -$request = $client->get('http://www.foo.com'); -echo $request->getUrl(); -// >> http://www.foo.com -``` - -### Less verbose BadResponseException - -The exception message for `Guzzle\Http\Exception\BadResponseException` no longer contains the full HTTP request and -response information. You can, however, get access to the request and response object by calling `getRequest()` or -`getResponse()` on the exception object. - -### Query parameter aggregation - -Multi-valued query parameters are no longer aggregated using a callback function. `Guzzle\Http\Query` now has a -setAggregator() method that accepts a `Guzzle\Http\QueryAggregator\QueryAggregatorInterface` object. This object is -responsible for handling the aggregation of multi-valued query string variables into a flattened hash. - -2.8 to 3.x ----------- - -### Guzzle\Service\Inspector - -Change `\Guzzle\Service\Inspector::fromConfig` to `\Guzzle\Common\Collection::fromConfig` - -**Before** - -```php -use Guzzle\Service\Inspector; - -class YourClient extends \Guzzle\Service\Client -{ - public static function factory($config = array()) - { - $default = array(); - $required = array('base_url', 'username', 'api_key'); - $config = Inspector::fromConfig($config, $default, $required); - - $client = new self( - $config->get('base_url'), - $config->get('username'), - $config->get('api_key') - ); - $client->setConfig($config); - - $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); - - return $client; - } -``` - -**After** - -```php -use Guzzle\Common\Collection; - -class YourClient extends \Guzzle\Service\Client -{ - public static function factory($config = array()) - { - $default = array(); - $required = array('base_url', 'username', 'api_key'); - $config = Collection::fromConfig($config, $default, $required); - - $client = new self( - $config->get('base_url'), - $config->get('username'), - $config->get('api_key') - ); - $client->setConfig($config); - - $client->setDescription(ServiceDescription::factory(__DIR__ . DIRECTORY_SEPARATOR . 'client.json')); - - return $client; - } -``` - -### Convert XML Service Descriptions to JSON - -**Before** - -```xml - - - - - - Get a list of groups - - - Uses a search query to get a list of groups - - - - Create a group - - - - - Delete a group by ID - - - - - - - Update a group - - - - - - -``` - -**After** - -```json -{ - "name": "Zendesk REST API v2", - "apiVersion": "2012-12-31", - "description":"Provides access to Zendesk views, groups, tickets, ticket fields, and users", - "operations": { - "list_groups": { - "httpMethod":"GET", - "uri": "groups.json", - "summary": "Get a list of groups" - }, - "search_groups":{ - "httpMethod":"GET", - "uri": "search.json?query=\"{query} type:group\"", - "summary": "Uses a search query to get a list of groups", - "parameters":{ - "query":{ - "location": "uri", - "description":"Zendesk Search Query", - "type": "string", - "required": true - } - } - }, - "create_group": { - "httpMethod":"POST", - "uri": "groups.json", - "summary": "Create a group", - "parameters":{ - "data": { - "type": "array", - "location": "body", - "description":"Group JSON", - "filters": "json_encode", - "required": true - }, - "Content-Type":{ - "type": "string", - "location":"header", - "static": "application/json" - } - } - }, - "delete_group": { - "httpMethod":"DELETE", - "uri": "groups/{id}.json", - "summary": "Delete a group", - "parameters":{ - "id":{ - "location": "uri", - "description":"Group to delete by ID", - "type": "integer", - "required": true - } - } - }, - "get_group": { - "httpMethod":"GET", - "uri": "groups/{id}.json", - "summary": "Get a ticket", - "parameters":{ - "id":{ - "location": "uri", - "description":"Group to get by ID", - "type": "integer", - "required": true - } - } - }, - "update_group": { - "httpMethod":"PUT", - "uri": "groups/{id}.json", - "summary": "Update a group", - "parameters":{ - "id": { - "location": "uri", - "description":"Group to update by ID", - "type": "integer", - "required": true - }, - "data": { - "type": "array", - "location": "body", - "description":"Group JSON", - "filters": "json_encode", - "required": true - }, - "Content-Type":{ - "type": "string", - "location":"header", - "static": "application/json" - } - } - } -} -``` - -### Guzzle\Service\Description\ServiceDescription - -Commands are now called Operations - -**Before** - -```php -use Guzzle\Service\Description\ServiceDescription; - -$sd = new ServiceDescription(); -$sd->getCommands(); // @returns ApiCommandInterface[] -$sd->hasCommand($name); -$sd->getCommand($name); // @returns ApiCommandInterface|null -$sd->addCommand($command); // @param ApiCommandInterface $command -``` - -**After** - -```php -use Guzzle\Service\Description\ServiceDescription; - -$sd = new ServiceDescription(); -$sd->getOperations(); // @returns OperationInterface[] -$sd->hasOperation($name); -$sd->getOperation($name); // @returns OperationInterface|null -$sd->addOperation($operation); // @param OperationInterface $operation -``` - -### Guzzle\Common\Inflection\Inflector - -Namespace is now `Guzzle\Inflection\Inflector` - -### Guzzle\Http\Plugin - -Namespace is now `Guzzle\Plugin`. Many other changes occur within this namespace and are detailed in their own sections below. - -### Guzzle\Http\Plugin\LogPlugin and Guzzle\Common\Log - -Now `Guzzle\Plugin\Log\LogPlugin` and `Guzzle\Log` respectively. - -**Before** - -```php -use Guzzle\Common\Log\ClosureLogAdapter; -use Guzzle\Http\Plugin\LogPlugin; - -/** @var \Guzzle\Http\Client */ -$client; - -// $verbosity is an integer indicating desired message verbosity level -$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $verbosity = LogPlugin::LOG_VERBOSE); -``` - -**After** - -```php -use Guzzle\Log\ClosureLogAdapter; -use Guzzle\Log\MessageFormatter; -use Guzzle\Plugin\Log\LogPlugin; - -/** @var \Guzzle\Http\Client */ -$client; - -// $format is a string indicating desired message format -- @see MessageFormatter -$client->addSubscriber(new LogPlugin(new ClosureLogAdapter(function($m) { echo $m; }, $format = MessageFormatter::DEBUG_FORMAT); -``` - -### Guzzle\Http\Plugin\CurlAuthPlugin - -Now `Guzzle\Plugin\CurlAuth\CurlAuthPlugin`. - -### Guzzle\Http\Plugin\ExponentialBackoffPlugin - -Now `Guzzle\Plugin\Backoff\BackoffPlugin`, and other changes. - -**Before** - -```php -use Guzzle\Http\Plugin\ExponentialBackoffPlugin; - -$backoffPlugin = new ExponentialBackoffPlugin($maxRetries, array_merge( - ExponentialBackoffPlugin::getDefaultFailureCodes(), array(429) - )); - -$client->addSubscriber($backoffPlugin); -``` - -**After** - -```php -use Guzzle\Plugin\Backoff\BackoffPlugin; -use Guzzle\Plugin\Backoff\HttpBackoffStrategy; - -// Use convenient factory method instead -- see implementation for ideas of what -// you can do with chaining backoff strategies -$backoffPlugin = BackoffPlugin::getExponentialBackoff($maxRetries, array_merge( - HttpBackoffStrategy::getDefaultFailureCodes(), array(429) - )); -$client->addSubscriber($backoffPlugin); -``` - -### Known Issues - -#### [BUG] Accept-Encoding header behavior changed unintentionally. - -(See #217) (Fixed in 09daeb8c666fb44499a0646d655a8ae36456575e) - -In version 2.8 setting the `Accept-Encoding` header would set the CURLOPT_ENCODING option, which permitted cURL to -properly handle gzip/deflate compressed responses from the server. In versions affected by this bug this does not happen. -See issue #217 for a workaround, or use a version containing the fix. diff --git a/tests/integration/vendor/guzzlehttp/guzzle/composer.json b/tests/integration/vendor/guzzlehttp/guzzle/composer.json deleted file mode 100644 index a57d78f..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/composer.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "name": "guzzlehttp/guzzle", - "type": "library", - "description": "Guzzle is a PHP HTTP client library", - "keywords": [ - "framework", - "http", - "rest", - "web service", - "curl", - "client", - "HTTP client" - ], - "homepage": "http://guzzlephp.org/", - "license": "MIT", - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Jeremy Lindblom", - "email": "jeremeamia@gmail.com", - "homepage": "https://github.com/jeremeamia" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "require": { - "php": ">=5.5", - "ext-json": "*", - "symfony/polyfill-intl-idn": "^1.17", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.9" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.1" - }, - "suggest": { - "psr/log": "Required for using the Log middleware" - }, - "config": { - "sort-packages": true, - "allow-plugins": { - "bamarni/composer-bin-plugin": true - } - }, - "extra": { - "branch-alias": { - "dev-master": "6.5-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\Tests\\": "tests/" - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Client.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Client.php deleted file mode 100644 index 315a022..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Client.php +++ /dev/null @@ -1,501 +0,0 @@ - 'http://www.foo.com/1.0/', - * 'timeout' => 0, - * 'allow_redirects' => false, - * 'proxy' => '192.168.16.1:10' - * ]); - * - * Client configuration settings include the following options: - * - * - handler: (callable) Function that transfers HTTP requests over the - * wire. The function is called with a Psr7\Http\Message\RequestInterface - * and array of transfer options, and must return a - * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a - * Psr7\Http\Message\ResponseInterface on success. - * If no handler is provided, a default handler will be created - * that enables all of the request options below by attaching all of the - * default middleware to the handler. - * - base_uri: (string|UriInterface) Base URI of the client that is merged - * into relative URIs. Can be a string or instance of UriInterface. - * - **: any request option - * - * @param array $config Client configuration settings. - * - * @see \GuzzleHttp\RequestOptions for a list of available request options. - */ - public function __construct(array $config = []) - { - if (!isset($config['handler'])) { - $config['handler'] = HandlerStack::create(); - } elseif (!is_callable($config['handler'])) { - throw new \InvalidArgumentException('handler must be a callable'); - } - - // Convert the base_uri to a UriInterface - if (isset($config['base_uri'])) { - $config['base_uri'] = Psr7\uri_for($config['base_uri']); - } - - $this->configureDefaults($config); - } - - /** - * @param string $method - * @param array $args - * - * @return Promise\PromiseInterface - */ - public function __call($method, $args) - { - if (count($args) < 1) { - throw new \InvalidArgumentException('Magic request methods require a URI and optional options array'); - } - - $uri = $args[0]; - $opts = isset($args[1]) ? $args[1] : []; - - return substr($method, -5) === 'Async' - ? $this->requestAsync(substr($method, 0, -5), $uri, $opts) - : $this->request($method, $uri, $opts); - } - - /** - * Asynchronously send an HTTP request. - * - * @param array $options Request options to apply to the given - * request and to the transfer. See \GuzzleHttp\RequestOptions. - * - * @return Promise\PromiseInterface - */ - public function sendAsync(RequestInterface $request, array $options = []) - { - // Merge the base URI into the request URI if needed. - $options = $this->prepareDefaults($options); - - return $this->transfer( - $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), - $options - ); - } - - /** - * Send an HTTP request. - * - * @param array $options Request options to apply to the given - * request and to the transfer. See \GuzzleHttp\RequestOptions. - * - * @return ResponseInterface - * @throws GuzzleException - */ - public function send(RequestInterface $request, array $options = []) - { - $options[RequestOptions::SYNCHRONOUS] = true; - return $this->sendAsync($request, $options)->wait(); - } - - /** - * Create and send an asynchronous HTTP request. - * - * Use an absolute path to override the base path of the client, or a - * relative path to append to the base path of the client. The URL can - * contain the query string as well. Use an array to provide a URL - * template and additional variables to use in the URL template expansion. - * - * @param string $method HTTP method - * @param string|UriInterface $uri URI object or string. - * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. - * - * @return Promise\PromiseInterface - */ - public function requestAsync($method, $uri = '', array $options = []) - { - $options = $this->prepareDefaults($options); - // Remove request modifying parameter because it can be done up-front. - $headers = isset($options['headers']) ? $options['headers'] : []; - $body = isset($options['body']) ? $options['body'] : null; - $version = isset($options['version']) ? $options['version'] : '1.1'; - // Merge the URI into the base URI. - $uri = $this->buildUri($uri, $options); - if (is_array($body)) { - $this->invalidBody(); - } - $request = new Psr7\Request($method, $uri, $headers, $body, $version); - // Remove the option so that they are not doubly-applied. - unset($options['headers'], $options['body'], $options['version']); - - return $this->transfer($request, $options); - } - - /** - * Create and send an HTTP request. - * - * Use an absolute path to override the base path of the client, or a - * relative path to append to the base path of the client. The URL can - * contain the query string as well. - * - * @param string $method HTTP method. - * @param string|UriInterface $uri URI object or string. - * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. - * - * @return ResponseInterface - * @throws GuzzleException - */ - public function request($method, $uri = '', array $options = []) - { - $options[RequestOptions::SYNCHRONOUS] = true; - return $this->requestAsync($method, $uri, $options)->wait(); - } - - /** - * Get a client configuration option. - * - * These options include default request options of the client, a "handler" - * (if utilized by the concrete client), and a "base_uri" if utilized by - * the concrete client. - * - * @param string|null $option The config option to retrieve. - * - * @return mixed - */ - public function getConfig($option = null) - { - return $option === null - ? $this->config - : (isset($this->config[$option]) ? $this->config[$option] : null); - } - - /** - * @param string|null $uri - * - * @return UriInterface - */ - private function buildUri($uri, array $config) - { - // for BC we accept null which would otherwise fail in uri_for - $uri = Psr7\uri_for($uri === null ? '' : $uri); - - if (isset($config['base_uri'])) { - $uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri); - } - - if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) { - $idnOptions = ($config['idn_conversion'] === true) ? IDNA_DEFAULT : $config['idn_conversion']; - $uri = Utils::idnUriConvert($uri, $idnOptions); - } - - return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; - } - - /** - * Configures the default options for a client. - * - * @param array $config - * @return void - */ - private function configureDefaults(array $config) - { - $defaults = [ - 'allow_redirects' => RedirectMiddleware::$defaultSettings, - 'http_errors' => true, - 'decode_content' => true, - 'verify' => true, - 'cookies' => false, - 'idn_conversion' => true, - ]; - - // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. - - // We can only trust the HTTP_PROXY environment variable in a CLI - // process due to the fact that PHP has no reliable mechanism to - // get environment variables that start with "HTTP_". - if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) { - $defaults['proxy']['http'] = getenv('HTTP_PROXY'); - } - - if ($proxy = getenv('HTTPS_PROXY')) { - $defaults['proxy']['https'] = $proxy; - } - - if ($noProxy = getenv('NO_PROXY')) { - $cleanedNoProxy = str_replace(' ', '', $noProxy); - $defaults['proxy']['no'] = explode(',', $cleanedNoProxy); - } - - $this->config = $config + $defaults; - - if (!empty($config['cookies']) && $config['cookies'] === true) { - $this->config['cookies'] = new CookieJar(); - } - - // Add the default user-agent header. - if (!isset($this->config['headers'])) { - $this->config['headers'] = ['User-Agent' => default_user_agent()]; - } else { - // Add the User-Agent header if one was not already set. - foreach (array_keys($this->config['headers']) as $name) { - if (strtolower($name) === 'user-agent') { - return; - } - } - $this->config['headers']['User-Agent'] = default_user_agent(); - } - } - - /** - * Merges default options into the array. - * - * @param array $options Options to modify by reference - * - * @return array - */ - private function prepareDefaults(array $options) - { - $defaults = $this->config; - - if (!empty($defaults['headers'])) { - // Default headers are only added if they are not present. - $defaults['_conditional'] = $defaults['headers']; - unset($defaults['headers']); - } - - // Special handling for headers is required as they are added as - // conditional headers and as headers passed to a request ctor. - if (array_key_exists('headers', $options)) { - // Allows default headers to be unset. - if ($options['headers'] === null) { - $defaults['_conditional'] = []; - unset($options['headers']); - } elseif (!is_array($options['headers'])) { - throw new \InvalidArgumentException('headers must be an array'); - } - } - - // Shallow merge defaults underneath options. - $result = $options + $defaults; - - // Remove null values. - foreach ($result as $k => $v) { - if ($v === null) { - unset($result[$k]); - } - } - - return $result; - } - - /** - * Transfers the given request and applies request options. - * - * The URI of the request is not modified and the request options are used - * as-is without merging in default options. - * - * @param array $options See \GuzzleHttp\RequestOptions. - * - * @return Promise\PromiseInterface - */ - private function transfer(RequestInterface $request, array $options) - { - // save_to -> sink - if (isset($options['save_to'])) { - $options['sink'] = $options['save_to']; - unset($options['save_to']); - } - - // exceptions -> http_errors - if (isset($options['exceptions'])) { - $options['http_errors'] = $options['exceptions']; - unset($options['exceptions']); - } - - $request = $this->applyOptions($request, $options); - /** @var HandlerStack $handler */ - $handler = $options['handler']; - - try { - return Promise\promise_for($handler($request, $options)); - } catch (\Exception $e) { - return Promise\rejection_for($e); - } - } - - /** - * Applies the array of request options to a request. - * - * @param RequestInterface $request - * @param array $options - * - * @return RequestInterface - */ - private function applyOptions(RequestInterface $request, array &$options) - { - $modify = [ - 'set_headers' => [], - ]; - - if (isset($options['headers'])) { - $modify['set_headers'] = $options['headers']; - unset($options['headers']); - } - - if (isset($options['form_params'])) { - if (isset($options['multipart'])) { - throw new \InvalidArgumentException('You cannot use ' - . 'form_params and multipart at the same time. Use the ' - . 'form_params option if you want to send application/' - . 'x-www-form-urlencoded requests, and the multipart ' - . 'option to send multipart/form-data requests.'); - } - $options['body'] = http_build_query($options['form_params'], '', '&'); - unset($options['form_params']); - // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); - $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; - } - - if (isset($options['multipart'])) { - $options['body'] = new Psr7\MultipartStream($options['multipart']); - unset($options['multipart']); - } - - if (isset($options['json'])) { - $options['body'] = \GuzzleHttp\json_encode($options['json']); - unset($options['json']); - // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); - $options['_conditional']['Content-Type'] = 'application/json'; - } - - if (!empty($options['decode_content']) - && $options['decode_content'] !== true - ) { - // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']); - $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; - } - - if (isset($options['body'])) { - if (is_array($options['body'])) { - $this->invalidBody(); - } - $modify['body'] = Psr7\stream_for($options['body']); - unset($options['body']); - } - - if (!empty($options['auth']) && is_array($options['auth'])) { - $value = $options['auth']; - $type = isset($value[2]) ? strtolower($value[2]) : 'basic'; - switch ($type) { - case 'basic': - // Ensure that we don't have the header in different case and set the new value. - $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']); - $modify['set_headers']['Authorization'] = 'Basic ' - . base64_encode("$value[0]:$value[1]"); - break; - case 'digest': - // @todo: Do not rely on curl - $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST; - $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]"; - break; - case 'ntlm': - $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_NTLM; - $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]"; - break; - } - } - - if (isset($options['query'])) { - $value = $options['query']; - if (is_array($value)) { - $value = http_build_query($value, null, '&', PHP_QUERY_RFC3986); - } - if (!is_string($value)) { - throw new \InvalidArgumentException('query must be a string or array'); - } - $modify['query'] = $value; - unset($options['query']); - } - - // Ensure that sink is not an invalid value. - if (isset($options['sink'])) { - // TODO: Add more sink validation? - if (is_bool($options['sink'])) { - throw new \InvalidArgumentException('sink must not be a boolean'); - } - } - - $request = Psr7\modify_request($request, $modify); - if ($request->getBody() instanceof Psr7\MultipartStream) { - // Use a multipart/form-data POST if a Content-Type is not set. - // Ensure that we don't have the header in different case and set the new value. - $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); - $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' - . $request->getBody()->getBoundary(); - } - - // Merge in conditional headers if they are not present. - if (isset($options['_conditional'])) { - // Build up the changes so it's in a single clone of the message. - $modify = []; - foreach ($options['_conditional'] as $k => $v) { - if (!$request->hasHeader($k)) { - $modify['set_headers'][$k] = $v; - } - } - $request = Psr7\modify_request($request, $modify); - // Don't pass this internal value along to middleware/handlers. - unset($options['_conditional']); - } - - return $request; - } - - /** - * Throw Exception with pre-set message. - * @return void - * @throws \InvalidArgumentException Invalid body. - */ - private function invalidBody() - { - throw new \InvalidArgumentException('Passing in the "body" request ' - . 'option as an array to send a POST request has been deprecated. ' - . 'Please use the "form_params" request option to send a ' - . 'application/x-www-form-urlencoded request, or the "multipart" ' - . 'request option to send a multipart/form-data request.'); - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/tests/integration/vendor/guzzlehttp/guzzle/src/ClientInterface.php deleted file mode 100644 index 638b75d..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/ClientInterface.php +++ /dev/null @@ -1,87 +0,0 @@ -strictMode = $strictMode; - - foreach ($cookieArray as $cookie) { - if (!($cookie instanceof SetCookie)) { - $cookie = new SetCookie($cookie); - } - $this->setCookie($cookie); - } - } - - /** - * Create a new Cookie jar from an associative array and domain. - * - * @param array $cookies Cookies to create the jar from - * @param string $domain Domain to set the cookies to - * - * @return self - */ - public static function fromArray(array $cookies, $domain) - { - $cookieJar = new self(); - foreach ($cookies as $name => $value) { - $cookieJar->setCookie(new SetCookie([ - 'Domain' => $domain, - 'Name' => $name, - 'Value' => $value, - 'Discard' => true - ])); - } - - return $cookieJar; - } - - /** - * @deprecated - */ - public static function getCookieValue($value) - { - return $value; - } - - /** - * Evaluate if this cookie should be persisted to storage - * that survives between requests. - * - * @param SetCookie $cookie Being evaluated. - * @param bool $allowSessionCookies If we should persist session cookies - * @return bool - */ - public static function shouldPersist( - SetCookie $cookie, - $allowSessionCookies = false - ) { - if ($cookie->getExpires() || $allowSessionCookies) { - if (!$cookie->getDiscard()) { - return true; - } - } - - return false; - } - - /** - * Finds and returns the cookie based on the name - * - * @param string $name cookie name to search for - * @return SetCookie|null cookie that was found or null if not found - */ - public function getCookieByName($name) - { - // don't allow a non string name - if ($name === null || !is_scalar($name)) { - return null; - } - foreach ($this->cookies as $cookie) { - if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { - return $cookie; - } - } - - return null; - } - - public function toArray() - { - return array_map(function (SetCookie $cookie) { - return $cookie->toArray(); - }, $this->getIterator()->getArrayCopy()); - } - - public function clear($domain = null, $path = null, $name = null) - { - if (!$domain) { - $this->cookies = []; - return; - } elseif (!$path) { - $this->cookies = array_filter( - $this->cookies, - function (SetCookie $cookie) use ($domain) { - return !$cookie->matchesDomain($domain); - } - ); - } elseif (!$name) { - $this->cookies = array_filter( - $this->cookies, - function (SetCookie $cookie) use ($path, $domain) { - return !($cookie->matchesPath($path) && - $cookie->matchesDomain($domain)); - } - ); - } else { - $this->cookies = array_filter( - $this->cookies, - function (SetCookie $cookie) use ($path, $domain, $name) { - return !($cookie->getName() == $name && - $cookie->matchesPath($path) && - $cookie->matchesDomain($domain)); - } - ); - } - } - - public function clearSessionCookies() - { - $this->cookies = array_filter( - $this->cookies, - function (SetCookie $cookie) { - return !$cookie->getDiscard() && $cookie->getExpires(); - } - ); - } - - public function setCookie(SetCookie $cookie) - { - // If the name string is empty (but not 0), ignore the set-cookie - // string entirely. - $name = $cookie->getName(); - if (!$name && $name !== '0') { - return false; - } - - // Only allow cookies with set and valid domain, name, value - $result = $cookie->validate(); - if ($result !== true) { - if ($this->strictMode) { - throw new \RuntimeException('Invalid cookie: ' . $result); - } else { - $this->removeCookieIfEmpty($cookie); - return false; - } - } - - // Resolve conflicts with previously set cookies - foreach ($this->cookies as $i => $c) { - - // Two cookies are identical, when their path, and domain are - // identical. - if ($c->getPath() != $cookie->getPath() || - $c->getDomain() != $cookie->getDomain() || - $c->getName() != $cookie->getName() - ) { - continue; - } - - // The previously set cookie is a discard cookie and this one is - // not so allow the new cookie to be set - if (!$cookie->getDiscard() && $c->getDiscard()) { - unset($this->cookies[$i]); - continue; - } - - // If the new cookie's expiration is further into the future, then - // replace the old cookie - if ($cookie->getExpires() > $c->getExpires()) { - unset($this->cookies[$i]); - continue; - } - - // If the value has changed, we better change it - if ($cookie->getValue() !== $c->getValue()) { - unset($this->cookies[$i]); - continue; - } - - // The cookie exists, so no need to continue - return false; - } - - $this->cookies[] = $cookie; - - return true; - } - - public function count() - { - return count($this->cookies); - } - - public function getIterator() - { - return new \ArrayIterator(array_values($this->cookies)); - } - - public function extractCookies( - RequestInterface $request, - ResponseInterface $response - ) { - if ($cookieHeader = $response->getHeader('Set-Cookie')) { - foreach ($cookieHeader as $cookie) { - $sc = SetCookie::fromString($cookie); - if (!$sc->getDomain()) { - $sc->setDomain($request->getUri()->getHost()); - } - if (0 !== strpos($sc->getPath(), '/')) { - $sc->setPath($this->getCookiePathFromRequest($request)); - } - if (!$sc->matchesDomain($request->getUri()->getHost())) { - continue; - } - // Note: At this point `$sc->getDomain()` being a public suffix should - // be rejected, but we don't want to pull in the full PSL dependency. - $this->setCookie($sc); - } - } - } - - /** - * Computes cookie path following RFC 6265 section 5.1.4 - * - * @link https://tools.ietf.org/html/rfc6265#section-5.1.4 - * - * @param RequestInterface $request - * @return string - */ - private function getCookiePathFromRequest(RequestInterface $request) - { - $uriPath = $request->getUri()->getPath(); - if ('' === $uriPath) { - return '/'; - } - if (0 !== strpos($uriPath, '/')) { - return '/'; - } - if ('/' === $uriPath) { - return '/'; - } - if (0 === $lastSlashPos = strrpos($uriPath, '/')) { - return '/'; - } - - return substr($uriPath, 0, $lastSlashPos); - } - - public function withCookieHeader(RequestInterface $request) - { - $values = []; - $uri = $request->getUri(); - $scheme = $uri->getScheme(); - $host = $uri->getHost(); - $path = $uri->getPath() ?: '/'; - - foreach ($this->cookies as $cookie) { - if ($cookie->matchesPath($path) && - $cookie->matchesDomain($host) && - !$cookie->isExpired() && - (!$cookie->getSecure() || $scheme === 'https') - ) { - $values[] = $cookie->getName() . '=' - . $cookie->getValue(); - } - } - - return $values - ? $request->withHeader('Cookie', implode('; ', $values)) - : $request; - } - - /** - * If a cookie already exists and the server asks to set it again with a - * null value, the cookie must be deleted. - * - * @param SetCookie $cookie - */ - private function removeCookieIfEmpty(SetCookie $cookie) - { - $cookieValue = $cookie->getValue(); - if ($cookieValue === null || $cookieValue === '') { - $this->clear( - $cookie->getDomain(), - $cookie->getPath(), - $cookie->getName() - ); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php deleted file mode 100644 index 6ee1188..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +++ /dev/null @@ -1,84 +0,0 @@ -filename = $cookieFile; - $this->storeSessionCookies = $storeSessionCookies; - - if (file_exists($cookieFile)) { - $this->load($cookieFile); - } - } - - /** - * Saves the file when shutting down - */ - public function __destruct() - { - $this->save($this->filename); - } - - /** - * Saves the cookies to a file. - * - * @param string $filename File to save - * @throws \RuntimeException if the file cannot be found or created - */ - public function save($filename) - { - $json = []; - foreach ($this as $cookie) { - /** @var SetCookie $cookie */ - if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { - $json[] = $cookie->toArray(); - } - } - - $jsonStr = \GuzzleHttp\json_encode($json); - if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) { - throw new \RuntimeException("Unable to save file {$filename}"); - } - } - - /** - * Load cookies from a JSON formatted file. - * - * Old cookies are kept unless overwritten by newly loaded ones. - * - * @param string $filename Cookie file to load. - * @throws \RuntimeException if the file cannot be loaded. - */ - public function load($filename) - { - $json = file_get_contents($filename); - if (false === $json) { - throw new \RuntimeException("Unable to load file {$filename}"); - } elseif ($json === '') { - return; - } - - $data = \GuzzleHttp\json_decode($json, true); - if (is_array($data)) { - foreach (json_decode($json, true) as $cookie) { - $this->setCookie(new SetCookie($cookie)); - } - } elseif (strlen($data)) { - throw new \RuntimeException("Invalid cookie file: {$filename}"); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php deleted file mode 100644 index 0224a24..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +++ /dev/null @@ -1,72 +0,0 @@ -sessionKey = $sessionKey; - $this->storeSessionCookies = $storeSessionCookies; - $this->load(); - } - - /** - * Saves cookies to session when shutting down - */ - public function __destruct() - { - $this->save(); - } - - /** - * Save cookies to the client session - */ - public function save() - { - $json = []; - foreach ($this as $cookie) { - /** @var SetCookie $cookie */ - if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { - $json[] = $cookie->toArray(); - } - } - - $_SESSION[$this->sessionKey] = json_encode($json); - } - - /** - * Load the contents of the client session into the data array - */ - protected function load() - { - if (!isset($_SESSION[$this->sessionKey])) { - return; - } - $data = json_decode($_SESSION[$this->sessionKey], true); - if (is_array($data)) { - foreach ($data as $cookie) { - $this->setCookie(new SetCookie($cookie)); - } - } elseif (strlen($data)) { - throw new \RuntimeException("Invalid cookie data"); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php deleted file mode 100644 index 55f6901..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +++ /dev/null @@ -1,410 +0,0 @@ - null, - 'Value' => null, - 'Domain' => null, - 'Path' => '/', - 'Max-Age' => null, - 'Expires' => null, - 'Secure' => false, - 'Discard' => false, - 'HttpOnly' => false - ]; - - /** @var array Cookie data */ - private $data; - - /** - * Create a new SetCookie object from a string - * - * @param string $cookie Set-Cookie header string - * - * @return self - */ - public static function fromString($cookie) - { - // Create the default return array - $data = self::$defaults; - // Explode the cookie string using a series of semicolons - $pieces = array_filter(array_map('trim', explode(';', $cookie))); - // The name of the cookie (first kvp) must exist and include an equal sign. - if (empty($pieces[0]) || !strpos($pieces[0], '=')) { - return new self($data); - } - - // Add the cookie pieces into the parsed data array - foreach ($pieces as $part) { - $cookieParts = explode('=', $part, 2); - $key = trim($cookieParts[0]); - $value = isset($cookieParts[1]) - ? trim($cookieParts[1], " \n\r\t\0\x0B") - : true; - - // Only check for non-cookies when cookies have been found - if (empty($data['Name'])) { - $data['Name'] = $key; - $data['Value'] = $value; - } else { - foreach (array_keys(self::$defaults) as $search) { - if (!strcasecmp($search, $key)) { - $data[$search] = $value; - continue 2; - } - } - $data[$key] = $value; - } - } - - return new self($data); - } - - /** - * @param array $data Array of cookie data provided by a Cookie parser - */ - public function __construct(array $data = []) - { - $this->data = array_replace(self::$defaults, $data); - // Extract the Expires value and turn it into a UNIX timestamp if needed - if (!$this->getExpires() && $this->getMaxAge()) { - // Calculate the Expires date - $this->setExpires(time() + $this->getMaxAge()); - } elseif ($this->getExpires() && !is_numeric($this->getExpires())) { - $this->setExpires($this->getExpires()); - } - } - - public function __toString() - { - $str = $this->data['Name'] . '=' . $this->data['Value'] . '; '; - foreach ($this->data as $k => $v) { - if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) { - if ($k === 'Expires') { - $str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; '; - } else { - $str .= ($v === true ? $k : "{$k}={$v}") . '; '; - } - } - } - - return rtrim($str, '; '); - } - - public function toArray() - { - return $this->data; - } - - /** - * Get the cookie name - * - * @return string - */ - public function getName() - { - return $this->data['Name']; - } - - /** - * Set the cookie name - * - * @param string $name Cookie name - */ - public function setName($name) - { - $this->data['Name'] = $name; - } - - /** - * Get the cookie value - * - * @return string - */ - public function getValue() - { - return $this->data['Value']; - } - - /** - * Set the cookie value - * - * @param string $value Cookie value - */ - public function setValue($value) - { - $this->data['Value'] = $value; - } - - /** - * Get the domain - * - * @return string|null - */ - public function getDomain() - { - return $this->data['Domain']; - } - - /** - * Set the domain of the cookie - * - * @param string $domain - */ - public function setDomain($domain) - { - $this->data['Domain'] = $domain; - } - - /** - * Get the path - * - * @return string - */ - public function getPath() - { - return $this->data['Path']; - } - - /** - * Set the path of the cookie - * - * @param string $path Path of the cookie - */ - public function setPath($path) - { - $this->data['Path'] = $path; - } - - /** - * Maximum lifetime of the cookie in seconds - * - * @return int|null - */ - public function getMaxAge() - { - return $this->data['Max-Age']; - } - - /** - * Set the max-age of the cookie - * - * @param int $maxAge Max age of the cookie in seconds - */ - public function setMaxAge($maxAge) - { - $this->data['Max-Age'] = $maxAge; - } - - /** - * The UNIX timestamp when the cookie Expires - * - * @return mixed - */ - public function getExpires() - { - return $this->data['Expires']; - } - - /** - * Set the unix timestamp for which the cookie will expire - * - * @param int $timestamp Unix timestamp - */ - public function setExpires($timestamp) - { - $this->data['Expires'] = is_numeric($timestamp) - ? (int) $timestamp - : strtotime($timestamp); - } - - /** - * Get whether or not this is a secure cookie - * - * @return bool|null - */ - public function getSecure() - { - return $this->data['Secure']; - } - - /** - * Set whether or not the cookie is secure - * - * @param bool $secure Set to true or false if secure - */ - public function setSecure($secure) - { - $this->data['Secure'] = $secure; - } - - /** - * Get whether or not this is a session cookie - * - * @return bool|null - */ - public function getDiscard() - { - return $this->data['Discard']; - } - - /** - * Set whether or not this is a session cookie - * - * @param bool $discard Set to true or false if this is a session cookie - */ - public function setDiscard($discard) - { - $this->data['Discard'] = $discard; - } - - /** - * Get whether or not this is an HTTP only cookie - * - * @return bool - */ - public function getHttpOnly() - { - return $this->data['HttpOnly']; - } - - /** - * Set whether or not this is an HTTP only cookie - * - * @param bool $httpOnly Set to true or false if this is HTTP only - */ - public function setHttpOnly($httpOnly) - { - $this->data['HttpOnly'] = $httpOnly; - } - - /** - * Check if the cookie matches a path value. - * - * A request-path path-matches a given cookie-path if at least one of - * the following conditions holds: - * - * - The cookie-path and the request-path are identical. - * - The cookie-path is a prefix of the request-path, and the last - * character of the cookie-path is %x2F ("/"). - * - The cookie-path is a prefix of the request-path, and the first - * character of the request-path that is not included in the cookie- - * path is a %x2F ("/") character. - * - * @param string $requestPath Path to check against - * - * @return bool - */ - public function matchesPath($requestPath) - { - $cookiePath = $this->getPath(); - - // Match on exact matches or when path is the default empty "/" - if ($cookiePath === '/' || $cookiePath == $requestPath) { - return true; - } - - // Ensure that the cookie-path is a prefix of the request path. - if (0 !== strpos($requestPath, $cookiePath)) { - return false; - } - - // Match if the last character of the cookie-path is "/" - if (substr($cookiePath, -1, 1) === '/') { - return true; - } - - // Match if the first character not included in cookie path is "/" - return substr($requestPath, strlen($cookiePath), 1) === '/'; - } - - /** - * Check if the cookie matches a domain value - * - * @param string $domain Domain to check against - * - * @return bool - */ - public function matchesDomain($domain) - { - $cookieDomain = $this->getDomain(); - if (null === $cookieDomain) { - return true; - } - - // Remove the leading '.' as per spec in RFC 6265. - // http://tools.ietf.org/html/rfc6265#section-5.2.3 - $cookieDomain = ltrim(strtolower($cookieDomain), '.'); - - $domain = strtolower($domain); - - // Domain not set or exact match. - if ('' === $cookieDomain || $domain === $cookieDomain) { - return true; - } - - // Matching the subdomain according to RFC 6265. - // http://tools.ietf.org/html/rfc6265#section-5.1.3 - if (filter_var($domain, FILTER_VALIDATE_IP)) { - return false; - } - - return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain); - } - - /** - * Check if the cookie is expired - * - * @return bool - */ - public function isExpired() - { - return $this->getExpires() !== null && time() > $this->getExpires(); - } - - /** - * Check if the cookie is valid according to RFC 6265 - * - * @return bool|string Returns true if valid or an error message if invalid - */ - public function validate() - { - // Names must not be empty, but can be 0 - $name = $this->getName(); - if (empty($name) && !is_numeric($name)) { - return 'The cookie name must not be empty'; - } - - // Check if any of the invalid characters are present in the cookie name - if (preg_match( - '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/', - $name - )) { - return 'Cookie name must not contain invalid characters: ASCII ' - . 'Control characters (0-31;127), space, tab and the ' - . 'following characters: ()<>@,;:\"/?={}'; - } - - // Value must not be empty, but can be 0 - $value = $this->getValue(); - if (empty($value) && !is_numeric($value)) { - return 'The cookie value must not be empty'; - } - - // Domains must not be empty, but can be 0 - // A "0" is not a valid internet domain, but may be used as server name - // in a private network. - $domain = $this->getDomain(); - if (empty($domain) && !is_numeric($domain)) { - return 'The cookie domain must not be empty'; - } - - return true; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php deleted file mode 100644 index 427d896..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php +++ /dev/null @@ -1,27 +0,0 @@ -getStatusCode() - : 0; - parent::__construct($message, $code, $previous); - $this->request = $request; - $this->response = $response; - $this->handlerContext = $handlerContext; - } - - /** - * Wrap non-RequestExceptions with a RequestException - * - * @param RequestInterface $request - * @param \Exception $e - * - * @return RequestException - */ - public static function wrapException(RequestInterface $request, \Exception $e) - { - return $e instanceof RequestException - ? $e - : new RequestException($e->getMessage(), $request, null, $e); - } - - /** - * Factory method to create a new exception with a normalized error message - * - * @param RequestInterface $request Request - * @param ResponseInterface $response Response received - * @param \Exception $previous Previous exception - * @param array $ctx Optional handler context. - * - * @return self - */ - public static function create( - RequestInterface $request, - ResponseInterface $response = null, - \Exception $previous = null, - array $ctx = [] - ) { - if (!$response) { - return new self( - 'Error completing request', - $request, - null, - $previous, - $ctx - ); - } - - $level = (int) floor($response->getStatusCode() / 100); - if ($level === 4) { - $label = 'Client error'; - $className = ClientException::class; - } elseif ($level === 5) { - $label = 'Server error'; - $className = ServerException::class; - } else { - $label = 'Unsuccessful request'; - $className = __CLASS__; - } - - $uri = $request->getUri(); - $uri = static::obfuscateUri($uri); - - // Client Error: `GET /` resulted in a `404 Not Found` response: - // ... (truncated) - $message = sprintf( - '%s: `%s %s` resulted in a `%s %s` response', - $label, - $request->getMethod(), - $uri, - $response->getStatusCode(), - $response->getReasonPhrase() - ); - - $summary = static::getResponseBodySummary($response); - - if ($summary !== null) { - $message .= ":\n{$summary}\n"; - } - - return new $className($message, $request, $response, $previous, $ctx); - } - - /** - * Get a short summary of the response - * - * Will return `null` if the response is not printable. - * - * @param ResponseInterface $response - * - * @return string|null - */ - public static function getResponseBodySummary(ResponseInterface $response) - { - return \GuzzleHttp\Psr7\get_message_body_summary($response); - } - - /** - * Obfuscates URI if there is a username and a password present - * - * @param UriInterface $uri - * - * @return UriInterface - */ - private static function obfuscateUri(UriInterface $uri) - { - $userInfo = $uri->getUserInfo(); - - if (false !== ($pos = strpos($userInfo, ':'))) { - return $uri->withUserInfo(substr($userInfo, 0, $pos), '***'); - } - - return $uri; - } - - /** - * Get the request that caused the exception - * - * @return RequestInterface - */ - public function getRequest() - { - return $this->request; - } - - /** - * Get the associated response - * - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - - /** - * Check if a response was received - * - * @return bool - */ - public function hasResponse() - { - return $this->response !== null; - } - - /** - * Get contextual information about the error from the underlying handler. - * - * The contents of this array will vary depending on which handler you are - * using. It may also be just an empty array. Relying on this data will - * couple you to a specific handler, but can give more debug information - * when needed. - * - * @return array - */ - public function getHandlerContext() - { - return $this->handlerContext; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php deleted file mode 100644 index a77c289..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php +++ /dev/null @@ -1,27 +0,0 @@ -stream = $stream; - $msg = $msg ?: 'Could not seek the stream to position ' . $pos; - parent::__construct($msg); - } - - /** - * @return StreamInterface - */ - public function getStream() - { - return $this->stream; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php deleted file mode 100644 index 127094c..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php +++ /dev/null @@ -1,9 +0,0 @@ -maxHandles = $maxHandles; - } - - public function create(RequestInterface $request, array $options) - { - if (isset($options['curl']['body_as_string'])) { - $options['_body_as_string'] = $options['curl']['body_as_string']; - unset($options['curl']['body_as_string']); - } - - $easy = new EasyHandle; - $easy->request = $request; - $easy->options = $options; - $conf = $this->getDefaultConf($easy); - $this->applyMethod($easy, $conf); - $this->applyHandlerOptions($easy, $conf); - $this->applyHeaders($easy, $conf); - unset($conf['_headers']); - - // Add handler options from the request configuration options - if (isset($options['curl'])) { - $conf = array_replace($conf, $options['curl']); - } - - $conf[CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); - $easy->handle = $this->handles - ? array_pop($this->handles) - : curl_init(); - curl_setopt_array($easy->handle, $conf); - - return $easy; - } - - public function release(EasyHandle $easy) - { - $resource = $easy->handle; - unset($easy->handle); - - if (count($this->handles) >= $this->maxHandles) { - curl_close($resource); - } else { - // Remove all callback functions as they can hold onto references - // and are not cleaned up by curl_reset. Using curl_setopt_array - // does not work for some reason, so removing each one - // individually. - curl_setopt($resource, CURLOPT_HEADERFUNCTION, null); - curl_setopt($resource, CURLOPT_READFUNCTION, null); - curl_setopt($resource, CURLOPT_WRITEFUNCTION, null); - curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null); - curl_reset($resource); - $this->handles[] = $resource; - } - } - - /** - * Completes a cURL transaction, either returning a response promise or a - * rejected promise. - * - * @param callable $handler - * @param EasyHandle $easy - * @param CurlFactoryInterface $factory Dictates how the handle is released - * - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public static function finish( - callable $handler, - EasyHandle $easy, - CurlFactoryInterface $factory - ) { - if (isset($easy->options['on_stats'])) { - self::invokeStats($easy); - } - - if (!$easy->response || $easy->errno) { - return self::finishError($handler, $easy, $factory); - } - - // Return the response if it is present and there is no error. - $factory->release($easy); - - // Rewind the body of the response if possible. - $body = $easy->response->getBody(); - if ($body->isSeekable()) { - $body->rewind(); - } - - return new FulfilledPromise($easy->response); - } - - private static function invokeStats(EasyHandle $easy) - { - $curlStats = curl_getinfo($easy->handle); - $curlStats['appconnect_time'] = curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME); - $stats = new TransferStats( - $easy->request, - $easy->response, - $curlStats['total_time'], - $easy->errno, - $curlStats - ); - call_user_func($easy->options['on_stats'], $stats); - } - - private static function finishError( - callable $handler, - EasyHandle $easy, - CurlFactoryInterface $factory - ) { - // Get error information and release the handle to the factory. - $ctx = [ - 'errno' => $easy->errno, - 'error' => curl_error($easy->handle), - 'appconnect_time' => curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME), - ] + curl_getinfo($easy->handle); - $ctx[self::CURL_VERSION_STR] = curl_version()['version']; - $factory->release($easy); - - // Retry when nothing is present or when curl failed to rewind. - if (empty($easy->options['_err_message']) - && (!$easy->errno || $easy->errno == 65) - ) { - return self::retryFailedRewind($handler, $easy, $ctx); - } - - return self::createRejection($easy, $ctx); - } - - private static function createRejection(EasyHandle $easy, array $ctx) - { - static $connectionErrors = [ - CURLE_OPERATION_TIMEOUTED => true, - CURLE_COULDNT_RESOLVE_HOST => true, - CURLE_COULDNT_CONNECT => true, - CURLE_SSL_CONNECT_ERROR => true, - CURLE_GOT_NOTHING => true, - ]; - - // If an exception was encountered during the onHeaders event, then - // return a rejected promise that wraps that exception. - if ($easy->onHeadersException) { - return \GuzzleHttp\Promise\rejection_for( - new RequestException( - 'An error was encountered during the on_headers event', - $easy->request, - $easy->response, - $easy->onHeadersException, - $ctx - ) - ); - } - if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) { - $message = sprintf( - 'cURL error %s: %s (%s)', - $ctx['errno'], - $ctx['error'], - 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html' - ); - } else { - $message = sprintf( - 'cURL error %s: %s (%s) for %s', - $ctx['errno'], - $ctx['error'], - 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html', - $easy->request->getUri() - ); - } - - // Create a connection exception if it was a specific error code. - $error = isset($connectionErrors[$easy->errno]) - ? new ConnectException($message, $easy->request, null, $ctx) - : new RequestException($message, $easy->request, $easy->response, null, $ctx); - - return \GuzzleHttp\Promise\rejection_for($error); - } - - private function getDefaultConf(EasyHandle $easy) - { - $conf = [ - '_headers' => $easy->request->getHeaders(), - CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), - CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), - CURLOPT_RETURNTRANSFER => false, - CURLOPT_HEADER => false, - CURLOPT_CONNECTTIMEOUT => 150, - ]; - - if (defined('CURLOPT_PROTOCOLS')) { - $conf[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; - } - - $version = $easy->request->getProtocolVersion(); - if ($version == 1.1) { - $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; - } elseif ($version == 2.0) { - $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; - } else { - $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; - } - - return $conf; - } - - private function applyMethod(EasyHandle $easy, array &$conf) - { - $body = $easy->request->getBody(); - $size = $body->getSize(); - - if ($size === null || $size > 0) { - $this->applyBody($easy->request, $easy->options, $conf); - return; - } - - $method = $easy->request->getMethod(); - if ($method === 'PUT' || $method === 'POST') { - // See http://tools.ietf.org/html/rfc7230#section-3.3.2 - if (!$easy->request->hasHeader('Content-Length')) { - $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; - } - } elseif ($method === 'HEAD') { - $conf[CURLOPT_NOBODY] = true; - unset( - $conf[CURLOPT_WRITEFUNCTION], - $conf[CURLOPT_READFUNCTION], - $conf[CURLOPT_FILE], - $conf[CURLOPT_INFILE] - ); - } - } - - private function applyBody(RequestInterface $request, array $options, array &$conf) - { - $size = $request->hasHeader('Content-Length') - ? (int) $request->getHeaderLine('Content-Length') - : null; - - // Send the body as a string if the size is less than 1MB OR if the - // [curl][body_as_string] request value is set. - if (($size !== null && $size < 1000000) || - !empty($options['_body_as_string']) - ) { - $conf[CURLOPT_POSTFIELDS] = (string) $request->getBody(); - // Don't duplicate the Content-Length header - $this->removeHeader('Content-Length', $conf); - $this->removeHeader('Transfer-Encoding', $conf); - } else { - $conf[CURLOPT_UPLOAD] = true; - if ($size !== null) { - $conf[CURLOPT_INFILESIZE] = $size; - $this->removeHeader('Content-Length', $conf); - } - $body = $request->getBody(); - if ($body->isSeekable()) { - $body->rewind(); - } - $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { - return $body->read($length); - }; - } - - // If the Expect header is not present, prevent curl from adding it - if (!$request->hasHeader('Expect')) { - $conf[CURLOPT_HTTPHEADER][] = 'Expect:'; - } - - // cURL sometimes adds a content-type by default. Prevent this. - if (!$request->hasHeader('Content-Type')) { - $conf[CURLOPT_HTTPHEADER][] = 'Content-Type:'; - } - } - - private function applyHeaders(EasyHandle $easy, array &$conf) - { - foreach ($conf['_headers'] as $name => $values) { - foreach ($values as $value) { - $value = (string) $value; - if ($value === '') { - // cURL requires a special format for empty headers. - // See https://github.com/guzzle/guzzle/issues/1882 for more details. - $conf[CURLOPT_HTTPHEADER][] = "$name;"; - } else { - $conf[CURLOPT_HTTPHEADER][] = "$name: $value"; - } - } - } - - // Remove the Accept header if one was not set - if (!$easy->request->hasHeader('Accept')) { - $conf[CURLOPT_HTTPHEADER][] = 'Accept:'; - } - } - - /** - * Remove a header from the options array. - * - * @param string $name Case-insensitive header to remove - * @param array $options Array of options to modify - */ - private function removeHeader($name, array &$options) - { - foreach (array_keys($options['_headers']) as $key) { - if (!strcasecmp($key, $name)) { - unset($options['_headers'][$key]); - return; - } - } - } - - private function applyHandlerOptions(EasyHandle $easy, array &$conf) - { - $options = $easy->options; - if (isset($options['verify'])) { - if ($options['verify'] === false) { - unset($conf[CURLOPT_CAINFO]); - $conf[CURLOPT_SSL_VERIFYHOST] = 0; - $conf[CURLOPT_SSL_VERIFYPEER] = false; - } else { - $conf[CURLOPT_SSL_VERIFYHOST] = 2; - $conf[CURLOPT_SSL_VERIFYPEER] = true; - if (is_string($options['verify'])) { - // Throw an error if the file/folder/link path is not valid or doesn't exist. - if (!file_exists($options['verify'])) { - throw new \InvalidArgumentException( - "SSL CA bundle not found: {$options['verify']}" - ); - } - // If it's a directory or a link to a directory use CURLOPT_CAPATH. - // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO. - if (is_dir($options['verify']) || - (is_link($options['verify']) && is_dir(readlink($options['verify'])))) { - $conf[CURLOPT_CAPATH] = $options['verify']; - } else { - $conf[CURLOPT_CAINFO] = $options['verify']; - } - } - } - } - - if (!empty($options['decode_content'])) { - $accept = $easy->request->getHeaderLine('Accept-Encoding'); - if ($accept) { - $conf[CURLOPT_ENCODING] = $accept; - } else { - $conf[CURLOPT_ENCODING] = ''; - // Don't let curl send the header over the wire - $conf[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; - } - } - - if (isset($options['sink'])) { - $sink = $options['sink']; - if (!is_string($sink)) { - $sink = \GuzzleHttp\Psr7\stream_for($sink); - } elseif (!is_dir(dirname($sink))) { - // Ensure that the directory exists before failing in curl. - throw new \RuntimeException(sprintf( - 'Directory %s does not exist for sink value of %s', - dirname($sink), - $sink - )); - } else { - $sink = new LazyOpenStream($sink, 'w+'); - } - $easy->sink = $sink; - $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) { - return $sink->write($write); - }; - } else { - // Use a default temp stream if no sink was set. - $conf[CURLOPT_FILE] = fopen('php://temp', 'w+'); - $easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]); - } - $timeoutRequiresNoSignal = false; - if (isset($options['timeout'])) { - $timeoutRequiresNoSignal |= $options['timeout'] < 1; - $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; - } - - // CURL default value is CURL_IPRESOLVE_WHATEVER - if (isset($options['force_ip_resolve'])) { - if ('v4' === $options['force_ip_resolve']) { - $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; - } elseif ('v6' === $options['force_ip_resolve']) { - $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; - } - } - - if (isset($options['connect_timeout'])) { - $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; - $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; - } - - if ($timeoutRequiresNoSignal && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $conf[CURLOPT_NOSIGNAL] = true; - } - - if (isset($options['proxy'])) { - if (!is_array($options['proxy'])) { - $conf[CURLOPT_PROXY] = $options['proxy']; - } else { - $scheme = $easy->request->getUri()->getScheme(); - if (isset($options['proxy'][$scheme])) { - $host = $easy->request->getUri()->getHost(); - if (!isset($options['proxy']['no']) || - !\GuzzleHttp\is_host_in_noproxy($host, $options['proxy']['no']) - ) { - $conf[CURLOPT_PROXY] = $options['proxy'][$scheme]; - } - } - } - } - - if (isset($options['cert'])) { - $cert = $options['cert']; - if (is_array($cert)) { - $conf[CURLOPT_SSLCERTPASSWD] = $cert[1]; - $cert = $cert[0]; - } - if (!file_exists($cert)) { - throw new \InvalidArgumentException( - "SSL certificate not found: {$cert}" - ); - } - $conf[CURLOPT_SSLCERT] = $cert; - } - - if (isset($options['ssl_key'])) { - if (is_array($options['ssl_key'])) { - if (count($options['ssl_key']) === 2) { - list($sslKey, $conf[CURLOPT_SSLKEYPASSWD]) = $options['ssl_key']; - } else { - list($sslKey) = $options['ssl_key']; - } - } - - $sslKey = isset($sslKey) ? $sslKey: $options['ssl_key']; - - if (!file_exists($sslKey)) { - throw new \InvalidArgumentException( - "SSL private key not found: {$sslKey}" - ); - } - $conf[CURLOPT_SSLKEY] = $sslKey; - } - - if (isset($options['progress'])) { - $progress = $options['progress']; - if (!is_callable($progress)) { - throw new \InvalidArgumentException( - 'progress client option must be callable' - ); - } - $conf[CURLOPT_NOPROGRESS] = false; - $conf[CURLOPT_PROGRESSFUNCTION] = function () use ($progress) { - $args = func_get_args(); - // PHP 5.5 pushed the handle onto the start of the args - if (is_resource($args[0])) { - array_shift($args); - } - call_user_func_array($progress, $args); - }; - } - - if (!empty($options['debug'])) { - $conf[CURLOPT_STDERR] = \GuzzleHttp\debug_resource($options['debug']); - $conf[CURLOPT_VERBOSE] = true; - } - } - - /** - * This function ensures that a response was set on a transaction. If one - * was not set, then the request is retried if possible. This error - * typically means you are sending a payload, curl encountered a - * "Connection died, retrying a fresh connect" error, tried to rewind the - * stream, and then encountered a "necessary data rewind wasn't possible" - * error, causing the request to be sent through curl_multi_info_read() - * without an error status. - */ - private static function retryFailedRewind( - callable $handler, - EasyHandle $easy, - array $ctx - ) { - try { - // Only rewind if the body has been read from. - $body = $easy->request->getBody(); - if ($body->tell() > 0) { - $body->rewind(); - } - } catch (\RuntimeException $e) { - $ctx['error'] = 'The connection unexpectedly failed without ' - . 'providing an error. The request would have been retried, ' - . 'but attempting to rewind the request body failed. ' - . 'Exception: ' . $e; - return self::createRejection($easy, $ctx); - } - - // Retry no more than 3 times before giving up. - if (!isset($easy->options['_curl_retries'])) { - $easy->options['_curl_retries'] = 1; - } elseif ($easy->options['_curl_retries'] == 2) { - $ctx['error'] = 'The cURL request was retried 3 times ' - . 'and did not succeed. The most likely reason for the failure ' - . 'is that cURL was unable to rewind the body of the request ' - . 'and subsequent retries resulted in the same error. Turn on ' - . 'the debug option to see what went wrong. See ' - . 'https://bugs.php.net/bug.php?id=47204 for more information.'; - return self::createRejection($easy, $ctx); - } else { - $easy->options['_curl_retries']++; - } - - return $handler($easy->request, $easy->options); - } - - private function createHeaderFn(EasyHandle $easy) - { - if (isset($easy->options['on_headers'])) { - $onHeaders = $easy->options['on_headers']; - - if (!is_callable($onHeaders)) { - throw new \InvalidArgumentException('on_headers must be callable'); - } - } else { - $onHeaders = null; - } - - return function ($ch, $h) use ( - $onHeaders, - $easy, - &$startingResponse - ) { - $value = trim($h); - if ($value === '') { - $startingResponse = true; - $easy->createResponse(); - if ($onHeaders !== null) { - try { - $onHeaders($easy->response); - } catch (\Exception $e) { - // Associate the exception with the handle and trigger - // a curl header write error by returning 0. - $easy->onHeadersException = $e; - return -1; - } - } - } elseif ($startingResponse) { - $startingResponse = false; - $easy->headers = [$value]; - } else { - $easy->headers[] = $value; - } - return strlen($h); - }; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php deleted file mode 100644 index b0fc236..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php +++ /dev/null @@ -1,27 +0,0 @@ -factory = isset($options['handle_factory']) - ? $options['handle_factory'] - : new CurlFactory(3); - } - - public function __invoke(RequestInterface $request, array $options) - { - if (isset($options['delay'])) { - usleep($options['delay'] * 1000); - } - - $easy = $this->factory->create($request, $options); - curl_exec($easy->handle); - $easy->errno = curl_errno($easy->handle); - - return CurlFactory::finish($this, $easy, $this->factory); - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php deleted file mode 100644 index 564c95f..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php +++ /dev/null @@ -1,219 +0,0 @@ -factory = isset($options['handle_factory']) - ? $options['handle_factory'] : new CurlFactory(50); - - if (isset($options['select_timeout'])) { - $this->selectTimeout = $options['select_timeout']; - } elseif ($selectTimeout = getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { - $this->selectTimeout = $selectTimeout; - } else { - $this->selectTimeout = 1; - } - - $this->options = isset($options['options']) ? $options['options'] : []; - } - - public function __get($name) - { - if ($name === '_mh') { - $this->_mh = curl_multi_init(); - - foreach ($this->options as $option => $value) { - // A warning is raised in case of a wrong option. - curl_multi_setopt($this->_mh, $option, $value); - } - - // Further calls to _mh will return the value directly, without entering the - // __get() method at all. - return $this->_mh; - } - - throw new \BadMethodCallException(); - } - - public function __destruct() - { - if (isset($this->_mh)) { - curl_multi_close($this->_mh); - unset($this->_mh); - } - } - - public function __invoke(RequestInterface $request, array $options) - { - $easy = $this->factory->create($request, $options); - $id = (int) $easy->handle; - - $promise = new Promise( - [$this, 'execute'], - function () use ($id) { - return $this->cancel($id); - } - ); - - $this->addRequest(['easy' => $easy, 'deferred' => $promise]); - - return $promise; - } - - /** - * Ticks the curl event loop. - */ - public function tick() - { - // Add any delayed handles if needed. - if ($this->delays) { - $currentTime = Utils::currentTime(); - foreach ($this->delays as $id => $delay) { - if ($currentTime >= $delay) { - unset($this->delays[$id]); - curl_multi_add_handle( - $this->_mh, - $this->handles[$id]['easy']->handle - ); - } - } - } - - // Step through the task queue which may add additional requests. - P\queue()->run(); - - if ($this->active && - curl_multi_select($this->_mh, $this->selectTimeout) === -1 - ) { - // Perform a usleep if a select returns -1. - // See: https://bugs.php.net/bug.php?id=61141 - usleep(250); - } - - while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM); - - $this->processMessages(); - } - - /** - * Runs until all outstanding connections have completed. - */ - public function execute() - { - $queue = P\queue(); - - while ($this->handles || !$queue->isEmpty()) { - // If there are no transfers, then sleep for the next delay - if (!$this->active && $this->delays) { - usleep($this->timeToNext()); - } - $this->tick(); - } - } - - private function addRequest(array $entry) - { - $easy = $entry['easy']; - $id = (int) $easy->handle; - $this->handles[$id] = $entry; - if (empty($easy->options['delay'])) { - curl_multi_add_handle($this->_mh, $easy->handle); - } else { - $this->delays[$id] = Utils::currentTime() + ($easy->options['delay'] / 1000); - } - } - - /** - * Cancels a handle from sending and removes references to it. - * - * @param int $id Handle ID to cancel and remove. - * - * @return bool True on success, false on failure. - */ - private function cancel($id) - { - // Cannot cancel if it has been processed. - if (!isset($this->handles[$id])) { - return false; - } - - $handle = $this->handles[$id]['easy']->handle; - unset($this->delays[$id], $this->handles[$id]); - curl_multi_remove_handle($this->_mh, $handle); - curl_close($handle); - - return true; - } - - private function processMessages() - { - while ($done = curl_multi_info_read($this->_mh)) { - $id = (int) $done['handle']; - curl_multi_remove_handle($this->_mh, $done['handle']); - - if (!isset($this->handles[$id])) { - // Probably was cancelled. - continue; - } - - $entry = $this->handles[$id]; - unset($this->handles[$id], $this->delays[$id]); - $entry['easy']->errno = $done['result']; - $entry['deferred']->resolve( - CurlFactory::finish( - $this, - $entry['easy'], - $this->factory - ) - ); - } - } - - private function timeToNext() - { - $currentTime = Utils::currentTime(); - $nextTime = PHP_INT_MAX; - foreach ($this->delays as $time) { - if ($time < $nextTime) { - $nextTime = $time; - } - } - - return max(0, $nextTime - $currentTime) * 1000000; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php deleted file mode 100644 index 7754e91..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php +++ /dev/null @@ -1,92 +0,0 @@ -headers)) { - throw new \RuntimeException('No headers have been received'); - } - - // HTTP-version SP status-code SP reason-phrase - $startLine = explode(' ', array_shift($this->headers), 3); - $headers = \GuzzleHttp\headers_from_lines($this->headers); - $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); - - if (!empty($this->options['decode_content']) - && isset($normalizedKeys['content-encoding']) - ) { - $headers['x-encoded-content-encoding'] - = $headers[$normalizedKeys['content-encoding']]; - unset($headers[$normalizedKeys['content-encoding']]); - if (isset($normalizedKeys['content-length'])) { - $headers['x-encoded-content-length'] - = $headers[$normalizedKeys['content-length']]; - - $bodyLength = (int) $this->sink->getSize(); - if ($bodyLength) { - $headers[$normalizedKeys['content-length']] = $bodyLength; - } else { - unset($headers[$normalizedKeys['content-length']]); - } - } - } - - // Attach a response to the easy handle with the parsed headers. - $this->response = new Response( - $startLine[1], - $headers, - $this->sink, - substr($startLine[0], 5), - isset($startLine[2]) ? (string) $startLine[2] : null - ); - } - - public function __get($name) - { - $msg = $name === 'handle' - ? 'The EasyHandle has been released' - : 'Invalid property: ' . $name; - throw new \BadMethodCallException($msg); - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php deleted file mode 100644 index 5b312bc..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php +++ /dev/null @@ -1,195 +0,0 @@ -onFulfilled = $onFulfilled; - $this->onRejected = $onRejected; - - if ($queue) { - call_user_func_array([$this, 'append'], $queue); - } - } - - public function __invoke(RequestInterface $request, array $options) - { - if (!$this->queue) { - throw new \OutOfBoundsException('Mock queue is empty'); - } - - if (isset($options['delay']) && is_numeric($options['delay'])) { - usleep($options['delay'] * 1000); - } - - $this->lastRequest = $request; - $this->lastOptions = $options; - $response = array_shift($this->queue); - - if (isset($options['on_headers'])) { - if (!is_callable($options['on_headers'])) { - throw new \InvalidArgumentException('on_headers must be callable'); - } - try { - $options['on_headers']($response); - } catch (\Exception $e) { - $msg = 'An error was encountered during the on_headers event'; - $response = new RequestException($msg, $request, $response, $e); - } - } - - if (is_callable($response)) { - $response = call_user_func($response, $request, $options); - } - - $response = $response instanceof \Exception - ? \GuzzleHttp\Promise\rejection_for($response) - : \GuzzleHttp\Promise\promise_for($response); - - return $response->then( - function ($value) use ($request, $options) { - $this->invokeStats($request, $options, $value); - if ($this->onFulfilled) { - call_user_func($this->onFulfilled, $value); - } - if (isset($options['sink'])) { - $contents = (string) $value->getBody(); - $sink = $options['sink']; - - if (is_resource($sink)) { - fwrite($sink, $contents); - } elseif (is_string($sink)) { - file_put_contents($sink, $contents); - } elseif ($sink instanceof \Psr\Http\Message\StreamInterface) { - $sink->write($contents); - } - } - - return $value; - }, - function ($reason) use ($request, $options) { - $this->invokeStats($request, $options, null, $reason); - if ($this->onRejected) { - call_user_func($this->onRejected, $reason); - } - return \GuzzleHttp\Promise\rejection_for($reason); - } - ); - } - - /** - * Adds one or more variadic requests, exceptions, callables, or promises - * to the queue. - */ - public function append() - { - foreach (func_get_args() as $value) { - if ($value instanceof ResponseInterface - || $value instanceof \Exception - || $value instanceof PromiseInterface - || is_callable($value) - ) { - $this->queue[] = $value; - } else { - throw new \InvalidArgumentException('Expected a response or ' - . 'exception. Found ' . \GuzzleHttp\describe_type($value)); - } - } - } - - /** - * Get the last received request. - * - * @return RequestInterface - */ - public function getLastRequest() - { - return $this->lastRequest; - } - - /** - * Get the last received request options. - * - * @return array - */ - public function getLastOptions() - { - return $this->lastOptions; - } - - /** - * Returns the number of remaining items in the queue. - * - * @return int - */ - public function count() - { - return count($this->queue); - } - - public function reset() - { - $this->queue = []; - } - - private function invokeStats( - RequestInterface $request, - array $options, - ResponseInterface $response = null, - $reason = null - ) { - if (isset($options['on_stats'])) { - $transferTime = isset($options['transfer_time']) ? $options['transfer_time'] : 0; - $stats = new TransferStats($request, $response, $transferTime, $reason); - call_user_func($options['on_stats'], $stats); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php deleted file mode 100644 index f8b00be..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php +++ /dev/null @@ -1,55 +0,0 @@ -withoutHeader('Expect'); - - // Append a content-length header if body size is zero to match - // cURL's behavior. - if (0 === $request->getBody()->getSize()) { - $request = $request->withHeader('Content-Length', '0'); - } - - return $this->createResponse( - $request, - $options, - $this->createStream($request, $options), - $startTime - ); - } catch (\InvalidArgumentException $e) { - throw $e; - } catch (\Exception $e) { - // Determine if the error was a networking error. - $message = $e->getMessage(); - // This list can probably get more comprehensive. - if (strpos($message, 'getaddrinfo') // DNS lookup failed - || strpos($message, 'Connection refused') - || strpos($message, "couldn't connect to host") // error on HHVM - || strpos($message, "connection attempt failed") - ) { - $e = new ConnectException($e->getMessage(), $request, $e); - } - $e = RequestException::wrapException($request, $e); - $this->invokeStats($options, $request, $startTime, null, $e); - - return \GuzzleHttp\Promise\rejection_for($e); - } - } - - private function invokeStats( - array $options, - RequestInterface $request, - $startTime, - ResponseInterface $response = null, - $error = null - ) { - if (isset($options['on_stats'])) { - $stats = new TransferStats( - $request, - $response, - Utils::currentTime() - $startTime, - $error, - [] - ); - call_user_func($options['on_stats'], $stats); - } - } - - private function createResponse( - RequestInterface $request, - array $options, - $stream, - $startTime - ) { - $hdrs = $this->lastHeaders; - $this->lastHeaders = []; - $parts = explode(' ', array_shift($hdrs), 3); - $ver = explode('/', $parts[0])[1]; - $status = $parts[1]; - $reason = isset($parts[2]) ? $parts[2] : null; - $headers = \GuzzleHttp\headers_from_lines($hdrs); - list($stream, $headers) = $this->checkDecode($options, $headers, $stream); - $stream = Psr7\stream_for($stream); - $sink = $stream; - - if (strcasecmp('HEAD', $request->getMethod())) { - $sink = $this->createSink($stream, $options); - } - - $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); - - if (isset($options['on_headers'])) { - try { - $options['on_headers']($response); - } catch (\Exception $e) { - $msg = 'An error was encountered during the on_headers event'; - $ex = new RequestException($msg, $request, $response, $e); - return \GuzzleHttp\Promise\rejection_for($ex); - } - } - - // Do not drain when the request is a HEAD request because they have - // no body. - if ($sink !== $stream) { - $this->drain( - $stream, - $sink, - $response->getHeaderLine('Content-Length') - ); - } - - $this->invokeStats($options, $request, $startTime, $response, null); - - return new FulfilledPromise($response); - } - - private function createSink(StreamInterface $stream, array $options) - { - if (!empty($options['stream'])) { - return $stream; - } - - $sink = isset($options['sink']) - ? $options['sink'] - : fopen('php://temp', 'r+'); - - return is_string($sink) - ? new Psr7\LazyOpenStream($sink, 'w+') - : Psr7\stream_for($sink); - } - - private function checkDecode(array $options, array $headers, $stream) - { - // Automatically decode responses when instructed. - if (!empty($options['decode_content'])) { - $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); - if (isset($normalizedKeys['content-encoding'])) { - $encoding = $headers[$normalizedKeys['content-encoding']]; - if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { - $stream = new Psr7\InflateStream( - Psr7\stream_for($stream) - ); - $headers['x-encoded-content-encoding'] - = $headers[$normalizedKeys['content-encoding']]; - // Remove content-encoding header - unset($headers[$normalizedKeys['content-encoding']]); - // Fix content-length header - if (isset($normalizedKeys['content-length'])) { - $headers['x-encoded-content-length'] - = $headers[$normalizedKeys['content-length']]; - - $length = (int) $stream->getSize(); - if ($length === 0) { - unset($headers[$normalizedKeys['content-length']]); - } else { - $headers[$normalizedKeys['content-length']] = [$length]; - } - } - } - } - } - - return [$stream, $headers]; - } - - /** - * Drains the source stream into the "sink" client option. - * - * @param StreamInterface $source - * @param StreamInterface $sink - * @param string $contentLength Header specifying the amount of - * data to read. - * - * @return StreamInterface - * @throws \RuntimeException when the sink option is invalid. - */ - private function drain( - StreamInterface $source, - StreamInterface $sink, - $contentLength - ) { - // If a content-length header is provided, then stop reading once - // that number of bytes has been read. This can prevent infinitely - // reading from a stream when dealing with servers that do not honor - // Connection: Close headers. - Psr7\copy_to_stream( - $source, - $sink, - (strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1 - ); - - $sink->seek(0); - $source->close(); - - return $sink; - } - - /** - * Create a resource and check to ensure it was created successfully - * - * @param callable $callback Callable that returns stream resource - * - * @return resource - * @throws \RuntimeException on error - */ - private function createResource(callable $callback) - { - $errors = null; - set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { - $errors[] = [ - 'message' => $msg, - 'file' => $file, - 'line' => $line - ]; - return true; - }); - - $resource = $callback(); - restore_error_handler(); - - if (!$resource) { - $message = 'Error creating resource: '; - foreach ($errors as $err) { - foreach ($err as $key => $value) { - $message .= "[$key] $value" . PHP_EOL; - } - } - throw new \RuntimeException(trim($message)); - } - - return $resource; - } - - private function createStream(RequestInterface $request, array $options) - { - static $methods; - if (!$methods) { - $methods = array_flip(get_class_methods(__CLASS__)); - } - - // HTTP/1.1 streams using the PHP stream wrapper require a - // Connection: close header - if ($request->getProtocolVersion() == '1.1' - && !$request->hasHeader('Connection') - ) { - $request = $request->withHeader('Connection', 'close'); - } - - // Ensure SSL is verified by default - if (!isset($options['verify'])) { - $options['verify'] = true; - } - - $params = []; - $context = $this->getDefaultContext($request); - - if (isset($options['on_headers']) && !is_callable($options['on_headers'])) { - throw new \InvalidArgumentException('on_headers must be callable'); - } - - if (!empty($options)) { - foreach ($options as $key => $value) { - $method = "add_{$key}"; - if (isset($methods[$method])) { - $this->{$method}($request, $context, $value, $params); - } - } - } - - if (isset($options['stream_context'])) { - if (!is_array($options['stream_context'])) { - throw new \InvalidArgumentException('stream_context must be an array'); - } - $context = array_replace_recursive( - $context, - $options['stream_context'] - ); - } - - // Microsoft NTLM authentication only supported with curl handler - if (isset($options['auth']) - && is_array($options['auth']) - && isset($options['auth'][2]) - && 'ntlm' == $options['auth'][2] - ) { - throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); - } - - $uri = $this->resolveHost($request, $options); - - $context = $this->createResource( - function () use ($context, $params) { - return stream_context_create($context, $params); - } - ); - - return $this->createResource( - function () use ($uri, &$http_response_header, $context, $options) { - $resource = fopen((string) $uri, 'r', null, $context); - $this->lastHeaders = $http_response_header; - - if (isset($options['read_timeout'])) { - $readTimeout = $options['read_timeout']; - $sec = (int) $readTimeout; - $usec = ($readTimeout - $sec) * 100000; - stream_set_timeout($resource, $sec, $usec); - } - - return $resource; - } - ); - } - - private function resolveHost(RequestInterface $request, array $options) - { - $uri = $request->getUri(); - - if (isset($options['force_ip_resolve']) && !filter_var($uri->getHost(), FILTER_VALIDATE_IP)) { - if ('v4' === $options['force_ip_resolve']) { - $records = dns_get_record($uri->getHost(), DNS_A); - if (!isset($records[0]['ip'])) { - throw new ConnectException( - sprintf( - "Could not resolve IPv4 address for host '%s'", - $uri->getHost() - ), - $request - ); - } - $uri = $uri->withHost($records[0]['ip']); - } elseif ('v6' === $options['force_ip_resolve']) { - $records = dns_get_record($uri->getHost(), DNS_AAAA); - if (!isset($records[0]['ipv6'])) { - throw new ConnectException( - sprintf( - "Could not resolve IPv6 address for host '%s'", - $uri->getHost() - ), - $request - ); - } - $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']'); - } - } - - return $uri; - } - - private function getDefaultContext(RequestInterface $request) - { - $headers = ''; - foreach ($request->getHeaders() as $name => $value) { - foreach ($value as $val) { - $headers .= "$name: $val\r\n"; - } - } - - $context = [ - 'http' => [ - 'method' => $request->getMethod(), - 'header' => $headers, - 'protocol_version' => $request->getProtocolVersion(), - 'ignore_errors' => true, - 'follow_location' => 0, - ], - ]; - - $body = (string) $request->getBody(); - - if (!empty($body)) { - $context['http']['content'] = $body; - // Prevent the HTTP handler from adding a Content-Type header. - if (!$request->hasHeader('Content-Type')) { - $context['http']['header'] .= "Content-Type:\r\n"; - } - } - - $context['http']['header'] = rtrim($context['http']['header']); - - return $context; - } - - private function add_proxy(RequestInterface $request, &$options, $value, &$params) - { - if (!is_array($value)) { - $options['http']['proxy'] = $value; - } else { - $scheme = $request->getUri()->getScheme(); - if (isset($value[$scheme])) { - if (!isset($value['no']) - || !\GuzzleHttp\is_host_in_noproxy( - $request->getUri()->getHost(), - $value['no'] - ) - ) { - $options['http']['proxy'] = $value[$scheme]; - } - } - } - } - - private function add_timeout(RequestInterface $request, &$options, $value, &$params) - { - if ($value > 0) { - $options['http']['timeout'] = $value; - } - } - - private function add_verify(RequestInterface $request, &$options, $value, &$params) - { - if ($value === true) { - // PHP 5.6 or greater will find the system cert by default. When - // < 5.6, use the Guzzle bundled cacert. - if (PHP_VERSION_ID < 50600) { - $options['ssl']['cafile'] = \GuzzleHttp\default_ca_bundle(); - } - } elseif (is_string($value)) { - $options['ssl']['cafile'] = $value; - if (!file_exists($value)) { - throw new \RuntimeException("SSL CA bundle not found: $value"); - } - } elseif ($value === false) { - $options['ssl']['verify_peer'] = false; - $options['ssl']['verify_peer_name'] = false; - return; - } else { - throw new \InvalidArgumentException('Invalid verify request option'); - } - - $options['ssl']['verify_peer'] = true; - $options['ssl']['verify_peer_name'] = true; - $options['ssl']['allow_self_signed'] = false; - } - - private function add_cert(RequestInterface $request, &$options, $value, &$params) - { - if (is_array($value)) { - $options['ssl']['passphrase'] = $value[1]; - $value = $value[0]; - } - - if (!file_exists($value)) { - throw new \RuntimeException("SSL certificate not found: {$value}"); - } - - $options['ssl']['local_cert'] = $value; - } - - private function add_progress(RequestInterface $request, &$options, $value, &$params) - { - $this->addNotification( - $params, - function ($code, $a, $b, $c, $transferred, $total) use ($value) { - if ($code == STREAM_NOTIFY_PROGRESS) { - $value($total, $transferred, null, null); - } - } - ); - } - - private function add_debug(RequestInterface $request, &$options, $value, &$params) - { - if ($value === false) { - return; - } - - static $map = [ - STREAM_NOTIFY_CONNECT => 'CONNECT', - STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', - STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', - STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', - STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', - STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', - STREAM_NOTIFY_PROGRESS => 'PROGRESS', - STREAM_NOTIFY_FAILURE => 'FAILURE', - STREAM_NOTIFY_COMPLETED => 'COMPLETED', - STREAM_NOTIFY_RESOLVE => 'RESOLVE', - ]; - static $args = ['severity', 'message', 'message_code', - 'bytes_transferred', 'bytes_max']; - - $value = \GuzzleHttp\debug_resource($value); - $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); - $this->addNotification( - $params, - function () use ($ident, $value, $map, $args) { - $passed = func_get_args(); - $code = array_shift($passed); - fprintf($value, '<%s> [%s] ', $ident, $map[$code]); - foreach (array_filter($passed) as $i => $v) { - fwrite($value, $args[$i] . ': "' . $v . '" '); - } - fwrite($value, "\n"); - } - ); - } - - private function addNotification(array &$params, callable $notify) - { - // Wrap the existing function if needed. - if (!isset($params['notification'])) { - $params['notification'] = $notify; - } else { - $params['notification'] = $this->callArray([ - $params['notification'], - $notify - ]); - } - } - - private function callArray(array $functions) - { - return function () use ($functions) { - $args = func_get_args(); - foreach ($functions as $fn) { - call_user_func_array($fn, $args); - } - }; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/tests/integration/vendor/guzzlehttp/guzzle/src/HandlerStack.php deleted file mode 100644 index 6a49cc0..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/HandlerStack.php +++ /dev/null @@ -1,277 +0,0 @@ -push(Middleware::httpErrors(), 'http_errors'); - $stack->push(Middleware::redirect(), 'allow_redirects'); - $stack->push(Middleware::cookies(), 'cookies'); - $stack->push(Middleware::prepareBody(), 'prepare_body'); - - return $stack; - } - - /** - * @param callable $handler Underlying HTTP handler. - */ - public function __construct(callable $handler = null) - { - $this->handler = $handler; - } - - /** - * Invokes the handler stack as a composed handler - * - * @param RequestInterface $request - * @param array $options - * - * @return ResponseInterface|PromiseInterface - */ - public function __invoke(RequestInterface $request, array $options) - { - $handler = $this->resolve(); - - return $handler($request, $options); - } - - /** - * Dumps a string representation of the stack. - * - * @return string - */ - public function __toString() - { - $depth = 0; - $stack = []; - if ($this->handler) { - $stack[] = "0) Handler: " . $this->debugCallable($this->handler); - } - - $result = ''; - foreach (array_reverse($this->stack) as $tuple) { - $depth++; - $str = "{$depth}) Name: '{$tuple[1]}', "; - $str .= "Function: " . $this->debugCallable($tuple[0]); - $result = "> {$str}\n{$result}"; - $stack[] = $str; - } - - foreach (array_keys($stack) as $k) { - $result .= "< {$stack[$k]}\n"; - } - - return $result; - } - - /** - * Set the HTTP handler that actually returns a promise. - * - * @param callable $handler Accepts a request and array of options and - * returns a Promise. - */ - public function setHandler(callable $handler) - { - $this->handler = $handler; - $this->cached = null; - } - - /** - * Returns true if the builder has a handler. - * - * @return bool - */ - public function hasHandler() - { - return (bool) $this->handler; - } - - /** - * Unshift a middleware to the bottom of the stack. - * - * @param callable $middleware Middleware function - * @param string $name Name to register for this middleware. - */ - public function unshift(callable $middleware, $name = null) - { - array_unshift($this->stack, [$middleware, $name]); - $this->cached = null; - } - - /** - * Push a middleware to the top of the stack. - * - * @param callable $middleware Middleware function - * @param string $name Name to register for this middleware. - */ - public function push(callable $middleware, $name = '') - { - $this->stack[] = [$middleware, $name]; - $this->cached = null; - } - - /** - * Add a middleware before another middleware by name. - * - * @param string $findName Middleware to find - * @param callable $middleware Middleware function - * @param string $withName Name to register for this middleware. - */ - public function before($findName, callable $middleware, $withName = '') - { - $this->splice($findName, $withName, $middleware, true); - } - - /** - * Add a middleware after another middleware by name. - * - * @param string $findName Middleware to find - * @param callable $middleware Middleware function - * @param string $withName Name to register for this middleware. - */ - public function after($findName, callable $middleware, $withName = '') - { - $this->splice($findName, $withName, $middleware, false); - } - - /** - * Remove a middleware by instance or name from the stack. - * - * @param callable|string $remove Middleware to remove by instance or name. - */ - public function remove($remove) - { - $this->cached = null; - $idx = is_callable($remove) ? 0 : 1; - $this->stack = array_values(array_filter( - $this->stack, - function ($tuple) use ($idx, $remove) { - return $tuple[$idx] !== $remove; - } - )); - } - - /** - * Compose the middleware and handler into a single callable function. - * - * @return callable - */ - public function resolve() - { - if (!$this->cached) { - if (!($prev = $this->handler)) { - throw new \LogicException('No handler has been specified'); - } - - foreach (array_reverse($this->stack) as $fn) { - $prev = $fn[0]($prev); - } - - $this->cached = $prev; - } - - return $this->cached; - } - - /** - * @param string $name - * @return int - */ - private function findByName($name) - { - foreach ($this->stack as $k => $v) { - if ($v[1] === $name) { - return $k; - } - } - - throw new \InvalidArgumentException("Middleware not found: $name"); - } - - /** - * Splices a function into the middleware list at a specific position. - * - * @param string $findName - * @param string $withName - * @param callable $middleware - * @param bool $before - */ - private function splice($findName, $withName, callable $middleware, $before) - { - $this->cached = null; - $idx = $this->findByName($findName); - $tuple = [$middleware, $withName]; - - if ($before) { - if ($idx === 0) { - array_unshift($this->stack, $tuple); - } else { - $replacement = [$tuple, $this->stack[$idx]]; - array_splice($this->stack, $idx, 1, $replacement); - } - } elseif ($idx === count($this->stack) - 1) { - $this->stack[] = $tuple; - } else { - $replacement = [$this->stack[$idx], $tuple]; - array_splice($this->stack, $idx, 1, $replacement); - } - } - - /** - * Provides a debug string for a given callable. - * - * @param array|callable $fn Function to write as a string. - * - * @return string - */ - private function debugCallable($fn) - { - if (is_string($fn)) { - return "callable({$fn})"; - } - - if (is_array($fn)) { - return is_string($fn[0]) - ? "callable({$fn[0]}::{$fn[1]})" - : "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])"; - } - - return 'callable(' . spl_object_hash($fn) . ')'; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/tests/integration/vendor/guzzlehttp/guzzle/src/MessageFormatter.php deleted file mode 100644 index dc36bb5..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/MessageFormatter.php +++ /dev/null @@ -1,185 +0,0 @@ ->>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; - const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}'; - - /** @var string Template used to format log messages */ - private $template; - - /** - * @param string $template Log message template - */ - public function __construct($template = self::CLF) - { - $this->template = $template ?: self::CLF; - } - - /** - * Returns a formatted message string. - * - * @param RequestInterface $request Request that was sent - * @param ResponseInterface $response Response that was received - * @param \Exception $error Exception that was received - * - * @return string - */ - public function format( - RequestInterface $request, - ResponseInterface $response = null, - \Exception $error = null - ) { - $cache = []; - - return preg_replace_callback( - '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', - function (array $matches) use ($request, $response, $error, &$cache) { - if (isset($cache[$matches[1]])) { - return $cache[$matches[1]]; - } - - $result = ''; - switch ($matches[1]) { - case 'request': - $result = Psr7\str($request); - break; - case 'response': - $result = $response ? Psr7\str($response) : ''; - break; - case 'req_headers': - $result = trim($request->getMethod() - . ' ' . $request->getRequestTarget()) - . ' HTTP/' . $request->getProtocolVersion() . "\r\n" - . $this->headers($request); - break; - case 'res_headers': - $result = $response ? - sprintf( - 'HTTP/%s %d %s', - $response->getProtocolVersion(), - $response->getStatusCode(), - $response->getReasonPhrase() - ) . "\r\n" . $this->headers($response) - : 'NULL'; - break; - case 'req_body': - $result = $request->getBody(); - break; - case 'res_body': - $result = $response ? $response->getBody() : 'NULL'; - break; - case 'ts': - case 'date_iso_8601': - $result = gmdate('c'); - break; - case 'date_common_log': - $result = date('d/M/Y:H:i:s O'); - break; - case 'method': - $result = $request->getMethod(); - break; - case 'version': - $result = $request->getProtocolVersion(); - break; - case 'uri': - case 'url': - $result = $request->getUri(); - break; - case 'target': - $result = $request->getRequestTarget(); - break; - case 'req_version': - $result = $request->getProtocolVersion(); - break; - case 'res_version': - $result = $response - ? $response->getProtocolVersion() - : 'NULL'; - break; - case 'host': - $result = $request->getHeaderLine('Host'); - break; - case 'hostname': - $result = gethostname(); - break; - case 'code': - $result = $response ? $response->getStatusCode() : 'NULL'; - break; - case 'phrase': - $result = $response ? $response->getReasonPhrase() : 'NULL'; - break; - case 'error': - $result = $error ? $error->getMessage() : 'NULL'; - break; - default: - // handle prefixed dynamic headers - if (strpos($matches[1], 'req_header_') === 0) { - $result = $request->getHeaderLine(substr($matches[1], 11)); - } elseif (strpos($matches[1], 'res_header_') === 0) { - $result = $response - ? $response->getHeaderLine(substr($matches[1], 11)) - : 'NULL'; - } - } - - $cache[$matches[1]] = $result; - return $result; - }, - $this->template - ); - } - - /** - * Get headers from message as string - * - * @return string - */ - private function headers(MessageInterface $message) - { - $result = ''; - foreach ($message->getHeaders() as $name => $values) { - $result .= $name . ': ' . implode(', ', $values) . "\r\n"; - } - - return trim($result); - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Middleware.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Middleware.php deleted file mode 100644 index bffc197..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Middleware.php +++ /dev/null @@ -1,254 +0,0 @@ -withCookieHeader($request); - return $handler($request, $options) - ->then( - function ($response) use ($cookieJar, $request) { - $cookieJar->extractCookies($request, $response); - return $response; - } - ); - }; - }; - } - - /** - * Middleware that throws exceptions for 4xx or 5xx responses when the - * "http_error" request option is set to true. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function httpErrors() - { - return function (callable $handler) { - return function ($request, array $options) use ($handler) { - if (empty($options['http_errors'])) { - return $handler($request, $options); - } - return $handler($request, $options)->then( - function (ResponseInterface $response) use ($request) { - $code = $response->getStatusCode(); - if ($code < 400) { - return $response; - } - throw RequestException::create($request, $response); - } - ); - }; - }; - } - - /** - * Middleware that pushes history data to an ArrayAccess container. - * - * @param array|\ArrayAccess $container Container to hold the history (by reference). - * - * @return callable Returns a function that accepts the next handler. - * @throws \InvalidArgumentException if container is not an array or ArrayAccess. - */ - public static function history(&$container) - { - if (!is_array($container) && !$container instanceof \ArrayAccess) { - throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); - } - - return function (callable $handler) use (&$container) { - return function ($request, array $options) use ($handler, &$container) { - return $handler($request, $options)->then( - function ($value) use ($request, &$container, $options) { - $container[] = [ - 'request' => $request, - 'response' => $value, - 'error' => null, - 'options' => $options - ]; - return $value; - }, - function ($reason) use ($request, &$container, $options) { - $container[] = [ - 'request' => $request, - 'response' => null, - 'error' => $reason, - 'options' => $options - ]; - return \GuzzleHttp\Promise\rejection_for($reason); - } - ); - }; - }; - } - - /** - * Middleware that invokes a callback before and after sending a request. - * - * The provided listener cannot modify or alter the response. It simply - * "taps" into the chain to be notified before returning the promise. The - * before listener accepts a request and options array, and the after - * listener accepts a request, options array, and response promise. - * - * @param callable $before Function to invoke before forwarding the request. - * @param callable $after Function invoked after forwarding. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function tap(callable $before = null, callable $after = null) - { - return function (callable $handler) use ($before, $after) { - return function ($request, array $options) use ($handler, $before, $after) { - if ($before) { - $before($request, $options); - } - $response = $handler($request, $options); - if ($after) { - $after($request, $options, $response); - } - return $response; - }; - }; - } - - /** - * Middleware that handles request redirects. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function redirect() - { - return function (callable $handler) { - return new RedirectMiddleware($handler); - }; - } - - /** - * Middleware that retries requests based on the boolean result of - * invoking the provided "decider" function. - * - * If no delay function is provided, a simple implementation of exponential - * backoff will be utilized. - * - * @param callable $decider Function that accepts the number of retries, - * a request, [response], and [exception] and - * returns true if the request is to be retried. - * @param callable $delay Function that accepts the number of retries and - * returns the number of milliseconds to delay. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function retry(callable $decider, callable $delay = null) - { - return function (callable $handler) use ($decider, $delay) { - return new RetryMiddleware($decider, $handler, $delay); - }; - } - - /** - * Middleware that logs requests, responses, and errors using a message - * formatter. - * - * @param LoggerInterface $logger Logs messages. - * @param MessageFormatter $formatter Formatter used to create message strings. - * @param string $logLevel Level at which to log requests. - * - * @return callable Returns a function that accepts the next handler. - */ - public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = 'info' /* \Psr\Log\LogLevel::INFO */) - { - return function (callable $handler) use ($logger, $formatter, $logLevel) { - return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) { - return $handler($request, $options)->then( - function ($response) use ($logger, $request, $formatter, $logLevel) { - $message = $formatter->format($request, $response); - $logger->log($logLevel, $message); - return $response; - }, - function ($reason) use ($logger, $request, $formatter) { - $response = $reason instanceof RequestException - ? $reason->getResponse() - : null; - $message = $formatter->format($request, $response, $reason); - $logger->notice($message); - return \GuzzleHttp\Promise\rejection_for($reason); - } - ); - }; - }; - } - - /** - * This middleware adds a default content-type if possible, a default - * content-length or transfer-encoding header, and the expect header. - * - * @return callable - */ - public static function prepareBody() - { - return function (callable $handler) { - return new PrepareBodyMiddleware($handler); - }; - } - - /** - * Middleware that applies a map function to the request before passing to - * the next handler. - * - * @param callable $fn Function that accepts a RequestInterface and returns - * a RequestInterface. - * @return callable - */ - public static function mapRequest(callable $fn) - { - return function (callable $handler) use ($fn) { - return function ($request, array $options) use ($handler, $fn) { - return $handler($fn($request), $options); - }; - }; - } - - /** - * Middleware that applies a map function to the resolved promise's - * response. - * - * @param callable $fn Function that accepts a ResponseInterface and - * returns a ResponseInterface. - * @return callable - */ - public static function mapResponse(callable $fn) - { - return function (callable $handler) use ($fn) { - return function ($request, array $options) use ($handler, $fn) { - return $handler($request, $options)->then($fn); - }; - }; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/Pool.php b/tests/integration/vendor/guzzlehttp/guzzle/src/Pool.php deleted file mode 100644 index 5838db4..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/Pool.php +++ /dev/null @@ -1,134 +0,0 @@ - $rfn) { - if ($rfn instanceof RequestInterface) { - yield $key => $client->sendAsync($rfn, $opts); - } elseif (is_callable($rfn)) { - yield $key => $rfn($opts); - } else { - throw new \InvalidArgumentException('Each value yielded by ' - . 'the iterator must be a Psr7\Http\Message\RequestInterface ' - . 'or a callable that returns a promise that fulfills ' - . 'with a Psr7\Message\Http\ResponseInterface object.'); - } - } - }; - - $this->each = new EachPromise($requests(), $config); - } - - /** - * Get promise - * - * @return PromiseInterface - */ - public function promise() - { - return $this->each->promise(); - } - - /** - * Sends multiple requests concurrently and returns an array of responses - * and exceptions that uses the same ordering as the provided requests. - * - * IMPORTANT: This method keeps every request and response in memory, and - * as such, is NOT recommended when sending a large number or an - * indeterminate number of requests concurrently. - * - * @param ClientInterface $client Client used to send the requests - * @param array|\Iterator $requests Requests to send concurrently. - * @param array $options Passes through the options available in - * {@see GuzzleHttp\Pool::__construct} - * - * @return array Returns an array containing the response or an exception - * in the same order that the requests were sent. - * @throws \InvalidArgumentException if the event format is incorrect. - */ - public static function batch( - ClientInterface $client, - $requests, - array $options = [] - ) { - $res = []; - self::cmpCallback($options, 'fulfilled', $res); - self::cmpCallback($options, 'rejected', $res); - $pool = new static($client, $requests, $options); - $pool->promise()->wait(); - ksort($res); - - return $res; - } - - /** - * Execute callback(s) - * - * @return void - */ - private static function cmpCallback(array &$options, $name, array &$results) - { - if (!isset($options[$name])) { - $options[$name] = function ($v, $k) use (&$results) { - $results[$k] = $v; - }; - } else { - $currentFn = $options[$name]; - $options[$name] = function ($v, $k) use (&$results, $currentFn) { - $currentFn($v, $k); - $results[$k] = $v; - }; - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/tests/integration/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php deleted file mode 100644 index 568a1e9..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php +++ /dev/null @@ -1,111 +0,0 @@ -nextHandler = $nextHandler; - } - - /** - * @param RequestInterface $request - * @param array $options - * - * @return PromiseInterface - */ - public function __invoke(RequestInterface $request, array $options) - { - $fn = $this->nextHandler; - - // Don't do anything if the request has no body. - if ($request->getBody()->getSize() === 0) { - return $fn($request, $options); - } - - $modify = []; - - // Add a default content-type if possible. - if (!$request->hasHeader('Content-Type')) { - if ($uri = $request->getBody()->getMetadata('uri')) { - if ($type = Psr7\mimetype_from_filename($uri)) { - $modify['set_headers']['Content-Type'] = $type; - } - } - } - - // Add a default content-length or transfer-encoding header. - if (!$request->hasHeader('Content-Length') - && !$request->hasHeader('Transfer-Encoding') - ) { - $size = $request->getBody()->getSize(); - if ($size !== null) { - $modify['set_headers']['Content-Length'] = $size; - } else { - $modify['set_headers']['Transfer-Encoding'] = 'chunked'; - } - } - - // Add the expect header if needed. - $this->addExpectHeader($request, $options, $modify); - - return $fn(Psr7\modify_request($request, $modify), $options); - } - - /** - * Add expect header - * - * @return void - */ - private function addExpectHeader( - RequestInterface $request, - array $options, - array &$modify - ) { - // Determine if the Expect header should be used - if ($request->hasHeader('Expect')) { - return; - } - - $expect = isset($options['expect']) ? $options['expect'] : null; - - // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0 - if ($expect === false || $request->getProtocolVersion() < 1.1) { - return; - } - - // The expect header is unconditionally enabled - if ($expect === true) { - $modify['set_headers']['Expect'] = '100-Continue'; - return; - } - - // By default, send the expect header when the payload is > 1mb - if ($expect === null) { - $expect = 1048576; - } - - // Always add if the body cannot be rewound, the size cannot be - // determined, or the size is greater than the cutoff threshold - $body = $request->getBody(); - $size = $body->getSize(); - - if ($size === null || $size >= (int) $expect || !$body->isSeekable()) { - $modify['set_headers']['Expect'] = '100-Continue'; - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/tests/integration/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php deleted file mode 100644 index 008a29b..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php +++ /dev/null @@ -1,264 +0,0 @@ - 5, - 'protocols' => ['http', 'https'], - 'strict' => false, - 'referer' => false, - 'track_redirects' => false, - ]; - - /** @var callable */ - private $nextHandler; - - /** - * @param callable $nextHandler Next handler to invoke. - */ - public function __construct(callable $nextHandler) - { - $this->nextHandler = $nextHandler; - } - - /** - * @param RequestInterface $request - * @param array $options - * - * @return PromiseInterface - */ - public function __invoke(RequestInterface $request, array $options) - { - $fn = $this->nextHandler; - - if (empty($options['allow_redirects'])) { - return $fn($request, $options); - } - - if ($options['allow_redirects'] === true) { - $options['allow_redirects'] = self::$defaultSettings; - } elseif (!is_array($options['allow_redirects'])) { - throw new \InvalidArgumentException('allow_redirects must be true, false, or array'); - } else { - // Merge the default settings with the provided settings - $options['allow_redirects'] += self::$defaultSettings; - } - - if (empty($options['allow_redirects']['max'])) { - return $fn($request, $options); - } - - return $fn($request, $options) - ->then(function (ResponseInterface $response) use ($request, $options) { - return $this->checkRedirect($request, $options, $response); - }); - } - - /** - * @param RequestInterface $request - * @param array $options - * @param ResponseInterface $response - * - * @return ResponseInterface|PromiseInterface - */ - public function checkRedirect( - RequestInterface $request, - array $options, - ResponseInterface $response - ) { - if (substr($response->getStatusCode(), 0, 1) != '3' - || !$response->hasHeader('Location') - ) { - return $response; - } - - $this->guardMax($request, $options); - $nextRequest = $this->modifyRequest($request, $options, $response); - - // If authorization is handled by curl, unset it if URI is cross-origin. - if (Psr7\UriComparator::isCrossOrigin($request->getUri(), $nextRequest->getUri()) && defined('\CURLOPT_HTTPAUTH')) { - unset( - $options['curl'][\CURLOPT_HTTPAUTH], - $options['curl'][\CURLOPT_USERPWD] - ); - } - - if (isset($options['allow_redirects']['on_redirect'])) { - call_user_func( - $options['allow_redirects']['on_redirect'], - $request, - $response, - $nextRequest->getUri() - ); - } - - /** @var PromiseInterface|ResponseInterface $promise */ - $promise = $this($nextRequest, $options); - - // Add headers to be able to track history of redirects. - if (!empty($options['allow_redirects']['track_redirects'])) { - return $this->withTracking( - $promise, - (string) $nextRequest->getUri(), - $response->getStatusCode() - ); - } - - return $promise; - } - - /** - * Enable tracking on promise. - * - * @return PromiseInterface - */ - private function withTracking(PromiseInterface $promise, $uri, $statusCode) - { - return $promise->then( - function (ResponseInterface $response) use ($uri, $statusCode) { - // Note that we are pushing to the front of the list as this - // would be an earlier response than what is currently present - // in the history header. - $historyHeader = $response->getHeader(self::HISTORY_HEADER); - $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); - array_unshift($historyHeader, $uri); - array_unshift($statusHeader, $statusCode); - return $response->withHeader(self::HISTORY_HEADER, $historyHeader) - ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); - } - ); - } - - /** - * Check for too many redirects. - * - * @return void - * - * @throws TooManyRedirectsException Too many redirects. - */ - private function guardMax(RequestInterface $request, array &$options) - { - $current = isset($options['__redirect_count']) - ? $options['__redirect_count'] - : 0; - $options['__redirect_count'] = $current + 1; - $max = $options['allow_redirects']['max']; - - if ($options['__redirect_count'] > $max) { - throw new TooManyRedirectsException( - "Will not follow more than {$max} redirects", - $request - ); - } - } - - /** - * @param RequestInterface $request - * @param array $options - * @param ResponseInterface $response - * - * @return RequestInterface - */ - public function modifyRequest( - RequestInterface $request, - array $options, - ResponseInterface $response - ) { - // Request modifications to apply. - $modify = []; - $protocols = $options['allow_redirects']['protocols']; - - // Use a GET request if this is an entity enclosing request and we are - // not forcing RFC compliance, but rather emulating what all browsers - // would do. - $statusCode = $response->getStatusCode(); - if ($statusCode == 303 || - ($statusCode <= 302 && !$options['allow_redirects']['strict']) - ) { - $modify['method'] = 'GET'; - $modify['body'] = ''; - } - - $uri = self::redirectUri($request, $response, $protocols); - if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) { - $idnOptions = ($options['idn_conversion'] === true) ? IDNA_DEFAULT : $options['idn_conversion']; - $uri = Utils::idnUriConvert($uri, $idnOptions); - } - - $modify['uri'] = $uri; - Psr7\rewind_body($request); - - // Add the Referer header if it is told to do so and only - // add the header if we are not redirecting from https to http. - if ($options['allow_redirects']['referer'] - && $modify['uri']->getScheme() === $request->getUri()->getScheme() - ) { - $uri = $request->getUri()->withUserInfo(''); - $modify['set_headers']['Referer'] = (string) $uri; - } else { - $modify['remove_headers'][] = 'Referer'; - } - - // Remove Authorization and Cookie headers if URI is cross-origin. - if (Psr7\UriComparator::isCrossOrigin($request->getUri(), $modify['uri'])) { - $modify['remove_headers'][] = 'Authorization'; - $modify['remove_headers'][] = 'Cookie'; - } - - return Psr7\modify_request($request, $modify); - } - - /** - * Set the appropriate URL on the request based on the location header. - * - * @param RequestInterface $request - * @param ResponseInterface $response - * @param array $protocols - * - * @return UriInterface - */ - private static function redirectUri( - RequestInterface $request, - ResponseInterface $response, - array $protocols - ) { - $location = Psr7\UriResolver::resolve( - $request->getUri(), - new Psr7\Uri($response->getHeaderLine('Location')) - ); - - // Ensure that the redirect URI is allowed based on the protocols. - if (!in_array($location->getScheme(), $protocols)) { - throw new BadResponseException( - sprintf( - 'Redirect URI, %s, does not use one of the allowed redirect protocols: %s', - $location, - implode(', ', $protocols) - ), - $request, - $response - ); - } - - return $location; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/tests/integration/vendor/guzzlehttp/guzzle/src/RequestOptions.php deleted file mode 100644 index 355f658..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/RequestOptions.php +++ /dev/null @@ -1,263 +0,0 @@ -decider = $decider; - $this->nextHandler = $nextHandler; - $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; - } - - /** - * Default exponential backoff delay function. - * - * @param int $retries - * - * @return int milliseconds. - */ - public static function exponentialDelay($retries) - { - return (int) pow(2, $retries - 1) * 1000; - } - - /** - * @param RequestInterface $request - * @param array $options - * - * @return PromiseInterface - */ - public function __invoke(RequestInterface $request, array $options) - { - if (!isset($options['retries'])) { - $options['retries'] = 0; - } - - $fn = $this->nextHandler; - return $fn($request, $options) - ->then( - $this->onFulfilled($request, $options), - $this->onRejected($request, $options) - ); - } - - /** - * Execute fulfilled closure - * - * @return mixed - */ - private function onFulfilled(RequestInterface $req, array $options) - { - return function ($value) use ($req, $options) { - if (!call_user_func( - $this->decider, - $options['retries'], - $req, - $value, - null - )) { - return $value; - } - return $this->doRetry($req, $options, $value); - }; - } - - /** - * Execute rejected closure - * - * @return callable - */ - private function onRejected(RequestInterface $req, array $options) - { - return function ($reason) use ($req, $options) { - if (!call_user_func( - $this->decider, - $options['retries'], - $req, - null, - $reason - )) { - return \GuzzleHttp\Promise\rejection_for($reason); - } - return $this->doRetry($req, $options); - }; - } - - /** - * @return self - */ - private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null) - { - $options['delay'] = call_user_func($this->delay, ++$options['retries'], $response); - - return $this($request, $options); - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/TransferStats.php b/tests/integration/vendor/guzzlehttp/guzzle/src/TransferStats.php deleted file mode 100644 index 87fb3c0..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/TransferStats.php +++ /dev/null @@ -1,126 +0,0 @@ -request = $request; - $this->response = $response; - $this->transferTime = $transferTime; - $this->handlerErrorData = $handlerErrorData; - $this->handlerStats = $handlerStats; - } - - /** - * @return RequestInterface - */ - public function getRequest() - { - return $this->request; - } - - /** - * Returns the response that was received (if any). - * - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - - /** - * Returns true if a response was received. - * - * @return bool - */ - public function hasResponse() - { - return $this->response !== null; - } - - /** - * Gets handler specific error data. - * - * This might be an exception, a integer representing an error code, or - * anything else. Relying on this value assumes that you know what handler - * you are using. - * - * @return mixed - */ - public function getHandlerErrorData() - { - return $this->handlerErrorData; - } - - /** - * Get the effective URI the request was sent to. - * - * @return UriInterface - */ - public function getEffectiveUri() - { - return $this->request->getUri(); - } - - /** - * Get the estimated time the request was being transferred by the handler. - * - * @return float|null Time in seconds. - */ - public function getTransferTime() - { - return $this->transferTime; - } - - /** - * Gets an array of all of the handler specific transfer data. - * - * @return array - */ - public function getHandlerStats() - { - return $this->handlerStats; - } - - /** - * Get a specific handler statistic from the handler by name. - * - * @param string $stat Handler specific transfer stat to retrieve. - * - * @return mixed|null - */ - public function getHandlerStat($stat) - { - return isset($this->handlerStats[$stat]) - ? $this->handlerStats[$stat] - : null; - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/UriTemplate.php b/tests/integration/vendor/guzzlehttp/guzzle/src/UriTemplate.php deleted file mode 100644 index 96dcfd0..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/UriTemplate.php +++ /dev/null @@ -1,237 +0,0 @@ - ['prefix' => '', 'joiner' => ',', 'query' => false], - '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], - '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false], - '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false], - '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false], - ';' => ['prefix' => ';', 'joiner' => ';', 'query' => true], - '?' => ['prefix' => '?', 'joiner' => '&', 'query' => true], - '&' => ['prefix' => '&', 'joiner' => '&', 'query' => true] - ]; - - /** @var array Delimiters */ - private static $delims = [':', '/', '?', '#', '[', ']', '@', '!', '$', - '&', '\'', '(', ')', '*', '+', ',', ';', '=']; - - /** @var array Percent encoded delimiters */ - private static $delimsPct = ['%3A', '%2F', '%3F', '%23', '%5B', '%5D', - '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', - '%3B', '%3D']; - - public function expand($template, array $variables) - { - if (false === strpos($template, '{')) { - return $template; - } - - $this->template = $template; - $this->variables = $variables; - - return preg_replace_callback( - '/\{([^\}]+)\}/', - [$this, 'expandMatch'], - $this->template - ); - } - - /** - * Parse an expression into parts - * - * @param string $expression Expression to parse - * - * @return array Returns an associative array of parts - */ - private function parseExpression($expression) - { - $result = []; - - if (isset(self::$operatorHash[$expression[0]])) { - $result['operator'] = $expression[0]; - $expression = substr($expression, 1); - } else { - $result['operator'] = ''; - } - - foreach (explode(',', $expression) as $value) { - $value = trim($value); - $varspec = []; - if ($colonPos = strpos($value, ':')) { - $varspec['value'] = substr($value, 0, $colonPos); - $varspec['modifier'] = ':'; - $varspec['position'] = (int) substr($value, $colonPos + 1); - } elseif (substr($value, -1) === '*') { - $varspec['modifier'] = '*'; - $varspec['value'] = substr($value, 0, -1); - } else { - $varspec['value'] = (string) $value; - $varspec['modifier'] = ''; - } - $result['values'][] = $varspec; - } - - return $result; - } - - /** - * Process an expansion - * - * @param array $matches Matches met in the preg_replace_callback - * - * @return string Returns the replacement string - */ - private function expandMatch(array $matches) - { - static $rfc1738to3986 = ['+' => '%20', '%7e' => '~']; - - $replacements = []; - $parsed = self::parseExpression($matches[1]); - $prefix = self::$operatorHash[$parsed['operator']]['prefix']; - $joiner = self::$operatorHash[$parsed['operator']]['joiner']; - $useQuery = self::$operatorHash[$parsed['operator']]['query']; - - foreach ($parsed['values'] as $value) { - if (!isset($this->variables[$value['value']])) { - continue; - } - - $variable = $this->variables[$value['value']]; - $actuallyUseQuery = $useQuery; - $expanded = ''; - - if (is_array($variable)) { - $isAssoc = $this->isAssoc($variable); - $kvp = []; - foreach ($variable as $key => $var) { - if ($isAssoc) { - $key = rawurlencode($key); - $isNestedArray = is_array($var); - } else { - $isNestedArray = false; - } - - if (!$isNestedArray) { - $var = rawurlencode($var); - if ($parsed['operator'] === '+' || - $parsed['operator'] === '#' - ) { - $var = $this->decodeReserved($var); - } - } - - if ($value['modifier'] === '*') { - if ($isAssoc) { - if ($isNestedArray) { - // Nested arrays must allow for deeply nested - // structures. - $var = strtr( - http_build_query([$key => $var]), - $rfc1738to3986 - ); - } else { - $var = $key . '=' . $var; - } - } elseif ($key > 0 && $actuallyUseQuery) { - $var = $value['value'] . '=' . $var; - } - } - - $kvp[$key] = $var; - } - - if (empty($variable)) { - $actuallyUseQuery = false; - } elseif ($value['modifier'] === '*') { - $expanded = implode($joiner, $kvp); - if ($isAssoc) { - // Don't prepend the value name when using the explode - // modifier with an associative array. - $actuallyUseQuery = false; - } - } else { - if ($isAssoc) { - // When an associative array is encountered and the - // explode modifier is not set, then the result must be - // a comma separated list of keys followed by their - // respective values. - foreach ($kvp as $k => &$v) { - $v = $k . ',' . $v; - } - } - $expanded = implode(',', $kvp); - } - } else { - if ($value['modifier'] === ':') { - $variable = substr($variable, 0, $value['position']); - } - $expanded = rawurlencode($variable); - if ($parsed['operator'] === '+' || $parsed['operator'] === '#') { - $expanded = $this->decodeReserved($expanded); - } - } - - if ($actuallyUseQuery) { - if (!$expanded && $joiner !== '&') { - $expanded = $value['value']; - } else { - $expanded = $value['value'] . '=' . $expanded; - } - } - - $replacements[] = $expanded; - } - - $ret = implode($joiner, $replacements); - if ($ret && $prefix) { - return $prefix . $ret; - } - - return $ret; - } - - /** - * Determines if an array is associative. - * - * This makes the assumption that input arrays are sequences or hashes. - * This assumption is a tradeoff for accuracy in favor of speed, but it - * should work in almost every case where input is supplied for a URI - * template. - * - * @param array $array Array to check - * - * @return bool - */ - private function isAssoc(array $array) - { - return $array && array_keys($array)[0] !== 0; - } - - /** - * Removes percent encoding on reserved characters (used with + and # - * modifiers). - * - * @param string $string String to fix - * - * @return string - */ - private function decodeReserved($string) - { - return str_replace(self::$delimsPct, self::$delims, $string); - } -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/functions.php b/tests/integration/vendor/guzzlehttp/guzzle/src/functions.php deleted file mode 100644 index c2afd8c..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/functions.php +++ /dev/null @@ -1,334 +0,0 @@ -expand($template, $variables); -} - -/** - * Debug function used to describe the provided value type and class. - * - * @param mixed $input - * - * @return string Returns a string containing the type of the variable and - * if a class is provided, the class name. - */ -function describe_type($input) -{ - switch (gettype($input)) { - case 'object': - return 'object(' . get_class($input) . ')'; - case 'array': - return 'array(' . count($input) . ')'; - default: - ob_start(); - var_dump($input); - // normalize float vs double - return str_replace('double(', 'float(', rtrim(ob_get_clean())); - } -} - -/** - * Parses an array of header lines into an associative array of headers. - * - * @param iterable $lines Header lines array of strings in the following - * format: "Name: Value" - * @return array - */ -function headers_from_lines($lines) -{ - $headers = []; - - foreach ($lines as $line) { - $parts = explode(':', $line, 2); - $headers[trim($parts[0])][] = isset($parts[1]) - ? trim($parts[1]) - : null; - } - - return $headers; -} - -/** - * Returns a debug stream based on the provided variable. - * - * @param mixed $value Optional value - * - * @return resource - */ -function debug_resource($value = null) -{ - if (is_resource($value)) { - return $value; - } elseif (defined('STDOUT')) { - return STDOUT; - } - - return fopen('php://output', 'w'); -} - -/** - * Chooses and creates a default handler to use based on the environment. - * - * The returned handler is not wrapped by any default middlewares. - * - * @return callable Returns the best handler for the given system. - * @throws \RuntimeException if no viable Handler is available. - */ -function choose_handler() -{ - $handler = null; - if (function_exists('curl_multi_exec') && function_exists('curl_exec')) { - $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler()); - } elseif (function_exists('curl_exec')) { - $handler = new CurlHandler(); - } elseif (function_exists('curl_multi_exec')) { - $handler = new CurlMultiHandler(); - } - - if (ini_get('allow_url_fopen')) { - $handler = $handler - ? Proxy::wrapStreaming($handler, new StreamHandler()) - : new StreamHandler(); - } elseif (!$handler) { - throw new \RuntimeException('GuzzleHttp requires cURL, the ' - . 'allow_url_fopen ini setting, or a custom HTTP handler.'); - } - - return $handler; -} - -/** - * Get the default User-Agent string to use with Guzzle - * - * @return string - */ -function default_user_agent() -{ - static $defaultAgent = ''; - - if (!$defaultAgent) { - $defaultAgent = 'GuzzleHttp/' . Client::VERSION; - if (extension_loaded('curl') && function_exists('curl_version')) { - $defaultAgent .= ' curl/' . \curl_version()['version']; - } - $defaultAgent .= ' PHP/' . PHP_VERSION; - } - - return $defaultAgent; -} - -/** - * Returns the default cacert bundle for the current system. - * - * First, the openssl.cafile and curl.cainfo php.ini settings are checked. - * If those settings are not configured, then the common locations for - * bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X - * and Windows are checked. If any of these file locations are found on - * disk, they will be utilized. - * - * Note: the result of this function is cached for subsequent calls. - * - * @return string - * @throws \RuntimeException if no bundle can be found. - */ -function default_ca_bundle() -{ - static $cached = null; - static $cafiles = [ - // Red Hat, CentOS, Fedora (provided by the ca-certificates package) - '/etc/pki/tls/certs/ca-bundle.crt', - // Ubuntu, Debian (provided by the ca-certificates package) - '/etc/ssl/certs/ca-certificates.crt', - // FreeBSD (provided by the ca_root_nss package) - '/usr/local/share/certs/ca-root-nss.crt', - // SLES 12 (provided by the ca-certificates package) - '/var/lib/ca-certificates/ca-bundle.pem', - // OS X provided by homebrew (using the default path) - '/usr/local/etc/openssl/cert.pem', - // Google app engine - '/etc/ca-certificates.crt', - // Windows? - 'C:\\windows\\system32\\curl-ca-bundle.crt', - 'C:\\windows\\curl-ca-bundle.crt', - ]; - - if ($cached) { - return $cached; - } - - if ($ca = ini_get('openssl.cafile')) { - return $cached = $ca; - } - - if ($ca = ini_get('curl.cainfo')) { - return $cached = $ca; - } - - foreach ($cafiles as $filename) { - if (file_exists($filename)) { - return $cached = $filename; - } - } - - throw new \RuntimeException( - <<< EOT -No system CA bundle could be found in any of the the common system locations. -PHP versions earlier than 5.6 are not properly configured to use the system's -CA bundle by default. In order to verify peer certificates, you will need to -supply the path on disk to a certificate bundle to the 'verify' request -option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not -need a specific certificate bundle, then Mozilla provides a commonly used CA -bundle which can be downloaded here (provided by the maintainer of cURL): -https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt. Once -you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP -ini setting to point to the path to the file, allowing you to omit the 'verify' -request option. See http://curl.haxx.se/docs/sslcerts.html for more -information. -EOT - ); -} - -/** - * Creates an associative array of lowercase header names to the actual - * header casing. - * - * @param array $headers - * - * @return array - */ -function normalize_header_keys(array $headers) -{ - $result = []; - foreach (array_keys($headers) as $key) { - $result[strtolower($key)] = $key; - } - - return $result; -} - -/** - * Returns true if the provided host matches any of the no proxy areas. - * - * This method will strip a port from the host if it is present. Each pattern - * can be matched with an exact match (e.g., "foo.com" == "foo.com") or a - * partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" == - * "baz.foo.com", but ".foo.com" != "foo.com"). - * - * Areas are matched in the following cases: - * 1. "*" (without quotes) always matches any hosts. - * 2. An exact match. - * 3. The area starts with "." and the area is the last part of the host. e.g. - * '.mit.edu' will match any host that ends with '.mit.edu'. - * - * @param string $host Host to check against the patterns. - * @param array $noProxyArray An array of host patterns. - * - * @return bool - */ -function is_host_in_noproxy($host, array $noProxyArray) -{ - if (strlen($host) === 0) { - throw new \InvalidArgumentException('Empty host provided'); - } - - // Strip port if present. - if (strpos($host, ':')) { - $host = explode($host, ':', 2)[0]; - } - - foreach ($noProxyArray as $area) { - // Always match on wildcards. - if ($area === '*') { - return true; - } elseif (empty($area)) { - // Don't match on empty values. - continue; - } elseif ($area === $host) { - // Exact matches. - return true; - } else { - // Special match if the area when prefixed with ".". Remove any - // existing leading "." and add a new leading ".". - $area = '.' . ltrim($area, '.'); - if (substr($host, -(strlen($area))) === $area) { - return true; - } - } - } - - return false; -} - -/** - * Wrapper for json_decode that throws when an error occurs. - * - * @param string $json JSON data to parse - * @param bool $assoc When true, returned objects will be converted - * into associative arrays. - * @param int $depth User specified recursion depth. - * @param int $options Bitmask of JSON decode options. - * - * @return mixed - * @throws Exception\InvalidArgumentException if the JSON cannot be decoded. - * @link http://www.php.net/manual/en/function.json-decode.php - */ -function json_decode($json, $assoc = false, $depth = 512, $options = 0) -{ - $data = \json_decode($json, $assoc, $depth, $options); - if (JSON_ERROR_NONE !== json_last_error()) { - throw new Exception\InvalidArgumentException( - 'json_decode error: ' . json_last_error_msg() - ); - } - - return $data; -} - -/** - * Wrapper for JSON encoding that throws when an error occurs. - * - * @param mixed $value The value being encoded - * @param int $options JSON encode option bitmask - * @param int $depth Set the maximum depth. Must be greater than zero. - * - * @return string - * @throws Exception\InvalidArgumentException if the JSON cannot be encoded. - * @link http://www.php.net/manual/en/function.json-encode.php - */ -function json_encode($value, $options = 0, $depth = 512) -{ - $json = \json_encode($value, $options, $depth); - if (JSON_ERROR_NONE !== json_last_error()) { - throw new Exception\InvalidArgumentException( - 'json_encode error: ' . json_last_error_msg() - ); - } - - return $json; -} diff --git a/tests/integration/vendor/guzzlehttp/guzzle/src/functions_include.php b/tests/integration/vendor/guzzlehttp/guzzle/src/functions_include.php deleted file mode 100644 index a93393a..0000000 --- a/tests/integration/vendor/guzzlehttp/guzzle/src/functions_include.php +++ /dev/null @@ -1,6 +0,0 @@ - -Copyright (c) 2015 Graham Campbell -Copyright (c) 2017 Tobias Schultze -Copyright (c) 2020 Tobias Nyholm - -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. diff --git a/tests/integration/vendor/guzzlehttp/promises/README.md b/tests/integration/vendor/guzzlehttp/promises/README.md deleted file mode 100644 index 1ea667a..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/README.md +++ /dev/null @@ -1,546 +0,0 @@ -# Guzzle Promises - -[Promises/A+](https://promisesaplus.com/) implementation that handles promise -chaining and resolution iteratively, allowing for "infinite" promise chaining -while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/) -for a general introduction to promises. - -- [Features](#features) -- [Quick start](#quick-start) -- [Synchronous wait](#synchronous-wait) -- [Cancellation](#cancellation) -- [API](#api) - - [Promise](#promise) - - [FulfilledPromise](#fulfilledpromise) - - [RejectedPromise](#rejectedpromise) -- [Promise interop](#promise-interop) -- [Implementation notes](#implementation-notes) - - -## Features - -- [Promises/A+](https://promisesaplus.com/) implementation. -- Promise resolution and chaining is handled iteratively, allowing for - "infinite" promise chaining. -- Promises have a synchronous `wait` method. -- Promises can be cancelled. -- Works with any object that has a `then` function. -- C# style async/await coroutine promises using - `GuzzleHttp\Promise\Coroutine::of()`. - - -## Quick Start - -A *promise* represents the eventual result of an asynchronous operation. The -primary way of interacting with a promise is through its `then` method, which -registers callbacks to receive either a promise's eventual value or the reason -why the promise cannot be fulfilled. - -### Callbacks - -Callbacks are registered with the `then` method by providing an optional -`$onFulfilled` followed by an optional `$onRejected` function. - - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then( - // $onFulfilled - function ($value) { - echo 'The promise was fulfilled.'; - }, - // $onRejected - function ($reason) { - echo 'The promise was rejected.'; - } -); -``` - -*Resolving* a promise means that you either fulfill a promise with a *value* or -reject a promise with a *reason*. Resolving a promise triggers callbacks -registered with the promise's `then` method. These callbacks are triggered -only once and in the order in which they were added. - -### Resolving a Promise - -Promises are fulfilled using the `resolve($value)` method. Resolving a promise -with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger -all of the onFulfilled callbacks (resolving a promise with a rejected promise -will reject the promise and trigger the `$onRejected` callbacks). - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise - ->then(function ($value) { - // Return a value and don't break the chain - return "Hello, " . $value; - }) - // This then is executed after the first then and receives the value - // returned from the first then. - ->then(function ($value) { - echo $value; - }); - -// Resolving the promise triggers the $onFulfilled callbacks and outputs -// "Hello, reader." -$promise->resolve('reader.'); -``` - -### Promise Forwarding - -Promises can be chained one after the other. Each then in the chain is a new -promise. The return value of a promise is what's forwarded to the next -promise in the chain. Returning a promise in a `then` callback will cause the -subsequent promises in the chain to only be fulfilled when the returned promise -has been fulfilled. The next promise in the chain will be invoked with the -resolved value of the promise. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$nextPromise = new Promise(); - -$promise - ->then(function ($value) use ($nextPromise) { - echo $value; - return $nextPromise; - }) - ->then(function ($value) { - echo $value; - }); - -// Triggers the first callback and outputs "A" -$promise->resolve('A'); -// Triggers the second callback and outputs "B" -$nextPromise->resolve('B'); -``` - -### Promise Rejection - -When a promise is rejected, the `$onRejected` callbacks are invoked with the -rejection reason. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - echo $reason; -}); - -$promise->reject('Error!'); -// Outputs "Error!" -``` - -### Rejection Forwarding - -If an exception is thrown in an `$onRejected` callback, subsequent -`$onRejected` callbacks are invoked with the thrown exception as the reason. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - throw new Exception($reason); -})->then(null, function ($reason) { - assert($reason->getMessage() === 'Error!'); -}); - -$promise->reject('Error!'); -``` - -You can also forward a rejection down the promise chain by returning a -`GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or -`$onRejected` callback. - -```php -use GuzzleHttp\Promise\Promise; -use GuzzleHttp\Promise\RejectedPromise; - -$promise = new Promise(); -$promise->then(null, function ($reason) { - return new RejectedPromise($reason); -})->then(null, function ($reason) { - assert($reason === 'Error!'); -}); - -$promise->reject('Error!'); -``` - -If an exception is not thrown in a `$onRejected` callback and the callback -does not return a rejected promise, downstream `$onFulfilled` callbacks are -invoked using the value returned from the `$onRejected` callback. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise(); -$promise - ->then(null, function ($reason) { - return "It's ok"; - }) - ->then(function ($value) { - assert($value === "It's ok"); - }); - -$promise->reject('Error!'); -``` - - -## Synchronous Wait - -You can synchronously force promises to complete using a promise's `wait` -method. When creating a promise, you can provide a wait function that is used -to synchronously force a promise to complete. When a wait function is invoked -it is expected to deliver a value to the promise or reject the promise. If the -wait function does not deliver a value, then an exception is thrown. The wait -function provided to a promise constructor is invoked when the `wait` function -of the promise is called. - -```php -$promise = new Promise(function () use (&$promise) { - $promise->resolve('foo'); -}); - -// Calling wait will return the value of the promise. -echo $promise->wait(); // outputs "foo" -``` - -If an exception is encountered while invoking the wait function of a promise, -the promise is rejected with the exception and the exception is thrown. - -```php -$promise = new Promise(function () use (&$promise) { - throw new Exception('foo'); -}); - -$promise->wait(); // throws the exception. -``` - -Calling `wait` on a promise that has been fulfilled will not trigger the wait -function. It will simply return the previously resolved value. - -```php -$promise = new Promise(function () { die('this is not called!'); }); -$promise->resolve('foo'); -echo $promise->wait(); // outputs "foo" -``` - -Calling `wait` on a promise that has been rejected will throw an exception. If -the rejection reason is an instance of `\Exception` the reason is thrown. -Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason -can be obtained by calling the `getReason` method of the exception. - -```php -$promise = new Promise(); -$promise->reject('foo'); -$promise->wait(); -``` - -> PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo' - -### Unwrapping a Promise - -When synchronously waiting on a promise, you are joining the state of the -promise into the current state of execution (i.e., return the value of the -promise if it was fulfilled or throw an exception if it was rejected). This is -called "unwrapping" the promise. Waiting on a promise will by default unwrap -the promise state. - -You can force a promise to resolve and *not* unwrap the state of the promise -by passing `false` to the first argument of the `wait` function: - -```php -$promise = new Promise(); -$promise->reject('foo'); -// This will not throw an exception. It simply ensures the promise has -// been resolved. -$promise->wait(false); -``` - -When unwrapping a promise, the resolved value of the promise will be waited -upon until the unwrapped value is not a promise. This means that if you resolve -promise A with a promise B and unwrap promise A, the value returned by the -wait function will be the value delivered to promise B. - -**Note**: when you do not unwrap the promise, no value is returned. - - -## Cancellation - -You can cancel a promise that has not yet been fulfilled using the `cancel()` -method of a promise. When creating a promise you can provide an optional -cancel function that when invoked cancels the action of computing a resolution -of the promise. - - -## API - -### Promise - -When creating a promise object, you can provide an optional `$waitFn` and -`$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is -expected to resolve the promise. `$cancelFn` is a function with no arguments -that is expected to cancel the computation of a promise. It is invoked when the -`cancel()` method of a promise is called. - -```php -use GuzzleHttp\Promise\Promise; - -$promise = new Promise( - function () use (&$promise) { - $promise->resolve('waited'); - }, - function () { - // do something that will cancel the promise computation (e.g., close - // a socket, cancel a database query, etc...) - } -); - -assert('waited' === $promise->wait()); -``` - -A promise has the following methods: - -- `then(callable $onFulfilled, callable $onRejected) : PromiseInterface` - - Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler. - -- `otherwise(callable $onRejected) : PromiseInterface` - - Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled. - -- `wait($unwrap = true) : mixed` - - Synchronously waits on the promise to complete. - - `$unwrap` controls whether or not the value of the promise is returned for a - fulfilled promise or if an exception is thrown if the promise is rejected. - This is set to `true` by default. - -- `cancel()` - - Attempts to cancel the promise if possible. The promise being cancelled and - the parent most ancestor that has not yet been resolved will also be - cancelled. Any promises waiting on the cancelled promise to resolve will also - be cancelled. - -- `getState() : string` - - Returns the state of the promise. One of `pending`, `fulfilled`, or - `rejected`. - -- `resolve($value)` - - Fulfills the promise with the given `$value`. - -- `reject($reason)` - - Rejects the promise with the given `$reason`. - - -### FulfilledPromise - -A fulfilled promise can be created to represent a promise that has been -fulfilled. - -```php -use GuzzleHttp\Promise\FulfilledPromise; - -$promise = new FulfilledPromise('value'); - -// Fulfilled callbacks are immediately invoked. -$promise->then(function ($value) { - echo $value; -}); -``` - - -### RejectedPromise - -A rejected promise can be created to represent a promise that has been -rejected. - -```php -use GuzzleHttp\Promise\RejectedPromise; - -$promise = new RejectedPromise('Error'); - -// Rejected callbacks are immediately invoked. -$promise->then(null, function ($reason) { - echo $reason; -}); -``` - - -## Promise Interoperability - -This library works with foreign promises that have a `then` method. This means -you can use Guzzle promises with [React promises](https://github.com/reactphp/promise) -for example. When a foreign promise is returned inside of a then method -callback, promise resolution will occur recursively. - -```php -// Create a React promise -$deferred = new React\Promise\Deferred(); -$reactPromise = $deferred->promise(); - -// Create a Guzzle promise that is fulfilled with a React promise. -$guzzlePromise = new GuzzleHttp\Promise\Promise(); -$guzzlePromise->then(function ($value) use ($reactPromise) { - // Do something something with the value... - // Return the React promise - return $reactPromise; -}); -``` - -Please note that wait and cancel chaining is no longer possible when forwarding -a foreign promise. You will need to wrap a third-party promise with a Guzzle -promise in order to utilize wait and cancel functions with foreign promises. - - -### Event Loop Integration - -In order to keep the stack size constant, Guzzle promises are resolved -asynchronously using a task queue. When waiting on promises synchronously, the -task queue will be automatically run to ensure that the blocking promise and -any forwarded promises are resolved. When using promises asynchronously in an -event loop, you will need to run the task queue on each tick of the loop. If -you do not run the task queue, then promises will not be resolved. - -You can run the task queue using the `run()` method of the global task queue -instance. - -```php -// Get the global task queue -$queue = GuzzleHttp\Promise\Utils::queue(); -$queue->run(); -``` - -For example, you could use Guzzle promises with React using a periodic timer: - -```php -$loop = React\EventLoop\Factory::create(); -$loop->addPeriodicTimer(0, [$queue, 'run']); -``` - -*TODO*: Perhaps adding a `futureTick()` on each tick would be faster? - - -## Implementation Notes - -### Promise Resolution and Chaining is Handled Iteratively - -By shuffling pending handlers from one owner to another, promises are -resolved iteratively, allowing for "infinite" then chaining. - -```php -then(function ($v) { - // The stack size remains constant (a good thing) - echo xdebug_get_stack_depth() . ', '; - return $v + 1; - }); -} - -$parent->resolve(0); -var_dump($p->wait()); // int(1000) - -``` - -When a promise is fulfilled or rejected with a non-promise value, the promise -then takes ownership of the handlers of each child promise and delivers values -down the chain without using recursion. - -When a promise is resolved with another promise, the original promise transfers -all of its pending handlers to the new promise. When the new promise is -eventually resolved, all of the pending handlers are delivered the forwarded -value. - -### A Promise is the Deferred - -Some promise libraries implement promises using a deferred object to represent -a computation and a promise object to represent the delivery of the result of -the computation. This is a nice separation of computation and delivery because -consumers of the promise cannot modify the value that will be eventually -delivered. - -One side effect of being able to implement promise resolution and chaining -iteratively is that you need to be able for one promise to reach into the state -of another promise to shuffle around ownership of handlers. In order to achieve -this without making the handlers of a promise publicly mutable, a promise is -also the deferred value, allowing promises of the same parent class to reach -into and modify the private properties of promises of the same type. While this -does allow consumers of the value to modify the resolution or rejection of the -deferred, it is a small price to pay for keeping the stack size constant. - -```php -$promise = new Promise(); -$promise->then(function ($value) { echo $value; }); -// The promise is the deferred value, so you can deliver a value to it. -$promise->resolve('foo'); -// prints "foo" -``` - - -## Upgrading from Function API - -A static API was first introduced in 1.4.0, in order to mitigate problems with -functions conflicting between global and local copies of the package. The -function API will be removed in 2.0.0. A migration table has been provided here -for your convenience: - -| Original Function | Replacement Method | -|----------------|----------------| -| `queue` | `Utils::queue` | -| `task` | `Utils::task` | -| `promise_for` | `Create::promiseFor` | -| `rejection_for` | `Create::rejectionFor` | -| `exception_for` | `Create::exceptionFor` | -| `iter_for` | `Create::iterFor` | -| `inspect` | `Utils::inspect` | -| `inspect_all` | `Utils::inspectAll` | -| `unwrap` | `Utils::unwrap` | -| `all` | `Utils::all` | -| `some` | `Utils::some` | -| `any` | `Utils::any` | -| `settle` | `Utils::settle` | -| `each` | `Each::of` | -| `each_limit` | `Each::ofLimit` | -| `each_limit_all` | `Each::ofLimitAll` | -| `!is_fulfilled` | `Is::pending` | -| `is_fulfilled` | `Is::fulfilled` | -| `is_rejected` | `Is::rejected` | -| `is_settled` | `Is::settled` | -| `coroutine` | `Coroutine::of` | - - -## Security - -If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/promises/security/policy) for more information. - - -## License - -Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. - - -## For Enterprise - -Available as part of the Tidelift Subscription - -The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-promises?utm_source=packagist-guzzlehttp-promises&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/tests/integration/vendor/guzzlehttp/promises/composer.json b/tests/integration/vendor/guzzlehttp/promises/composer.json deleted file mode 100644 index 966e3e3..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/composer.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "guzzlehttp/promises", - "description": "Guzzle promises library", - "keywords": ["promise"], - "license": "MIT", - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "require": { - "php": ">=5.5" - }, - "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": ["src/functions_include.php"] - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\Promise\\Tests\\": "tests/" - } - }, - "scripts": { - "test": "vendor/bin/simple-phpunit", - "test-ci": "vendor/bin/simple-phpunit --coverage-text" - }, - "config": { - "preferred-install": "dist", - "sort-packages": true - } -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/AggregateException.php b/tests/integration/vendor/guzzlehttp/promises/src/AggregateException.php deleted file mode 100644 index d2b5712..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/AggregateException.php +++ /dev/null @@ -1,17 +0,0 @@ -then(function ($v) { echo $v; }); - * - * @param callable $generatorFn Generator function to wrap into a promise. - * - * @return Promise - * - * @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration - */ -final class Coroutine implements PromiseInterface -{ - /** - * @var PromiseInterface|null - */ - private $currentPromise; - - /** - * @var Generator - */ - private $generator; - - /** - * @var Promise - */ - private $result; - - public function __construct(callable $generatorFn) - { - $this->generator = $generatorFn(); - $this->result = new Promise(function () { - while (isset($this->currentPromise)) { - $this->currentPromise->wait(); - } - }); - try { - $this->nextCoroutine($this->generator->current()); - } catch (\Exception $exception) { - $this->result->reject($exception); - } catch (Throwable $throwable) { - $this->result->reject($throwable); - } - } - - /** - * Create a new coroutine. - * - * @return self - */ - public static function of(callable $generatorFn) - { - return new self($generatorFn); - } - - public function then( - callable $onFulfilled = null, - callable $onRejected = null - ) { - return $this->result->then($onFulfilled, $onRejected); - } - - public function otherwise(callable $onRejected) - { - return $this->result->otherwise($onRejected); - } - - public function wait($unwrap = true) - { - return $this->result->wait($unwrap); - } - - public function getState() - { - return $this->result->getState(); - } - - public function resolve($value) - { - $this->result->resolve($value); - } - - public function reject($reason) - { - $this->result->reject($reason); - } - - public function cancel() - { - $this->currentPromise->cancel(); - $this->result->cancel(); - } - - private function nextCoroutine($yielded) - { - $this->currentPromise = Create::promiseFor($yielded) - ->then([$this, '_handleSuccess'], [$this, '_handleFailure']); - } - - /** - * @internal - */ - public function _handleSuccess($value) - { - unset($this->currentPromise); - try { - $next = $this->generator->send($value); - if ($this->generator->valid()) { - $this->nextCoroutine($next); - } else { - $this->result->resolve($value); - } - } catch (Exception $exception) { - $this->result->reject($exception); - } catch (Throwable $throwable) { - $this->result->reject($throwable); - } - } - - /** - * @internal - */ - public function _handleFailure($reason) - { - unset($this->currentPromise); - try { - $nextYield = $this->generator->throw(Create::exceptionFor($reason)); - // The throw was caught, so keep iterating on the coroutine - $this->nextCoroutine($nextYield); - } catch (Exception $exception) { - $this->result->reject($exception); - } catch (Throwable $throwable) { - $this->result->reject($throwable); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/EachPromise.php b/tests/integration/vendor/guzzlehttp/promises/src/EachPromise.php deleted file mode 100644 index 280d799..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/EachPromise.php +++ /dev/null @@ -1,247 +0,0 @@ -iterable = Create::iterFor($iterable); - - if (isset($config['concurrency'])) { - $this->concurrency = $config['concurrency']; - } - - if (isset($config['fulfilled'])) { - $this->onFulfilled = $config['fulfilled']; - } - - if (isset($config['rejected'])) { - $this->onRejected = $config['rejected']; - } - } - - /** @psalm-suppress InvalidNullableReturnType */ - public function promise() - { - if ($this->aggregate) { - return $this->aggregate; - } - - try { - $this->createPromise(); - /** @psalm-assert Promise $this->aggregate */ - $this->iterable->rewind(); - $this->refillPending(); - } catch (\Throwable $e) { - $this->aggregate->reject($e); - } catch (\Exception $e) { - $this->aggregate->reject($e); - } - - /** - * @psalm-suppress NullableReturnStatement - * @phpstan-ignore-next-line - */ - return $this->aggregate; - } - - private function createPromise() - { - $this->mutex = false; - $this->aggregate = new Promise(function () { - if ($this->checkIfFinished()) { - return; - } - reset($this->pending); - // Consume a potentially fluctuating list of promises while - // ensuring that indexes are maintained (precluding array_shift). - while ($promise = current($this->pending)) { - next($this->pending); - $promise->wait(); - if (Is::settled($this->aggregate)) { - return; - } - } - }); - - // Clear the references when the promise is resolved. - $clearFn = function () { - $this->iterable = $this->concurrency = $this->pending = null; - $this->onFulfilled = $this->onRejected = null; - $this->nextPendingIndex = 0; - }; - - $this->aggregate->then($clearFn, $clearFn); - } - - private function refillPending() - { - if (!$this->concurrency) { - // Add all pending promises. - while ($this->addPending() && $this->advanceIterator()); - return; - } - - // Add only up to N pending promises. - $concurrency = is_callable($this->concurrency) - ? call_user_func($this->concurrency, count($this->pending)) - : $this->concurrency; - $concurrency = max($concurrency - count($this->pending), 0); - // Concurrency may be set to 0 to disallow new promises. - if (!$concurrency) { - return; - } - // Add the first pending promise. - $this->addPending(); - // Note this is special handling for concurrency=1 so that we do - // not advance the iterator after adding the first promise. This - // helps work around issues with generators that might not have the - // next value to yield until promise callbacks are called. - while (--$concurrency - && $this->advanceIterator() - && $this->addPending()); - } - - private function addPending() - { - if (!$this->iterable || !$this->iterable->valid()) { - return false; - } - - $promise = Create::promiseFor($this->iterable->current()); - $key = $this->iterable->key(); - - // Iterable keys may not be unique, so we use a counter to - // guarantee uniqueness - $idx = $this->nextPendingIndex++; - - $this->pending[$idx] = $promise->then( - function ($value) use ($idx, $key) { - if ($this->onFulfilled) { - call_user_func( - $this->onFulfilled, - $value, - $key, - $this->aggregate - ); - } - $this->step($idx); - }, - function ($reason) use ($idx, $key) { - if ($this->onRejected) { - call_user_func( - $this->onRejected, - $reason, - $key, - $this->aggregate - ); - } - $this->step($idx); - } - ); - - return true; - } - - private function advanceIterator() - { - // Place a lock on the iterator so that we ensure to not recurse, - // preventing fatal generator errors. - if ($this->mutex) { - return false; - } - - $this->mutex = true; - - try { - $this->iterable->next(); - $this->mutex = false; - return true; - } catch (\Throwable $e) { - $this->aggregate->reject($e); - $this->mutex = false; - return false; - } catch (\Exception $e) { - $this->aggregate->reject($e); - $this->mutex = false; - return false; - } - } - - private function step($idx) - { - // If the promise was already resolved, then ignore this step. - if (Is::settled($this->aggregate)) { - return; - } - - unset($this->pending[$idx]); - - // Only refill pending promises if we are not locked, preventing the - // EachPromise to recursively invoke the provided iterator, which - // cause a fatal error: "Cannot resume an already running generator" - if ($this->advanceIterator() && !$this->checkIfFinished()) { - // Add more pending promises if possible. - $this->refillPending(); - } - } - - private function checkIfFinished() - { - if (!$this->pending && !$this->iterable->valid()) { - // Resolve the promise if there's nothing left to do. - $this->aggregate->resolve(null); - return true; - } - - return false; - } -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/FulfilledPromise.php b/tests/integration/vendor/guzzlehttp/promises/src/FulfilledPromise.php deleted file mode 100644 index 98f72a6..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/FulfilledPromise.php +++ /dev/null @@ -1,84 +0,0 @@ -value = $value; - } - - public function then( - callable $onFulfilled = null, - callable $onRejected = null - ) { - // Return itself if there is no onFulfilled function. - if (!$onFulfilled) { - return $this; - } - - $queue = Utils::queue(); - $p = new Promise([$queue, 'run']); - $value = $this->value; - $queue->add(static function () use ($p, $value, $onFulfilled) { - if (Is::pending($p)) { - try { - $p->resolve($onFulfilled($value)); - } catch (\Throwable $e) { - $p->reject($e); - } catch (\Exception $e) { - $p->reject($e); - } - } - }); - - return $p; - } - - public function otherwise(callable $onRejected) - { - return $this->then(null, $onRejected); - } - - public function wait($unwrap = true, $defaultDelivery = null) - { - return $unwrap ? $this->value : null; - } - - public function getState() - { - return self::FULFILLED; - } - - public function resolve($value) - { - if ($value !== $this->value) { - throw new \LogicException("Cannot resolve a fulfilled promise"); - } - } - - public function reject($reason) - { - throw new \LogicException("Cannot reject a fulfilled promise"); - } - - public function cancel() - { - // pass - } -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/Promise.php b/tests/integration/vendor/guzzlehttp/promises/src/Promise.php deleted file mode 100644 index 7593905..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/Promise.php +++ /dev/null @@ -1,278 +0,0 @@ -waitFn = $waitFn; - $this->cancelFn = $cancelFn; - } - - public function then( - callable $onFulfilled = null, - callable $onRejected = null - ) { - if ($this->state === self::PENDING) { - $p = new Promise(null, [$this, 'cancel']); - $this->handlers[] = [$p, $onFulfilled, $onRejected]; - $p->waitList = $this->waitList; - $p->waitList[] = $this; - return $p; - } - - // Return a fulfilled promise and immediately invoke any callbacks. - if ($this->state === self::FULFILLED) { - $promise = Create::promiseFor($this->result); - return $onFulfilled ? $promise->then($onFulfilled) : $promise; - } - - // It's either cancelled or rejected, so return a rejected promise - // and immediately invoke any callbacks. - $rejection = Create::rejectionFor($this->result); - return $onRejected ? $rejection->then(null, $onRejected) : $rejection; - } - - public function otherwise(callable $onRejected) - { - return $this->then(null, $onRejected); - } - - public function wait($unwrap = true) - { - $this->waitIfPending(); - - if ($this->result instanceof PromiseInterface) { - return $this->result->wait($unwrap); - } - if ($unwrap) { - if ($this->state === self::FULFILLED) { - return $this->result; - } - // It's rejected so "unwrap" and throw an exception. - throw Create::exceptionFor($this->result); - } - } - - public function getState() - { - return $this->state; - } - - public function cancel() - { - if ($this->state !== self::PENDING) { - return; - } - - $this->waitFn = $this->waitList = null; - - if ($this->cancelFn) { - $fn = $this->cancelFn; - $this->cancelFn = null; - try { - $fn(); - } catch (\Throwable $e) { - $this->reject($e); - } catch (\Exception $e) { - $this->reject($e); - } - } - - // Reject the promise only if it wasn't rejected in a then callback. - /** @psalm-suppress RedundantCondition */ - if ($this->state === self::PENDING) { - $this->reject(new CancellationException('Promise has been cancelled')); - } - } - - public function resolve($value) - { - $this->settle(self::FULFILLED, $value); - } - - public function reject($reason) - { - $this->settle(self::REJECTED, $reason); - } - - private function settle($state, $value) - { - if ($this->state !== self::PENDING) { - // Ignore calls with the same resolution. - if ($state === $this->state && $value === $this->result) { - return; - } - throw $this->state === $state - ? new \LogicException("The promise is already {$state}.") - : new \LogicException("Cannot change a {$this->state} promise to {$state}"); - } - - if ($value === $this) { - throw new \LogicException('Cannot fulfill or reject a promise with itself'); - } - - // Clear out the state of the promise but stash the handlers. - $this->state = $state; - $this->result = $value; - $handlers = $this->handlers; - $this->handlers = null; - $this->waitList = $this->waitFn = null; - $this->cancelFn = null; - - if (!$handlers) { - return; - } - - // If the value was not a settled promise or a thenable, then resolve - // it in the task queue using the correct ID. - if (!is_object($value) || !method_exists($value, 'then')) { - $id = $state === self::FULFILLED ? 1 : 2; - // It's a success, so resolve the handlers in the queue. - Utils::queue()->add(static function () use ($id, $value, $handlers) { - foreach ($handlers as $handler) { - self::callHandler($id, $value, $handler); - } - }); - } elseif ($value instanceof Promise && Is::pending($value)) { - // We can just merge our handlers onto the next promise. - $value->handlers = array_merge($value->handlers, $handlers); - } else { - // Resolve the handlers when the forwarded promise is resolved. - $value->then( - static function ($value) use ($handlers) { - foreach ($handlers as $handler) { - self::callHandler(1, $value, $handler); - } - }, - static function ($reason) use ($handlers) { - foreach ($handlers as $handler) { - self::callHandler(2, $reason, $handler); - } - } - ); - } - } - - /** - * Call a stack of handlers using a specific callback index and value. - * - * @param int $index 1 (resolve) or 2 (reject). - * @param mixed $value Value to pass to the callback. - * @param array $handler Array of handler data (promise and callbacks). - */ - private static function callHandler($index, $value, array $handler) - { - /** @var PromiseInterface $promise */ - $promise = $handler[0]; - - // The promise may have been cancelled or resolved before placing - // this thunk in the queue. - if (Is::settled($promise)) { - return; - } - - try { - if (isset($handler[$index])) { - /* - * If $f throws an exception, then $handler will be in the exception - * stack trace. Since $handler contains a reference to the callable - * itself we get a circular reference. We clear the $handler - * here to avoid that memory leak. - */ - $f = $handler[$index]; - unset($handler); - $promise->resolve($f($value)); - } elseif ($index === 1) { - // Forward resolution values as-is. - $promise->resolve($value); - } else { - // Forward rejections down the chain. - $promise->reject($value); - } - } catch (\Throwable $reason) { - $promise->reject($reason); - } catch (\Exception $reason) { - $promise->reject($reason); - } - } - - private function waitIfPending() - { - if ($this->state !== self::PENDING) { - return; - } elseif ($this->waitFn) { - $this->invokeWaitFn(); - } elseif ($this->waitList) { - $this->invokeWaitList(); - } else { - // If there's no wait function, then reject the promise. - $this->reject('Cannot wait on a promise that has ' - . 'no internal wait function. You must provide a wait ' - . 'function when constructing the promise to be able to ' - . 'wait on a promise.'); - } - - Utils::queue()->run(); - - /** @psalm-suppress RedundantCondition */ - if ($this->state === self::PENDING) { - $this->reject('Invoking the wait callback did not resolve the promise'); - } - } - - private function invokeWaitFn() - { - try { - $wfn = $this->waitFn; - $this->waitFn = null; - $wfn(true); - } catch (\Exception $reason) { - if ($this->state === self::PENDING) { - // The promise has not been resolved yet, so reject the promise - // with the exception. - $this->reject($reason); - } else { - // The promise was already resolved, so there's a problem in - // the application. - throw $reason; - } - } - } - - private function invokeWaitList() - { - $waitList = $this->waitList; - $this->waitList = null; - - foreach ($waitList as $result) { - do { - $result->waitIfPending(); - $result = $result->result; - } while ($result instanceof Promise); - - if ($result instanceof PromiseInterface) { - $result->wait(false); - } - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/PromiseInterface.php b/tests/integration/vendor/guzzlehttp/promises/src/PromiseInterface.php deleted file mode 100644 index e598331..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/PromiseInterface.php +++ /dev/null @@ -1,97 +0,0 @@ -reason = $reason; - } - - public function then( - callable $onFulfilled = null, - callable $onRejected = null - ) { - // If there's no onRejected callback then just return self. - if (!$onRejected) { - return $this; - } - - $queue = Utils::queue(); - $reason = $this->reason; - $p = new Promise([$queue, 'run']); - $queue->add(static function () use ($p, $reason, $onRejected) { - if (Is::pending($p)) { - try { - // Return a resolved promise if onRejected does not throw. - $p->resolve($onRejected($reason)); - } catch (\Throwable $e) { - // onRejected threw, so return a rejected promise. - $p->reject($e); - } catch (\Exception $e) { - // onRejected threw, so return a rejected promise. - $p->reject($e); - } - } - }); - - return $p; - } - - public function otherwise(callable $onRejected) - { - return $this->then(null, $onRejected); - } - - public function wait($unwrap = true, $defaultDelivery = null) - { - if ($unwrap) { - throw Create::exceptionFor($this->reason); - } - - return null; - } - - public function getState() - { - return self::REJECTED; - } - - public function resolve($value) - { - throw new \LogicException("Cannot resolve a rejected promise"); - } - - public function reject($reason) - { - if ($reason !== $this->reason) { - throw new \LogicException("Cannot reject a rejected promise"); - } - } - - public function cancel() - { - // pass - } -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/RejectionException.php b/tests/integration/vendor/guzzlehttp/promises/src/RejectionException.php deleted file mode 100644 index e2f1377..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/RejectionException.php +++ /dev/null @@ -1,48 +0,0 @@ -reason = $reason; - - $message = 'The promise was rejected'; - - if ($description) { - $message .= ' with reason: ' . $description; - } elseif (is_string($reason) - || (is_object($reason) && method_exists($reason, '__toString')) - ) { - $message .= ' with reason: ' . $this->reason; - } elseif ($reason instanceof \JsonSerializable) { - $message .= ' with reason: ' - . json_encode($this->reason, JSON_PRETTY_PRINT); - } - - parent::__construct($message); - } - - /** - * Returns the rejection reason. - * - * @return mixed - */ - public function getReason() - { - return $this->reason; - } -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/TaskQueue.php b/tests/integration/vendor/guzzlehttp/promises/src/TaskQueue.php deleted file mode 100644 index f0fba2c..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/TaskQueue.php +++ /dev/null @@ -1,67 +0,0 @@ -run(); - */ -class TaskQueue implements TaskQueueInterface -{ - private $enableShutdown = true; - private $queue = []; - - public function __construct($withShutdown = true) - { - if ($withShutdown) { - register_shutdown_function(function () { - if ($this->enableShutdown) { - // Only run the tasks if an E_ERROR didn't occur. - $err = error_get_last(); - if (!$err || ($err['type'] ^ E_ERROR)) { - $this->run(); - } - } - }); - } - } - - public function isEmpty() - { - return !$this->queue; - } - - public function add(callable $task) - { - $this->queue[] = $task; - } - - public function run() - { - while ($task = array_shift($this->queue)) { - /** @var callable $task */ - $task(); - } - } - - /** - * The task queue will be run and exhausted by default when the process - * exits IFF the exit is not the result of a PHP E_ERROR error. - * - * You can disable running the automatic shutdown of the queue by calling - * this function. If you disable the task queue shutdown process, then you - * MUST either run the task queue (as a result of running your event loop - * or manually using the run() method) or wait on each outstanding promise. - * - * Note: This shutdown will occur before any destructors are triggered. - */ - public function disableShutdown() - { - $this->enableShutdown = false; - } -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/TaskQueueInterface.php b/tests/integration/vendor/guzzlehttp/promises/src/TaskQueueInterface.php deleted file mode 100644 index 723d4d5..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/TaskQueueInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - * while ($eventLoop->isRunning()) { - * GuzzleHttp\Promise\queue()->run(); - * } - * - * - * @param TaskQueueInterface $assign Optionally specify a new queue instance. - * - * @return TaskQueueInterface - * - * @deprecated queue will be removed in guzzlehttp/promises:2.0. Use Utils::queue instead. - */ -function queue(TaskQueueInterface $assign = null) -{ - return Utils::queue($assign); -} - -/** - * Adds a function to run in the task queue when it is next `run()` and returns - * a promise that is fulfilled or rejected with the result. - * - * @param callable $task Task function to run. - * - * @return PromiseInterface - * - * @deprecated task will be removed in guzzlehttp/promises:2.0. Use Utils::task instead. - */ -function task(callable $task) -{ - return Utils::task($task); -} - -/** - * Creates a promise for a value if the value is not a promise. - * - * @param mixed $value Promise or value. - * - * @return PromiseInterface - * - * @deprecated promise_for will be removed in guzzlehttp/promises:2.0. Use Create::promiseFor instead. - */ -function promise_for($value) -{ - return Create::promiseFor($value); -} - -/** - * Creates a rejected promise for a reason if the reason is not a promise. If - * the provided reason is a promise, then it is returned as-is. - * - * @param mixed $reason Promise or reason. - * - * @return PromiseInterface - * - * @deprecated rejection_for will be removed in guzzlehttp/promises:2.0. Use Create::rejectionFor instead. - */ -function rejection_for($reason) -{ - return Create::rejectionFor($reason); -} - -/** - * Create an exception for a rejected promise value. - * - * @param mixed $reason - * - * @return \Exception|\Throwable - * - * @deprecated exception_for will be removed in guzzlehttp/promises:2.0. Use Create::exceptionFor instead. - */ -function exception_for($reason) -{ - return Create::exceptionFor($reason); -} - -/** - * Returns an iterator for the given value. - * - * @param mixed $value - * - * @return \Iterator - * - * @deprecated iter_for will be removed in guzzlehttp/promises:2.0. Use Create::iterFor instead. - */ -function iter_for($value) -{ - return Create::iterFor($value); -} - -/** - * Synchronously waits on a promise to resolve and returns an inspection state - * array. - * - * Returns a state associative array containing a "state" key mapping to a - * valid promise state. If the state of the promise is "fulfilled", the array - * will contain a "value" key mapping to the fulfilled value of the promise. If - * the promise is rejected, the array will contain a "reason" key mapping to - * the rejection reason of the promise. - * - * @param PromiseInterface $promise Promise or value. - * - * @return array - * - * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspect instead. - */ -function inspect(PromiseInterface $promise) -{ - return Utils::inspect($promise); -} - -/** - * Waits on all of the provided promises, but does not unwrap rejected promises - * as thrown exception. - * - * Returns an array of inspection state arrays. - * - * @see inspect for the inspection state array format. - * - * @param PromiseInterface[] $promises Traversable of promises to wait upon. - * - * @return array - * - * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspectAll instead. - */ -function inspect_all($promises) -{ - return Utils::inspectAll($promises); -} - -/** - * Waits on all of the provided promises and returns the fulfilled values. - * - * Returns an array that contains the value of each promise (in the same order - * the promises were provided). An exception is thrown if any of the promises - * are rejected. - * - * @param iterable $promises Iterable of PromiseInterface objects to wait on. - * - * @return array - * - * @throws \Exception on error - * @throws \Throwable on error in PHP >=7 - * - * @deprecated unwrap will be removed in guzzlehttp/promises:2.0. Use Utils::unwrap instead. - */ -function unwrap($promises) -{ - return Utils::unwrap($promises); -} - -/** - * Given an array of promises, return a promise that is fulfilled when all the - * items in the array are fulfilled. - * - * The promise's fulfillment value is an array with fulfillment values at - * respective positions to the original array. If any promise in the array - * rejects, the returned promise is rejected with the rejection reason. - * - * @param mixed $promises Promises or values. - * @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution. - * - * @return PromiseInterface - * - * @deprecated all will be removed in guzzlehttp/promises:2.0. Use Utils::all instead. - */ -function all($promises, $recursive = false) -{ - return Utils::all($promises, $recursive); -} - -/** - * Initiate a competitive race between multiple promises or values (values will - * become immediately fulfilled promises). - * - * When count amount of promises have been fulfilled, the returned promise is - * fulfilled with an array that contains the fulfillment values of the winners - * in order of resolution. - * - * This promise is rejected with a {@see AggregateException} if the number of - * fulfilled promises is less than the desired $count. - * - * @param int $count Total number of promises. - * @param mixed $promises Promises or values. - * - * @return PromiseInterface - * - * @deprecated some will be removed in guzzlehttp/promises:2.0. Use Utils::some instead. - */ -function some($count, $promises) -{ - return Utils::some($count, $promises); -} - -/** - * Like some(), with 1 as count. However, if the promise fulfills, the - * fulfillment value is not an array of 1 but the value directly. - * - * @param mixed $promises Promises or values. - * - * @return PromiseInterface - * - * @deprecated any will be removed in guzzlehttp/promises:2.0. Use Utils::any instead. - */ -function any($promises) -{ - return Utils::any($promises); -} - -/** - * Returns a promise that is fulfilled when all of the provided promises have - * been fulfilled or rejected. - * - * The returned promise is fulfilled with an array of inspection state arrays. - * - * @see inspect for the inspection state array format. - * - * @param mixed $promises Promises or values. - * - * @return PromiseInterface - * - * @deprecated settle will be removed in guzzlehttp/promises:2.0. Use Utils::settle instead. - */ -function settle($promises) -{ - return Utils::settle($promises); -} - -/** - * Given an iterator that yields promises or values, returns a promise that is - * fulfilled with a null value when the iterator has been consumed or the - * aggregate promise has been fulfilled or rejected. - * - * $onFulfilled is a function that accepts the fulfilled value, iterator index, - * and the aggregate promise. The callback can invoke any necessary side - * effects and choose to resolve or reject the aggregate if needed. - * - * $onRejected is a function that accepts the rejection reason, iterator index, - * and the aggregate promise. The callback can invoke any necessary side - * effects and choose to resolve or reject the aggregate if needed. - * - * @param mixed $iterable Iterator or array to iterate over. - * @param callable $onFulfilled - * @param callable $onRejected - * - * @return PromiseInterface - * - * @deprecated each will be removed in guzzlehttp/promises:2.0. Use Each::of instead. - */ -function each( - $iterable, - callable $onFulfilled = null, - callable $onRejected = null -) { - return Each::of($iterable, $onFulfilled, $onRejected); -} - -/** - * Like each, but only allows a certain number of outstanding promises at any - * given time. - * - * $concurrency may be an integer or a function that accepts the number of - * pending promises and returns a numeric concurrency limit value to allow for - * dynamic a concurrency size. - * - * @param mixed $iterable - * @param int|callable $concurrency - * @param callable $onFulfilled - * @param callable $onRejected - * - * @return PromiseInterface - * - * @deprecated each_limit will be removed in guzzlehttp/promises:2.0. Use Each::ofLimit instead. - */ -function each_limit( - $iterable, - $concurrency, - callable $onFulfilled = null, - callable $onRejected = null -) { - return Each::ofLimit($iterable, $concurrency, $onFulfilled, $onRejected); -} - -/** - * Like each_limit, but ensures that no promise in the given $iterable argument - * is rejected. If any promise is rejected, then the aggregate promise is - * rejected with the encountered rejection. - * - * @param mixed $iterable - * @param int|callable $concurrency - * @param callable $onFulfilled - * - * @return PromiseInterface - * - * @deprecated each_limit_all will be removed in guzzlehttp/promises:2.0. Use Each::ofLimitAll instead. - */ -function each_limit_all( - $iterable, - $concurrency, - callable $onFulfilled = null -) { - return Each::ofLimitAll($iterable, $concurrency, $onFulfilled); -} - -/** - * Returns true if a promise is fulfilled. - * - * @return bool - * - * @deprecated is_fulfilled will be removed in guzzlehttp/promises:2.0. Use Is::fulfilled instead. - */ -function is_fulfilled(PromiseInterface $promise) -{ - return Is::fulfilled($promise); -} - -/** - * Returns true if a promise is rejected. - * - * @return bool - * - * @deprecated is_rejected will be removed in guzzlehttp/promises:2.0. Use Is::rejected instead. - */ -function is_rejected(PromiseInterface $promise) -{ - return Is::rejected($promise); -} - -/** - * Returns true if a promise is fulfilled or rejected. - * - * @return bool - * - * @deprecated is_settled will be removed in guzzlehttp/promises:2.0. Use Is::settled instead. - */ -function is_settled(PromiseInterface $promise) -{ - return Is::settled($promise); -} - -/** - * Create a new coroutine. - * - * @see Coroutine - * - * @return PromiseInterface - * - * @deprecated coroutine will be removed in guzzlehttp/promises:2.0. Use Coroutine::of instead. - */ -function coroutine(callable $generatorFn) -{ - return Coroutine::of($generatorFn); -} diff --git a/tests/integration/vendor/guzzlehttp/promises/src/functions_include.php b/tests/integration/vendor/guzzlehttp/promises/src/functions_include.php deleted file mode 100644 index 34cd171..0000000 --- a/tests/integration/vendor/guzzlehttp/promises/src/functions_include.php +++ /dev/null @@ -1,6 +0,0 @@ -withPath('foo')->withHost('example.com')` will throw an exception - because the path of a URI with an authority must start with a slash "/" or be empty - - `(new Uri())->withScheme('http')` will return `'http://localhost'` - -### Deprecated - -- `Uri::resolve` in favor of `UriResolver::resolve` -- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` - -### Fixed - -- `Stream::read` when length parameter <= 0. -- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. -- `ServerRequest::getUriFromGlobals` when `Host` header contains port. -- Compatibility of URIs with `file` scheme and empty host. - - -## [1.3.1] - 2016-06-25 - -### Fixed - -- `Uri::__toString` for network path references, e.g. `//example.org`. -- Missing lowercase normalization for host. -- Handling of URI components in case they are `'0'` in a lot of places, - e.g. as a user info password. -- `Uri::withAddedHeader` to correctly merge headers with different case. -- Trimming of header values in `Uri::withAddedHeader`. Header values may - be surrounded by whitespace which should be ignored according to RFC 7230 - Section 3.2.4. This does not apply to header names. -- `Uri::withAddedHeader` with an array of header values. -- `Uri::resolve` when base path has no slash and handling of fragment. -- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the - key/value both in encoded as well as decoded form to those methods. This is - consistent with withPath, withQuery etc. -- `ServerRequest::withoutAttribute` when attribute value is null. - - -## [1.3.0] - 2016-04-13 - -### Added - -- Remaining interfaces needed for full PSR7 compatibility - (ServerRequestInterface, UploadedFileInterface, etc.). -- Support for stream_for from scalars. - -### Changed - -- Can now extend Uri. - -### Fixed -- A bug in validating request methods by making it more permissive. - - -## [1.2.3] - 2016-02-18 - -### Fixed - -- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote - streams, which can sometimes return fewer bytes than requested with `fread`. -- Handling of gzipped responses with FNAME headers. - - -## [1.2.2] - 2016-01-22 - -### Added - -- Support for URIs without any authority. -- Support for HTTP 451 'Unavailable For Legal Reasons.' -- Support for using '0' as a filename. -- Support for including non-standard ports in Host headers. - - -## [1.2.1] - 2015-11-02 - -### Changes - -- Now supporting negative offsets when seeking to SEEK_END. - - -## [1.2.0] - 2015-08-15 - -### Changed - -- Body as `"0"` is now properly added to a response. -- Now allowing forward seeking in CachingStream. -- Now properly parsing HTTP requests that contain proxy targets in - `parse_request`. -- functions.php is now conditionally required. -- user-info is no longer dropped when resolving URIs. - - -## [1.1.0] - 2015-06-24 - -### Changed - -- URIs can now be relative. -- `multipart/form-data` headers are now overridden case-insensitively. -- URI paths no longer encode the following characters because they are allowed - in URIs: "(", ")", "*", "!", "'" -- A port is no longer added to a URI when the scheme is missing and no port is - present. - - -## 1.0.0 - 2015-05-19 - -Initial release. - -Currently unsupported: - -- `Psr\Http\Message\ServerRequestInterface` -- `Psr\Http\Message\UploadedFileInterface` - - - -[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 -[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 -[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 -[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 -[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 -[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 -[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 -[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 -[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 -[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 -[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 -[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 -[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 -[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/tests/integration/vendor/guzzlehttp/psr7/LICENSE b/tests/integration/vendor/guzzlehttp/psr7/LICENSE deleted file mode 100644 index 51c7ec8..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Michael Dowling -Copyright (c) 2015 Márk Sági-Kazár -Copyright (c) 2015 Graham Campbell -Copyright (c) 2016 Tobias Schultze -Copyright (c) 2016 George Mponos -Copyright (c) 2018 Tobias Nyholm - -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. diff --git a/tests/integration/vendor/guzzlehttp/psr7/README.md b/tests/integration/vendor/guzzlehttp/psr7/README.md deleted file mode 100644 index 64776cb..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/README.md +++ /dev/null @@ -1,844 +0,0 @@ -# PSR-7 Message Implementation - -This repository contains a full [PSR-7](https://www.php-fig.org/psr/psr-7/) -message implementation, several stream decorators, and some helpful -functionality like query string parsing. - - -[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7) - - -# Stream implementation - -This package comes with a number of stream implementations and stream -decorators. - - -## AppendStream - -`GuzzleHttp\Psr7\AppendStream` - -Reads from multiple streams, one after the other. - -```php -use GuzzleHttp\Psr7; - -$a = Psr7\Utils::streamFor('abc, '); -$b = Psr7\Utils::streamFor('123.'); -$composed = new Psr7\AppendStream([$a, $b]); - -$composed->addStream(Psr7\Utils::streamFor(' Above all listen to me')); - -echo $composed; // abc, 123. Above all listen to me. -``` - - -## BufferStream - -`GuzzleHttp\Psr7\BufferStream` - -Provides a buffer stream that can be written to fill a buffer, and read -from to remove bytes from the buffer. - -This stream returns a "hwm" metadata value that tells upstream consumers -what the configured high water mark of the stream is, or the maximum -preferred size of the buffer. - -```php -use GuzzleHttp\Psr7; - -// When more than 1024 bytes are in the buffer, it will begin returning -// false to writes. This is an indication that writers should slow down. -$buffer = new Psr7\BufferStream(1024); -``` - - -## CachingStream - -The CachingStream is used to allow seeking over previously read bytes on -non-seekable streams. This can be useful when transferring a non-seekable -entity body fails due to needing to rewind the stream (for example, resulting -from a redirect). Data that is read from the remote stream will be buffered in -a PHP temp stream so that previously read bytes are cached first in memory, -then on disk. - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\Utils::streamFor(fopen('http://www.google.com', 'r')); -$stream = new Psr7\CachingStream($original); - -$stream->read(1024); -echo $stream->tell(); -// 1024 - -$stream->seek(0); -echo $stream->tell(); -// 0 -``` - - -## DroppingStream - -`GuzzleHttp\Psr7\DroppingStream` - -Stream decorator that begins dropping data once the size of the underlying -stream becomes too full. - -```php -use GuzzleHttp\Psr7; - -// Create an empty stream -$stream = Psr7\Utils::streamFor(); - -// Start dropping data when the stream has more than 10 bytes -$dropping = new Psr7\DroppingStream($stream, 10); - -$dropping->write('01234567890123456789'); -echo $stream; // 0123456789 -``` - - -## FnStream - -`GuzzleHttp\Psr7\FnStream` - -Compose stream implementations based on a hash of functions. - -Allows for easy testing and extension of a provided stream without needing -to create a concrete class for a simple extension point. - -```php - -use GuzzleHttp\Psr7; - -$stream = Psr7\Utils::streamFor('hi'); -$fnStream = Psr7\FnStream::decorate($stream, [ - 'rewind' => function () use ($stream) { - echo 'About to rewind - '; - $stream->rewind(); - echo 'rewound!'; - } -]); - -$fnStream->rewind(); -// Outputs: About to rewind - rewound! -``` - - -## InflateStream - -`GuzzleHttp\Psr7\InflateStream` - -Uses PHP's zlib.inflate filter to inflate deflate or gzipped content. - -This stream decorator skips the first 10 bytes of the given stream to remove -the gzip header, converts the provided stream to a PHP stream resource, -then appends the zlib.inflate filter. The stream is then converted back -to a Guzzle stream resource to be used as a Guzzle stream. - - -## LazyOpenStream - -`GuzzleHttp\Psr7\LazyOpenStream` - -Lazily reads or writes to a file that is opened only after an IO operation -take place on the stream. - -```php -use GuzzleHttp\Psr7; - -$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); -// The file has not yet been opened... - -echo $stream->read(10); -// The file is opened and read from only when needed. -``` - - -## LimitStream - -`GuzzleHttp\Psr7\LimitStream` - -LimitStream can be used to read a subset or slice of an existing stream object. -This can be useful for breaking a large file into smaller pieces to be sent in -chunks (e.g. Amazon S3's multipart upload API). - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\Utils::streamFor(fopen('/tmp/test.txt', 'r+')); -echo $original->getSize(); -// >>> 1048576 - -// Limit the size of the body to 1024 bytes and start reading from byte 2048 -$stream = new Psr7\LimitStream($original, 1024, 2048); -echo $stream->getSize(); -// >>> 1024 -echo $stream->tell(); -// >>> 0 -``` - - -## MultipartStream - -`GuzzleHttp\Psr7\MultipartStream` - -Stream that when read returns bytes for a streaming multipart or -multipart/form-data stream. - - -## NoSeekStream - -`GuzzleHttp\Psr7\NoSeekStream` - -NoSeekStream wraps a stream and does not allow seeking. - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\Utils::streamFor('foo'); -$noSeek = new Psr7\NoSeekStream($original); - -echo $noSeek->read(3); -// foo -var_export($noSeek->isSeekable()); -// false -$noSeek->seek(0); -var_export($noSeek->read(3)); -// NULL -``` - - -## PumpStream - -`GuzzleHttp\Psr7\PumpStream` - -Provides a read only stream that pumps data from a PHP callable. - -When invoking the provided callable, the PumpStream will pass the amount of -data requested to read to the callable. The callable can choose to ignore -this value and return fewer or more bytes than requested. Any extra data -returned by the provided callable is buffered internally until drained using -the read() function of the PumpStream. The provided callable MUST return -false when there is no more data to read. - - -## Implementing stream decorators - -Creating a stream decorator is very easy thanks to the -`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that -implement `Psr\Http\Message\StreamInterface` by proxying to an underlying -stream. Just `use` the `StreamDecoratorTrait` and implement your custom -methods. - -For example, let's say we wanted to call a specific function each time the last -byte is read from a stream. This could be implemented by overriding the -`read()` method. - -```php -use Psr\Http\Message\StreamInterface; -use GuzzleHttp\Psr7\StreamDecoratorTrait; - -class EofCallbackStream implements StreamInterface -{ - use StreamDecoratorTrait; - - private $callback; - - public function __construct(StreamInterface $stream, callable $cb) - { - $this->stream = $stream; - $this->callback = $cb; - } - - public function read($length) - { - $result = $this->stream->read($length); - - // Invoke the callback when EOF is hit. - if ($this->eof()) { - call_user_func($this->callback); - } - - return $result; - } -} -``` - -This decorator could be added to any existing stream and used like so: - -```php -use GuzzleHttp\Psr7; - -$original = Psr7\Utils::streamFor('foo'); - -$eofStream = new EofCallbackStream($original, function () { - echo 'EOF!'; -}); - -$eofStream->read(2); -$eofStream->read(1); -// echoes "EOF!" -$eofStream->seek(0); -$eofStream->read(3); -// echoes "EOF!" -``` - - -## PHP StreamWrapper - -You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a -PSR-7 stream as a PHP stream resource. - -Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP -stream from a PSR-7 stream. - -```php -use GuzzleHttp\Psr7\StreamWrapper; - -$stream = GuzzleHttp\Psr7\Utils::streamFor('hello!'); -$resource = StreamWrapper::getResource($stream); -echo fread($resource, 6); // outputs hello! -``` - - -# Static API - -There are various static methods available under the `GuzzleHttp\Psr7` namespace. - - -## `GuzzleHttp\Psr7\Message::toString` - -`public static function toString(MessageInterface $message): string` - -Returns the string representation of an HTTP message. - -```php -$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); -echo GuzzleHttp\Psr7\Message::toString($request); -``` - - -## `GuzzleHttp\Psr7\Message::bodySummary` - -`public static function bodySummary(MessageInterface $message, int $truncateAt = 120): string|null` - -Get a short summary of the message body. - -Will return `null` if the response is not printable. - - -## `GuzzleHttp\Psr7\Message::rewindBody` - -`public static function rewindBody(MessageInterface $message): void` - -Attempts to rewind a message body and throws an exception on failure. - -The body of the message will only be rewound if a call to `tell()` -returns a value other than `0`. - - -## `GuzzleHttp\Psr7\Message::parseMessage` - -`public static function parseMessage(string $message): array` - -Parses an HTTP message into an associative array. - -The array contains the "start-line" key containing the start line of -the message, "headers" key containing an associative array of header -array values, and a "body" key containing the body of the message. - - -## `GuzzleHttp\Psr7\Message::parseRequestUri` - -`public static function parseRequestUri(string $path, array $headers): string` - -Constructs a URI for an HTTP request message. - - -## `GuzzleHttp\Psr7\Message::parseRequest` - -`public static function parseRequest(string $message): Request` - -Parses a request message string into a request object. - - -## `GuzzleHttp\Psr7\Message::parseResponse` - -`public static function parseResponse(string $message): Response` - -Parses a response message string into a response object. - - -## `GuzzleHttp\Psr7\Header::parse` - -`public static function parse(string|array $header): array` - -Parse an array of header values containing ";" separated data into an -array of associative arrays representing the header key value pair data -of the header. When a parameter does not contain a value, but just -contains a key, this function will inject a key with a '' string value. - - -## `GuzzleHttp\Psr7\Header::normalize` - -`public static function normalize(string|array $header): array` - -Converts an array of header values that may contain comma separated -headers into an array of headers with no comma separated values. - - -## `GuzzleHttp\Psr7\Query::parse` - -`public static function parse(string $str, int|bool $urlEncoding = true): array` - -Parse a query string into an associative array. - -If multiple values are found for the same key, the value of that key -value pair will become an array. This function does not parse nested -PHP style arrays into an associative array (e.g., `foo[a]=1&foo[b]=2` -will be parsed into `['foo[a]' => '1', 'foo[b]' => '2'])`. - - -## `GuzzleHttp\Psr7\Query::build` - -`public static function build(array $params, int|false $encoding = PHP_QUERY_RFC3986): string` - -Build a query string from an array of key value pairs. - -This function can use the return value of `parse()` to build a query -string. This function does not modify the provided keys when an array is -encountered (like `http_build_query()` would). - - -## `GuzzleHttp\Psr7\Utils::caselessRemove` - -`public static function caselessRemove(iterable $keys, $keys, array $data): array` - -Remove the items given by the keys, case insensitively from the data. - - -## `GuzzleHttp\Psr7\Utils::copyToStream` - -`public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1): void` - -Copy the contents of a stream into another stream until the given number -of bytes have been read. - - -## `GuzzleHttp\Psr7\Utils::copyToString` - -`public static function copyToString(StreamInterface $stream, int $maxLen = -1): string` - -Copy the contents of a stream into a string until the given number of -bytes have been read. - - -## `GuzzleHttp\Psr7\Utils::hash` - -`public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = false): string` - -Calculate a hash of a stream. - -This method reads the entire stream to calculate a rolling hash, based on -PHP's `hash_init` functions. - - -## `GuzzleHttp\Psr7\Utils::modifyRequest` - -`public static function modifyRequest(RequestInterface $request, array $changes): RequestInterface` - -Clone and modify a request with the given changes. - -This method is useful for reducing the number of clones needed to mutate -a message. - -- method: (string) Changes the HTTP method. -- set_headers: (array) Sets the given headers. -- remove_headers: (array) Remove the given headers. -- body: (mixed) Sets the given body. -- uri: (UriInterface) Set the URI. -- query: (string) Set the query string value of the URI. -- version: (string) Set the protocol version. - - -## `GuzzleHttp\Psr7\Utils::readLine` - -`public static function readLine(StreamInterface $stream, int $maxLength = null): string` - -Read a line from the stream up to the maximum allowed buffer length. - - -## `GuzzleHttp\Psr7\Utils::streamFor` - -`public static function streamFor(resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource = '', array $options = []): StreamInterface` - -Create a new stream based on the input type. - -Options is an associative array that can contain the following keys: - -- metadata: Array of custom metadata. -- size: Size of the stream. - -This method accepts the following `$resource` types: - -- `Psr\Http\Message\StreamInterface`: Returns the value as-is. -- `string`: Creates a stream object that uses the given string as the contents. -- `resource`: Creates a stream object that wraps the given PHP stream resource. -- `Iterator`: If the provided value implements `Iterator`, then a read-only - stream object will be created that wraps the given iterable. Each time the - stream is read from, data from the iterator will fill a buffer and will be - continuously called until the buffer is equal to the requested read size. - Subsequent read calls will first read from the buffer and then call `next` - on the underlying iterator until it is exhausted. -- `object` with `__toString()`: If the object has the `__toString()` method, - the object will be cast to a string and then a stream will be returned that - uses the string value. -- `NULL`: When `null` is passed, an empty stream object is returned. -- `callable` When a callable is passed, a read-only stream object will be - created that invokes the given callable. The callable is invoked with the - number of suggested bytes to read. The callable can return any number of - bytes, but MUST return `false` when there is no more data to return. The - stream object that wraps the callable will invoke the callable until the - number of requested bytes are available. Any additional bytes will be - buffered and used in subsequent reads. - -```php -$stream = GuzzleHttp\Psr7\Utils::streamFor('foo'); -$stream = GuzzleHttp\Psr7\Utils::streamFor(fopen('/path/to/file', 'r')); - -$generator = function ($bytes) { - for ($i = 0; $i < $bytes; $i++) { - yield ' '; - } -} - -$stream = GuzzleHttp\Psr7\Utils::streamFor($generator(100)); -``` - - -## `GuzzleHttp\Psr7\Utils::tryFopen` - -`public static function tryFopen(string $filename, string $mode): resource` - -Safely opens a PHP stream resource using a filename. - -When fopen fails, PHP normally raises a warning. This function adds an -error handler that checks for errors and throws an exception instead. - - -## `GuzzleHttp\Psr7\Utils::uriFor` - -`public static function uriFor(string|UriInterface $uri): UriInterface` - -Returns a UriInterface for the given value. - -This function accepts a string or UriInterface and returns a -UriInterface for the given value. If the value is already a -UriInterface, it is returned as-is. - - -## `GuzzleHttp\Psr7\MimeType::fromFilename` - -`public static function fromFilename(string $filename): string|null` - -Determines the mimetype of a file by looking at its extension. - - -## `GuzzleHttp\Psr7\MimeType::fromExtension` - -`public static function fromExtension(string $extension): string|null` - -Maps a file extensions to a mimetype. - - -## Upgrading from Function API - -The static API was first introduced in 1.7.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API will be removed in 2.0.0. A migration table has been provided here for your convenience: - -| Original Function | Replacement Method | -|----------------|----------------| -| `str` | `Message::toString` | -| `uri_for` | `Utils::uriFor` | -| `stream_for` | `Utils::streamFor` | -| `parse_header` | `Header::parse` | -| `normalize_header` | `Header::normalize` | -| `modify_request` | `Utils::modifyRequest` | -| `rewind_body` | `Message::rewindBody` | -| `try_fopen` | `Utils::tryFopen` | -| `copy_to_string` | `Utils::copyToString` | -| `copy_to_stream` | `Utils::copyToStream` | -| `hash` | `Utils::hash` | -| `readline` | `Utils::readLine` | -| `parse_request` | `Message::parseRequest` | -| `parse_response` | `Message::parseResponse` | -| `parse_query` | `Query::parse` | -| `build_query` | `Query::build` | -| `mimetype_from_filename` | `MimeType::fromFilename` | -| `mimetype_from_extension` | `MimeType::fromExtension` | -| `_parse_message` | `Message::parseMessage` | -| `_parse_request_uri` | `Message::parseRequestUri` | -| `get_message_body_summary` | `Message::bodySummary` | -| `_caseless_remove` | `Utils::caselessRemove` | - - -# Additional URI Methods - -Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, -this library also provides additional functionality when working with URIs as static methods. - -## URI Types - -An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. -An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, -the base URI. Relative references can be divided into several forms according to -[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): - -- network-path references, e.g. `//example.com/path` -- absolute-path references, e.g. `/path` -- relative-path references, e.g. `subpath` - -The following methods can be used to identify the type of the URI. - -### `GuzzleHttp\Psr7\Uri::isAbsolute` - -`public static function isAbsolute(UriInterface $uri): bool` - -Whether the URI is absolute, i.e. it has a scheme. - -### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` - -`public static function isNetworkPathReference(UriInterface $uri): bool` - -Whether the URI is a network-path reference. A relative reference that begins with two slash characters is -termed an network-path reference. - -### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` - -`public static function isAbsolutePathReference(UriInterface $uri): bool` - -Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is -termed an absolute-path reference. - -### `GuzzleHttp\Psr7\Uri::isRelativePathReference` - -`public static function isRelativePathReference(UriInterface $uri): bool` - -Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is -termed a relative-path reference. - -### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` - -`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool` - -Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its -fragment component, identical to the base URI. When no base URI is given, only an empty URI reference -(apart from its fragment) is considered a same-document reference. - -## URI Components - -Additional methods to work with URI components. - -### `GuzzleHttp\Psr7\Uri::isDefaultPort` - -`public static function isDefaultPort(UriInterface $uri): bool` - -Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null -or the standard port. This method can be used independently of the implementation. - -### `GuzzleHttp\Psr7\Uri::composeComponents` - -`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` - -Composes a URI reference string from its various components according to -[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called -manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. - -### `GuzzleHttp\Psr7\Uri::fromParts` - -`public static function fromParts(array $parts): UriInterface` - -Creates a URI from a hash of [`parse_url`](https://www.php.net/manual/en/function.parse-url.php) components. - - -### `GuzzleHttp\Psr7\Uri::withQueryValue` - -`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` - -Creates a new URI with a specific query string value. Any existing query string values that exactly match the -provided key are removed and replaced with the given key value pair. A value of null will set the query string -key without a value, e.g. "key" instead of "key=value". - -### `GuzzleHttp\Psr7\Uri::withQueryValues` - -`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` - -Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an -associative array of key => value. - -### `GuzzleHttp\Psr7\Uri::withoutQueryValue` - -`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` - -Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the -provided key are removed. - -## Cross-Origin Detection - -`GuzzleHttp\Psr7\UriComparator` provides methods to determine if a modified URL should be considered cross-origin. - -### `GuzzleHttp\Psr7\UriComparator::isCrossOrigin` - -`public static function isCrossOrigin(UriInterface $original, UriInterface $modified): bool` - -Determines if a modified URL should be considered cross-origin with respect to an original URL. - -## Reference Resolution - -`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according -to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers -do when resolving a link in a website based on the current request URI. - -### `GuzzleHttp\Psr7\UriResolver::resolve` - -`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` - -Converts the relative URI into a new URI that is resolved against the base URI. - -### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` - -`public static function removeDotSegments(string $path): string` - -Removes dot segments from a path and returns the new path according to -[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). - -### `GuzzleHttp\Psr7\UriResolver::relativize` - -`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` - -Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): - -```php -(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) -``` - -One use-case is to use the current request URI as base URI and then generate relative links in your documents -to reduce the document size or offer self-contained downloadable document archives. - -```php -$base = new Uri('http://example.com/a/b/'); -echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. -echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. -echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. -echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. -``` - -## Normalization and Comparison - -`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to -[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). - -### `GuzzleHttp\Psr7\UriNormalizer::normalize` - -`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` - -Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. -This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask -of normalizations to apply. The following normalizations are available: - -- `UriNormalizer::PRESERVING_NORMALIZATIONS` - - Default normalizations which only include the ones that preserve semantics. - -- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` - - All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. - - Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` - -- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` - - Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of - ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should - not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved - characters by URI normalizers. - - Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` - -- `UriNormalizer::CONVERT_EMPTY_PATH` - - Converts the empty path to "/" for http and https URIs. - - Example: `http://example.org` → `http://example.org/` - -- `UriNormalizer::REMOVE_DEFAULT_HOST` - - Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host - "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to - RFC 3986. - - Example: `file://localhost/myfile` → `file:///myfile` - -- `UriNormalizer::REMOVE_DEFAULT_PORT` - - Removes the default port of the given URI scheme from the URI. - - Example: `http://example.org:80/` → `http://example.org/` - -- `UriNormalizer::REMOVE_DOT_SEGMENTS` - - Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would - change the semantics of the URI reference. - - Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` - -- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` - - Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes - and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization - may change the semantics. Encoded slashes (%2F) are not removed. - - Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` - -- `UriNormalizer::SORT_QUERY_PARAMETERS` - - Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be - significant (this is not defined by the standard). So this normalization is not safe and may change the semantics - of the URI. - - Example: `?lang=en&article=fred` → `?article=fred&lang=en` - -### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` - -`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` - -Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given -`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. -This of course assumes they will be resolved against the same base URI. If this is not the case, determination of -equivalence or difference of relative references does not mean anything. - - -## Version Guidance - -| Version | Status | PHP Version | -|---------|----------------|------------------| -| 1.x | Security fixes | >=5.4,<8.1 | -| 2.x | Latest | ^7.2.5 \|\| ^8.0 | - - -## Security - -If you discover a security vulnerability within this package, please send an email to security@tidelift.com. All security vulnerabilities will be promptly addressed. Please do not disclose security-related issues publicly until a fix has been announced. Please see [Security Policy](https://github.com/guzzle/psr7/security/policy) for more information. - - -## License - -Guzzle is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information. - - -## For Enterprise - -Available as part of the Tidelift Subscription - -The maintainers of Guzzle and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-guzzlehttp-psr7?utm_source=packagist-guzzlehttp-psr7&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/tests/integration/vendor/guzzlehttp/psr7/composer.json b/tests/integration/vendor/guzzlehttp/psr7/composer.json deleted file mode 100644 index 2607f22..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/composer.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "guzzlehttp/psr7", - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"], - "license": "MIT", - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos" - }, - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/Nyholm" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://github.com/sagikazarmark" - }, - { - "name": "Tobias Schultze", - "email": "webmaster@tubo-world.de", - "homepage": "https://github.com/Tobion" - } - ], - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10", - "ext-zlib": "*" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": ["src/functions_include.php"] - }, - "autoload-dev": { - "psr-4": { - "GuzzleHttp\\Tests\\Psr7\\": "tests/" - } - }, - "config": { - "preferred-install": "dist", - "sort-packages": true, - "allow-plugins": { - "bamarni/composer-bin-plugin": true - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/AppendStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/AppendStream.php deleted file mode 100644 index fa9153d..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/AppendStream.php +++ /dev/null @@ -1,246 +0,0 @@ -addStream($stream); - } - } - - public function __toString() - { - try { - $this->rewind(); - return $this->getContents(); - } catch (\Exception $e) { - return ''; - } - } - - /** - * Add a stream to the AppendStream - * - * @param StreamInterface $stream Stream to append. Must be readable. - * - * @throws \InvalidArgumentException if the stream is not readable - */ - public function addStream(StreamInterface $stream) - { - if (!$stream->isReadable()) { - throw new \InvalidArgumentException('Each stream must be readable'); - } - - // The stream is only seekable if all streams are seekable - if (!$stream->isSeekable()) { - $this->seekable = false; - } - - $this->streams[] = $stream; - } - - public function getContents() - { - return Utils::copyToString($this); - } - - /** - * Closes each attached stream. - * - * {@inheritdoc} - */ - public function close() - { - $this->pos = $this->current = 0; - $this->seekable = true; - - foreach ($this->streams as $stream) { - $stream->close(); - } - - $this->streams = []; - } - - /** - * Detaches each attached stream. - * - * Returns null as it's not clear which underlying stream resource to return. - * - * {@inheritdoc} - */ - public function detach() - { - $this->pos = $this->current = 0; - $this->seekable = true; - - foreach ($this->streams as $stream) { - $stream->detach(); - } - - $this->streams = []; - - return null; - } - - public function tell() - { - return $this->pos; - } - - /** - * Tries to calculate the size by adding the size of each stream. - * - * If any of the streams do not return a valid number, then the size of the - * append stream cannot be determined and null is returned. - * - * {@inheritdoc} - */ - public function getSize() - { - $size = 0; - - foreach ($this->streams as $stream) { - $s = $stream->getSize(); - if ($s === null) { - return null; - } - $size += $s; - } - - return $size; - } - - public function eof() - { - return !$this->streams || - ($this->current >= count($this->streams) - 1 && - $this->streams[$this->current]->eof()); - } - - public function rewind() - { - $this->seek(0); - } - - /** - * Attempts to seek to the given position. Only supports SEEK_SET. - * - * {@inheritdoc} - */ - public function seek($offset, $whence = SEEK_SET) - { - if (!$this->seekable) { - throw new \RuntimeException('This AppendStream is not seekable'); - } elseif ($whence !== SEEK_SET) { - throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); - } - - $this->pos = $this->current = 0; - - // Rewind each stream - foreach ($this->streams as $i => $stream) { - try { - $stream->rewind(); - } catch (\Exception $e) { - throw new \RuntimeException('Unable to seek stream ' - . $i . ' of the AppendStream', 0, $e); - } - } - - // Seek to the actual position by reading from each stream - while ($this->pos < $offset && !$this->eof()) { - $result = $this->read(min(8096, $offset - $this->pos)); - if ($result === '') { - break; - } - } - } - - /** - * Reads from all of the appended streams until the length is met or EOF. - * - * {@inheritdoc} - */ - public function read($length) - { - $buffer = ''; - $total = count($this->streams) - 1; - $remaining = $length; - $progressToNext = false; - - while ($remaining > 0) { - - // Progress to the next stream if needed. - if ($progressToNext || $this->streams[$this->current]->eof()) { - $progressToNext = false; - if ($this->current === $total) { - break; - } - $this->current++; - } - - $result = $this->streams[$this->current]->read($remaining); - - // Using a loose comparison here to match on '', false, and null - if ($result == null) { - $progressToNext = true; - continue; - } - - $buffer .= $result; - $remaining = $length - strlen($buffer); - } - - $this->pos += strlen($buffer); - - return $buffer; - } - - public function isReadable() - { - return true; - } - - public function isWritable() - { - return false; - } - - public function isSeekable() - { - return $this->seekable; - } - - public function write($string) - { - throw new \RuntimeException('Cannot write to an AppendStream'); - } - - public function getMetadata($key = null) - { - return $key ? null : []; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/BufferStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/BufferStream.php deleted file mode 100644 index 783859c..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/BufferStream.php +++ /dev/null @@ -1,142 +0,0 @@ -hwm = $hwm; - } - - public function __toString() - { - return $this->getContents(); - } - - public function getContents() - { - $buffer = $this->buffer; - $this->buffer = ''; - - return $buffer; - } - - public function close() - { - $this->buffer = ''; - } - - public function detach() - { - $this->close(); - - return null; - } - - public function getSize() - { - return strlen($this->buffer); - } - - public function isReadable() - { - return true; - } - - public function isWritable() - { - return true; - } - - public function isSeekable() - { - return false; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - throw new \RuntimeException('Cannot seek a BufferStream'); - } - - public function eof() - { - return strlen($this->buffer) === 0; - } - - public function tell() - { - throw new \RuntimeException('Cannot determine the position of a BufferStream'); - } - - /** - * Reads data from the buffer. - */ - public function read($length) - { - $currentLength = strlen($this->buffer); - - if ($length >= $currentLength) { - // No need to slice the buffer because we don't have enough data. - $result = $this->buffer; - $this->buffer = ''; - } else { - // Slice up the result to provide a subset of the buffer. - $result = substr($this->buffer, 0, $length); - $this->buffer = substr($this->buffer, $length); - } - - return $result; - } - - /** - * Writes data to the buffer. - */ - public function write($string) - { - $this->buffer .= $string; - - // TODO: What should happen here? - if (strlen($this->buffer) >= $this->hwm) { - return false; - } - - return strlen($string); - } - - public function getMetadata($key = null) - { - if ($key == 'hwm') { - return $this->hwm; - } - - return $key ? null : []; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/CachingStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/CachingStream.php deleted file mode 100644 index febade9..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/CachingStream.php +++ /dev/null @@ -1,147 +0,0 @@ -remoteStream = $stream; - $this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+')); - } - - public function getSize() - { - $remoteSize = $this->remoteStream->getSize(); - - if (null === $remoteSize) { - return null; - } - - return max($this->stream->getSize(), $remoteSize); - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - if ($whence == SEEK_SET) { - $byte = $offset; - } elseif ($whence == SEEK_CUR) { - $byte = $offset + $this->tell(); - } elseif ($whence == SEEK_END) { - $size = $this->remoteStream->getSize(); - if ($size === null) { - $size = $this->cacheEntireStream(); - } - $byte = $size + $offset; - } else { - throw new \InvalidArgumentException('Invalid whence'); - } - - $diff = $byte - $this->stream->getSize(); - - if ($diff > 0) { - // Read the remoteStream until we have read in at least the amount - // of bytes requested, or we reach the end of the file. - while ($diff > 0 && !$this->remoteStream->eof()) { - $this->read($diff); - $diff = $byte - $this->stream->getSize(); - } - } else { - // We can just do a normal seek since we've already seen this byte. - $this->stream->seek($byte); - } - } - - public function read($length) - { - // Perform a regular read on any previously read data from the buffer - $data = $this->stream->read($length); - $remaining = $length - strlen($data); - - // More data was requested so read from the remote stream - if ($remaining) { - // If data was written to the buffer in a position that would have - // been filled from the remote stream, then we must skip bytes on - // the remote stream to emulate overwriting bytes from that - // position. This mimics the behavior of other PHP stream wrappers. - $remoteData = $this->remoteStream->read( - $remaining + $this->skipReadBytes - ); - - if ($this->skipReadBytes) { - $len = strlen($remoteData); - $remoteData = substr($remoteData, $this->skipReadBytes); - $this->skipReadBytes = max(0, $this->skipReadBytes - $len); - } - - $data .= $remoteData; - $this->stream->write($remoteData); - } - - return $data; - } - - public function write($string) - { - // When appending to the end of the currently read stream, you'll want - // to skip bytes from being read from the remote stream to emulate - // other stream wrappers. Basically replacing bytes of data of a fixed - // length. - $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); - if ($overflow > 0) { - $this->skipReadBytes += $overflow; - } - - return $this->stream->write($string); - } - - public function eof() - { - return $this->stream->eof() && $this->remoteStream->eof(); - } - - /** - * Close both the remote stream and buffer stream - */ - public function close() - { - $this->remoteStream->close() && $this->stream->close(); - } - - private function cacheEntireStream() - { - $target = new FnStream(['write' => 'strlen']); - Utils::copyToStream($this, $target); - - return $this->tell(); - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/DroppingStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/DroppingStream.php deleted file mode 100644 index 9f7420c..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/DroppingStream.php +++ /dev/null @@ -1,45 +0,0 @@ -stream = $stream; - $this->maxLength = $maxLength; - } - - public function write($string) - { - $diff = $this->maxLength - $this->stream->getSize(); - - // Begin returning 0 when the underlying stream is too large. - if ($diff <= 0) { - return 0; - } - - // Write the stream or a subset of the stream if needed. - if (strlen($string) < $diff) { - return $this->stream->write($string); - } - - return $this->stream->write(substr($string, 0, $diff)); - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/FnStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/FnStream.php deleted file mode 100644 index 76a8cc7..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/FnStream.php +++ /dev/null @@ -1,163 +0,0 @@ -methods = $methods; - - // Create the functions on the class - foreach ($methods as $name => $fn) { - $this->{'_fn_' . $name} = $fn; - } - } - - /** - * Lazily determine which methods are not implemented. - * - * @throws \BadMethodCallException - */ - public function __get($name) - { - throw new \BadMethodCallException(str_replace('_fn_', '', $name) - . '() is not implemented in the FnStream'); - } - - /** - * The close method is called on the underlying stream only if possible. - */ - public function __destruct() - { - if (isset($this->_fn_close)) { - call_user_func($this->_fn_close); - } - } - - /** - * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. - * - * @throws \LogicException - */ - public function __wakeup() - { - throw new \LogicException('FnStream should never be unserialized'); - } - - /** - * Adds custom functionality to an underlying stream by intercepting - * specific method calls. - * - * @param StreamInterface $stream Stream to decorate - * @param array $methods Hash of method name to a closure - * - * @return FnStream - */ - public static function decorate(StreamInterface $stream, array $methods) - { - // If any of the required methods were not provided, then simply - // proxy to the decorated stream. - foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { - $methods[$diff] = [$stream, $diff]; - } - - return new self($methods); - } - - public function __toString() - { - return call_user_func($this->_fn___toString); - } - - public function close() - { - return call_user_func($this->_fn_close); - } - - public function detach() - { - return call_user_func($this->_fn_detach); - } - - public function getSize() - { - return call_user_func($this->_fn_getSize); - } - - public function tell() - { - return call_user_func($this->_fn_tell); - } - - public function eof() - { - return call_user_func($this->_fn_eof); - } - - public function isSeekable() - { - return call_user_func($this->_fn_isSeekable); - } - - public function rewind() - { - call_user_func($this->_fn_rewind); - } - - public function seek($offset, $whence = SEEK_SET) - { - call_user_func($this->_fn_seek, $offset, $whence); - } - - public function isWritable() - { - return call_user_func($this->_fn_isWritable); - } - - public function write($string) - { - return call_user_func($this->_fn_write, $string); - } - - public function isReadable() - { - return call_user_func($this->_fn_isReadable); - } - - public function read($length) - { - return call_user_func($this->_fn_read, $length); - } - - public function getContents() - { - return call_user_func($this->_fn_getContents); - } - - public function getMetadata($key = null) - { - return call_user_func($this->_fn_getMetadata, $key); - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/InflateStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/InflateStream.php deleted file mode 100644 index 0cbd2cc..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/InflateStream.php +++ /dev/null @@ -1,56 +0,0 @@ -read(10); - $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header); - // Skip the header, that is 10 + length of filename + 1 (nil) bytes - $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength); - $resource = StreamWrapper::getResource($stream); - stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ); - $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); - } - - /** - * @param StreamInterface $stream - * @param $header - * - * @return int - */ - private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header) - { - $filename_header_length = 0; - - if (substr(bin2hex($header), 6, 2) === '08') { - // we have a filename, read until nil - $filename_header_length = 1; - while ($stream->read(1) !== chr(0)) { - $filename_header_length++; - } - } - - return $filename_header_length; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/LazyOpenStream.php deleted file mode 100644 index 911e127..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/LazyOpenStream.php +++ /dev/null @@ -1,42 +0,0 @@ -filename = $filename; - $this->mode = $mode; - } - - /** - * Creates the underlying stream lazily when required. - * - * @return StreamInterface - */ - protected function createStream() - { - return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode)); - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/LimitStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/LimitStream.php deleted file mode 100644 index 1173ec4..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/LimitStream.php +++ /dev/null @@ -1,157 +0,0 @@ -stream = $stream; - $this->setLimit($limit); - $this->setOffset($offset); - } - - public function eof() - { - // Always return true if the underlying stream is EOF - if ($this->stream->eof()) { - return true; - } - - // No limit and the underlying stream is not at EOF - if ($this->limit == -1) { - return false; - } - - return $this->stream->tell() >= $this->offset + $this->limit; - } - - /** - * Returns the size of the limited subset of data - * {@inheritdoc} - */ - public function getSize() - { - if (null === ($length = $this->stream->getSize())) { - return null; - } elseif ($this->limit == -1) { - return $length - $this->offset; - } else { - return min($this->limit, $length - $this->offset); - } - } - - /** - * Allow for a bounded seek on the read limited stream - * {@inheritdoc} - */ - public function seek($offset, $whence = SEEK_SET) - { - if ($whence !== SEEK_SET || $offset < 0) { - throw new \RuntimeException(sprintf( - 'Cannot seek to offset %s with whence %s', - $offset, - $whence - )); - } - - $offset += $this->offset; - - if ($this->limit !== -1) { - if ($offset > $this->offset + $this->limit) { - $offset = $this->offset + $this->limit; - } - } - - $this->stream->seek($offset); - } - - /** - * Give a relative tell() - * {@inheritdoc} - */ - public function tell() - { - return $this->stream->tell() - $this->offset; - } - - /** - * Set the offset to start limiting from - * - * @param int $offset Offset to seek to and begin byte limiting from - * - * @throws \RuntimeException if the stream cannot be seeked. - */ - public function setOffset($offset) - { - $current = $this->stream->tell(); - - if ($current !== $offset) { - // If the stream cannot seek to the offset position, then read to it - if ($this->stream->isSeekable()) { - $this->stream->seek($offset); - } elseif ($current > $offset) { - throw new \RuntimeException("Could not seek to stream offset $offset"); - } else { - $this->stream->read($offset - $current); - } - } - - $this->offset = $offset; - } - - /** - * Set the limit of bytes that the decorator allows to be read from the - * stream. - * - * @param int $limit Number of bytes to allow to be read from the stream. - * Use -1 for no limit. - */ - public function setLimit($limit) - { - $this->limit = $limit; - } - - public function read($length) - { - if ($this->limit == -1) { - return $this->stream->read($length); - } - - // Check if the current position is less than the total allowed - // bytes + original offset - $remaining = ($this->offset + $this->limit) - $this->stream->tell(); - if ($remaining > 0) { - // Only return the amount of requested data, ensuring that the byte - // limit is not exceeded - return $this->stream->read(min($remaining, $length)); - } - - return ''; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/MessageTrait.php b/tests/integration/vendor/guzzlehttp/psr7/src/MessageTrait.php deleted file mode 100644 index 0bbd63e..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ /dev/null @@ -1,269 +0,0 @@ - array of values */ - private $headers = []; - - /** @var array Map of lowercase header name => original name at registration */ - private $headerNames = []; - - /** @var string */ - private $protocol = '1.1'; - - /** @var StreamInterface|null */ - private $stream; - - public function getProtocolVersion() - { - return $this->protocol; - } - - public function withProtocolVersion($version) - { - if ($this->protocol === $version) { - return $this; - } - - $new = clone $this; - $new->protocol = $version; - return $new; - } - - public function getHeaders() - { - return $this->headers; - } - - public function hasHeader($header) - { - return isset($this->headerNames[strtolower($header)]); - } - - public function getHeader($header) - { - $header = strtolower($header); - - if (!isset($this->headerNames[$header])) { - return []; - } - - $header = $this->headerNames[$header]; - - return $this->headers[$header]; - } - - public function getHeaderLine($header) - { - return implode(', ', $this->getHeader($header)); - } - - public function withHeader($header, $value) - { - $this->assertHeader($header); - $value = $this->normalizeHeaderValue($value); - $normalized = strtolower($header); - - $new = clone $this; - if (isset($new->headerNames[$normalized])) { - unset($new->headers[$new->headerNames[$normalized]]); - } - $new->headerNames[$normalized] = $header; - $new->headers[$header] = $value; - - return $new; - } - - public function withAddedHeader($header, $value) - { - $this->assertHeader($header); - $value = $this->normalizeHeaderValue($value); - $normalized = strtolower($header); - - $new = clone $this; - if (isset($new->headerNames[$normalized])) { - $header = $this->headerNames[$normalized]; - $new->headers[$header] = array_merge($this->headers[$header], $value); - } else { - $new->headerNames[$normalized] = $header; - $new->headers[$header] = $value; - } - - return $new; - } - - public function withoutHeader($header) - { - $normalized = strtolower($header); - - if (!isset($this->headerNames[$normalized])) { - return $this; - } - - $header = $this->headerNames[$normalized]; - - $new = clone $this; - unset($new->headers[$header], $new->headerNames[$normalized]); - - return $new; - } - - public function getBody() - { - if (!$this->stream) { - $this->stream = Utils::streamFor(''); - } - - return $this->stream; - } - - public function withBody(StreamInterface $body) - { - if ($body === $this->stream) { - return $this; - } - - $new = clone $this; - $new->stream = $body; - return $new; - } - - private function setHeaders(array $headers) - { - $this->headerNames = $this->headers = []; - foreach ($headers as $header => $value) { - if (is_int($header)) { - // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec - // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass. - $header = (string) $header; - } - $this->assertHeader($header); - $value = $this->normalizeHeaderValue($value); - $normalized = strtolower($header); - if (isset($this->headerNames[$normalized])) { - $header = $this->headerNames[$normalized]; - $this->headers[$header] = array_merge($this->headers[$header], $value); - } else { - $this->headerNames[$normalized] = $header; - $this->headers[$header] = $value; - } - } - } - - /** - * @param mixed $value - * - * @return string[] - */ - private function normalizeHeaderValue($value) - { - if (!is_array($value)) { - return $this->trimAndValidateHeaderValues([$value]); - } - - if (count($value) === 0) { - throw new \InvalidArgumentException('Header value can not be an empty array.'); - } - - return $this->trimAndValidateHeaderValues($value); - } - - /** - * Trims whitespace from the header values. - * - * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. - * - * header-field = field-name ":" OWS field-value OWS - * OWS = *( SP / HTAB ) - * - * @param mixed[] $values Header values - * - * @return string[] Trimmed header values - * - * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 - */ - private function trimAndValidateHeaderValues(array $values) - { - return array_map(function ($value) { - if (!is_scalar($value) && null !== $value) { - throw new \InvalidArgumentException(sprintf( - 'Header value must be scalar or null but %s provided.', - is_object($value) ? get_class($value) : gettype($value) - )); - } - - $trimmed = trim((string) $value, " \t"); - $this->assertValue($trimmed); - - return $trimmed; - }, array_values($values)); - } - - /** - * @see https://tools.ietf.org/html/rfc7230#section-3.2 - * - * @param mixed $header - * - * @return void - */ - private function assertHeader($header) - { - if (!is_string($header)) { - throw new \InvalidArgumentException(sprintf( - 'Header name must be a string but %s provided.', - is_object($header) ? get_class($header) : gettype($header) - )); - } - - if ($header === '') { - throw new \InvalidArgumentException('Header name can not be empty.'); - } - - if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) { - throw new \InvalidArgumentException( - sprintf('"%s" is not valid header name.', $header) - ); - } - } - - /** - * @param string $value - * - * @return void - * - * @see https://tools.ietf.org/html/rfc7230#section-3.2 - * - * field-value = *( field-content / obs-fold ) - * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] - * field-vchar = VCHAR / obs-text - * VCHAR = %x21-7E - * obs-text = %x80-FF - * obs-fold = CRLF 1*( SP / HTAB ) - */ - private function assertValue($value) - { - // The regular expression intentionally does not support the obs-fold production, because as - // per RFC 7230#3.2.4: - // - // A sender MUST NOT generate a message that includes - // line folding (i.e., that has any field-value that contains a match to - // the obs-fold rule) unless the message is intended for packaging - // within the message/http media type. - // - // Clients must not send a request with line folding and a server sending folded headers is - // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting - // folding is not likely to break any legitimate use case. - if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/D', $value)) { - throw new \InvalidArgumentException( - sprintf('"%s" is not valid header value.', $value) - ); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/MultipartStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/MultipartStream.php deleted file mode 100644 index 5a6079a..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/MultipartStream.php +++ /dev/null @@ -1,158 +0,0 @@ -boundary = $boundary ?: sha1(uniqid('', true)); - $this->stream = $this->createStream($elements); - } - - /** - * Get the boundary - * - * @return string - */ - public function getBoundary() - { - return $this->boundary; - } - - public function isWritable() - { - return false; - } - - /** - * Get the headers needed before transferring the content of a POST file - */ - private function getHeaders(array $headers) - { - $str = ''; - foreach ($headers as $key => $value) { - $str .= "{$key}: {$value}\r\n"; - } - - return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; - } - - /** - * Create the aggregate stream that will be used to upload the POST data - */ - protected function createStream(array $elements) - { - $stream = new AppendStream(); - - foreach ($elements as $element) { - $this->addElement($stream, $element); - } - - // Add the trailing boundary with CRLF - $stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n")); - - return $stream; - } - - private function addElement(AppendStream $stream, array $element) - { - foreach (['contents', 'name'] as $key) { - if (!array_key_exists($key, $element)) { - throw new \InvalidArgumentException("A '{$key}' key is required"); - } - } - - $element['contents'] = Utils::streamFor($element['contents']); - - if (empty($element['filename'])) { - $uri = $element['contents']->getMetadata('uri'); - if (substr($uri, 0, 6) !== 'php://') { - $element['filename'] = $uri; - } - } - - list($body, $headers) = $this->createElement( - $element['name'], - $element['contents'], - isset($element['filename']) ? $element['filename'] : null, - isset($element['headers']) ? $element['headers'] : [] - ); - - $stream->addStream(Utils::streamFor($this->getHeaders($headers))); - $stream->addStream($body); - $stream->addStream(Utils::streamFor("\r\n")); - } - - /** - * @return array - */ - private function createElement($name, StreamInterface $stream, $filename, array $headers) - { - // Set a default content-disposition header if one was no provided - $disposition = $this->getHeader($headers, 'content-disposition'); - if (!$disposition) { - $headers['Content-Disposition'] = ($filename === '0' || $filename) - ? sprintf( - 'form-data; name="%s"; filename="%s"', - $name, - basename($filename) - ) - : "form-data; name=\"{$name}\""; - } - - // Set a default content-length header if one was no provided - $length = $this->getHeader($headers, 'content-length'); - if (!$length) { - if ($length = $stream->getSize()) { - $headers['Content-Length'] = (string) $length; - } - } - - // Set a default Content-Type if one was not supplied - $type = $this->getHeader($headers, 'content-type'); - if (!$type && ($filename === '0' || $filename)) { - if ($type = MimeType::fromFilename($filename)) { - $headers['Content-Type'] = $type; - } - } - - return [$stream, $headers]; - } - - private function getHeader(array $headers, $key) - { - $lowercaseHeader = strtolower($key); - foreach ($headers as $k => $v) { - if (strtolower($k) === $lowercaseHeader) { - return $v; - } - } - - return null; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/NoSeekStream.php b/tests/integration/vendor/guzzlehttp/psr7/src/NoSeekStream.php deleted file mode 100644 index d66bdde..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/NoSeekStream.php +++ /dev/null @@ -1,25 +0,0 @@ -source = $source; - $this->size = isset($options['size']) ? $options['size'] : null; - $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; - $this->buffer = new BufferStream(); - } - - public function __toString() - { - try { - return Utils::copyToString($this); - } catch (\Exception $e) { - return ''; - } - } - - public function close() - { - $this->detach(); - } - - public function detach() - { - $this->tellPos = false; - $this->source = null; - - return null; - } - - public function getSize() - { - return $this->size; - } - - public function tell() - { - return $this->tellPos; - } - - public function eof() - { - return !$this->source; - } - - public function isSeekable() - { - return false; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - throw new \RuntimeException('Cannot seek a PumpStream'); - } - - public function isWritable() - { - return false; - } - - public function write($string) - { - throw new \RuntimeException('Cannot write to a PumpStream'); - } - - public function isReadable() - { - return true; - } - - public function read($length) - { - $data = $this->buffer->read($length); - $readLen = strlen($data); - $this->tellPos += $readLen; - $remaining = $length - $readLen; - - if ($remaining) { - $this->pump($remaining); - $data .= $this->buffer->read($remaining); - $this->tellPos += strlen($data) - $readLen; - } - - return $data; - } - - public function getContents() - { - $result = ''; - while (!$this->eof()) { - $result .= $this->read(1000000); - } - - return $result; - } - - public function getMetadata($key = null) - { - if (!$key) { - return $this->metadata; - } - - return isset($this->metadata[$key]) ? $this->metadata[$key] : null; - } - - private function pump($length) - { - if ($this->source) { - do { - $data = call_user_func($this->source, $length); - if ($data === false || $data === null) { - $this->source = null; - return; - } - $this->buffer->write($data); - $length -= strlen($data); - } while ($length > 0); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/Request.php b/tests/integration/vendor/guzzlehttp/psr7/src/Request.php deleted file mode 100644 index c1cdaeb..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/Request.php +++ /dev/null @@ -1,152 +0,0 @@ -assertMethod($method); - if (!($uri instanceof UriInterface)) { - $uri = new Uri($uri); - } - - $this->method = strtoupper($method); - $this->uri = $uri; - $this->setHeaders($headers); - $this->protocol = $version; - - if (!isset($this->headerNames['host'])) { - $this->updateHostFromUri(); - } - - if ($body !== '' && $body !== null) { - $this->stream = Utils::streamFor($body); - } - } - - public function getRequestTarget() - { - if ($this->requestTarget !== null) { - return $this->requestTarget; - } - - $target = $this->uri->getPath(); - if ($target == '') { - $target = '/'; - } - if ($this->uri->getQuery() != '') { - $target .= '?' . $this->uri->getQuery(); - } - - return $target; - } - - public function withRequestTarget($requestTarget) - { - if (preg_match('#\s#', $requestTarget)) { - throw new InvalidArgumentException( - 'Invalid request target provided; cannot contain whitespace' - ); - } - - $new = clone $this; - $new->requestTarget = $requestTarget; - return $new; - } - - public function getMethod() - { - return $this->method; - } - - public function withMethod($method) - { - $this->assertMethod($method); - $new = clone $this; - $new->method = strtoupper($method); - return $new; - } - - public function getUri() - { - return $this->uri; - } - - public function withUri(UriInterface $uri, $preserveHost = false) - { - if ($uri === $this->uri) { - return $this; - } - - $new = clone $this; - $new->uri = $uri; - - if (!$preserveHost || !isset($this->headerNames['host'])) { - $new->updateHostFromUri(); - } - - return $new; - } - - private function updateHostFromUri() - { - $host = $this->uri->getHost(); - - if ($host == '') { - return; - } - - if (($port = $this->uri->getPort()) !== null) { - $host .= ':' . $port; - } - - if (isset($this->headerNames['host'])) { - $header = $this->headerNames['host']; - } else { - $header = 'Host'; - $this->headerNames['host'] = 'Host'; - } - // Ensure Host is the first header. - // See: http://tools.ietf.org/html/rfc7230#section-5.4 - $this->headers = [$header => [$host]] + $this->headers; - } - - private function assertMethod($method) - { - if (!is_string($method) || $method === '') { - throw new \InvalidArgumentException('Method must be a non-empty string.'); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/Response.php b/tests/integration/vendor/guzzlehttp/psr7/src/Response.php deleted file mode 100644 index 8c01a0f..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/Response.php +++ /dev/null @@ -1,155 +0,0 @@ - 'Continue', - 101 => 'Switching Protocols', - 102 => 'Processing', - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 207 => 'Multi-status', - 208 => 'Already Reported', - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 306 => 'Switch Proxy', - 307 => 'Temporary Redirect', - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Time-out', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Large', - 415 => 'Unsupported Media Type', - 416 => 'Requested range not satisfiable', - 417 => 'Expectation Failed', - 418 => 'I\'m a teapot', - 422 => 'Unprocessable Entity', - 423 => 'Locked', - 424 => 'Failed Dependency', - 425 => 'Unordered Collection', - 426 => 'Upgrade Required', - 428 => 'Precondition Required', - 429 => 'Too Many Requests', - 431 => 'Request Header Fields Too Large', - 451 => 'Unavailable For Legal Reasons', - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Time-out', - 505 => 'HTTP Version not supported', - 506 => 'Variant Also Negotiates', - 507 => 'Insufficient Storage', - 508 => 'Loop Detected', - 511 => 'Network Authentication Required', - ]; - - /** @var string */ - private $reasonPhrase = ''; - - /** @var int */ - private $statusCode = 200; - - /** - * @param int $status Status code - * @param array $headers Response headers - * @param string|resource|StreamInterface|null $body Response body - * @param string $version Protocol version - * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) - */ - public function __construct( - $status = 200, - array $headers = [], - $body = null, - $version = '1.1', - $reason = null - ) { - $this->assertStatusCodeIsInteger($status); - $status = (int) $status; - $this->assertStatusCodeRange($status); - - $this->statusCode = $status; - - if ($body !== '' && $body !== null) { - $this->stream = Utils::streamFor($body); - } - - $this->setHeaders($headers); - if ($reason == '' && isset(self::$phrases[$this->statusCode])) { - $this->reasonPhrase = self::$phrases[$this->statusCode]; - } else { - $this->reasonPhrase = (string) $reason; - } - - $this->protocol = $version; - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function getReasonPhrase() - { - return $this->reasonPhrase; - } - - public function withStatus($code, $reasonPhrase = '') - { - $this->assertStatusCodeIsInteger($code); - $code = (int) $code; - $this->assertStatusCodeRange($code); - - $new = clone $this; - $new->statusCode = $code; - if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) { - $reasonPhrase = self::$phrases[$new->statusCode]; - } - $new->reasonPhrase = (string) $reasonPhrase; - return $new; - } - - private function assertStatusCodeIsInteger($statusCode) - { - if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { - throw new \InvalidArgumentException('Status code must be an integer value.'); - } - } - - private function assertStatusCodeRange($statusCode) - { - if ($statusCode < 100 || $statusCode >= 600) { - throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/ServerRequest.php b/tests/integration/vendor/guzzlehttp/psr7/src/ServerRequest.php deleted file mode 100644 index e6d26f5..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/ServerRequest.php +++ /dev/null @@ -1,379 +0,0 @@ -serverParams = $serverParams; - - parent::__construct($method, $uri, $headers, $body, $version); - } - - /** - * Return an UploadedFile instance array. - * - * @param array $files A array which respect $_FILES structure - * - * @return array - * - * @throws InvalidArgumentException for unrecognized values - */ - public static function normalizeFiles(array $files) - { - $normalized = []; - - foreach ($files as $key => $value) { - if ($value instanceof UploadedFileInterface) { - $normalized[$key] = $value; - } elseif (is_array($value) && isset($value['tmp_name'])) { - $normalized[$key] = self::createUploadedFileFromSpec($value); - } elseif (is_array($value)) { - $normalized[$key] = self::normalizeFiles($value); - continue; - } else { - throw new InvalidArgumentException('Invalid value in files specification'); - } - } - - return $normalized; - } - - /** - * Create and return an UploadedFile instance from a $_FILES specification. - * - * If the specification represents an array of values, this method will - * delegate to normalizeNestedFileSpec() and return that return value. - * - * @param array $value $_FILES struct - * - * @return array|UploadedFileInterface - */ - private static function createUploadedFileFromSpec(array $value) - { - if (is_array($value['tmp_name'])) { - return self::normalizeNestedFileSpec($value); - } - - return new UploadedFile( - $value['tmp_name'], - (int) $value['size'], - (int) $value['error'], - $value['name'], - $value['type'] - ); - } - - /** - * Normalize an array of file specifications. - * - * Loops through all nested files and returns a normalized array of - * UploadedFileInterface instances. - * - * @param array $files - * - * @return UploadedFileInterface[] - */ - private static function normalizeNestedFileSpec(array $files = []) - { - $normalizedFiles = []; - - foreach (array_keys($files['tmp_name']) as $key) { - $spec = [ - 'tmp_name' => $files['tmp_name'][$key], - 'size' => $files['size'][$key], - 'error' => $files['error'][$key], - 'name' => $files['name'][$key], - 'type' => $files['type'][$key], - ]; - $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); - } - - return $normalizedFiles; - } - - /** - * Return a ServerRequest populated with superglobals: - * $_GET - * $_POST - * $_COOKIE - * $_FILES - * $_SERVER - * - * @return ServerRequestInterface - */ - public static function fromGlobals() - { - $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; - $headers = getallheaders(); - $uri = self::getUriFromGlobals(); - $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); - $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; - - $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); - - return $serverRequest - ->withCookieParams($_COOKIE) - ->withQueryParams($_GET) - ->withParsedBody($_POST) - ->withUploadedFiles(self::normalizeFiles($_FILES)); - } - - private static function extractHostAndPortFromAuthority($authority) - { - $uri = 'http://' . $authority; - $parts = parse_url($uri); - if (false === $parts) { - return [null, null]; - } - - $host = isset($parts['host']) ? $parts['host'] : null; - $port = isset($parts['port']) ? $parts['port'] : null; - - return [$host, $port]; - } - - /** - * Get a Uri populated with values from $_SERVER. - * - * @return UriInterface - */ - public static function getUriFromGlobals() - { - $uri = new Uri(''); - - $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); - - $hasPort = false; - if (isset($_SERVER['HTTP_HOST'])) { - list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); - if ($host !== null) { - $uri = $uri->withHost($host); - } - - if ($port !== null) { - $hasPort = true; - $uri = $uri->withPort($port); - } - } elseif (isset($_SERVER['SERVER_NAME'])) { - $uri = $uri->withHost($_SERVER['SERVER_NAME']); - } elseif (isset($_SERVER['SERVER_ADDR'])) { - $uri = $uri->withHost($_SERVER['SERVER_ADDR']); - } - - if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { - $uri = $uri->withPort($_SERVER['SERVER_PORT']); - } - - $hasQuery = false; - if (isset($_SERVER['REQUEST_URI'])) { - $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); - $uri = $uri->withPath($requestUriParts[0]); - if (isset($requestUriParts[1])) { - $hasQuery = true; - $uri = $uri->withQuery($requestUriParts[1]); - } - } - - if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { - $uri = $uri->withQuery($_SERVER['QUERY_STRING']); - } - - return $uri; - } - - /** - * {@inheritdoc} - */ - public function getServerParams() - { - return $this->serverParams; - } - - /** - * {@inheritdoc} - */ - public function getUploadedFiles() - { - return $this->uploadedFiles; - } - - /** - * {@inheritdoc} - */ - public function withUploadedFiles(array $uploadedFiles) - { - $new = clone $this; - $new->uploadedFiles = $uploadedFiles; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function getCookieParams() - { - return $this->cookieParams; - } - - /** - * {@inheritdoc} - */ - public function withCookieParams(array $cookies) - { - $new = clone $this; - $new->cookieParams = $cookies; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function getQueryParams() - { - return $this->queryParams; - } - - /** - * {@inheritdoc} - */ - public function withQueryParams(array $query) - { - $new = clone $this; - $new->queryParams = $query; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function getParsedBody() - { - return $this->parsedBody; - } - - /** - * {@inheritdoc} - */ - public function withParsedBody($data) - { - $new = clone $this; - $new->parsedBody = $data; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * {@inheritdoc} - */ - public function getAttribute($attribute, $default = null) - { - if (false === array_key_exists($attribute, $this->attributes)) { - return $default; - } - - return $this->attributes[$attribute]; - } - - /** - * {@inheritdoc} - */ - public function withAttribute($attribute, $value) - { - $new = clone $this; - $new->attributes[$attribute] = $value; - - return $new; - } - - /** - * {@inheritdoc} - */ - public function withoutAttribute($attribute) - { - if (false === array_key_exists($attribute, $this->attributes)) { - return $this; - } - - $new = clone $this; - unset($new->attributes[$attribute]); - - return $new; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/Stream.php b/tests/integration/vendor/guzzlehttp/psr7/src/Stream.php deleted file mode 100644 index 3865d6d..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/Stream.php +++ /dev/null @@ -1,270 +0,0 @@ -size = $options['size']; - } - - $this->customMetadata = isset($options['metadata']) - ? $options['metadata'] - : []; - - $this->stream = $stream; - $meta = stream_get_meta_data($this->stream); - $this->seekable = $meta['seekable']; - $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']); - $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']); - $this->uri = $this->getMetadata('uri'); - } - - /** - * Closes the stream when the destructed - */ - public function __destruct() - { - $this->close(); - } - - public function __toString() - { - try { - if ($this->isSeekable()) { - $this->seek(0); - } - return $this->getContents(); - } catch (\Exception $e) { - return ''; - } - } - - public function getContents() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - $contents = stream_get_contents($this->stream); - - if ($contents === false) { - throw new \RuntimeException('Unable to read stream contents'); - } - - return $contents; - } - - public function close() - { - if (isset($this->stream)) { - if (is_resource($this->stream)) { - fclose($this->stream); - } - $this->detach(); - } - } - - public function detach() - { - if (!isset($this->stream)) { - return null; - } - - $result = $this->stream; - unset($this->stream); - $this->size = $this->uri = null; - $this->readable = $this->writable = $this->seekable = false; - - return $result; - } - - public function getSize() - { - if ($this->size !== null) { - return $this->size; - } - - if (!isset($this->stream)) { - return null; - } - - // Clear the stat cache if the stream has a URI - if ($this->uri) { - clearstatcache(true, $this->uri); - } - - $stats = fstat($this->stream); - if (isset($stats['size'])) { - $this->size = $stats['size']; - return $this->size; - } - - return null; - } - - public function isReadable() - { - return $this->readable; - } - - public function isWritable() - { - return $this->writable; - } - - public function isSeekable() - { - return $this->seekable; - } - - public function eof() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - return feof($this->stream); - } - - public function tell() - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - - $result = ftell($this->stream); - - if ($result === false) { - throw new \RuntimeException('Unable to determine stream position'); - } - - return $result; - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - $whence = (int) $whence; - - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->seekable) { - throw new \RuntimeException('Stream is not seekable'); - } - if (fseek($this->stream, $offset, $whence) === -1) { - throw new \RuntimeException('Unable to seek to stream position ' - . $offset . ' with whence ' . var_export($whence, true)); - } - } - - public function read($length) - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->readable) { - throw new \RuntimeException('Cannot read from non-readable stream'); - } - if ($length < 0) { - throw new \RuntimeException('Length parameter cannot be negative'); - } - - if (0 === $length) { - return ''; - } - - $string = fread($this->stream, $length); - if (false === $string) { - throw new \RuntimeException('Unable to read from stream'); - } - - return $string; - } - - public function write($string) - { - if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); - } - if (!$this->writable) { - throw new \RuntimeException('Cannot write to a non-writable stream'); - } - - // We can't know the size after writing anything - $this->size = null; - $result = fwrite($this->stream, $string); - - if ($result === false) { - throw new \RuntimeException('Unable to write to stream'); - } - - return $result; - } - - public function getMetadata($key = null) - { - if (!isset($this->stream)) { - return $key ? null : []; - } elseif (!$key) { - return $this->customMetadata + stream_get_meta_data($this->stream); - } elseif (isset($this->customMetadata[$key])) { - return $this->customMetadata[$key]; - } - - $meta = stream_get_meta_data($this->stream); - - return isset($meta[$key]) ? $meta[$key] : null; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/tests/integration/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php deleted file mode 100644 index 5025dd6..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php +++ /dev/null @@ -1,152 +0,0 @@ -stream = $stream; - } - - /** - * Magic method used to create a new stream if streams are not added in - * the constructor of a decorator (e.g., LazyOpenStream). - * - * @param string $name Name of the property (allows "stream" only). - * - * @return StreamInterface - */ - public function __get($name) - { - if ($name == 'stream') { - $this->stream = $this->createStream(); - return $this->stream; - } - - throw new \UnexpectedValueException("$name not found on class"); - } - - public function __toString() - { - try { - if ($this->isSeekable()) { - $this->seek(0); - } - return $this->getContents(); - } catch (\Exception $e) { - // Really, PHP? https://bugs.php.net/bug.php?id=53648 - trigger_error('StreamDecorator::__toString exception: ' - . (string) $e, E_USER_ERROR); - return ''; - } - } - - public function getContents() - { - return Utils::copyToString($this); - } - - /** - * Allow decorators to implement custom methods - * - * @param string $method Missing method name - * @param array $args Method arguments - * - * @return mixed - */ - public function __call($method, array $args) - { - $result = call_user_func_array([$this->stream, $method], $args); - - // Always return the wrapped object if the result is a return $this - return $result === $this->stream ? $this : $result; - } - - public function close() - { - $this->stream->close(); - } - - public function getMetadata($key = null) - { - return $this->stream->getMetadata($key); - } - - public function detach() - { - return $this->stream->detach(); - } - - public function getSize() - { - return $this->stream->getSize(); - } - - public function eof() - { - return $this->stream->eof(); - } - - public function tell() - { - return $this->stream->tell(); - } - - public function isReadable() - { - return $this->stream->isReadable(); - } - - public function isWritable() - { - return $this->stream->isWritable(); - } - - public function isSeekable() - { - return $this->stream->isSeekable(); - } - - public function rewind() - { - $this->seek(0); - } - - public function seek($offset, $whence = SEEK_SET) - { - $this->stream->seek($offset, $whence); - } - - public function read($length) - { - return $this->stream->read($length); - } - - public function write($string) - { - return $this->stream->write($string); - } - - /** - * Implement in subclasses to dynamically create streams when requested. - * - * @return StreamInterface - * - * @throws \BadMethodCallException - */ - protected function createStream() - { - throw new \BadMethodCallException('Not implemented'); - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/tests/integration/vendor/guzzlehttp/psr7/src/StreamWrapper.php deleted file mode 100644 index fc7cb96..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/StreamWrapper.php +++ /dev/null @@ -1,165 +0,0 @@ -isReadable()) { - $mode = $stream->isWritable() ? 'r+' : 'r'; - } elseif ($stream->isWritable()) { - $mode = 'w'; - } else { - throw new \InvalidArgumentException('The stream must be readable, ' - . 'writable, or both.'); - } - - return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); - } - - /** - * Creates a stream context that can be used to open a stream as a php stream resource. - * - * @param StreamInterface $stream - * - * @return resource - */ - public static function createStreamContext(StreamInterface $stream) - { - return stream_context_create([ - 'guzzle' => ['stream' => $stream] - ]); - } - - /** - * Registers the stream wrapper if needed - */ - public static function register() - { - if (!in_array('guzzle', stream_get_wrappers())) { - stream_wrapper_register('guzzle', __CLASS__); - } - } - - public function stream_open($path, $mode, $options, &$opened_path) - { - $options = stream_context_get_options($this->context); - - if (!isset($options['guzzle']['stream'])) { - return false; - } - - $this->mode = $mode; - $this->stream = $options['guzzle']['stream']; - - return true; - } - - public function stream_read($count) - { - return $this->stream->read($count); - } - - public function stream_write($data) - { - return (int) $this->stream->write($data); - } - - public function stream_tell() - { - return $this->stream->tell(); - } - - public function stream_eof() - { - return $this->stream->eof(); - } - - public function stream_seek($offset, $whence) - { - $this->stream->seek($offset, $whence); - - return true; - } - - public function stream_cast($cast_as) - { - $stream = clone($this->stream); - - return $stream->detach(); - } - - public function stream_stat() - { - static $modeMap = [ - 'r' => 33060, - 'rb' => 33060, - 'r+' => 33206, - 'w' => 33188, - 'wb' => 33188 - ]; - - return [ - 'dev' => 0, - 'ino' => 0, - 'mode' => $modeMap[$this->mode], - 'nlink' => 0, - 'uid' => 0, - 'gid' => 0, - 'rdev' => 0, - 'size' => $this->stream->getSize() ?: 0, - 'atime' => 0, - 'mtime' => 0, - 'ctime' => 0, - 'blksize' => 0, - 'blocks' => 0 - ]; - } - - public function url_stat($path, $flags) - { - return [ - 'dev' => 0, - 'ino' => 0, - 'mode' => 0, - 'nlink' => 0, - 'uid' => 0, - 'gid' => 0, - 'rdev' => 0, - 'size' => 0, - 'atime' => 0, - 'mtime' => 0, - 'ctime' => 0, - 'blksize' => 0, - 'blocks' => 0 - ]; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/UploadedFile.php b/tests/integration/vendor/guzzlehttp/psr7/src/UploadedFile.php deleted file mode 100644 index bf342c4..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/UploadedFile.php +++ /dev/null @@ -1,328 +0,0 @@ -setError($errorStatus); - $this->setSize($size); - $this->setClientFilename($clientFilename); - $this->setClientMediaType($clientMediaType); - - if ($this->isOk()) { - $this->setStreamOrFile($streamOrFile); - } - } - - /** - * Depending on the value set file or stream variable - * - * @param mixed $streamOrFile - * - * @throws InvalidArgumentException - */ - private function setStreamOrFile($streamOrFile) - { - if (is_string($streamOrFile)) { - $this->file = $streamOrFile; - } elseif (is_resource($streamOrFile)) { - $this->stream = new Stream($streamOrFile); - } elseif ($streamOrFile instanceof StreamInterface) { - $this->stream = $streamOrFile; - } else { - throw new InvalidArgumentException( - 'Invalid stream or file provided for UploadedFile' - ); - } - } - - /** - * @param int $error - * - * @throws InvalidArgumentException - */ - private function setError($error) - { - if (false === is_int($error)) { - throw new InvalidArgumentException( - 'Upload file error status must be an integer' - ); - } - - if (false === in_array($error, UploadedFile::$errors)) { - throw new InvalidArgumentException( - 'Invalid error status for UploadedFile' - ); - } - - $this->error = $error; - } - - /** - * @param int $size - * - * @throws InvalidArgumentException - */ - private function setSize($size) - { - if (false === is_int($size)) { - throw new InvalidArgumentException( - 'Upload file size must be an integer' - ); - } - - $this->size = $size; - } - - /** - * @param mixed $param - * - * @return bool - */ - private function isStringOrNull($param) - { - return in_array(gettype($param), ['string', 'NULL']); - } - - /** - * @param mixed $param - * - * @return bool - */ - private function isStringNotEmpty($param) - { - return is_string($param) && false === empty($param); - } - - /** - * @param string|null $clientFilename - * - * @throws InvalidArgumentException - */ - private function setClientFilename($clientFilename) - { - if (false === $this->isStringOrNull($clientFilename)) { - throw new InvalidArgumentException( - 'Upload file client filename must be a string or null' - ); - } - - $this->clientFilename = $clientFilename; - } - - /** - * @param string|null $clientMediaType - * - * @throws InvalidArgumentException - */ - private function setClientMediaType($clientMediaType) - { - if (false === $this->isStringOrNull($clientMediaType)) { - throw new InvalidArgumentException( - 'Upload file client media type must be a string or null' - ); - } - - $this->clientMediaType = $clientMediaType; - } - - /** - * Return true if there is no upload error - * - * @return bool - */ - private function isOk() - { - return $this->error === UPLOAD_ERR_OK; - } - - /** - * @return bool - */ - public function isMoved() - { - return $this->moved; - } - - /** - * @throws RuntimeException if is moved or not ok - */ - private function validateActive() - { - if (false === $this->isOk()) { - throw new RuntimeException('Cannot retrieve stream due to upload error'); - } - - if ($this->isMoved()) { - throw new RuntimeException('Cannot retrieve stream after it has already been moved'); - } - } - - /** - * {@inheritdoc} - * - * @throws RuntimeException if the upload was not successful. - */ - public function getStream() - { - $this->validateActive(); - - if ($this->stream instanceof StreamInterface) { - return $this->stream; - } - - return new LazyOpenStream($this->file, 'r+'); - } - - /** - * {@inheritdoc} - * - * @see http://php.net/is_uploaded_file - * @see http://php.net/move_uploaded_file - * - * @param string $targetPath Path to which to move the uploaded file. - * - * @throws RuntimeException if the upload was not successful. - * @throws InvalidArgumentException if the $path specified is invalid. - * @throws RuntimeException on any error during the move operation, or on - * the second or subsequent call to the method. - */ - public function moveTo($targetPath) - { - $this->validateActive(); - - if (false === $this->isStringNotEmpty($targetPath)) { - throw new InvalidArgumentException( - 'Invalid path provided for move operation; must be a non-empty string' - ); - } - - if ($this->file) { - $this->moved = php_sapi_name() == 'cli' - ? rename($this->file, $targetPath) - : move_uploaded_file($this->file, $targetPath); - } else { - Utils::copyToStream( - $this->getStream(), - new LazyOpenStream($targetPath, 'w') - ); - - $this->moved = true; - } - - if (false === $this->moved) { - throw new RuntimeException( - sprintf('Uploaded file could not be moved to %s', $targetPath) - ); - } - } - - /** - * {@inheritdoc} - * - * @return int|null The file size in bytes or null if unknown. - */ - public function getSize() - { - return $this->size; - } - - /** - * {@inheritdoc} - * - * @see http://php.net/manual/en/features.file-upload.errors.php - * - * @return int One of PHP's UPLOAD_ERR_XXX constants. - */ - public function getError() - { - return $this->error; - } - - /** - * {@inheritdoc} - * - * @return string|null The filename sent by the client or null if none - * was provided. - */ - public function getClientFilename() - { - return $this->clientFilename; - } - - /** - * {@inheritdoc} - */ - public function getClientMediaType() - { - return $this->clientMediaType; - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/Uri.php b/tests/integration/vendor/guzzlehttp/psr7/src/Uri.php deleted file mode 100644 index 0f9f020..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/Uri.php +++ /dev/null @@ -1,810 +0,0 @@ - 80, - 'https' => 443, - 'ftp' => 21, - 'gopher' => 70, - 'nntp' => 119, - 'news' => 119, - 'telnet' => 23, - 'tn3270' => 23, - 'imap' => 143, - 'pop' => 110, - 'ldap' => 389, - ]; - - private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; - private static $charSubDelims = '!\$&\'\(\)\*\+,;='; - private static $replaceQuery = ['=' => '%3D', '&' => '%26']; - - /** @var string Uri scheme. */ - private $scheme = ''; - - /** @var string Uri user info. */ - private $userInfo = ''; - - /** @var string Uri host. */ - private $host = ''; - - /** @var int|null Uri port. */ - private $port; - - /** @var string Uri path. */ - private $path = ''; - - /** @var string Uri query string. */ - private $query = ''; - - /** @var string Uri fragment. */ - private $fragment = ''; - - /** - * @param string $uri URI to parse - */ - public function __construct($uri = '') - { - // weak type check to also accept null until we can add scalar type hints - if ($uri != '') { - $parts = self::parse($uri); - if ($parts === false) { - throw new \InvalidArgumentException("Unable to parse URI: $uri"); - } - $this->applyParts($parts); - } - } - - /** - * UTF-8 aware \parse_url() replacement. - * - * The internal function produces broken output for non ASCII domain names - * (IDN) when used with locales other than "C". - * - * On the other hand, cURL understands IDN correctly only when UTF-8 locale - * is configured ("C.UTF-8", "en_US.UTF-8", etc.). - * - * @see https://bugs.php.net/bug.php?id=52923 - * @see https://www.php.net/manual/en/function.parse-url.php#114817 - * @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING - * - * @param string $url - * - * @return array|false - */ - private static function parse($url) - { - // If IPv6 - $prefix = ''; - if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) { - $prefix = $matches[1]; - $url = $matches[2]; - } - - $encodedUrl = preg_replace_callback( - '%[^:/@?&=#]+%usD', - static function ($matches) { - return urlencode($matches[0]); - }, - $url - ); - - $result = parse_url($prefix . $encodedUrl); - - if ($result === false) { - return false; - } - - return array_map('urldecode', $result); - } - - public function __toString() - { - return self::composeComponents( - $this->scheme, - $this->getAuthority(), - $this->path, - $this->query, - $this->fragment - ); - } - - /** - * Composes a URI reference string from its various components. - * - * Usually this method does not need to be called manually but instead is used indirectly via - * `Psr\Http\Message\UriInterface::__toString`. - * - * PSR-7 UriInterface treats an empty component the same as a missing component as - * getQuery(), getFragment() etc. always return a string. This explains the slight - * difference to RFC 3986 Section 5.3. - * - * Another adjustment is that the authority separator is added even when the authority is missing/empty - * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with - * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But - * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to - * that format). - * - * @param string $scheme - * @param string $authority - * @param string $path - * @param string $query - * @param string $fragment - * - * @return string - * - * @link https://tools.ietf.org/html/rfc3986#section-5.3 - */ - public static function composeComponents($scheme, $authority, $path, $query, $fragment) - { - $uri = ''; - - // weak type checks to also accept null until we can add scalar type hints - if ($scheme != '') { - $uri .= $scheme . ':'; - } - - if ($authority != ''|| $scheme === 'file') { - $uri .= '//' . $authority; - } - - $uri .= $path; - - if ($query != '') { - $uri .= '?' . $query; - } - - if ($fragment != '') { - $uri .= '#' . $fragment; - } - - return $uri; - } - - /** - * Whether the URI has the default port of the current scheme. - * - * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used - * independently of the implementation. - * - * @param UriInterface $uri - * - * @return bool - */ - public static function isDefaultPort(UriInterface $uri) - { - return $uri->getPort() === null - || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); - } - - /** - * Whether the URI is absolute, i.e. it has a scheme. - * - * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true - * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative - * to another URI, the base URI. Relative references can be divided into several forms: - * - network-path references, e.g. '//example.com/path' - * - absolute-path references, e.g. '/path' - * - relative-path references, e.g. 'subpath' - * - * @param UriInterface $uri - * - * @return bool - * - * @see Uri::isNetworkPathReference - * @see Uri::isAbsolutePathReference - * @see Uri::isRelativePathReference - * @link https://tools.ietf.org/html/rfc3986#section-4 - */ - public static function isAbsolute(UriInterface $uri) - { - return $uri->getScheme() !== ''; - } - - /** - * Whether the URI is a network-path reference. - * - * A relative reference that begins with two slash characters is termed an network-path reference. - * - * @param UriInterface $uri - * - * @return bool - * - * @link https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isNetworkPathReference(UriInterface $uri) - { - return $uri->getScheme() === '' && $uri->getAuthority() !== ''; - } - - /** - * Whether the URI is a absolute-path reference. - * - * A relative reference that begins with a single slash character is termed an absolute-path reference. - * - * @param UriInterface $uri - * - * @return bool - * - * @link https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isAbsolutePathReference(UriInterface $uri) - { - return $uri->getScheme() === '' - && $uri->getAuthority() === '' - && isset($uri->getPath()[0]) - && $uri->getPath()[0] === '/'; - } - - /** - * Whether the URI is a relative-path reference. - * - * A relative reference that does not begin with a slash character is termed a relative-path reference. - * - * @param UriInterface $uri - * - * @return bool - * - * @link https://tools.ietf.org/html/rfc3986#section-4.2 - */ - public static function isRelativePathReference(UriInterface $uri) - { - return $uri->getScheme() === '' - && $uri->getAuthority() === '' - && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); - } - - /** - * Whether the URI is a same-document reference. - * - * A same-document reference refers to a URI that is, aside from its fragment - * component, identical to the base URI. When no base URI is given, only an empty - * URI reference (apart from its fragment) is considered a same-document reference. - * - * @param UriInterface $uri The URI to check - * @param UriInterface|null $base An optional base URI to compare against - * - * @return bool - * - * @link https://tools.ietf.org/html/rfc3986#section-4.4 - */ - public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) - { - if ($base !== null) { - $uri = UriResolver::resolve($base, $uri); - - return ($uri->getScheme() === $base->getScheme()) - && ($uri->getAuthority() === $base->getAuthority()) - && ($uri->getPath() === $base->getPath()) - && ($uri->getQuery() === $base->getQuery()); - } - - return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; - } - - /** - * Removes dot segments from a path and returns the new path. - * - * @param string $path - * - * @return string - * - * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. - * @see UriResolver::removeDotSegments - */ - public static function removeDotSegments($path) - { - return UriResolver::removeDotSegments($path); - } - - /** - * Converts the relative URI into a new URI that is resolved against the base URI. - * - * @param UriInterface $base Base URI - * @param string|UriInterface $rel Relative URI - * - * @return UriInterface - * - * @deprecated since version 1.4. Use UriResolver::resolve instead. - * @see UriResolver::resolve - */ - public static function resolve(UriInterface $base, $rel) - { - if (!($rel instanceof UriInterface)) { - $rel = new self($rel); - } - - return UriResolver::resolve($base, $rel); - } - - /** - * Creates a new URI with a specific query string value removed. - * - * Any existing query string values that exactly match the provided key are - * removed. - * - * @param UriInterface $uri URI to use as a base. - * @param string $key Query string key to remove. - * - * @return UriInterface - */ - public static function withoutQueryValue(UriInterface $uri, $key) - { - $result = self::getFilteredQueryString($uri, [$key]); - - return $uri->withQuery(implode('&', $result)); - } - - /** - * Creates a new URI with a specific query string value. - * - * Any existing query string values that exactly match the provided key are - * removed and replaced with the given key value pair. - * - * A value of null will set the query string key without a value, e.g. "key" - * instead of "key=value". - * - * @param UriInterface $uri URI to use as a base. - * @param string $key Key to set. - * @param string|null $value Value to set - * - * @return UriInterface - */ - public static function withQueryValue(UriInterface $uri, $key, $value) - { - $result = self::getFilteredQueryString($uri, [$key]); - - $result[] = self::generateQueryString($key, $value); - - return $uri->withQuery(implode('&', $result)); - } - - /** - * Creates a new URI with multiple specific query string values. - * - * It has the same behavior as withQueryValue() but for an associative array of key => value. - * - * @param UriInterface $uri URI to use as a base. - * @param array $keyValueArray Associative array of key and values - * - * @return UriInterface - */ - public static function withQueryValues(UriInterface $uri, array $keyValueArray) - { - $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); - - foreach ($keyValueArray as $key => $value) { - $result[] = self::generateQueryString($key, $value); - } - - return $uri->withQuery(implode('&', $result)); - } - - /** - * Creates a URI from a hash of `parse_url` components. - * - * @param array $parts - * - * @return UriInterface - * - * @link http://php.net/manual/en/function.parse-url.php - * - * @throws \InvalidArgumentException If the components do not form a valid URI. - */ - public static function fromParts(array $parts) - { - $uri = new self(); - $uri->applyParts($parts); - $uri->validateState(); - - return $uri; - } - - public function getScheme() - { - return $this->scheme; - } - - public function getAuthority() - { - $authority = $this->host; - if ($this->userInfo !== '') { - $authority = $this->userInfo . '@' . $authority; - } - - if ($this->port !== null) { - $authority .= ':' . $this->port; - } - - return $authority; - } - - public function getUserInfo() - { - return $this->userInfo; - } - - public function getHost() - { - return $this->host; - } - - public function getPort() - { - return $this->port; - } - - public function getPath() - { - return $this->path; - } - - public function getQuery() - { - return $this->query; - } - - public function getFragment() - { - return $this->fragment; - } - - public function withScheme($scheme) - { - $scheme = $this->filterScheme($scheme); - - if ($this->scheme === $scheme) { - return $this; - } - - $new = clone $this; - $new->scheme = $scheme; - $new->removeDefaultPort(); - $new->validateState(); - - return $new; - } - - public function withUserInfo($user, $password = null) - { - $info = $this->filterUserInfoComponent($user); - if ($password !== null) { - $info .= ':' . $this->filterUserInfoComponent($password); - } - - if ($this->userInfo === $info) { - return $this; - } - - $new = clone $this; - $new->userInfo = $info; - $new->validateState(); - - return $new; - } - - public function withHost($host) - { - $host = $this->filterHost($host); - - if ($this->host === $host) { - return $this; - } - - $new = clone $this; - $new->host = $host; - $new->validateState(); - - return $new; - } - - public function withPort($port) - { - $port = $this->filterPort($port); - - if ($this->port === $port) { - return $this; - } - - $new = clone $this; - $new->port = $port; - $new->removeDefaultPort(); - $new->validateState(); - - return $new; - } - - public function withPath($path) - { - $path = $this->filterPath($path); - - if ($this->path === $path) { - return $this; - } - - $new = clone $this; - $new->path = $path; - $new->validateState(); - - return $new; - } - - public function withQuery($query) - { - $query = $this->filterQueryAndFragment($query); - - if ($this->query === $query) { - return $this; - } - - $new = clone $this; - $new->query = $query; - - return $new; - } - - public function withFragment($fragment) - { - $fragment = $this->filterQueryAndFragment($fragment); - - if ($this->fragment === $fragment) { - return $this; - } - - $new = clone $this; - $new->fragment = $fragment; - - return $new; - } - - /** - * Apply parse_url parts to a URI. - * - * @param array $parts Array of parse_url parts to apply. - */ - private function applyParts(array $parts) - { - $this->scheme = isset($parts['scheme']) - ? $this->filterScheme($parts['scheme']) - : ''; - $this->userInfo = isset($parts['user']) - ? $this->filterUserInfoComponent($parts['user']) - : ''; - $this->host = isset($parts['host']) - ? $this->filterHost($parts['host']) - : ''; - $this->port = isset($parts['port']) - ? $this->filterPort($parts['port']) - : null; - $this->path = isset($parts['path']) - ? $this->filterPath($parts['path']) - : ''; - $this->query = isset($parts['query']) - ? $this->filterQueryAndFragment($parts['query']) - : ''; - $this->fragment = isset($parts['fragment']) - ? $this->filterQueryAndFragment($parts['fragment']) - : ''; - if (isset($parts['pass'])) { - $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); - } - - $this->removeDefaultPort(); - } - - /** - * @param string $scheme - * - * @return string - * - * @throws \InvalidArgumentException If the scheme is invalid. - */ - private function filterScheme($scheme) - { - if (!is_string($scheme)) { - throw new \InvalidArgumentException('Scheme must be a string'); - } - - return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); - } - - /** - * @param string $component - * - * @return string - * - * @throws \InvalidArgumentException If the user info is invalid. - */ - private function filterUserInfoComponent($component) - { - if (!is_string($component)) { - throw new \InvalidArgumentException('User info must be a string'); - } - - return preg_replace_callback( - '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/', - [$this, 'rawurlencodeMatchZero'], - $component - ); - } - - /** - * @param string $host - * - * @return string - * - * @throws \InvalidArgumentException If the host is invalid. - */ - private function filterHost($host) - { - if (!is_string($host)) { - throw new \InvalidArgumentException('Host must be a string'); - } - - return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); - } - - /** - * @param int|null $port - * - * @return int|null - * - * @throws \InvalidArgumentException If the port is invalid. - */ - private function filterPort($port) - { - if ($port === null) { - return null; - } - - $port = (int) $port; - if (0 > $port || 0xffff < $port) { - throw new \InvalidArgumentException( - sprintf('Invalid port: %d. Must be between 0 and 65535', $port) - ); - } - - return $port; - } - - /** - * @param UriInterface $uri - * @param array $keys - * - * @return array - */ - private static function getFilteredQueryString(UriInterface $uri, array $keys) - { - $current = $uri->getQuery(); - - if ($current === '') { - return []; - } - - $decodedKeys = array_map('rawurldecode', $keys); - - return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { - return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); - }); - } - - /** - * @param string $key - * @param string|null $value - * - * @return string - */ - private static function generateQueryString($key, $value) - { - // Query string separators ("=", "&") within the key or value need to be encoded - // (while preventing double-encoding) before setting the query string. All other - // chars that need percent-encoding will be encoded by withQuery(). - $queryString = strtr($key, self::$replaceQuery); - - if ($value !== null) { - $queryString .= '=' . strtr($value, self::$replaceQuery); - } - - return $queryString; - } - - private function removeDefaultPort() - { - if ($this->port !== null && self::isDefaultPort($this)) { - $this->port = null; - } - } - - /** - * Filters the path of a URI - * - * @param string $path - * - * @return string - * - * @throws \InvalidArgumentException If the path is invalid. - */ - private function filterPath($path) - { - if (!is_string($path)) { - throw new \InvalidArgumentException('Path must be a string'); - } - - return preg_replace_callback( - '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', - [$this, 'rawurlencodeMatchZero'], - $path - ); - } - - /** - * Filters the query string or fragment of a URI. - * - * @param string $str - * - * @return string - * - * @throws \InvalidArgumentException If the query or fragment is invalid. - */ - private function filterQueryAndFragment($str) - { - if (!is_string($str)) { - throw new \InvalidArgumentException('Query and fragment must be a string'); - } - - return preg_replace_callback( - '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', - [$this, 'rawurlencodeMatchZero'], - $str - ); - } - - private function rawurlencodeMatchZero(array $match) - { - return rawurlencode($match[0]); - } - - private function validateState() - { - if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { - $this->host = self::HTTP_DEFAULT_HOST; - } - - if ($this->getAuthority() === '') { - if (0 === strpos($this->path, '//')) { - throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); - } - if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { - throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); - } - } elseif (isset($this->path[0]) && $this->path[0] !== '/') { - @trigger_error( - 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . - 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', - E_USER_DEPRECATED - ); - $this->path = '/' . $this->path; - //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); - } - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/tests/integration/vendor/guzzlehttp/psr7/src/UriNormalizer.php deleted file mode 100644 index 81419ea..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/UriNormalizer.php +++ /dev/null @@ -1,219 +0,0 @@ -getPath() === '' && - ($uri->getScheme() === 'http' || $uri->getScheme() === 'https') - ) { - $uri = $uri->withPath('/'); - } - - if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { - $uri = $uri->withHost(''); - } - - if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { - $uri = $uri->withPort(null); - } - - if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { - $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); - } - - if ($flags & self::REMOVE_DUPLICATE_SLASHES) { - $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); - } - - if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { - $queryKeyValues = explode('&', $uri->getQuery()); - sort($queryKeyValues); - $uri = $uri->withQuery(implode('&', $queryKeyValues)); - } - - return $uri; - } - - /** - * Whether two URIs can be considered equivalent. - * - * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also - * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be - * resolved against the same base URI. If this is not the case, determination of equivalence or difference of - * relative references does not mean anything. - * - * @param UriInterface $uri1 An URI to compare - * @param UriInterface $uri2 An URI to compare - * @param int $normalizations A bitmask of normalizations to apply, see constants - * - * @return bool - * - * @link https://tools.ietf.org/html/rfc3986#section-6.1 - */ - public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) - { - return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); - } - - private static function capitalizePercentEncoding(UriInterface $uri) - { - $regex = '/(?:%[A-Fa-f0-9]{2})++/'; - - $callback = function (array $match) { - return strtoupper($match[0]); - }; - - return - $uri->withPath( - preg_replace_callback($regex, $callback, $uri->getPath()) - )->withQuery( - preg_replace_callback($regex, $callback, $uri->getQuery()) - ); - } - - private static function decodeUnreservedCharacters(UriInterface $uri) - { - $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; - - $callback = function (array $match) { - return rawurldecode($match[0]); - }; - - return - $uri->withPath( - preg_replace_callback($regex, $callback, $uri->getPath()) - )->withQuery( - preg_replace_callback($regex, $callback, $uri->getQuery()) - ); - } - - private function __construct() - { - // cannot be instantiated - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/UriResolver.php b/tests/integration/vendor/guzzlehttp/psr7/src/UriResolver.php deleted file mode 100644 index a3cb15d..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/UriResolver.php +++ /dev/null @@ -1,222 +0,0 @@ -getScheme() != '') { - return $rel->withPath(self::removeDotSegments($rel->getPath())); - } - - if ($rel->getAuthority() != '') { - $targetAuthority = $rel->getAuthority(); - $targetPath = self::removeDotSegments($rel->getPath()); - $targetQuery = $rel->getQuery(); - } else { - $targetAuthority = $base->getAuthority(); - if ($rel->getPath() === '') { - $targetPath = $base->getPath(); - $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); - } else { - if ($rel->getPath()[0] === '/') { - $targetPath = $rel->getPath(); - } else { - if ($targetAuthority != '' && $base->getPath() === '') { - $targetPath = '/' . $rel->getPath(); - } else { - $lastSlashPos = strrpos($base->getPath(), '/'); - if ($lastSlashPos === false) { - $targetPath = $rel->getPath(); - } else { - $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); - } - } - } - $targetPath = self::removeDotSegments($targetPath); - $targetQuery = $rel->getQuery(); - } - } - - return new Uri(Uri::composeComponents( - $base->getScheme(), - $targetAuthority, - $targetPath, - $targetQuery, - $rel->getFragment() - )); - } - - /** - * Returns the target URI as a relative reference from the base URI. - * - * This method is the counterpart to resolve(): - * - * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) - * - * One use-case is to use the current request URI as base URI and then generate relative links in your documents - * to reduce the document size or offer self-contained downloadable document archives. - * - * $base = new Uri('http://example.com/a/b/'); - * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. - * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. - * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. - * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. - * - * This method also accepts a target that is already relative and will try to relativize it further. Only a - * relative-path reference will be returned as-is. - * - * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well - * - * @param UriInterface $base Base URI - * @param UriInterface $target Target URI - * - * @return UriInterface The relative URI reference - */ - public static function relativize(UriInterface $base, UriInterface $target) - { - if ($target->getScheme() !== '' && - ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '') - ) { - return $target; - } - - if (Uri::isRelativePathReference($target)) { - // As the target is already highly relative we return it as-is. It would be possible to resolve - // the target with `$target = self::resolve($base, $target);` and then try make it more relative - // by removing a duplicate query. But let's not do that automatically. - return $target; - } - - if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { - return $target->withScheme(''); - } - - // We must remove the path before removing the authority because if the path starts with two slashes, the URI - // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also - // invalid. - $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); - - if ($base->getPath() !== $target->getPath()) { - return $emptyPathUri->withPath(self::getRelativePath($base, $target)); - } - - if ($base->getQuery() === $target->getQuery()) { - // Only the target fragment is left. And it must be returned even if base and target fragment are the same. - return $emptyPathUri->withQuery(''); - } - - // If the base URI has a query but the target has none, we cannot return an empty path reference as it would - // inherit the base query component when resolving. - if ($target->getQuery() === '') { - $segments = explode('/', $target->getPath()); - $lastSegment = end($segments); - - return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); - } - - return $emptyPathUri; - } - - private static function getRelativePath(UriInterface $base, UriInterface $target) - { - $sourceSegments = explode('/', $base->getPath()); - $targetSegments = explode('/', $target->getPath()); - array_pop($sourceSegments); - $targetLastSegment = array_pop($targetSegments); - foreach ($sourceSegments as $i => $segment) { - if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { - unset($sourceSegments[$i], $targetSegments[$i]); - } else { - break; - } - } - $targetSegments[] = $targetLastSegment; - $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); - - // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". - // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used - // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. - if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { - $relativePath = "./$relativePath"; - } elseif ('/' === $relativePath[0]) { - if ($base->getAuthority() != '' && $base->getPath() === '') { - // In this case an extra slash is added by resolve() automatically. So we must not add one here. - $relativePath = ".$relativePath"; - } else { - $relativePath = "./$relativePath"; - } - } - - return $relativePath; - } - - private function __construct() - { - // cannot be instantiated - } -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/functions.php b/tests/integration/vendor/guzzlehttp/psr7/src/functions.php deleted file mode 100644 index b0901fa..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/functions.php +++ /dev/null @@ -1,422 +0,0 @@ - '1', 'foo[b]' => '2'])`. - * - * @param string $str Query string to parse - * @param int|bool $urlEncoding How the query string is encoded - * - * @return array - * - * @deprecated parse_query will be removed in guzzlehttp/psr7:2.0. Use Query::parse instead. - */ -function parse_query($str, $urlEncoding = true) -{ - return Query::parse($str, $urlEncoding); -} - -/** - * Build a query string from an array of key value pairs. - * - * This function can use the return value of `parse_query()` to build a query - * string. This function does not modify the provided keys when an array is - * encountered (like `http_build_query()` would). - * - * @param array $params Query string parameters. - * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 - * to encode using RFC3986, or PHP_QUERY_RFC1738 - * to encode using RFC1738. - * - * @return string - * - * @deprecated build_query will be removed in guzzlehttp/psr7:2.0. Use Query::build instead. - */ -function build_query(array $params, $encoding = PHP_QUERY_RFC3986) -{ - return Query::build($params, $encoding); -} - -/** - * Determines the mimetype of a file by looking at its extension. - * - * @param string $filename - * - * @return string|null - * - * @deprecated mimetype_from_filename will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromFilename instead. - */ -function mimetype_from_filename($filename) -{ - return MimeType::fromFilename($filename); -} - -/** - * Maps a file extensions to a mimetype. - * - * @param $extension string The file extension. - * - * @return string|null - * - * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types - * @deprecated mimetype_from_extension will be removed in guzzlehttp/psr7:2.0. Use MimeType::fromExtension instead. - */ -function mimetype_from_extension($extension) -{ - return MimeType::fromExtension($extension); -} - -/** - * Parses an HTTP message into an associative array. - * - * The array contains the "start-line" key containing the start line of - * the message, "headers" key containing an associative array of header - * array values, and a "body" key containing the body of the message. - * - * @param string $message HTTP request or response to parse. - * - * @return array - * - * @internal - * - * @deprecated _parse_message will be removed in guzzlehttp/psr7:2.0. Use Message::parseMessage instead. - */ -function _parse_message($message) -{ - return Message::parseMessage($message); -} - -/** - * Constructs a URI for an HTTP request message. - * - * @param string $path Path from the start-line - * @param array $headers Array of headers (each value an array). - * - * @return string - * - * @internal - * - * @deprecated _parse_request_uri will be removed in guzzlehttp/psr7:2.0. Use Message::parseRequestUri instead. - */ -function _parse_request_uri($path, array $headers) -{ - return Message::parseRequestUri($path, $headers); -} - -/** - * Get a short summary of the message body. - * - * Will return `null` if the response is not printable. - * - * @param MessageInterface $message The message to get the body summary - * @param int $truncateAt The maximum allowed size of the summary - * - * @return string|null - * - * @deprecated get_message_body_summary will be removed in guzzlehttp/psr7:2.0. Use Message::bodySummary instead. - */ -function get_message_body_summary(MessageInterface $message, $truncateAt = 120) -{ - return Message::bodySummary($message, $truncateAt); -} - -/** - * Remove the items given by the keys, case insensitively from the data. - * - * @param iterable $keys - * - * @return array - * - * @internal - * - * @deprecated _caseless_remove will be removed in guzzlehttp/psr7:2.0. Use Utils::caselessRemove instead. - */ -function _caseless_remove($keys, array $data) -{ - return Utils::caselessRemove($keys, $data); -} diff --git a/tests/integration/vendor/guzzlehttp/psr7/src/functions_include.php b/tests/integration/vendor/guzzlehttp/psr7/src/functions_include.php deleted file mode 100644 index 96a4a83..0000000 --- a/tests/integration/vendor/guzzlehttp/psr7/src/functions_include.php +++ /dev/null @@ -1,6 +0,0 @@ -=7.4.0" - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - } -} diff --git a/tests/integration/vendor/psr/container/src/ContainerExceptionInterface.php b/tests/integration/vendor/psr/container/src/ContainerExceptionInterface.php deleted file mode 100644 index 0f213f2..0000000 --- a/tests/integration/vendor/psr/container/src/ContainerExceptionInterface.php +++ /dev/null @@ -1,12 +0,0 @@ -getHeaders() as $name => $values) { - * echo $name . ": " . implode(", ", $values); - * } - * - * // Emit headers iteratively: - * foreach ($message->getHeaders() as $name => $values) { - * foreach ($values as $value) { - * header(sprintf('%s: %s', $name, $value), false); - * } - * } - * - * While header names are not case-sensitive, getHeaders() will preserve the - * exact case in which headers were originally specified. - * - * @return string[][] Returns an associative array of the message's headers. Each - * key MUST be a header name, and each value MUST be an array of strings - * for that header. - */ - public function getHeaders(); - - /** - * Checks if a header exists by the given case-insensitive name. - * - * @param string $name Case-insensitive header field name. - * @return bool Returns true if any header names match the given header - * name using a case-insensitive string comparison. Returns false if - * no matching header name is found in the message. - */ - public function hasHeader(string $name); - - /** - * Retrieves a message header value by the given case-insensitive name. - * - * This method returns an array of all the header values of the given - * case-insensitive header name. - * - * If the header does not appear in the message, this method MUST return an - * empty array. - * - * @param string $name Case-insensitive header field name. - * @return string[] An array of string values as provided for the given - * header. If the header does not appear in the message, this method MUST - * return an empty array. - */ - public function getHeader(string $name); - - /** - * Retrieves a comma-separated string of the values for a single header. - * - * This method returns all of the header values of the given - * case-insensitive header name as a string concatenated together using - * a comma. - * - * NOTE: Not all header values may be appropriately represented using - * comma concatenation. For such headers, use getHeader() instead - * and supply your own delimiter when concatenating. - * - * If the header does not appear in the message, this method MUST return - * an empty string. - * - * @param string $name Case-insensitive header field name. - * @return string A string of values as provided for the given header - * concatenated together using a comma. If the header does not appear in - * the message, this method MUST return an empty string. - */ - public function getHeaderLine(string $name); - - /** - * Return an instance with the provided value replacing the specified header. - * - * While header names are case-insensitive, the casing of the header will - * be preserved by this function, and returned from getHeaders(). - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * new and/or updated header and value. - * - * @param string $name Case-insensitive header field name. - * @param string|string[] $value Header value(s). - * @return static - * @throws \InvalidArgumentException for invalid header names or values. - */ - public function withHeader(string $name, $value); - - /** - * Return an instance with the specified header appended with the given value. - * - * Existing values for the specified header will be maintained. The new - * value(s) will be appended to the existing list. If the header did not - * exist previously, it will be added. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * new header and/or value. - * - * @param string $name Case-insensitive header field name to add. - * @param string|string[] $value Header value(s). - * @return static - * @throws \InvalidArgumentException for invalid header names or values. - */ - public function withAddedHeader(string $name, $value); - - /** - * Return an instance without the specified header. - * - * Header resolution MUST be done without case-sensitivity. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that removes - * the named header. - * - * @param string $name Case-insensitive header field name to remove. - * @return static - */ - public function withoutHeader(string $name); - - /** - * Gets the body of the message. - * - * @return StreamInterface Returns the body as a stream. - */ - public function getBody(); - - /** - * Return an instance with the specified message body. - * - * The body MUST be a StreamInterface object. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return a new instance that has the - * new body stream. - * - * @param StreamInterface $body Body. - * @return static - * @throws \InvalidArgumentException When the body is not valid. - */ - public function withBody(StreamInterface $body); -} diff --git a/tests/integration/vendor/psr/http-message/src/RequestInterface.php b/tests/integration/vendor/psr/http-message/src/RequestInterface.php deleted file mode 100644 index 38066df..0000000 --- a/tests/integration/vendor/psr/http-message/src/RequestInterface.php +++ /dev/null @@ -1,131 +0,0 @@ -getQuery()` - * or from the `QUERY_STRING` server param. - * - * @return array - */ - public function getQueryParams(); - - /** - * Return an instance with the specified query string arguments. - * - * These values SHOULD remain immutable over the course of the incoming - * request. They MAY be injected during instantiation, such as from PHP's - * $_GET superglobal, or MAY be derived from some other value such as the - * URI. In cases where the arguments are parsed from the URI, the data - * MUST be compatible with what PHP's parse_str() would return for - * purposes of how duplicate query parameters are handled, and how nested - * sets are handled. - * - * Setting query string arguments MUST NOT change the URI stored by the - * request, nor the values in the server params. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * updated query string arguments. - * - * @param array $query Array of query string arguments, typically from - * $_GET. - * @return static - */ - public function withQueryParams(array $query); - - /** - * Retrieve normalized file upload data. - * - * This method returns upload metadata in a normalized tree, with each leaf - * an instance of Psr\Http\Message\UploadedFileInterface. - * - * These values MAY be prepared from $_FILES or the message body during - * instantiation, or MAY be injected via withUploadedFiles(). - * - * @return array An array tree of UploadedFileInterface instances; an empty - * array MUST be returned if no data is present. - */ - public function getUploadedFiles(); - - /** - * Create a new instance with the specified uploaded files. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * updated body parameters. - * - * @param array $uploadedFiles An array tree of UploadedFileInterface instances. - * @return static - * @throws \InvalidArgumentException if an invalid structure is provided. - */ - public function withUploadedFiles(array $uploadedFiles); - - /** - * Retrieve any parameters provided in the request body. - * - * If the request Content-Type is either application/x-www-form-urlencoded - * or multipart/form-data, and the request method is POST, this method MUST - * return the contents of $_POST. - * - * Otherwise, this method may return any results of deserializing - * the request body content; as parsing returns structured content, the - * potential types MUST be arrays or objects only. A null value indicates - * the absence of body content. - * - * @return null|array|object The deserialized body parameters, if any. - * These will typically be an array or object. - */ - public function getParsedBody(); - - /** - * Return an instance with the specified body parameters. - * - * These MAY be injected during instantiation. - * - * If the request Content-Type is either application/x-www-form-urlencoded - * or multipart/form-data, and the request method is POST, use this method - * ONLY to inject the contents of $_POST. - * - * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of - * deserializing the request body content. Deserialization/parsing returns - * structured data, and, as such, this method ONLY accepts arrays or objects, - * or a null value if nothing was available to parse. - * - * As an example, if content negotiation determines that the request data - * is a JSON payload, this method could be used to create a request - * instance with the deserialized parameters. - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * updated body parameters. - * - * @param null|array|object $data The deserialized body data. This will - * typically be in an array or object. - * @return static - * @throws \InvalidArgumentException if an unsupported argument type is - * provided. - */ - public function withParsedBody($data); - - /** - * Retrieve attributes derived from the request. - * - * The request "attributes" may be used to allow injection of any - * parameters derived from the request: e.g., the results of path - * match operations; the results of decrypting cookies; the results of - * deserializing non-form-encoded message bodies; etc. Attributes - * will be application and request specific, and CAN be mutable. - * - * @return array Attributes derived from the request. - */ - public function getAttributes(); - - /** - * Retrieve a single derived request attribute. - * - * Retrieves a single derived request attribute as described in - * getAttributes(). If the attribute has not been previously set, returns - * the default value as provided. - * - * This method obviates the need for a hasAttribute() method, as it allows - * specifying a default value to return if the attribute is not found. - * - * @see getAttributes() - * @param string $name The attribute name. - * @param mixed $default Default value to return if the attribute does not exist. - * @return mixed - */ - public function getAttribute(string $name, $default = null); - - /** - * Return an instance with the specified derived request attribute. - * - * This method allows setting a single derived request attribute as - * described in getAttributes(). - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that has the - * updated attribute. - * - * @see getAttributes() - * @param string $name The attribute name. - * @param mixed $value The value of the attribute. - * @return static - */ - public function withAttribute(string $name, $value); - - /** - * Return an instance that removes the specified derived request attribute. - * - * This method allows removing a single derived request attribute as - * described in getAttributes(). - * - * This method MUST be implemented in such a way as to retain the - * immutability of the message, and MUST return an instance that removes - * the attribute. - * - * @see getAttributes() - * @param string $name The attribute name. - * @return static - */ - public function withoutAttribute(string $name); -} diff --git a/tests/integration/vendor/psr/http-message/src/StreamInterface.php b/tests/integration/vendor/psr/http-message/src/StreamInterface.php deleted file mode 100644 index 5924663..0000000 --- a/tests/integration/vendor/psr/http-message/src/StreamInterface.php +++ /dev/null @@ -1,160 +0,0 @@ - - * [user-info@]host[:port] - * - * - * If the port component is not set or is the standard port for the current - * scheme, it SHOULD NOT be included. - * - * @see https://tools.ietf.org/html/rfc3986#section-3.2 - * @return string The URI authority, in "[user-info@]host[:port]" format. - */ - public function getAuthority(); - - /** - * Retrieve the user information component of the URI. - * - * If no user information is present, this method MUST return an empty - * string. - * - * If a user is present in the URI, this will return that value; - * additionally, if the password is also present, it will be appended to the - * user value, with a colon (":") separating the values. - * - * The trailing "@" character is not part of the user information and MUST - * NOT be added. - * - * @return string The URI user information, in "username[:password]" format. - */ - public function getUserInfo(); - - /** - * Retrieve the host component of the URI. - * - * If no host is present, this method MUST return an empty string. - * - * The value returned MUST be normalized to lowercase, per RFC 3986 - * Section 3.2.2. - * - * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 - * @return string The URI host. - */ - public function getHost(); - - /** - * Retrieve the port component of the URI. - * - * If a port is present, and it is non-standard for the current scheme, - * this method MUST return it as an integer. If the port is the standard port - * used with the current scheme, this method SHOULD return null. - * - * If no port is present, and no scheme is present, this method MUST return - * a null value. - * - * If no port is present, but a scheme is present, this method MAY return - * the standard port for that scheme, but SHOULD return null. - * - * @return null|int The URI port. - */ - public function getPort(); - - /** - * Retrieve the path component of the URI. - * - * The path can either be empty or absolute (starting with a slash) or - * rootless (not starting with a slash). Implementations MUST support all - * three syntaxes. - * - * Normally, the empty path "" and absolute path "/" are considered equal as - * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically - * do this normalization because in contexts with a trimmed base path, e.g. - * the front controller, this difference becomes significant. It's the task - * of the user to handle both "" and "/". - * - * The value returned MUST be percent-encoded, but MUST NOT double-encode - * any characters. To determine what characters to encode, please refer to - * RFC 3986, Sections 2 and 3.3. - * - * As an example, if the value should include a slash ("/") not intended as - * delimiter between path segments, that value MUST be passed in encoded - * form (e.g., "%2F") to the instance. - * - * @see https://tools.ietf.org/html/rfc3986#section-2 - * @see https://tools.ietf.org/html/rfc3986#section-3.3 - * @return string The URI path. - */ - public function getPath(); - - /** - * Retrieve the query string of the URI. - * - * If no query string is present, this method MUST return an empty string. - * - * The leading "?" character is not part of the query and MUST NOT be - * added. - * - * The value returned MUST be percent-encoded, but MUST NOT double-encode - * any characters. To determine what characters to encode, please refer to - * RFC 3986, Sections 2 and 3.4. - * - * As an example, if a value in a key/value pair of the query string should - * include an ampersand ("&") not intended as a delimiter between values, - * that value MUST be passed in encoded form (e.g., "%26") to the instance. - * - * @see https://tools.ietf.org/html/rfc3986#section-2 - * @see https://tools.ietf.org/html/rfc3986#section-3.4 - * @return string The URI query string. - */ - public function getQuery(); - - /** - * Retrieve the fragment component of the URI. - * - * If no fragment is present, this method MUST return an empty string. - * - * The leading "#" character is not part of the fragment and MUST NOT be - * added. - * - * The value returned MUST be percent-encoded, but MUST NOT double-encode - * any characters. To determine what characters to encode, please refer to - * RFC 3986, Sections 2 and 3.5. - * - * @see https://tools.ietf.org/html/rfc3986#section-2 - * @see https://tools.ietf.org/html/rfc3986#section-3.5 - * @return string The URI fragment. - */ - public function getFragment(); - - /** - * Return an instance with the specified scheme. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified scheme. - * - * Implementations MUST support the schemes "http" and "https" case - * insensitively, and MAY accommodate other schemes if required. - * - * An empty scheme is equivalent to removing the scheme. - * - * @param string $scheme The scheme to use with the new instance. - * @return static A new instance with the specified scheme. - * @throws \InvalidArgumentException for invalid or unsupported schemes. - */ - public function withScheme(string $scheme); - - /** - * Return an instance with the specified user information. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified user information. - * - * Password is optional, but the user information MUST include the - * user; an empty string for the user is equivalent to removing user - * information. - * - * @param string $user The user name to use for authority. - * @param null|string $password The password associated with $user. - * @return static A new instance with the specified user information. - */ - public function withUserInfo(string $user, ?string $password = null); - - /** - * Return an instance with the specified host. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified host. - * - * An empty host value is equivalent to removing the host. - * - * @param string $host The hostname to use with the new instance. - * @return static A new instance with the specified host. - * @throws \InvalidArgumentException for invalid hostnames. - */ - public function withHost(string $host); - - /** - * Return an instance with the specified port. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified port. - * - * Implementations MUST raise an exception for ports outside the - * established TCP and UDP port ranges. - * - * A null value provided for the port is equivalent to removing the port - * information. - * - * @param null|int $port The port to use with the new instance; a null value - * removes the port information. - * @return static A new instance with the specified port. - * @throws \InvalidArgumentException for invalid ports. - */ - public function withPort(?int $port); - - /** - * Return an instance with the specified path. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified path. - * - * The path can either be empty or absolute (starting with a slash) or - * rootless (not starting with a slash). Implementations MUST support all - * three syntaxes. - * - * If the path is intended to be domain-relative rather than path relative then - * it must begin with a slash ("/"). Paths not starting with a slash ("/") - * are assumed to be relative to some base path known to the application or - * consumer. - * - * Users can provide both encoded and decoded path characters. - * Implementations ensure the correct encoding as outlined in getPath(). - * - * @param string $path The path to use with the new instance. - * @return static A new instance with the specified path. - * @throws \InvalidArgumentException for invalid paths. - */ - public function withPath(string $path); - - /** - * Return an instance with the specified query string. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified query string. - * - * Users can provide both encoded and decoded query characters. - * Implementations ensure the correct encoding as outlined in getQuery(). - * - * An empty query string value is equivalent to removing the query string. - * - * @param string $query The query string to use with the new instance. - * @return static A new instance with the specified query string. - * @throws \InvalidArgumentException for invalid query strings. - */ - public function withQuery(string $query); - - /** - * Return an instance with the specified URI fragment. - * - * This method MUST retain the state of the current instance, and return - * an instance that contains the specified URI fragment. - * - * Users can provide both encoded and decoded fragment characters. - * Implementations ensure the correct encoding as outlined in getFragment(). - * - * An empty fragment value is equivalent to removing the fragment. - * - * @param string $fragment The fragment to use with the new instance. - * @return static A new instance with the specified fragment. - */ - public function withFragment(string $fragment); - - /** - * Return the string representation as a URI reference. - * - * Depending on which components of the URI are present, the resulting - * string is either a full URI or relative reference according to RFC 3986, - * Section 4.1. The method concatenates the various components of the URI, - * using the appropriate delimiters: - * - * - If a scheme is present, it MUST be suffixed by ":". - * - If an authority is present, it MUST be prefixed by "//". - * - The path can be concatenated without delimiters. But there are two - * cases where the path has to be adjusted to make the URI reference - * valid as PHP does not allow to throw an exception in __toString(): - * - If the path is rootless and an authority is present, the path MUST - * be prefixed by "/". - * - If the path is starting with more than one "/" and no authority is - * present, the starting slashes MUST be reduced to one. - * - If a query is present, it MUST be prefixed by "?". - * - If a fragment is present, it MUST be prefixed by "#". - * - * @see http://tools.ietf.org/html/rfc3986#section-4.1 - * @return string - */ - public function __toString(); -} diff --git a/tests/integration/vendor/symfony/config/CHANGELOG.md b/tests/integration/vendor/symfony/config/CHANGELOG.md deleted file mode 100644 index 094d5ab..0000000 --- a/tests/integration/vendor/symfony/config/CHANGELOG.md +++ /dev/null @@ -1,153 +0,0 @@ -CHANGELOG -========= - -6.3 ---- - - * Allow enum values in `EnumNode` - -6.2 ---- - - * Deprecate calling `NodeBuilder::setParent()` without any arguments - * Add a more accurate typehint in generated PHP config - -6.1 ---- - - * Allow using environment variables in `EnumNode` - * Add Node's information in generated Config - * Add `DefinitionFileLoader` class to load a TreeBuilder definition from an external file - * Add `DefinitionConfigurator` helper - -6.0 ---- - - * Remove `BaseNode::getDeprecationMessage()` - -5.3.0 ------ - - * Add support for generating `ConfigBuilder` for extensions - -5.1.0 ------ - - * updated the signature of method `NodeDefinition::setDeprecated()` to `NodeDefinition::setDeprecation(string $package, string $version, string $message)` - * updated the signature of method `BaseNode::setDeprecated()` to `BaseNode::setDeprecation(string $package, string $version, string $message)` - * deprecated passing a null message to `BaseNode::setDeprecated()` to un-deprecate a node - * deprecated `BaseNode::getDeprecationMessage()`, use `BaseNode::getDeprecation()` instead - -5.0.0 ------ - - * Dropped support for constructing a `TreeBuilder` without passing root node information. - * Removed the `root()` method in `TreeBuilder`, pass the root node information to the constructor instead - * Added method `getChildNodeDefinitions()` to ParentNodeDefinitionInterface - * Removed `FileLoaderLoadException`, use `LoaderLoadException` instead - -4.4.0 ------ - - * added a way to exclude patterns of resources from being imported by the `import()` method - -4.3.0 ------ - - * deprecated using environment variables with `cannotBeEmpty()` if the value is validated with `validate()` - * made `Resource\*` classes final and not implement `Serializable` anymore - * deprecated the `root()` method in `TreeBuilder`, pass the root node information to the constructor instead - -4.2.0 ------ - - * deprecated constructing a `TreeBuilder` without passing root node information - * renamed `FileLoaderLoadException` to `LoaderLoadException` - -4.1.0 ------ - - * added `setPathSeparator` method to `NodeBuilder` class - * added third `$pathSeparator` constructor argument to `BaseNode` - * the `Processor` class has been made final - -4.0.0 ------ - - * removed `ConfigCachePass` - -3.4.0 ------ - - * added `setDeprecated()` method to indicate a deprecated node - * added `XmlUtils::parse()` method to parse an XML string - * deprecated `ConfigCachePass` - -3.3.0 ------ - - * added `ReflectionClassResource` class - * added second `$exists` constructor argument to `ClassExistenceResource` - * made `ClassExistenceResource` work with interfaces and traits - * added `ConfigCachePass` (originally in FrameworkBundle) - * added `castToArray()` helper to turn any config value into an array - -3.0.0 ------ - - * removed `ReferenceDumper` class - * removed the `ResourceInterface::isFresh()` method - * removed `BCResourceInterfaceChecker` class - * removed `ResourceInterface::getResource()` method - -2.8.0 ------ - -The edge case of defining just one value for nodes of type Enum is now allowed: - -```php -$rootNode - ->children() - ->enumNode('variable') - ->values(['value']) - ->end() - ->end() -; -``` - -Before: `InvalidArgumentException` (variable must contain at least two -distinct elements). -After: the code will work as expected and it will restrict the values of the -`variable` option to just `value`. - - * deprecated the `ResourceInterface::isFresh()` method. If you implement custom resource types and they - can be validated that way, make them implement the new `SelfCheckingResourceInterface`. - * deprecated the getResource() method in ResourceInterface. You can still call this method - on concrete classes implementing the interface, but it does not make sense at the interface - level as you need to know about the particular type of resource at hand to understand the - semantics of the returned value. - -2.7.0 ------ - - * added `ConfigCacheInterface`, `ConfigCacheFactoryInterface` and a basic `ConfigCacheFactory` - implementation to delegate creation of ConfigCache instances - -2.2.0 ------ - - * added `ArrayNodeDefinition::canBeEnabled()` and `ArrayNodeDefinition::canBeDisabled()` - to ease configuration when some sections are respectively disabled / enabled - by default. - * added a `normalizeKeys()` method for array nodes (to avoid key normalization) - * added numerical type handling for config definitions - * added convenience methods for optional configuration sections to `ArrayNodeDefinition` - * added a utils class for XML manipulations - -2.1.0 ------ - - * added a way to add documentation on configuration - * implemented `Serializable` on resources - * `LoaderResolverInterface` is now used instead of `LoaderResolver` for type - hinting diff --git a/tests/integration/vendor/symfony/config/ConfigCache.php b/tests/integration/vendor/symfony/config/ConfigCache.php deleted file mode 100644 index 8951941..0000000 --- a/tests/integration/vendor/symfony/config/ConfigCache.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -use Symfony\Component\Config\Resource\SelfCheckingResourceChecker; - -/** - * ConfigCache caches arbitrary content in files on disk. - * - * When in debug mode, those metadata resources that implement - * \Symfony\Component\Config\Resource\SelfCheckingResourceInterface will - * be used to check cache freshness. - * - * @author Fabien Potencier - * @author Matthias Pigulla - */ -class ConfigCache extends ResourceCheckerConfigCache -{ - private bool $debug; - - /** - * @param string $file The absolute cache path - * @param bool $debug Whether debugging is enabled or not - */ - public function __construct(string $file, bool $debug) - { - $this->debug = $debug; - - $checkers = []; - if (true === $this->debug) { - $checkers = [new SelfCheckingResourceChecker()]; - } - - parent::__construct($file, $checkers); - } - - /** - * Checks if the cache is still fresh. - * - * This implementation always returns true when debug is off and the - * cache file exists. - */ - public function isFresh(): bool - { - if (!$this->debug && is_file($this->getPath())) { - return true; - } - - return parent::isFresh(); - } -} diff --git a/tests/integration/vendor/symfony/config/ConfigCacheFactory.php b/tests/integration/vendor/symfony/config/ConfigCacheFactory.php deleted file mode 100644 index 39adad1..0000000 --- a/tests/integration/vendor/symfony/config/ConfigCacheFactory.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -/** - * Basic implementation of ConfigCacheFactoryInterface that - * creates an instance of the default ConfigCache. - * - * This factory and/or cache do not support cache validation - * by means of ResourceChecker instances (that is, service-based). - * - * @author Matthias Pigulla - */ -class ConfigCacheFactory implements ConfigCacheFactoryInterface -{ - private bool $debug; - - /** - * @param bool $debug The debug flag to pass to ConfigCache - */ - public function __construct(bool $debug) - { - $this->debug = $debug; - } - - public function cache(string $file, callable $callback): ConfigCacheInterface - { - $cache = new ConfigCache($file, $this->debug); - if (!$cache->isFresh()) { - $callback($cache); - } - - return $cache; - } -} diff --git a/tests/integration/vendor/symfony/config/ConfigCacheFactoryInterface.php b/tests/integration/vendor/symfony/config/ConfigCacheFactoryInterface.php deleted file mode 100644 index 01c90d1..0000000 --- a/tests/integration/vendor/symfony/config/ConfigCacheFactoryInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -/** - * Interface for a ConfigCache factory. This factory creates - * an instance of ConfigCacheInterface and initializes the - * cache if necessary. - * - * @author Matthias Pigulla - */ -interface ConfigCacheFactoryInterface -{ - /** - * Creates a cache instance and (re-)initializes it if necessary. - * - * @param string $file The absolute cache file path - * @param callable $callable The callable to be executed when the cache needs to be filled (i. e. is not fresh). The cache will be passed as the only parameter to this callback - */ - public function cache(string $file, callable $callable): ConfigCacheInterface; -} diff --git a/tests/integration/vendor/symfony/config/ConfigCacheInterface.php b/tests/integration/vendor/symfony/config/ConfigCacheInterface.php deleted file mode 100644 index be7f098..0000000 --- a/tests/integration/vendor/symfony/config/ConfigCacheInterface.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * Interface for ConfigCache. - * - * @author Matthias Pigulla - */ -interface ConfigCacheInterface -{ - /** - * Gets the cache file path. - */ - public function getPath(): string; - - /** - * Checks if the cache is still fresh. - * - * This check should take the metadata passed to the write() method into consideration. - */ - public function isFresh(): bool; - - /** - * Writes the given content into the cache file. Metadata will be stored - * independently and can be used to check cache freshness at a later time. - * - * @param string $content The content to write into the cache - * @param ResourceInterface[]|null $metadata An array of ResourceInterface instances - * - * @return void - * - * @throws \RuntimeException When the cache file cannot be written - */ - public function write(string $content, array $metadata = null); -} diff --git a/tests/integration/vendor/symfony/config/Definition/ArrayNode.php b/tests/integration/vendor/symfony/config/Definition/ArrayNode.php deleted file mode 100644 index 1448220..0000000 --- a/tests/integration/vendor/symfony/config/Definition/ArrayNode.php +++ /dev/null @@ -1,402 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; -use Symfony\Component\Config\Definition\Exception\UnsetKeyException; - -/** - * Represents an Array node in the config tree. - * - * @author Johannes M. Schmitt - */ -class ArrayNode extends BaseNode implements PrototypeNodeInterface -{ - protected $xmlRemappings = []; - protected $children = []; - protected $allowFalse = false; - protected $allowNewKeys = true; - protected $addIfNotSet = false; - protected $performDeepMerging = true; - protected $ignoreExtraKeys = false; - protected $removeExtraKeys = true; - protected $normalizeKeys = true; - - /** - * @return void - */ - public function setNormalizeKeys(bool $normalizeKeys) - { - $this->normalizeKeys = $normalizeKeys; - } - - /** - * Namely, you mostly have foo_bar in YAML while you have foo-bar in XML. - * After running this method, all keys are normalized to foo_bar. - * - * If you have a mixed key like foo-bar_moo, it will not be altered. - * The key will also not be altered if the target key already exists. - */ - protected function preNormalize(mixed $value): mixed - { - if (!$this->normalizeKeys || !\is_array($value)) { - return $value; - } - - $normalized = []; - - foreach ($value as $k => $v) { - if (str_contains($k, '-') && !str_contains($k, '_') && !\array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) { - $normalized[$normalizedKey] = $v; - } else { - $normalized[$k] = $v; - } - } - - return $normalized; - } - - /** - * Retrieves the children of this node. - * - * @return array - */ - public function getChildren(): array - { - return $this->children; - } - - /** - * Sets the xml remappings that should be performed. - * - * @param array $remappings An array of the form [[string, string]] - * - * @return void - */ - public function setXmlRemappings(array $remappings) - { - $this->xmlRemappings = $remappings; - } - - /** - * Gets the xml remappings that should be performed. - * - * @return array an array of the form [[string, string]] - */ - public function getXmlRemappings(): array - { - return $this->xmlRemappings; - } - - /** - * Sets whether to add default values for this array if it has not been - * defined in any of the configuration files. - * - * @return void - */ - public function setAddIfNotSet(bool $boolean) - { - $this->addIfNotSet = $boolean; - } - - /** - * Sets whether false is allowed as value indicating that the array should be unset. - * - * @return void - */ - public function setAllowFalse(bool $allow) - { - $this->allowFalse = $allow; - } - - /** - * Sets whether new keys can be defined in subsequent configurations. - * - * @return void - */ - public function setAllowNewKeys(bool $allow) - { - $this->allowNewKeys = $allow; - } - - /** - * Sets if deep merging should occur. - * - * @return void - */ - public function setPerformDeepMerging(bool $boolean) - { - $this->performDeepMerging = $boolean; - } - - /** - * Whether extra keys should just be ignored without an exception. - * - * @param bool $boolean To allow extra keys - * @param bool $remove To remove extra keys - * - * @return void - */ - public function setIgnoreExtraKeys(bool $boolean, bool $remove = true) - { - $this->ignoreExtraKeys = $boolean; - $this->removeExtraKeys = $this->ignoreExtraKeys && $remove; - } - - /** - * Returns true when extra keys should be ignored without an exception. - */ - public function shouldIgnoreExtraKeys(): bool - { - return $this->ignoreExtraKeys; - } - - /** - * @return void - */ - public function setName(string $name) - { - $this->name = $name; - } - - public function hasDefaultValue(): bool - { - return $this->addIfNotSet; - } - - public function getDefaultValue(): mixed - { - if (!$this->hasDefaultValue()) { - throw new \RuntimeException(sprintf('The node at path "%s" has no default value.', $this->getPath())); - } - - $defaults = []; - foreach ($this->children as $name => $child) { - if ($child->hasDefaultValue()) { - $defaults[$name] = $child->getDefaultValue(); - } - } - - return $defaults; - } - - /** - * Adds a child node. - * - * @return void - * - * @throws \InvalidArgumentException when the child node has no name - * @throws \InvalidArgumentException when the child node's name is not unique - */ - public function addChild(NodeInterface $node) - { - $name = $node->getName(); - if ('' === $name) { - throw new \InvalidArgumentException('Child nodes must be named.'); - } - if (isset($this->children[$name])) { - throw new \InvalidArgumentException(sprintf('A child node named "%s" already exists.', $name)); - } - - $this->children[$name] = $node; - } - - /** - * @throws UnsetKeyException - * @throws InvalidConfigurationException if the node doesn't have enough children - */ - protected function finalizeValue(mixed $value): mixed - { - if (false === $value) { - throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value))); - } - - foreach ($this->children as $name => $child) { - if (!\array_key_exists($name, $value)) { - if ($child->isRequired()) { - $message = sprintf('The child config "%s" under "%s" must be configured', $name, $this->getPath()); - if ($child->getInfo()) { - $message .= sprintf(': %s', $child->getInfo()); - } else { - $message .= '.'; - } - $ex = new InvalidConfigurationException($message); - $ex->setPath($this->getPath()); - - throw $ex; - } - - if ($child->hasDefaultValue()) { - $value[$name] = $child->getDefaultValue(); - } - - continue; - } - - if ($child->isDeprecated()) { - $deprecation = $child->getDeprecation($name, $this->getPath()); - trigger_deprecation($deprecation['package'], $deprecation['version'], $deprecation['message']); - } - - try { - $value[$name] = $child->finalize($value[$name]); - } catch (UnsetKeyException) { - unset($value[$name]); - } - } - - return $value; - } - - /** - * @return void - */ - protected function validateType(mixed $value) - { - if (!\is_array($value) && (!$this->allowFalse || false !== $value)) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected "array", but got "%s"', $this->getPath(), get_debug_type($value))); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } - - /** - * @throws InvalidConfigurationException - */ - protected function normalizeValue(mixed $value): mixed - { - if (false === $value) { - return $value; - } - - $value = $this->remapXml($value); - - $normalized = []; - foreach ($value as $name => $val) { - if (isset($this->children[$name])) { - try { - $normalized[$name] = $this->children[$name]->normalize($val); - } catch (UnsetKeyException) { - } - unset($value[$name]); - } elseif (!$this->removeExtraKeys) { - $normalized[$name] = $val; - } - } - - // if extra fields are present, throw exception - if (\count($value) && !$this->ignoreExtraKeys) { - $proposals = array_keys($this->children); - sort($proposals); - $guesses = []; - - foreach (array_keys($value) as $subject) { - $minScore = \INF; - foreach ($proposals as $proposal) { - $distance = levenshtein($subject, $proposal); - if ($distance <= $minScore && $distance < 3) { - $guesses[$proposal] = $distance; - $minScore = $distance; - } - } - } - - $msg = sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath()); - - if (\count($guesses)) { - asort($guesses); - $msg .= sprintf('. Did you mean "%s"?', implode('", "', array_keys($guesses))); - } else { - $msg .= sprintf('. Available option%s %s "%s".', 1 === \count($proposals) ? '' : 's', 1 === \count($proposals) ? 'is' : 'are', implode('", "', $proposals)); - } - - $ex = new InvalidConfigurationException($msg); - $ex->setPath($this->getPath()); - - throw $ex; - } - - return $normalized; - } - - /** - * Remaps multiple singular values to a single plural value. - */ - protected function remapXml(array $value): array - { - foreach ($this->xmlRemappings as [$singular, $plural]) { - if (!isset($value[$singular])) { - continue; - } - - $value[$plural] = Processor::normalizeConfig($value, $singular, $plural); - unset($value[$singular]); - } - - return $value; - } - - /** - * @throws InvalidConfigurationException - * @throws \RuntimeException - */ - protected function mergeValues(mixed $leftSide, mixed $rightSide): mixed - { - if (false === $rightSide) { - // if this is still false after the last config has been merged the - // finalization pass will take care of removing this key entirely - return false; - } - - if (false === $leftSide || !$this->performDeepMerging) { - return $rightSide; - } - - foreach ($rightSide as $k => $v) { - // no conflict - if (!\array_key_exists($k, $leftSide)) { - if (!$this->allowNewKeys) { - $ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath())); - $ex->setPath($this->getPath()); - - throw $ex; - } - - $leftSide[$k] = $v; - continue; - } - - if (!isset($this->children[$k])) { - if (!$this->ignoreExtraKeys || $this->removeExtraKeys) { - throw new \RuntimeException('merge() expects a normalized config array.'); - } - - $leftSide[$k] = $v; - continue; - } - - $leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v); - } - - return $leftSide; - } - - protected function allowPlaceholders(): bool - { - return false; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/BaseNode.php b/tests/integration/vendor/symfony/config/Definition/BaseNode.php deleted file mode 100644 index 85f0f7e..0000000 --- a/tests/integration/vendor/symfony/config/Definition/BaseNode.php +++ /dev/null @@ -1,542 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\Exception; -use Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException; -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; -use Symfony\Component\Config\Definition\Exception\UnsetKeyException; - -/** - * The base node class. - * - * @author Johannes M. Schmitt - */ -abstract class BaseNode implements NodeInterface -{ - public const DEFAULT_PATH_SEPARATOR = '.'; - - private static array $placeholderUniquePrefixes = []; - private static array $placeholders = []; - - protected $name; - protected $parent; - protected $normalizationClosures = []; - protected $normalizedTypes = []; - protected $finalValidationClosures = []; - protected $allowOverwrite = true; - protected $required = false; - protected $deprecation = []; - protected $equivalentValues = []; - protected $attributes = []; - protected $pathSeparator; - - private mixed $handlingPlaceholder = null; - - /** - * @throws \InvalidArgumentException if the name contains a period - */ - public function __construct(?string $name, NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR) - { - if (str_contains($name = (string) $name, $pathSeparator)) { - throw new \InvalidArgumentException('The name must not contain ".'.$pathSeparator.'".'); - } - - $this->name = $name; - $this->parent = $parent; - $this->pathSeparator = $pathSeparator; - } - - /** - * Register possible (dummy) values for a dynamic placeholder value. - * - * Matching configuration values will be processed with a provided value, one by one. After a provided value is - * successfully processed the configuration value is returned as is, thus preserving the placeholder. - * - * @internal - */ - public static function setPlaceholder(string $placeholder, array $values): void - { - if (!$values) { - throw new \InvalidArgumentException('At least one value must be provided.'); - } - - self::$placeholders[$placeholder] = $values; - } - - /** - * Adds a common prefix for dynamic placeholder values. - * - * Matching configuration values will be skipped from being processed and are returned as is, thus preserving the - * placeholder. An exact match provided by {@see setPlaceholder()} might take precedence. - * - * @internal - */ - public static function setPlaceholderUniquePrefix(string $prefix): void - { - self::$placeholderUniquePrefixes[] = $prefix; - } - - /** - * Resets all current placeholders available. - * - * @internal - */ - public static function resetPlaceholders(): void - { - self::$placeholderUniquePrefixes = []; - self::$placeholders = []; - } - - /** - * @return void - */ - public function setAttribute(string $key, mixed $value) - { - $this->attributes[$key] = $value; - } - - public function getAttribute(string $key, mixed $default = null): mixed - { - return $this->attributes[$key] ?? $default; - } - - public function hasAttribute(string $key): bool - { - return isset($this->attributes[$key]); - } - - public function getAttributes(): array - { - return $this->attributes; - } - - /** - * @return void - */ - public function setAttributes(array $attributes) - { - $this->attributes = $attributes; - } - - /** - * @return void - */ - public function removeAttribute(string $key) - { - unset($this->attributes[$key]); - } - - /** - * Sets an info message. - * - * @return void - */ - public function setInfo(string $info) - { - $this->setAttribute('info', $info); - } - - /** - * Returns info message. - */ - public function getInfo(): ?string - { - return $this->getAttribute('info'); - } - - /** - * Sets the example configuration for this node. - * - * @return void - */ - public function setExample(string|array $example) - { - $this->setAttribute('example', $example); - } - - /** - * Retrieves the example configuration for this node. - */ - public function getExample(): string|array|null - { - return $this->getAttribute('example'); - } - - /** - * Adds an equivalent value. - * - * @return void - */ - public function addEquivalentValue(mixed $originalValue, mixed $equivalentValue) - { - $this->equivalentValues[] = [$originalValue, $equivalentValue]; - } - - /** - * Set this node as required. - * - * @return void - */ - public function setRequired(bool $boolean) - { - $this->required = $boolean; - } - - /** - * Sets this node as deprecated. - * - * You can use %node% and %path% placeholders in your message to display, - * respectively, the node name and its complete path. - * - * @param string $package The name of the composer package that is triggering the deprecation - * @param string $version The version of the package that introduced the deprecation - * @param string $message the deprecation message to use - * - * @return void - */ - public function setDeprecated(string $package, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.') - { - $this->deprecation = [ - 'package' => $package, - 'version' => $version, - 'message' => $message, - ]; - } - - /** - * Sets if this node can be overridden. - * - * @return void - */ - public function setAllowOverwrite(bool $allow) - { - $this->allowOverwrite = $allow; - } - - /** - * Sets the closures used for normalization. - * - * @param \Closure[] $closures An array of Closures used for normalization - * - * @return void - */ - public function setNormalizationClosures(array $closures) - { - $this->normalizationClosures = $closures; - } - - /** - * Sets the list of types supported by normalization. - * - * see ExprBuilder::TYPE_* constants. - * - * @return void - */ - public function setNormalizedTypes(array $types) - { - $this->normalizedTypes = $types; - } - - /** - * Gets the list of types supported by normalization. - * - * see ExprBuilder::TYPE_* constants. - */ - public function getNormalizedTypes(): array - { - return $this->normalizedTypes; - } - - /** - * Sets the closures used for final validation. - * - * @param \Closure[] $closures An array of Closures used for final validation - * - * @return void - */ - public function setFinalValidationClosures(array $closures) - { - $this->finalValidationClosures = $closures; - } - - public function isRequired(): bool - { - return $this->required; - } - - /** - * Checks if this node is deprecated. - */ - public function isDeprecated(): bool - { - return (bool) $this->deprecation; - } - - /** - * @param string $node The configuration node name - * @param string $path The path of the node - */ - public function getDeprecation(string $node, string $path): array - { - return [ - 'package' => $this->deprecation['package'], - 'version' => $this->deprecation['version'], - 'message' => strtr($this->deprecation['message'], ['%node%' => $node, '%path%' => $path]), - ]; - } - - public function getName(): string - { - return $this->name; - } - - public function getPath(): string - { - if (null !== $this->parent) { - return $this->parent->getPath().$this->pathSeparator.$this->name; - } - - return $this->name; - } - - final public function merge(mixed $leftSide, mixed $rightSide): mixed - { - if (!$this->allowOverwrite) { - throw new ForbiddenOverwriteException(sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); - } - - if ($leftSide !== $leftPlaceholders = self::resolvePlaceholderValue($leftSide)) { - foreach ($leftPlaceholders as $leftPlaceholder) { - $this->handlingPlaceholder = $leftSide; - try { - $this->merge($leftPlaceholder, $rightSide); - } finally { - $this->handlingPlaceholder = null; - } - } - - return $rightSide; - } - - if ($rightSide !== $rightPlaceholders = self::resolvePlaceholderValue($rightSide)) { - foreach ($rightPlaceholders as $rightPlaceholder) { - $this->handlingPlaceholder = $rightSide; - try { - $this->merge($leftSide, $rightPlaceholder); - } finally { - $this->handlingPlaceholder = null; - } - } - - return $rightSide; - } - - $this->doValidateType($leftSide); - $this->doValidateType($rightSide); - - return $this->mergeValues($leftSide, $rightSide); - } - - final public function normalize(mixed $value): mixed - { - $value = $this->preNormalize($value); - - // run custom normalization closures - foreach ($this->normalizationClosures as $closure) { - $value = $closure($value); - } - - // resolve placeholder value - if ($value !== $placeholders = self::resolvePlaceholderValue($value)) { - foreach ($placeholders as $placeholder) { - $this->handlingPlaceholder = $value; - try { - $this->normalize($placeholder); - } finally { - $this->handlingPlaceholder = null; - } - } - - return $value; - } - - // replace value with their equivalent - foreach ($this->equivalentValues as $data) { - if ($data[0] === $value) { - $value = $data[1]; - } - } - - // validate type - $this->doValidateType($value); - - // normalize value - return $this->normalizeValue($value); - } - - /** - * Normalizes the value before any other normalization is applied. - */ - protected function preNormalize(mixed $value): mixed - { - return $value; - } - - /** - * Returns parent node for this node. - */ - public function getParent(): ?NodeInterface - { - return $this->parent; - } - - final public function finalize(mixed $value): mixed - { - if ($value !== $placeholders = self::resolvePlaceholderValue($value)) { - foreach ($placeholders as $placeholder) { - $this->handlingPlaceholder = $value; - try { - $this->finalize($placeholder); - } finally { - $this->handlingPlaceholder = null; - } - } - - return $value; - } - - $this->doValidateType($value); - - $value = $this->finalizeValue($value); - - // Perform validation on the final value if a closure has been set. - // The closure is also allowed to return another value. - foreach ($this->finalValidationClosures as $closure) { - try { - $value = $closure($value); - } catch (Exception $e) { - if ($e instanceof UnsetKeyException && null !== $this->handlingPlaceholder) { - continue; - } - - throw $e; - } catch (\Exception $e) { - throw new InvalidConfigurationException(sprintf('Invalid configuration for path "%s": ', $this->getPath()).$e->getMessage(), $e->getCode(), $e); - } - } - - return $value; - } - - /** - * Validates the type of a Node. - * - * @return void - * - * @throws InvalidTypeException when the value is invalid - */ - abstract protected function validateType(mixed $value); - - /** - * Normalizes the value. - */ - abstract protected function normalizeValue(mixed $value): mixed; - - /** - * Merges two values together. - */ - abstract protected function mergeValues(mixed $leftSide, mixed $rightSide): mixed; - - /** - * Finalizes a value. - */ - abstract protected function finalizeValue(mixed $value): mixed; - - /** - * Tests if placeholder values are allowed for this node. - */ - protected function allowPlaceholders(): bool - { - return true; - } - - /** - * Tests if a placeholder is being handled currently. - */ - protected function isHandlingPlaceholder(): bool - { - return null !== $this->handlingPlaceholder; - } - - /** - * Gets allowed dynamic types for this node. - */ - protected function getValidPlaceholderTypes(): array - { - return []; - } - - private static function resolvePlaceholderValue(mixed $value): mixed - { - if (\is_string($value)) { - if (isset(self::$placeholders[$value])) { - return self::$placeholders[$value]; - } - - foreach (self::$placeholderUniquePrefixes as $placeholderUniquePrefix) { - if (str_starts_with($value, $placeholderUniquePrefix)) { - return []; - } - } - } - - return $value; - } - - private function doValidateType(mixed $value): void - { - if (null !== $this->handlingPlaceholder && !$this->allowPlaceholders()) { - $e = new InvalidTypeException(sprintf('A dynamic value is not compatible with a "%s" node type at path "%s".', static::class, $this->getPath())); - $e->setPath($this->getPath()); - - throw $e; - } - - if (null === $this->handlingPlaceholder || null === $value) { - $this->validateType($value); - - return; - } - - $knownTypes = array_keys(self::$placeholders[$this->handlingPlaceholder]); - $validTypes = $this->getValidPlaceholderTypes(); - - if ($validTypes && array_diff($knownTypes, $validTypes)) { - $e = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected %s, but got %s.', - $this->getPath(), - 1 === \count($validTypes) ? '"'.reset($validTypes).'"' : 'one of "'.implode('", "', $validTypes).'"', - 1 === \count($knownTypes) ? '"'.reset($knownTypes).'"' : 'one of "'.implode('", "', $knownTypes).'"' - )); - if ($hint = $this->getInfo()) { - $e->addHint($hint); - } - $e->setPath($this->getPath()); - - throw $e; - } - - $this->validateType($value); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/BooleanNode.php b/tests/integration/vendor/symfony/config/Definition/BooleanNode.php deleted file mode 100644 index 7ec903c..0000000 --- a/tests/integration/vendor/symfony/config/Definition/BooleanNode.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * This node represents a Boolean value in the config tree. - * - * @author Johannes M. Schmitt - */ -class BooleanNode extends ScalarNode -{ - /** - * @return void - */ - protected function validateType(mixed $value) - { - if (!\is_bool($value)) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected "bool", but got "%s".', $this->getPath(), get_debug_type($value))); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } - - protected function isValueEmpty(mixed $value): bool - { - // a boolean value cannot be empty - return false; - } - - protected function getValidPlaceholderTypes(): array - { - return ['bool']; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php deleted file mode 100644 index 0110f05..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php +++ /dev/null @@ -1,516 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; -use Symfony\Component\Config\Definition\NodeInterface; -use Symfony\Component\Config\Definition\PrototypedArrayNode; - -/** - * This class provides a fluent interface for defining an array node. - * - * @author Johannes M. Schmitt - */ -class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinitionInterface -{ - protected $performDeepMerging = true; - protected $ignoreExtraKeys = false; - protected $removeExtraKeys = true; - protected $children = []; - protected $prototype; - protected $atLeastOne = false; - protected $allowNewKeys = true; - protected $key; - protected $removeKeyItem; - protected $addDefaults = false; - protected $addDefaultChildren = false; - protected $nodeBuilder; - protected $normalizeKeys = true; - - public function __construct(?string $name, NodeParentInterface $parent = null) - { - parent::__construct($name, $parent); - - $this->nullEquivalent = []; - $this->trueEquivalent = []; - } - - /** - * @return void - */ - public function setBuilder(NodeBuilder $builder) - { - $this->nodeBuilder = $builder; - } - - public function children(): NodeBuilder - { - return $this->getNodeBuilder(); - } - - /** - * Sets a prototype for child nodes. - */ - public function prototype(string $type): NodeDefinition - { - return $this->prototype = $this->getNodeBuilder()->node(null, $type)->setParent($this); - } - - public function variablePrototype(): VariableNodeDefinition - { - return $this->prototype('variable'); - } - - public function scalarPrototype(): ScalarNodeDefinition - { - return $this->prototype('scalar'); - } - - public function booleanPrototype(): BooleanNodeDefinition - { - return $this->prototype('boolean'); - } - - public function integerPrototype(): IntegerNodeDefinition - { - return $this->prototype('integer'); - } - - public function floatPrototype(): FloatNodeDefinition - { - return $this->prototype('float'); - } - - public function arrayPrototype(): self - { - return $this->prototype('array'); - } - - public function enumPrototype(): EnumNodeDefinition - { - return $this->prototype('enum'); - } - - /** - * Adds the default value if the node is not set in the configuration. - * - * This method is applicable to concrete nodes only (not to prototype nodes). - * If this function has been called and the node is not set during the finalization - * phase, it's default value will be derived from its children default values. - * - * @return $this - */ - public function addDefaultsIfNotSet(): static - { - $this->addDefaults = true; - - return $this; - } - - /** - * Adds children with a default value when none are defined. - * - * This method is applicable to prototype nodes only. - * - * @param int|string|array|null $children The number of children|The child name|The children names to be added - * - * @return $this - */ - public function addDefaultChildrenIfNoneSet(int|string|array $children = null): static - { - $this->addDefaultChildren = $children; - - return $this; - } - - /** - * Requires the node to have at least one element. - * - * This method is applicable to prototype nodes only. - * - * @return $this - */ - public function requiresAtLeastOneElement(): static - { - $this->atLeastOne = true; - - return $this; - } - - /** - * Disallows adding news keys in a subsequent configuration. - * - * If used all keys have to be defined in the same configuration file. - * - * @return $this - */ - public function disallowNewKeysInSubsequentConfigs(): static - { - $this->allowNewKeys = false; - - return $this; - } - - /** - * Sets a normalization rule for XML configurations. - * - * @param string $singular The key to remap - * @param string|null $plural The plural of the key for irregular plurals - * - * @return $this - */ - public function fixXmlConfig(string $singular, string $plural = null): static - { - $this->normalization()->remap($singular, $plural); - - return $this; - } - - /** - * Sets the attribute which value is to be used as key. - * - * This is useful when you have an indexed array that should be an - * associative array. You can select an item from within the array - * to be the key of the particular item. For example, if "id" is the - * "key", then: - * - * [ - * ['id' => 'my_name', 'foo' => 'bar'], - * ]; - * - * becomes - * - * [ - * 'my_name' => ['foo' => 'bar'], - * ]; - * - * If you'd like "'id' => 'my_name'" to still be present in the resulting - * array, then you can set the second argument of this method to false. - * - * This method is applicable to prototype nodes only. - * - * @param string $name The name of the key - * @param bool $removeKeyItem Whether or not the key item should be removed - * - * @return $this - */ - public function useAttributeAsKey(string $name, bool $removeKeyItem = true): static - { - $this->key = $name; - $this->removeKeyItem = $removeKeyItem; - - return $this; - } - - /** - * Sets whether the node can be unset. - * - * @return $this - */ - public function canBeUnset(bool $allow = true): static - { - $this->merge()->allowUnset($allow); - - return $this; - } - - /** - * Adds an "enabled" boolean to enable the current section. - * - * By default, the section is disabled. If any configuration is specified then - * the node will be automatically enabled: - * - * enableableArrayNode: {enabled: true, ...} # The config is enabled & default values get overridden - * enableableArrayNode: ~ # The config is enabled & use the default values - * enableableArrayNode: true # The config is enabled & use the default values - * enableableArrayNode: {other: value, ...} # The config is enabled & default values get overridden - * enableableArrayNode: {enabled: false, ...} # The config is disabled - * enableableArrayNode: false # The config is disabled - * - * @return $this - */ - public function canBeEnabled(): static - { - $this - ->addDefaultsIfNotSet() - ->treatFalseLike(['enabled' => false]) - ->treatTrueLike(['enabled' => true]) - ->treatNullLike(['enabled' => true]) - ->beforeNormalization() - ->ifArray() - ->then(function (array $v) { - $v['enabled'] ??= true; - - return $v; - }) - ->end() - ->children() - ->booleanNode('enabled') - ->defaultFalse() - ; - - return $this; - } - - /** - * Adds an "enabled" boolean to enable the current section. - * - * By default, the section is enabled. - * - * @return $this - */ - public function canBeDisabled(): static - { - $this - ->addDefaultsIfNotSet() - ->treatFalseLike(['enabled' => false]) - ->treatTrueLike(['enabled' => true]) - ->treatNullLike(['enabled' => true]) - ->children() - ->booleanNode('enabled') - ->defaultTrue() - ; - - return $this; - } - - /** - * Disables the deep merging of the node. - * - * @return $this - */ - public function performNoDeepMerging(): static - { - $this->performDeepMerging = false; - - return $this; - } - - /** - * Allows extra config keys to be specified under an array without - * throwing an exception. - * - * Those config values are ignored and removed from the resulting - * array. This should be used only in special cases where you want - * to send an entire configuration array through a special tree that - * processes only part of the array. - * - * @param bool $remove Whether to remove the extra keys - * - * @return $this - */ - public function ignoreExtraKeys(bool $remove = true): static - { - $this->ignoreExtraKeys = true; - $this->removeExtraKeys = $remove; - - return $this; - } - - /** - * Sets whether to enable key normalization. - * - * @return $this - */ - public function normalizeKeys(bool $bool): static - { - $this->normalizeKeys = $bool; - - return $this; - } - - public function append(NodeDefinition $node): static - { - $this->children[$node->name] = $node->setParent($this); - - return $this; - } - - /** - * Returns a node builder to be used to add children and prototype. - */ - protected function getNodeBuilder(): NodeBuilder - { - $this->nodeBuilder ??= new NodeBuilder(); - - return $this->nodeBuilder->setParent($this); - } - - protected function createNode(): NodeInterface - { - if (null === $this->prototype) { - $node = new ArrayNode($this->name, $this->parent, $this->pathSeparator); - - $this->validateConcreteNode($node); - - $node->setAddIfNotSet($this->addDefaults); - - foreach ($this->children as $child) { - $child->parent = $node; - $node->addChild($child->getNode()); - } - } else { - $node = new PrototypedArrayNode($this->name, $this->parent, $this->pathSeparator); - - $this->validatePrototypeNode($node); - - if (null !== $this->key) { - $node->setKeyAttribute($this->key, $this->removeKeyItem); - } - - if (true === $this->atLeastOne || false === $this->allowEmptyValue) { - $node->setMinNumberOfElements(1); - } - - if ($this->default) { - if (!\is_array($this->defaultValue)) { - throw new \InvalidArgumentException(sprintf('%s: the default value of an array node has to be an array.', $node->getPath())); - } - - $node->setDefaultValue($this->defaultValue); - } - - if (false !== $this->addDefaultChildren) { - $node->setAddChildrenIfNoneSet($this->addDefaultChildren); - if ($this->prototype instanceof static && null === $this->prototype->prototype) { - $this->prototype->addDefaultsIfNotSet(); - } - } - - $this->prototype->parent = $node; - $node->setPrototype($this->prototype->getNode()); - } - - $node->setAllowNewKeys($this->allowNewKeys); - $node->addEquivalentValue(null, $this->nullEquivalent); - $node->addEquivalentValue(true, $this->trueEquivalent); - $node->addEquivalentValue(false, $this->falseEquivalent); - $node->setPerformDeepMerging($this->performDeepMerging); - $node->setRequired($this->required); - $node->setIgnoreExtraKeys($this->ignoreExtraKeys, $this->removeExtraKeys); - $node->setNormalizeKeys($this->normalizeKeys); - - if ($this->deprecation) { - $node->setDeprecated($this->deprecation['package'], $this->deprecation['version'], $this->deprecation['message']); - } - - if (null !== $this->normalization) { - $node->setNormalizationClosures($this->normalization->before); - $node->setNormalizedTypes($this->normalization->declaredTypes); - $node->setXmlRemappings($this->normalization->remappings); - } - - if (null !== $this->merge) { - $node->setAllowOverwrite($this->merge->allowOverwrite); - $node->setAllowFalse($this->merge->allowFalse); - } - - if (null !== $this->validation) { - $node->setFinalValidationClosures($this->validation->rules); - } - - return $node; - } - - /** - * Validate the configuration of a concrete node. - * - * @return void - * - * @throws InvalidDefinitionException - */ - protected function validateConcreteNode(ArrayNode $node) - { - $path = $node->getPath(); - - if (null !== $this->key) { - throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s".', $path)); - } - - if (false === $this->allowEmptyValue) { - throw new InvalidDefinitionException(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s".', $path)); - } - - if (true === $this->atLeastOne) { - throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s".', $path)); - } - - if ($this->default) { - throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s".', $path)); - } - - if (false !== $this->addDefaultChildren) { - throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s".', $path)); - } - } - - /** - * Validate the configuration of a prototype node. - * - * @return void - * - * @throws InvalidDefinitionException - */ - protected function validatePrototypeNode(PrototypedArrayNode $node) - { - $path = $node->getPath(); - - if ($this->addDefaults) { - throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s".', $path)); - } - - if (false !== $this->addDefaultChildren) { - if ($this->default) { - throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s".', $path)); - } - - if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { - throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s".', $path)); - } - - if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) { - throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s".', $path)); - } - } - } - - /** - * @return NodeDefinition[] - */ - public function getChildNodeDefinitions(): array - { - return $this->children; - } - - /** - * Finds a node defined by the given $nodePath. - * - * @param string $nodePath The path of the node to find. e.g "doctrine.orm.mappings" - */ - public function find(string $nodePath): NodeDefinition - { - $firstPathSegment = (false === $pathSeparatorPos = strpos($nodePath, $this->pathSeparator)) - ? $nodePath - : substr($nodePath, 0, $pathSeparatorPos); - - if (null === $node = ($this->children[$firstPathSegment] ?? null)) { - throw new \RuntimeException(sprintf('Node with name "%s" does not exist in the current node "%s".', $firstPathSegment, $this->name)); - } - - if (false === $pathSeparatorPos) { - return $node; - } - - return $node->find(substr($nodePath, $pathSeparatorPos + \strlen($this->pathSeparator))); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php deleted file mode 100644 index 3d8fad4..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/BooleanNodeDefinition.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\BooleanNode; -use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; - -/** - * This class provides a fluent interface for defining a node. - * - * @author Johannes M. Schmitt - */ -class BooleanNodeDefinition extends ScalarNodeDefinition -{ - public function __construct(?string $name, NodeParentInterface $parent = null) - { - parent::__construct($name, $parent); - - $this->nullEquivalent = true; - } - - /** - * Instantiate a Node. - */ - protected function instantiateNode(): BooleanNode - { - return new BooleanNode($this->name, $this->parent, $this->pathSeparator); - } - - /** - * @throws InvalidDefinitionException - */ - public function cannotBeEmpty(): static - { - throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to BooleanNodeDefinition.'); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php deleted file mode 100644 index 99f3181..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/EnumNodeDefinition.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\EnumNode; - -/** - * Enum Node Definition. - * - * @author Johannes M. Schmitt - */ -class EnumNodeDefinition extends ScalarNodeDefinition -{ - private array $values; - - /** - * @return $this - */ - public function values(array $values): static - { - if (!$values) { - throw new \InvalidArgumentException('->values() must be called with at least one value.'); - } - - $this->values = $values; - - return $this; - } - - /** - * Instantiate a Node. - * - * @throws \RuntimeException - */ - protected function instantiateNode(): EnumNode - { - if (!isset($this->values)) { - throw new \RuntimeException('You must call ->values() on enum nodes.'); - } - - return new EnumNode($this->name, $this->parent, $this->values, $this->pathSeparator); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/ExprBuilder.php b/tests/integration/vendor/symfony/config/Definition/Builder/ExprBuilder.php deleted file mode 100644 index 9cb4414..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/ExprBuilder.php +++ /dev/null @@ -1,252 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\Exception\UnsetKeyException; - -/** - * This class builds an if expression. - * - * @author Johannes M. Schmitt - * @author Christophe Coevoet - */ -class ExprBuilder -{ - public const TYPE_ANY = 'any'; - public const TYPE_STRING = 'string'; - public const TYPE_NULL = 'null'; - public const TYPE_ARRAY = 'array'; - - protected $node; - - public $allowedTypes; - public $ifPart; - public $thenPart; - - public function __construct(NodeDefinition $node) - { - $this->node = $node; - } - - /** - * Marks the expression as being always used. - * - * @return $this - */ - public function always(\Closure $then = null): static - { - $this->ifPart = static fn () => true; - $this->allowedTypes = self::TYPE_ANY; - - if (null !== $then) { - $this->thenPart = $then; - } - - return $this; - } - - /** - * Sets a closure to use as tests. - * - * The default one tests if the value is true. - * - * @return $this - */ - public function ifTrue(\Closure $closure = null): static - { - $this->ifPart = $closure ?? static fn ($v) => true === $v; - $this->allowedTypes = self::TYPE_ANY; - - return $this; - } - - /** - * Tests if the value is a string. - * - * @return $this - */ - public function ifString(): static - { - $this->ifPart = \is_string(...); - $this->allowedTypes = self::TYPE_STRING; - - return $this; - } - - /** - * Tests if the value is null. - * - * @return $this - */ - public function ifNull(): static - { - $this->ifPart = \is_null(...); - $this->allowedTypes = self::TYPE_NULL; - - return $this; - } - - /** - * Tests if the value is empty. - * - * @return $this - */ - public function ifEmpty(): static - { - $this->ifPart = static fn ($v) => empty($v); - $this->allowedTypes = self::TYPE_ANY; - - return $this; - } - - /** - * Tests if the value is an array. - * - * @return $this - */ - public function ifArray(): static - { - $this->ifPart = \is_array(...); - $this->allowedTypes = self::TYPE_ARRAY; - - return $this; - } - - /** - * Tests if the value is in an array. - * - * @return $this - */ - public function ifInArray(array $array): static - { - $this->ifPart = static fn ($v) => \in_array($v, $array, true); - $this->allowedTypes = self::TYPE_ANY; - - return $this; - } - - /** - * Tests if the value is not in an array. - * - * @return $this - */ - public function ifNotInArray(array $array): static - { - $this->ifPart = static fn ($v) => !\in_array($v, $array, true); - $this->allowedTypes = self::TYPE_ANY; - - return $this; - } - - /** - * Transforms variables of any type into an array. - * - * @return $this - */ - public function castToArray(): static - { - $this->ifPart = static fn ($v) => !\is_array($v); - $this->allowedTypes = self::TYPE_ANY; - $this->thenPart = static fn ($v) => [$v]; - - return $this; - } - - /** - * Sets the closure to run if the test pass. - * - * @return $this - */ - public function then(\Closure $closure): static - { - $this->thenPart = $closure; - - return $this; - } - - /** - * Sets a closure returning an empty array. - * - * @return $this - */ - public function thenEmptyArray(): static - { - $this->thenPart = static fn () => []; - - return $this; - } - - /** - * Sets a closure marking the value as invalid at processing time. - * - * if you want to add the value of the node in your message just use a %s placeholder. - * - * @return $this - * - * @throws \InvalidArgumentException - */ - public function thenInvalid(string $message): static - { - $this->thenPart = static fn ($v) => throw new \InvalidArgumentException(sprintf($message, json_encode($v))); - - return $this; - } - - /** - * Sets a closure unsetting this key of the array at processing time. - * - * @return $this - * - * @throws UnsetKeyException - */ - public function thenUnset(): static - { - $this->thenPart = static fn () => throw new UnsetKeyException('Unsetting key.'); - - return $this; - } - - /** - * Returns the related node. - * - * @throws \RuntimeException - */ - public function end(): NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition - { - if (null === $this->ifPart) { - throw new \RuntimeException('You must specify an if part.'); - } - if (null === $this->thenPart) { - throw new \RuntimeException('You must specify a then part.'); - } - - return $this->node; - } - - /** - * Builds the expressions. - * - * @param ExprBuilder[] $expressions An array of ExprBuilder instances to build - */ - public static function buildExpressions(array $expressions): array - { - foreach ($expressions as $k => $expr) { - if ($expr instanceof self) { - $if = $expr->ifPart; - $then = $expr->thenPart; - $expressions[$k] = static fn ($v) => $if($v) ? $then($v) : $v; - } - } - - return $expressions; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php deleted file mode 100644 index 337e971..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/FloatNodeDefinition.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\FloatNode; - -/** - * This class provides a fluent interface for defining a float node. - * - * @author Jeanmonod David - */ -class FloatNodeDefinition extends NumericNodeDefinition -{ - /** - * Instantiates a Node. - */ - protected function instantiateNode(): FloatNode - { - return new FloatNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php deleted file mode 100644 index 2af81df..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/IntegerNodeDefinition.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\IntegerNode; - -/** - * This class provides a fluent interface for defining an integer node. - * - * @author Jeanmonod David - */ -class IntegerNodeDefinition extends NumericNodeDefinition -{ - /** - * Instantiates a Node. - */ - protected function instantiateNode(): IntegerNode - { - return new IntegerNode($this->name, $this->parent, $this->min, $this->max, $this->pathSeparator); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/MergeBuilder.php b/tests/integration/vendor/symfony/config/Definition/Builder/MergeBuilder.php deleted file mode 100644 index f8980a6..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/MergeBuilder.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * This class builds merge conditions. - * - * @author Johannes M. Schmitt - */ -class MergeBuilder -{ - protected $node; - public $allowFalse = false; - public $allowOverwrite = true; - - public function __construct(NodeDefinition $node) - { - $this->node = $node; - } - - /** - * Sets whether the node can be unset. - * - * @return $this - */ - public function allowUnset(bool $allow = true): static - { - $this->allowFalse = $allow; - - return $this; - } - - /** - * Sets whether the node can be overwritten. - * - * @return $this - */ - public function denyOverwrite(bool $deny = true): static - { - $this->allowOverwrite = !$deny; - - return $this; - } - - /** - * Returns the related node. - */ - public function end(): NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition - { - return $this->node; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/NodeBuilder.php b/tests/integration/vendor/symfony/config/Definition/Builder/NodeBuilder.php deleted file mode 100644 index 7cda0bc..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/NodeBuilder.php +++ /dev/null @@ -1,204 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * This class provides a fluent interface for building a node. - * - * @author Johannes M. Schmitt - */ -class NodeBuilder implements NodeParentInterface -{ - protected $parent; - protected $nodeMapping; - - public function __construct() - { - $this->nodeMapping = [ - 'variable' => VariableNodeDefinition::class, - 'scalar' => ScalarNodeDefinition::class, - 'boolean' => BooleanNodeDefinition::class, - 'integer' => IntegerNodeDefinition::class, - 'float' => FloatNodeDefinition::class, - 'array' => ArrayNodeDefinition::class, - 'enum' => EnumNodeDefinition::class, - ]; - } - - /** - * Set the parent node. - * - * @return $this - */ - public function setParent(ParentNodeDefinitionInterface $parent = null): static - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/form', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - $this->parent = $parent; - - return $this; - } - - /** - * Creates a child array node. - */ - public function arrayNode(string $name): ArrayNodeDefinition - { - return $this->node($name, 'array'); - } - - /** - * Creates a child scalar node. - */ - public function scalarNode(string $name): ScalarNodeDefinition - { - return $this->node($name, 'scalar'); - } - - /** - * Creates a child Boolean node. - */ - public function booleanNode(string $name): BooleanNodeDefinition - { - return $this->node($name, 'boolean'); - } - - /** - * Creates a child integer node. - */ - public function integerNode(string $name): IntegerNodeDefinition - { - return $this->node($name, 'integer'); - } - - /** - * Creates a child float node. - */ - public function floatNode(string $name): FloatNodeDefinition - { - return $this->node($name, 'float'); - } - - /** - * Creates a child EnumNode. - */ - public function enumNode(string $name): EnumNodeDefinition - { - return $this->node($name, 'enum'); - } - - /** - * Creates a child variable node. - */ - public function variableNode(string $name): VariableNodeDefinition - { - return $this->node($name, 'variable'); - } - - /** - * Returns the parent node. - * - * @return NodeDefinition&ParentNodeDefinitionInterface - */ - public function end() - { - return $this->parent; - } - - /** - * Creates a child node. - * - * @throws \RuntimeException When the node type is not registered - * @throws \RuntimeException When the node class is not found - */ - public function node(?string $name, string $type): NodeDefinition - { - $class = $this->getNodeClass($type); - - $node = new $class($name); - - $this->append($node); - - return $node; - } - - /** - * Appends a node definition. - * - * Usage: - * - * $node = new ArrayNodeDefinition('name') - * ->children() - * ->scalarNode('foo')->end() - * ->scalarNode('baz')->end() - * ->append($this->getBarNodeDefinition()) - * ->end() - * ; - * - * @return $this - */ - public function append(NodeDefinition $node): static - { - if ($node instanceof BuilderAwareInterface) { - $builder = clone $this; - $builder->setParent(null); - $node->setBuilder($builder); - } - - if (null !== $this->parent) { - $this->parent->append($node); - // Make this builder the node parent to allow for a fluid interface - $node->setParent($this); - } - - return $this; - } - - /** - * Adds or overrides a node Type. - * - * @param string $type The name of the type - * @param string $class The fully qualified name the node definition class - * - * @return $this - */ - public function setNodeClass(string $type, string $class): static - { - $this->nodeMapping[strtolower($type)] = $class; - - return $this; - } - - /** - * Returns the class name of the node definition. - * - * @throws \RuntimeException When the node type is not registered - * @throws \RuntimeException When the node class is not found - */ - protected function getNodeClass(string $type): string - { - $type = strtolower($type); - - if (!isset($this->nodeMapping[$type])) { - throw new \RuntimeException(sprintf('The node type "%s" is not registered.', $type)); - } - - $class = $this->nodeMapping[$type]; - - if (!class_exists($class)) { - throw new \RuntimeException(sprintf('The node class "%s" does not exist.', $class)); - } - - return $class; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/NodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/NodeDefinition.php deleted file mode 100644 index 1cd32ca..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/NodeDefinition.php +++ /dev/null @@ -1,336 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\BaseNode; -use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; -use Symfony\Component\Config\Definition\NodeInterface; - -/** - * This class provides a fluent interface for defining a node. - * - * @author Johannes M. Schmitt - */ -abstract class NodeDefinition implements NodeParentInterface -{ - protected $name; - protected $normalization; - protected $validation; - protected $defaultValue; - protected $default = false; - protected $required = false; - protected $deprecation = []; - protected $merge; - protected $allowEmptyValue = true; - protected $nullEquivalent; - protected $trueEquivalent = true; - protected $falseEquivalent = false; - protected $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR; - protected $parent; - protected $attributes = []; - - public function __construct(?string $name, NodeParentInterface $parent = null) - { - $this->parent = $parent; - $this->name = $name; - } - - /** - * Sets the parent node. - * - * @return $this - */ - public function setParent(NodeParentInterface $parent): static - { - $this->parent = $parent; - - return $this; - } - - /** - * Sets info message. - * - * @return $this - */ - public function info(string $info): static - { - return $this->attribute('info', $info); - } - - /** - * Sets example configuration. - * - * @return $this - */ - public function example(string|array $example): static - { - return $this->attribute('example', $example); - } - - /** - * Sets an attribute on the node. - * - * @return $this - */ - public function attribute(string $key, mixed $value): static - { - $this->attributes[$key] = $value; - - return $this; - } - - /** - * Returns the parent node. - */ - public function end(): NodeParentInterface|NodeBuilder|NodeDefinition|ArrayNodeDefinition|VariableNodeDefinition|null - { - return $this->parent; - } - - /** - * Creates the node. - */ - public function getNode(bool $forceRootNode = false): NodeInterface - { - if ($forceRootNode) { - $this->parent = null; - } - - if (null !== $this->normalization) { - $allowedTypes = []; - foreach ($this->normalization->before as $expr) { - $allowedTypes[] = $expr->allowedTypes; - } - $allowedTypes = array_unique($allowedTypes); - $this->normalization->before = ExprBuilder::buildExpressions($this->normalization->before); - $this->normalization->declaredTypes = $allowedTypes; - } - - if (null !== $this->validation) { - $this->validation->rules = ExprBuilder::buildExpressions($this->validation->rules); - } - - $node = $this->createNode(); - if ($node instanceof BaseNode) { - $node->setAttributes($this->attributes); - } - - return $node; - } - - /** - * Sets the default value. - * - * @return $this - */ - public function defaultValue(mixed $value): static - { - $this->default = true; - $this->defaultValue = $value; - - return $this; - } - - /** - * Sets the node as required. - * - * @return $this - */ - public function isRequired(): static - { - $this->required = true; - - return $this; - } - - /** - * Sets the node as deprecated. - * - * @param string $package The name of the composer package that is triggering the deprecation - * @param string $version The version of the package that introduced the deprecation - * @param string $message the deprecation message to use - * - * You can use %node% and %path% placeholders in your message to display, - * respectively, the node name and its complete path - * - * @return $this - */ - public function setDeprecated(string $package, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.'): static - { - $this->deprecation = [ - 'package' => $package, - 'version' => $version, - 'message' => $message, - ]; - - return $this; - } - - /** - * Sets the equivalent value used when the node contains null. - * - * @return $this - */ - public function treatNullLike(mixed $value): static - { - $this->nullEquivalent = $value; - - return $this; - } - - /** - * Sets the equivalent value used when the node contains true. - * - * @return $this - */ - public function treatTrueLike(mixed $value): static - { - $this->trueEquivalent = $value; - - return $this; - } - - /** - * Sets the equivalent value used when the node contains false. - * - * @return $this - */ - public function treatFalseLike(mixed $value): static - { - $this->falseEquivalent = $value; - - return $this; - } - - /** - * Sets null as the default value. - * - * @return $this - */ - public function defaultNull(): static - { - return $this->defaultValue(null); - } - - /** - * Sets true as the default value. - * - * @return $this - */ - public function defaultTrue(): static - { - return $this->defaultValue(true); - } - - /** - * Sets false as the default value. - * - * @return $this - */ - public function defaultFalse(): static - { - return $this->defaultValue(false); - } - - /** - * Sets an expression to run before the normalization. - */ - public function beforeNormalization(): ExprBuilder - { - return $this->normalization()->before(); - } - - /** - * Denies the node value being empty. - * - * @return $this - */ - public function cannotBeEmpty(): static - { - $this->allowEmptyValue = false; - - return $this; - } - - /** - * Sets an expression to run for the validation. - * - * The expression receives the value of the node and must return it. It can - * modify it. - * An exception should be thrown when the node is not valid. - */ - public function validate(): ExprBuilder - { - return $this->validation()->rule(); - } - - /** - * Sets whether the node can be overwritten. - * - * @return $this - */ - public function cannotBeOverwritten(bool $deny = true): static - { - $this->merge()->denyOverwrite($deny); - - return $this; - } - - /** - * Gets the builder for validation rules. - */ - protected function validation(): ValidationBuilder - { - return $this->validation ??= new ValidationBuilder($this); - } - - /** - * Gets the builder for merging rules. - */ - protected function merge(): MergeBuilder - { - return $this->merge ??= new MergeBuilder($this); - } - - /** - * Gets the builder for normalization rules. - */ - protected function normalization(): NormalizationBuilder - { - return $this->normalization ??= new NormalizationBuilder($this); - } - - /** - * Instantiate and configure the node according to this definition. - * - * @throws InvalidDefinitionException When the definition is invalid - */ - abstract protected function createNode(): NodeInterface; - - /** - * Set PathSeparator to use. - * - * @return $this - */ - public function setPathSeparator(string $separator): static - { - if ($this instanceof ParentNodeDefinitionInterface) { - foreach ($this->getChildNodeDefinitions() as $child) { - $child->setPathSeparator($separator); - } - } - - $this->pathSeparator = $separator; - - return $this; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/NodeParentInterface.php b/tests/integration/vendor/symfony/config/Definition/Builder/NodeParentInterface.php deleted file mode 100644 index 305e993..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/NodeParentInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * An interface that must be implemented by all node parents. - * - * @author Victor Berchet - */ -interface NodeParentInterface -{ -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php b/tests/integration/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php deleted file mode 100644 index 0e362d9..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/NormalizationBuilder.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * This class builds normalization conditions. - * - * @author Johannes M. Schmitt - */ -class NormalizationBuilder -{ - protected $node; - public $before = []; - public $declaredTypes = []; - public $remappings = []; - - public function __construct(NodeDefinition $node) - { - $this->node = $node; - } - - /** - * Registers a key to remap to its plural form. - * - * @param string $key The key to remap - * @param string|null $plural The plural of the key in case of irregular plural - * - * @return $this - */ - public function remap(string $key, string $plural = null): static - { - $this->remappings[] = [$key, null === $plural ? $key.'s' : $plural]; - - return $this; - } - - /** - * Registers a closure to run before the normalization or an expression builder to build it if null is provided. - * - * @return ExprBuilder|$this - */ - public function before(\Closure $closure = null): ExprBuilder|static - { - if (null !== $closure) { - $this->before[] = $closure; - - return $this; - } - - return $this->before[] = new ExprBuilder($this->node); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php deleted file mode 100644 index 890910c..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/NumericNodeDefinition.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; - -/** - * Abstract class that contains common code of integer and float node definitions. - * - * @author David Jeanmonod - */ -abstract class NumericNodeDefinition extends ScalarNodeDefinition -{ - protected $min; - protected $max; - - /** - * Ensures that the value is smaller than the given reference. - * - * @return $this - * - * @throws \InvalidArgumentException when the constraint is inconsistent - */ - public function max(int|float $max): static - { - if (isset($this->min) && $this->min > $max) { - throw new \InvalidArgumentException(sprintf('You cannot define a max(%s) as you already have a min(%s).', $max, $this->min)); - } - $this->max = $max; - - return $this; - } - - /** - * Ensures that the value is bigger than the given reference. - * - * @return $this - * - * @throws \InvalidArgumentException when the constraint is inconsistent - */ - public function min(int|float $min): static - { - if (isset($this->max) && $this->max < $min) { - throw new \InvalidArgumentException(sprintf('You cannot define a min(%s) as you already have a max(%s).', $min, $this->max)); - } - $this->min = $min; - - return $this; - } - - /** - * @throws InvalidDefinitionException - */ - public function cannotBeEmpty(): static - { - throw new InvalidDefinitionException('->cannotBeEmpty() is not applicable to NumericNodeDefinition.'); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php b/tests/integration/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php deleted file mode 100644 index 7b8a7eb..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/ParentNodeDefinitionInterface.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * An interface that must be implemented by nodes which can have children. - * - * @author Victor Berchet - */ -interface ParentNodeDefinitionInterface extends BuilderAwareInterface -{ - /** - * Returns a builder to add children nodes. - */ - public function children(): NodeBuilder; - - /** - * Appends a node definition. - * - * Usage: - * - * $node = $parentNode - * ->children() - * ->scalarNode('foo')->end() - * ->scalarNode('baz')->end() - * ->append($this->getBarNodeDefinition()) - * ->end() - * ; - * - * @return $this - */ - public function append(NodeDefinition $node): static; - - /** - * Gets the child node definitions. - * - * @return NodeDefinition[] - */ - public function getChildNodeDefinitions(): array; -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php deleted file mode 100644 index 37a0af0..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/ScalarNodeDefinition.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\ScalarNode; - -/** - * This class provides a fluent interface for defining a node. - * - * @author Johannes M. Schmitt - */ -class ScalarNodeDefinition extends VariableNodeDefinition -{ - /** - * Instantiate a Node. - */ - protected function instantiateNode(): ScalarNode - { - return new ScalarNode($this->name, $this->parent, $this->pathSeparator); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/TreeBuilder.php b/tests/integration/vendor/symfony/config/Definition/Builder/TreeBuilder.php deleted file mode 100644 index 4f868f7..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/TreeBuilder.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\NodeInterface; - -/** - * This is the entry class for building a config tree. - * - * @author Johannes M. Schmitt - */ -class TreeBuilder implements NodeParentInterface -{ - protected $tree; - protected $root; - - public function __construct(string $name, string $type = 'array', NodeBuilder $builder = null) - { - $builder ??= new NodeBuilder(); - $this->root = $builder->node($name, $type)->setParent($this); - } - - /** - * @return NodeDefinition|ArrayNodeDefinition The root node (as an ArrayNodeDefinition when the type is 'array') - */ - public function getRootNode(): NodeDefinition|ArrayNodeDefinition - { - return $this->root; - } - - /** - * Builds the tree. - * - * @throws \RuntimeException - */ - public function buildTree(): NodeInterface - { - if (null !== $this->tree) { - return $this->tree; - } - - return $this->tree = $this->root->getNode(true); - } - - /** - * @return void - */ - public function setPathSeparator(string $separator) - { - // unset last built as changing path separator changes all nodes - $this->tree = null; - - $this->root->setPathSeparator($separator); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/ValidationBuilder.php b/tests/integration/vendor/symfony/config/Definition/Builder/ValidationBuilder.php deleted file mode 100644 index 1bee851..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/ValidationBuilder.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -/** - * This class builds validation conditions. - * - * @author Christophe Coevoet - */ -class ValidationBuilder -{ - protected $node; - public $rules = []; - - public function __construct(NodeDefinition $node) - { - $this->node = $node; - } - - /** - * Registers a closure to run as normalization or an expression builder to build it if null is provided. - * - * @return ExprBuilder|$this - */ - public function rule(\Closure $closure = null): ExprBuilder|static - { - if (null !== $closure) { - $this->rules[] = $closure; - - return $this; - } - - return $this->rules[] = new ExprBuilder($this->node); - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php b/tests/integration/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php deleted file mode 100644 index c49391f..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Builder/VariableNodeDefinition.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Builder; - -use Symfony\Component\Config\Definition\NodeInterface; -use Symfony\Component\Config\Definition\VariableNode; - -/** - * This class provides a fluent interface for defining a node. - * - * @author Johannes M. Schmitt - */ -class VariableNodeDefinition extends NodeDefinition -{ - /** - * Instantiate a Node. - */ - protected function instantiateNode(): VariableNode - { - return new VariableNode($this->name, $this->parent, $this->pathSeparator); - } - - protected function createNode(): NodeInterface - { - $node = $this->instantiateNode(); - - if (null !== $this->normalization) { - $node->setNormalizationClosures($this->normalization->before); - } - - if (null !== $this->merge) { - $node->setAllowOverwrite($this->merge->allowOverwrite); - } - - if (true === $this->default) { - $node->setDefaultValue($this->defaultValue); - } - - $node->setAllowEmptyValue($this->allowEmptyValue); - $node->addEquivalentValue(null, $this->nullEquivalent); - $node->addEquivalentValue(true, $this->trueEquivalent); - $node->addEquivalentValue(false, $this->falseEquivalent); - $node->setRequired($this->required); - - if ($this->deprecation) { - $node->setDeprecated($this->deprecation['package'], $this->deprecation['version'], $this->deprecation['message']); - } - - if (null !== $this->validation) { - $node->setFinalValidationClosures($this->validation->rules); - } - - return $node; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/ConfigurationInterface.php b/tests/integration/vendor/symfony/config/Definition/ConfigurationInterface.php deleted file mode 100644 index 7b5d443..0000000 --- a/tests/integration/vendor/symfony/config/Definition/ConfigurationInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Builder\TreeBuilder; - -/** - * Configuration interface. - * - * @author Victor Berchet - */ -interface ConfigurationInterface -{ - /** - * Generates the configuration tree builder. - * - * @return TreeBuilder - */ - public function getConfigTreeBuilder(); -} diff --git a/tests/integration/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php b/tests/integration/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php deleted file mode 100644 index 34f93ce..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php +++ /dev/null @@ -1,299 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Dumper; - -use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\BaseNode; -use Symfony\Component\Config\Definition\BooleanNode; -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\Config\Definition\EnumNode; -use Symfony\Component\Config\Definition\FloatNode; -use Symfony\Component\Config\Definition\IntegerNode; -use Symfony\Component\Config\Definition\NodeInterface; -use Symfony\Component\Config\Definition\PrototypedArrayNode; -use Symfony\Component\Config\Definition\ScalarNode; - -/** - * Dumps an XML reference configuration for the given configuration/node instance. - * - * @author Wouter J - */ -class XmlReferenceDumper -{ - private ?string $reference = null; - - /** - * @return string - */ - public function dump(ConfigurationInterface $configuration, string $namespace = null) - { - return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace); - } - - /** - * @return string - */ - public function dumpNode(NodeInterface $node, string $namespace = null) - { - $this->reference = ''; - $this->writeNode($node, 0, true, $namespace); - $ref = $this->reference; - $this->reference = null; - - return $ref; - } - - private function writeNode(NodeInterface $node, int $depth = 0, bool $root = false, string $namespace = null): void - { - $rootName = ($root ? 'config' : $node->getName()); - $rootNamespace = ($namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null)); - - // xml remapping - if ($node->getParent()) { - $remapping = array_filter($node->getParent()->getXmlRemappings(), fn (array $mapping) => $rootName === $mapping[1]); - - if (\count($remapping)) { - [$singular] = current($remapping); - $rootName = $singular; - } - } - $rootName = str_replace('_', '-', $rootName); - - $rootAttributes = []; - $rootAttributeComments = []; - $rootChildren = []; - $rootComments = []; - - if ($node instanceof ArrayNode) { - $children = $node->getChildren(); - - // comments about the root node - if ($rootInfo = $node->getInfo()) { - $rootComments[] = $rootInfo; - } - - if ($rootNamespace) { - $rootComments[] = 'Namespace: '.$rootNamespace; - } - - // render prototyped nodes - if ($node instanceof PrototypedArrayNode) { - $prototype = $node->getPrototype(); - - $info = 'prototype'; - if (null !== $prototype->getInfo()) { - $info .= ': '.$prototype->getInfo(); - } - array_unshift($rootComments, $info); - - if ($key = $node->getKeyAttribute()) { - $rootAttributes[$key] = str_replace('-', ' ', $rootName).' '.$key; - } - - if ($prototype instanceof PrototypedArrayNode) { - $prototype->setName($key ?? ''); - $children = [$key => $prototype]; - } elseif ($prototype instanceof ArrayNode) { - $children = $prototype->getChildren(); - } else { - if ($prototype->hasDefaultValue()) { - $prototypeValue = $prototype->getDefaultValue(); - } else { - $prototypeValue = match ($prototype::class) { - ScalarNode::class => 'scalar value', - FloatNode::class, - IntegerNode::class => 'numeric value', - BooleanNode::class => 'true|false', - EnumNode::class => $prototype->getPermissibleValues('|'), - default => 'value', - }; - } - } - } - - // get attributes and elements - foreach ($children as $child) { - if ($child instanceof ArrayNode) { - // get elements - $rootChildren[] = $child; - - continue; - } - - // get attributes - - // metadata - $name = str_replace('_', '-', $child->getName()); - $value = '%%%%not_defined%%%%'; // use a string which isn't used in the normal world - - // comments - $comments = []; - if ($child instanceof BaseNode && $info = $child->getInfo()) { - $comments[] = $info; - } - - if ($child instanceof BaseNode && $example = $child->getExample()) { - $comments[] = 'Example: '.(\is_array($example) ? implode(', ', $example) : $example); - } - - if ($child->isRequired()) { - $comments[] = 'Required'; - } - - if ($child instanceof BaseNode && $child->isDeprecated()) { - $deprecation = $child->getDeprecation($child->getName(), $node->getPath()); - $comments[] = sprintf('Deprecated (%s)', ($deprecation['package'] || $deprecation['version'] ? "Since {$deprecation['package']} {$deprecation['version']}: " : '').$deprecation['message']); - } - - if ($child instanceof EnumNode) { - $comments[] = 'One of '.$child->getPermissibleValues('; '); - } - - if (\count($comments)) { - $rootAttributeComments[$name] = implode(";\n", $comments); - } - - // default values - if ($child->hasDefaultValue()) { - $value = $child->getDefaultValue(); - } - - // append attribute - $rootAttributes[$name] = $value; - } - } - - // render comments - - // root node comment - if (\count($rootComments)) { - foreach ($rootComments as $comment) { - $this->writeLine('', $depth); - } - } - - // attribute comments - if (\count($rootAttributeComments)) { - foreach ($rootAttributeComments as $attrName => $comment) { - $commentDepth = $depth + 4 + \strlen($attrName) + 2; - $commentLines = explode("\n", $comment); - $multiline = (\count($commentLines) > 1); - $comment = implode(\PHP_EOL.str_repeat(' ', $commentDepth), $commentLines); - - if ($multiline) { - $this->writeLine('', $depth); - } else { - $this->writeLine('', $depth); - } - } - } - - // render start tag + attributes - $rootIsVariablePrototype = isset($prototypeValue); - $rootIsEmptyTag = (0 === \count($rootChildren) && !$rootIsVariablePrototype); - $rootOpenTag = '<'.$rootName; - if (1 >= ($attributesCount = \count($rootAttributes))) { - if (1 === $attributesCount) { - $rootOpenTag .= sprintf(' %s="%s"', current(array_keys($rootAttributes)), $this->writeValue(current($rootAttributes))); - } - - $rootOpenTag .= $rootIsEmptyTag ? ' />' : '>'; - - if ($rootIsVariablePrototype) { - $rootOpenTag .= $prototypeValue.''; - } - - $this->writeLine($rootOpenTag, $depth); - } else { - $this->writeLine($rootOpenTag, $depth); - - $i = 1; - - foreach ($rootAttributes as $attrName => $attrValue) { - $attr = sprintf('%s="%s"', $attrName, $this->writeValue($attrValue)); - - $this->writeLine($attr, $depth + 4); - - if ($attributesCount === $i++) { - $this->writeLine($rootIsEmptyTag ? '/>' : '>', $depth); - - if ($rootIsVariablePrototype) { - $rootOpenTag .= $prototypeValue.''; - } - } - } - } - - // render children tags - foreach ($rootChildren as $child) { - $this->writeLine(''); - $this->writeNode($child, $depth + 4); - } - - // render end tag - if (!$rootIsEmptyTag && !$rootIsVariablePrototype) { - $this->writeLine(''); - - $rootEndTag = ''; - $this->writeLine($rootEndTag, $depth); - } - } - - /** - * Outputs a single config reference line. - */ - private function writeLine(string $text, int $indent = 0): void - { - $indent = \strlen($text) + $indent; - $format = '%'.$indent.'s'; - - $this->reference .= sprintf($format, $text).\PHP_EOL; - } - - /** - * Renders the string conversion of the value. - */ - private function writeValue(mixed $value): string - { - if ('%%%%not_defined%%%%' === $value) { - return ''; - } - - if (\is_string($value) || is_numeric($value)) { - return $value; - } - - if (false === $value) { - return 'false'; - } - - if (true === $value) { - return 'true'; - } - - if (null === $value) { - return 'null'; - } - - if (empty($value)) { - return ''; - } - - if (\is_array($value)) { - return implode(',', $value); - } - - return ''; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php b/tests/integration/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php deleted file mode 100644 index 97a391a..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php +++ /dev/null @@ -1,260 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Dumper; - -use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\BaseNode; -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\Config\Definition\EnumNode; -use Symfony\Component\Config\Definition\NodeInterface; -use Symfony\Component\Config\Definition\PrototypedArrayNode; -use Symfony\Component\Config\Definition\ScalarNode; -use Symfony\Component\Config\Definition\VariableNode; -use Symfony\Component\Yaml\Inline; - -/** - * Dumps a Yaml reference configuration for the given configuration/node instance. - * - * @author Kevin Bond - */ -class YamlReferenceDumper -{ - private ?string $reference = null; - - /** - * @return string - */ - public function dump(ConfigurationInterface $configuration) - { - return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree()); - } - - /** - * @return string - */ - public function dumpAtPath(ConfigurationInterface $configuration, string $path) - { - $rootNode = $node = $configuration->getConfigTreeBuilder()->buildTree(); - - foreach (explode('.', $path) as $step) { - if (!$node instanceof ArrayNode) { - throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path)); - } - - /** @var NodeInterface[] $children */ - $children = $node instanceof PrototypedArrayNode ? $this->getPrototypeChildren($node) : $node->getChildren(); - - foreach ($children as $child) { - if ($child->getName() === $step) { - $node = $child; - - continue 2; - } - } - - throw new \UnexpectedValueException(sprintf('Unable to find node at path "%s.%s".', $rootNode->getName(), $path)); - } - - return $this->dumpNode($node); - } - - /** - * @return string - */ - public function dumpNode(NodeInterface $node) - { - $this->reference = ''; - $this->writeNode($node); - $ref = $this->reference; - $this->reference = null; - - return $ref; - } - - private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = false): void - { - $comments = []; - $default = ''; - $defaultArray = null; - $children = null; - $example = null; - if ($node instanceof BaseNode) { - $example = $node->getExample(); - } - - // defaults - if ($node instanceof ArrayNode) { - $children = $node->getChildren(); - - if ($node instanceof PrototypedArrayNode) { - $children = $this->getPrototypeChildren($node); - } - - if (!$children) { - if ($node->hasDefaultValue() && \count($defaultArray = $node->getDefaultValue())) { - $default = ''; - } elseif (!\is_array($example)) { - $default = '[]'; - } - } - } elseif ($node instanceof EnumNode) { - $comments[] = 'One of '.$node->getPermissibleValues('; '); - $default = $node->hasDefaultValue() ? Inline::dump($node->getDefaultValue()) : '~'; - } elseif (VariableNode::class === $node::class && \is_array($example)) { - // If there is an array example, we are sure we dont need to print a default value - $default = ''; - } else { - $default = '~'; - - if ($node->hasDefaultValue()) { - $default = $node->getDefaultValue(); - - if (\is_array($default)) { - if (\count($defaultArray = $node->getDefaultValue())) { - $default = ''; - } elseif (!\is_array($example)) { - $default = '[]'; - } - } else { - $default = Inline::dump($default); - } - } - } - - // required? - if ($node->isRequired()) { - $comments[] = 'Required'; - } - - // deprecated? - if ($node instanceof BaseNode && $node->isDeprecated()) { - $deprecation = $node->getDeprecation($node->getName(), $parentNode ? $parentNode->getPath() : $node->getPath()); - $comments[] = sprintf('Deprecated (%s)', ($deprecation['package'] || $deprecation['version'] ? "Since {$deprecation['package']} {$deprecation['version']}: " : '').$deprecation['message']); - } - - // example - if ($example && !\is_array($example)) { - $comments[] = 'Example: '.Inline::dump($example); - } - - $default = '' != (string) $default ? ' '.$default : ''; - $comments = \count($comments) ? '# '.implode(', ', $comments) : ''; - - $key = $prototypedArray ? '-' : $node->getName().':'; - $text = rtrim(sprintf('%-21s%s %s', $key, $default, $comments), ' '); - - if ($node instanceof BaseNode && $info = $node->getInfo()) { - $this->writeLine(''); - // indenting multi-line info - $info = str_replace("\n", sprintf("\n%".($depth * 4).'s# ', ' '), $info); - $this->writeLine('# '.$info, $depth * 4); - } - - $this->writeLine($text, $depth * 4); - - // output defaults - if ($defaultArray) { - $this->writeLine(''); - - $message = \count($defaultArray) > 1 ? 'Defaults' : 'Default'; - - $this->writeLine('# '.$message.':', $depth * 4 + 4); - - $this->writeArray($defaultArray, $depth + 1); - } - - if (\is_array($example)) { - $this->writeLine(''); - - $message = \count($example) > 1 ? 'Examples' : 'Example'; - - $this->writeLine('# '.$message.':', $depth * 4 + 4); - - $this->writeArray(array_map(Inline::dump(...), $example), $depth + 1); - } - - if ($children) { - foreach ($children as $childNode) { - $this->writeNode($childNode, $node, $depth + 1, $node instanceof PrototypedArrayNode && !$node->getKeyAttribute()); - } - } - } - - /** - * Outputs a single config reference line. - */ - private function writeLine(string $text, int $indent = 0): void - { - $indent = \strlen($text) + $indent; - $format = '%'.$indent.'s'; - - $this->reference .= sprintf($format, $text)."\n"; - } - - private function writeArray(array $array, int $depth): void - { - $isIndexed = array_is_list($array); - - foreach ($array as $key => $value) { - if (\is_array($value)) { - $val = ''; - } else { - $val = $value; - } - - if ($isIndexed) { - $this->writeLine('- '.$val, $depth * 4); - } else { - $this->writeLine(sprintf('%-20s %s', $key.':', $val), $depth * 4); - } - - if (\is_array($value)) { - $this->writeArray($value, $depth + 1); - } - } - } - - private function getPrototypeChildren(PrototypedArrayNode $node): array - { - $prototype = $node->getPrototype(); - $key = $node->getKeyAttribute(); - - // Do not expand prototype if it isn't an array node nor uses attribute as key - if (!$key && !$prototype instanceof ArrayNode) { - return $node->getChildren(); - } - - if ($prototype instanceof ArrayNode) { - $keyNode = new ArrayNode($key, $node); - $children = $prototype->getChildren(); - - if ($prototype instanceof PrototypedArrayNode && $prototype->getKeyAttribute()) { - $children = $this->getPrototypeChildren($prototype); - } - - // add children - foreach ($children as $childNode) { - $keyNode->addChild($childNode); - } - } else { - $keyNode = new ScalarNode($key, $node); - } - - $info = 'Prototype'; - if (null !== $prototype->getInfo()) { - $info .= ': '.$prototype->getInfo(); - } - $keyNode->setInfo($info); - - return [$key => $keyNode]; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/EnumNode.php b/tests/integration/vendor/symfony/config/Definition/EnumNode.php deleted file mode 100644 index 4edeae9..0000000 --- a/tests/integration/vendor/symfony/config/Definition/EnumNode.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; - -/** - * Node which only allows a finite set of values. - * - * @author Johannes M. Schmitt - */ -class EnumNode extends ScalarNode -{ - private array $values; - - public function __construct(?string $name, NodeInterface $parent = null, array $values = [], string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR) - { - if (!$values) { - throw new \InvalidArgumentException('$values must contain at least one element.'); - } - - foreach ($values as $value) { - if (null === $value || \is_scalar($value)) { - continue; - } - - if (!$value instanceof \UnitEnum) { - throw new \InvalidArgumentException(sprintf('"%s" only supports scalar, enum, or null values, "%s" given.', __CLASS__, get_debug_type($value))); - } - - if ($value::class !== ($enumClass ??= $value::class)) { - throw new \InvalidArgumentException(sprintf('"%s" only supports one type of enum, "%s" and "%s" passed.', __CLASS__, $enumClass, $value::class)); - } - } - - parent::__construct($name, $parent, $pathSeparator); - $this->values = $values; - } - - /** - * @return array - */ - public function getValues() - { - return $this->values; - } - - /** - * @internal - */ - public function getPermissibleValues(string $separator): string - { - return implode($separator, array_unique(array_map(static function (mixed $value): string { - if (!$value instanceof \UnitEnum) { - return json_encode($value); - } - - return ltrim(var_export($value, true), '\\'); - }, $this->values))); - } - - /** - * @return void - */ - protected function validateType(mixed $value) - { - if ($value instanceof \UnitEnum) { - return; - } - - parent::validateType($value); - } - - protected function finalizeValue(mixed $value): mixed - { - $value = parent::finalizeValue($value); - - if (!\in_array($value, $this->values, true)) { - $ex = new InvalidConfigurationException(sprintf('The value %s is not allowed for path "%s". Permissible values: %s', json_encode($value), $this->getPath(), $this->getPermissibleValues(', '))); - $ex->setPath($this->getPath()); - - throw $ex; - } - - return $value; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Exception/DuplicateKeyException.php b/tests/integration/vendor/symfony/config/Definition/Exception/DuplicateKeyException.php deleted file mode 100644 index 48dd932..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Exception/DuplicateKeyException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * This exception is thrown whenever the key of an array is not unique. This can - * only be the case if the configuration is coming from an XML file. - * - * @author Johannes M. Schmitt - */ -class DuplicateKeyException extends InvalidConfigurationException -{ -} diff --git a/tests/integration/vendor/symfony/config/Definition/Exception/Exception.php b/tests/integration/vendor/symfony/config/Definition/Exception/Exception.php deleted file mode 100644 index 8933a49..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Exception/Exception.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * Base exception for all configuration exceptions. - * - * @author Johannes M. Schmitt - */ -class Exception extends \RuntimeException -{ -} diff --git a/tests/integration/vendor/symfony/config/Definition/Exception/ForbiddenOverwriteException.php b/tests/integration/vendor/symfony/config/Definition/Exception/ForbiddenOverwriteException.php deleted file mode 100644 index 726c07f..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Exception/ForbiddenOverwriteException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * This exception is thrown when a configuration path is overwritten from a - * subsequent configuration file, but the entry node specifically forbids this. - * - * @author Johannes M. Schmitt - */ -class ForbiddenOverwriteException extends InvalidConfigurationException -{ -} diff --git a/tests/integration/vendor/symfony/config/Definition/Exception/InvalidConfigurationException.php b/tests/integration/vendor/symfony/config/Definition/Exception/InvalidConfigurationException.php deleted file mode 100644 index 794447b..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Exception/InvalidConfigurationException.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * A very general exception which can be thrown whenever non of the more specific - * exceptions is suitable. - * - * @author Johannes M. Schmitt - */ -class InvalidConfigurationException extends Exception -{ - private ?string $path = null; - private bool $containsHints = false; - - /** - * @return void - */ - public function setPath(string $path) - { - $this->path = $path; - } - - public function getPath(): ?string - { - return $this->path; - } - - /** - * Adds extra information that is suffixed to the original exception message. - * - * @return void - */ - public function addHint(string $hint) - { - if (!$this->containsHints) { - $this->message .= "\nHint: ".$hint; - $this->containsHints = true; - } else { - $this->message .= ', '.$hint; - } - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Exception/InvalidDefinitionException.php b/tests/integration/vendor/symfony/config/Definition/Exception/InvalidDefinitionException.php deleted file mode 100644 index 98310da..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Exception/InvalidDefinitionException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * Thrown when an error is detected in a node Definition. - * - * @author Victor Berchet - */ -class InvalidDefinitionException extends Exception -{ -} diff --git a/tests/integration/vendor/symfony/config/Definition/Exception/InvalidTypeException.php b/tests/integration/vendor/symfony/config/Definition/Exception/InvalidTypeException.php deleted file mode 100644 index d7ca8c9..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Exception/InvalidTypeException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * This exception is thrown if an invalid type is encountered. - * - * @author Johannes M. Schmitt - */ -class InvalidTypeException extends InvalidConfigurationException -{ -} diff --git a/tests/integration/vendor/symfony/config/Definition/Exception/UnsetKeyException.php b/tests/integration/vendor/symfony/config/Definition/Exception/UnsetKeyException.php deleted file mode 100644 index 863181a..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Exception/UnsetKeyException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition\Exception; - -/** - * This exception is usually not encountered by the end-user, but only used - * internally to signal the parent scope to unset a key. - * - * @author Johannes M. Schmitt - */ -class UnsetKeyException extends Exception -{ -} diff --git a/tests/integration/vendor/symfony/config/Definition/FloatNode.php b/tests/integration/vendor/symfony/config/Definition/FloatNode.php deleted file mode 100644 index ce4193e..0000000 --- a/tests/integration/vendor/symfony/config/Definition/FloatNode.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * This node represents a float value in the config tree. - * - * @author Jeanmonod David - */ -class FloatNode extends NumericNode -{ - /** - * @return void - */ - protected function validateType(mixed $value) - { - // Integers are also accepted, we just cast them - if (\is_int($value)) { - $value = (float) $value; - } - - if (!\is_float($value)) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected "float", but got "%s".', $this->getPath(), get_debug_type($value))); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } - - protected function getValidPlaceholderTypes(): array - { - return ['float']; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/IntegerNode.php b/tests/integration/vendor/symfony/config/Definition/IntegerNode.php deleted file mode 100644 index 4a3e325..0000000 --- a/tests/integration/vendor/symfony/config/Definition/IntegerNode.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * This node represents an integer value in the config tree. - * - * @author Jeanmonod David - */ -class IntegerNode extends NumericNode -{ - /** - * @return void - */ - protected function validateType(mixed $value) - { - if (!\is_int($value)) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected "int", but got "%s".', $this->getPath(), get_debug_type($value))); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } - - protected function getValidPlaceholderTypes(): array - { - return ['int']; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/NodeInterface.php b/tests/integration/vendor/symfony/config/Definition/NodeInterface.php deleted file mode 100644 index d171587..0000000 --- a/tests/integration/vendor/symfony/config/Definition/NodeInterface.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException; -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * Common Interface among all nodes. - * - * In most cases, it is better to inherit from BaseNode instead of implementing - * this interface yourself. - * - * @author Johannes M. Schmitt - */ -interface NodeInterface -{ - /** - * Returns the name of the node. - */ - public function getName(): string; - - /** - * Returns the path of the node. - */ - public function getPath(): string; - - /** - * Returns true when the node is required. - */ - public function isRequired(): bool; - - /** - * Returns true when the node has a default value. - */ - public function hasDefaultValue(): bool; - - /** - * Returns the default value of the node. - * - * @throws \RuntimeException if the node has no default value - */ - public function getDefaultValue(): mixed; - - /** - * Normalizes a value. - * - * @throws InvalidTypeException if the value type is invalid - */ - public function normalize(mixed $value): mixed; - - /** - * Merges two values together. - * - * @throws ForbiddenOverwriteException if the configuration path cannot be overwritten - * @throws InvalidTypeException if the value type is invalid - */ - public function merge(mixed $leftSide, mixed $rightSide): mixed; - - /** - * Finalizes a value. - * - * @throws InvalidTypeException if the value type is invalid - * @throws InvalidConfigurationException if the value is invalid configuration - */ - public function finalize(mixed $value): mixed; -} diff --git a/tests/integration/vendor/symfony/config/Definition/NumericNode.php b/tests/integration/vendor/symfony/config/Definition/NumericNode.php deleted file mode 100644 index da32b84..0000000 --- a/tests/integration/vendor/symfony/config/Definition/NumericNode.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; - -/** - * This node represents a numeric value in the config tree. - * - * @author David Jeanmonod - */ -class NumericNode extends ScalarNode -{ - protected $min; - protected $max; - - public function __construct(?string $name, NodeInterface $parent = null, int|float $min = null, int|float $max = null, string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR) - { - parent::__construct($name, $parent, $pathSeparator); - $this->min = $min; - $this->max = $max; - } - - protected function finalizeValue(mixed $value): mixed - { - $value = parent::finalizeValue($value); - - $errorMsg = null; - if (isset($this->min) && $value < $this->min) { - $errorMsg = sprintf('The value %s is too small for path "%s". Should be greater than or equal to %s', $value, $this->getPath(), $this->min); - } - if (isset($this->max) && $value > $this->max) { - $errorMsg = sprintf('The value %s is too big for path "%s". Should be less than or equal to %s', $value, $this->getPath(), $this->max); - } - if (isset($errorMsg)) { - $ex = new InvalidConfigurationException($errorMsg); - $ex->setPath($this->getPath()); - throw $ex; - } - - return $value; - } - - protected function isValueEmpty(mixed $value): bool - { - // a numeric value cannot be empty - return false; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/Processor.php b/tests/integration/vendor/symfony/config/Definition/Processor.php deleted file mode 100644 index dc3d4c6..0000000 --- a/tests/integration/vendor/symfony/config/Definition/Processor.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -/** - * This class is the entry point for config normalization/merging/finalization. - * - * @author Johannes M. Schmitt - * - * @final - */ -class Processor -{ - /** - * Processes an array of configurations. - * - * @param array $configs An array of configuration items to process - */ - public function process(NodeInterface $configTree, array $configs): array - { - $currentConfig = []; - foreach ($configs as $config) { - $config = $configTree->normalize($config); - $currentConfig = $configTree->merge($currentConfig, $config); - } - - return $configTree->finalize($currentConfig); - } - - /** - * Processes an array of configurations. - * - * @param array $configs An array of configuration items to process - */ - public function processConfiguration(ConfigurationInterface $configuration, array $configs): array - { - return $this->process($configuration->getConfigTreeBuilder()->buildTree(), $configs); - } - - /** - * Normalizes a configuration entry. - * - * This method returns a normalize configuration array for a given key - * to remove the differences due to the original format (YAML and XML mainly). - * - * Here is an example. - * - * The configuration in XML: - * - * twig.extension.foo - * twig.extension.bar - * - * And the same configuration in YAML: - * - * extensions: ['twig.extension.foo', 'twig.extension.bar'] - * - * @param array $config A config array - * @param string $key The key to normalize - * @param string|null $plural The plural form of the key if it is irregular - */ - public static function normalizeConfig(array $config, string $key, string $plural = null): array - { - $plural ??= $key.'s'; - - if (isset($config[$plural])) { - return $config[$plural]; - } - - if (isset($config[$key])) { - if (\is_string($config[$key]) || !\is_int(key($config[$key]))) { - // only one - return [$config[$key]]; - } - - return $config[$key]; - } - - return []; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/PrototypeNodeInterface.php b/tests/integration/vendor/symfony/config/Definition/PrototypeNodeInterface.php deleted file mode 100644 index 9dce744..0000000 --- a/tests/integration/vendor/symfony/config/Definition/PrototypeNodeInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -/** - * This interface must be implemented by nodes which can be used as prototypes. - * - * @author Johannes M. Schmitt - */ -interface PrototypeNodeInterface extends NodeInterface -{ - /** - * Sets the name of the node. - * - * @return void - */ - public function setName(string $name); -} diff --git a/tests/integration/vendor/symfony/config/Definition/PrototypedArrayNode.php b/tests/integration/vendor/symfony/config/Definition/PrototypedArrayNode.php deleted file mode 100644 index c105ac1..0000000 --- a/tests/integration/vendor/symfony/config/Definition/PrototypedArrayNode.php +++ /dev/null @@ -1,343 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\DuplicateKeyException; -use Symfony\Component\Config\Definition\Exception\Exception; -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; -use Symfony\Component\Config\Definition\Exception\UnsetKeyException; - -/** - * Represents a prototyped Array node in the config tree. - * - * @author Johannes M. Schmitt - */ -class PrototypedArrayNode extends ArrayNode -{ - protected $prototype; - protected $keyAttribute; - protected $removeKeyAttribute = false; - protected $minNumberOfElements = 0; - protected $defaultValue = []; - protected $defaultChildren; - /** - * @var NodeInterface[] An array of the prototypes of the simplified value children - */ - private array $valuePrototypes = []; - - /** - * Sets the minimum number of elements that a prototype based node must - * contain. By default this is zero, meaning no elements. - * - * @return void - */ - public function setMinNumberOfElements(int $number) - { - $this->minNumberOfElements = $number; - } - - /** - * Sets the attribute which value is to be used as key. - * - * This is useful when you have an indexed array that should be an - * associative array. You can select an item from within the array - * to be the key of the particular item. For example, if "id" is the - * "key", then: - * - * [ - * ['id' => 'my_name', 'foo' => 'bar'], - * ]; - * - * becomes - * - * [ - * 'my_name' => ['foo' => 'bar'], - * ]; - * - * If you'd like "'id' => 'my_name'" to still be present in the resulting - * array, then you can set the second argument of this method to false. - * - * @param string $attribute The name of the attribute which value is to be used as a key - * @param bool $remove Whether or not to remove the key - * - * @return void - */ - public function setKeyAttribute(string $attribute, bool $remove = true) - { - $this->keyAttribute = $attribute; - $this->removeKeyAttribute = $remove; - } - - /** - * Retrieves the name of the attribute which value should be used as key. - */ - public function getKeyAttribute(): ?string - { - return $this->keyAttribute; - } - - /** - * Sets the default value of this node. - * - * @return void - */ - public function setDefaultValue(array $value) - { - $this->defaultValue = $value; - } - - public function hasDefaultValue(): bool - { - return true; - } - - /** - * Adds default children when none are set. - * - * @param int|string|array|null $children The number of children|The child name|The children names to be added - * - * @return void - */ - public function setAddChildrenIfNoneSet(int|string|array|null $children = ['defaults']) - { - if (null === $children) { - $this->defaultChildren = ['defaults']; - } else { - $this->defaultChildren = \is_int($children) && $children > 0 ? range(1, $children) : (array) $children; - } - } - - /** - * The default value could be either explicited or derived from the prototype - * default value. - */ - public function getDefaultValue(): mixed - { - if (null !== $this->defaultChildren) { - $default = $this->prototype->hasDefaultValue() ? $this->prototype->getDefaultValue() : []; - $defaults = []; - foreach (array_values($this->defaultChildren) as $i => $name) { - $defaults[null === $this->keyAttribute ? $i : $name] = $default; - } - - return $defaults; - } - - return $this->defaultValue; - } - - /** - * Sets the node prototype. - * - * @return void - */ - public function setPrototype(PrototypeNodeInterface $node) - { - $this->prototype = $node; - } - - /** - * Retrieves the prototype. - */ - public function getPrototype(): PrototypeNodeInterface - { - return $this->prototype; - } - - /** - * Disable adding concrete children for prototyped nodes. - * - * @return never - * - * @throws Exception - */ - public function addChild(NodeInterface $node) - { - throw new Exception('A prototyped array node cannot have concrete children.'); - } - - protected function finalizeValue(mixed $value): mixed - { - if (false === $value) { - throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s.', $this->getPath(), json_encode($value))); - } - - foreach ($value as $k => $v) { - $prototype = $this->getPrototypeForChild($k); - try { - $value[$k] = $prototype->finalize($v); - } catch (UnsetKeyException) { - unset($value[$k]); - } - } - - if (\count($value) < $this->minNumberOfElements) { - $ex = new InvalidConfigurationException(sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements)); - $ex->setPath($this->getPath()); - - throw $ex; - } - - return $value; - } - - /** - * @throws DuplicateKeyException - */ - protected function normalizeValue(mixed $value): mixed - { - if (false === $value) { - return $value; - } - - $value = $this->remapXml($value); - - $isList = array_is_list($value); - $normalized = []; - foreach ($value as $k => $v) { - if (null !== $this->keyAttribute && \is_array($v)) { - if (!isset($v[$this->keyAttribute]) && \is_int($k) && $isList) { - $ex = new InvalidConfigurationException(sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath())); - $ex->setPath($this->getPath()); - - throw $ex; - } elseif (isset($v[$this->keyAttribute])) { - $k = $v[$this->keyAttribute]; - - if (\is_float($k)) { - $k = var_export($k, true); - } - - // remove the key attribute when required - if ($this->removeKeyAttribute) { - unset($v[$this->keyAttribute]); - } - - // if only "value" is left - if (array_keys($v) === ['value']) { - $v = $v['value']; - if ($this->prototype instanceof ArrayNode && ($children = $this->prototype->getChildren()) && \array_key_exists('value', $children)) { - $valuePrototype = current($this->valuePrototypes) ?: clone $children['value']; - $valuePrototype->parent = $this; - $originalClosures = $this->prototype->normalizationClosures; - if (\is_array($originalClosures)) { - $valuePrototypeClosures = $valuePrototype->normalizationClosures; - $valuePrototype->normalizationClosures = \is_array($valuePrototypeClosures) ? array_merge($originalClosures, $valuePrototypeClosures) : $originalClosures; - } - $this->valuePrototypes[$k] = $valuePrototype; - } - } - } - - if (\array_key_exists($k, $normalized)) { - $ex = new DuplicateKeyException(sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath())); - $ex->setPath($this->getPath()); - - throw $ex; - } - } - - $prototype = $this->getPrototypeForChild($k); - if (null !== $this->keyAttribute || !$isList) { - $normalized[$k] = $prototype->normalize($v); - } else { - $normalized[] = $prototype->normalize($v); - } - } - - return $normalized; - } - - protected function mergeValues(mixed $leftSide, mixed $rightSide): mixed - { - if (false === $rightSide) { - // if this is still false after the last config has been merged the - // finalization pass will take care of removing this key entirely - return false; - } - - if (false === $leftSide || !$this->performDeepMerging) { - return $rightSide; - } - - $isList = array_is_list($rightSide); - foreach ($rightSide as $k => $v) { - // prototype, and key is irrelevant there are no named keys, append the element - if (null === $this->keyAttribute && $isList) { - $leftSide[] = $v; - continue; - } - - // no conflict - if (!\array_key_exists($k, $leftSide)) { - if (!$this->allowNewKeys) { - $ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file.', $this->getPath())); - $ex->setPath($this->getPath()); - - throw $ex; - } - - $leftSide[$k] = $v; - continue; - } - - $prototype = $this->getPrototypeForChild($k); - $leftSide[$k] = $prototype->merge($leftSide[$k], $v); - } - - return $leftSide; - } - - /** - * Returns a prototype for the child node that is associated to $key in the value array. - * For general child nodes, this will be $this->prototype. - * But if $this->removeKeyAttribute is true and there are only two keys in the child node: - * one is same as this->keyAttribute and the other is 'value', then the prototype will be different. - * - * For example, assume $this->keyAttribute is 'name' and the value array is as follows: - * - * [ - * [ - * 'name' => 'name001', - * 'value' => 'value001' - * ] - * ] - * - * Now, the key is 0 and the child node is: - * - * [ - * 'name' => 'name001', - * 'value' => 'value001' - * ] - * - * When normalizing the value array, the 'name' element will removed from the child node - * and its value becomes the new key of the child node: - * - * [ - * 'name001' => ['value' => 'value001'] - * ] - * - * Now only 'value' element is left in the child node which can be further simplified into a string: - * - * ['name001' => 'value001'] - * - * Now, the key becomes 'name001' and the child node becomes 'value001' and - * the prototype of child node 'name001' should be a ScalarNode instead of an ArrayNode instance. - */ - private function getPrototypeForChild(string $key): mixed - { - $prototype = $this->valuePrototypes[$key] ?? $this->prototype; - $prototype->setName($key); - - return $prototype; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/ScalarNode.php b/tests/integration/vendor/symfony/config/Definition/ScalarNode.php deleted file mode 100644 index e11fa1e..0000000 --- a/tests/integration/vendor/symfony/config/Definition/ScalarNode.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidTypeException; - -/** - * This node represents a scalar value in the config tree. - * - * The following values are considered scalars: - * * booleans - * * strings - * * null - * * integers - * * floats - * - * @author Johannes M. Schmitt - */ -class ScalarNode extends VariableNode -{ - /** - * @return void - */ - protected function validateType(mixed $value) - { - if (!\is_scalar($value) && null !== $value) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected "scalar", but got "%s".', $this->getPath(), get_debug_type($value))); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - } - - protected function isValueEmpty(mixed $value): bool - { - // assume environment variables are never empty (which in practice is likely to be true during runtime) - // not doing so breaks many configs that are valid today - if ($this->isHandlingPlaceholder()) { - return false; - } - - return null === $value || '' === $value; - } - - protected function getValidPlaceholderTypes(): array - { - return ['bool', 'int', 'float', 'string']; - } -} diff --git a/tests/integration/vendor/symfony/config/Definition/VariableNode.php b/tests/integration/vendor/symfony/config/Definition/VariableNode.php deleted file mode 100644 index 6bdc65b..0000000 --- a/tests/integration/vendor/symfony/config/Definition/VariableNode.php +++ /dev/null @@ -1,128 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Definition; - -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; - -/** - * This node represents a value of variable type in the config tree. - * - * This node is intended for values of arbitrary type. - * Any PHP type is accepted as a value. - * - * @author Jeremy Mikola - */ -class VariableNode extends BaseNode implements PrototypeNodeInterface -{ - protected $defaultValueSet = false; - protected $defaultValue; - protected $allowEmptyValue = true; - - /** - * @return void - */ - public function setDefaultValue(mixed $value) - { - $this->defaultValueSet = true; - $this->defaultValue = $value; - } - - public function hasDefaultValue(): bool - { - return $this->defaultValueSet; - } - - public function getDefaultValue(): mixed - { - $v = $this->defaultValue; - - return $v instanceof \Closure ? $v() : $v; - } - - /** - * Sets if this node is allowed to have an empty value. - * - * @param bool $boolean True if this entity will accept empty values - * - * @return void - */ - public function setAllowEmptyValue(bool $boolean) - { - $this->allowEmptyValue = $boolean; - } - - /** - * @return void - */ - public function setName(string $name) - { - $this->name = $name; - } - - /** - * @return void - */ - protected function validateType(mixed $value) - { - } - - protected function finalizeValue(mixed $value): mixed - { - // deny environment variables only when using custom validators - // this avoids ever passing an empty value to final validation closures - if (!$this->allowEmptyValue && $this->isHandlingPlaceholder() && $this->finalValidationClosures) { - $e = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an environment variable when empty values are not allowed by definition and are validated.', $this->getPath())); - if ($hint = $this->getInfo()) { - $e->addHint($hint); - } - $e->setPath($this->getPath()); - - throw $e; - } - - if (!$this->allowEmptyValue && $this->isValueEmpty($value)) { - $ex = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath(), json_encode($value))); - if ($hint = $this->getInfo()) { - $ex->addHint($hint); - } - $ex->setPath($this->getPath()); - - throw $ex; - } - - return $value; - } - - protected function normalizeValue(mixed $value): mixed - { - return $value; - } - - protected function mergeValues(mixed $leftSide, mixed $rightSide): mixed - { - return $rightSide; - } - - /** - * Evaluates if the given value is to be treated as empty. - * - * By default, PHP's empty() function is used to test for emptiness. This - * method may be overridden by subtypes to better match their understanding - * of empty data. - * - * @see finalizeValue() - */ - protected function isValueEmpty(mixed $value): bool - { - return empty($value); - } -} diff --git a/tests/integration/vendor/symfony/config/Exception/FileLoaderImportCircularReferenceException.php b/tests/integration/vendor/symfony/config/Exception/FileLoaderImportCircularReferenceException.php deleted file mode 100644 index da0b55b..0000000 --- a/tests/integration/vendor/symfony/config/Exception/FileLoaderImportCircularReferenceException.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Exception; - -/** - * Exception class for when a circular reference is detected when importing resources. - * - * @author Fabien Potencier - */ -class FileLoaderImportCircularReferenceException extends LoaderLoadException -{ - public function __construct(array $resources, int $code = 0, \Throwable $previous = null) - { - $message = sprintf('Circular reference detected in "%s" ("%s" > "%s").', $this->varToString($resources[0]), implode('" > "', $resources), $resources[0]); - - \Exception::__construct($message, $code, $previous); - } -} diff --git a/tests/integration/vendor/symfony/config/Exception/FileLocatorFileNotFoundException.php b/tests/integration/vendor/symfony/config/Exception/FileLocatorFileNotFoundException.php deleted file mode 100644 index c5173ae..0000000 --- a/tests/integration/vendor/symfony/config/Exception/FileLocatorFileNotFoundException.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Exception; - -/** - * File locator exception if a file does not exist. - * - * @author Leo Feyer - */ -class FileLocatorFileNotFoundException extends \InvalidArgumentException -{ - private array $paths; - - public function __construct(string $message = '', int $code = 0, \Throwable $previous = null, array $paths = []) - { - parent::__construct($message, $code, $previous); - - $this->paths = $paths; - } - - /** - * @return array - */ - public function getPaths() - { - return $this->paths; - } -} diff --git a/tests/integration/vendor/symfony/config/FileLocator.php b/tests/integration/vendor/symfony/config/FileLocator.php deleted file mode 100644 index e147d9b..0000000 --- a/tests/integration/vendor/symfony/config/FileLocator.php +++ /dev/null @@ -1,94 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; - -/** - * FileLocator uses an array of pre-defined paths to find files. - * - * @author Fabien Potencier - */ -class FileLocator implements FileLocatorInterface -{ - protected $paths; - - /** - * @param string|string[] $paths A path or an array of paths where to look for resources - */ - public function __construct(string|array $paths = []) - { - $this->paths = (array) $paths; - } - - /** - * @return string|array - */ - public function locate(string $name, string $currentPath = null, bool $first = true) - { - if ('' === $name) { - throw new \InvalidArgumentException('An empty file name is not valid to be located.'); - } - - if ($this->isAbsolutePath($name)) { - if (!file_exists($name)) { - throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist.', $name), 0, null, [$name]); - } - - return $name; - } - - $paths = $this->paths; - - if (null !== $currentPath) { - array_unshift($paths, $currentPath); - } - - $paths = array_unique($paths); - $filepaths = $notfound = []; - - foreach ($paths as $path) { - if (@file_exists($file = $path.\DIRECTORY_SEPARATOR.$name)) { - if (true === $first) { - return $file; - } - $filepaths[] = $file; - } else { - $notfound[] = $file; - } - } - - if (!$filepaths) { - throw new FileLocatorFileNotFoundException(sprintf('The file "%s" does not exist (in: "%s").', $name, implode('", "', $paths)), 0, null, $notfound); - } - - return $filepaths; - } - - /** - * Returns whether the file path is an absolute path. - */ - private function isAbsolutePath(string $file): bool - { - if ('/' === $file[0] || '\\' === $file[0] - || (\strlen($file) > 3 && ctype_alpha($file[0]) - && ':' === $file[1] - && ('\\' === $file[2] || '/' === $file[2]) - ) - || null !== parse_url($file, \PHP_URL_SCHEME) - ) { - return true; - } - - return false; - } -} diff --git a/tests/integration/vendor/symfony/config/FileLocatorInterface.php b/tests/integration/vendor/symfony/config/FileLocatorInterface.php deleted file mode 100644 index e3ca1d4..0000000 --- a/tests/integration/vendor/symfony/config/FileLocatorInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; - -/** - * @author Fabien Potencier - */ -interface FileLocatorInterface -{ - /** - * Returns a full path for a given file name. - * - * @param string $name The file name to locate - * @param string|null $currentPath The current path - * @param bool $first Whether to return the first occurrence or an array of filenames - * - * @return string|array The full path to the file or an array of file paths - * - * @throws \InvalidArgumentException If $name is empty - * @throws FileLocatorFileNotFoundException If a file is not found - */ - public function locate(string $name, string $currentPath = null, bool $first = true); -} diff --git a/tests/integration/vendor/symfony/config/LICENSE b/tests/integration/vendor/symfony/config/LICENSE deleted file mode 100644 index 0138f8f..0000000 --- a/tests/integration/vendor/symfony/config/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-present Fabien Potencier - -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. diff --git a/tests/integration/vendor/symfony/config/Loader/DelegatingLoader.php b/tests/integration/vendor/symfony/config/Loader/DelegatingLoader.php deleted file mode 100644 index fac3724..0000000 --- a/tests/integration/vendor/symfony/config/Loader/DelegatingLoader.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -use Symfony\Component\Config\Exception\LoaderLoadException; - -/** - * DelegatingLoader delegates loading to other loaders using a loader resolver. - * - * This loader acts as an array of LoaderInterface objects - each having - * a chance to load a given resource (handled by the resolver) - * - * @author Fabien Potencier - */ -class DelegatingLoader extends Loader -{ - public function __construct(LoaderResolverInterface $resolver) - { - $this->resolver = $resolver; - } - - public function load(mixed $resource, string $type = null): mixed - { - if (false === $loader = $this->resolver->resolve($resource, $type)) { - throw new LoaderLoadException($resource, null, 0, null, $type); - } - - return $loader->load($resource, $type); - } - - public function supports(mixed $resource, string $type = null): bool - { - return false !== $this->resolver->resolve($resource, $type); - } -} diff --git a/tests/integration/vendor/symfony/config/Loader/FileLoader.php b/tests/integration/vendor/symfony/config/Loader/FileLoader.php deleted file mode 100644 index 8cfaa23..0000000 --- a/tests/integration/vendor/symfony/config/Loader/FileLoader.php +++ /dev/null @@ -1,188 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException; -use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; -use Symfony\Component\Config\Exception\LoaderLoadException; -use Symfony\Component\Config\FileLocatorInterface; -use Symfony\Component\Config\Resource\FileExistenceResource; -use Symfony\Component\Config\Resource\GlobResource; - -/** - * FileLoader is the abstract class used by all built-in loaders that are file based. - * - * @author Fabien Potencier - */ -abstract class FileLoader extends Loader -{ - protected static $loading = []; - - protected $locator; - - private ?string $currentDir = null; - - public function __construct(FileLocatorInterface $locator, string $env = null) - { - $this->locator = $locator; - parent::__construct($env); - } - - /** - * Sets the current directory. - * - * @return void - */ - public function setCurrentDir(string $dir) - { - $this->currentDir = $dir; - } - - /** - * Returns the file locator used by this loader. - */ - public function getLocator(): FileLocatorInterface - { - return $this->locator; - } - - /** - * Imports a resource. - * - * @param mixed $resource A Resource - * @param string|null $type The resource type or null if unknown - * @param bool $ignoreErrors Whether to ignore import errors or not - * @param string|null $sourceResource The original resource importing the new resource - * @param string|string[]|null $exclude Glob patterns to exclude from the import - * - * @return mixed - * - * @throws LoaderLoadException - * @throws FileLoaderImportCircularReferenceException - * @throws FileLocatorFileNotFoundException - */ - public function import(mixed $resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null, string|array $exclude = null) - { - if (\is_string($resource) && \strlen($resource) !== ($i = strcspn($resource, '*?{[')) && !str_contains($resource, "\n")) { - $excluded = []; - foreach ((array) $exclude as $pattern) { - foreach ($this->glob($pattern, true, $_, false, true) as $path => $info) { - // normalize Windows slashes and remove trailing slashes - $excluded[rtrim(str_replace('\\', '/', $path), '/')] = true; - } - } - - $ret = []; - $isSubpath = 0 !== $i && str_contains(substr($resource, 0, $i), '/'); - foreach ($this->glob($resource, false, $_, $ignoreErrors || !$isSubpath, false, $excluded) as $path => $info) { - if (null !== $res = $this->doImport($path, 'glob' === $type ? null : $type, $ignoreErrors, $sourceResource)) { - $ret[] = $res; - } - $isSubpath = true; - } - - if ($isSubpath) { - return isset($ret[1]) ? $ret : ($ret[0] ?? null); - } - } - - return $this->doImport($resource, $type, $ignoreErrors, $sourceResource); - } - - /** - * @internal - */ - protected function glob(string $pattern, bool $recursive, array|GlobResource &$resource = null, bool $ignoreErrors = false, bool $forExclusion = false, array $excluded = []): iterable - { - if (\strlen($pattern) === $i = strcspn($pattern, '*?{[')) { - $prefix = $pattern; - $pattern = ''; - } elseif (0 === $i || !str_contains(substr($pattern, 0, $i), '/')) { - $prefix = '.'; - $pattern = '/'.$pattern; - } else { - $prefix = \dirname(substr($pattern, 0, 1 + $i)); - $pattern = substr($pattern, \strlen($prefix)); - } - - try { - $prefix = $this->locator->locate($prefix, $this->currentDir, true); - } catch (FileLocatorFileNotFoundException $e) { - if (!$ignoreErrors) { - throw $e; - } - - $resource = []; - foreach ($e->getPaths() as $path) { - $resource[] = new FileExistenceResource($path); - } - - return; - } - $resource = new GlobResource($prefix, $pattern, $recursive, $forExclusion, $excluded); - - yield from $resource; - } - - private function doImport(mixed $resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null): mixed - { - try { - $loader = $this->resolve($resource, $type); - - if ($loader instanceof DirectoryAwareLoaderInterface) { - $loader = $loader->forDirectory($this->currentDir); - } - - if (!$loader instanceof self) { - return $loader->load($resource, $type); - } - - if (null !== $this->currentDir) { - $resource = $loader->getLocator()->locate($resource, $this->currentDir, false); - } - - $resources = \is_array($resource) ? $resource : [$resource]; - for ($i = 0; $i < $resourcesCount = \count($resources); ++$i) { - if (isset(self::$loading[$resources[$i]])) { - if ($i == $resourcesCount - 1) { - throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading)); - } - } else { - $resource = $resources[$i]; - break; - } - } - self::$loading[$resource] = true; - - try { - $ret = $loader->load($resource, $type); - } finally { - unset(self::$loading[$resource]); - } - - return $ret; - } catch (FileLoaderImportCircularReferenceException $e) { - throw $e; - } catch (\Exception $e) { - if (!$ignoreErrors) { - // prevent embedded imports from nesting multiple exceptions - if ($e instanceof LoaderLoadException) { - throw $e; - } - - throw new LoaderLoadException($resource, $sourceResource, 0, $e, $type); - } - } - - return null; - } -} diff --git a/tests/integration/vendor/symfony/config/Loader/GlobFileLoader.php b/tests/integration/vendor/symfony/config/Loader/GlobFileLoader.php deleted file mode 100644 index f921ec5..0000000 --- a/tests/integration/vendor/symfony/config/Loader/GlobFileLoader.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -/** - * GlobFileLoader loads files from a glob pattern. - * - * @author Fabien Potencier - */ -class GlobFileLoader extends FileLoader -{ - public function load(mixed $resource, string $type = null): mixed - { - return $this->import($resource); - } - - public function supports(mixed $resource, string $type = null): bool - { - return 'glob' === $type; - } -} diff --git a/tests/integration/vendor/symfony/config/Loader/Loader.php b/tests/integration/vendor/symfony/config/Loader/Loader.php deleted file mode 100644 index 36e85ad..0000000 --- a/tests/integration/vendor/symfony/config/Loader/Loader.php +++ /dev/null @@ -1,73 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -use Symfony\Component\Config\Exception\LoaderLoadException; - -/** - * Loader is the abstract class used by all built-in loaders. - * - * @author Fabien Potencier - */ -abstract class Loader implements LoaderInterface -{ - protected $resolver; - protected $env; - - public function __construct(string $env = null) - { - $this->env = $env; - } - - public function getResolver(): LoaderResolverInterface - { - return $this->resolver; - } - - /** - * @return void - */ - public function setResolver(LoaderResolverInterface $resolver) - { - $this->resolver = $resolver; - } - - /** - * Imports a resource. - * - * @return mixed - */ - public function import(mixed $resource, string $type = null) - { - return $this->resolve($resource, $type)->load($resource, $type); - } - - /** - * Finds a loader able to load an imported resource. - * - * @throws LoaderLoadException If no loader is found - */ - public function resolve(mixed $resource, string $type = null): LoaderInterface - { - if ($this->supports($resource, $type)) { - return $this; - } - - $loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type); - - if (false === $loader) { - throw new LoaderLoadException($resource, null, 0, null, $type); - } - - return $loader; - } -} diff --git a/tests/integration/vendor/symfony/config/Loader/LoaderInterface.php b/tests/integration/vendor/symfony/config/Loader/LoaderInterface.php deleted file mode 100644 index 4e0746d..0000000 --- a/tests/integration/vendor/symfony/config/Loader/LoaderInterface.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -/** - * LoaderInterface is the interface implemented by all loader classes. - * - * @author Fabien Potencier - */ -interface LoaderInterface -{ - /** - * Loads a resource. - * - * @return mixed - * - * @throws \Exception If something went wrong - */ - public function load(mixed $resource, string $type = null); - - /** - * Returns whether this class supports the given resource. - * - * @param mixed $resource A resource - * - * @return bool - */ - public function supports(mixed $resource, string $type = null); - - /** - * Gets the loader resolver. - * - * @return LoaderResolverInterface - */ - public function getResolver(); - - /** - * Sets the loader resolver. - * - * @return void - */ - public function setResolver(LoaderResolverInterface $resolver); -} diff --git a/tests/integration/vendor/symfony/config/Loader/LoaderResolver.php b/tests/integration/vendor/symfony/config/Loader/LoaderResolver.php deleted file mode 100644 index 670e320..0000000 --- a/tests/integration/vendor/symfony/config/Loader/LoaderResolver.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -/** - * LoaderResolver selects a loader for a given resource. - * - * A resource can be anything (e.g. a full path to a config file or a Closure). - * Each loader determines whether it can load a resource and how. - * - * @author Fabien Potencier - */ -class LoaderResolver implements LoaderResolverInterface -{ - /** - * @var LoaderInterface[] An array of LoaderInterface objects - */ - private array $loaders = []; - - /** - * @param LoaderInterface[] $loaders An array of loaders - */ - public function __construct(array $loaders = []) - { - foreach ($loaders as $loader) { - $this->addLoader($loader); - } - } - - public function resolve(mixed $resource, string $type = null): LoaderInterface|false - { - foreach ($this->loaders as $loader) { - if ($loader->supports($resource, $type)) { - return $loader; - } - } - - return false; - } - - /** - * @return void - */ - public function addLoader(LoaderInterface $loader) - { - $this->loaders[] = $loader; - $loader->setResolver($this); - } - - /** - * Returns the registered loaders. - * - * @return LoaderInterface[] - */ - public function getLoaders(): array - { - return $this->loaders; - } -} diff --git a/tests/integration/vendor/symfony/config/Loader/LoaderResolverInterface.php b/tests/integration/vendor/symfony/config/Loader/LoaderResolverInterface.php deleted file mode 100644 index 076c520..0000000 --- a/tests/integration/vendor/symfony/config/Loader/LoaderResolverInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Loader; - -/** - * LoaderResolverInterface selects a loader for a given resource. - * - * @author Fabien Potencier - */ -interface LoaderResolverInterface -{ - /** - * Returns a loader able to load the resource. - * - * @param string|null $type The resource type or null if unknown - */ - public function resolve(mixed $resource, string $type = null): LoaderInterface|false; -} diff --git a/tests/integration/vendor/symfony/config/README.md b/tests/integration/vendor/symfony/config/README.md deleted file mode 100644 index 10c2ddd..0000000 --- a/tests/integration/vendor/symfony/config/README.md +++ /dev/null @@ -1,15 +0,0 @@ -Config Component -================ - -The Config component helps find, load, combine, autofill and validate -configuration values of any kind, whatever their source may be (YAML, XML, INI -files, or for instance a database). - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/config.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/tests/integration/vendor/symfony/config/Resource/ClassExistenceResource.php b/tests/integration/vendor/symfony/config/Resource/ClassExistenceResource.php deleted file mode 100644 index 2f262ba..0000000 --- a/tests/integration/vendor/symfony/config/Resource/ClassExistenceResource.php +++ /dev/null @@ -1,227 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * ClassExistenceResource represents a class existence. - * Freshness is only evaluated against resource existence. - * - * The resource must be a fully-qualified class name. - * - * @author Fabien Potencier - * - * @final - */ -class ClassExistenceResource implements SelfCheckingResourceInterface -{ - private string $resource; - private ?array $exists = null; - - private static int $autoloadLevel = 0; - private static ?string $autoloadedClass = null; - private static array $existsCache = []; - - /** - * @param string $resource The fully-qualified class name - * @param bool|null $exists Boolean when the existence check has already been done - */ - public function __construct(string $resource, bool $exists = null) - { - $this->resource = $resource; - if (null !== $exists) { - $this->exists = [$exists, null]; - } - } - - public function __toString(): string - { - return $this->resource; - } - - public function getResource(): string - { - return $this->resource; - } - - /** - * @throws \ReflectionException when a parent class/interface/trait is not found - */ - public function isFresh(int $timestamp): bool - { - $loaded = class_exists($this->resource, false) || interface_exists($this->resource, false) || trait_exists($this->resource, false); - - if (null !== $exists = &self::$existsCache[$this->resource]) { - if ($loaded) { - $exists = [true, null]; - } elseif (0 >= $timestamp && !$exists[0] && null !== $exists[1]) { - throw new \ReflectionException($exists[1]); - } - } elseif ([false, null] === $exists = [$loaded, null]) { - if (!self::$autoloadLevel++) { - spl_autoload_register(__CLASS__.'::throwOnRequiredClass'); - } - $autoloadedClass = self::$autoloadedClass; - self::$autoloadedClass = ltrim($this->resource, '\\'); - - try { - $exists[0] = class_exists($this->resource) || interface_exists($this->resource, false) || trait_exists($this->resource, false); - } catch (\Exception $e) { - $exists[1] = $e->getMessage(); - - try { - self::throwOnRequiredClass($this->resource, $e); - } catch (\ReflectionException $e) { - if (0 >= $timestamp) { - throw $e; - } - } - } catch (\Throwable $e) { - $exists[1] = $e->getMessage(); - - throw $e; - } finally { - self::$autoloadedClass = $autoloadedClass; - if (!--self::$autoloadLevel) { - spl_autoload_unregister(__CLASS__.'::throwOnRequiredClass'); - } - } - } - - $this->exists ??= $exists; - - return $this->exists[0] xor !$exists[0]; - } - - /** - * @internal - */ - public function __sleep(): array - { - if (null === $this->exists) { - $this->isFresh(0); - } - - return ['resource', 'exists']; - } - - /** - * @internal - */ - public function __wakeup() - { - if (\is_bool($this->exists)) { - $this->exists = [$this->exists, null]; - } - } - - /** - * Throws a reflection exception when the passed class does not exist but is required. - * - * A class is considered "not required" when it's loaded as part of a "class_exists" or similar check. - * - * This function can be used as an autoload function to throw a reflection - * exception if the class was not found by previous autoload functions. - * - * A previous exception can be passed. In this case, the class is considered as being - * required totally, so if it doesn't exist, a reflection exception is always thrown. - * If it exists, the previous exception is rethrown. - * - * @throws \ReflectionException - * - * @internal - */ - public static function throwOnRequiredClass(string $class, \Exception $previous = null): void - { - // If the passed class is the resource being checked, we shouldn't throw. - if (null === $previous && self::$autoloadedClass === $class) { - return; - } - - if (class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) { - if (null !== $previous) { - throw $previous; - } - - return; - } - - if ($previous instanceof \ReflectionException) { - throw $previous; - } - - $message = sprintf('Class "%s" not found.', $class); - - if ($class !== (self::$autoloadedClass ?? $class)) { - $message = substr_replace($message, sprintf(' while loading "%s"', self::$autoloadedClass), -1, 0); - } - - if (null !== $previous) { - $message = $previous->getMessage(); - } - - $e = new \ReflectionException($message, 0, $previous); - - if (null !== $previous) { - throw $e; - } - - $trace = debug_backtrace(); - $autoloadFrame = [ - 'function' => 'spl_autoload_call', - 'args' => [$class], - ]; - - if (isset($trace[1])) { - $callerFrame = $trace[1]; - $i = 2; - } elseif (false !== $i = array_search($autoloadFrame, $trace, true)) { - $callerFrame = $trace[++$i]; - } else { - throw $e; - } - - if (isset($callerFrame['function']) && !isset($callerFrame['class'])) { - switch ($callerFrame['function']) { - case 'get_class_methods': - case 'get_class_vars': - case 'get_parent_class': - case 'is_a': - case 'is_subclass_of': - case 'class_exists': - case 'class_implements': - case 'class_parents': - case 'trait_exists': - case 'defined': - case 'interface_exists': - case 'method_exists': - case 'property_exists': - case 'is_callable': - return; - } - - $props = [ - 'file' => $callerFrame['file'] ?? null, - 'line' => $callerFrame['line'] ?? null, - 'trace' => \array_slice($trace, 1 + $i), - ]; - - foreach ($props as $p => $v) { - if (null !== $v) { - $r = new \ReflectionProperty(\Exception::class, $p); - $r->setValue($e, $v); - } - } - } - - throw $e; - } -} diff --git a/tests/integration/vendor/symfony/config/Resource/ComposerResource.php b/tests/integration/vendor/symfony/config/Resource/ComposerResource.php deleted file mode 100644 index 8348122..0000000 --- a/tests/integration/vendor/symfony/config/Resource/ComposerResource.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * ComposerResource tracks the PHP version and Composer dependencies. - * - * @author Nicolas Grekas - * - * @final - */ -class ComposerResource implements SelfCheckingResourceInterface -{ - private array $vendors; - - private static array $runtimeVendors; - - public function __construct() - { - self::refresh(); - $this->vendors = self::$runtimeVendors; - } - - public function getVendors(): array - { - return array_keys($this->vendors); - } - - public function __toString(): string - { - return __CLASS__; - } - - public function isFresh(int $timestamp): bool - { - self::refresh(); - - return array_values(self::$runtimeVendors) === array_values($this->vendors); - } - - private static function refresh(): void - { - self::$runtimeVendors = []; - - foreach (get_declared_classes() as $class) { - if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) { - $r = new \ReflectionClass($class); - $v = \dirname($r->getFileName(), 2); - if (is_file($v.'/composer/installed.json')) { - self::$runtimeVendors[$v] = @filemtime($v.'/composer/installed.json'); - } - } - } - } -} diff --git a/tests/integration/vendor/symfony/config/Resource/DirectoryResource.php b/tests/integration/vendor/symfony/config/Resource/DirectoryResource.php deleted file mode 100644 index 7560cd3..0000000 --- a/tests/integration/vendor/symfony/config/Resource/DirectoryResource.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * DirectoryResource represents a resources stored in a subdirectory tree. - * - * @author Fabien Potencier - * - * @final - */ -class DirectoryResource implements SelfCheckingResourceInterface -{ - private string $resource; - private ?string $pattern; - - /** - * @param string $resource The file path to the resource - * @param string|null $pattern A pattern to restrict monitored files - * - * @throws \InvalidArgumentException - */ - public function __construct(string $resource, string $pattern = null) - { - $resolvedResource = realpath($resource) ?: (file_exists($resource) ? $resource : false); - $this->pattern = $pattern; - - if (false === $resolvedResource || !is_dir($resolvedResource)) { - throw new \InvalidArgumentException(sprintf('The directory "%s" does not exist.', $resource)); - } - - $this->resource = $resolvedResource; - } - - public function __toString(): string - { - return hash('xxh128', serialize([$this->resource, $this->pattern])); - } - - public function getResource(): string - { - return $this->resource; - } - - public function getPattern(): ?string - { - return $this->pattern; - } - - public function isFresh(int $timestamp): bool - { - if (!is_dir($this->resource)) { - return false; - } - - if ($timestamp < filemtime($this->resource)) { - return false; - } - - foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) { - // if regex filtering is enabled only check matching files - if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) { - continue; - } - - // always monitor directories for changes, except the .. entries - // (otherwise deleted files wouldn't get detected) - if ($file->isDir() && str_ends_with($file, '/..')) { - continue; - } - - // for broken links - try { - $fileMTime = $file->getMTime(); - } catch (\RuntimeException) { - continue; - } - - // early return if a file's mtime exceeds the passed timestamp - if ($timestamp < $fileMTime) { - return false; - } - } - - return true; - } -} diff --git a/tests/integration/vendor/symfony/config/Resource/FileExistenceResource.php b/tests/integration/vendor/symfony/config/Resource/FileExistenceResource.php deleted file mode 100644 index e7b91ff..0000000 --- a/tests/integration/vendor/symfony/config/Resource/FileExistenceResource.php +++ /dev/null @@ -1,53 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * FileExistenceResource represents a resource stored on the filesystem. - * Freshness is only evaluated against resource creation or deletion. - * - * The resource can be a file or a directory. - * - * @author Charles-Henri Bruyand - * - * @final - */ -class FileExistenceResource implements SelfCheckingResourceInterface -{ - private string $resource; - - private bool $exists; - - /** - * @param string $resource The file path to the resource - */ - public function __construct(string $resource) - { - $this->resource = $resource; - $this->exists = file_exists($resource); - } - - public function __toString(): string - { - return $this->resource; - } - - public function getResource(): string - { - return $this->resource; - } - - public function isFresh(int $timestamp): bool - { - return file_exists($this->resource) === $this->exists; - } -} diff --git a/tests/integration/vendor/symfony/config/Resource/FileResource.php b/tests/integration/vendor/symfony/config/Resource/FileResource.php deleted file mode 100644 index 6e8f9bd..0000000 --- a/tests/integration/vendor/symfony/config/Resource/FileResource.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * FileResource represents a resource stored on the filesystem. - * - * The resource can be a file or a directory. - * - * @author Fabien Potencier - * - * @final - */ -class FileResource implements SelfCheckingResourceInterface -{ - private string $resource; - - /** - * @param string $resource The file path to the resource - * - * @throws \InvalidArgumentException - */ - public function __construct(string $resource) - { - $resolvedResource = realpath($resource) ?: (file_exists($resource) ? $resource : false); - - if (false === $resolvedResource) { - throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $resource)); - } - - $this->resource = $resolvedResource; - } - - public function __toString(): string - { - return $this->resource; - } - - /** - * Returns the canonicalized, absolute path to the resource. - */ - public function getResource(): string - { - return $this->resource; - } - - public function isFresh(int $timestamp): bool - { - return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp; - } -} diff --git a/tests/integration/vendor/symfony/config/Resource/GlobResource.php b/tests/integration/vendor/symfony/config/Resource/GlobResource.php deleted file mode 100644 index 2aedc84..0000000 --- a/tests/integration/vendor/symfony/config/Resource/GlobResource.php +++ /dev/null @@ -1,249 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -use Symfony\Component\Finder\Finder; -use Symfony\Component\Finder\Glob; - -/** - * GlobResource represents a set of resources stored on the filesystem. - * - * Only existence/removal is tracked (not mtimes.) - * - * @author Nicolas Grekas - * - * @final - * - * @implements \IteratorAggregate - */ -class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface -{ - private string $prefix; - private string $pattern; - private bool $recursive; - private string $hash; - private bool $forExclusion; - private array $excludedPrefixes; - private int $globBrace; - - /** - * @param string $prefix A directory prefix - * @param string $pattern A glob pattern - * @param bool $recursive Whether directories should be scanned recursively or not - * - * @throws \InvalidArgumentException - */ - public function __construct(string $prefix, string $pattern, bool $recursive, bool $forExclusion = false, array $excludedPrefixes = []) - { - ksort($excludedPrefixes); - $resolvedPrefix = realpath($prefix) ?: (file_exists($prefix) ? $prefix : false); - $this->pattern = $pattern; - $this->recursive = $recursive; - $this->forExclusion = $forExclusion; - $this->excludedPrefixes = $excludedPrefixes; - $this->globBrace = \defined('GLOB_BRACE') ? \GLOB_BRACE : 0; - - if (false === $resolvedPrefix) { - throw new \InvalidArgumentException(sprintf('The path "%s" does not exist.', $prefix)); - } - - $this->prefix = $resolvedPrefix; - } - - public function getPrefix(): string - { - return $this->prefix; - } - - public function __toString(): string - { - return 'glob.'.$this->prefix.(int) $this->recursive.$this->pattern.(int) $this->forExclusion.implode("\0", $this->excludedPrefixes); - } - - public function isFresh(int $timestamp): bool - { - $hash = $this->computeHash(); - $this->hash ??= $hash; - - return $this->hash === $hash; - } - - /** - * @internal - */ - public function __sleep(): array - { - $this->hash ??= $this->computeHash(); - - return ['prefix', 'pattern', 'recursive', 'hash', 'forExclusion', 'excludedPrefixes']; - } - - /** - * @internal - */ - public function __wakeup(): void - { - $this->globBrace = \defined('GLOB_BRACE') ? \GLOB_BRACE : 0; - } - - public function getIterator(): \Traversable - { - if ((!$this->recursive && '' === $this->pattern) || !file_exists($this->prefix)) { - return; - } - - if (is_file($prefix = str_replace('\\', '/', $this->prefix))) { - $prefix = \dirname($prefix); - $pattern = basename($prefix).$this->pattern; - } else { - $pattern = $this->pattern; - } - - if (class_exists(Finder::class)) { - $regex = Glob::toRegex($pattern); - if ($this->recursive) { - $regex = substr_replace($regex, '(/|$)', -2, 1); - } - } else { - $regex = null; - } - - $prefixLen = \strlen($prefix); - $paths = null; - - if ('' === $this->pattern && is_file($this->prefix)) { - $paths = [$this->prefix => null]; - } elseif (!str_starts_with($this->prefix, 'phar://') && (null !== $regex || !str_contains($this->pattern, '/**/'))) { - if (!str_contains($this->pattern, '/**/') && ($this->globBrace || !str_contains($this->pattern, '{'))) { - $paths = array_fill_keys(glob($this->prefix.$this->pattern, \GLOB_NOSORT | $this->globBrace), null); - } elseif (!str_contains($this->pattern, '\\') || !preg_match('/\\\\[,{}]/', $this->pattern)) { - $paths = []; - foreach ($this->expandGlob($this->pattern) as $p) { - if (false !== $i = strpos($p, '/**/')) { - $p = substr_replace($p, '/*', $i); - } - $paths += array_fill_keys(glob($this->prefix.$p, \GLOB_NOSORT), false !== $i ? $regex : null); - } - } - } - - if (null !== $paths) { - uksort($paths, 'strnatcmp'); - foreach ($paths as $path => $regex) { - if ($this->excludedPrefixes) { - $normalizedPath = str_replace('\\', '/', $path); - do { - if (isset($this->excludedPrefixes[$dirPath = $normalizedPath])) { - continue 2; - } - } while ($prefix !== $dirPath && $dirPath !== $normalizedPath = \dirname($dirPath)); - } - - if ((null === $regex || preg_match($regex, substr(str_replace('\\', '/', $path), $prefixLen))) && is_file($path)) { - yield $path => new \SplFileInfo($path); - } - if (!is_dir($path)) { - continue; - } - if ($this->forExclusion && (null === $regex || preg_match($regex, substr(str_replace('\\', '/', $path), $prefixLen)))) { - yield $path => new \SplFileInfo($path); - continue; - } - if (!($this->recursive || null !== $regex) || isset($this->excludedPrefixes[str_replace('\\', '/', $path)])) { - continue; - } - $files = iterator_to_array(new \RecursiveIteratorIterator( - new \RecursiveCallbackFilterIterator( - new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), - fn (\SplFileInfo $file, $path) => !isset($this->excludedPrefixes[$path = str_replace('\\', '/', $path)]) - && (null === $regex || preg_match($regex, substr($path, $prefixLen)) || $file->isDir()) - && '.' !== $file->getBasename()[0] - ), - \RecursiveIteratorIterator::LEAVES_ONLY - )); - uksort($files, 'strnatcmp'); - - foreach ($files as $path => $info) { - if ($info->isFile()) { - yield $path => $info; - } - } - } - - return; - } - - if (!class_exists(Finder::class)) { - throw new \LogicException('Extended glob patterns cannot be used as the Finder component is not installed. Try running "composer require symfony/finder".'); - } - - yield from (new Finder()) - ->followLinks() - ->filter(function (\SplFileInfo $info) use ($regex, $prefixLen, $prefix) { - $normalizedPath = str_replace('\\', '/', $info->getPathname()); - if (!preg_match($regex, substr($normalizedPath, $prefixLen)) || !$info->isFile()) { - return false; - } - if ($this->excludedPrefixes) { - do { - if (isset($this->excludedPrefixes[$dirPath = $normalizedPath])) { - return false; - } - } while ($prefix !== $dirPath && $dirPath !== $normalizedPath = \dirname($dirPath)); - } - }) - ->sortByName() - ->in($prefix) - ; - } - - private function computeHash(): string - { - $hash = hash_init('xxh128'); - - foreach ($this->getIterator() as $path => $info) { - hash_update($hash, $path."\n"); - } - - return hash_final($hash); - } - - private function expandGlob(string $pattern): array - { - $segments = preg_split('/\{([^{}]*+)\}/', $pattern, -1, \PREG_SPLIT_DELIM_CAPTURE); - $paths = [$segments[0]]; - $patterns = []; - - for ($i = 1; $i < \count($segments); $i += 2) { - $patterns = []; - - foreach (explode(',', $segments[$i]) as $s) { - foreach ($paths as $p) { - $patterns[] = $p.$s.$segments[1 + $i]; - } - } - - $paths = $patterns; - } - - $j = 0; - foreach ($patterns as $i => $p) { - if (str_contains($p, '{')) { - $p = $this->expandGlob($p); - array_splice($paths, $i + $j, 1, $p); - $j += \count($p) - 1; - } - } - - return $paths; - } -} diff --git a/tests/integration/vendor/symfony/config/Resource/ReflectionClassResource.php b/tests/integration/vendor/symfony/config/Resource/ReflectionClassResource.php deleted file mode 100644 index dbd47e6..0000000 --- a/tests/integration/vendor/symfony/config/Resource/ReflectionClassResource.php +++ /dev/null @@ -1,206 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\Messenger\Handler\MessageSubscriberInterface; -use Symfony\Contracts\Service\ServiceSubscriberInterface; - -/** - * @author Nicolas Grekas - * - * @final - */ -class ReflectionClassResource implements SelfCheckingResourceInterface -{ - private array $files = []; - private string $className; - private \ReflectionClass $classReflector; - private array $excludedVendors = []; - private string $hash; - - public function __construct(\ReflectionClass $classReflector, array $excludedVendors = []) - { - $this->className = $classReflector->name; - $this->classReflector = $classReflector; - $this->excludedVendors = $excludedVendors; - } - - public function isFresh(int $timestamp): bool - { - if (!isset($this->hash)) { - $this->hash = $this->computeHash(); - $this->loadFiles($this->classReflector); - } - - foreach ($this->files as $file => $v) { - if (false === $filemtime = @filemtime($file)) { - return false; - } - - if ($filemtime > $timestamp) { - return $this->hash === $this->computeHash(); - } - } - - return true; - } - - public function __toString(): string - { - return 'reflection.'.$this->className; - } - - /** - * @internal - */ - public function __sleep(): array - { - if (!isset($this->hash)) { - $this->hash = $this->computeHash(); - $this->loadFiles($this->classReflector); - } - - return ['files', 'className', 'hash']; - } - - private function loadFiles(\ReflectionClass $class): void - { - foreach ($class->getInterfaces() as $v) { - $this->loadFiles($v); - } - do { - $file = $class->getFileName(); - if (false !== $file && is_file($file)) { - foreach ($this->excludedVendors as $vendor) { - if (str_starts_with($file, $vendor) && false !== strpbrk(substr($file, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) { - $file = false; - break; - } - } - if ($file) { - $this->files[$file] = null; - } - } - foreach ($class->getTraits() as $v) { - $this->loadFiles($v); - } - } while ($class = $class->getParentClass()); - } - - private function computeHash(): string - { - try { - $this->classReflector ??= new \ReflectionClass($this->className); - } catch (\ReflectionException) { - // the class does not exist anymore - return false; - } - $hash = hash_init('xxh128'); - - foreach ($this->generateSignature($this->classReflector) as $info) { - hash_update($hash, $info); - } - - return hash_final($hash); - } - - private function generateSignature(\ReflectionClass $class): iterable - { - $attributes = []; - foreach ($class->getAttributes() as $a) { - $attributes[] = [$a->getName(), (string) $a]; - } - yield print_r($attributes, true); - $attributes = []; - - yield $class->getDocComment(); - yield (int) $class->isFinal(); - yield (int) $class->isAbstract(); - - if ($class->isTrait()) { - yield print_r(class_uses($class->name), true); - } else { - yield print_r(class_parents($class->name), true); - yield print_r(class_implements($class->name), true); - yield print_r($class->getConstants(), true); - } - - if (!$class->isInterface()) { - $defaults = $class->getDefaultProperties(); - - foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED) as $p) { - foreach ($p->getAttributes() as $a) { - $attributes[] = [$a->getName(), (string) $a]; - } - yield print_r($attributes, true); - $attributes = []; - - yield $p->getDocComment(); - yield $p->isDefault() ? '' : ''; - yield $p->isPublic() ? 'public' : 'protected'; - yield $p->isStatic() ? 'static' : ''; - yield '$'.$p->name; - yield print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, true); - } - } - - foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) { - foreach ($m->getAttributes() as $a) { - $attributes[] = [$a->getName(), (string) $a]; - } - yield print_r($attributes, true); - $attributes = []; - - $defaults = []; - foreach ($m->getParameters() as $p) { - foreach ($p->getAttributes() as $a) { - $attributes[] = [$a->getName(), (string) $a]; - } - yield print_r($attributes, true); - $attributes = []; - - if (!$p->isDefaultValueAvailable()) { - $defaults[$p->name] = null; - - continue; - } - - $defaults[$p->name] = (string) $p; - } - - yield preg_replace('/^ @@.*/m', '', $m); - yield print_r($defaults, true); - } - - if ($class->isAbstract() || $class->isInterface() || $class->isTrait()) { - return; - } - - if (interface_exists(EventSubscriberInterface::class, false) && $class->isSubclassOf(EventSubscriberInterface::class)) { - yield EventSubscriberInterface::class; - yield print_r($class->name::getSubscribedEvents(), true); - } - - if (interface_exists(MessageSubscriberInterface::class, false) && $class->isSubclassOf(MessageSubscriberInterface::class)) { - yield MessageSubscriberInterface::class; - foreach ($class->name::getHandledMessages() as $key => $value) { - yield $key.print_r($value, true); - } - } - - if (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) { - yield ServiceSubscriberInterface::class; - yield print_r($class->name::getSubscribedServices(), true); - } - } -} diff --git a/tests/integration/vendor/symfony/config/Resource/ResourceInterface.php b/tests/integration/vendor/symfony/config/Resource/ResourceInterface.php deleted file mode 100644 index 4fbe321..0000000 --- a/tests/integration/vendor/symfony/config/Resource/ResourceInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * ResourceInterface is the interface that must be implemented by all Resource classes. - * - * @author Fabien Potencier - */ -interface ResourceInterface -{ - /** - * Returns a string representation of the Resource. - * - * This method is necessary to allow for resource de-duplication, for example by means - * of array_unique(). The string returned need not have a particular meaning, but has - * to be identical for different ResourceInterface instances referring to the same - * resource; and it should be unlikely to collide with that of other, unrelated - * resource instances. - */ - public function __toString(): string; -} diff --git a/tests/integration/vendor/symfony/config/Resource/SelfCheckingResourceChecker.php b/tests/integration/vendor/symfony/config/Resource/SelfCheckingResourceChecker.php deleted file mode 100644 index 5abdbad..0000000 --- a/tests/integration/vendor/symfony/config/Resource/SelfCheckingResourceChecker.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -use Symfony\Component\Config\ResourceCheckerInterface; - -/** - * Resource checker for instances of SelfCheckingResourceInterface. - * - * As these resources perform the actual check themselves, we can provide - * this class as a standard way of validating them. - * - * @author Matthias Pigulla - */ -class SelfCheckingResourceChecker implements ResourceCheckerInterface -{ - // Common shared cache, because this checker can be used in different - // situations. For example, when using the full stack framework, the router - // and the container have their own cache. But they may check the very same - // resources - private static array $cache = []; - - public function supports(ResourceInterface $metadata): bool - { - return $metadata instanceof SelfCheckingResourceInterface; - } - - /** - * @param SelfCheckingResourceInterface $resource - */ - public function isFresh(ResourceInterface $resource, int $timestamp): bool - { - $key = "$resource:$timestamp"; - - return self::$cache[$key] ??= $resource->isFresh($timestamp); - } -} diff --git a/tests/integration/vendor/symfony/config/Resource/SelfCheckingResourceInterface.php b/tests/integration/vendor/symfony/config/Resource/SelfCheckingResourceInterface.php deleted file mode 100644 index 197ff1f..0000000 --- a/tests/integration/vendor/symfony/config/Resource/SelfCheckingResourceInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Resource; - -/** - * Interface for Resources that can check for freshness autonomously, - * without special support from external services. - * - * @author Matthias Pigulla - */ -interface SelfCheckingResourceInterface extends ResourceInterface -{ - /** - * Returns true if the resource has not been updated since the given timestamp. - * - * @param int $timestamp The last time the resource was loaded - */ - public function isFresh(int $timestamp): bool; -} diff --git a/tests/integration/vendor/symfony/config/ResourceCheckerConfigCache.php b/tests/integration/vendor/symfony/config/ResourceCheckerConfigCache.php deleted file mode 100644 index a8478a8..0000000 --- a/tests/integration/vendor/symfony/config/ResourceCheckerConfigCache.php +++ /dev/null @@ -1,181 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -use Symfony\Component\Config\Resource\ResourceInterface; -use Symfony\Component\Filesystem\Exception\IOException; -use Symfony\Component\Filesystem\Filesystem; - -/** - * ResourceCheckerConfigCache uses instances of ResourceCheckerInterface - * to check whether cached data is still fresh. - * - * @author Matthias Pigulla - */ -class ResourceCheckerConfigCache implements ConfigCacheInterface -{ - private string $file; - - /** - * @var iterable - */ - private iterable $resourceCheckers; - - /** - * @param string $file The absolute cache path - * @param iterable $resourceCheckers The ResourceCheckers to use for the freshness check - */ - public function __construct(string $file, iterable $resourceCheckers = []) - { - $this->file = $file; - $this->resourceCheckers = $resourceCheckers; - } - - public function getPath(): string - { - return $this->file; - } - - /** - * Checks if the cache is still fresh. - * - * This implementation will make a decision solely based on the ResourceCheckers - * passed in the constructor. - * - * The first ResourceChecker that supports a given resource is considered authoritative. - * Resources with no matching ResourceChecker will silently be ignored and considered fresh. - */ - public function isFresh(): bool - { - if (!is_file($this->file)) { - return false; - } - - if ($this->resourceCheckers instanceof \Traversable && !$this->resourceCheckers instanceof \Countable) { - $this->resourceCheckers = iterator_to_array($this->resourceCheckers); - } - - if (!\count($this->resourceCheckers)) { - return true; // shortcut - if we don't have any checkers we don't need to bother with the meta file at all - } - - $metadata = $this->getMetaFile(); - - if (!is_file($metadata)) { - return false; - } - - $meta = $this->safelyUnserialize($metadata); - - if (false === $meta) { - return false; - } - - $time = filemtime($this->file); - - foreach ($meta as $resource) { - foreach ($this->resourceCheckers as $checker) { - if (!$checker->supports($resource)) { - continue; // next checker - } - if ($checker->isFresh($resource, $time)) { - break; // no need to further check this resource - } - - return false; // cache is stale - } - // no suitable checker found, ignore this resource - } - - return true; - } - - /** - * Writes cache. - * - * @param string $content The content to write in the cache - * @param ResourceInterface[] $metadata An array of metadata - * - * @return void - * - * @throws \RuntimeException When cache file can't be written - */ - public function write(string $content, array $metadata = null) - { - $mode = 0666; - $umask = umask(); - $filesystem = new Filesystem(); - $filesystem->dumpFile($this->file, $content); - try { - $filesystem->chmod($this->file, $mode, $umask); - } catch (IOException) { - // discard chmod failure (some filesystem may not support it) - } - - if (null !== $metadata) { - $filesystem->dumpFile($this->getMetaFile(), serialize($metadata)); - try { - $filesystem->chmod($this->getMetaFile(), $mode, $umask); - } catch (IOException) { - // discard chmod failure (some filesystem may not support it) - } - } - - if (\function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL)) { - @opcache_invalidate($this->file, true); - } - } - - /** - * Gets the meta file path. - */ - private function getMetaFile(): string - { - return $this->file.'.meta'; - } - - private function safelyUnserialize(string $file): mixed - { - $meta = false; - $content = file_get_contents($file); - $signalingException = new \UnexpectedValueException(); - $prevUnserializeHandler = ini_set('unserialize_callback_func', self::class.'::handleUnserializeCallback'); - $prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$prevErrorHandler, $signalingException) { - if (__FILE__ === $file) { - throw $signalingException; - } - - return $prevErrorHandler ? $prevErrorHandler($type, $msg, $file, $line, $context) : false; - }); - - try { - $meta = unserialize($content); - } catch (\Throwable $e) { - if ($e !== $signalingException) { - throw $e; - } - } finally { - restore_error_handler(); - ini_set('unserialize_callback_func', $prevUnserializeHandler); - } - - return $meta; - } - - /** - * @internal - */ - public static function handleUnserializeCallback(string $class): void - { - trigger_error('Class not found: '.$class); - } -} diff --git a/tests/integration/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php b/tests/integration/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php deleted file mode 100644 index 97d5200..0000000 --- a/tests/integration/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -/** - * A ConfigCacheFactory implementation that validates the - * cache with an arbitrary set of ResourceCheckers. - * - * @author Matthias Pigulla - */ -class ResourceCheckerConfigCacheFactory implements ConfigCacheFactoryInterface -{ - private iterable $resourceCheckers = []; - - /** - * @param iterable $resourceCheckers - */ - public function __construct(iterable $resourceCheckers = []) - { - $this->resourceCheckers = $resourceCheckers; - } - - public function cache(string $file, callable $callable): ConfigCacheInterface - { - $cache = new ResourceCheckerConfigCache($file, $this->resourceCheckers); - if (!$cache->isFresh()) { - $callable($cache); - } - - return $cache; - } -} diff --git a/tests/integration/vendor/symfony/config/ResourceCheckerInterface.php b/tests/integration/vendor/symfony/config/ResourceCheckerInterface.php deleted file mode 100644 index 6b1c6c5..0000000 --- a/tests/integration/vendor/symfony/config/ResourceCheckerInterface.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * Interface for ResourceCheckers. - * - * When a ResourceCheckerConfigCache instance is checked for freshness, all its associated - * metadata resources are passed to ResourceCheckers. The ResourceCheckers - * can then inspect the resources and decide whether the cache can be considered - * fresh or not. - * - * @author Matthias Pigulla - * @author Benjamin Klotz - */ -interface ResourceCheckerInterface -{ - /** - * Queries the ResourceChecker whether it can validate a given - * resource or not. - * - * @return bool - */ - public function supports(ResourceInterface $metadata); - - /** - * Validates the resource. - * - * @param int $timestamp The timestamp at which the cache associated with this resource was created - * - * @return bool - */ - public function isFresh(ResourceInterface $resource, int $timestamp); -} diff --git a/tests/integration/vendor/symfony/config/Util/XmlUtils.php b/tests/integration/vendor/symfony/config/Util/XmlUtils.php deleted file mode 100644 index cc024da..0000000 --- a/tests/integration/vendor/symfony/config/Util/XmlUtils.php +++ /dev/null @@ -1,272 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Config\Util; - -use Symfony\Component\Config\Util\Exception\InvalidXmlException; -use Symfony\Component\Config\Util\Exception\XmlParsingException; - -/** - * XMLUtils is a bunch of utility methods to XML operations. - * - * This class contains static methods only and is not meant to be instantiated. - * - * @author Fabien Potencier - * @author Martin Hasoň - * @author Ole Rößner - */ -class XmlUtils -{ - /** - * This class should not be instantiated. - */ - private function __construct() - { - } - - /** - * Parses an XML string. - * - * @param string $content An XML string - * @param string|callable|null $schemaOrCallable An XSD schema file path, a callable, or null to disable validation - * - * @throws XmlParsingException When parsing of XML file returns error - * @throws InvalidXmlException When parsing of XML with schema or callable produces any errors unrelated to the XML parsing itself - * @throws \RuntimeException When DOM extension is missing - */ - public static function parse(string $content, string|callable $schemaOrCallable = null): \DOMDocument - { - if (!\extension_loaded('dom')) { - throw new \LogicException('Extension DOM is required.'); - } - - $internalErrors = libxml_use_internal_errors(true); - libxml_clear_errors(); - - $dom = new \DOMDocument(); - $dom->validateOnParse = true; - if (!$dom->loadXML($content, \LIBXML_NONET | \LIBXML_COMPACT)) { - throw new XmlParsingException(implode("\n", static::getXmlErrors($internalErrors))); - } - - $dom->normalizeDocument(); - - libxml_use_internal_errors($internalErrors); - - foreach ($dom->childNodes as $child) { - if (\XML_DOCUMENT_TYPE_NODE === $child->nodeType) { - throw new XmlParsingException('Document types are not allowed.'); - } - } - - if (null !== $schemaOrCallable) { - $internalErrors = libxml_use_internal_errors(true); - libxml_clear_errors(); - - $e = null; - if (\is_callable($schemaOrCallable)) { - try { - $valid = $schemaOrCallable($dom, $internalErrors); - } catch (\Exception $e) { - $valid = false; - } - } elseif (is_file($schemaOrCallable)) { - $schemaSource = file_get_contents((string) $schemaOrCallable); - $valid = @$dom->schemaValidateSource($schemaSource); - } else { - libxml_use_internal_errors($internalErrors); - - throw new XmlParsingException(sprintf('Invalid XSD file: "%s".', $schemaOrCallable)); - } - - if (!$valid) { - $messages = static::getXmlErrors($internalErrors); - if (!$messages) { - throw new InvalidXmlException('The XML is not valid.', 0, $e); - } - throw new XmlParsingException(implode("\n", $messages), 0, $e); - } - } - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - - return $dom; - } - - /** - * Loads an XML file. - * - * @param string $file An XML file path - * @param string|callable|null $schemaOrCallable An XSD schema file path, a callable, or null to disable validation - * - * @throws \InvalidArgumentException When loading of XML file returns error - * @throws XmlParsingException When XML parsing returns any errors - * @throws \RuntimeException When DOM extension is missing - */ - public static function loadFile(string $file, string|callable $schemaOrCallable = null): \DOMDocument - { - if (!is_file($file)) { - throw new \InvalidArgumentException(sprintf('Resource "%s" is not a file.', $file)); - } - - if (!is_readable($file)) { - throw new \InvalidArgumentException(sprintf('File "%s" is not readable.', $file)); - } - - $content = @file_get_contents($file); - - if ('' === trim($content)) { - throw new \InvalidArgumentException(sprintf('File "%s" does not contain valid XML, it is empty.', $file)); - } - - try { - return static::parse($content, $schemaOrCallable); - } catch (InvalidXmlException $e) { - throw new XmlParsingException(sprintf('The XML file "%s" is not valid.', $file), 0, $e->getPrevious()); - } - } - - /** - * Converts a \DOMElement object to a PHP array. - * - * The following rules applies during the conversion: - * - * * Each tag is converted to a key value or an array - * if there is more than one "value" - * - * * The content of a tag is set under a "value" key (bar) - * if the tag also has some nested tags - * - * * The attributes are converted to keys () - * - * * The nested-tags are converted to keys (bar) - * - * @param \DOMElement $element A \DOMElement instance - * @param bool $checkPrefix Check prefix in an element or an attribute name - */ - public static function convertDomElementToArray(\DOMElement $element, bool $checkPrefix = true): mixed - { - $prefix = (string) $element->prefix; - $empty = true; - $config = []; - foreach ($element->attributes as $name => $node) { - if ($checkPrefix && !\in_array((string) $node->prefix, ['', $prefix], true)) { - continue; - } - $config[$name] = static::phpize($node->value); - $empty = false; - } - - $nodeValue = false; - foreach ($element->childNodes as $node) { - if ($node instanceof \DOMText) { - if ('' !== trim($node->nodeValue)) { - $nodeValue = trim($node->nodeValue); - $empty = false; - } - } elseif ($checkPrefix && $prefix != (string) $node->prefix) { - continue; - } elseif (!$node instanceof \DOMComment) { - $value = static::convertDomElementToArray($node, $checkPrefix); - - $key = $node->localName; - if (isset($config[$key])) { - if (!\is_array($config[$key]) || !\is_int(key($config[$key]))) { - $config[$key] = [$config[$key]]; - } - $config[$key][] = $value; - } else { - $config[$key] = $value; - } - - $empty = false; - } - } - - if (false !== $nodeValue) { - $value = static::phpize($nodeValue); - if (\count($config)) { - $config['value'] = $value; - } else { - $config = $value; - } - } - - return !$empty ? $config : null; - } - - /** - * Converts an xml value to a PHP type. - */ - public static function phpize(string|\Stringable $value): mixed - { - $value = (string) $value; - $lowercaseValue = strtolower($value); - - switch (true) { - case 'null' === $lowercaseValue: - return null; - case ctype_digit($value): - case isset($value[1]) && '-' === $value[0] && ctype_digit(substr($value, 1)): - $raw = $value; - $cast = (int) $value; - - return self::isOctal($value) ? \intval($value, 8) : (($raw === (string) $cast) ? $cast : $raw); - case 'true' === $lowercaseValue: - return true; - case 'false' === $lowercaseValue: - return false; - case isset($value[1]) && '0b' == $value[0].$value[1] && preg_match('/^0b[01]*$/', $value): - return bindec($value); - case is_numeric($value): - return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value; - case preg_match('/^0x[0-9a-f]++$/i', $value): - return hexdec($value); - case preg_match('/^[+-]?[0-9]+(\.[0-9]+)?$/', $value): - return (float) $value; - default: - return $value; - } - } - - /** - * @return array - */ - protected static function getXmlErrors(bool $internalErrors) - { - $errors = []; - foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - \LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', - $error->code, - trim($error->message), - $error->file ?: 'n/a', - $error->line, - $error->column - ); - } - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - - return $errors; - } - - private static function isOctal(string $str): bool - { - if ('-' === $str[0]) { - $str = substr($str, 1); - } - - return $str === '0'.decoct(\intval($str, 8)); - } -} diff --git a/tests/integration/vendor/symfony/config/composer.json b/tests/integration/vendor/symfony/config/composer.json deleted file mode 100644 index a4b72c3..0000000 --- a/tests/integration/vendor/symfony/config/composer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "symfony/config", - "type": "library", - "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/filesystem": "^5.4|^6.0", - "symfony/polyfill-ctype": "~1.8" - }, - "require-dev": { - "symfony/event-dispatcher": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", - "symfony/messenger": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^5.4|^6.0" - }, - "conflict": { - "symfony/finder": "<5.4", - "symfony/service-contracts": "<2.5" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Config\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/tests/integration/vendor/symfony/console/Application.php b/tests/integration/vendor/symfony/console/Application.php deleted file mode 100644 index b7aaa6a..0000000 --- a/tests/integration/vendor/symfony/console/Application.php +++ /dev/null @@ -1,1316 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Command\CompleteCommand; -use Symfony\Component\Console\Command\DumpCompletionCommand; -use Symfony\Component\Console\Command\HelpCommand; -use Symfony\Component\Console\Command\LazyCommand; -use Symfony\Component\Console\Command\ListCommand; -use Symfony\Component\Console\Command\SignalableCommandInterface; -use Symfony\Component\Console\CommandLoader\CommandLoaderInterface; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Completion\Suggestion; -use Symfony\Component\Console\Event\ConsoleCommandEvent; -use Symfony\Component\Console\Event\ConsoleErrorEvent; -use Symfony\Component\Console\Event\ConsoleSignalEvent; -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\Exception\RuntimeException; -use Symfony\Component\Console\Formatter\OutputFormatter; -use Symfony\Component\Console\Helper\DebugFormatterHelper; -use Symfony\Component\Console\Helper\DescriptorHelper; -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\SignalRegistry\SignalRegistry; -use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\ErrorHandler\ErrorHandler; -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -use Symfony\Contracts\Service\ResetInterface; - -/** - * An Application is the container for a collection of commands. - * - * It is the main entry point of a Console application. - * - * This class is optimized for a standard CLI environment. - * - * Usage: - * - * $app = new Application('myapp', '1.0 (stable)'); - * $app->add(new SimpleCommand()); - * $app->run(); - * - * @author Fabien Potencier - */ -class Application implements ResetInterface -{ - private array $commands = []; - private bool $wantHelps = false; - private ?Command $runningCommand = null; - private string $name; - private string $version; - private ?CommandLoaderInterface $commandLoader = null; - private bool $catchExceptions = true; - private bool $autoExit = true; - private InputDefinition $definition; - private HelperSet $helperSet; - private ?EventDispatcherInterface $dispatcher = null; - private Terminal $terminal; - private string $defaultCommand; - private bool $singleCommand = false; - private bool $initialized = false; - private ?SignalRegistry $signalRegistry = null; - private array $signalsToDispatchEvent = []; - - public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN') - { - $this->name = $name; - $this->version = $version; - $this->terminal = new Terminal(); - $this->defaultCommand = 'list'; - if (\defined('SIGINT') && SignalRegistry::isSupported()) { - $this->signalRegistry = new SignalRegistry(); - $this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2]; - } - } - - /** - * @final - */ - public function setDispatcher(EventDispatcherInterface $dispatcher): void - { - $this->dispatcher = $dispatcher; - } - - /** - * @return void - */ - public function setCommandLoader(CommandLoaderInterface $commandLoader) - { - $this->commandLoader = $commandLoader; - } - - public function getSignalRegistry(): SignalRegistry - { - if (!$this->signalRegistry) { - throw new RuntimeException('Signals are not supported. Make sure that the "pcntl" extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.'); - } - - return $this->signalRegistry; - } - - /** - * @return void - */ - public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent) - { - $this->signalsToDispatchEvent = $signalsToDispatchEvent; - } - - /** - * Runs the current application. - * - * @return int 0 if everything went fine, or an error code - * - * @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}. - */ - public function run(InputInterface $input = null, OutputInterface $output = null): int - { - if (\function_exists('putenv')) { - @putenv('LINES='.$this->terminal->getHeight()); - @putenv('COLUMNS='.$this->terminal->getWidth()); - } - - $input ??= new ArgvInput(); - $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) { - $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 ($exitCode <= 0) { - $exitCode = 1; - } - } else { - $exitCode = 1; - } - } finally { - // if the exception handler changed, keep it - // otherwise, unregister $renderException - 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; - } - - /** - * Runs the current application. - * - * @return int 0 if everything went fine, or an error code - */ - public function doRun(InputInterface $input, OutputInterface $output) - { - if (true === $input->hasParameterOption(['--version', '-V'], true)) { - $output->writeln($this->getLongVersion()); - - return 0; - } - - try { - // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument. - $input->bind($this->getDefinition()); - } catch (ExceptionInterface) { - // Errors must be ignored, full binding/validation happens later when the command is known. - } - - $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; - // the command name MUST be the first element of the input - $command = $this->find($name); - } catch (\Throwable $e) { - if (($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) && 1 === \count($alternatives = $e->getAlternatives()) && $input->isInteractive()) { - $alternative = $alternatives[0]; - - $style = new SymfonyStyle($input, $output); - $output->writeln(''); - $formattedBlock = (new FormatterHelper())->formatBlock(sprintf('Command "%s" is not defined.', $name), 'error', true); - $output->writeln($formattedBlock); - 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); - } else { - 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(); - } - - try { - if ($e instanceof CommandNotFoundException && $namespace = $this->findNamespace($name)) { - $helper = new DescriptorHelper(); - $helper->describe($output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output, $this, [ - 'format' => 'txt', - 'raw_text' => false, - 'namespace' => $namespace, - 'short' => false, - ]); - - return isset($event) ? $event->getExitCode() : 1; - } - - throw $e; - } catch (NamespaceNotFoundException) { - throw $e; - } - } - } - - if ($command instanceof LazyCommand) { - $command = $command->getCommand(); - } - - $this->runningCommand = $command; - $exitCode = $this->doRunCommand($command, $input, $output); - $this->runningCommand = null; - - return $exitCode; - } - - /** - * @return void - */ - public function reset() - { - } - - /** - * @return void - */ - public function setHelperSet(HelperSet $helperSet) - { - $this->helperSet = $helperSet; - } - - /** - * Get the helper set associated with the command. - */ - public function getHelperSet(): HelperSet - { - return $this->helperSet ??= $this->getDefaultHelperSet(); - } - - /** - * @return void - */ - public function setDefinition(InputDefinition $definition) - { - $this->definition = $definition; - } - - /** - * Gets the InputDefinition related to this Application. - */ - public function getDefinition(): InputDefinition - { - $this->definition ??= $this->getDefaultInputDefinition(); - - if ($this->singleCommand) { - $inputDefinition = $this->definition; - $inputDefinition->setArguments(); - - return $inputDefinition; - } - - return $this->definition; - } - - /** - * Adds suggestions to $suggestions for the current completion input (e.g. option or argument). - */ - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - if ( - CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType() - && 'command' === $input->getCompletionName() - ) { - foreach ($this->all() as $name => $command) { - // skip hidden commands and aliased commands as they already get added below - if ($command->isHidden() || $command->getName() !== $name) { - continue; - } - $suggestions->suggestValue(new Suggestion($command->getName(), $command->getDescription())); - foreach ($command->getAliases() as $name) { - $suggestions->suggestValue(new Suggestion($name, $command->getDescription())); - } - } - - return; - } - - if (CompletionInput::TYPE_OPTION_NAME === $input->getCompletionType()) { - $suggestions->suggestOptions($this->getDefinition()->getOptions()); - - return; - } - } - - /** - * Gets the help message. - */ - public function getHelp(): string - { - return $this->getLongVersion(); - } - - /** - * Gets whether to catch exceptions or not during commands execution. - */ - public function areExceptionsCaught(): bool - { - return $this->catchExceptions; - } - - /** - * Sets whether to catch exceptions or not during commands execution. - * - * @return void - */ - public function setCatchExceptions(bool $boolean) - { - $this->catchExceptions = $boolean; - } - - /** - * Gets whether to automatically exit after a command execution or not. - */ - public function isAutoExitEnabled(): bool - { - return $this->autoExit; - } - - /** - * Sets whether to automatically exit after a command execution or not. - * - * @return void - */ - public function setAutoExit(bool $boolean) - { - $this->autoExit = $boolean; - } - - /** - * Gets the name of the application. - */ - public function getName(): string - { - return $this->name; - } - - /** - * Sets the application name. - * - * @return void - */ - public function setName(string $name) - { - $this->name = $name; - } - - /** - * Gets the application version. - */ - public function getVersion(): string - { - return $this->version; - } - - /** - * Sets the application version. - * - * @return void - */ - public function setVersion(string $version) - { - $this->version = $version; - } - - /** - * Returns the long version of the application. - * - * @return string - */ - public function getLongVersion() - { - if ('UNKNOWN' !== $this->getName()) { - if ('UNKNOWN' !== $this->getVersion()) { - return sprintf('%s %s', $this->getName(), $this->getVersion()); - } - - return $this->getName(); - } - - return 'Console Tool'; - } - - /** - * Registers a new command. - */ - public function register(string $name): Command - { - return $this->add(new Command($name)); - } - - /** - * Adds an array of command objects. - * - * If a Command is not enabled it will not be added. - * - * @param Command[] $commands An array of commands - * - * @return void - */ - public function addCommands(array $commands) - { - foreach ($commands as $command) { - $this->add($command); - } - } - - /** - * Adds a command object. - * - * If a command with the same name already exists, it will be overridden. - * If the command is not enabled it will not be added. - * - * @return Command|null - */ - public function add(Command $command) - { - $this->init(); - - $command->setApplication($this); - - if (!$command->isEnabled()) { - $command->setApplication(null); - - return null; - } - - if (!$command instanceof LazyCommand) { - // Will throw if the command is not correctly initialized. - $command->getDefinition(); - } - - if (!$command->getName()) { - throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_debug_type($command))); - } - - $this->commands[$command->getName()] = $command; - - foreach ($command->getAliases() as $alias) { - $this->commands[$alias] = $command; - } - - return $command; - } - - /** - * Returns a registered command by name or alias. - * - * @return Command - * - * @throws CommandNotFoundException When given command name does not exist - */ - public function get(string $name) - { - $this->init(); - - if (!$this->has($name)) { - throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name)); - } - - // When the command has a different name than the one used at the command loader level - 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; - } - - /** - * Returns true if the command exists, false otherwise. - */ - public function has(string $name): bool - { - $this->init(); - - return isset($this->commands[$name]) || ($this->commandLoader?->has($name) && $this->add($this->commandLoader->get($name))); - } - - /** - * Returns an array of all unique namespaces used by currently registered commands. - * - * It does not return the global namespace which always exists. - * - * @return string[] - */ - public function getNamespaces(): array - { - $namespaces = []; - foreach ($this->all() as $command) { - if ($command->isHidden()) { - continue; - } - - $namespaces[] = $this->extractAllNamespaces($command->getName()); - - foreach ($command->getAliases() as $alias) { - $namespaces[] = $this->extractAllNamespaces($alias); - } - } - - return array_values(array_unique(array_filter(array_merge([], ...$namespaces)))); - } - - /** - * Finds a registered namespace by a name or an abbreviation. - * - * @throws NamespaceNotFoundException When namespace is incorrect or ambiguous - */ - public function findNamespace(string $namespace): string - { - $allNamespaces = $this->getNamespaces(); - $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $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); - } - - /** - * Finds a command by name or alias. - * - * Contrary to get, this command tries to find the best - * match if you give it an abbreviation of a name or alias. - * - * @return Command - * - * @throws CommandNotFoundException When command name is incorrect or ambiguous - */ - public function find(string $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 = implode('[^:]*:', array_map('preg_quote', explode(':', $name))).'[^:]*'; - $commands = preg_grep('{^'.$expr.'}', $allCommands); - - if (empty($commands)) { - $commands = preg_grep('{^'.$expr.'}i', $allCommands); - } - - // if no commands matched or we just matched namespaces - if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) { - if (false !== $pos = strrpos($name, ':')) { - // check if a namespace exists and contains commands - $this->findNamespace(substr($name, 0, $pos)); - } - - $message = sprintf('Command "%s" is not defined.', $name); - - if ($alternatives = $this->findAlternatives($name, $allCommands)) { - // remove hidden commands - $alternatives = array_filter($alternatives, fn ($name) => !$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)); - } - - // filter out aliases for commands which are already on the list - 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::width($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::width($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()) { - throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name)); - } - - return $command; - } - - /** - * Gets the commands (registered in the given namespace if provided). - * - * The array keys are the full names and the values the command instances. - * - * @return Command[] - */ - public function all(string $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; - } - - /** - * Returns an array of possible abbreviations given a set of names. - * - * @return string[][] - */ - public static function getAbbreviations(array $names): array - { - $abbrevs = []; - foreach ($names as $name) { - for ($len = \strlen($name); $len > 0; --$len) { - $abbrev = substr($name, 0, $len); - $abbrevs[$abbrev][] = $name; - } - } - - return $abbrevs; - } - - public function renderThrowable(\Throwable $e, OutputInterface $output): void - { - $output->writeln('', OutputInterface::VERBOSITY_QUIET); - - $this->doRenderThrowable($e, $output); - - if (null !== $this->runningCommand) { - $output->writeln(sprintf('%s', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET); - $output->writeln('', OutputInterface::VERBOSITY_QUIET); - } - } - - protected function doRenderThrowable(\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::width($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]++/', fn ($m) => 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) { - // pre-format lines to get the right string length - $lineLength = Helper::width($line) + 4; - $lines[] = [$line, $lineLength]; - - $len = max($lineLength, $len); - } - } - - $messages = []; - if (!$e instanceof ExceptionInterface || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { - $messages[] = sprintf('%s', OutputFormatter::escape(sprintf('In %s line %s:', basename($e->getFile()) ?: 'n/a', $e->getLine() ?: 'n/a'))); - } - $messages[] = $emptyLine = sprintf('%s', str_repeat(' ', $len)); - if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { - $messages[] = sprintf('%s%s', $title, str_repeat(' ', max(0, $len - Helper::width($title)))); - } - foreach ($lines as $line) { - $messages[] = sprintf(' %s %s', 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('Exception trace:', OutputInterface::VERBOSITY_QUIET); - - // exception related properties - $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 %s:%s', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET); - } - - $output->writeln('', OutputInterface::VERBOSITY_QUIET); - } - } while ($e = $e->getPrevious()); - } - - /** - * Configures the input and output instances based on the user arguments and options. - * - * @return void - */ - 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; - } - - /** - * Runs the current command. - * - * If an event dispatcher has been attached to the application, - * events are also dispatched during the life-cycle of the command. - * - * @return int 0 if everything went fine, or an error code - */ - protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output) - { - foreach ($command->getHelperSet() as $helper) { - if ($helper instanceof InputAwareInterface) { - $helper->setInput($input); - } - } - - $commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : []; - if ($commandSignals || $this->dispatcher && $this->signalsToDispatchEvent) { - if (!$this->signalRegistry) { - throw new RuntimeException('Unable to subscribe to signal events. Make sure that the "pcntl" extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.'); - } - - if (Terminal::hasSttyAvailable()) { - $sttyMode = shell_exec('stty -g'); - - foreach ([\SIGINT, \SIGTERM] as $signal) { - $this->signalRegistry->register($signal, static fn () => shell_exec('stty '.$sttyMode)); - } - } - - if ($this->dispatcher) { - // We register application signals, so that we can dispatch the event - foreach ($this->signalsToDispatchEvent as $signal) { - $event = new ConsoleSignalEvent($command, $input, $output, $signal); - - $this->signalRegistry->register($signal, function ($signal) use ($event, $command, $commandSignals) { - $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL); - $exitCode = $event->getExitCode(); - - // If the command is signalable, we call the handleSignal() method - if (\in_array($signal, $commandSignals, true)) { - $exitCode = $command->handleSignal($signal, $exitCode); - // BC layer for Symfony <= 5 - if (null === $exitCode) { - trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', get_debug_type($command)); - $exitCode = 0; - } - } - - if (false !== $exitCode) { - exit($exitCode); - } - }); - } - - // then we register command signals, but not if already handled after the dispatcher - $commandSignals = array_diff($commandSignals, $this->signalsToDispatchEvent); - } - - foreach ($commandSignals as $signal) { - $this->signalRegistry->register($signal, function (int $signal) use ($command): void { - $exitCode = $command->handleSignal($signal); - // BC layer for Symfony <= 5 - if (null === $exitCode) { - trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', get_debug_type($command)); - $exitCode = 0; - } - - if (false !== $exitCode) { - exit($exitCode); - } - }); - } - } - - if (null === $this->dispatcher) { - return $command->run($input, $output); - } - - // bind before the console.command event, so the listeners have access to input options/arguments - try { - $command->mergeApplicationDefinition(); - $input->bind($command->getDefinition()); - } catch (ExceptionInterface) { - // ignore invalid options/arguments for now, to allow the event listeners to customize the InputDefinition - } - - $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(); - } - - /** - * Gets the name of the command based on input. - */ - protected function getCommandName(InputInterface $input): ?string - { - return $this->singleCommand ? $this->defaultCommand : $input->getFirstArgument(); - } - - /** - * Gets the default input definition. - */ - protected function getDefaultInputDefinition(): InputDefinition - { - return new InputDefinition([ - new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display help for the given command. When no command is given display help for the '.$this->defaultCommand.' command'), - 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_NEGATABLE, 'Force (or disable --no-ansi) ANSI output', null), - new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'), - ]); - } - - /** - * Gets the default commands that should always be available. - * - * @return Command[] - */ - protected function getDefaultCommands(): array - { - return [new HelpCommand(), new ListCommand(), new CompleteCommand(), new DumpCompletionCommand()]; - } - - /** - * Gets the default helper set with the helpers that should always be available. - */ - protected function getDefaultHelperSet(): HelperSet - { - return new HelperSet([ - new FormatterHelper(), - new DebugFormatterHelper(), - new ProcessHelper(), - new QuestionHelper(), - ]); - } - - /** - * Returns abbreviated suggestions in string format. - */ - private function getAbbreviationSuggestions(array $abbrevs): string - { - return ' '.implode("\n ", $abbrevs); - } - - /** - * Returns the namespace part of the command name. - * - * This method is not part of public API and should not be used directly. - */ - public function extractNamespace(string $name, int $limit = null): string - { - $parts = explode(':', $name, -1); - - return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit)); - } - - /** - * Finds alternative of $name among $collection, - * if nothing is found in $collection, try in $abbrevs. - * - * @return string[] - */ - 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, fn ($lev) => $lev < 2 * $threshold); - ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); - - return array_keys($alternatives); - } - - /** - * Sets the default Command name. - * - * @return $this - */ - public function setDefaultCommand(string $commandName, bool $isSingleCommand = false): static - { - $this->defaultCommand = explode('|', ltrim($commandName, '|'))[0]; - - if ($isSingleCommand) { - // Ensure the command exist - $this->find($commandName); - - $this->singleCommand = true; - } - - return $this; - } - - /** - * @internal - */ - public function isSingleCommand(): bool - { - return $this->singleCommand; - } - - private function splitStringByWidth(string $string, int $width): array - { - // str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly. - // additionally, array_slice() is not enough as some character has doubled width. - // we need a function to split string not by character count but by string width - 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) { - // test if $char could be appended to current line - if (mb_strwidth($line.$char, 'utf8') <= $width) { - $line .= $char; - continue; - } - // if not, push current line to array and make new line - $lines[] = str_pad($line, $width); - $line = $char; - } - } - - $lines[] = \count($lines) ? str_pad($line, $width) : $line; - - mb_convert_variables($encoding, 'utf8', $lines); - - return $lines; - } - - /** - * Returns all namespaces of the command name. - * - * @return string[] - */ - private function extractAllNamespaces(string $name): array - { - // -1 as third argument is needed to skip the command short name when exploding - $parts = explode(':', $name, -1); - $namespaces = []; - - foreach ($parts as $part) { - if (\count($namespaces)) { - $namespaces[] = end($namespaces).':'.$part; - } else { - $namespaces[] = $part; - } - } - - return $namespaces; - } - - private function init(): void - { - if ($this->initialized) { - return; - } - $this->initialized = true; - - foreach ($this->getDefaultCommands() as $command) { - $this->add($command); - } - } -} diff --git a/tests/integration/vendor/symfony/console/CHANGELOG.md b/tests/integration/vendor/symfony/console/CHANGELOG.md deleted file mode 100644 index 3428a57..0000000 --- a/tests/integration/vendor/symfony/console/CHANGELOG.md +++ /dev/null @@ -1,252 +0,0 @@ -CHANGELOG -========= - -6.3 ---- - - * Add support for choosing exit code while handling signal, or to not exit at all - * Add `ProgressBar::setPlaceholderFormatter` to set a placeholder attached to a instance, instead of being global. - * Add `ReStructuredTextDescriptor` - -6.2 ---- - - * Improve truecolor terminal detection in some cases - * Add support for 256 color terminals (conversion from Ansi24 to Ansi8 if terminal is capable of it) - * Deprecate calling `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()`, `Question::setAutocompleterCallback/setValidator()`without any arguments - * Change the signature of `OutputFormatterStyleInterface::setForeground/setBackground()` to `setForeground/setBackground(?string)` - * Change the signature of `HelperInterface::setHelperSet()` to `setHelperSet(?HelperSet)` - -6.1 ---- - - * Add support to display table vertically when calling setVertical() - * Add method `__toString()` to `InputInterface` - * Added `OutputWrapper` to prevent truncated URL in `SymfonyStyle::createBlock`. - * Deprecate `Command::$defaultName` and `Command::$defaultDescription`, use the `AsCommand` attribute instead - * Add suggested values for arguments and options in input definition, for input completion - * Add `$resumeAt` parameter to `ProgressBar#start()`, so that one can easily 'resume' progress on longer tasks, and still get accurate `getEstimate()` and `getRemaining()` results. - -6.0 ---- - - * `Command::setHidden()` has a default value (`true`) for `$hidden` parameter and is final - * Remove `Helper::strlen()`, use `Helper::width()` instead - * Remove `Helper::strlenWithoutDecoration()`, use `Helper::removeDecoration()` instead - * `AddConsoleCommandPass` can not be configured anymore - * Remove `HelperSet::setCommand()` and `getCommand()` without replacement - -5.4 ---- - - * Add `TesterTrait::assertCommandIsSuccessful()` to test command - * Deprecate `HelperSet::setCommand()` and `getCommand()` without replacement - -5.3 ---- - - * Add `GithubActionReporter` to render annotations in a Github Action - * Add `InputOption::VALUE_NEGATABLE` flag to handle `--foo`/`--no-foo` options - * Add the `Command::$defaultDescription` static property and the `description` attribute - on the `console.command` tag to allow the `list` command to instantiate commands lazily - * Add option `--short` to the `list` command - * Add support for bright colors - * Add `#[AsCommand]` attribute for declaring commands on PHP 8 - * Add `Helper::width()` and `Helper::length()` - * The `--ansi` and `--no-ansi` options now default to `null`. - -5.2.0 ------ - - * Added `SingleCommandApplication::setAutoExit()` to allow testing via `CommandTester` - * added support for multiline responses to questions through `Question::setMultiline()` - and `Question::isMultiline()` - * Added `SignalRegistry` class to stack signals handlers - * Added support for signals: - * Added `Application::getSignalRegistry()` and `Application::setSignalsToDispatchEvent()` methods - * Added `SignalableCommandInterface` interface - * Added `TableCellStyle` class to customize table cell - * Removed `php ` prefix invocation from help messages. - -5.1.0 ------ - - * `Command::setHidden()` is final since Symfony 5.1 - * Add `SingleCommandApplication` - * Add `Cursor` class - -5.0.0 ------ - - * removed support for finding hidden commands using an abbreviation, use the full name instead - * removed `TableStyle::setCrossingChar()` method in favor of `TableStyle::setDefaultCrossingChar()` - * removed `TableStyle::setHorizontalBorderChar()` method in favor of `TableStyle::setDefaultCrossingChars()` - * removed `TableStyle::getHorizontalBorderChar()` method in favor of `TableStyle::getBorderChars()` - * removed `TableStyle::setVerticalBorderChar()` method in favor of `TableStyle::setVerticalBorderChars()` - * removed `TableStyle::getVerticalBorderChar()` method in favor of `TableStyle::getBorderChars()` - * removed support for returning `null` from `Command::execute()`, return `0` instead - * `ProcessHelper::run()` accepts only `array|Symfony\Component\Process\Process` for its `command` argument - * `Application::setDispatcher` accepts only `Symfony\Contracts\EventDispatcher\EventDispatcherInterface` - for its `dispatcher` argument - * renamed `Application::renderException()` and `Application::doRenderException()` - to `renderThrowable()` and `doRenderThrowable()` respectively. - -4.4.0 ------ - - * deprecated finding hidden commands using an abbreviation, use the full name instead - * added `Question::setTrimmable` default to true to allow the answer to be trimmed - * added method `minSecondsBetweenRedraws()` and `maxSecondsBetweenRedraws()` on `ProgressBar` - * `Application` implements `ResetInterface` - * marked all dispatched event classes as `@final` - * added support for displaying table horizontally - * deprecated returning `null` from `Command::execute()`, return `0` instead - * Deprecated the `Application::renderException()` and `Application::doRenderException()` methods, - use `renderThrowable()` and `doRenderThrowable()` instead. - * added support for the `NO_COLOR` env var (https://no-color.org/) - -4.3.0 ------ - - * added support for hyperlinks - * added `ProgressBar::iterate()` method that simplify updating the progress bar when iterating - * added `Question::setAutocompleterCallback()` to provide a callback function - that dynamically generates suggestions as the user types - -4.2.0 ------ - - * allowed passing commands as `[$process, 'ENV_VAR' => 'value']` to - `ProcessHelper::run()` to pass environment variables - * deprecated passing a command as a string to `ProcessHelper::run()`, - pass it the command as an array of its arguments instead - * made the `ProcessHelper` class final - * added `WrappableOutputFormatterInterface::formatAndWrap()` (implemented in `OutputFormatter`) - * added `capture_stderr_separately` option to `CommandTester::execute()` - -4.1.0 ------ - - * added option to run suggested command if command is not found and only 1 alternative is available - * added option to modify console output and print multiple modifiable sections - * added support for iterable messages in output `write` and `writeln` methods - -4.0.0 ------ - - * `OutputFormatter` throws an exception when unknown options are used - * removed `QuestionHelper::setInputStream()/getInputStream()` - * removed `Application::getTerminalWidth()/getTerminalHeight()` and - `Application::setTerminalDimensions()/getTerminalDimensions()` - * removed `ConsoleExceptionEvent` - * removed `ConsoleEvents::EXCEPTION` - -3.4.0 ------ - - * added `SHELL_VERBOSITY` env var to control verbosity - * added `CommandLoaderInterface`, `FactoryCommandLoader` and PSR-11 - `ContainerCommandLoader` for commands lazy-loading - * added a case-insensitive command name matching fallback - * added static `Command::$defaultName/getDefaultName()`, allowing for - commands to be registered at compile time in the application command loader. - Setting the `$defaultName` property avoids the need for filling the `command` - attribute on the `console.command` tag when using `AddConsoleCommandPass`. - -3.3.0 ------ - - * added `ExceptionListener` - * added `AddConsoleCommandPass` (originally in FrameworkBundle) - * [BC BREAK] `Input::getOption()` no longer returns the default value for options - with value optional explicitly passed empty - * added console.error event to catch exceptions thrown by other listeners - * deprecated console.exception event in favor of console.error - * added ability to handle `CommandNotFoundException` through the - `console.error` event - * deprecated default validation in `SymfonyQuestionHelper::ask` - -3.2.0 ------- - - * added `setInputs()` method to CommandTester for ease testing of commands expecting inputs - * added `setStream()` and `getStream()` methods to Input (implement StreamableInputInterface) - * added StreamableInputInterface - * added LockableTrait - -3.1.0 ------ - - * added truncate method to FormatterHelper - * added setColumnWidth(s) method to Table - -2.8.3 ------ - - * remove readline support from the question helper as it caused issues - -2.8.0 ------ - - * use readline for user input in the question helper when available to allow - the use of arrow keys - -2.6.0 ------ - - * added a Process helper - * added a DebugFormatter helper - -2.5.0 ------ - - * deprecated the dialog helper (use the question helper instead) - * deprecated TableHelper in favor of Table - * deprecated ProgressHelper in favor of ProgressBar - * added ConsoleLogger - * added a question helper - * added a way to set the process name of a command - * added a way to set a default command instead of `ListCommand` - -2.4.0 ------ - - * added a way to force terminal dimensions - * added a convenient method to detect verbosity level - * [BC BREAK] made descriptors use output instead of returning a string - -2.3.0 ------ - - * added multiselect support to the select dialog helper - * added Table Helper for tabular data rendering - * added support for events in `Application` - * added a way to normalize EOLs in `ApplicationTester::getDisplay()` and `CommandTester::getDisplay()` - * added a way to set the progress bar progress via the `setCurrent` method - * added support for multiple InputOption shortcuts, written as `'-a|-b|-c'` - * added two additional verbosity levels, VERBOSITY_VERY_VERBOSE and VERBOSITY_DEBUG - -2.2.0 ------ - - * added support for colorization on Windows via ConEmu - * add a method to Dialog Helper to ask for a question and hide the response - * added support for interactive selections in console (DialogHelper::select()) - * added support for autocompletion as you type in Dialog Helper - -2.1.0 ------ - - * added ConsoleOutputInterface - * added the possibility to disable a command (Command::isEnabled()) - * added suggestions when a command does not exist - * added a --raw option to the list command - * added support for STDERR in the console output class (errors are now sent - to STDERR) - * made the defaults (helper set, commands, input definition) in Application - more easily customizable - * added support for the shell even if readline is not available - * added support for process isolation in Symfony shell via - `--process-isolation` switch - * added support for `--`, which disables options parsing after that point - (tokens will be parsed as arguments) diff --git a/tests/integration/vendor/symfony/console/Command/Command.php b/tests/integration/vendor/symfony/console/Command/Command.php deleted file mode 100644 index 704b112..0000000 --- a/tests/integration/vendor/symfony/console/Command/Command.php +++ /dev/null @@ -1,725 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Command; - -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Completion\Suggestion; -use Symfony\Component\Console\Exception\ExceptionInterface; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; -use Symfony\Component\Console\Helper\HelperInterface; -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; - -/** - * Base class for all commands. - * - * @author Fabien Potencier - */ -class Command -{ - // see https://tldp.org/LDP/abs/html/exitcodes.html - public const SUCCESS = 0; - public const FAILURE = 1; - public const INVALID = 2; - - /** - * @var string|null The default command name - * - * @deprecated since Symfony 6.1, use the AsCommand attribute instead - */ - protected static $defaultName; - - /** - * @var string|null The default command description - * - * @deprecated since Symfony 6.1, use the AsCommand attribute instead - */ - protected static $defaultDescription; - - private ?Application $application = null; - private ?string $name = null; - private ?string $processTitle = null; - private array $aliases = []; - private InputDefinition $definition; - private bool $hidden = false; - private string $help = ''; - private string $description = ''; - private ?InputDefinition $fullDefinition = null; - private bool $ignoreValidationErrors = false; - private ?\Closure $code = null; - private array $synopsis = []; - private array $usages = []; - private ?HelperSet $helperSet = null; - - public static function getDefaultName(): ?string - { - $class = static::class; - - if ($attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) { - return $attribute[0]->newInstance()->name; - } - - $r = new \ReflectionProperty($class, 'defaultName'); - - if ($class !== $r->class || null === static::$defaultName) { - return null; - } - - trigger_deprecation('symfony/console', '6.1', 'Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "%s" attribute to the "%s" class instead.', AsCommand::class, static::class); - - return static::$defaultName; - } - - public static function getDefaultDescription(): ?string - { - $class = static::class; - - if ($attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) { - return $attribute[0]->newInstance()->description; - } - - $r = new \ReflectionProperty($class, 'defaultDescription'); - - if ($class !== $r->class || null === static::$defaultDescription) { - return null; - } - - trigger_deprecation('symfony/console', '6.1', 'Relying on the static property "$defaultDescription" for setting a command description is deprecated. Add the "%s" attribute to the "%s" class instead.', AsCommand::class, static::class); - - return static::$defaultDescription; - } - - /** - * @param string|null $name The name of the command; passing null means it must be set in configure() - * - * @throws LogicException When the command name is empty - */ - public function __construct(string $name = null) - { - $this->definition = new InputDefinition(); - - if (null === $name && null !== $name = static::getDefaultName()) { - $aliases = explode('|', $name); - - if ('' === $name = array_shift($aliases)) { - $this->setHidden(true); - $name = array_shift($aliases); - } - - $this->setAliases($aliases); - } - - if (null !== $name) { - $this->setName($name); - } - - if ('' === $this->description) { - $this->setDescription(static::getDefaultDescription() ?? ''); - } - - $this->configure(); - } - - /** - * Ignores validation errors. - * - * This is mainly useful for the help command. - * - * @return void - */ - public function ignoreValidationErrors() - { - $this->ignoreValidationErrors = true; - } - - /** - * @return void - */ - public function setApplication(Application $application = null) - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - $this->application = $application; - if ($application) { - $this->setHelperSet($application->getHelperSet()); - } else { - $this->helperSet = null; - } - - $this->fullDefinition = null; - } - - /** - * @return void - */ - public function setHelperSet(HelperSet $helperSet) - { - $this->helperSet = $helperSet; - } - - /** - * Gets the helper set. - */ - public function getHelperSet(): ?HelperSet - { - return $this->helperSet; - } - - /** - * Gets the application instance for this command. - */ - public function getApplication(): ?Application - { - return $this->application; - } - - /** - * Checks whether the command is enabled or not in the current environment. - * - * Override this to check for x or y and return false if the command cannot - * run properly under the current conditions. - * - * @return bool - */ - public function isEnabled() - { - return true; - } - - /** - * Configures the current command. - * - * @return void - */ - protected function configure() - { - } - - /** - * Executes the current command. - * - * This method is not abstract because you can use this class - * as a concrete class. In this case, instead of defining the - * execute() method, you set the code to execute by passing - * a Closure to the setCode() method. - * - * @return int 0 if everything went fine, or an exit code - * - * @throws LogicException When this abstract method is not implemented - * - * @see setCode() - */ - protected function execute(InputInterface $input, OutputInterface $output) - { - throw new LogicException('You must override the execute() method in the concrete command class.'); - } - - /** - * Interacts with the user. - * - * This method is executed before the InputDefinition is validated. - * This means that this is the only place where the command can - * interactively ask for values of missing required arguments. - * - * @return void - */ - protected function interact(InputInterface $input, OutputInterface $output) - { - } - - /** - * Initializes the command after the input has been bound and before the input - * is validated. - * - * This is mainly useful when a lot of commands extends one main command - * where some things need to be initialized based on the input arguments and options. - * - * @see InputInterface::bind() - * @see InputInterface::validate() - * - * @return void - */ - protected function initialize(InputInterface $input, OutputInterface $output) - { - } - - /** - * Runs the command. - * - * The code to execute is either defined directly with the - * setCode() method or by overriding the execute() method - * in a sub-class. - * - * @return int The command exit code - * - * @throws ExceptionInterface When input binding fails. Bypass this by calling {@link ignoreValidationErrors()}. - * - * @see setCode() - * @see execute() - */ - public function run(InputInterface $input, OutputInterface $output): int - { - // add the application arguments and options - $this->mergeApplicationDefinition(); - - // bind the input against the command specific arguments/options - try { - $input->bind($this->getDefinition()); - } 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('Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.', 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('Install the proctitle PECL to be able to change the process title.'); - } - } - - if ($input->isInteractive()) { - $this->interact($input, $output); - } - - // The command name argument is often omitted when a command is executed directly with its run() method. - // It would fail the validation if we didn't make sure the command argument is present, - // since it's required by the application. - 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)) { - throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode))); - } - } - - return is_numeric($statusCode) ? (int) $statusCode : 0; - } - - /** - * Adds suggestions to $suggestions for the current completion input (e.g. option or argument). - */ - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - $definition = $this->getDefinition(); - if (CompletionInput::TYPE_OPTION_VALUE === $input->getCompletionType() && $definition->hasOption($input->getCompletionName())) { - $definition->getOption($input->getCompletionName())->complete($input, $suggestions); - } elseif (CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType() && $definition->hasArgument($input->getCompletionName())) { - $definition->getArgument($input->getCompletionName())->complete($input, $suggestions); - } - } - - /** - * Sets the code to execute when running this command. - * - * If this method is used, it overrides the code defined - * in the execute() method. - * - * @param callable $code A callable(InputInterface $input, OutputInterface $output) - * - * @return $this - * - * @throws InvalidArgumentException - * - * @see execute() - */ - public function setCode(callable $code): static - { - 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(); - } - } - } else { - $code = $code(...); - } - - $this->code = $code; - - return $this; - } - - /** - * Merges the application definition with the command definition. - * - * This method is not part of public API and should not be used directly. - * - * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments - * - * @internal - */ - public function mergeApplicationDefinition(bool $mergeArgs = true): void - { - if (null === $this->application) { - return; - } - - $this->fullDefinition = new InputDefinition(); - $this->fullDefinition->setOptions($this->definition->getOptions()); - $this->fullDefinition->addOptions($this->application->getDefinition()->getOptions()); - - if ($mergeArgs) { - $this->fullDefinition->setArguments($this->application->getDefinition()->getArguments()); - $this->fullDefinition->addArguments($this->definition->getArguments()); - } else { - $this->fullDefinition->setArguments($this->definition->getArguments()); - } - } - - /** - * Sets an array of argument and option instances. - * - * @return $this - */ - public function setDefinition(array|InputDefinition $definition): static - { - if ($definition instanceof InputDefinition) { - $this->definition = $definition; - } else { - $this->definition->setDefinition($definition); - } - - $this->fullDefinition = null; - - return $this; - } - - /** - * Gets the InputDefinition attached to this Command. - */ - public function getDefinition(): InputDefinition - { - return $this->fullDefinition ?? $this->getNativeDefinition(); - } - - /** - * Gets the InputDefinition to be used to create representations of this Command. - * - * Can be overridden to provide the original command representation when it would otherwise - * be changed by merging with the application InputDefinition. - * - * This method is not part of public API and should not be used directly. - */ - public function getNativeDefinition(): InputDefinition - { - return $this->definition ?? throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class)); - } - - /** - * Adds an argument. - * - * @param $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param $default The default value (for InputArgument::OPTIONAL mode only) - * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion - * - * @return $this - * - * @throws InvalidArgumentException When argument mode is not valid - */ - public function addArgument(string $name, int $mode = null, string $description = '', mixed $default = null /* array|\Closure $suggestedValues = null */): static - { - $suggestedValues = 5 <= \func_num_args() ? func_get_arg(4) : []; - if (!\is_array($suggestedValues) && !$suggestedValues instanceof \Closure) { - throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be array or \Closure, "%s" given.', __METHOD__, get_debug_type($suggestedValues))); - } - $this->definition->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues)); - $this->fullDefinition?->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues)); - - return $this; - } - - /** - * Adds an option. - * - * @param $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param $mode The option mode: One of the InputOption::VALUE_* constants - * @param $default The default value (must be null for InputOption::VALUE_NONE) - * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion - * - * @return $this - * - * @throws InvalidArgumentException If option mode is invalid or incompatible - */ - public function addOption(string $name, string|array $shortcut = null, int $mode = null, string $description = '', mixed $default = null /* array|\Closure $suggestedValues = [] */): static - { - $suggestedValues = 6 <= \func_num_args() ? func_get_arg(5) : []; - if (!\is_array($suggestedValues) && !$suggestedValues instanceof \Closure) { - throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be array or \Closure, "%s" given.', __METHOD__, get_debug_type($suggestedValues))); - } - $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues)); - $this->fullDefinition?->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues)); - - return $this; - } - - /** - * Sets the name of the command. - * - * This method can set both the namespace and the name if - * you separate them by a colon (:) - * - * $command->setName('foo:bar'); - * - * @return $this - * - * @throws InvalidArgumentException When the name is invalid - */ - public function setName(string $name): static - { - $this->validateName($name); - - $this->name = $name; - - return $this; - } - - /** - * Sets the process title of the command. - * - * This feature should be used only when creating a long process command, - * like a daemon. - * - * @return $this - */ - public function setProcessTitle(string $title): static - { - $this->processTitle = $title; - - return $this; - } - - /** - * Returns the command name. - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param bool $hidden Whether or not the command should be hidden from the list of commands - * - * @return $this - */ - public function setHidden(bool $hidden = true): static - { - $this->hidden = $hidden; - - return $this; - } - - /** - * @return bool whether the command should be publicly shown or not - */ - public function isHidden(): bool - { - return $this->hidden; - } - - /** - * Sets the description for the command. - * - * @return $this - */ - public function setDescription(string $description): static - { - $this->description = $description; - - return $this; - } - - /** - * Returns the description for the command. - */ - public function getDescription(): string - { - return $this->description; - } - - /** - * Sets the help for the command. - * - * @return $this - */ - public function setHelp(string $help): static - { - $this->help = $help; - - return $this; - } - - /** - * Returns the help for the command. - */ - public function getHelp(): string - { - return $this->help; - } - - /** - * Returns the processed help for the command replacing the %command.name% and - * %command.full_name% patterns with the real values dynamically. - */ - public function getProcessedHelp(): string - { - $name = $this->name; - $isSingleCommand = $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()); - } - - /** - * Sets the aliases for the command. - * - * @param string[] $aliases An array of aliases for the command - * - * @return $this - * - * @throws InvalidArgumentException When an alias is invalid - */ - public function setAliases(iterable $aliases): static - { - $list = []; - - foreach ($aliases as $alias) { - $this->validateName($alias); - $list[] = $alias; - } - - $this->aliases = \is_array($aliases) ? $aliases : $list; - - return $this; - } - - /** - * Returns the aliases for the command. - */ - public function getAliases(): array - { - return $this->aliases; - } - - /** - * Returns the synopsis for the command. - * - * @param bool $short Whether to show the short version of the synopsis (with options folded) or not - */ - public function getSynopsis(bool $short = false): string - { - $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]; - } - - /** - * Add a command usage example, it'll be prefixed with the command name. - * - * @return $this - */ - public function addUsage(string $usage): static - { - if (!str_starts_with($usage, $this->name)) { - $usage = sprintf('%s %s', $this->name, $usage); - } - - $this->usages[] = $usage; - - return $this; - } - - /** - * Returns alternative usages of the command. - */ - public function getUsages(): array - { - return $this->usages; - } - - /** - * Gets a helper instance by name. - * - * @return HelperInterface - * - * @throws LogicException if no HelperSet is defined - * @throws InvalidArgumentException if the helper is not defined - */ - public function getHelper(string $name): mixed - { - 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); - } - - /** - * Validates a command name. - * - * It must be non-empty and parts can optionally be separated by ":". - * - * @throws InvalidArgumentException When the name is invalid - */ - private function validateName(string $name): void - { - if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) { - throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name)); - } - } -} diff --git a/tests/integration/vendor/symfony/console/Command/HelpCommand.php b/tests/integration/vendor/symfony/console/Command/HelpCommand.php deleted file mode 100644 index e6447b0..0000000 --- a/tests/integration/vendor/symfony/console/Command/HelpCommand.php +++ /dev/null @@ -1,82 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Command; - -use Symfony\Component\Console\Descriptor\ApplicationDescription; -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; - -/** - * HelpCommand displays the help for a given command. - * - * @author Fabien Potencier - */ -class HelpCommand extends Command -{ - private Command $command; - - /** - * @return void - */ - protected function configure() - { - $this->ignoreValidationErrors(); - - $this - ->setName('help') - ->setDefinition([ - new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help', fn () => array_keys((new ApplicationDescription($this->getApplication()))->getCommands())), - new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt', fn () => (new DescriptorHelper())->getFormats()), - new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), - ]) - ->setDescription('Display help for a command') - ->setHelp(<<<'EOF' -The %command.name% command displays help for a given command: - - %command.full_name% list - -You can also output the help in other formats by using the --format option: - - %command.full_name% --format=xml list - -To display the list of available commands, please use the list command. -EOF - ) - ; - } - - /** - * @return void - */ - public function setCommand(Command $command) - { - $this->command = $command; - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $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'), - ]); - - unset($this->command); - - return 0; - } -} diff --git a/tests/integration/vendor/symfony/console/Command/ListCommand.php b/tests/integration/vendor/symfony/console/Command/ListCommand.php deleted file mode 100644 index 5850c3d..0000000 --- a/tests/integration/vendor/symfony/console/Command/ListCommand.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Command; - -use Symfony\Component\Console\Descriptor\ApplicationDescription; -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; - -/** - * ListCommand displays the list of all available commands for the application. - * - * @author Fabien Potencier - */ -class ListCommand extends Command -{ - /** - * @return void - */ - protected function configure() - { - $this - ->setName('list') - ->setDefinition([ - new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', null, fn () => array_keys((new ApplicationDescription($this->getApplication()))->getNamespaces())), - 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', fn () => (new DescriptorHelper())->getFormats()), - new InputOption('short', null, InputOption::VALUE_NONE, 'To skip describing commands\' arguments'), - ]) - ->setDescription('List commands') - ->setHelp(<<<'EOF' -The %command.name% command lists all commands: - - %command.full_name% - -You can also display the commands for a specific namespace: - - %command.full_name% test - -You can also output the information in other formats by using the --format option: - - %command.full_name% --format=xml - -It's also possible to get raw list of commands (useful for embedding command runner): - - %command.full_name% --raw -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $helper = new DescriptorHelper(); - $helper->describe($output, $this->getApplication(), [ - 'format' => $input->getOption('format'), - 'raw_text' => $input->getOption('raw'), - 'namespace' => $input->getArgument('namespace'), - 'short' => $input->getOption('short'), - ]); - - return 0; - } -} diff --git a/tests/integration/vendor/symfony/console/Command/LockableTrait.php b/tests/integration/vendor/symfony/console/Command/LockableTrait.php deleted file mode 100644 index c1006a6..0000000 --- a/tests/integration/vendor/symfony/console/Command/LockableTrait.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Command; - -use Symfony\Component\Console\Exception\LogicException; -use Symfony\Component\Lock\LockFactory; -use Symfony\Component\Lock\LockInterface; -use Symfony\Component\Lock\Store\FlockStore; -use Symfony\Component\Lock\Store\SemaphoreStore; - -/** - * Basic lock feature for commands. - * - * @author Geoffrey Brier - */ -trait LockableTrait -{ - private ?LockInterface $lock = null; - - /** - * Locks a command. - */ - 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. Try running "composer require symfony/lock".'); - } - - 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; - } - - /** - * Releases the command lock if there is one. - */ - private function release(): void - { - if ($this->lock) { - $this->lock->release(); - $this->lock = null; - } - } -} diff --git a/tests/integration/vendor/symfony/console/ConsoleEvents.php b/tests/integration/vendor/symfony/console/ConsoleEvents.php deleted file mode 100644 index 6ae8f32..0000000 --- a/tests/integration/vendor/symfony/console/ConsoleEvents.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console; - -use Symfony\Component\Console\Event\ConsoleCommandEvent; -use Symfony\Component\Console\Event\ConsoleErrorEvent; -use Symfony\Component\Console\Event\ConsoleSignalEvent; -use Symfony\Component\Console\Event\ConsoleTerminateEvent; - -/** - * Contains all events dispatched by an Application. - * - * @author Francesco Levorato - */ -final class ConsoleEvents -{ - /** - * The COMMAND event allows you to attach listeners before any command is - * executed by the console. It also allows you to modify the command, input and output - * before they are handed to the command. - * - * @Event("Symfony\Component\Console\Event\ConsoleCommandEvent") - */ - public const COMMAND = 'console.command'; - - /** - * The SIGNAL event allows you to perform some actions - * after the command execution was interrupted. - * - * @Event("Symfony\Component\Console\Event\ConsoleSignalEvent") - */ - public const SIGNAL = 'console.signal'; - - /** - * The TERMINATE event allows you to attach listeners after a command is - * executed by the console. - * - * @Event("Symfony\Component\Console\Event\ConsoleTerminateEvent") - */ - public const TERMINATE = 'console.terminate'; - - /** - * The ERROR event occurs when an uncaught exception or error appears. - * - * This event allows you to deal with the exception/error or - * to modify the thrown exception. - * - * @Event("Symfony\Component\Console\Event\ConsoleErrorEvent") - */ - public const ERROR = 'console.error'; - - /** - * Event aliases. - * - * These aliases can be consumed by RegisterListenersPass. - */ - public const ALIASES = [ - ConsoleCommandEvent::class => self::COMMAND, - ConsoleErrorEvent::class => self::ERROR, - ConsoleSignalEvent::class => self::SIGNAL, - ConsoleTerminateEvent::class => self::TERMINATE, - ]; -} diff --git a/tests/integration/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php b/tests/integration/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php deleted file mode 100644 index 27705dd..0000000 --- a/tests/integration/vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\DependencyInjection; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Command\LazyCommand; -use Symfony\Component\Console\CommandLoader\ContainerCommandLoader; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -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\Reference; -use Symfony\Component\DependencyInjection\TypedReference; - -/** - * Registers console commands. - * - * @author Grégoire Pineau - */ -class AddConsoleCommandPass implements CompilerPassInterface -{ - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - $commandServices = $container->findTaggedServiceIds('console.command', true); - $lazyCommandMap = []; - $lazyCommandRefs = []; - $serviceIds = []; - - foreach ($commandServices as $id => $tags) { - $definition = $container->getDefinition($id); - $definition->addTag('container.no_preload'); - $class = $container->getParameterBag()->resolveValue($definition->getClass()); - - if (isset($tags[0]['command'])) { - $aliases = $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, 'console.command', Command::class)); - } - $aliases = str_replace('%', '%%', $class::getDefaultName() ?? ''); - } - - $aliases = explode('|', $aliases ?? ''); - $commandName = array_shift($aliases); - - if ($isHidden = '' === $commandName) { - $commandName = array_shift($aliases); - } - - if (null === $commandName) { - if (!$definition->isPublic() || $definition->isPrivate() || $definition->hasTag('container.private')) { - $commandId = 'console.command.public_alias.'.$id; - $container->setAlias($commandId, $id)->setPublic(true); - $id = $commandId; - } - $serviceIds[] = $id; - - continue; - } - - $description = $tags[0]['description'] ?? null; - - unset($tags[0]); - $lazyCommandMap[$commandName] = $id; - $lazyCommandRefs[$id] = new TypedReference($id, $class); - - foreach ($aliases as $alias) { - $lazyCommandMap[$alias] = $id; - } - - foreach ($tags as $tag) { - if (isset($tag['command'])) { - $aliases[] = $tag['command']; - $lazyCommandMap[$tag['command']] = $id; - } - - $description ??= $tag['description'] ?? null; - } - - $definition->addMethodCall('setName', [$commandName]); - - if ($aliases) { - $definition->addMethodCall('setAliases', [$aliases]); - } - - if ($isHidden) { - $definition->addMethodCall('setHidden', [true]); - } - - if (!$description) { - 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, 'console.command', Command::class)); - } - $description = str_replace('%', '%%', $class::getDefaultDescription() ?? ''); - } - - if ($description) { - $definition->addMethodCall('setDescription', [$description]); - - $container->register('.'.$id.'.lazy', LazyCommand::class) - ->setArguments([$commandName, $aliases, $description, $isHidden, new ServiceClosureArgument($lazyCommandRefs[$id])]); - - $lazyCommandRefs[$id] = new Reference('.'.$id.'.lazy'); - } - } - - $container - ->register('console.command_loader', ContainerCommandLoader::class) - ->setPublic(true) - ->addTag('container.no_preload') - ->setArguments([ServiceLocatorTagPass::register($container, $lazyCommandRefs), $lazyCommandMap]); - - $container->setParameter('console.command.ids', $serviceIds); - } -} diff --git a/tests/integration/vendor/symfony/console/Descriptor/ApplicationDescription.php b/tests/integration/vendor/symfony/console/Descriptor/ApplicationDescription.php deleted file mode 100644 index f8ed180..0000000 --- a/tests/integration/vendor/symfony/console/Descriptor/ApplicationDescription.php +++ /dev/null @@ -1,139 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Descriptor; - -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Exception\CommandNotFoundException; - -/** - * @author Jean-François Simon - * - * @internal - */ -class ApplicationDescription -{ - public const GLOBAL_NAMESPACE = '_global'; - - private Application $application; - private ?string $namespace; - private bool $showHidden; - private array $namespaces; - - /** - * @var array - */ - private array $commands; - - /** - * @var array - */ - private array $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 (!isset($this->namespaces)) { - $this->inspectApplication(); - } - - return $this->namespaces; - } - - /** - * @return Command[] - */ - public function getCommands(): array - { - if (!isset($this->commands)) { - $this->inspectApplication(); - } - - return $this->commands; - } - - /** - * @throws CommandNotFoundException - */ - 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(): void - { - $this->commands = []; - $this->namespaces = []; - - $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null); - foreach ($this->sortCommands($all) as $namespace => $commands) { - $names = []; - - /** @var Command $command */ - 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, \SORT_STRING); - foreach ($namespacedCommands as $key => $commandsSet) { - ksort($commandsSet); - $sortedCommands[$key] = $commandsSet; - } - } - - return $sortedCommands; - } -} diff --git a/tests/integration/vendor/symfony/console/Descriptor/Descriptor.php b/tests/integration/vendor/symfony/console/Descriptor/Descriptor.php deleted file mode 100644 index 7b2509c..0000000 --- a/tests/integration/vendor/symfony/console/Descriptor/Descriptor.php +++ /dev/null @@ -1,74 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * @author Jean-François Simon - * - * @internal - */ -abstract class Descriptor implements DescriptorInterface -{ - protected OutputInterface $output; - - public function describe(OutputInterface $output, object $object, array $options = []): void - { - $this->output = $output; - - match (true) { - $object instanceof InputArgument => $this->describeInputArgument($object, $options), - $object instanceof InputOption => $this->describeInputOption($object, $options), - $object instanceof InputDefinition => $this->describeInputDefinition($object, $options), - $object instanceof Command => $this->describeCommand($object, $options), - $object instanceof Application => $this->describeApplication($object, $options), - default => throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_debug_type($object))), - }; - } - - protected function write(string $content, bool $decorated = false): void - { - $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW); - } - - /** - * Describes an InputArgument instance. - */ - abstract protected function describeInputArgument(InputArgument $argument, array $options = []): void; - - /** - * Describes an InputOption instance. - */ - abstract protected function describeInputOption(InputOption $option, array $options = []): void; - - /** - * Describes an InputDefinition instance. - */ - abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []): void; - - /** - * Describes a Command instance. - */ - abstract protected function describeCommand(Command $command, array $options = []): void; - - /** - * Describes an Application instance. - */ - abstract protected function describeApplication(Application $application, array $options = []): void; -} diff --git a/tests/integration/vendor/symfony/console/Descriptor/DescriptorInterface.php b/tests/integration/vendor/symfony/console/Descriptor/DescriptorInterface.php deleted file mode 100644 index ab468a2..0000000 --- a/tests/integration/vendor/symfony/console/Descriptor/DescriptorInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Descriptor; - -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Descriptor interface. - * - * @author Jean-François Simon - */ -interface DescriptorInterface -{ - /** - * @return void - */ - public function describe(OutputInterface $output, object $object, array $options = []); -} diff --git a/tests/integration/vendor/symfony/console/Descriptor/JsonDescriptor.php b/tests/integration/vendor/symfony/console/Descriptor/JsonDescriptor.php deleted file mode 100644 index 9563037..0000000 --- a/tests/integration/vendor/symfony/console/Descriptor/JsonDescriptor.php +++ /dev/null @@ -1,166 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * JSON descriptor. - * - * @author Jean-François Simon - * - * @internal - */ -class JsonDescriptor extends Descriptor -{ - protected function describeInputArgument(InputArgument $argument, array $options = []): void - { - $this->writeData($this->getInputArgumentData($argument), $options); - } - - protected function describeInputOption(InputOption $option, array $options = []): void - { - $this->writeData($this->getInputOptionData($option), $options); - if ($option->isNegatable()) { - $this->writeData($this->getInputOptionData($option, true), $options); - } - } - - protected function describeInputDefinition(InputDefinition $definition, array $options = []): void - { - $this->writeData($this->getInputDefinitionData($definition), $options); - } - - protected function describeCommand(Command $command, array $options = []): void - { - $this->writeData($this->getCommandData($command, $options['short'] ?? false), $options); - } - - protected function describeApplication(Application $application, array $options = []): void - { - $describedNamespace = $options['namespace'] ?? null; - $description = new ApplicationDescription($application, $describedNamespace, true); - $commands = []; - - foreach ($description->getCommands() as $command) { - $commands[] = $this->getCommandData($command, $options['short'] ?? false); - } - - $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); - } - - /** - * Writes data as json. - */ - private function writeData(array $data, array $options): void - { - $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, bool $negated = false): array - { - return $negated ? [ - 'name' => '--no-'.$option->getName(), - 'shortcut' => '', - 'accept_value' => false, - 'is_value_required' => false, - 'is_multiple' => false, - 'description' => 'Negate the "--'.$option->getName().'" option', - 'default' => false, - ] : [ - '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); - if ($option->isNegatable()) { - $inputOptions['no-'.$name] = $this->getInputOptionData($option, true); - } - } - - return ['arguments' => $inputArguments, 'options' => $inputOptions]; - } - - private function getCommandData(Command $command, bool $short = false): array - { - $data = [ - 'name' => $command->getName(), - 'description' => $command->getDescription(), - ]; - - if ($short) { - $data += [ - 'usage' => $command->getAliases(), - ]; - } else { - $command->mergeApplicationDefinition(false); - - $data += [ - 'usage' => array_merge([$command->getSynopsis()], $command->getUsages(), $command->getAliases()), - 'help' => $command->getProcessedHelp(), - 'definition' => $this->getInputDefinitionData($command->getDefinition()), - ]; - } - - $data['hidden'] = $command->isHidden(); - - return $data; - } -} diff --git a/tests/integration/vendor/symfony/console/Descriptor/MarkdownDescriptor.php b/tests/integration/vendor/symfony/console/Descriptor/MarkdownDescriptor.php deleted file mode 100644 index b3f16ee..0000000 --- a/tests/integration/vendor/symfony/console/Descriptor/MarkdownDescriptor.php +++ /dev/null @@ -1,173 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * Markdown descriptor. - * - * @author Jean-François Simon - * - * @internal - */ -class MarkdownDescriptor extends Descriptor -{ - public function describe(OutputInterface $output, object $object, array $options = []): void - { - $decorated = $output->isDecorated(); - $output->setDecorated(false); - - parent::describe($output, $object, $options); - - $output->setDecorated($decorated); - } - - protected function write(string $content, bool $decorated = true): void - { - parent::write($content, $decorated); - } - - protected function describeInputArgument(InputArgument $argument, array $options = []): void - { - $this->write( - '#### `'.($argument->getName() ?: '')."`\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 = []): void - { - $name = '--'.$option->getName(); - if ($option->isNegatable()) { - $name .= '|--no-'.$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" - .'* Is negatable: '.($option->isNegatable() ? 'yes' : 'no')."\n" - .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`' - ); - } - - protected function describeInputDefinition(InputDefinition $definition, array $options = []): void - { - if ($showArguments = \count($definition->getArguments()) > 0) { - $this->write('### Arguments'); - foreach ($definition->getArguments() as $argument) { - $this->write("\n\n"); - $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->describeInputOption($option); - } - } - } - - protected function describeCommand(Command $command, array $options = []): void - { - if ($options['short'] ?? false) { - $this->write( - '`'.$command->getName()."`\n" - .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" - .($command->getDescription() ? $command->getDescription()."\n\n" : '') - .'### Usage'."\n\n" - .array_reduce($command->getAliases(), fn ($carry, $usage) => $carry.'* `'.$usage.'`'."\n") - ); - - return; - } - - $command->mergeApplicationDefinition(false); - - $this->write( - '`'.$command->getName()."`\n" - .str_repeat('-', Helper::width($command->getName()) + 2)."\n\n" - .($command->getDescription() ? $command->getDescription()."\n\n" : '') - .'### Usage'."\n\n" - .array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), fn ($carry, $usage) => $carry.'* `'.$usage.'`'."\n") - ); - - if ($help = $command->getProcessedHelp()) { - $this->write("\n"); - $this->write($help); - } - - $definition = $command->getDefinition(); - if ($definition->getOptions() || $definition->getArguments()) { - $this->write("\n\n"); - $this->describeInputDefinition($definition); - } - } - - protected function describeApplication(Application $application, array $options = []): void - { - $describedNamespace = $options['namespace'] ?? null; - $description = new ApplicationDescription($application, $describedNamespace); - $title = $this->getApplicationTitle($application); - - $this->write($title."\n".str_repeat('=', Helper::width($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(fn ($commandName) => sprintf('* [`%s`](#%s)', $commandName, str_replace(':', '', $description->getCommand($commandName)->getName())), $namespace['commands']))); - } - - foreach ($description->getCommands() as $command) { - $this->write("\n\n"); - $this->describeCommand($command, $options); - } - } - - 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'; - } -} diff --git a/tests/integration/vendor/symfony/console/Descriptor/TextDescriptor.php b/tests/integration/vendor/symfony/console/Descriptor/TextDescriptor.php deleted file mode 100644 index d04d102..0000000 --- a/tests/integration/vendor/symfony/console/Descriptor/TextDescriptor.php +++ /dev/null @@ -1,317 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * Text descriptor. - * - * @author Jean-François Simon - * - * @internal - */ -class TextDescriptor extends Descriptor -{ - protected function describeInputArgument(InputArgument $argument, array $options = []): void - { - if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) { - $default = sprintf(' [default: %s]', $this->formatDefaultValue($argument->getDefault())); - } else { - $default = ''; - } - - $totalWidth = $options['total_width'] ?? Helper::width($argument->getName()); - $spacingWidth = $totalWidth - \strlen($argument->getName()); - - $this->writeText(sprintf(' %s %s%s%s', - $argument->getName(), - str_repeat(' ', $spacingWidth), - // + 4 = 2 spaces before , 2 spaces after - preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()), - $default - ), $options); - } - - protected function describeInputOption(InputOption $option, array $options = []): void - { - if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) { - $default = sprintf(' [default: %s]', $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($option->isNegatable() ? '--%1$s|--no-%1$s' : '--%1$s%2$s', $option->getName(), $value) - ); - - $spacingWidth = $totalWidth - Helper::width($synopsis); - - $this->writeText(sprintf(' %s %s%s%s%s', - $synopsis, - str_repeat(' ', $spacingWidth), - // + 4 = 2 spaces before , 2 spaces after - preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()), - $default, - $option->isArray() ? ' (multiple values allowed)' : '' - ), $options); - } - - protected function describeInputDefinition(InputDefinition $definition, array $options = []): void - { - $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions()); - foreach ($definition->getArguments() as $argument) { - $totalWidth = max($totalWidth, Helper::width($argument->getName())); - } - - if ($definition->getArguments()) { - $this->writeText('Arguments:', $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('Options:', $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 = []): void - { - $command->mergeApplicationDefinition(false); - - if ($description = $command->getDescription()) { - $this->writeText('Description:', $options); - $this->writeText("\n"); - $this->writeText(' '.$description); - $this->writeText("\n\n"); - } - - $this->writeText('Usage:', $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->getDefinition(); - 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('Help:', $options); - $this->writeText("\n"); - $this->writeText(' '.str_replace("\n", "\n ", $help), $options); - $this->writeText("\n"); - } - } - - protected function describeApplication(Application $application, array $options = []): void - { - $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("Usage:\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) { - // make sure all alias commands are included when describing a specific namespace - $describedNamespaceInfo = reset($namespaces); - foreach ($describedNamespaceInfo['commands'] as $name) { - $commands[$name] = $description->getCommand($name); - } - } - - // calculate max. width based on available commands per namespace - $width = $this->getColumnWidth(array_merge(...array_values(array_map(fn ($namespace) => array_intersect($namespace['commands'], array_keys($commands)), array_values($namespaces))))); - - if ($describedNamespace) { - $this->writeText(sprintf('Available commands for the "%s" namespace:', $describedNamespace), $options); - } else { - $this->writeText('Available commands:', $options); - } - - foreach ($namespaces as $namespace) { - $namespace['commands'] = array_filter($namespace['commands'], fn ($name) => isset($commands[$name])); - - if (!$namespace['commands']) { - continue; - } - - if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { - $this->writeText("\n"); - $this->writeText(' '.$namespace['id'].'', $options); - } - - foreach ($namespace['commands'] as $name) { - $this->writeText("\n"); - $spacingWidth = $width - Helper::width($name); - $command = $commands[$name]; - $commandAliases = $name === $command->getName() ? $this->getCommandAliasesText($command) : ''; - $this->writeText(sprintf(' %s%s%s', $name, str_repeat(' ', $spacingWidth), $commandAliases.$command->getDescription()), $options); - } - } - - $this->writeText("\n"); - } - } - - private function writeText(string $content, array $options = []): void - { - $this->write( - isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content, - isset($options['raw_output']) ? !$options['raw_output'] : true - ); - } - - /** - * Formats command aliases to show them in the command description. - */ - private function getCommandAliasesText(Command $command): string - { - $text = ''; - $aliases = $command->getAliases(); - - if ($aliases) { - $text = '['.implode('|', $aliases).'] '; - } - - return $text; - } - - /** - * Formats input option/argument default value. - */ - private function formatDefaultValue(mixed $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)); - } - - /** - * @param array $commands - */ - private function getColumnWidth(array $commands): int - { - $widths = []; - - foreach ($commands as $command) { - if ($command instanceof Command) { - $widths[] = Helper::width($command->getName()); - foreach ($command->getAliases() as $alias) { - $widths[] = Helper::width($alias); - } - } else { - $widths[] = Helper::width($command); - } - } - - return $widths ? max($widths) + 2 : 0; - } - - /** - * @param InputOption[] $options - */ - private function calculateTotalWidthForOptions(array $options): int - { - $totalWidth = 0; - foreach ($options as $option) { - // "-" + shortcut + ", --" + name - $nameLength = 1 + max(Helper::width($option->getShortcut()), 1) + 4 + Helper::width($option->getName()); - if ($option->isNegatable()) { - $nameLength += 6 + Helper::width($option->getName()); // |--no- + name - } elseif ($option->acceptValue()) { - $valueLength = 1 + Helper::width($option->getName()); // = + value - $valueLength += $option->isValueOptional() ? 2 : 0; // [ + ] - - $nameLength += $valueLength; - } - $totalWidth = max($totalWidth, $nameLength); - } - - return $totalWidth; - } -} diff --git a/tests/integration/vendor/symfony/console/Descriptor/XmlDescriptor.php b/tests/integration/vendor/symfony/console/Descriptor/XmlDescriptor.php deleted file mode 100644 index 72580fd..0000000 --- a/tests/integration/vendor/symfony/console/Descriptor/XmlDescriptor.php +++ /dev/null @@ -1,232 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * XML descriptor. - * - * @author Jean-François Simon - * - * @internal - */ -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, bool $short = false): \DOMDocument - { - $dom = new \DOMDocument('1.0', 'UTF-8'); - $dom->appendChild($commandXML = $dom->createElement('command')); - - $commandXML->setAttribute('id', $command->getName()); - $commandXML->setAttribute('name', $command->getName()); - $commandXML->setAttribute('hidden', $command->isHidden() ? 1 : 0); - - $commandXML->appendChild($usagesXML = $dom->createElement('usages')); - - $commandXML->appendChild($descriptionXML = $dom->createElement('description')); - $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription()))); - - if ($short) { - foreach ($command->getAliases() as $usage) { - $usagesXML->appendChild($dom->createElement('usage', $usage)); - } - } else { - $command->mergeApplicationDefinition(false); - - foreach (array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()) as $usage) { - $usagesXML->appendChild($dom->createElement('usage', $usage)); - } - - $commandXML->appendChild($helpXML = $dom->createElement('help')); - $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp()))); - - $definitionXML = $this->getInputDefinitionDocument($command->getDefinition()); - $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0)); - } - - return $dom; - } - - public function getApplicationDocument(Application $application, string $namespace = null, bool $short = false): \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, $short)); - } - - 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 = []): void - { - $this->writeDocument($this->getInputArgumentDocument($argument)); - } - - protected function describeInputOption(InputOption $option, array $options = []): void - { - $this->writeDocument($this->getInputOptionDocument($option)); - } - - protected function describeInputDefinition(InputDefinition $definition, array $options = []): void - { - $this->writeDocument($this->getInputDefinitionDocument($definition)); - } - - protected function describeCommand(Command $command, array $options = []): void - { - $this->writeDocument($this->getCommandDocument($command, $options['short'] ?? false)); - } - - protected function describeApplication(Application $application, array $options = []): void - { - $this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null, $options['short'] ?? false)); - } - - /** - * Appends document children to parent node. - */ - private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent): void - { - foreach ($importedParent->childNodes as $childNode) { - $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true)); - } - } - - /** - * Writes DOM document. - */ - private function writeDocument(\DOMDocument $dom): void - { - $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)); - } - } - } - - if ($option->isNegatable()) { - $dom->appendChild($objectXML = $dom->createElement('option')); - $objectXML->setAttribute('name', '--no-'.$option->getName()); - $objectXML->setAttribute('shortcut', ''); - $objectXML->setAttribute('accept_value', 0); - $objectXML->setAttribute('is_value_required', 0); - $objectXML->setAttribute('is_multiple', 0); - $objectXML->appendChild($descriptionXML = $dom->createElement('description')); - $descriptionXML->appendChild($dom->createTextNode('Negate the "--'.$option->getName().'" option')); - } - - return $dom; - } -} diff --git a/tests/integration/vendor/symfony/console/Event/ConsoleCommandEvent.php b/tests/integration/vendor/symfony/console/Event/ConsoleCommandEvent.php deleted file mode 100644 index 31c9ee9..0000000 --- a/tests/integration/vendor/symfony/console/Event/ConsoleCommandEvent.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Event; - -/** - * Allows to do things before the command is executed, like skipping the command or changing the input. - * - * @author Fabien Potencier - */ -final class ConsoleCommandEvent extends ConsoleEvent -{ - /** - * The return code for skipped commands, this will also be passed into the terminate event. - */ - public const RETURN_CODE_DISABLED = 113; - - /** - * Indicates if the command should be run or skipped. - */ - private bool $commandShouldRun = true; - - /** - * Disables the command, so it won't be run. - */ - public function disableCommand(): bool - { - return $this->commandShouldRun = false; - } - - public function enableCommand(): bool - { - return $this->commandShouldRun = true; - } - - /** - * Returns true if the command is runnable, false otherwise. - */ - public function commandShouldRun(): bool - { - return $this->commandShouldRun; - } -} diff --git a/tests/integration/vendor/symfony/console/Event/ConsoleErrorEvent.php b/tests/integration/vendor/symfony/console/Event/ConsoleErrorEvent.php deleted file mode 100644 index d4a6912..0000000 --- a/tests/integration/vendor/symfony/console/Event/ConsoleErrorEvent.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Event; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Allows to handle throwables thrown while running a command. - * - * @author Wouter de Jong - */ -final class ConsoleErrorEvent extends ConsoleEvent -{ - private \Throwable $error; - private int $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->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); - } -} diff --git a/tests/integration/vendor/symfony/console/Event/ConsoleEvent.php b/tests/integration/vendor/symfony/console/Event/ConsoleEvent.php deleted file mode 100644 index 6ba1615..0000000 --- a/tests/integration/vendor/symfony/console/Event/ConsoleEvent.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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\Contracts\EventDispatcher\Event; - -/** - * Allows to inspect input and output of a command. - * - * @author Francesco Levorato - */ -class ConsoleEvent extends Event -{ - protected $command; - - private InputInterface $input; - private OutputInterface $output; - - public function __construct(?Command $command, InputInterface $input, OutputInterface $output) - { - $this->command = $command; - $this->input = $input; - $this->output = $output; - } - - /** - * Gets the command that is executed. - */ - public function getCommand(): ?Command - { - return $this->command; - } - - /** - * Gets the input instance. - */ - public function getInput(): InputInterface - { - return $this->input; - } - - /** - * Gets the output instance. - */ - public function getOutput(): OutputInterface - { - return $this->output; - } -} diff --git a/tests/integration/vendor/symfony/console/Event/ConsoleTerminateEvent.php b/tests/integration/vendor/symfony/console/Event/ConsoleTerminateEvent.php deleted file mode 100644 index de63c8f..0000000 --- a/tests/integration/vendor/symfony/console/Event/ConsoleTerminateEvent.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Event; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Allows to manipulate the exit code of a command after its execution. - * - * @author Francesco Levorato - */ -final class ConsoleTerminateEvent extends ConsoleEvent -{ - private int $exitCode; - - public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode) - { - parent::__construct($command, $input, $output); - - $this->setExitCode($exitCode); - } - - public function setExitCode(int $exitCode): void - { - $this->exitCode = $exitCode; - } - - public function getExitCode(): int - { - return $this->exitCode; - } -} diff --git a/tests/integration/vendor/symfony/console/EventListener/ErrorListener.php b/tests/integration/vendor/symfony/console/EventListener/ErrorListener.php deleted file mode 100644 index 9925a5f..0000000 --- a/tests/integration/vendor/symfony/console/EventListener/ErrorListener.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * @author James Halsall - * @author Robin Chalas - */ -class ErrorListener implements EventSubscriberInterface -{ - private ?LoggerInterface $logger; - - public function __construct(LoggerInterface $logger = null) - { - $this->logger = $logger; - } - - /** - * @return void - */ - 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()]); - } - - /** - * @return void - */ - 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(): array - { - return [ - ConsoleEvents::ERROR => ['onConsoleError', -128], - ConsoleEvents::TERMINATE => ['onConsoleTerminate', -128], - ]; - } - - private static function getInputString(ConsoleEvent $event): ?string - { - $commandName = $event->getCommand()?->getName(); - $input = $event->getInput(); - - if ($input instanceof \Stringable) { - if ($commandName) { - return str_replace(["'$commandName'", "\"$commandName\""], $commandName, (string) $input); - } - - return (string) $input; - } - - return $commandName; - } -} diff --git a/tests/integration/vendor/symfony/console/Exception/CommandNotFoundException.php b/tests/integration/vendor/symfony/console/Exception/CommandNotFoundException.php deleted file mode 100644 index 1e9f1c7..0000000 --- a/tests/integration/vendor/symfony/console/Exception/CommandNotFoundException.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Exception; - -/** - * Represents an incorrect command name typed in the console. - * - * @author Jérôme Tamarelle - */ -class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface -{ - private array $alternatives; - - /** - * @param string $message Exception message to throw - * @param string[] $alternatives List of similar defined names - * @param int $code Exception code - * @param \Throwable|null $previous Previous exception used for the exception chaining - */ - public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null) - { - parent::__construct($message, $code, $previous); - - $this->alternatives = $alternatives; - } - - /** - * @return string[] - */ - public function getAlternatives(): array - { - return $this->alternatives; - } -} diff --git a/tests/integration/vendor/symfony/console/Exception/ExceptionInterface.php b/tests/integration/vendor/symfony/console/Exception/ExceptionInterface.php deleted file mode 100644 index 1624e13..0000000 --- a/tests/integration/vendor/symfony/console/Exception/ExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Exception; - -/** - * ExceptionInterface. - * - * @author Jérôme Tamarelle - */ -interface ExceptionInterface extends \Throwable -{ -} diff --git a/tests/integration/vendor/symfony/console/Exception/InvalidArgumentException.php b/tests/integration/vendor/symfony/console/Exception/InvalidArgumentException.php deleted file mode 100644 index 07cc0b6..0000000 --- a/tests/integration/vendor/symfony/console/Exception/InvalidArgumentException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Exception; - -/** - * @author Jérôme Tamarelle - */ -class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/console/Exception/InvalidOptionException.php b/tests/integration/vendor/symfony/console/Exception/InvalidOptionException.php deleted file mode 100644 index 5cf6279..0000000 --- a/tests/integration/vendor/symfony/console/Exception/InvalidOptionException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Exception; - -/** - * Represents an incorrect option name or value typed in the console. - * - * @author Jérôme Tamarelle - */ -class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/console/Exception/LogicException.php b/tests/integration/vendor/symfony/console/Exception/LogicException.php deleted file mode 100644 index fc37b8d..0000000 --- a/tests/integration/vendor/symfony/console/Exception/LogicException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Exception; - -/** - * @author Jérôme Tamarelle - */ -class LogicException extends \LogicException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/console/Exception/RuntimeException.php b/tests/integration/vendor/symfony/console/Exception/RuntimeException.php deleted file mode 100644 index 51d7d80..0000000 --- a/tests/integration/vendor/symfony/console/Exception/RuntimeException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Exception; - -/** - * @author Jérôme Tamarelle - */ -class RuntimeException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/console/Formatter/OutputFormatter.php b/tests/integration/vendor/symfony/console/Formatter/OutputFormatter.php deleted file mode 100644 index 9cb6310..0000000 --- a/tests/integration/vendor/symfony/console/Formatter/OutputFormatter.php +++ /dev/null @@ -1,268 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Formatter; - -use Symfony\Component\Console\Exception\InvalidArgumentException; - -/** - * Formatter class for console output. - * - * @author Konstantin Kudryashov - * @author Roland Franssen - */ -class OutputFormatter implements WrappableOutputFormatterInterface -{ - private bool $decorated; - private array $styles = []; - private OutputFormatterStyleStack $styleStack; - - public function __clone() - { - $this->styleStack = clone $this->styleStack; - foreach ($this->styles as $key => $value) { - $this->styles[$key] = clone $value; - } - } - - /** - * Escapes "<" and ">" special chars in given text. - */ - public static function escape(string $text): string - { - $text = preg_replace('/([^\\\\]|^)([<>])/', '$1\\\\$2', $text); - - return self::escapeTrailingBackslash($text); - } - - /** - * Escapes trailing "\" in given text. - * - * @internal - */ - 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; - } - - /** - * Initializes console output formatter. - * - * @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances - */ - 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(); - } - - /** - * @return void - */ - public function setDecorated(bool $decorated) - { - $this->decorated = $decorated; - } - - public function isDecorated(): bool - { - return $this->decorated; - } - - /** - * @return void - */ - public function setStyle(string $name, OutputFormatterStyleInterface $style) - { - $this->styles[strtolower($name)] = $style; - } - - public function hasStyle(string $name): bool - { - return isset($this->styles[strtolower($name)]); - } - - public function getStyle(string $name): OutputFormatterStyleInterface - { - if (!$this->hasStyle($name)) { - throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name)); - } - - return $this->styles[strtolower($name)]; - } - - public function format(?string $message): ?string - { - return $this->formatAndWrap($message, 0); - } - - /** - * @return string - */ - public function formatAndWrap(?string $message, int $width) - { - if (null === $message) { - return ''; - } - - $offset = 0; - $output = ''; - $openTagRegex = '[a-z](?:[^\\\\<>]*+ | \\\\.)*'; - $closeTagRegex = '[a-z][^<>]*+'; - $currentLineLength = 0; - preg_match_all("#<(($openTagRegex) | /($closeTagRegex)?)>#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; - } - - // add the text up to the next tag - $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset), $output, $width, $currentLineLength); - $offset = $pos + \strlen($text); - - // opening tag? - 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); - - return strtr($output, ["\0" => '\\', '\\<' => '<', '\\>' => '>']); - } - - public function getStyleStack(): OutputFormatterStyleStack - { - return $this->styleStack; - } - - /** - * Tries to create new style instance from string. - */ - 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]) { - $url = preg_replace('{\\\\([<>])}', '$1', $match[1]); - $style->setHref($url); - } 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; - } - - /** - * Applies current style from stack to text, if must be applied. - */ - 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 && !str_ends_with($current, "\n")) { - $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); - } -} diff --git a/tests/integration/vendor/symfony/console/Formatter/OutputFormatterInterface.php b/tests/integration/vendor/symfony/console/Formatter/OutputFormatterInterface.php deleted file mode 100644 index 433cd41..0000000 --- a/tests/integration/vendor/symfony/console/Formatter/OutputFormatterInterface.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Formatter; - -/** - * Formatter interface for console output. - * - * @author Konstantin Kudryashov - */ -interface OutputFormatterInterface -{ - /** - * Sets the decorated flag. - * - * @return void - */ - public function setDecorated(bool $decorated); - - /** - * Whether the output will decorate messages. - */ - public function isDecorated(): bool; - - /** - * Sets a new style. - * - * @return void - */ - public function setStyle(string $name, OutputFormatterStyleInterface $style); - - /** - * Checks if output formatter has style with specified name. - */ - public function hasStyle(string $name): bool; - - /** - * Gets style options from style with specified name. - * - * @throws \InvalidArgumentException When style isn't defined - */ - public function getStyle(string $name): OutputFormatterStyleInterface; - - /** - * Formats a message according to the given styles. - */ - public function format(?string $message): ?string; -} diff --git a/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyle.php b/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyle.php deleted file mode 100644 index 346a474..0000000 --- a/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyle.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Formatter; - -use Symfony\Component\Console\Color; - -/** - * Formatter style class for defining styles. - * - * @author Konstantin Kudryashov - */ -class OutputFormatterStyle implements OutputFormatterStyleInterface -{ - private Color $color; - private string $foreground; - private string $background; - private array $options; - private ?string $href = null; - private bool $handlesHrefGracefully; - - /** - * Initializes output formatter style. - * - * @param string|null $foreground The style foreground color name - * @param string|null $background The style background color name - */ - public function __construct(string $foreground = null, string $background = null, array $options = []) - { - $this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options); - } - - /** - * @return void - */ - public function setForeground(string $color = null) - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - $this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options); - } - - /** - * @return void - */ - public function setBackground(string $color = null) - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - $this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options); - } - - public function setHref(string $url): void - { - $this->href = $url; - } - - /** - * @return void - */ - public function setOption(string $option) - { - $this->options[] = $option; - $this->color = new Color($this->foreground, $this->background, $this->options); - } - - /** - * @return void - */ - public function unsetOption(string $option) - { - $pos = array_search($option, $this->options); - if (false !== $pos) { - unset($this->options[$pos]); - } - - $this->color = new Color($this->foreground, $this->background, $this->options); - } - - /** - * @return void - */ - public function setOptions(array $options) - { - $this->color = new Color($this->foreground, $this->background, $this->options = $options); - } - - public function apply(string $text): string - { - $this->handlesHrefGracefully ??= 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') - && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100) - && !isset($_SERVER['IDEA_INITIAL_DIRECTORY']); - - if (null !== $this->href && $this->handlesHrefGracefully) { - $text = "\033]8;;$this->href\033\\$text\033]8;;\033\\"; - } - - return $this->color->apply($text); - } -} diff --git a/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php b/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php deleted file mode 100644 index 3b15098..0000000 --- a/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Formatter; - -/** - * Formatter style interface for defining styles. - * - * @author Konstantin Kudryashov - */ -interface OutputFormatterStyleInterface -{ - /** - * Sets style foreground color. - * - * @return void - */ - public function setForeground(?string $color); - - /** - * Sets style background color. - * - * @return void - */ - public function setBackground(?string $color); - - /** - * Sets some specific style option. - * - * @return void - */ - public function setOption(string $option); - - /** - * Unsets some specific style option. - * - * @return void - */ - public function unsetOption(string $option); - - /** - * Sets multiple style options at once. - * - * @return void - */ - public function setOptions(array $options); - - /** - * Applies the style to a given text. - */ - public function apply(string $text): string; -} diff --git a/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php b/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php deleted file mode 100644 index f98c2ef..0000000 --- a/tests/integration/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Formatter; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Contracts\Service\ResetInterface; - -/** - * @author Jean-François Simon - */ -class OutputFormatterStyleStack implements ResetInterface -{ - /** - * @var OutputFormatterStyleInterface[] - */ - private array $styles = []; - - private OutputFormatterStyleInterface $emptyStyle; - - public function __construct(OutputFormatterStyleInterface $emptyStyle = null) - { - $this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle(); - $this->reset(); - } - - /** - * Resets stack (ie. empty internal arrays). - * - * @return void - */ - public function reset() - { - $this->styles = []; - } - - /** - * Pushes a style in the stack. - * - * @return void - */ - public function push(OutputFormatterStyleInterface $style) - { - $this->styles[] = $style; - } - - /** - * Pops a style from the stack. - * - * @throws InvalidArgumentException When style tags incorrectly nested - */ - public function pop(OutputFormatterStyleInterface $style = null): OutputFormatterStyleInterface - { - if (!$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.'); - } - - /** - * Computes current style with stacks top codes. - */ - public function getCurrent(): OutputFormatterStyleInterface - { - if (!$this->styles) { - return $this->emptyStyle; - } - - return $this->styles[\count($this->styles) - 1]; - } - - /** - * @return $this - */ - public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle): static - { - $this->emptyStyle = $emptyStyle; - - return $this; - } - - public function getEmptyStyle(): OutputFormatterStyleInterface - { - return $this->emptyStyle; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/DebugFormatterHelper.php b/tests/integration/vendor/symfony/console/Helper/DebugFormatterHelper.php deleted file mode 100644 index 9ea7fb9..0000000 --- a/tests/integration/vendor/symfony/console/Helper/DebugFormatterHelper.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -/** - * Helps outputting debug information when running an external program from a command. - * - * An external program can be a Process, an HTTP request, or anything else. - * - * @author Fabien Potencier - */ -class DebugFormatterHelper extends Helper -{ - private const COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default']; - private array $started = []; - private int $count = -1; - - /** - * Starts a debug formatting session. - */ - public function start(string $id, string $message, string $prefix = 'RUN'): string - { - $this->started[$id] = ['border' => ++$this->count % \count(self::COLORS)]; - - return sprintf("%s %s %s\n", $this->getBorder($id), $prefix, $message); - } - - /** - * Adds progress to a formatting session. - */ - public function progress(string $id, string $buffer, bool $error = false, string $prefix = 'OUT', string $errorPrefix = 'ERR'): string - { - $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 %s ', $this->getBorder($id), $errorPrefix); - $this->started[$id]['err'] = true; - } - - $message .= str_replace("\n", sprintf("\n%s %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 %s ', $this->getBorder($id), $prefix); - $this->started[$id]['out'] = true; - } - - $message .= str_replace("\n", sprintf("\n%s %s ", $this->getBorder($id), $prefix), $buffer); - } - - return $message; - } - - /** - * Stops a formatting session. - */ - public function stop(string $id, string $message, bool $successful, string $prefix = 'RES'): string - { - $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : ''; - - if ($successful) { - return sprintf("%s%s %s %s\n", $trailingEOL, $this->getBorder($id), $prefix, $message); - } - - $message = sprintf("%s%s %s %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(' ', self::COLORS[$this->started[$id]['border']]); - } - - public function getName(): string - { - return 'debug_formatter'; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/DescriptorHelper.php b/tests/integration/vendor/symfony/console/Helper/DescriptorHelper.php deleted file mode 100644 index eb32bce..0000000 --- a/tests/integration/vendor/symfony/console/Helper/DescriptorHelper.php +++ /dev/null @@ -1,93 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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\ReStructuredTextDescriptor; -use Symfony\Component\Console\Descriptor\TextDescriptor; -use Symfony\Component\Console\Descriptor\XmlDescriptor; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * This class adds helper method to describe objects in various formats. - * - * @author Jean-François Simon - */ -class DescriptorHelper extends Helper -{ - /** - * @var DescriptorInterface[] - */ - private array $descriptors = []; - - public function __construct() - { - $this - ->register('txt', new TextDescriptor()) - ->register('xml', new XmlDescriptor()) - ->register('json', new JsonDescriptor()) - ->register('md', new MarkdownDescriptor()) - ->register('rst', new ReStructuredTextDescriptor()) - ; - } - - /** - * Describes an object if supported. - * - * Available options are: - * * format: string, the output format name - * * raw_text: boolean, sets output type as raw - * - * @return void - * - * @throws InvalidArgumentException when the given format is not supported - */ - public function describe(OutputInterface $output, ?object $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); - } - - /** - * Registers a descriptor. - * - * @return $this - */ - public function register(string $format, DescriptorInterface $descriptor): static - { - $this->descriptors[$format] = $descriptor; - - return $this; - } - - public function getName(): string - { - return 'descriptor'; - } - - public function getFormats(): array - { - return array_keys($this->descriptors); - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/FormatterHelper.php b/tests/integration/vendor/symfony/console/Helper/FormatterHelper.php deleted file mode 100644 index 279e4c7..0000000 --- a/tests/integration/vendor/symfony/console/Helper/FormatterHelper.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Formatter\OutputFormatter; - -/** - * The Formatter class provides helpers to format messages. - * - * @author Fabien Potencier - */ -class FormatterHelper extends Helper -{ - /** - * Formats a message within a section. - */ - public function formatSection(string $section, string $message, string $style = 'info'): string - { - return sprintf('<%s>[%s] %s', $style, $section, $style, $message); - } - - /** - * Formats a message as a block of text. - */ - public function formatBlock(string|array $messages, string $style, bool $large = false): string - { - 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::width($message) + ($large ? 4 : 2), $len); - } - - $messages = $large ? [str_repeat(' ', $len)] : []; - for ($i = 0; isset($lines[$i]); ++$i) { - $messages[] = $lines[$i].str_repeat(' ', $len - self::width($lines[$i])); - } - if ($large) { - $messages[] = str_repeat(' ', $len); - } - - for ($i = 0; isset($messages[$i]); ++$i) { - $messages[$i] = sprintf('<%s>%s', $style, $messages[$i], $style); - } - - return implode("\n", $messages); - } - - /** - * Truncates a message to the given length. - */ - public function truncate(string $message, int $length, string $suffix = '...'): string - { - $computedLength = $length - self::width($suffix); - - if ($computedLength > self::width($message)) { - return $message; - } - - return self::substr($message, 0, $length).$suffix; - } - - public function getName(): string - { - return 'formatter'; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/Helper.php b/tests/integration/vendor/symfony/console/Helper/Helper.php deleted file mode 100644 index 3631b30..0000000 --- a/tests/integration/vendor/symfony/console/Helper/Helper.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Formatter\OutputFormatterInterface; -use Symfony\Component\String\UnicodeString; - -/** - * Helper is the base class for all helper classes. - * - * @author Fabien Potencier - */ -abstract class Helper implements HelperInterface -{ - protected $helperSet; - - /** - * @return void - */ - public function setHelperSet(HelperSet $helperSet = null) - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - $this->helperSet = $helperSet; - } - - public function getHelperSet(): ?HelperSet - { - return $this->helperSet; - } - - /** - * Returns the width of a string, using mb_strwidth if it is available. - * The width is how many characters positions the string will use. - */ - public static function width(?string $string): int - { - $string ??= ''; - - if (preg_match('//u', $string)) { - return (new UnicodeString($string))->width(false); - } - - if (false === $encoding = mb_detect_encoding($string, null, true)) { - return \strlen($string); - } - - return mb_strwidth($string, $encoding); - } - - /** - * Returns the length of a string, using mb_strlen if it is available. - * The length is related to how many bytes the string will use. - */ - public static function length(?string $string): int - { - $string ??= ''; - - if (preg_match('//u', $string)) { - return (new UnicodeString($string))->length(); - } - - if (false === $encoding = mb_detect_encoding($string, null, true)) { - return \strlen($string); - } - - return mb_strlen($string, $encoding); - } - - /** - * Returns the subset of a string, using mb_substr if it is available. - */ - public static function substr(?string $string, int $from, int $length = null): string - { - $string ??= ''; - - if (false === $encoding = mb_detect_encoding($string, null, true)) { - return substr($string, $from, $length); - } - - return mb_substr($string, $from, $length, $encoding); - } - - /** - * @return string - */ - public static function formatTime(int|float $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]; - } - } - } - } - - /** - * @return string - */ - public static function formatMemory(int $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); - } - - /** - * @return string - */ - public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string) - { - $isDecorated = $formatter->isDecorated(); - $formatter->setDecorated(false); - // remove <...> formatting - $string = $formatter->format($string ?? ''); - // remove already formatted characters - $string = preg_replace("/\033\[[^m]*m/", '', $string ?? ''); - // remove terminal hyperlinks - $string = preg_replace('/\\033]8;[^;]*;[^\\033]*\\033\\\\/', '', $string ?? ''); - $formatter->setDecorated($isDecorated); - - return $string; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/HelperInterface.php b/tests/integration/vendor/symfony/console/Helper/HelperInterface.php deleted file mode 100644 index ab626c9..0000000 --- a/tests/integration/vendor/symfony/console/Helper/HelperInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -/** - * HelperInterface is the interface all helpers must implement. - * - * @author Fabien Potencier - */ -interface HelperInterface -{ - /** - * Sets the helper set associated with this helper. - * - * @return void - */ - public function setHelperSet(?HelperSet $helperSet); - - /** - * Gets the helper set associated with this helper. - */ - public function getHelperSet(): ?HelperSet; - - /** - * Returns the canonical name of this helper. - * - * @return string - */ - public function getName(); -} diff --git a/tests/integration/vendor/symfony/console/Helper/HelperSet.php b/tests/integration/vendor/symfony/console/Helper/HelperSet.php deleted file mode 100644 index dc5d499..0000000 --- a/tests/integration/vendor/symfony/console/Helper/HelperSet.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Exception\InvalidArgumentException; - -/** - * HelperSet represents a set of helpers to be used with a command. - * - * @author Fabien Potencier - * - * @implements \IteratorAggregate - */ -class HelperSet implements \IteratorAggregate -{ - /** @var array */ - private array $helpers = []; - - /** - * @param HelperInterface[] $helpers - */ - public function __construct(array $helpers = []) - { - foreach ($helpers as $alias => $helper) { - $this->set($helper, \is_int($alias) ? null : $alias); - } - } - - /** - * @return void - */ - public function set(HelperInterface $helper, string $alias = null) - { - $this->helpers[$helper->getName()] = $helper; - if (null !== $alias) { - $this->helpers[$alias] = $helper; - } - - $helper->setHelperSet($this); - } - - /** - * Returns true if the helper if defined. - */ - public function has(string $name): bool - { - return isset($this->helpers[$name]); - } - - /** - * Gets a helper value. - * - * @throws InvalidArgumentException if the helper is not defined - */ - public function get(string $name): HelperInterface - { - if (!$this->has($name)) { - throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name)); - } - - return $this->helpers[$name]; - } - - public function getIterator(): \Traversable - { - return new \ArrayIterator($this->helpers); - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/InputAwareHelper.php b/tests/integration/vendor/symfony/console/Helper/InputAwareHelper.php deleted file mode 100644 index 6f82259..0000000 --- a/tests/integration/vendor/symfony/console/Helper/InputAwareHelper.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Input\InputAwareInterface; -use Symfony\Component\Console\Input\InputInterface; - -/** - * An implementation of InputAwareInterface for Helpers. - * - * @author Wouter J - */ -abstract class InputAwareHelper extends Helper implements InputAwareInterface -{ - protected $input; - - /** - * @return void - */ - public function setInput(InputInterface $input) - { - $this->input = $input; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/ProcessHelper.php b/tests/integration/vendor/symfony/console/Helper/ProcessHelper.php deleted file mode 100644 index 26d35a1..0000000 --- a/tests/integration/vendor/symfony/console/Helper/ProcessHelper.php +++ /dev/null @@ -1,137 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * The ProcessHelper class provides helpers to run external processes. - * - * @author Fabien Potencier - * - * @final - */ -class ProcessHelper extends Helper -{ - /** - * Runs an external process. - * - * @param array|Process $cmd An instance of Process or an array of the command and arguments - * @param callable|null $callback A PHP callback to run whenever there is some - * output available on STDOUT or STDERR - */ - public function run(OutputInterface $output, array|Process $cmd, string $error = null, callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process - { - 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_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('%s', $this->escapeString($error))); - } - - return $process; - } - - /** - * Runs the process. - * - * This is identical to run() except that an exception is thrown if the process - * exits with a non-zero exit code. - * - * @param array|Process $cmd An instance of Process or a command to run - * @param callable|null $callback A PHP callback to run whenever there is some - * output available on STDOUT or STDERR - * - * @throws ProcessFailedException - * - * @see run() - */ - public function mustRun(OutputInterface $output, array|Process $cmd, string $error = null, callable $callback = null): Process - { - $process = $this->run($output, $cmd, $error, $callback); - - if (!$process->isSuccessful()) { - throw new ProcessFailedException($process); - } - - return $process; - } - - /** - * Wraps a Process callback to add debugging output. - */ - public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable - { - 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(): string - { - return 'process'; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/ProgressBar.php b/tests/integration/vendor/symfony/console/Helper/ProgressBar.php deleted file mode 100644 index 19faea4..0000000 --- a/tests/integration/vendor/symfony/console/Helper/ProgressBar.php +++ /dev/null @@ -1,612 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Cursor; -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; - -/** - * The ProgressBar provides helpers to display progress output. - * - * @author Fabien Potencier - * @author Chris Jones - */ -final class ProgressBar -{ - public const FORMAT_VERBOSE = 'verbose'; - public const FORMAT_VERY_VERBOSE = 'very_verbose'; - public const FORMAT_DEBUG = 'debug'; - public const FORMAT_NORMAL = 'normal'; - - private const FORMAT_VERBOSE_NOMAX = 'verbose_nomax'; - private const FORMAT_VERY_VERBOSE_NOMAX = 'very_verbose_nomax'; - private const FORMAT_DEBUG_NOMAX = 'debug_nomax'; - private const FORMAT_NORMAL_NOMAX = 'normal_nomax'; - - private int $barWidth = 28; - private string $barChar; - private string $emptyBarChar = '-'; - private string $progressChar = '>'; - private ?string $format = null; - private ?string $internalFormat = null; - private ?int $redrawFreq = 1; - private int $writeCount = 0; - private float $lastWriteTime = 0; - private float $minSecondsBetweenRedraws = 0; - private float $maxSecondsBetweenRedraws = 1; - private OutputInterface $output; - private int $step = 0; - private int $startingStep = 0; - private ?int $max = null; - private int $startTime; - private int $stepWidth; - private float $percent = 0.0; - private array $messages = []; - private bool $overwrite = true; - private Terminal $terminal; - private ?string $previousMessage = null; - private Cursor $cursor; - private array $placeholders = []; - - private static array $formatters; - private static array $formats; - - /** - * @param int $max Maximum steps (0 if unknown) - */ - public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 1 / 25) - { - 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()) { - // disable overwrite when output does not support ANSI codes. - $this->overwrite = false; - - // set a reasonable redraw frequency so output isn't flooded - $this->redrawFreq = null; - } - - $this->startTime = time(); - $this->cursor = new Cursor($output); - } - - /** - * Sets a placeholder formatter for a given name, globally for all instances of ProgressBar. - * - * This method also allow you to override an existing placeholder. - * - * @param string $name The placeholder name (including the delimiter char like %) - * @param callable(ProgressBar):string $callable A PHP callable - */ - public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void - { - self::$formatters ??= self::initPlaceholderFormatters(); - - self::$formatters[$name] = $callable; - } - - /** - * Gets the placeholder formatter for a given name. - * - * @param string $name The placeholder name (including the delimiter char like %) - */ - public static function getPlaceholderFormatterDefinition(string $name): ?callable - { - self::$formatters ??= self::initPlaceholderFormatters(); - - return self::$formatters[$name] ?? null; - } - - /** - * Sets a placeholder formatter for a given name, for this instance only. - * - * @param callable(ProgressBar):string $callable A PHP callable - */ - public function setPlaceholderFormatter(string $name, callable $callable): void - { - $this->placeholders[$name] = $callable; - } - - /** - * Gets the placeholder formatter for a given name. - * - * @param string $name The placeholder name (including the delimiter char like %) - */ - public function getPlaceholderFormatter(string $name): ?callable - { - return $this->placeholders[$name] ?? $this::getPlaceholderFormatterDefinition($name); - } - - /** - * Sets a format for a given name. - * - * This method also allow you to override an existing format. - * - * @param string $name The format name - * @param string $format A format string - */ - public static function setFormatDefinition(string $name, string $format): void - { - self::$formats ??= self::initFormats(); - - self::$formats[$name] = $format; - } - - /** - * Gets the format for a given name. - * - * @param string $name The format name - */ - public static function getFormatDefinition(string $name): ?string - { - self::$formats ??= self::initFormats(); - - return self::$formats[$name] ?? null; - } - - /** - * Associates a text with a named placeholder. - * - * The text is displayed when the progress bar is rendered but only - * when the corresponding placeholder is part of the custom format line - * (by wrapping the name with %). - * - * @param string $message The text to associate with the placeholder - * @param string $name The name of the placeholder - */ - public function setMessage(string $message, string $name = 'message'): void - { - $this->messages[$name] = $message; - } - - public function getMessage(string $name = 'message'): string - { - 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(): float - { - 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 getEstimated(): float - { - if (0 === $this->step || $this->step === $this->startingStep) { - return 0; - } - - return round((time() - $this->startTime) / ($this->step - $this->startingStep) * $this->max); - } - - public function getRemaining(): float - { - if (!$this->step) { - return 0; - } - - return round((time() - $this->startTime) / ($this->step - $this->startingStep) * ($this->max - $this->step)); - } - - public function setBarWidth(int $size): void - { - $this->barWidth = max(1, $size); - } - - public function getBarWidth(): int - { - return $this->barWidth; - } - - public function setBarCharacter(string $char): void - { - $this->barChar = $char; - } - - public function getBarCharacter(): string - { - return $this->barChar ?? ($this->max ? '=' : $this->emptyBarChar); - } - - public function setEmptyBarCharacter(string $char): void - { - $this->emptyBarChar = $char; - } - - public function getEmptyBarCharacter(): string - { - return $this->emptyBarChar; - } - - public function setProgressCharacter(string $char): void - { - $this->progressChar = $char; - } - - public function getProgressCharacter(): string - { - return $this->progressChar; - } - - public function setFormat(string $format): void - { - $this->format = null; - $this->internalFormat = $format; - } - - /** - * Sets the redraw frequency. - * - * @param int|null $freq The frequency in steps - */ - public function setRedrawFrequency(?int $freq): void - { - $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; - } - - /** - * Returns an iterator that will automatically update the progress bar when iterated. - * - * @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable - */ - 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(); - } - - /** - * Starts the progress output. - * - * @param int|null $max Number of steps to complete the bar (0 if indeterminate), null to leave unchanged - * @param int $startAt The starting point of the bar (useful e.g. when resuming a previously started bar) - */ - public function start(int $max = null, int $startAt = 0): void - { - $this->startTime = time(); - $this->step = $startAt; - $this->startingStep = $startAt; - - $startAt > 0 ? $this->setProgress($startAt) : $this->percent = 0.0; - - if (null !== $max) { - $this->setMaxSteps($max); - } - - $this->display(); - } - - /** - * Advances the progress output X steps. - * - * @param int $step Number of steps to advance - */ - public function advance(int $step = 1): void - { - $this->setProgress($this->step + $step); - } - - /** - * Sets whether to overwrite the progressbar, false for new line. - */ - public function setOverwrite(bool $overwrite): void - { - $this->overwrite = $overwrite; - } - - public function setProgress(int $step): void - { - 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; - - // Draw regardless of other limits - if ($this->max === $step) { - $this->display(); - - return; - } - - // Throttling - if ($timeInterval < $this->minSecondsBetweenRedraws) { - return; - } - - // Draw each step period, but not too late - if ($prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws) { - $this->display(); - } - } - - public function setMaxSteps(int $max): void - { - $this->format = null; - $this->max = max(0, $max); - $this->stepWidth = $this->max ? Helper::width((string) $this->max) : 4; - } - - /** - * Finishes the progress output. - */ - public function finish(): void - { - if (!$this->max) { - $this->max = $this->step; - } - - if ($this->step === $this->max && !$this->overwrite) { - // prevent double 100% output - return; - } - - $this->setProgress($this->max); - } - - /** - * Outputs the current progress string. - */ - 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()); - } - - /** - * Removes the progress bar from the current line. - * - * This is useful if you wish to write some output - * while a progress bar is running. - * Call display() to show the progress bar again. - */ - 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): void - { - // try to use the _nomax variant if available - 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; - } - } - - /** - * Overwrites a previous message to the output. - */ - 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", $this->previousMessage); - $lineCount = \count($messageLines); - foreach ($messageLines as $messageLine) { - $messageLineLength = Helper::width(Helper::removeDecoration($this->output->getFormatter(), $messageLine)); - if ($messageLineLength > $this->terminal->getWidth()) { - $lineCount += floor($messageLineLength / $this->terminal->getWidth()); - } - } - $this->output->clear($lineCount); - } else { - $lineCount = substr_count($this->previousMessage, "\n"); - for ($i = 0; $i < $lineCount; ++$i) { - $this->cursor->moveToColumn(1); - $this->cursor->clearLine(); - $this->cursor->moveUp(); - } - - $this->cursor->moveToColumn(1); - $this->cursor->clearLine(); - } - } - } 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 - { - return match ($this->output->getVerbosity()) { - // OutputInterface::VERBOSITY_QUIET: display is disabled anyway - OutputInterface::VERBOSITY_VERBOSE => $this->max ? self::FORMAT_VERBOSE : self::FORMAT_VERBOSE_NOMAX, - OutputInterface::VERBOSITY_VERY_VERBOSE => $this->max ? self::FORMAT_VERY_VERBOSE : self::FORMAT_VERY_VERBOSE_NOMAX, - OutputInterface::VERBOSITY_DEBUG => $this->max ? self::FORMAT_DEBUG : self::FORMAT_DEBUG_NOMAX, - default => $this->max ? self::FORMAT_NORMAL : self::FORMAT_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::length(Helper::removeDecoration($output->getFormatter(), $bar->getProgressCharacter())); - $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars); - } - - return $display; - }, - 'elapsed' => fn (self $bar) => 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.'); - } - - return Helper::formatTime($bar->getRemaining()); - }, - '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.'); - } - - return Helper::formatTime($bar->getEstimated()); - }, - 'memory' => fn (self $bar) => Helper::formatMemory(memory_get_usage(true)), - 'current' => fn (self $bar) => str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT), - 'max' => fn (self $bar) => $bar->getMaxSteps(), - 'percent' => fn (self $bar) => floor($bar->getProgressPercent() * 100), - ]; - } - - private static function initFormats(): array - { - return [ - self::FORMAT_NORMAL => ' %current%/%max% [%bar%] %percent:3s%%', - self::FORMAT_NORMAL_NOMAX => ' %current% [%bar%]', - - self::FORMAT_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%', - self::FORMAT_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%', - - self::FORMAT_VERY_VERBOSE => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%', - self::FORMAT_VERY_VERBOSE_NOMAX => ' %current% [%bar%] %elapsed:6s%', - - self::FORMAT_DEBUG => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%', - self::FORMAT_DEBUG_NOMAX => ' %current% [%bar%] %elapsed:6s% %memory:6s%', - ]; - } - - private function buildLine(): string - { - \assert(null !== $this->format); - - $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i"; - $callback = function ($matches) { - if ($formatter = $this->getPlaceholderFormatter($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); - - // gets string length for each sub line with multiline format - $linesLength = array_map(fn ($subLine) => Helper::width(Helper::removeDecoration($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); - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/ProgressIndicator.php b/tests/integration/vendor/symfony/console/Helper/ProgressIndicator.php deleted file mode 100644 index 84dbef9..0000000 --- a/tests/integration/vendor/symfony/console/Helper/ProgressIndicator.php +++ /dev/null @@ -1,235 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * @author Kevin Bond - */ -class ProgressIndicator -{ - private const FORMATS = [ - '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%)', - ]; - - private OutputInterface $output; - private int $startTime; - private ?string $format = null; - private ?string $message = null; - private array $indicatorValues; - private int $indicatorCurrent; - private int $indicatorChangeInterval; - private float $indicatorUpdateTime; - private bool $started = false; - - /** - * @var array - */ - private static array $formatters; - - /** - * @param int $indicatorChangeInterval Change interval in milliseconds - * @param array|null $indicatorValues Animated indicator characters - */ - public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null) - { - $this->output = $output; - - $format ??= $this->determineBestFormat(); - $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(); - } - - /** - * Sets the current indicator message. - * - * @return void - */ - public function setMessage(?string $message) - { - $this->message = $message; - - $this->display(); - } - - /** - * Starts the indicator output. - * - * @return void - */ - public function start(string $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(); - } - - /** - * Advances the indicator. - * - * @return void - */ - 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(); - } - - /** - * Finish the indicator with message. - * - * @return void - */ - public function finish(string $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; - } - - /** - * Gets the format for a given name. - */ - public static function getFormatDefinition(string $name): ?string - { - return self::FORMATS[$name] ?? null; - } - - /** - * Sets a placeholder formatter for a given name. - * - * This method also allow you to override an existing placeholder. - * - * @return void - */ - public static function setPlaceholderFormatterDefinition(string $name, callable $callable) - { - self::$formatters ??= self::initPlaceholderFormatters(); - - self::$formatters[$name] = $callable; - } - - /** - * Gets the placeholder formatter for a given name (including the delimiter char like %). - */ - public static function getPlaceholderFormatterDefinition(string $name): ?callable - { - self::$formatters ??= self::initPlaceholderFormatters(); - - return self::$formatters[$name] ?? null; - } - - private function display(): void - { - 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 - { - return match ($this->output->getVerbosity()) { - // OutputInterface::VERBOSITY_QUIET: display is disabled anyway - OutputInterface::VERBOSITY_VERBOSE => $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi', - OutputInterface::VERBOSITY_VERY_VERBOSE, - OutputInterface::VERBOSITY_DEBUG => $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi', - default => $this->output->isDecorated() ? 'normal' : 'normal_no_ansi', - }; - } - - /** - * Overwrites a previous message to the output. - */ - private function overwrite(string $message): void - { - 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); - } - - /** - * @return array - */ - private static function initPlaceholderFormatters(): array - { - return [ - 'indicator' => fn (self $indicator) => $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)], - 'message' => fn (self $indicator) => $indicator->message, - 'elapsed' => fn (self $indicator) => Helper::formatTime(time() - $indicator->startTime), - 'memory' => fn () => Helper::formatMemory(memory_get_usage(true)), - ]; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/QuestionHelper.php b/tests/integration/vendor/symfony/console/Helper/QuestionHelper.php deleted file mode 100644 index f32813c..0000000 --- a/tests/integration/vendor/symfony/console/Helper/QuestionHelper.php +++ /dev/null @@ -1,612 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Cursor; -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; - -use function Symfony\Component\String\s; - -/** - * The QuestionHelper class provides helpers to interact with the user. - * - * @author Fabien Potencier - */ -class QuestionHelper extends Helper -{ - /** - * @var resource|null - */ - private $inputStream; - - private static bool $stty = true; - private static bool $stdinIsInteractive; - - /** - * Asks a question to the user. - * - * @return mixed The user answer - * - * @throws RuntimeException If there is no data to read in the input stream - */ - public function ask(InputInterface $input, OutputInterface $output, Question $question): mixed - { - 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 = fn () => $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(): string - { - return 'question'; - } - - /** - * Prevents usage of stty. - * - * @return void - */ - public static function disableStty() - { - self::$stty = false; - } - - /** - * Asks the question to the user. - * - * @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden - */ - private function doAsk(OutputInterface $output, Question $question): mixed - { - $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) { - $isBlocked = stream_get_meta_data($inputStream)['blocked'] ?? true; - - if (!$isBlocked) { - stream_set_blocking($inputStream, true); - } - - $ret = $this->readInput($inputStream, $question); - - if (!$isBlocked) { - stream_set_blocking($inputStream, false); - } - - 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(''); // add EOL to the question - $output->addContent($ret); - } - - $ret = \strlen($ret) > 0 ? $ret : $question->getDefault(); - - if ($normalizer = $question->getNormalizer()) { - return $normalizer($ret); - } - - return $ret; - } - - private function getDefaultAnswer(Question $question): mixed - { - $default = $question->getDefault(); - - if (null === $default) { - return $default; - } - - if ($validator = $question->getValidator()) { - return \call_user_func($validator, $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; - } - - /** - * Outputs the question prompt. - * - * @return void - */ - 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); - } - - /** - * @return string[] - */ - protected function formatChoiceQuestionChoices(ChoiceQuestion $question, string $tag): array - { - $messages = []; - - $maxWidth = max(array_map([__CLASS__, 'width'], array_keys($choices = $question->getChoices()))); - - foreach ($choices as $key => $value) { - $padding = str_repeat(' ', $maxWidth - self::width($key)); - - $messages[] = sprintf(" [<$tag>%s$padding] %s", $key, $value); - } - - return $messages; - } - - /** - * Outputs an error message. - * - * @return void - */ - 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->getMessage().''; - } - - $output->writeln($message); - } - - /** - * Autocompletes a question. - * - * @param resource $inputStream - */ - private function autocomplete(OutputInterface $output, Question $question, $inputStream, callable $autocomplete): string - { - $cursor = new Cursor($output, $inputStream); - - $fullChoice = ''; - $ret = ''; - - $i = 0; - $ofs = -1; - $matches = $autocomplete($ret); - $numMatches = \count($matches); - - $sttyMode = shell_exec('stty -g'); - $isStdin = 'php://stdin' === (stream_get_meta_data($inputStream)['uri'] ?? null); - $r = [$inputStream]; - $w = []; - - // Disable icanon (so we can fread each keypress) and echo (we'll do echoing here instead) - shell_exec('stty -icanon -echo'); - - // Add highlighted text style - $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white')); - - // Read a keypress - while (!feof($inputStream)) { - while ($isStdin && 0 === @stream_select($r, $w, $w, 0, 100)) { - // Give signal handlers a chance to run - $r = [$inputStream]; - } - $c = fread($inputStream, 1); - - // as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false. - if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) { - shell_exec('stty '.$sttyMode); - throw new MissingInputException('Aborted.'); - } elseif ("\177" === $c) { // Backspace Character - if (0 === $numMatches && 0 !== $i) { - --$i; - $cursor->moveLeft(s($fullChoice)->slice(-1)->width(false)); - - $fullChoice = self::substr($fullChoice, 0, $i); - } - - if (0 === $i) { - $ofs = -1; - $matches = $autocomplete($ret); - $numMatches = \count($matches); - } else { - $numMatches = 0; - } - - // Pop the last character off the end of our string - $ret = self::substr($ret, 0, $i); - } elseif ("\033" === $c) { - // Did we read an escape sequence? - $c .= fread($inputStream, 2); - - // A = Up Arrow. B = Down Arrow - 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]; - // Echo out remaining chars for current match - $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), - fn ($match) => '' === $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 typed characters match the beginning chunk of value (e.g. [AcmeDe]moBundle) - if (str_starts_with($value, $tempRet)) { - $matches[$numMatches++] = $value; - } - } - } - - $cursor->clearLineAfter(); - - if ($numMatches > 0 && -1 !== $ofs) { - $cursor->savePosition(); - // Write highlighted text, complete the partially entered response - $charactersEntered = \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))); - $output->write(''.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $charactersEntered)).''); - $cursor->restorePosition(); - } - } - - // Reset stty so it behaves normally again - shell_exec('stty '.$sttyMode); - - return $fullChoice; - } - - private function mostRecentlyEnteredValue(string $entered): string - { - // Determine the most recent value that the user entered - if (!str_contains($entered, ',')) { - return $entered; - } - - $choices = explode(',', $entered); - if ('' !== $lastChoice = trim($choices[\count($choices) - 1])) { - return $lastChoice; - } - - return $entered; - } - - /** - * Gets a hidden response from user. - * - * @param resource $inputStream The handler resource - * @param bool $trimmable Is the answer trimmable - * - * @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden - */ - private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string - { - if ('\\' === \DIRECTORY_SEPARATOR) { - $exe = __DIR__.'/../Resources/bin/hiddeninput.exe'; - - // handle code running from a phar - if (str_starts_with(__FILE__, 'phar:')) { - $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 (4095 === \strlen($value)) { - $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output; - $errOutput->warning('The value was possibly truncated by your shell or terminal emulator'); - } - - if (self::$stty && Terminal::hasSttyAvailable()) { - shell_exec('stty '.$sttyMode); - } - - if (false === $value) { - throw new MissingInputException('Aborted.'); - } - if ($trimmable) { - $value = trim($value); - } - $output->writeln(''); - - return $value; - } - - /** - * Validates an attempt. - * - * @param callable $interviewer A callable that will ask for a question and return the result - * - * @throws \Exception In case the max number of attempts has been reached and no valid response has been given - */ - private function validateAttempts(callable $interviewer, OutputInterface $output, Question $question): mixed - { - $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 (isset(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('shell_exec')) { - return self::$stdinIsInteractive = true; - } - - return self::$stdinIsInteractive = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null')); - } - - /** - * Reads one or more lines of input and returns what is read. - * - * @param resource $inputStream The handler resource - * @param Question $question The question being asked - */ - private function readInput($inputStream, Question $question): string|false - { - if (!$question->isMultiline()) { - $cp = $this->setIOCodepage(); - $ret = fgets($inputStream, 4096); - - return $this->resetIOCodepage($cp, $ret); - } - - $multiLineStreamReader = $this->cloneInputStream($inputStream); - if (null === $multiLineStreamReader) { - return false; - } - - $ret = ''; - $cp = $this->setIOCodepage(); - while (false !== ($char = fgetc($multiLineStreamReader))) { - if (\PHP_EOL === "{$ret}{$char}") { - break; - } - $ret .= $char; - } - - return $this->resetIOCodepage($cp, $ret); - } - - 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; - } - - /** - * Sets console I/O to the specified code page and converts the user input. - */ - private function resetIOCodepage(int $cp, string|false $input): string|false - { - 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; - } - - /** - * Clones an input stream in order to act on one instance of the same - * stream without affecting the other instance. - * - * @param resource $inputStream The handler resource - * - * @return resource|null The cloned resource, null in case it could not be cloned - */ - private function cloneInputStream($inputStream) - { - $streamMetaData = stream_get_meta_data($inputStream); - $seekable = $streamMetaData['seekable'] ?? false; - $mode = $streamMetaData['mode'] ?? 'rb'; - $uri = $streamMetaData['uri'] ?? null; - - if (null === $uri) { - return null; - } - - $cloneStream = fopen($uri, $mode); - - // For seekable and writable streams, add all the same data to the - // cloned stream and then seek to the same offset. - if (true === $seekable && !\in_array($mode, ['r', 'rb', 'rt'])) { - $offset = ftell($inputStream); - rewind($inputStream); - stream_copy_to_stream($inputStream, $cloneStream); - fseek($inputStream, $offset); - fseek($cloneStream, $offset); - } - - return $cloneStream; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/SymfonyQuestionHelper.php b/tests/integration/vendor/symfony/console/Helper/SymfonyQuestionHelper.php deleted file mode 100644 index 8ebc843..0000000 --- a/tests/integration/vendor/symfony/console/Helper/SymfonyQuestionHelper.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * Symfony Style Guide compliant question helper. - * - * @author Kevin Bond - */ -class SymfonyQuestionHelper extends QuestionHelper -{ - /** - * @return void - */ - protected function writePrompt(OutputInterface $output, Question $question) - { - $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion()); - $default = $question->getDefault(); - - if ($question->isMultiline()) { - $text .= sprintf(' (press %s to continue)', $this->getEofShortcut()); - } - - switch (true) { - case null === $default: - $text = sprintf(' %s:', $text); - - break; - - case $question instanceof ConfirmationQuestion: - $text = sprintf(' %s (yes/no) [%s]:', $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(' %s [%s]:', $text, OutputFormatter::escape(implode(', ', $default))); - - break; - - case $question instanceof ChoiceQuestion: - $choices = $question->getChoices(); - $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($choices[$default] ?? $default)); - - break; - - default: - $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($default)); - } - - $output->writeln($text); - - $prompt = ' > '; - - if ($question instanceof ChoiceQuestion) { - $output->writeln($this->formatChoiceQuestionChoices($question, 'comment')); - - $prompt = $question->getPrompt(); - } - - $output->write($prompt); - } - - /** - * @return void - */ - protected function writeError(OutputInterface $output, \Exception $error) - { - if ($output instanceof SymfonyStyle) { - $output->newLine(); - $output->error($error->getMessage()); - - return; - } - - parent::writeError($output, $error); - } - - private function getEofShortcut(): string - { - if ('Windows' === \PHP_OS_FAMILY) { - return 'Ctrl+Z then Enter'; - } - - return 'Ctrl+D'; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/Table.php b/tests/integration/vendor/symfony/console/Helper/Table.php deleted file mode 100644 index cf71487..0000000 --- a/tests/integration/vendor/symfony/console/Helper/Table.php +++ /dev/null @@ -1,914 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * Provides helpers to display a table. - * - * @author Fabien Potencier - * @author Саша Стаменковић - * @author Abdellatif Ait boudad - * @author Max Grigorian - * @author Dany Maillard - */ -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 const DISPLAY_ORIENTATION_DEFAULT = 'default'; - private const DISPLAY_ORIENTATION_HORIZONTAL = 'horizontal'; - private const DISPLAY_ORIENTATION_VERTICAL = 'vertical'; - - private ?string $headerTitle = null; - private ?string $footerTitle = null; - private array $headers = []; - private array $rows = []; - private array $effectiveColumnWidths = []; - private int $numberOfColumns; - private OutputInterface $output; - private TableStyle $style; - private array $columnStyles = []; - private array $columnWidths = []; - private array $columnMaxWidths = []; - private bool $rendered = false; - private string $displayOrientation = self::DISPLAY_ORIENTATION_DEFAULT; - - private static array $styles; - - public function __construct(OutputInterface $output) - { - $this->output = $output; - - self::$styles ??= self::initStyles(); - - $this->setStyle('default'); - } - - /** - * Sets a style definition. - * - * @return void - */ - public static function setStyleDefinition(string $name, TableStyle $style) - { - self::$styles ??= self::initStyles(); - - self::$styles[$name] = $style; - } - - /** - * Gets a style definition by name. - */ - public static function getStyleDefinition(string $name): TableStyle - { - self::$styles ??= self::initStyles(); - - return self::$styles[$name] ?? throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); - } - - /** - * Sets table style. - * - * @return $this - */ - public function setStyle(TableStyle|string $name): static - { - $this->style = $this->resolveStyle($name); - - return $this; - } - - /** - * Gets the current table style. - */ - public function getStyle(): TableStyle - { - return $this->style; - } - - /** - * Sets table column style. - * - * @param TableStyle|string $name The style name or a TableStyle instance - * - * @return $this - */ - public function setColumnStyle(int $columnIndex, TableStyle|string $name): static - { - $this->columnStyles[$columnIndex] = $this->resolveStyle($name); - - return $this; - } - - /** - * Gets the current style for a column. - * - * If style was not set, it returns the global table style. - */ - public function getColumnStyle(int $columnIndex): TableStyle - { - return $this->columnStyles[$columnIndex] ?? $this->getStyle(); - } - - /** - * Sets the minimum width of a column. - * - * @return $this - */ - public function setColumnWidth(int $columnIndex, int $width): static - { - $this->columnWidths[$columnIndex] = $width; - - return $this; - } - - /** - * Sets the minimum width of all columns. - * - * @return $this - */ - public function setColumnWidths(array $widths): static - { - $this->columnWidths = []; - foreach ($widths as $index => $width) { - $this->setColumnWidth($index, $width); - } - - return $this; - } - - /** - * Sets the maximum width of a column. - * - * Any cell within this column which contents exceeds the specified width will be wrapped into multiple lines, while - * formatted strings are preserved. - * - * @return $this - */ - public function setColumnMaxWidth(int $columnIndex, int $width): static - { - 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_debug_type($this->output->getFormatter()))); - } - - $this->columnMaxWidths[$columnIndex] = $width; - - return $this; - } - - /** - * @return $this - */ - public function setHeaders(array $headers): static - { - $headers = array_values($headers); - if ($headers && !\is_array($headers[0])) { - $headers = [$headers]; - } - - $this->headers = $headers; - - return $this; - } - - /** - * @return $this - */ - public function setRows(array $rows) - { - $this->rows = []; - - return $this->addRows($rows); - } - - /** - * @return $this - */ - public function addRows(array $rows): static - { - foreach ($rows as $row) { - $this->addRow($row); - } - - return $this; - } - - /** - * @return $this - */ - public function addRow(TableSeparator|array $row): static - { - if ($row instanceof TableSeparator) { - $this->rows[] = $row; - - return $this; - } - - $this->rows[] = array_values($row); - - return $this; - } - - /** - * Adds a row to the table, and re-renders the table. - * - * @return $this - */ - public function appendRow(TableSeparator|array $row): static - { - 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; - } - - /** - * @return $this - */ - public function setRow(int|string $column, array $row): static - { - $this->rows[$column] = $row; - - return $this; - } - - /** - * @return $this - */ - public function setHeaderTitle(?string $title): static - { - $this->headerTitle = $title; - - return $this; - } - - /** - * @return $this - */ - public function setFooterTitle(?string $title): static - { - $this->footerTitle = $title; - - return $this; - } - - /** - * @return $this - */ - public function setHorizontal(bool $horizontal = true): static - { - $this->displayOrientation = $horizontal ? self::DISPLAY_ORIENTATION_HORIZONTAL : self::DISPLAY_ORIENTATION_DEFAULT; - - return $this; - } - - /** - * @return $this - */ - public function setVertical(bool $vertical = true): static - { - $this->displayOrientation = $vertical ? self::DISPLAY_ORIENTATION_VERTICAL : self::DISPLAY_ORIENTATION_DEFAULT; - - return $this; - } - - /** - * Renders table to output. - * - * Example: - * - * +---------------+-----------------------+------------------+ - * | ISBN | Title | Author | - * +---------------+-----------------------+------------------+ - * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | - * +---------------+-----------------------+------------------+ - * - * @return void - */ - public function render() - { - $divider = new TableSeparator(); - $isCellWithColspan = static fn ($cell) => $cell instanceof TableCell && $cell->getColspan() >= 2; - - $horizontal = self::DISPLAY_ORIENTATION_HORIZONTAL === $this->displayOrientation; - $vertical = self::DISPLAY_ORIENTATION_VERTICAL === $this->displayOrientation; - - $rows = []; - if ($horizontal) { - 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 ($isCellWithColspan($rows[$i][0])) { - // Noop, there is a "title" - } else { - $rows[$i][] = null; - } - } - } - } elseif ($vertical) { - $formatter = $this->output->getFormatter(); - $maxHeaderLength = array_reduce($this->headers[0] ?? [], static fn ($max, $header) => max($max, Helper::width(Helper::removeDecoration($formatter, $header))), 0); - - foreach ($this->rows as $row) { - if ($row instanceof TableSeparator) { - continue; - } - - if ($rows) { - $rows[] = [$divider]; - } - - $containsColspan = false; - foreach ($row as $cell) { - if ($containsColspan = $isCellWithColspan($cell)) { - break; - } - } - - $headers = $this->headers[0] ?? []; - $maxRows = max(\count($headers), \count($row)); - for ($i = 0; $i < $maxRows; ++$i) { - $cell = (string) ($row[$i] ?? ''); - if ($headers && !$containsColspan) { - $rows[] = [sprintf( - '%s: %s', - str_pad($headers[$i] ?? '', $maxHeaderLength, ' ', \STR_PAD_LEFT), - $cell - )]; - } elseif ('' !== $cell) { - $rows[] = [$cell]; - } - } - } - } else { - $rows = array_merge($this->headers, [$divider], $this->rows); - } - - $this->calculateNumberOfColumns($rows); - - $rowGroups = $this->buildTableRows($rows); - $this->calculateColumnsWidth($rowGroups); - - $isHeader = !$horizontal; - $isFirstRow = $horizontal; - $hasTitle = (bool) $this->headerTitle; - - foreach ($rowGroups as $rowGroup) { - $isHeaderSeparatorRendered = false; - - foreach ($rowGroup as $row) { - if ($divider === $row) { - $isHeader = false; - $isFirstRow = true; - - continue; - } - - if ($row instanceof TableSeparator) { - $this->renderRowSeparator(); - - continue; - } - - if (!$row) { - continue; - } - - if ($isHeader && !$isHeaderSeparatorRendered) { - $this->renderRowSeparator( - $isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM, - $hasTitle ? $this->headerTitle : null, - $hasTitle ? $this->style->getHeaderTitleFormat() : null - ); - $hasTitle = false; - $isHeaderSeparatorRendered = true; - } - - if ($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 ($vertical) { - $isHeader = false; - $isFirstRow = false; - } - - if ($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; - } - - /** - * Renders horizontal header separator. - * - * Example: - * - * +-----+-----------+-------+ - */ - private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null): void - { - if (!$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::width(Helper::removeDecoration($formatter = $this->output->getFormatter(), $formattedTitle = sprintf($titleFormat, $title))); - $markupLength = Helper::width($markup); - if ($titleLength > $limit = $markupLength - 4) { - $titleLength = $limit; - $formatLength = Helper::width(Helper::removeDecoration($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)); - } - - /** - * Renders vertical column separator. - */ - 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]); - } - - /** - * Renders table row. - * - * Example: - * - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - */ - private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null): void - { - $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); - } - - /** - * Renders table cell with padding. - */ - private function renderCell(array $row, int $column, string $cellFormat): string - { - $cell = $row[$column] ?? ''; - $width = $this->effectiveColumnWidths[$column]; - if ($cell instanceof TableCell && $cell->getColspan() > 1) { - // add the width of the following columns(numbers of colspan). - foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) { - $width += $this->getColumnSeparatorWidth() + $this->effectiveColumnWidths[$nextColumn]; - } - } - - // str_pad won't work properly with multi-byte strings, we need to fix the padding - 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::length($cell) - Helper::length(Helper::removeDecoration($this->output->getFormatter(), $cell)); - $content = sprintf($style->getCellRowContentFormat(), $cell); - - $padType = $style->getPadType(); - if ($cell instanceof TableCell && $cell->getStyle() instanceof TableCellStyle) { - $isNotStyledByTag = !preg_match('/^<(\w+|(\w+=[\w,]+;?)*)>.+<\/(\w+|(\w+=\w+;?)*)?>$/', $cell); - if ($isNotStyledByTag) { - $cellFormat = $cell->getStyle()->getCellFormat(); - if (!\is_string($cellFormat)) { - $tag = http_build_query($cell->getStyle()->getTagOptions(), '', ';'); - $cellFormat = '<'.$tag.'>%s'; - } - - if (str_contains($content, '')) { - $content = str_replace('', '', $content); - $width -= 3; - } - if (str_contains($content, '')) { - $content = str_replace('', '', $content); - $width -= \strlen(''); - } - } - - $padType = $cell->getStyle()->getPadByAlign(); - } - - return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $padType)); - } - - /** - * Calculate number of columns for this table. - */ - private function calculateNumberOfColumns(array $rows): void - { - $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 - { - /** @var WrappableOutputFormatterInterface $formatter */ - $formatter = $this->output->getFormatter(); - $unmergedRows = []; - for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) { - $rows = $this->fillNextRows($rows, $rowKey); - - // Remove any new line breaks and replace it with a new line - foreach ($rows[$rowKey] as $column => $cell) { - $colspan = $cell instanceof TableCell ? $cell->getColspan() : 1; - - if (isset($this->columnMaxWidths[$column]) && Helper::width(Helper::removeDecoration($formatter, $cell)) > $this->columnMaxWidths[$column]) { - $cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan); - } - if (!str_contains($cell ?? '', "\n")) { - continue; - } - $escaped = implode("\n", array_map(OutputFormatter::escapeTrailingBackslash(...), explode("\n", $cell))); - $cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped; - $lines = explode("\n", str_replace("\n", "\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) { - $rowGroup = [$row instanceof TableSeparator ? $row : $this->fillCells($row)]; - - if (isset($unmergedRows[$rowKey])) { - foreach ($unmergedRows[$rowKey] as $row) { - $rowGroup[] = $row instanceof TableSeparator ? $row : $this->fillCells($row); - } - } - yield $rowGroup; - } - }); - } - - private function calculateRowCount(): int - { - $numberOfRows = \count(iterator_to_array($this->buildTableRows(array_merge($this->headers, [new TableSeparator()], $this->rows)))); - - if ($this->headers) { - ++$numberOfRows; // Add row for header separator - } - - if ($this->rows) { - ++$numberOfRows; // Add row for footer separator - } - - return $numberOfRows; - } - - /** - * fill rows that contains rowspan > 1. - * - * @throws InvalidArgumentException - */ - private function fillNextRows(array $rows, int $line): array - { - $unmergedRows = []; - foreach ($rows[$line] as $column => $cell) { - if (null !== $cell && !$cell instanceof TableCell && !\is_scalar($cell) && !$cell instanceof \Stringable) { - throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', get_debug_type($cell))); - } - if ($cell instanceof TableCell && $cell->getRowspan() > 1) { - $nbLines = $cell->getRowspan() - 1; - $lines = [$cell]; - if (str_contains($cell, "\n")) { - $lines = explode("\n", str_replace("\n", "\n", $cell)); - $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines; - - $rows[$line][$column] = new TableCell($lines[0], ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]); - unset($lines[0]); - } - - // create a two dimensional array (rowspan x colspan) - $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(), 'style' => $cell->getStyle()]); - if ($nbLines === $unmergedRowKey - $line) { - break; - } - } - } - } - - foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { - // we need to know if $unmergedRow will be merged or inserted into $rows - if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) { - foreach ($unmergedRow as $cellKey => $cell) { - // insert cell into row at cellKey position - 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; - } - - /** - * fill cells for a row that contains colspan > 1. - */ - private function fillCells(iterable $row): iterable - { - $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) { - // insert empty value at column 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; - } - - /** - * Gets number of columns by row. - */ - private function getNumberOfColumns(array $row): int - { - $columns = \count($row); - foreach ($row as $column) { - $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0; - } - - return $columns; - } - - /** - * Gets list of columns for the given row. - */ - private function getRowColumns(array $row): array - { - $columns = range(0, $this->numberOfColumns - 1); - foreach ($row as $cellKey => $cell) { - if ($cell instanceof TableCell && $cell->getColspan() > 1) { - // exclude grouped columns. - $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1)); - } - } - - return $columns; - } - - /** - * Calculates columns widths. - */ - private function calculateColumnsWidth(iterable $groups): void - { - for ($column = 0; $column < $this->numberOfColumns; ++$column) { - $lengths = []; - foreach ($groups as $group) { - foreach ($group 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::width($textContent); - if ($textLength > 0) { - $contentColumns = mb_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::width($this->style->getCellRowContentFormat()) - 2; - } - } - - private function getColumnSeparatorWidth(): int - { - return Helper::width(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::width(Helper::removeDecoration($this->output->getFormatter(), $cell)); - } - - $columnWidth = $this->columnWidths[$column] ?? 0; - $cellWidth = max($cellWidth, $columnWidth); - - return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth; - } - - /** - * Called after rendering to cleanup cache data. - */ - private function cleanup(): void - { - $this->effectiveColumnWidths = []; - unset($this->numberOfColumns); - } - - /** - * @return array - */ - 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(TableStyle|string $name): TableStyle - { - if ($name instanceof TableStyle) { - return $name; - } - - return self::$styles[$name] ?? throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name)); - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/TableCell.php b/tests/integration/vendor/symfony/console/Helper/TableCell.php deleted file mode 100644 index 394b2bc..0000000 --- a/tests/integration/vendor/symfony/console/Helper/TableCell.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Exception\InvalidArgumentException; - -/** - * @author Abdellatif Ait boudad - */ -class TableCell -{ - private string $value; - private array $options = [ - 'rowspan' => 1, - 'colspan' => 1, - 'style' => null, - ]; - - public function __construct(string $value = '', array $options = []) - { - $this->value = $value; - - // check option names - 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))); - } - - if (isset($options['style']) && !$options['style'] instanceof TableCellStyle) { - throw new InvalidArgumentException('The style option must be an instance of "TableCellStyle".'); - } - - $this->options = array_merge($this->options, $options); - } - - /** - * Returns the cell value. - */ - public function __toString(): string - { - return $this->value; - } - - /** - * Gets number of colspan. - */ - public function getColspan(): int - { - return (int) $this->options['colspan']; - } - - /** - * Gets number of rowspan. - */ - public function getRowspan(): int - { - return (int) $this->options['rowspan']; - } - - public function getStyle(): ?TableCellStyle - { - return $this->options['style']; - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/TableSeparator.php b/tests/integration/vendor/symfony/console/Helper/TableSeparator.php deleted file mode 100644 index e541c53..0000000 --- a/tests/integration/vendor/symfony/console/Helper/TableSeparator.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -/** - * Marks a row as being a separator. - * - * @author Fabien Potencier - */ -class TableSeparator extends TableCell -{ - public function __construct(array $options = []) - { - parent::__construct('', $options); - } -} diff --git a/tests/integration/vendor/symfony/console/Helper/TableStyle.php b/tests/integration/vendor/symfony/console/Helper/TableStyle.php deleted file mode 100644 index bbad98e..0000000 --- a/tests/integration/vendor/symfony/console/Helper/TableStyle.php +++ /dev/null @@ -1,362 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; - -/** - * Defines the styles for a Table. - * - * @author Fabien Potencier - * @author Саша Стаменковић - * @author Dany Maillard - */ -class TableStyle -{ - private string $paddingChar = ' '; - private string $horizontalOutsideBorderChar = '-'; - private string $horizontalInsideBorderChar = '-'; - private string $verticalOutsideBorderChar = '|'; - private string $verticalInsideBorderChar = '|'; - private string $crossingChar = '+'; - private string $crossingTopRightChar = '+'; - private string $crossingTopMidChar = '+'; - private string $crossingTopLeftChar = '+'; - private string $crossingMidRightChar = '+'; - private string $crossingBottomRightChar = '+'; - private string $crossingBottomMidChar = '+'; - private string $crossingBottomLeftChar = '+'; - private string $crossingMidLeftChar = '+'; - private string $crossingTopLeftBottomChar = '+'; - private string $crossingTopMidBottomChar = '+'; - private string $crossingTopRightBottomChar = '+'; - private string $headerTitleFormat = ' %s '; - private string $footerTitleFormat = ' %s '; - private string $cellHeaderFormat = '%s'; - private string $cellRowFormat = '%s'; - private string $cellRowContentFormat = ' %s '; - private string $borderFormat = '%s'; - private int $padType = \STR_PAD_RIGHT; - - /** - * Sets padding character, used for cell padding. - * - * @return $this - */ - public function setPaddingChar(string $paddingChar): static - { - if (!$paddingChar) { - throw new LogicException('The padding char must not be empty.'); - } - - $this->paddingChar = $paddingChar; - - return $this; - } - - /** - * Gets padding character, used for cell padding. - */ - public function getPaddingChar(): string - { - return $this->paddingChar; - } - - /** - * Sets horizontal border characters. - * - * - * ╔═══════════════╤══════════════════════════╤══════════════════╗ - * 1 ISBN 2 Title │ Author ║ - * ╠═══════════════╪══════════════════════════╪══════════════════╣ - * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║ - * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║ - * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║ - * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║ - * ╚═══════════════╧══════════════════════════╧══════════════════╝ - * - * - * @return $this - */ - public function setHorizontalBorderChars(string $outside, string $inside = null): static - { - $this->horizontalOutsideBorderChar = $outside; - $this->horizontalInsideBorderChar = $inside ?? $outside; - - return $this; - } - - /** - * Sets vertical border characters. - * - * - * ╔═══════════════╤══════════════════════════╤══════════════════╗ - * ║ ISBN │ Title │ Author ║ - * ╠═══════1═══════╪══════════════════════════╪══════════════════╣ - * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║ - * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║ - * ╟───────2───────┼──────────────────────────┼──────────────────╢ - * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║ - * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║ - * ╚═══════════════╧══════════════════════════╧══════════════════╝ - * - * - * @return $this - */ - public function setVerticalBorderChars(string $outside, string $inside = null): static - { - $this->verticalOutsideBorderChar = $outside; - $this->verticalInsideBorderChar = $inside ?? $outside; - - return $this; - } - - /** - * Gets border characters. - * - * @internal - */ - public function getBorderChars(): array - { - return [ - $this->horizontalOutsideBorderChar, - $this->verticalOutsideBorderChar, - $this->horizontalInsideBorderChar, - $this->verticalInsideBorderChar, - ]; - } - - /** - * Sets crossing characters. - * - * Example: - * - * 1═══════════════2══════════════════════════2══════════════════3 - * ║ ISBN │ Title │ Author ║ - * 8'══════════════0'═════════════════════════0'═════════════════4' - * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║ - * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║ - * 8───────────────0──────────────────────────0──────────────────4 - * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║ - * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║ - * 7═══════════════6══════════════════════════6══════════════════5 - * - * - * @param string $cross Crossing char (see #0 of example) - * @param string $topLeft Top left char (see #1 of example) - * @param string $topMid Top mid char (see #2 of example) - * @param string $topRight Top right char (see #3 of example) - * @param string $midRight Mid right char (see #4 of example) - * @param string $bottomRight Bottom right char (see #5 of example) - * @param string $bottomMid Bottom mid char (see #6 of example) - * @param string $bottomLeft Bottom left char (see #7 of example) - * @param string $midLeft Mid left char (see #8 of example) - * @param string|null $topLeftBottom Top left bottom char (see #8' of example), equals to $midLeft if null - * @param string|null $topMidBottom Top mid bottom char (see #0' of example), equals to $cross if null - * @param string|null $topRightBottom Top right bottom char (see #4' of example), equals to $midRight if null - * - * @return $this - */ - 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): static - { - $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; - } - - /** - * Sets default crossing character used for each cross. - * - * @see {@link setCrossingChars()} for setting each crossing individually. - */ - public function setDefaultCrossingChar(string $char): self - { - return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char); - } - - /** - * Gets crossing character. - */ - public function getCrossingChar(): string - { - return $this->crossingChar; - } - - /** - * Gets crossing characters. - * - * @internal - */ - 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, - ]; - } - - /** - * Sets header cell format. - * - * @return $this - */ - public function setCellHeaderFormat(string $cellHeaderFormat): static - { - $this->cellHeaderFormat = $cellHeaderFormat; - - return $this; - } - - /** - * Gets header cell format. - */ - public function getCellHeaderFormat(): string - { - return $this->cellHeaderFormat; - } - - /** - * Sets row cell format. - * - * @return $this - */ - public function setCellRowFormat(string $cellRowFormat): static - { - $this->cellRowFormat = $cellRowFormat; - - return $this; - } - - /** - * Gets row cell format. - */ - public function getCellRowFormat(): string - { - return $this->cellRowFormat; - } - - /** - * Sets row cell content format. - * - * @return $this - */ - public function setCellRowContentFormat(string $cellRowContentFormat): static - { - $this->cellRowContentFormat = $cellRowContentFormat; - - return $this; - } - - /** - * Gets row cell content format. - */ - public function getCellRowContentFormat(): string - { - return $this->cellRowContentFormat; - } - - /** - * Sets table border format. - * - * @return $this - */ - public function setBorderFormat(string $borderFormat): static - { - $this->borderFormat = $borderFormat; - - return $this; - } - - /** - * Gets table border format. - */ - public function getBorderFormat(): string - { - return $this->borderFormat; - } - - /** - * Sets cell padding type. - * - * @return $this - */ - public function setPadType(int $padType): static - { - 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; - } - - /** - * Gets cell padding type. - */ - public function getPadType(): int - { - return $this->padType; - } - - public function getHeaderTitleFormat(): string - { - return $this->headerTitleFormat; - } - - /** - * @return $this - */ - public function setHeaderTitleFormat(string $format): static - { - $this->headerTitleFormat = $format; - - return $this; - } - - public function getFooterTitleFormat(): string - { - return $this->footerTitleFormat; - } - - /** - * @return $this - */ - public function setFooterTitleFormat(string $format): static - { - $this->footerTitleFormat = $format; - - return $this; - } -} diff --git a/tests/integration/vendor/symfony/console/Input/ArgvInput.php b/tests/integration/vendor/symfony/console/Input/ArgvInput.php deleted file mode 100644 index 59f9217..0000000 --- a/tests/integration/vendor/symfony/console/Input/ArgvInput.php +++ /dev/null @@ -1,370 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Exception\RuntimeException; - -/** - * ArgvInput represents an input coming from the CLI arguments. - * - * Usage: - * - * $input = new ArgvInput(); - * - * By default, the `$_SERVER['argv']` array is used for the input values. - * - * This can be overridden by explicitly passing the input values in the constructor: - * - * $input = new ArgvInput($_SERVER['argv']); - * - * If you pass it yourself, don't forget that the first element of the array - * is the name of the running application. - * - * When passing an argument to the constructor, be sure that it respects - * the same rules as the argv one. It's almost always better to use the - * `StringInput` when you want to provide your own input. - * - * @author Fabien Potencier - * - * @see http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html - * @see http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02 - */ -class ArgvInput extends Input -{ - private array $tokens; - private array $parsed; - - public function __construct(array $argv = null, InputDefinition $definition = null) - { - $argv ??= $_SERVER['argv'] ?? []; - - // strip the application name - array_shift($argv); - - $this->tokens = $argv; - - parent::__construct($definition); - } - - /** - * @return void - */ - protected function setTokens(array $tokens) - { - $this->tokens = $tokens; - } - - /** - * @return void - */ - protected function parse() - { - $parseOptions = true; - $this->parsed = $this->tokens; - while (null !== $token = array_shift($this->parsed)) { - $parseOptions = $this->parseToken($token, $parseOptions); - } - } - - protected function parseToken(string $token, bool $parseOptions): bool - { - if ($parseOptions && '' == $token) { - $this->parseArgument($token); - } elseif ($parseOptions && '--' == $token) { - return false; - } elseif ($parseOptions && str_starts_with($token, '--')) { - $this->parseLongOption($token); - } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) { - $this->parseShortOption($token); - } else { - $this->parseArgument($token); - } - - return $parseOptions; - } - - /** - * Parses a short option. - */ - private function parseShortOption(string $token): void - { - $name = substr($token, 1); - - if (\strlen($name) > 1) { - if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) { - // an option with a value (with no space) - $this->addShortOption($name[0], substr($name, 1)); - } else { - $this->parseShortOptionSet($name); - } - } else { - $this->addShortOption($name, null); - } - } - - /** - * Parses a short option set. - * - * @throws RuntimeException When option given doesn't exist - */ - private function parseShortOptionSet(string $name): void - { - $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); - } - } - } - - /** - * Parses a long option. - */ - private function parseLongOption(string $token): void - { - $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); - } - } - - /** - * Parses an argument. - * - * @throws RuntimeException When too many arguments are given - */ - private function parseArgument(string $token): void - { - $c = \count($this->arguments); - - // if input is expecting another argument, add it - if ($this->definition->hasArgument($c)) { - $arg = $this->definition->getArgument($c); - $this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token; - - // if last argument isArray(), append token to last argument - } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) { - $arg = $this->definition->getArgument($c - 1); - $this->arguments[$arg->getName()][] = $token; - - // unexpected argument - } else { - $all = $this->definition->getArguments(); - $symfonyCommandName = null; - if (($inputArgument = $all[$key = array_key_first($all)] ?? null) && 'command' === $inputArgument->getName()) { - $symfonyCommandName = $this->arguments['command'] ?? null; - unset($all[$key]); - } - - if (\count($all)) { - if ($symfonyCommandName) { - $message = sprintf('Too many arguments to "%s" command, expected arguments "%s".', $symfonyCommandName, implode('" "', array_keys($all))); - } else { - $message = sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))); - } - } elseif ($symfonyCommandName) { - $message = sprintf('No arguments expected for "%s" command, got "%s".', $symfonyCommandName, $token); - } else { - $message = sprintf('No arguments expected, got "%s".', $token); - } - - throw new RuntimeException($message); - } - } - - /** - * Adds a short option value. - * - * @throws RuntimeException When option given doesn't exist - */ - private function addShortOption(string $shortcut, mixed $value): void - { - if (!$this->definition->hasShortcut($shortcut)) { - throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut)); - } - - $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value); - } - - /** - * Adds a long option value. - * - * @throws RuntimeException When option given doesn't exist - */ - private function addLongOption(string $name, mixed $value): void - { - if (!$this->definition->hasOption($name)) { - if (!$this->definition->hasNegation($name)) { - throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name)); - } - - $optionName = $this->definition->negationToName($name); - if (null !== $value) { - throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name)); - } - $this->options[$optionName] = false; - - return; - } - - $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)) { - // if option accepts an optional or mandatory argument - // let's see if there is one provided - $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(): ?string - { - $isOption = false; - foreach ($this->tokens as $i => $token) { - if ($token && '-' === $token[0]) { - if (str_contains($token, '=') || !isset($this->tokens[$i + 1])) { - continue; - } - - // If it's a long option, consider that everything after "--" is the option name. - // Otherwise, use the last char (if it's a short option set, only the last one can take a value with space separator) - $name = '-' === $token[1] ? substr($token, 2) : substr($token, -1); - if (!isset($this->options[$name]) && !$this->definition->hasShortcut($name)) { - // noop - } 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(string|array $values, bool $onlyParams = false): bool - { - $values = (array) $values; - - foreach ($this->tokens as $token) { - if ($onlyParams && '--' === $token) { - return false; - } - foreach ($values as $value) { - // Options with values: - // For long options, test for '--option=' at beginning - // For short options, test for '-o' at beginning - $leading = str_starts_with($value, '--') ? $value.'=' : $value; - if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) { - return true; - } - } - } - - return false; - } - - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed - { - $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); - } - // Options with values: - // For long options, test for '--option=' at beginning - // For short options, test for '-o' at beginning - $leading = str_starts_with($value, '--') ? $value.'=' : $value; - if ('' !== $leading && str_starts_with($token, $leading)) { - return substr($token, \strlen($leading)); - } - } - } - - return $default; - } - - /** - * Returns a stringified representation of the args passed to the command. - */ - public function __toString(): string - { - $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); - } -} diff --git a/tests/integration/vendor/symfony/console/Input/ArrayInput.php b/tests/integration/vendor/symfony/console/Input/ArrayInput.php deleted file mode 100644 index 355de61..0000000 --- a/tests/integration/vendor/symfony/console/Input/ArrayInput.php +++ /dev/null @@ -1,196 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\InvalidOptionException; - -/** - * ArrayInput represents an input provided as an array. - * - * Usage: - * - * $input = new ArrayInput(['command' => 'foo:bar', 'foo' => 'bar', '--bar' => 'foobar']); - * - * @author Fabien Potencier - */ -class ArrayInput extends Input -{ - private array $parameters; - - public function __construct(array $parameters, InputDefinition $definition = null) - { - $this->parameters = $parameters; - - parent::__construct($definition); - } - - public function getFirstArgument(): ?string - { - foreach ($this->parameters as $param => $value) { - if ($param && \is_string($param) && '-' === $param[0]) { - continue; - } - - return $value; - } - - return null; - } - - public function hasParameterOption(string|array $values, bool $onlyParams = false): bool - { - $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(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed - { - $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; - } - - /** - * Returns a stringified representation of the args passed to the command. - */ - public function __toString(): string - { - $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); - } - - /** - * @return void - */ - 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); - } - } - } - - /** - * Adds a short option value. - * - * @throws InvalidOptionException When option given doesn't exist - */ - private function addShortOption(string $shortcut, mixed $value): void - { - if (!$this->definition->hasShortcut($shortcut)) { - throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut)); - } - - $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value); - } - - /** - * Adds a long option value. - * - * @throws InvalidOptionException When option given doesn't exist - * @throws InvalidOptionException When a required value is missing - */ - private function addLongOption(string $name, mixed $value): void - { - if (!$this->definition->hasOption($name)) { - if (!$this->definition->hasNegation($name)) { - throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name)); - } - - $optionName = $this->definition->negationToName($name); - $this->options[$optionName] = false; - - return; - } - - $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; - } - - /** - * Adds an argument value. - * - * @throws InvalidArgumentException When argument given doesn't exist - */ - private function addArgument(string|int $name, mixed $value): void - { - if (!$this->definition->hasArgument($name)) { - throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); - } - - $this->arguments[$name] = $value; - } -} diff --git a/tests/integration/vendor/symfony/console/Input/Input.php b/tests/integration/vendor/symfony/console/Input/Input.php deleted file mode 100644 index 0f5617c..0000000 --- a/tests/integration/vendor/symfony/console/Input/Input.php +++ /dev/null @@ -1,192 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\RuntimeException; - -/** - * Input is the base class for all concrete Input classes. - * - * Three concrete classes are provided by default: - * - * * `ArgvInput`: The input comes from the CLI arguments (argv) - * * `StringInput`: The input is provided as a string - * * `ArrayInput`: The input is provided as an array - * - * @author Fabien Potencier - */ -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(); - } - } - - /** - * @return void - */ - public function bind(InputDefinition $definition) - { - $this->arguments = []; - $this->options = []; - $this->definition = $definition; - - $this->parse(); - } - - /** - * Processes command line arguments. - * - * @return void - */ - abstract protected function parse(); - - /** - * @return void - */ - public function validate() - { - $definition = $this->definition; - $givenArguments = $this->arguments; - - $missingArguments = array_filter(array_keys($definition->getArguments()), fn ($argument) => !\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(): bool - { - return $this->interactive; - } - - /** - * @return void - */ - public function setInteractive(bool $interactive) - { - $this->interactive = $interactive; - } - - public function getArguments(): array - { - return array_merge($this->definition->getArgumentDefaults(), $this->arguments); - } - - public function getArgument(string $name): mixed - { - if (!$this->definition->hasArgument($name)) { - throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); - } - - return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault(); - } - - /** - * @return void - */ - public function setArgument(string $name, mixed $value) - { - if (!$this->definition->hasArgument($name)) { - throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); - } - - $this->arguments[$name] = $value; - } - - public function hasArgument(string $name): bool - { - return $this->definition->hasArgument($name); - } - - public function getOptions(): array - { - return array_merge($this->definition->getOptionDefaults(), $this->options); - } - - public function getOption(string $name): mixed - { - if ($this->definition->hasNegation($name)) { - if (null === $value = $this->getOption($this->definition->negationToName($name))) { - return $value; - } - - return !$value; - } - - 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(); - } - - /** - * @return void - */ - public function setOption(string $name, mixed $value) - { - if ($this->definition->hasNegation($name)) { - $this->options[$this->definition->negationToName($name)] = !$value; - - return; - } elseif (!$this->definition->hasOption($name)) { - throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name)); - } - - $this->options[$name] = $value; - } - - public function hasOption(string $name): bool - { - return $this->definition->hasOption($name) || $this->definition->hasNegation($name); - } - - /** - * Escapes a token through escapeshellarg if it contains unsafe chars. - */ - public function escapeToken(string $token): string - { - return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token); - } - - /** - * @param resource $stream - * - * @return void - */ - public function setStream($stream) - { - $this->stream = $stream; - } - - /** - * @return resource - */ - public function getStream() - { - return $this->stream; - } -} diff --git a/tests/integration/vendor/symfony/console/Input/InputArgument.php b/tests/integration/vendor/symfony/console/Input/InputArgument.php deleted file mode 100644 index 5cb1514..0000000 --- a/tests/integration/vendor/symfony/console/Input/InputArgument.php +++ /dev/null @@ -1,154 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Completion\Suggestion; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; - -/** - * Represents a command line argument. - * - * @author Fabien Potencier - */ -class InputArgument -{ - public const REQUIRED = 1; - public const OPTIONAL = 2; - public const IS_ARRAY = 4; - - private string $name; - private int $mode; - private string|int|bool|array|null|float $default; - private array|\Closure $suggestedValues; - private string $description; - - /** - * @param string $name The argument name - * @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY - * @param string $description A description text - * @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only) - * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion - * - * @throws InvalidArgumentException When argument mode is not valid - */ - public function __construct(string $name, int $mode = null, string $description = '', string|bool|int|float|array $default = null, \Closure|array $suggestedValues = []) - { - 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->suggestedValues = $suggestedValues; - - $this->setDefault($default); - } - - /** - * Returns the argument name. - */ - public function getName(): string - { - return $this->name; - } - - /** - * Returns true if the argument is required. - * - * @return bool true if parameter mode is self::REQUIRED, false otherwise - */ - public function isRequired(): bool - { - return self::REQUIRED === (self::REQUIRED & $this->mode); - } - - /** - * Returns true if the argument can take multiple values. - * - * @return bool true if mode is self::IS_ARRAY, false otherwise - */ - public function isArray(): bool - { - return self::IS_ARRAY === (self::IS_ARRAY & $this->mode); - } - - /** - * Sets the default value. - * - * @return void - * - * @throws LogicException When incorrect default value is given - */ - public function setDefault(string|bool|int|float|array $default = null) - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - if ($this->isRequired() && 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; - } - - /** - * Returns the default value. - */ - public function getDefault(): string|bool|int|float|array|null - { - return $this->default; - } - - public function hasCompletion(): bool - { - return [] !== $this->suggestedValues; - } - - /** - * Adds suggestions to $suggestions for the current completion input. - * - * @see Command::complete() - */ - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - $values = $this->suggestedValues; - if ($values instanceof \Closure && !\is_array($values = $values($input))) { - throw new LogicException(sprintf('Closure for argument "%s" must return an array. Got "%s".', $this->name, get_debug_type($values))); - } - if ($values) { - $suggestions->suggestValues($values); - } - } - - /** - * Returns the description text. - */ - public function getDescription(): string - { - return $this->description; - } -} diff --git a/tests/integration/vendor/symfony/console/Input/InputAwareInterface.php b/tests/integration/vendor/symfony/console/Input/InputAwareInterface.php deleted file mode 100644 index 0ad27b4..0000000 --- a/tests/integration/vendor/symfony/console/Input/InputAwareInterface.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -/** - * InputAwareInterface should be implemented by classes that depends on the - * Console Input. - * - * @author Wouter J - */ -interface InputAwareInterface -{ - /** - * Sets the Console Input. - * - * @return void - */ - public function setInput(InputInterface $input); -} diff --git a/tests/integration/vendor/symfony/console/Input/InputDefinition.php b/tests/integration/vendor/symfony/console/Input/InputDefinition.php deleted file mode 100644 index b7162d7..0000000 --- a/tests/integration/vendor/symfony/console/Input/InputDefinition.php +++ /dev/null @@ -1,416 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; - -/** - * A InputDefinition represents a set of valid command line arguments and options. - * - * Usage: - * - * $definition = new InputDefinition([ - * new InputArgument('name', InputArgument::REQUIRED), - * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), - * ]); - * - * @author Fabien Potencier - */ -class InputDefinition -{ - private array $arguments = []; - private int $requiredCount = 0; - private ?InputArgument $lastArrayArgument = null; - private ?InputArgument $lastOptionalArgument = null; - private array $options = []; - private array $negations = []; - private array $shortcuts = []; - - /** - * @param array $definition An array of InputArgument and InputOption instance - */ - public function __construct(array $definition = []) - { - $this->setDefinition($definition); - } - - /** - * Sets the definition of the input. - * - * @return void - */ - 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); - } - - /** - * Sets the InputArgument objects. - * - * @param InputArgument[] $arguments An array of InputArgument objects - * - * @return void - */ - public function setArguments(array $arguments = []) - { - $this->arguments = []; - $this->requiredCount = 0; - $this->lastOptionalArgument = null; - $this->lastArrayArgument = null; - $this->addArguments($arguments); - } - - /** - * Adds an array of InputArgument objects. - * - * @param InputArgument[] $arguments An array of InputArgument objects - * - * @return void - */ - public function addArguments(?array $arguments = []) - { - if (null !== $arguments) { - foreach ($arguments as $argument) { - $this->addArgument($argument); - } - } - } - - /** - * @return void - * - * @throws LogicException When incorrect argument is given - */ - 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 (null !== $this->lastArrayArgument) { - throw new LogicException(sprintf('Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName())); - } - - if ($argument->isRequired() && null !== $this->lastOptionalArgument) { - throw new LogicException(sprintf('Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName())); - } - - if ($argument->isArray()) { - $this->lastArrayArgument = $argument; - } - - if ($argument->isRequired()) { - ++$this->requiredCount; - } else { - $this->lastOptionalArgument = $argument; - } - - $this->arguments[$argument->getName()] = $argument; - } - - /** - * Returns an InputArgument by name or by position. - * - * @throws InvalidArgumentException When argument given doesn't exist - */ - public function getArgument(string|int $name): InputArgument - { - 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]; - } - - /** - * Returns true if an InputArgument object exists by name or position. - */ - public function hasArgument(string|int $name): bool - { - $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments; - - return isset($arguments[$name]); - } - - /** - * Gets the array of InputArgument objects. - * - * @return InputArgument[] - */ - public function getArguments(): array - { - return $this->arguments; - } - - /** - * Returns the number of InputArguments. - */ - public function getArgumentCount(): int - { - return null !== $this->lastArrayArgument ? \PHP_INT_MAX : \count($this->arguments); - } - - /** - * Returns the number of required InputArguments. - */ - public function getArgumentRequiredCount(): int - { - return $this->requiredCount; - } - - /** - * @return array - */ - public function getArgumentDefaults(): array - { - $values = []; - foreach ($this->arguments as $argument) { - $values[$argument->getName()] = $argument->getDefault(); - } - - return $values; - } - - /** - * Sets the InputOption objects. - * - * @param InputOption[] $options An array of InputOption objects - * - * @return void - */ - public function setOptions(array $options = []) - { - $this->options = []; - $this->shortcuts = []; - $this->negations = []; - $this->addOptions($options); - } - - /** - * Adds an array of InputOption objects. - * - * @param InputOption[] $options An array of InputOption objects - * - * @return void - */ - public function addOptions(array $options = []) - { - foreach ($options as $option) { - $this->addOption($option); - } - } - - /** - * @return void - * - * @throws LogicException When option given already exist - */ - 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 (isset($this->negations[$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(); - } - } - - if ($option->isNegatable()) { - $negatedName = 'no-'.$option->getName(); - if (isset($this->options[$negatedName])) { - throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName)); - } - $this->negations[$negatedName] = $option->getName(); - } - } - - /** - * Returns an InputOption by name. - * - * @throws InvalidArgumentException When option given doesn't exist - */ - public function getOption(string $name): InputOption - { - if (!$this->hasOption($name)) { - throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name)); - } - - return $this->options[$name]; - } - - /** - * Returns true if an InputOption object exists by name. - * - * This method can't be used to check if the user included the option when - * executing the command (use getOption() instead). - */ - public function hasOption(string $name): bool - { - return isset($this->options[$name]); - } - - /** - * Gets the array of InputOption objects. - * - * @return InputOption[] - */ - public function getOptions(): array - { - return $this->options; - } - - /** - * Returns true if an InputOption object exists by shortcut. - */ - public function hasShortcut(string $name): bool - { - return isset($this->shortcuts[$name]); - } - - /** - * Returns true if an InputOption object exists by negated name. - */ - public function hasNegation(string $name): bool - { - return isset($this->negations[$name]); - } - - /** - * Gets an InputOption by shortcut. - */ - public function getOptionForShortcut(string $shortcut): InputOption - { - return $this->getOption($this->shortcutToName($shortcut)); - } - - /** - * @return array - */ - public function getOptionDefaults(): array - { - $values = []; - foreach ($this->options as $option) { - $values[$option->getName()] = $option->getDefault(); - } - - return $values; - } - - /** - * Returns the InputOption name given a shortcut. - * - * @throws InvalidArgumentException When option given does not exist - * - * @internal - */ - 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]; - } - - /** - * Returns the InputOption name given a negation. - * - * @throws InvalidArgumentException When option given does not exist - * - * @internal - */ - public function negationToName(string $negation): string - { - if (!isset($this->negations[$negation])) { - throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $negation)); - } - - return $this->negations[$negation]; - } - - /** - * Gets the synopsis. - */ - public function getSynopsis(bool $short = false): string - { - $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()) : ''; - $negation = $option->isNegatable() ? sprintf('|--no-%s', $option->getName()) : ''; - $elements[] = sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation); - } - } - - 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; - } -} diff --git a/tests/integration/vendor/symfony/console/Input/InputInterface.php b/tests/integration/vendor/symfony/console/Input/InputInterface.php deleted file mode 100644 index aaed5fd..0000000 --- a/tests/integration/vendor/symfony/console/Input/InputInterface.php +++ /dev/null @@ -1,150 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\RuntimeException; - -/** - * InputInterface is the interface implemented by all input classes. - * - * @author Fabien Potencier - * - * @method string __toString() Returns a stringified representation of the args passed to the command. - * InputArguments MUST be escaped as well as the InputOption values passed to the command. - */ -interface InputInterface -{ - /** - * Returns the first argument from the raw parameters (not parsed). - */ - public function getFirstArgument(): ?string; - - /** - * Returns true if the raw parameters (not parsed) contain a value. - * - * This method is to be used to introspect the input parameters - * before they have been validated. It must be used carefully. - * Does not necessarily return the correct result for short options - * when multiple flags are combined in the same option. - * - * @param string|array $values The values to look for in the raw parameters (can be an array) - * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal - */ - public function hasParameterOption(string|array $values, bool $onlyParams = false): bool; - - /** - * Returns the value of a raw option (not parsed). - * - * This method is to be used to introspect the input parameters - * before they have been validated. It must be used carefully. - * Does not necessarily return the correct result for short options - * when multiple flags are combined in the same option. - * - * @param string|array $values The value(s) to look for in the raw parameters (can be an array) - * @param string|bool|int|float|array|null $default The default value to return if no result is found - * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal - * - * @return mixed - */ - public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false); - - /** - * Binds the current Input instance with the given arguments and options. - * - * @return void - * - * @throws RuntimeException - */ - public function bind(InputDefinition $definition); - - /** - * Validates the input. - * - * @return void - * - * @throws RuntimeException When not enough arguments are given - */ - public function validate(); - - /** - * Returns all the given arguments merged with the default values. - * - * @return array - */ - public function getArguments(): array; - - /** - * Returns the argument value for a given argument name. - * - * @return mixed - * - * @throws InvalidArgumentException When argument given doesn't exist - */ - public function getArgument(string $name); - - /** - * Sets an argument value by name. - * - * @return void - * - * @throws InvalidArgumentException When argument given doesn't exist - */ - public function setArgument(string $name, mixed $value); - - /** - * Returns true if an InputArgument object exists by name or position. - */ - public function hasArgument(string $name): bool; - - /** - * Returns all the given options merged with the default values. - * - * @return array - */ - public function getOptions(): array; - - /** - * Returns the option value for a given option name. - * - * @return mixed - * - * @throws InvalidArgumentException When option given doesn't exist - */ - public function getOption(string $name); - - /** - * Sets an option value by name. - * - * @return void - * - * @throws InvalidArgumentException When option given doesn't exist - */ - public function setOption(string $name, mixed $value); - - /** - * Returns true if an InputOption object exists by name. - */ - public function hasOption(string $name): bool; - - /** - * Is this input means interactive? - */ - public function isInteractive(): bool; - - /** - * Sets the input interactivity. - * - * @return void - */ - public function setInteractive(bool $interactive); -} diff --git a/tests/integration/vendor/symfony/console/Input/InputOption.php b/tests/integration/vendor/symfony/console/Input/InputOption.php deleted file mode 100644 index fdf88dc..0000000 --- a/tests/integration/vendor/symfony/console/Input/InputOption.php +++ /dev/null @@ -1,255 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Completion\Suggestion; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; - -/** - * Represents a command line option. - * - * @author Fabien Potencier - */ -class InputOption -{ - /** - * Do not accept input for the option (e.g. --yell). This is the default behavior of options. - */ - public const VALUE_NONE = 1; - - /** - * A value must be passed when the option is used (e.g. --iterations=5 or -i5). - */ - public const VALUE_REQUIRED = 2; - - /** - * The option may or may not have a value (e.g. --yell or --yell=loud). - */ - public const VALUE_OPTIONAL = 4; - - /** - * The option accepts multiple values (e.g. --dir=/foo --dir=/bar). - */ - public const VALUE_IS_ARRAY = 8; - - /** - * The option may have either positive or negative value (e.g. --ansi or --no-ansi). - */ - public const VALUE_NEGATABLE = 16; - - private string $name; - private string|array|null $shortcut; - private int $mode; - private string|int|bool|array|null|float $default; - private array|\Closure $suggestedValues; - private string $description; - - /** - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the VALUE_* constants - * @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE) - * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion - * - * @throws InvalidArgumentException If option mode is invalid or incompatible - */ - public function __construct(string $name, string|array $shortcut = null, int $mode = null, string $description = '', string|bool|int|float|array $default = null, array|\Closure $suggestedValues = []) - { - 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 >= (self::VALUE_NEGATABLE << 1) || $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; - $this->suggestedValues = $suggestedValues; - - if ($suggestedValues && !$this->acceptValue()) { - throw new LogicException('Cannot set suggested values if the option does not accept a value.'); - } - 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.'); - } - if ($this->isNegatable() && $this->acceptValue()) { - throw new InvalidArgumentException('Impossible to have an option mode VALUE_NEGATABLE if the option also accepts a value.'); - } - - $this->setDefault($default); - } - - /** - * Returns the option shortcut. - */ - public function getShortcut(): ?string - { - return $this->shortcut; - } - - /** - * Returns the option name. - */ - public function getName(): string - { - return $this->name; - } - - /** - * Returns true if the option accepts a value. - * - * @return bool true if value mode is not self::VALUE_NONE, false otherwise - */ - public function acceptValue(): bool - { - return $this->isValueRequired() || $this->isValueOptional(); - } - - /** - * Returns true if the option requires a value. - * - * @return bool true if value mode is self::VALUE_REQUIRED, false otherwise - */ - public function isValueRequired(): bool - { - return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode); - } - - /** - * Returns true if the option takes an optional value. - * - * @return bool true if value mode is self::VALUE_OPTIONAL, false otherwise - */ - public function isValueOptional(): bool - { - return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode); - } - - /** - * Returns true if the option can take multiple values. - * - * @return bool true if mode is self::VALUE_IS_ARRAY, false otherwise - */ - public function isArray(): bool - { - return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode); - } - - public function isNegatable(): bool - { - return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode); - } - - /** - * @return void - */ - public function setDefault(string|bool|int|float|array $default = null) - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - 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() || $this->isNegatable() ? $default : false; - } - - /** - * Returns the default value. - */ - public function getDefault(): string|bool|int|float|array|null - { - return $this->default; - } - - /** - * Returns the description text. - */ - public function getDescription(): string - { - return $this->description; - } - - public function hasCompletion(): bool - { - return [] !== $this->suggestedValues; - } - - /** - * Adds suggestions to $suggestions for the current completion input. - * - * @see Command::complete() - */ - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - $values = $this->suggestedValues; - if ($values instanceof \Closure && !\is_array($values = $values($input))) { - throw new LogicException(sprintf('Closure for option "%s" must return an array. Got "%s".', $this->name, get_debug_type($values))); - } - if ($values) { - $suggestions->suggestValues($values); - } - } - - /** - * Checks whether the given option equals this one. - */ - public function equals(self $option): bool - { - return $option->getName() === $this->getName() - && $option->getShortcut() === $this->getShortcut() - && $option->getDefault() === $this->getDefault() - && $option->isNegatable() === $this->isNegatable() - && $option->isArray() === $this->isArray() - && $option->isValueRequired() === $this->isValueRequired() - && $option->isValueOptional() === $this->isValueOptional() - ; - } -} diff --git a/tests/integration/vendor/symfony/console/Input/StreamableInputInterface.php b/tests/integration/vendor/symfony/console/Input/StreamableInputInterface.php deleted file mode 100644 index 4b95fcb..0000000 --- a/tests/integration/vendor/symfony/console/Input/StreamableInputInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -/** - * StreamableInputInterface is the interface implemented by all input classes - * that have an input stream. - * - * @author Robin Chalas - */ -interface StreamableInputInterface extends InputInterface -{ - /** - * Sets the input stream to read from when interacting with the user. - * - * This is mainly useful for testing purpose. - * - * @param resource $stream The input stream - * - * @return void - */ - public function setStream($stream); - - /** - * Returns the input stream. - * - * @return resource|null - */ - public function getStream(); -} diff --git a/tests/integration/vendor/symfony/console/Input/StringInput.php b/tests/integration/vendor/symfony/console/Input/StringInput.php deleted file mode 100644 index 82bd214..0000000 --- a/tests/integration/vendor/symfony/console/Input/StringInput.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Input; - -use Symfony\Component\Console\Exception\InvalidArgumentException; - -/** - * StringInput represents an input provided as a string. - * - * Usage: - * - * $input = new StringInput('foo --bar="foobar"'); - * - * @author Fabien Potencier - */ -class StringInput extends ArgvInput -{ - /** - * @deprecated since Symfony 6.1 - */ - public const REGEX_STRING = '([^\s]+?)(?:\s|(?setTokens($this->tokenize($input)); - } - - /** - * Tokenizes a string. - * - * @throws InvalidArgumentException When unable to parse input (should never happen) - */ - private function tokenize(string $input): array - { - $tokens = []; - $length = \strlen($input); - $cursor = 0; - $token = null; - while ($cursor < $length) { - if ('\\' === $input[$cursor]) { - $token .= $input[++$cursor] ?? ''; - ++$cursor; - continue; - } - - if (preg_match('/\s+/A', $input, $match, 0, $cursor)) { - if (null !== $token) { - $tokens[] = $token; - $token = null; - } - } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) { - $token .= $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1))); - } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) { - $token .= stripcslashes(substr($match[0], 1, -1)); - } elseif (preg_match('/'.self::REGEX_UNQUOTED_STRING.'/A', $input, $match, 0, $cursor)) { - $token .= $match[1]; - } else { - // should never happen - throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10))); - } - - $cursor += \strlen($match[0]); - } - - if (null !== $token) { - $tokens[] = $token; - } - - return $tokens; - } -} diff --git a/tests/integration/vendor/symfony/console/LICENSE b/tests/integration/vendor/symfony/console/LICENSE deleted file mode 100644 index 0138f8f..0000000 --- a/tests/integration/vendor/symfony/console/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-present Fabien Potencier - -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. diff --git a/tests/integration/vendor/symfony/console/Logger/ConsoleLogger.php b/tests/integration/vendor/symfony/console/Logger/ConsoleLogger.php deleted file mode 100644 index fddef50..0000000 --- a/tests/integration/vendor/symfony/console/Logger/ConsoleLogger.php +++ /dev/null @@ -1,119 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * PSR-3 compliant console logger. - * - * @author Kévin Dunglas - * - * @see https://www.php-fig.org/psr/psr-3/ - */ -class ConsoleLogger extends AbstractLogger -{ - public const INFO = 'info'; - public const ERROR = 'error'; - - private OutputInterface $output; - private array $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 array $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 bool $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 = []): void - { - if (!isset($this->verbosityLevelMap[$level])) { - throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level)); - } - - $output = $this->output; - - // Write to the error output if necessary and available - if (self::ERROR === $this->formatLevelMap[$level]) { - if ($this->output instanceof ConsoleOutputInterface) { - $output = $output->getErrorOutput(); - } - $this->errored = true; - } - - // the if condition check isn't necessary -- it's the same one that $output will do internally anyway. - // We only do it for efficiency here as the message formatting is relatively expensive. - if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) { - $output->writeln(sprintf('<%1$s>[%2$s] %3$s', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)), $this->verbosityLevelMap[$level]); - } - } - - /** - * Returns true when any messages have been logged at error levels. - */ - public function hasErrored(): bool - { - return $this->errored; - } - - /** - * Interpolates context values into the message placeholders. - * - * @author PHP Framework Interoperability Group - */ - 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) || $val instanceof \Stringable) { - $replacements["{{$key}}"] = $val; - } elseif ($val instanceof \DateTimeInterface) { - $replacements["{{$key}}"] = $val->format(\DateTimeInterface::RFC3339); - } elseif (\is_object($val)) { - $replacements["{{$key}}"] = '[object '.$val::class.']'; - } else { - $replacements["{{$key}}"] = '['.\gettype($val).']'; - } - } - - return strtr($message, $replacements); - } -} diff --git a/tests/integration/vendor/symfony/console/Output/BufferedOutput.php b/tests/integration/vendor/symfony/console/Output/BufferedOutput.php deleted file mode 100644 index ef5099b..0000000 --- a/tests/integration/vendor/symfony/console/Output/BufferedOutput.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Output; - -/** - * @author Jean-François Simon - */ -class BufferedOutput extends Output -{ - private string $buffer = ''; - - /** - * Empties buffer and returns its content. - */ - public function fetch(): string - { - $content = $this->buffer; - $this->buffer = ''; - - return $content; - } - - /** - * @return void - */ - protected function doWrite(string $message, bool $newline) - { - $this->buffer .= $message; - - if ($newline) { - $this->buffer .= \PHP_EOL; - } - } -} diff --git a/tests/integration/vendor/symfony/console/Output/ConsoleOutput.php b/tests/integration/vendor/symfony/console/Output/ConsoleOutput.php deleted file mode 100644 index c1eb7cd..0000000 --- a/tests/integration/vendor/symfony/console/Output/ConsoleOutput.php +++ /dev/null @@ -1,165 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Output; - -use Symfony\Component\Console\Formatter\OutputFormatterInterface; - -/** - * ConsoleOutput is the default class for all CLI output. It uses STDOUT and STDERR. - * - * This class is a convenient wrapper around `StreamOutput` for both STDOUT and STDERR. - * - * $output = new ConsoleOutput(); - * - * This is equivalent to: - * - * $output = new StreamOutput(fopen('php://stdout', 'w')); - * $stdErr = new StreamOutput(fopen('php://stderr', 'w')); - * - * @author Fabien Potencier - */ -class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface -{ - private OutputInterface $stderr; - private array $consoleSectionOutputs = []; - - /** - * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) - * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) - * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) - */ - public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null) - { - parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter); - - if (null === $formatter) { - // for BC reasons, stdErr has it own Formatter only when user don't inject a specific 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()); - } - } - - /** - * Creates a new output section. - */ - public function section(): ConsoleSectionOutput - { - return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter()); - } - - /** - * @return void - */ - public function setDecorated(bool $decorated) - { - parent::setDecorated($decorated); - $this->stderr->setDecorated($decorated); - } - - /** - * @return void - */ - public function setFormatter(OutputFormatterInterface $formatter) - { - parent::setFormatter($formatter); - $this->stderr->setFormatter($formatter); - } - - /** - * @return void - */ - public function setVerbosity(int $level) - { - parent::setVerbosity($level); - $this->stderr->setVerbosity($level); - } - - public function getErrorOutput(): OutputInterface - { - return $this->stderr; - } - - /** - * @return void - */ - public function setErrorOutput(OutputInterface $error) - { - $this->stderr = $error; - } - - /** - * Returns true if current environment supports writing console output to - * STDOUT. - */ - protected function hasStdoutSupport(): bool - { - return false === $this->isRunningOS400(); - } - - /** - * Returns true if current environment supports writing console output to - * STDERR. - */ - protected function hasStderrSupport(): bool - { - return false === $this->isRunningOS400(); - } - - /** - * Checks if current executing environment is IBM iSeries (OS400), which - * doesn't properly convert character-encodings between ASCII to EBCDIC. - */ - private function isRunningOS400(): bool - { - $checks = [ - \function_exists('php_uname') ? php_uname('s') : '', - getenv('OSTYPE'), - \PHP_OS, - ]; - - return false !== stripos(implode(';', $checks), 'OS400'); - } - - /** - * @return resource - */ - private function openOutputStream() - { - if (!$this->hasStdoutSupport()) { - return fopen('php://output', 'w'); - } - - // Use STDOUT when possible to prevent from opening too many file descriptors - return \defined('STDOUT') ? \STDOUT : (@fopen('php://stdout', 'w') ?: fopen('php://output', 'w')); - } - - /** - * @return resource - */ - private function openErrorStream() - { - if (!$this->hasStderrSupport()) { - return fopen('php://output', 'w'); - } - - // Use STDERR when possible to prevent from opening too many file descriptors - return \defined('STDERR') ? \STDERR : (@fopen('php://stderr', 'w') ?: fopen('php://output', 'w')); - } -} diff --git a/tests/integration/vendor/symfony/console/Output/ConsoleOutputInterface.php b/tests/integration/vendor/symfony/console/Output/ConsoleOutputInterface.php deleted file mode 100644 index 9c0049c..0000000 --- a/tests/integration/vendor/symfony/console/Output/ConsoleOutputInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Output; - -/** - * ConsoleOutputInterface is the interface implemented by ConsoleOutput class. - * This adds information about stderr and section output stream. - * - * @author Dariusz Górecki - */ -interface ConsoleOutputInterface extends OutputInterface -{ - /** - * Gets the OutputInterface for errors. - */ - public function getErrorOutput(): OutputInterface; - - /** - * @return void - */ - public function setErrorOutput(OutputInterface $error); - - public function section(): ConsoleSectionOutput; -} diff --git a/tests/integration/vendor/symfony/console/Output/NullOutput.php b/tests/integration/vendor/symfony/console/Output/NullOutput.php deleted file mode 100644 index f3aa15b..0000000 --- a/tests/integration/vendor/symfony/console/Output/NullOutput.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Output; - -use Symfony\Component\Console\Formatter\NullOutputFormatter; -use Symfony\Component\Console\Formatter\OutputFormatterInterface; - -/** - * NullOutput suppresses all output. - * - * $output = new NullOutput(); - * - * @author Fabien Potencier - * @author Tobias Schultze - */ -class NullOutput implements OutputInterface -{ - private NullOutputFormatter $formatter; - - /** - * @return void - */ - public function setFormatter(OutputFormatterInterface $formatter) - { - // do nothing - } - - public function getFormatter(): OutputFormatterInterface - { - // to comply with the interface we must return a OutputFormatterInterface - return $this->formatter ??= new NullOutputFormatter(); - } - - /** - * @return void - */ - public function setDecorated(bool $decorated) - { - // do nothing - } - - public function isDecorated(): bool - { - return false; - } - - /** - * @return void - */ - public function setVerbosity(int $level) - { - // do nothing - } - - public function getVerbosity(): int - { - return self::VERBOSITY_QUIET; - } - - public function isQuiet(): bool - { - return true; - } - - public function isVerbose(): bool - { - return false; - } - - public function isVeryVerbose(): bool - { - return false; - } - - public function isDebug(): bool - { - return false; - } - - /** - * @return void - */ - public function writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL) - { - // do nothing - } - - /** - * @return void - */ - public function write(string|iterable $messages, bool $newline = false, int $options = self::OUTPUT_NORMAL) - { - // do nothing - } -} diff --git a/tests/integration/vendor/symfony/console/Output/Output.php b/tests/integration/vendor/symfony/console/Output/Output.php deleted file mode 100644 index 3a06311..0000000 --- a/tests/integration/vendor/symfony/console/Output/Output.php +++ /dev/null @@ -1,155 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Output; - -use Symfony\Component\Console\Formatter\OutputFormatter; -use Symfony\Component\Console\Formatter\OutputFormatterInterface; - -/** - * Base class for output classes. - * - * There are five levels of verbosity: - * - * * normal: no option passed (normal output) - * * verbose: -v (more output) - * * very verbose: -vv (highly extended output) - * * debug: -vvv (all debug output) - * * quiet: -q (no output) - * - * @author Fabien Potencier - */ -abstract class Output implements OutputInterface -{ - private int $verbosity; - private OutputFormatterInterface $formatter; - - /** - * @param int|null $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) - * @param bool $decorated Whether to decorate messages - * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) - */ - public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null) - { - $this->verbosity = $verbosity ?? self::VERBOSITY_NORMAL; - $this->formatter = $formatter ?? new OutputFormatter(); - $this->formatter->setDecorated($decorated); - } - - /** - * @return void - */ - public function setFormatter(OutputFormatterInterface $formatter) - { - $this->formatter = $formatter; - } - - public function getFormatter(): OutputFormatterInterface - { - return $this->formatter; - } - - /** - * @return void - */ - public function setDecorated(bool $decorated) - { - $this->formatter->setDecorated($decorated); - } - - public function isDecorated(): bool - { - return $this->formatter->isDecorated(); - } - - /** - * @return void - */ - public function setVerbosity(int $level) - { - $this->verbosity = $level; - } - - public function getVerbosity(): int - { - return $this->verbosity; - } - - public function isQuiet(): bool - { - return self::VERBOSITY_QUIET === $this->verbosity; - } - - public function isVerbose(): bool - { - return self::VERBOSITY_VERBOSE <= $this->verbosity; - } - - public function isVeryVerbose(): bool - { - return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity; - } - - public function isDebug(): bool - { - return self::VERBOSITY_DEBUG <= $this->verbosity; - } - - /** - * @return void - */ - public function writeln(string|iterable $messages, int $options = self::OUTPUT_NORMAL) - { - $this->write($messages, true, $options); - } - - /** - * @return void - */ - public function write(string|iterable $messages, bool $newline = false, int $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); - } - } - - /** - * Writes a message to the output. - * - * @return void - */ - abstract protected function doWrite(string $message, bool $newline); -} diff --git a/tests/integration/vendor/symfony/console/Output/OutputInterface.php b/tests/integration/vendor/symfony/console/Output/OutputInterface.php deleted file mode 100644 index fb15577..0000000 --- a/tests/integration/vendor/symfony/console/Output/OutputInterface.php +++ /dev/null @@ -1,107 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Output; - -use Symfony\Component\Console\Formatter\OutputFormatterInterface; - -/** - * OutputInterface is the interface implemented by all Output classes. - * - * @author Fabien Potencier - */ -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; - - /** - * Writes a message to the output. - * - * @param bool $newline Whether to add a newline - * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), - * 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL - * - * @return void - */ - public function write(string|iterable $messages, bool $newline = false, int $options = 0); - - /** - * Writes a message to the output and adds a newline at the end. - * - * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), - * 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL - * - * @return void - */ - public function writeln(string|iterable $messages, int $options = 0); - - /** - * Sets the verbosity of the output. - * - * @return void - */ - public function setVerbosity(int $level); - - /** - * Gets the current verbosity of the output. - */ - public function getVerbosity(): int; - - /** - * Returns whether verbosity is quiet (-q). - */ - public function isQuiet(): bool; - - /** - * Returns whether verbosity is verbose (-v). - */ - public function isVerbose(): bool; - - /** - * Returns whether verbosity is very verbose (-vv). - */ - public function isVeryVerbose(): bool; - - /** - * Returns whether verbosity is debug (-vvv). - */ - public function isDebug(): bool; - - /** - * Sets the decorated flag. - * - * @return void - */ - public function setDecorated(bool $decorated); - - /** - * Gets the decorated flag. - */ - public function isDecorated(): bool; - - /** - * @return void - */ - public function setFormatter(OutputFormatterInterface $formatter); - - /** - * Returns current output formatter instance. - */ - public function getFormatter(): OutputFormatterInterface; -} diff --git a/tests/integration/vendor/symfony/console/Output/StreamOutput.php b/tests/integration/vendor/symfony/console/Output/StreamOutput.php deleted file mode 100644 index 155066e..0000000 --- a/tests/integration/vendor/symfony/console/Output/StreamOutput.php +++ /dev/null @@ -1,113 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Output; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Formatter\OutputFormatterInterface; - -/** - * StreamOutput writes the output to a given stream. - * - * Usage: - * - * $output = new StreamOutput(fopen('php://stdout', 'w')); - * - * As `StreamOutput` can use any stream, you can also use a file: - * - * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); - * - * @author Fabien Potencier - */ -class StreamOutput extends Output -{ - private $stream; - - /** - * @param resource $stream A stream resource - * @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface) - * @param bool|null $decorated Whether to decorate messages (null for auto-guessing) - * @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter) - * - * @throws InvalidArgumentException When first argument is not a real 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; - - $decorated ??= $this->hasColorSupport(); - - parent::__construct($verbosity, $decorated, $formatter); - } - - /** - * Gets the stream attached to this StreamOutput instance. - * - * @return resource - */ - public function getStream() - { - return $this->stream; - } - - /** - * @return void - */ - protected function doWrite(string $message, bool $newline) - { - if ($newline) { - $message .= \PHP_EOL; - } - - @fwrite($this->stream, $message); - - fflush($this->stream); - } - - /** - * Returns true if the stream supports colorization. - * - * Colorization is disabled if not supported by the stream: - * - * This is tricky on Windows, because Cygwin, Msys2 etc emulate pseudo - * terminals via named pipes, so we can only check the environment. - * - * Reference: Composer\XdebugHandler\Process::supportsColor - * https://github.com/composer/xdebug-handler - * - * @return bool true if the stream supports colorization, false otherwise - */ - protected function hasColorSupport(): bool - { - // Follow https://no-color.org/ - 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'); - } - - return stream_isatty($this->stream); - } -} diff --git a/tests/integration/vendor/symfony/console/Question/ChoiceQuestion.php b/tests/integration/vendor/symfony/console/Question/ChoiceQuestion.php deleted file mode 100644 index e449ff6..0000000 --- a/tests/integration/vendor/symfony/console/Question/ChoiceQuestion.php +++ /dev/null @@ -1,177 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Question; - -use Symfony\Component\Console\Exception\InvalidArgumentException; - -/** - * Represents a choice question. - * - * @author Fabien Potencier - */ -class ChoiceQuestion extends Question -{ - private array $choices; - private bool $multiselect = false; - private string $prompt = ' > '; - private string $errorMessage = 'Value "%s" is invalid'; - - /** - * @param string $question The question to ask to the user - * @param array $choices The list of available choices - * @param mixed $default The default answer to return - */ - public function __construct(string $question, array $choices, mixed $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); - } - - /** - * Returns available choices. - */ - public function getChoices(): array - { - return $this->choices; - } - - /** - * Sets multiselect option. - * - * When multiselect is set to true, multiple choices can be answered. - * - * @return $this - */ - public function setMultiselect(bool $multiselect): static - { - $this->multiselect = $multiselect; - $this->setValidator($this->getDefaultValidator()); - - return $this; - } - - /** - * Returns whether the choices are multiselect. - */ - public function isMultiselect(): bool - { - return $this->multiselect; - } - - /** - * Gets the prompt for choices. - */ - public function getPrompt(): string - { - return $this->prompt; - } - - /** - * Sets the prompt for choices. - * - * @return $this - */ - public function setPrompt(string $prompt): static - { - $this->prompt = $prompt; - - return $this; - } - - /** - * Sets the error message for invalid values. - * - * The error message has a string placeholder (%s) for the invalid value. - * - * @return $this - */ - public function setErrorMessage(string $errorMessage): static - { - $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) { - // Check for a separated comma values - if (!preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) { - throw new InvalidArgumentException(sprintf($errorMessage, $selected)); - } - - $selectedChoices = explode(',', (string) $selected); - } else { - $selectedChoices = [$selected]; - } - - if ($this->isTrimmable()) { - foreach ($selectedChoices as $k => $v) { - $selectedChoices[$k] = trim((string) $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)); - } - - // For associative choices, consistently return the key as string: - $multiselectChoices[] = $isAssoc ? (string) $result : $result; - } - - if ($multiselect) { - return $multiselectChoices; - } - - return current($multiselectChoices); - }; - } -} diff --git a/tests/integration/vendor/symfony/console/Question/ConfirmationQuestion.php b/tests/integration/vendor/symfony/console/Question/ConfirmationQuestion.php deleted file mode 100644 index 40eab24..0000000 --- a/tests/integration/vendor/symfony/console/Question/ConfirmationQuestion.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Question; - -/** - * Represents a yes/no question. - * - * @author Fabien Potencier - */ -class ConfirmationQuestion extends Question -{ - private string $trueAnswerRegex; - - /** - * @param string $question The question to ask to the user - * @param bool $default The default answer to return, true or false - * @param string $trueAnswerRegex A regex to match the "yes" answer - */ - public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i') - { - parent::__construct($question, $default); - - $this->trueAnswerRegex = $trueAnswerRegex; - $this->setNormalizer($this->getDefaultNormalizer()); - } - - /** - * Returns the default answer normalizer. - */ - 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; - }; - } -} diff --git a/tests/integration/vendor/symfony/console/Question/Question.php b/tests/integration/vendor/symfony/console/Question/Question.php deleted file mode 100644 index 26896bb..0000000 --- a/tests/integration/vendor/symfony/console/Question/Question.php +++ /dev/null @@ -1,291 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Question; - -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; - -/** - * Represents a Question. - * - * @author Fabien Potencier - */ -class Question -{ - private string $question; - private ?int $attempts = null; - private bool $hidden = false; - private bool $hiddenFallback = true; - private ?\Closure $autocompleterCallback = null; - private ?\Closure $validator = null; - private string|int|bool|null|float $default; - private ?\Closure $normalizer = null; - private bool $trimmable = true; - private bool $multiline = false; - - /** - * @param string $question The question to ask to the user - * @param string|bool|int|float|null $default The default answer to return if the user enters nothing - */ - public function __construct(string $question, string|bool|int|float $default = null) - { - $this->question = $question; - $this->default = $default; - } - - /** - * Returns the question. - */ - public function getQuestion(): string - { - return $this->question; - } - - /** - * Returns the default answer. - */ - public function getDefault(): string|bool|int|float|null - { - return $this->default; - } - - /** - * Returns whether the user response accepts newline characters. - */ - public function isMultiline(): bool - { - return $this->multiline; - } - - /** - * Sets whether the user response should accept newline characters. - * - * @return $this - */ - public function setMultiline(bool $multiline): static - { - $this->multiline = $multiline; - - return $this; - } - - /** - * Returns whether the user response must be hidden. - */ - public function isHidden(): bool - { - return $this->hidden; - } - - /** - * Sets whether the user response must be hidden or not. - * - * @return $this - * - * @throws LogicException In case the autocompleter is also used - */ - public function setHidden(bool $hidden): static - { - if ($this->autocompleterCallback) { - throw new LogicException('A hidden question cannot use the autocompleter.'); - } - - $this->hidden = $hidden; - - return $this; - } - - /** - * In case the response cannot be hidden, whether to fallback on non-hidden question or not. - */ - public function isHiddenFallback(): bool - { - return $this->hiddenFallback; - } - - /** - * Sets whether to fallback on non-hidden question if the response cannot be hidden. - * - * @return $this - */ - public function setHiddenFallback(bool $fallback): static - { - $this->hiddenFallback = $fallback; - - return $this; - } - - /** - * Gets values for the autocompleter. - */ - public function getAutocompleterValues(): ?iterable - { - $callback = $this->getAutocompleterCallback(); - - return $callback ? $callback('') : null; - } - - /** - * Sets values for the autocompleter. - * - * @return $this - * - * @throws LogicException - */ - public function setAutocompleterValues(?iterable $values): static - { - if (\is_array($values)) { - $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values); - - $callback = static fn () => $values; - } elseif ($values instanceof \Traversable) { - $callback = static function () use ($values) { - static $valueCache; - - return $valueCache ??= iterator_to_array($values, false); - }; - } else { - $callback = null; - } - - return $this->setAutocompleterCallback($callback); - } - - /** - * Gets the callback function used for the autocompleter. - */ - public function getAutocompleterCallback(): ?callable - { - return $this->autocompleterCallback; - } - - /** - * Sets the callback function used for the autocompleter. - * - * The callback is passed the user input as argument and should return an iterable of corresponding suggestions. - * - * @return $this - */ - public function setAutocompleterCallback(callable $callback = null): static - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - if ($this->hidden && null !== $callback) { - throw new LogicException('A hidden question cannot use the autocompleter.'); - } - - $this->autocompleterCallback = null === $callback ? null : $callback(...); - - return $this; - } - - /** - * Sets a validator for the question. - * - * @return $this - */ - public function setValidator(callable $validator = null): static - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__); - } - $this->validator = null === $validator ? null : $validator(...); - - return $this; - } - - /** - * Gets the validator for the question. - */ - public function getValidator(): ?callable - { - return $this->validator; - } - - /** - * Sets the maximum number of attempts. - * - * Null means an unlimited number of attempts. - * - * @return $this - * - * @throws InvalidArgumentException in case the number of attempts is invalid - */ - public function setMaxAttempts(?int $attempts): static - { - if (null !== $attempts && $attempts < 1) { - throw new InvalidArgumentException('Maximum number of attempts must be a positive value.'); - } - - $this->attempts = $attempts; - - return $this; - } - - /** - * Gets the maximum number of attempts. - * - * Null means an unlimited number of attempts. - */ - public function getMaxAttempts(): ?int - { - return $this->attempts; - } - - /** - * Sets a normalizer for the response. - * - * The normalizer can be a callable (a string), a closure or a class implementing __invoke. - * - * @return $this - */ - public function setNormalizer(callable $normalizer): static - { - $this->normalizer = $normalizer(...); - - return $this; - } - - /** - * Gets the normalizer for the response. - * - * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. - */ - public function getNormalizer(): ?callable - { - return $this->normalizer; - } - - /** - * @return bool - */ - protected function isAssoc(array $array) - { - return (bool) \count(array_filter(array_keys($array), 'is_string')); - } - - public function isTrimmable(): bool - { - return $this->trimmable; - } - - /** - * @return $this - */ - public function setTrimmable(bool $trimmable): static - { - $this->trimmable = $trimmable; - - return $this; - } -} diff --git a/tests/integration/vendor/symfony/console/README.md b/tests/integration/vendor/symfony/console/README.md deleted file mode 100644 index bfd4881..0000000 --- a/tests/integration/vendor/symfony/console/README.md +++ /dev/null @@ -1,36 +0,0 @@ -Console Component -================= - -The Console component eases the creation of beautiful and testable command line -interfaces. - -Sponsor -------- - -The Console component for Symfony 6.3 is [backed][1] by [Les-Tilleuls.coop][2]. - -Les-Tilleuls.coop is a team of 70+ Symfony experts who can help you design, develop and -fix your projects. They provide a wide range of professional services including development, -consulting, coaching, training and audits. They also are highly skilled in JS, Go and DevOps. -They are a worker cooperative! - -Help Symfony by [sponsoring][3] its development! - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/console.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) - -Credits -------- - -`Resources/bin/hiddeninput.exe` is a third party binary provided within this -component. Find sources and license at https://github.com/Seldaek/hidden-input. - -[1]: https://symfony.com/backers -[2]: https://les-tilleuls.coop -[3]: https://symfony.com/sponsor diff --git a/tests/integration/vendor/symfony/console/Resources/bin/hiddeninput.exe b/tests/integration/vendor/symfony/console/Resources/bin/hiddeninput.exe deleted file mode 100644 index c8cf65e8d819e6e525121cf6b21f1c2429746038..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9216 zcmeHNe{@sVeZR8hV88~S)=Hp|Mpn({rC^@)BwNOI{ERJXCYlx+k1K6PLHo z_e!z_fhOzeA3JTX&-Z@s{rFOgjEwBlqjr!)9f zjyHz`A+ni`!0Taby{Uj5Y>jQq(k5A+X})PLWAi|{IZbtc8n^^trM{GI=P_15U6d?l zJJ3PW8XjfHpR}6`k{&5@JcEeH_SqQoQbU62o2YS30W)p_t&Fjy*RXQCZt$gCf|ao| zx&3R}m6|-Lfi@pua=$26n(UlnWo$>K67*|+#(qL_An=?l0M02AhOSJDv3;~?1ORfw z76EdK#MpSHqACHLcnJLIYlCSiX4eS@Pr8rN)Xwz0dk7O*y^0_C(Yks2Kvg! z-d-fJ)F9@k?>)m(XqDKIe2OKfhCQde9fpO0ko24yn*4xzX7q+ze`Z*=aJgwV?D?73 zaJ8UkSk|NN>@-|mB*f`EIK7$ElgAB<7p&p`^Vuq$58#;?B^*Bz7&d$B#+AYUC z(^m|`7{lqx&b^5$;i`j|S!+u|lcaQplp_&Nb)!>r>vGh3wb!tW zLq6%bkSt8jO|(vWH>LiPV(Xkp%BiGhl1q!PXXNKVKE!>Y5cHc2%cJOJA{-&ZsSn`T z#8~TA#(HWH4m>uCd+kCMTFgMI*s*n3!iCOwEI`{vGcVhzDu!Lw%-Ea^JATtrF`q3`+#KvvYJ0vM~A}D#LOD zlw`4ncB0U*Jji=--Wz#>I&5?hy;MgYW2u91d8ob=7MWfY`u;7Xe-J{Qsb0=0p|SM2 zG|=~mERIj4?gi)Ew|{LIN#oAsh20k_khIYjJBBN6rrIJ=eQO=nE;rTnPSiaQS$1$# z+|JRh0!IbQIa*f1(TZ}QM;|WO0+jTy(e)ggN4>zqp2E>C>hGPLHjHBh--2%@{EZNE zbUk{<3MABX&20QwK{MxK8`1Vk>^%dO5i@VTfu>NG3$K4NC=hSPsj9UYy`rNO}sBnB9QdKdIk7G+2_amnWstdTYVg z7HgLJGC~XLZG`63GwH8PdO_+G(k6~?J8Wj5mQos#21kC4W#2)guQXI)!z^{@F)U)5 z*re+r(2dib3D4P~%Z6TL=$PIkpmm<_#isu%t=%DcIwNkJhMeJ|bpahHO%8h|y~Ccf zUg#xVk+dyu>Q1O7JZ~8KS>tqi0qK**X*y6yHM71`bT=kFZ=@E%oe2!Km1^2sa>v+onZ%x_>aOJF+N0{i~z|<(IzgT*{0PpQq}E zQpU35@bm;qI?t_znGI&5&4sZV>+%m}w$(4hSDvLk)l<{5XyMlnCl7C%AjM3XnWvVz z{NoFsX)JB)SoqABZxUa*Yq+^^(cbq4mL%^lO12c${z{pf+)|kTTI~nQywyYF6}6|8 zlsN9&{-vwTrTyu<5^90_AsIU-ID#ZG@6d%poU44<**%xVe?`uxf}_Mr$SLHLS|K_N zQnw>(Lr2U=%$-<2D~RSzbG)2W2u^KMDnFFE?GmmbQ)V)fty957F`4OvQ_25E68ITr z5?`suu`|v?r!y=gFOGj$%9IJ zuTP=&2GcnoZZ0qSe6YL-*-lg>Q#>?Ew`a=GDc4vI#<1sNdKn?n7iSj0Orl$-#FMFi zykr>X-Xvi>sVr;92+8*H!r|3L$#o~hXa0z>AmF=z z?|@FF;*S|S0yqsw0j>Z(3mX-HD!|{N-vYc9paC8Ld=|6?00!6(_%lERupO`&um*4k z0b~W>e*uhTe4;V;mq>(ox$9FB`wLt!*DKj~!aOh|fL&#Pg*b??tm%5~_6M#02wqeC zS~wO>TWGnSp^r<0&8f2V6W->w=C+p~daC5e5wNQM*(* z66^}b0(!q3)zq$mu&VnbR#nr3;h5DS*o7{y66=!#;Dy4$pd1ZH<6WEOi0oJ8SxRL* z*v-9@Z^2w%^S(w5dO{_9Duby%2RT~;ppxaE$l()x6&}>7Wcg=u_&>f`Vs8OJGTy{X z2HpG=ThJz<{%|4Qq-~ad0qcrc87n88DHpM(nypwXIkZn<{zIT$ul&BQ?{ApCAZtyr zs2YpNt@x(G*faTU*HCKnAk(G=Tl~>r1QK8LY~J8mFFGoN5iIkYSwlm4Lsj#g4dsE5 zU-4;*Kdh-zv!rT4N$O}Q&n)?v0-9Y)lRFz58^P-KtKonzrfQ1p@0V_10^0||cGRn9 zRG<-#_TEV2nn4{BOh{YVBR4e!V!D?0K%BAlQN!D%M#k1bHypiIHT)5tlj>p0Pp_;+ z!cqC-JIs@JRhB+#teGs$Cib_=(yjRo4OJg^YPg%58aJVsC(LQ?W6%pn!-#aMZwoPcopo^Rn6BE z3=c5&W5~pP(C(-2r;PnH-S0{F`runM0ERCf3rESX$+S(MKOXmKJL9zXF}9-lf^xUs z+bb)+P%L&gV@<4q{6w^xEJ>Y>TQFUeoz0o-yq)jUqww=?wjUO8Y{a5G;DJ0Jr!LL+ zWhgsLuzi&eDrGDn$2DJwpFfH-?SGWbr>qRb?v{P`_%)So)CQgzO^HQ%;y#tJ=knH4 z95jX;^bF#BiuTH^%-j}{9VrZD=R%Q%wselH^p>5 z7d>gWB-st&3Fj%Mt*|tR5iK3J=`xhs&G)I7E>`FO@o7L z@S$B!pYMuzz5DN@X!O4DPm5n@raPJn-Q#o*m*e^5lk$g?0esg%$;>g5QW-|;c=H2GM}bo2tW^D924wmOkrUbWxcQ# z#v6bP%Tdfe~jtCRzAL;-OahZ=#yvUixu2-9fD2j$*|YY`F?0wF-{a# ztr<&kZjZ+81}6ZESqtgW)8kP#s@VLTSUR{}6?U^R*x7RE3Rl&n=VnFFqg9Uqz1n@N9N|=9<4} zuJfy^+}|D9X&vm3MAdqmu0&UMd^=K>b1hLAm_E!$rZC2b;;T~Dl zI`Eo_yRY76uM})|6wk9->of(=9&4jLv5#p@OzS~Yl>@pG)^>6`R+KtL{<4ly4o9WiM!%p_pfROU354)e8PIeE z1_s?#;OX6waNvvb&UQRN(WLbR+}&b#jo&WY-LlwCX}Q*$jGuKYuOGoIoyR(>e}}ix z+t}Q^cEcC8Y{@h}>HmJ^gD!l@gzwHmiBKl26x_lZVZG2UY!`w;RJd122;US&geQdW z3Qq}R!gIo5;ka;0I4c-Jq5X6A6?VzK&c4y!ZXdAUYu{r}*!SBXw?Aor+J4-A(*COb zb^CwV-?3k`zi-cX*c`VzL`RLI(b4MgIrGN z%ojf`E*6)Gg1A9!7q^N##2zsss^V9~-Qt7d!{UDNZ^XY9pA^3@9ui*?e=7c5d`nD; z?}~R(p>y1Kw!>|X4ycYEAkcZa*n-R%y! zqi)Up756UpqwfE7=hfigw$k~G@25gaxF9UGTkV>C(7x1Rbx4jb#|}rxq0vQ!n-c#f J0sQ~1{4brj`U(I5 diff --git a/tests/integration/vendor/symfony/console/Style/OutputStyle.php b/tests/integration/vendor/symfony/console/Style/OutputStyle.php deleted file mode 100644 index ddfa8de..0000000 --- a/tests/integration/vendor/symfony/console/Style/OutputStyle.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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; - -/** - * Decorates output to add console style guide helpers. - * - * @author Kevin Bond - */ -abstract class OutputStyle implements OutputInterface, StyleInterface -{ - private OutputInterface $output; - - public function __construct(OutputInterface $output) - { - $this->output = $output; - } - - /** - * @return void - */ - public function newLine(int $count = 1) - { - $this->output->write(str_repeat(\PHP_EOL, $count)); - } - - public function createProgressBar(int $max = 0): ProgressBar - { - return new ProgressBar($this->output, $max); - } - - /** - * @return void - */ - public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) - { - $this->output->write($messages, $newline, $type); - } - - /** - * @return void - */ - public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL) - { - $this->output->writeln($messages, $type); - } - - /** - * @return void - */ - public function setVerbosity(int $level) - { - $this->output->setVerbosity($level); - } - - public function getVerbosity(): int - { - return $this->output->getVerbosity(); - } - - /** - * @return void - */ - public function setDecorated(bool $decorated) - { - $this->output->setDecorated($decorated); - } - - public function isDecorated(): bool - { - return $this->output->isDecorated(); - } - - /** - * @return void - */ - public function setFormatter(OutputFormatterInterface $formatter) - { - $this->output->setFormatter($formatter); - } - - public function getFormatter(): OutputFormatterInterface - { - return $this->output->getFormatter(); - } - - public function isQuiet(): bool - { - return $this->output->isQuiet(); - } - - public function isVerbose(): bool - { - return $this->output->isVerbose(); - } - - public function isVeryVerbose(): bool - { - return $this->output->isVeryVerbose(); - } - - public function isDebug(): bool - { - return $this->output->isDebug(); - } - - /** - * @return OutputInterface - */ - protected function getErrorOutput() - { - if (!$this->output instanceof ConsoleOutputInterface) { - return $this->output; - } - - return $this->output->getErrorOutput(); - } -} diff --git a/tests/integration/vendor/symfony/console/Style/StyleInterface.php b/tests/integration/vendor/symfony/console/Style/StyleInterface.php deleted file mode 100644 index e25a65b..0000000 --- a/tests/integration/vendor/symfony/console/Style/StyleInterface.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Style; - -/** - * Output style helpers. - * - * @author Kevin Bond - */ -interface StyleInterface -{ - /** - * Formats a command title. - * - * @return void - */ - public function title(string $message); - - /** - * Formats a section title. - * - * @return void - */ - public function section(string $message); - - /** - * Formats a list. - * - * @return void - */ - public function listing(array $elements); - - /** - * Formats informational text. - * - * @return void - */ - public function text(string|array $message); - - /** - * Formats a success result bar. - * - * @return void - */ - public function success(string|array $message); - - /** - * Formats an error result bar. - * - * @return void - */ - public function error(string|array $message); - - /** - * Formats an warning result bar. - * - * @return void - */ - public function warning(string|array $message); - - /** - * Formats a note admonition. - * - * @return void - */ - public function note(string|array $message); - - /** - * Formats a caution admonition. - * - * @return void - */ - public function caution(string|array $message); - - /** - * Formats a table. - * - * @return void - */ - public function table(array $headers, array $rows); - - /** - * Asks a question. - */ - public function ask(string $question, string $default = null, callable $validator = null): mixed; - - /** - * Asks a question with the user input hidden. - */ - public function askHidden(string $question, callable $validator = null): mixed; - - /** - * Asks for confirmation. - */ - public function confirm(string $question, bool $default = true): bool; - - /** - * Asks a choice question. - */ - public function choice(string $question, array $choices, mixed $default = null): mixed; - - /** - * Add newline(s). - * - * @return void - */ - public function newLine(int $count = 1); - - /** - * Starts the progress output. - * - * @return void - */ - public function progressStart(int $max = 0); - - /** - * Advances the progress output X steps. - * - * @return void - */ - public function progressAdvance(int $step = 1); - - /** - * Finishes the progress output. - * - * @return void - */ - public function progressFinish(); -} diff --git a/tests/integration/vendor/symfony/console/Style/SymfonyStyle.php b/tests/integration/vendor/symfony/console/Style/SymfonyStyle.php deleted file mode 100644 index cecce6c..0000000 --- a/tests/integration/vendor/symfony/console/Style/SymfonyStyle.php +++ /dev/null @@ -1,506 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -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\OutputWrapper; -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\ConsoleOutputInterface; -use Symfony\Component\Console\Output\ConsoleSectionOutput; -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; - -/** - * Output decorator helpers for the Symfony Style Guide. - * - * @author Kevin Bond - */ -class SymfonyStyle extends OutputStyle -{ - public const MAX_LINE_LENGTH = 120; - - private InputInterface $input; - private OutputInterface $output; - private SymfonyQuestionHelper $questionHelper; - private ProgressBar $progressBar; - private int $lineLength; - private TrimmedBufferOutput $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()); - // Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not. - $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH; - $this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH); - - parent::__construct($this->output = $output); - } - - /** - * Formats a message as a block of text. - * - * @return void - */ - public function block(string|array $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true) - { - $messages = \is_array($messages) ? array_values($messages) : [$messages]; - - $this->autoPrependBlock(); - $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape)); - $this->newLine(); - } - - /** - * @return void - */ - public function title(string $message) - { - $this->autoPrependBlock(); - $this->writeln([ - sprintf('%s', OutputFormatter::escapeTrailingBackslash($message)), - sprintf('%s', str_repeat('=', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))), - ]); - $this->newLine(); - } - - /** - * @return void - */ - public function section(string $message) - { - $this->autoPrependBlock(); - $this->writeln([ - sprintf('%s', OutputFormatter::escapeTrailingBackslash($message)), - sprintf('%s', str_repeat('-', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))), - ]); - $this->newLine(); - } - - /** - * @return void - */ - public function listing(array $elements) - { - $this->autoPrependText(); - $elements = array_map(fn ($element) => sprintf(' * %s', $element), $elements); - - $this->writeln($elements); - $this->newLine(); - } - - /** - * @return void - */ - public function text(string|array $message) - { - $this->autoPrependText(); - - $messages = \is_array($message) ? array_values($message) : [$message]; - foreach ($messages as $message) { - $this->writeln(sprintf(' %s', $message)); - } - } - - /** - * Formats a command comment. - * - * @return void - */ - public function comment(string|array $message) - { - $this->block($message, null, null, ' // ', false, false); - } - - /** - * @return void - */ - public function success(string|array $message) - { - $this->block($message, 'OK', 'fg=black;bg=green', ' ', true); - } - - /** - * @return void - */ - public function error(string|array $message) - { - $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true); - } - - /** - * @return void - */ - public function warning(string|array $message) - { - $this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true); - } - - /** - * @return void - */ - public function note(string|array $message) - { - $this->block($message, 'NOTE', 'fg=yellow', ' ! '); - } - - /** - * Formats an info message. - * - * @return void - */ - public function info(string|array $message) - { - $this->block($message, 'INFO', 'fg=green', ' ', true); - } - - /** - * @return void - */ - public function caution(string|array $message) - { - $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true); - } - - /** - * @return void - */ - public function table(array $headers, array $rows) - { - $this->createTable() - ->setHeaders($headers) - ->setRows($rows) - ->render() - ; - - $this->newLine(); - } - - /** - * Formats a horizontal table. - * - * @return void - */ - public function horizontalTable(array $headers, array $rows) - { - $this->createTable() - ->setHorizontal(true) - ->setHeaders($headers) - ->setRows($rows) - ->render() - ; - - $this->newLine(); - } - - /** - * Formats a list of key/value horizontally. - * - * Each row can be one of: - * * 'A title' - * * ['key' => 'value'] - * * new TableSeparator() - * - * @return void - */ - public function definitionList(string|array|TableSeparator ...$list) - { - $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); - } - - $this->horizontalTable($headers, [$row]); - } - - public function ask(string $question, string $default = null, callable $validator = null): mixed - { - $question = new Question($question, $default); - $question->setValidator($validator); - - return $this->askQuestion($question); - } - - public function askHidden(string $question, callable $validator = null): mixed - { - $question = new Question($question); - - $question->setHidden(true); - $question->setValidator($validator); - - return $this->askQuestion($question); - } - - public function confirm(string $question, bool $default = true): bool - { - return $this->askQuestion(new ConfirmationQuestion($question, $default)); - } - - public function choice(string $question, array $choices, mixed $default = null, bool $multiSelect = false): mixed - { - if (null !== $default) { - $values = array_flip($choices); - $default = $values[$default] ?? $default; - } - - $questionChoice = new ChoiceQuestion($question, $choices, $default); - $questionChoice->setMultiselect($multiSelect); - - return $this->askQuestion($questionChoice); - } - - /** - * @return void - */ - public function progressStart(int $max = 0) - { - $this->progressBar = $this->createProgressBar($max); - $this->progressBar->start(); - } - - /** - * @return void - */ - public function progressAdvance(int $step = 1) - { - $this->getProgressBar()->advance($step); - } - - /** - * @return void - */ - public function progressFinish() - { - $this->getProgressBar()->finish(); - $this->newLine(2); - unset($this->progressBar); - } - - public function createProgressBar(int $max = 0): ProgressBar - { - $progressBar = parent::createProgressBar($max); - - if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) { - $progressBar->setEmptyBarCharacter('░'); // light shade character \u2591 - $progressBar->setProgressCharacter(''); - $progressBar->setBarCharacter('▓'); // dark shade character \u2593 - } - - return $progressBar; - } - - /** - * @see ProgressBar::iterate() - */ - public function progressIterate(iterable $iterable, int $max = null): iterable - { - yield from $this->createProgressBar()->iterate($iterable, $max); - - $this->newLine(2); - } - - public function askQuestion(Question $question): mixed - { - if ($this->input->isInteractive()) { - $this->autoPrependBlock(); - } - - $this->questionHelper ??= new SymfonyQuestionHelper(); - - $answer = $this->questionHelper->ask($this->input, $this, $question); - - if ($this->input->isInteractive()) { - if ($this->output instanceof ConsoleSectionOutput) { - // add the new line of the `return` to submit the input to ConsoleSectionOutput, because ConsoleSectionOutput is holding all it's lines. - // this is relevant when a `ConsoleSectionOutput::clear` is called. - $this->output->addNewLineOfInputSubmit(); - } - $this->newLine(); - $this->bufferedOutput->write("\n"); - } - - return $answer; - } - - /** - * @return void - */ - public function writeln(string|iterable $messages, int $type = self::OUTPUT_NORMAL) - { - if (!is_iterable($messages)) { - $messages = [$messages]; - } - - foreach ($messages as $message) { - parent::writeln($message, $type); - $this->writeBuffer($message, true, $type); - } - } - - /** - * @return void - */ - public function write(string|iterable $messages, bool $newline = false, int $type = self::OUTPUT_NORMAL) - { - if (!is_iterable($messages)) { - $messages = [$messages]; - } - - foreach ($messages as $message) { - parent::write($message, $newline, $type); - $this->writeBuffer($message, $newline, $type); - } - } - - /** - * @return void - */ - public function newLine(int $count = 1) - { - parent::newLine($count); - $this->bufferedOutput->write(str_repeat("\n", $count)); - } - - /** - * Returns a new instance which makes use of stderr if available. - */ - public function getErrorStyle(): self - { - return new self($this->input, $this->getErrorOutput()); - } - - public function createTable(): Table - { - $output = $this->output instanceof ConsoleOutputInterface ? $this->output->section() : $this->output; - $style = clone Table::getStyleDefinition('symfony-style-guide'); - $style->setCellHeaderFormat('%s'); - - return (new Table($output))->setStyle($style); - } - - private function getProgressBar(): ProgressBar - { - return $this->progressBar - ?? throw new RuntimeException('The ProgressBar is not started.'); - } - - private function autoPrependBlock(): void - { - $chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2); - - if (!isset($chars[0])) { - $this->newLine(); // empty history, so we should start with a new line. - - return; - } - // Prepend new line for each non LF chars (This means no blank line was output before) - $this->newLine(2 - substr_count($chars, "\n")); - } - - private function autoPrependText(): void - { - $fetched = $this->bufferedOutput->fetch(); - // Prepend new line if last char isn't EOL: - if ($fetched && !str_ends_with($fetched, "\n")) { - $this->newLine(); - } - } - - private function writeBuffer(string $message, bool $newLine, int $type): void - { - // We need to know if the last chars are PHP_EOL - $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::width(Helper::removeDecoration($this->getFormatter(), $prefix)); - $lines = []; - - if (null !== $type) { - $type = sprintf('[%s] ', $type); - $indentLength = Helper::width($type); - $lineIndentation = str_repeat(' ', $indentLength); - } - - // wrap and add newlines for each element - $outputWrapper = new OutputWrapper(); - foreach ($messages as $key => $message) { - if ($escape) { - $message = OutputFormatter::escape($message); - } - - $lines = array_merge( - $lines, - explode(\PHP_EOL, $outputWrapper->wrap( - $message, - $this->lineLength - $prefixLength - $indentLength, - \PHP_EOL - )) - ); - - 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::width(Helper::removeDecoration($this->getFormatter(), $line)), 0)); - - if ($style) { - $line = sprintf('<%s>%s', $style, $line); - } - } - - return $lines; - } -} diff --git a/tests/integration/vendor/symfony/console/Terminal.php b/tests/integration/vendor/symfony/console/Terminal.php deleted file mode 100644 index 3eda037..0000000 --- a/tests/integration/vendor/symfony/console/Terminal.php +++ /dev/null @@ -1,236 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console; - -use Symfony\Component\Console\Output\AnsiColorMode; - -class Terminal -{ - public const DEFAULT_COLOR_MODE = AnsiColorMode::Ansi4; - - private static ?AnsiColorMode $colorMode = null; - private static ?int $width = null; - private static ?int $height = null; - private static ?bool $stty = null; - - /** - * About Ansi color types: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors - * For more information about true color support with terminals https://github.com/termstandard/colors/. - */ - public static function getColorMode(): AnsiColorMode - { - // Use Cache from previous run (or user forced mode) - if (null !== self::$colorMode) { - return self::$colorMode; - } - - // Try with $COLORTERM first - if (\is_string($colorterm = getenv('COLORTERM'))) { - $colorterm = strtolower($colorterm); - - if (str_contains($colorterm, 'truecolor')) { - self::setColorMode(AnsiColorMode::Ansi24); - - return self::$colorMode; - } - - if (str_contains($colorterm, '256color')) { - self::setColorMode(AnsiColorMode::Ansi8); - - return self::$colorMode; - } - } - - // Try with $TERM - if (\is_string($term = getenv('TERM'))) { - $term = strtolower($term); - - if (str_contains($term, 'truecolor')) { - self::setColorMode(AnsiColorMode::Ansi24); - - return self::$colorMode; - } - - if (str_contains($term, '256color')) { - self::setColorMode(AnsiColorMode::Ansi8); - - return self::$colorMode; - } - } - - self::setColorMode(self::DEFAULT_COLOR_MODE); - - return self::$colorMode; - } - - /** - * Force a terminal color mode rendering. - */ - public static function setColorMode(?AnsiColorMode $colorMode): void - { - self::$colorMode = $colorMode; - } - - /** - * Gets the terminal width. - */ - public function getWidth(): int - { - $width = getenv('COLUMNS'); - if (false !== $width) { - return (int) trim($width); - } - - if (null === self::$width) { - self::initDimensions(); - } - - return self::$width ?: 80; - } - - /** - * Gets the terminal height. - */ - public function getHeight(): int - { - $height = getenv('LINES'); - if (false !== $height) { - return (int) trim($height); - } - - if (null === self::$height) { - self::initDimensions(); - } - - return self::$height ?: 50; - } - - /** - * @internal - */ - public static function hasSttyAvailable(): bool - { - if (null !== self::$stty) { - return self::$stty; - } - - // skip check if shell_exec function is disabled - if (!\function_exists('shell_exec')) { - return false; - } - - return self::$stty = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null')); - } - - private static function initDimensions(): void - { - if ('\\' === \DIRECTORY_SEPARATOR) { - $ansicon = getenv('ANSICON'); - if (false !== $ansicon && preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim($ansicon), $matches)) { - // extract [w, H] from "wxh (WxH)" - // or [w, h] from "wxh" - self::$width = (int) $matches[1]; - self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2]; - } elseif (!self::hasVt100Support() && self::hasSttyAvailable()) { - // only use stty on Windows if the terminal does not support vt100 (e.g. Windows 7 + git-bash) - // testing for stty in a Windows 10 vt100-enabled console will implicitly disable vt100 support on STDOUT - self::initDimensionsUsingStty(); - } elseif (null !== $dimensions = self::getConsoleMode()) { - // extract [w, h] from "wxh" - self::$width = (int) $dimensions[0]; - self::$height = (int) $dimensions[1]; - } - } else { - self::initDimensionsUsingStty(); - } - } - - /** - * Returns whether STDOUT has vt100 support (some Windows 10+ configurations). - */ - private static function hasVt100Support(): bool - { - return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w')); - } - - /** - * Initializes dimensions using the output of an stty columns line. - */ - private static function initDimensionsUsingStty(): void - { - if ($sttyString = self::getSttyColumns()) { - if (preg_match('/rows.(\d+);.columns.(\d+);/is', $sttyString, $matches)) { - // extract [w, h] from "rows h; columns w;" - self::$width = (int) $matches[2]; - self::$height = (int) $matches[1]; - } elseif (preg_match('/;.(\d+).rows;.(\d+).columns/is', $sttyString, $matches)) { - // extract [w, h] from "; h rows; w columns" - self::$width = (int) $matches[2]; - self::$height = (int) $matches[1]; - } - } - } - - /** - * Runs and parses mode CON if it's available, suppressing any error output. - * - * @return int[]|null An array composed of the width and the height or null if it could not be parsed - */ - 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]]; - } - - /** - * Runs and parses stty -a if it's available, suppressing any error output. - */ - private static function getSttyColumns(): ?string - { - return self::readFromProcess(['stty', '-a']); - } - - private static function readFromProcess(string|array $command): ?string - { - if (!\function_exists('proc_open')) { - return null; - } - - $descriptorspec = [ - 1 => ['pipe', 'w'], - 2 => ['pipe', 'w'], - ]; - - $cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0; - - $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); - - if ($cp) { - sapi_windows_cp_set($cp); - } - - return $info; - } -} diff --git a/tests/integration/vendor/symfony/console/Tester/ApplicationTester.php b/tests/integration/vendor/symfony/console/Tester/ApplicationTester.php deleted file mode 100644 index 58aee54..0000000 --- a/tests/integration/vendor/symfony/console/Tester/ApplicationTester.php +++ /dev/null @@ -1,85 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tester; - -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Input\ArrayInput; - -/** - * Eases the testing of console applications. - * - * When testing an application, don't forget to disable the auto exit flag: - * - * $application = new Application(); - * $application->setAutoExit(false); - * - * @author Fabien Potencier - */ -class ApplicationTester -{ - use TesterTrait; - - private Application $application; - - public function __construct(Application $application) - { - $this->application = $application; - } - - /** - * Executes the application. - * - * Available options: - * - * * interactive: Sets the input interactive flag - * * decorated: Sets the output decorated flag - * * verbosity: Sets the output verbosity flag - * * capture_stderr_separately: Make output of stdOut and stdErr separately available - * - * @return int The command exit code - */ - public function run(array $input, array $options = []): int - { - $prevShellVerbosity = getenv('SHELL_VERBOSITY'); - - try { - $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); - } finally { - // SHELL_VERBOSITY is set by Application::configureIO so we need to unset/reset it - // to its previous value to avoid one test's verbosity to spread to the following tests - if (false === $prevShellVerbosity) { - if (\function_exists('putenv')) { - @putenv('SHELL_VERBOSITY'); - } - unset($_ENV['SHELL_VERBOSITY']); - unset($_SERVER['SHELL_VERBOSITY']); - } else { - if (\function_exists('putenv')) { - @putenv('SHELL_VERBOSITY='.$prevShellVerbosity); - } - $_ENV['SHELL_VERBOSITY'] = $prevShellVerbosity; - $_SERVER['SHELL_VERBOSITY'] = $prevShellVerbosity; - } - } - } -} diff --git a/tests/integration/vendor/symfony/console/Tester/CommandTester.php b/tests/integration/vendor/symfony/console/Tester/CommandTester.php deleted file mode 100644 index 2ff813b..0000000 --- a/tests/integration/vendor/symfony/console/Tester/CommandTester.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Tester; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\ArrayInput; - -/** - * Eases the testing of console commands. - * - * @author Fabien Potencier - * @author Robin Chalas - */ -class CommandTester -{ - use TesterTrait; - - private Command $command; - - public function __construct(Command $command) - { - $this->command = $command; - } - - /** - * Executes the command. - * - * Available execution options: - * - * * interactive: Sets the input interactive flag - * * decorated: Sets the output decorated flag - * * verbosity: Sets the output verbosity flag - * * capture_stderr_separately: Make output of stdOut and stdErr separately available - * - * @param array $input An array of command arguments and options - * @param array $options An array of execution options - * - * @return int The command exit code - */ - public function execute(array $input, array $options = []): int - { - // set the command name automatically if the application requires - // this argument and no command name was passed - 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); - // Use an in-memory input stream even if no inputs are set so that QuestionHelper::ask() does not rely on the blocking STDIN. - $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); - } -} diff --git a/tests/integration/vendor/symfony/console/composer.json b/tests/integration/vendor/symfony/console/composer.json deleted file mode 100644 index c344212..0000000 --- a/tests/integration/vendor/symfony/console/composer.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "symfony/console", - "type": "library", - "description": "Eases the creation of beautiful and testable command line interfaces", - "keywords": ["console", "cli", "command-line", "terminal"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0" - }, - "require-dev": { - "symfony/config": "^5.4|^6.0", - "symfony/event-dispatcher": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/lock": "^5.4|^6.0", - "symfony/process": "^5.4|^6.0", - "symfony/var-dumper": "^5.4|^6.0", - "psr/log": "^1|^2|^3" - }, - "provide": { - "psr/log-implementation": "1.0|2.0|3.0" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Console\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Alias.php b/tests/integration/vendor/symfony/dependency-injection/Alias.php deleted file mode 100644 index c5b91ed..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Alias.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; - -class Alias -{ - private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%alias_id%" service alias is deprecated. You should stop using it, as it will be removed in the future.'; - - private string $id; - private bool $public; - private array $deprecation = []; - - public function __construct(string $id, bool $public = false) - { - $this->id = $id; - $this->public = $public; - } - - /** - * Checks if this DI Alias should be public or not. - */ - public function isPublic(): bool - { - return $this->public; - } - - /** - * Sets if this Alias is public. - * - * @return $this - */ - public function setPublic(bool $boolean): static - { - $this->public = $boolean; - - return $this; - } - - /** - * Whether this alias is private. - */ - public function isPrivate(): bool - { - return !$this->public; - } - - /** - * Whether this alias is deprecated, that means it should not be referenced - * anymore. - * - * @param string $package The name of the composer package that is triggering the deprecation - * @param string $version The version of the package that introduced the deprecation - * @param string $message The deprecation message to use - * - * @return $this - * - * @throws InvalidArgumentException when the message template is invalid - */ - public function setDeprecated(string $package, string $version, string $message): static - { - if ('' !== $message) { - if (preg_match('#[\r\n]|\*/#', $message)) { - throw new InvalidArgumentException('Invalid characters found in deprecation template.'); - } - - if (!str_contains($message, '%alias_id%')) { - throw new InvalidArgumentException('The deprecation template must contain the "%alias_id%" placeholder.'); - } - } - - $this->deprecation = ['package' => $package, 'version' => $version, 'message' => $message ?: self::DEFAULT_DEPRECATION_TEMPLATE]; - - return $this; - } - - public function isDeprecated(): bool - { - return (bool) $this->deprecation; - } - - /** - * @param string $id Service id relying on this definition - */ - public function getDeprecation(string $id): array - { - return [ - 'package' => $this->deprecation['package'], - 'version' => $this->deprecation['version'], - 'message' => str_replace('%alias_id%', $id, $this->deprecation['message']), - ]; - } - - public function __toString(): string - { - return $this->id; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Argument/ArgumentInterface.php b/tests/integration/vendor/symfony/dependency-injection/Argument/ArgumentInterface.php deleted file mode 100644 index 3b39f36..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Argument/ArgumentInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Argument; - -/** - * Represents a complex argument containing nested values. - * - * @author Titouan Galopin - */ -interface ArgumentInterface -{ - public function getValues(): array; - - /** - * @return void - */ - public function setValues(array $values); -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Argument/IteratorArgument.php b/tests/integration/vendor/symfony/dependency-injection/Argument/IteratorArgument.php deleted file mode 100644 index aedd1e6..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Argument/IteratorArgument.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Argument; - -/** - * Represents a collection of values to lazily iterate over. - * - * @author Titouan Galopin - */ -class IteratorArgument implements ArgumentInterface -{ - private array $values; - - public function __construct(array $values) - { - $this->setValues($values); - } - - public function getValues(): array - { - return $this->values; - } - - /** - * @return void - */ - public function setValues(array $values) - { - $this->values = $values; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php b/tests/integration/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php deleted file mode 100644 index 9fee374..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Argument; - -/** - * @internal - */ -class RewindableGenerator implements \IteratorAggregate, \Countable -{ - private \Closure $generator; - private \Closure|int $count; - - public function __construct(callable $generator, int|callable $count) - { - $this->generator = $generator(...); - $this->count = \is_int($count) ? $count : $count(...); - } - - public function getIterator(): \Traversable - { - $g = $this->generator; - - return $g(); - } - - public function count(): int - { - if (!\is_int($count = $this->count)) { - $this->count = $count(); - } - - return $this->count; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php b/tests/integration/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php deleted file mode 100644 index be86412..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php +++ /dev/null @@ -1,46 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Argument; - -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; - -/** - * Represents a service wrapped in a memoizing closure. - * - * @author Nicolas Grekas - */ -class ServiceClosureArgument implements ArgumentInterface -{ - private array $values; - - public function __construct(mixed $value) - { - $this->values = [$value]; - } - - public function getValues(): array - { - return $this->values; - } - - /** - * @return void - */ - public function setValues(array $values) - { - if ([0] !== array_keys($values)) { - throw new InvalidArgumentException('A ServiceClosureArgument must hold one and only one value.'); - } - - $this->values = $values; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/CHANGELOG.md b/tests/integration/vendor/symfony/dependency-injection/CHANGELOG.md deleted file mode 100644 index b329847..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/CHANGELOG.md +++ /dev/null @@ -1,363 +0,0 @@ -CHANGELOG -========= - -6.3 ---- - - * Add options `inline_factories` and `inline_class_loader` to `PhpDumper::dump()` - * Deprecate `PhpDumper` options `inline_factories_parameter` and `inline_class_loader_parameter` - * Add `RemoveBuildParametersPass`, which removes parameters starting with a dot during compilation - * Add support for nesting autowiring-related attributes into `#[Autowire(...)]` - * Deprecate undefined and numeric keys with `service_locator` config - * Fail if Target attribute does not exist during compilation - * Enable deprecating parameters with `ContainerBuilder::deprecateParameter()` - * Add `#[AsAlias]` attribute to tell under which alias a service should be registered or to use the implemented interface if no parameter is given - * Allow to trim XML service parameters value by using `trim="true"` attribute - * Allow extending the `Autowire` attribute - * Add `#[Exclude]` to skip autoregistering a class - * Add support for generating lazy closures - * Add support for autowiring services as closures using `#[AutowireCallable]` or `#[AutowireServiceClosure]` - * Add support for `#[Autowire(lazy: true|class-string)]` - * Make it possible to cast callables into single-method interfaces - * Deprecate `#[MapDecorated]`, use `#[AutowireDecorated]` instead - * Deprecate the `@required` annotation, use the `Symfony\Contracts\Service\Attribute\Required` attribute instead - * Add `constructor` option to services declaration and to `#[Autoconfigure]` - -6.2 ---- - - * Use lazy-loading ghost objects and virtual proxies out of the box - * Add arguments `&$asGhostObject` and `$id` to LazyProxy's `DumperInterface` to allow using ghost objects for lazy loading services - * Add `enum` env var processor - * Add `shuffle` env var processor - * Allow #[When] to be extended - * Change the signature of `ContainerAwareInterface::setContainer()` to `setContainer(?ContainerInterface)` - * Deprecate calling `ContainerAwareTrait::setContainer()` without arguments - * Deprecate using numeric parameter names - * Add support for tagged iterators/locators `exclude` option to the xml and yaml loaders/dumpers - * Allow injecting `string $env` into php config closures - * Add `excludeSelf` parameter to `TaggedIteratorArgument` with default value to `true` - to control whether the referencing service should be automatically excluded from the iterator - -6.1 ---- - - * Add `#[MapDecorated]` attribute telling to which parameter the decorated service should be mapped in a decorator - * Add `#[AsDecorator]` attribute to make a service decorates another - * Add `$exclude` to `TaggedIterator` and `TaggedLocator` attributes - * Add `$exclude` to `tagged_iterator` and `tagged_locator` configurator - * Add an `env` function to the expression language provider - * Add an `Autowire` attribute to tell a parameter how to be autowired - * Allow using expressions as service factories - * Add argument type `closure` to help passing closures to services - * Deprecate `ReferenceSetArgumentTrait` - * Add `AbstractExtension` class for DI configuration/definition on a single file - -6.0 ---- - - * Remove `Definition::setPrivate()` and `Alias::setPrivate()`, use `setPublic()` instead - * Remove `inline()` in favor of `inline_service()` and `ref()` in favor of `service()` when using the PHP-DSL - * Remove `Definition::getDeprecationMessage()`, use `Definition::getDeprecation()` instead - * Remove `Alias::getDeprecationMessage()`, use `Alias::getDeprecation()` instead - * Remove the `Psr\Container\ContainerInterface` and `Symfony\Component\DependencyInjection\ContainerInterface` aliases of the `service_container` service - -5.4 ---- - * Add `$defaultIndexMethod` and `$defaultPriorityMethod` to `TaggedIterator` and `TaggedLocator` attributes - * Add `service_closure()` to the PHP-DSL - * Add support for autoconfigurable attributes on methods, properties and parameters - * Make auto-aliases private by default - * Add support for autowiring union and intersection types - -5.3 ---- - - * Add `ServicesConfigurator::remove()` in the PHP-DSL - * Add `%env(not:...)%` processor to negate boolean values - * Add support for loading autoconfiguration rules via the `#[Autoconfigure]` and `#[AutoconfigureTag]` attributes on PHP 8 - * Add `#[AsTaggedItem]` attribute for defining the index and priority of classes found in tagged iterators/locators - * Add autoconfigurable attributes - * Add support for autowiring tagged iterators and locators via attributes on PHP 8 - * Add support for per-env configuration in XML and Yaml loaders - * Add `ContainerBuilder::willBeAvailable()` to help with conditional configuration - * Add support an integer return value for default_index_method - * Add `#[When(env: 'foo')]` to skip autoregistering a class when the env doesn't match - * Add `env()` and `EnvConfigurator` in the PHP-DSL - * Add support for `ConfigBuilder` in the `PhpFileLoader` - * Add `ContainerConfigurator::env()` to get the current environment - * Add `#[Target]` to tell how a dependency is used and hint named autowiring aliases - -5.2.0 ------ - - * added `param()` and `abstract_arg()` in the PHP-DSL - * deprecated `Definition::setPrivate()` and `Alias::setPrivate()`, use `setPublic()` instead - * added support for the `#[Required]` attribute - -5.1.0 ------ - - * deprecated `inline()` in favor of `inline_service()` and `ref()` in favor of `service()` when using the PHP-DSL - * allow decorators to reference their decorated service using the special `.inner` id - * added support to autowire public typed properties in php 7.4 - * added support for defining method calls, a configurator, and property setters in `InlineServiceConfigurator` - * added possibility to define abstract service arguments - * allowed mixing "parent" and instanceof-conditionals/defaults/bindings - * updated the signature of method `Definition::setDeprecated()` to `Definition::setDeprecation(string $package, string $version, string $message)` - * updated the signature of method `Alias::setDeprecated()` to `Alias::setDeprecation(string $package, string $version, string $message)` - * updated the signature of method `DeprecateTrait::deprecate()` to `DeprecateTrait::deprecation(string $package, string $version, string $message)` - * deprecated the `Psr\Container\ContainerInterface` and `Symfony\Component\DependencyInjection\ContainerInterface` aliases of the `service_container` service, - configure them explicitly instead - * added class `Symfony\Component\DependencyInjection\Dumper\Preloader` to help with preloading on PHP 7.4+ - * added tags `container.preload`/`.no_preload` to declare extra classes to preload/services to not preload - * allowed loading and dumping tags with an attribute named "name" - * deprecated `Definition::getDeprecationMessage()`, use `Definition::getDeprecation()` instead - * deprecated `Alias::getDeprecationMessage()`, use `Alias::getDeprecation()` instead - * added support of PHP8 static return type for withers - * added `AliasDeprecatedPublicServicesPass` to deprecate public services to private - -5.0.0 ------ - - * removed support for auto-discovered extension configuration class which does not implement `ConfigurationInterface` - * removed support for non-string default env() parameters - * moved `ServiceSubscriberInterface` to the `Symfony\Contracts\Service` namespace - * removed `RepeatedPass` and `RepeatablePassInterface` - * removed support for short factory/configurator syntax from `YamlFileLoader` - * removed `ResettableContainerInterface`, use `ResetInterface` instead - * added argument `$returnsClone` to `Definition::addMethodCall()` - * removed `tagged`, use `tagged_iterator` instead - -4.4.0 ------ - - * added `CheckTypeDeclarationsPass` to check injected parameters type during compilation - * added support for opcache.preload by generating a preloading script in the cache folder - * added support for dumping the container in one file instead of many files - * deprecated support for short factories and short configurators in Yaml - * added `tagged_iterator` alias for `tagged` which might be deprecated in a future version - * deprecated passing an instance of `Symfony\Component\DependencyInjection\Parameter` as class name to `Symfony\Component\DependencyInjection\Definition` - * added support for binding iterable and tagged services - * made singly-implemented interfaces detection be scoped by file - * added ability to define a static priority method for tagged service - * added support for improved syntax to define method calls in Yaml - * made the `%env(base64:...)%` processor able to decode base64url - * added ability to choose behavior of decorations on non existent decorated services - -4.3.0 ------ - - * added `%env(trim:...)%` processor to trim a string value - * added `%env(default:param_name:...)%` processor to fallback to a parameter or to null when using `%env(default::...)%` - * added `%env(url:...)%` processor to convert a URL or DNS into an array of components - * added `%env(query_string:...)%` processor to convert a query string into an array of key values - * added support for deprecating aliases - * made `ContainerParametersResource` final and not implement `Serializable` anymore - * added `ReverseContainer`: a container that turns services back to their ids - * added ability to define an index for a tagged collection - * added ability to define an index for services in an injected service locator argument - * made `ServiceLocator` implement `ServiceProviderInterface` - * deprecated support for non-string default env() parameters - * added `%env(require:...)%` processor to `require()` a PHP file and use the value returned from it - -4.2.0 ------ - - * added `ContainerBuilder::registerAliasForArgument()` to support autowiring by type+name - * added support for binding by type+name - * added `ServiceSubscriberTrait` to ease implementing `ServiceSubscriberInterface` using methods' return types - * added `ServiceLocatorArgument` and `!service_locator` config tag for creating optimized service-locators - * added support for autoconfiguring bindings - * added `%env(key:...)%` processor to fetch a specific key from an array - * deprecated `ServiceSubscriberInterface`, use the same interface from the `Symfony\Contracts\Service` namespace instead - * deprecated `ResettableContainerInterface`, use `Symfony\Contracts\Service\ResetInterface` instead - -4.1.0 ------ - - * added support for variadics in named arguments - * added PSR-11 `ContainerBagInterface` and its `ContainerBag` implementation to access parameters as-a-service - * added support for service's decorators autowiring - * deprecated the `TypedReference::canBeAutoregistered()` and `TypedReference::getRequiringClass()` methods - * environment variables are validated when used in extension configuration - * deprecated support for auto-discovered extension configuration class which does not implement `ConfigurationInterface` - -4.0.0 ------ - - * Relying on service auto-registration while autowiring is not supported anymore. - Explicitly inject your dependencies or create services whose ids are - their fully-qualified class name. - - Before: - - ```php - namespace App\Controller; - - use App\Mailer; - - class DefaultController - { - public function __construct(Mailer $mailer) { - // ... - } - - // ... - } - ``` - ```yml - services: - App\Controller\DefaultController: - autowire: true - ``` - - After: - - ```php - // same PHP code - ``` - ```yml - services: - App\Controller\DefaultController: - autowire: true - - # or - # App\Controller\DefaultController: - # arguments: { $mailer: "@App\Mailer" } - - App\Mailer: - autowire: true - ``` - * removed autowiring services based on the types they implement - * added a third `$methodName` argument to the `getProxyFactoryCode()` method - of the `DumperInterface` - * removed support for autowiring types - * removed `Container::isFrozen` - * removed support for dumping an ucompiled container in `PhpDumper` - * removed support for generating a dumped `Container` without populating the method map - * removed support for case insensitive service identifiers - * removed the `DefinitionDecorator` class, replaced by `ChildDefinition` - * removed the `AutowireServiceResource` class and related `AutowirePass::createResourceForClass()` method - * removed `LoggingFormatter`, `Compiler::getLoggingFormatter()` and `addLogMessage()` class and methods, use the `ContainerBuilder::log()` method instead - * removed `FactoryReturnTypePass` - * removed `ContainerBuilder::addClassResource()`, use the `addObjectResource()` or the `getReflectionClass()` method instead. - * removed support for top-level anonymous services - * removed silent behavior for unused attributes and elements - * removed support for setting and accessing private services in `Container` - * removed support for setting pre-defined services in `Container` - * removed support for case insensitivity of parameter names - * removed `AutowireExceptionPass` and `AutowirePass::getAutowiringExceptions()`, use `Definition::addError()` and the `DefinitionErrorExceptionPass` instead - -3.4.0 ------ - - * moved the `ExtensionCompilerPass` to before-optimization passes with priority -1000 - * deprecated "public-by-default" definitions and aliases, the new default will be "private" in 4.0 - * added `EnvVarProcessorInterface` and corresponding "container.env_var_processor" tag for processing env vars - * added support for ignore-on-uninitialized references - * deprecated service auto-registration while autowiring - * deprecated the ability to check for the initialization of a private service with the `Container::initialized()` method - * deprecated support for top-level anonymous services in XML - * deprecated case insensitivity of parameter names - * deprecated the `ResolveDefinitionTemplatesPass` class in favor of `ResolveChildDefinitionsPass` - * added `TaggedIteratorArgument` with YAML (`!tagged foo`) and XML (``) support - * deprecated `AutowireExceptionPass` and `AutowirePass::getAutowiringExceptions()`, use `Definition::addError()` and the `DefinitionErrorExceptionPass` instead - -3.3.0 ------ - - * deprecated autowiring services based on the types they implement; - rename (or alias) your services to their FQCN id to make them autowirable - * added "ServiceSubscriberInterface" - to allow for per-class explicit service-locator definitions - * added "container.service_locator" tag for defining service-locator services - * added anonymous services support in YAML configuration files using the `!service` tag. - * added "TypedReference" and "ServiceClosureArgument" for creating service-locator services - * added `ServiceLocator` - a PSR-11 container holding a set of services to be lazily loaded - * added "instanceof" section for local interface-defined configs - * added prototype services for PSR4-based discovery and registration - * added `ContainerBuilder::getReflectionClass()` for retrieving and tracking reflection class info - * deprecated `ContainerBuilder::getClassResource()`, use `ContainerBuilder::getReflectionClass()` or `ContainerBuilder::addObjectResource()` instead - * added `ContainerBuilder::fileExists()` for checking and tracking file or directory existence - * deprecated autowiring-types, use aliases instead - * added support for omitting the factory class name in a service definition if the definition class is set - * deprecated case insensitivity of service identifiers - * added "iterator" argument type for lazy iteration over a set of values and services - * added file-wide configurable defaults for service attributes "public", "tags", - "autowire" and "autoconfigure" - * made the "class" attribute optional, using the "id" as fallback - * using the `PhpDumper` with an uncompiled `ContainerBuilder` is deprecated and - will not be supported anymore in 4.0 - * deprecated the `DefinitionDecorator` class in favor of `ChildDefinition` - * allow config files to be loaded using a glob pattern - * [BC BREAK] the `NullDumper` class is now final - -3.2.0 ------ - - * allowed to prioritize compiler passes by introducing a third argument to `PassConfig::addPass()`, to `Compiler::addPass` and to `ContainerBuilder::addCompilerPass()` - * added support for PHP constants in YAML configuration files - * deprecated the ability to set or unset a private service with the `Container::set()` method - * deprecated the ability to check for the existence of a private service with the `Container::has()` method - * deprecated the ability to request a private service with the `Container::get()` method - * deprecated support for generating a dumped `Container` without populating the method map - -3.0.0 ------ - - * removed all deprecated codes from 2.x versions - -2.8.0 ------ - - * deprecated the abstract ContainerAware class in favor of ContainerAwareTrait - * deprecated IntrospectableContainerInterface, to be merged with ContainerInterface in 3.0 - * allowed specifying a directory to recursively load all configuration files it contains - * deprecated the concept of scopes - * added `Definition::setShared()` and `Definition::isShared()` - * added ResettableContainerInterface to be able to reset the container to release memory on shutdown - * added a way to define the priority of service decoration - * added support for service autowiring - -2.7.0 ------ - - * deprecated synchronized services - -2.6.0 ------ - - * added new factory syntax and deprecated the old one - -2.5.0 ------ - - * added DecoratorServicePass and a way to override a service definition (Definition::setDecoratedService()) - * deprecated SimpleXMLElement class. - -2.4.0 ------ - - * added support for expressions in service definitions - * added ContainerAwareTrait to add default container aware behavior to a class - -2.2.0 ------ - - * added Extension::isConfigEnabled() to ease working with enableable configurations - * added an Extension base class with sensible defaults to be used in conjunction - with the Config component. - * added PrependExtensionInterface (to be able to allow extensions to prepend - application configuration settings for any Bundle) - -2.1.0 ------ - - * added IntrospectableContainerInterface (to be able to check if a service - has been initialized or not) - * added ConfigurationExtensionInterface - * added Definition::clearTag() - * component exceptions that inherit base SPL classes are now used exclusively - (this includes dumped containers) - * [BC BREAK] fixed unescaping of class arguments, method - ParameterBag::unescapeValue() was made public diff --git a/tests/integration/vendor/symfony/dependency-injection/ChildDefinition.php b/tests/integration/vendor/symfony/dependency-injection/ChildDefinition.php deleted file mode 100644 index c5905a4..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ChildDefinition.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException; - -/** - * This definition extends another definition. - * - * @author Johannes M. Schmitt - */ -class ChildDefinition extends Definition -{ - private string $parent; - - /** - * @param string $parent The id of Definition instance to decorate - */ - public function __construct(string $parent) - { - $this->parent = $parent; - } - - /** - * Returns the Definition to inherit from. - */ - public function getParent(): string - { - return $this->parent; - } - - /** - * Sets the Definition to inherit from. - * - * @return $this - */ - public function setParent(string $parent): static - { - $this->parent = $parent; - - return $this; - } - - /** - * Gets an argument to pass to the service constructor/factory method. - * - * If replaceArgument() has been used to replace an argument, this method - * will return the replacement value. - * - * @throws OutOfBoundsException When the argument does not exist - */ - public function getArgument(int|string $index): mixed - { - if (\array_key_exists('index_'.$index, $this->arguments)) { - return $this->arguments['index_'.$index]; - } - - return parent::getArgument($index); - } - - /** - * You should always use this method when overwriting existing arguments - * of the parent definition. - * - * If you directly call setArguments() keep in mind that you must follow - * certain conventions when you want to overwrite the arguments of the - * parent definition, otherwise your arguments will only be appended. - * - * @return $this - * - * @throws InvalidArgumentException when $index isn't an integer - */ - public function replaceArgument(int|string $index, mixed $value): static - { - if (\is_int($index)) { - $this->arguments['index_'.$index] = $value; - } elseif (str_starts_with($index, '$')) { - $this->arguments[$index] = $value; - } else { - throw new InvalidArgumentException('The argument must be an existing index or the name of a constructor\'s parameter.'); - } - - return $this; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php deleted file mode 100644 index 95251de..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php +++ /dev/null @@ -1,255 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; -use Symfony\Component\DependencyInjection\ChildDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\ExpressionLanguage; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\ExpressionLanguage\Expression; - -/** - * @author Nicolas Grekas - */ -abstract class AbstractRecursivePass implements CompilerPassInterface -{ - /** - * @var ContainerBuilder - */ - protected $container; - protected $currentId; - - private bool $processExpressions = false; - private ExpressionLanguage $expressionLanguage; - private bool $inExpression = false; - - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - $this->container = $container; - - try { - $this->processValue($container->getDefinitions(), true); - } finally { - $this->container = null; - } - } - - /** - * @return void - */ - protected function enableExpressionProcessing() - { - $this->processExpressions = true; - } - - protected function inExpression(bool $reset = true): bool - { - $inExpression = $this->inExpression; - if ($reset) { - $this->inExpression = false; - } - - return $inExpression; - } - - /** - * Processes a value found in a definition tree. - * - * @return mixed - */ - protected function processValue(mixed $value, bool $isRoot = false) - { - if (\is_array($value)) { - foreach ($value as $k => $v) { - if ($isRoot) { - if ($v->hasTag('container.excluded')) { - continue; - } - $this->currentId = $k; - } - if ($v !== $processedValue = $this->processValue($v, $isRoot)) { - $value[$k] = $processedValue; - } - } - } elseif ($value instanceof ArgumentInterface) { - $value->setValues($this->processValue($value->getValues())); - } elseif ($value instanceof Expression && $this->processExpressions) { - $this->getExpressionLanguage()->compile((string) $value, ['this' => 'container', 'args' => 'args']); - } elseif ($value instanceof Definition) { - $value->setArguments($this->processValue($value->getArguments())); - $value->setProperties($this->processValue($value->getProperties())); - $value->setMethodCalls($this->processValue($value->getMethodCalls())); - - $changes = $value->getChanges(); - if (isset($changes['factory'])) { - if (\is_string($factory = $value->getFactory()) && str_starts_with($factory, '@=')) { - if (!class_exists(Expression::class)) { - throw new LogicException('Expressions cannot be used in service factories without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); - } - $factory = new Expression(substr($factory, 2)); - } - if (($factory = $this->processValue($factory)) instanceof Expression) { - $factory = '@='.$factory; - } - $value->setFactory($factory); - } - if (isset($changes['configurator'])) { - $value->setConfigurator($this->processValue($value->getConfigurator())); - } - } - - return $value; - } - - /** - * @throws RuntimeException - */ - protected function getConstructor(Definition $definition, bool $required): ?\ReflectionFunctionAbstract - { - if ($definition->isSynthetic()) { - return null; - } - - if (\is_string($factory = $definition->getFactory())) { - if (str_starts_with($factory, '@=')) { - return new \ReflectionFunction(static function (...$args) {}); - } - - if (!\function_exists($factory)) { - throw new RuntimeException(sprintf('Invalid service "%s": function "%s" does not exist.', $this->currentId, $factory)); - } - $r = new \ReflectionFunction($factory); - if (false !== $r->getFileName() && file_exists($r->getFileName())) { - $this->container->fileExists($r->getFileName()); - } - - return $r; - } - - if ($factory) { - [$class, $method] = $factory; - - if ('__construct' === $method) { - throw new RuntimeException(sprintf('Invalid service "%s": "__construct()" cannot be used as a factory method.', $this->currentId)); - } - - if ($class instanceof Reference) { - $factoryDefinition = $this->container->findDefinition((string) $class); - while ((null === $class = $factoryDefinition->getClass()) && $factoryDefinition instanceof ChildDefinition) { - $factoryDefinition = $this->container->findDefinition($factoryDefinition->getParent()); - } - } elseif ($class instanceof Definition) { - $class = $class->getClass(); - } else { - $class ??= $definition->getClass(); - } - - return $this->getReflectionMethod(new Definition($class), $method); - } - - while ((null === $class = $definition->getClass()) && $definition instanceof ChildDefinition) { - $definition = $this->container->findDefinition($definition->getParent()); - } - - try { - if (!$r = $this->container->getReflectionClass($class)) { - if (null === $class) { - throw new RuntimeException(sprintf('Invalid service "%s": the class is not set.', $this->currentId)); - } - - throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class)); - } - } catch (\ReflectionException $e) { - throw new RuntimeException(sprintf('Invalid service "%s": ', $this->currentId).lcfirst($e->getMessage())); - } - if (!$r = $r->getConstructor()) { - if ($required) { - throw new RuntimeException(sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, sprintf($class !== $this->currentId ? ' "%s"' : '', $class))); - } - } elseif (!$r->isPublic()) { - throw new RuntimeException(sprintf('Invalid service "%s": ', $this->currentId).sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class).' must be public.'); - } - - return $r; - } - - /** - * @throws RuntimeException - */ - protected function getReflectionMethod(Definition $definition, string $method): \ReflectionFunctionAbstract - { - if ('__construct' === $method) { - return $this->getConstructor($definition, true); - } - - while ((null === $class = $definition->getClass()) && $definition instanceof ChildDefinition) { - $definition = $this->container->findDefinition($definition->getParent()); - } - - if (null === $class) { - throw new RuntimeException(sprintf('Invalid service "%s": the class is not set.', $this->currentId)); - } - - if (!$r = $this->container->getReflectionClass($class)) { - throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class)); - } - - if (!$r->hasMethod($method)) { - if ($r->hasMethod('__call') && ($r = $r->getMethod('__call')) && $r->isPublic()) { - return new \ReflectionMethod(static function (...$arguments) {}, '__invoke'); - } - - throw new RuntimeException(sprintf('Invalid service "%s": method "%s()" does not exist.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method)); - } - - $r = $r->getMethod($method); - if (!$r->isPublic()) { - throw new RuntimeException(sprintf('Invalid service "%s": method "%s()" must be public.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method)); - } - - return $r; - } - - private function getExpressionLanguage(): ExpressionLanguage - { - if (!isset($this->expressionLanguage)) { - if (!class_exists(ExpressionLanguage::class)) { - throw new LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed. Try running "composer require symfony/expression-language".'); - } - - $providers = $this->container->getExpressionLanguageProviders(); - $this->expressionLanguage = new ExpressionLanguage(null, $providers, function (string $arg): string { - if ('""' === substr_replace($arg, '', 1, -1)) { - $id = stripcslashes(substr($arg, 1, -1)); - $this->inExpression = true; - $arg = $this->processValue(new Reference($id)); - $this->inExpression = false; - if (!$arg instanceof Reference) { - throw new RuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, "%s" returned for service("%s").', static::class, get_debug_type($arg), $id)); - } - $arg = sprintf('"%s"', $arg); - } - - return sprintf('$this->get(%s)', $arg); - }); - } - - return $this->expressionLanguage; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php deleted file mode 100644 index de033d9..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php +++ /dev/null @@ -1,203 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\ExpressionLanguage\Expression; - -/** - * Run this pass before passes that need to know more about the relation of - * your services. - * - * This class will populate the ServiceReferenceGraph with information. You can - * retrieve the graph in other passes from the compiler. - * - * @author Johannes M. Schmitt - * @author Nicolas Grekas - */ -class AnalyzeServiceReferencesPass extends AbstractRecursivePass -{ - private ServiceReferenceGraph $graph; - private ?Definition $currentDefinition = null; - private bool $onlyConstructorArguments; - private bool $hasProxyDumper; - private bool $lazy; - private bool $byConstructor; - private bool $byFactory; - private array $definitions; - private array $aliases; - - /** - * @param bool $onlyConstructorArguments Sets this Service Reference pass to ignore method calls - */ - public function __construct(bool $onlyConstructorArguments = false, bool $hasProxyDumper = true) - { - $this->onlyConstructorArguments = $onlyConstructorArguments; - $this->hasProxyDumper = $hasProxyDumper; - $this->enableExpressionProcessing(); - } - - /** - * Processes a ContainerBuilder object to populate the service reference graph. - * - * @return void - */ - public function process(ContainerBuilder $container) - { - $this->container = $container; - $this->graph = $container->getCompiler()->getServiceReferenceGraph(); - $this->graph->clear(); - $this->lazy = false; - $this->byConstructor = false; - $this->byFactory = false; - $this->definitions = $container->getDefinitions(); - $this->aliases = $container->getAliases(); - - foreach ($this->aliases as $id => $alias) { - $targetId = $this->getDefinitionId((string) $alias); - $this->graph->connect($id, $alias, $targetId, null !== $targetId ? $this->container->getDefinition($targetId) : null, null); - } - - try { - parent::process($container); - } finally { - $this->aliases = $this->definitions = []; - } - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - $lazy = $this->lazy; - $inExpression = $this->inExpression(); - - if ($value instanceof ArgumentInterface) { - $this->lazy = !$this->byFactory || !$value instanceof IteratorArgument; - parent::processValue($value->getValues()); - $this->lazy = $lazy; - - return $value; - } - if ($value instanceof Reference) { - $targetId = $this->getDefinitionId((string) $value); - $targetDefinition = null !== $targetId ? $this->container->getDefinition($targetId) : null; - - $this->graph->connect( - $this->currentId, - $this->currentDefinition, - $targetId, - $targetDefinition, - $value, - $this->lazy || ($this->hasProxyDumper && $targetDefinition?->isLazy()), - ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(), - $this->byConstructor - ); - - if ($inExpression) { - $this->graph->connect( - '.internal.reference_in_expression', - null, - $targetId, - $targetDefinition, - $value, - $this->lazy || $targetDefinition?->isLazy(), - true - ); - } - - return $value; - } - if (!$value instanceof Definition) { - return parent::processValue($value, $isRoot); - } - if ($isRoot) { - if ($value->isSynthetic() || $value->isAbstract()) { - return $value; - } - $this->currentDefinition = $value; - } elseif ($this->currentDefinition === $value) { - return $value; - } - $this->lazy = false; - - $byConstructor = $this->byConstructor; - $this->byConstructor = $isRoot || $byConstructor; - - $byFactory = $this->byFactory; - $this->byFactory = true; - if (\is_string($factory = $value->getFactory()) && str_starts_with($factory, '@=')) { - if (!class_exists(Expression::class)) { - throw new LogicException('Expressions cannot be used in service factories without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); - } - - $factory = new Expression(substr($factory, 2)); - } - $this->processValue($factory); - $this->byFactory = $byFactory; - - $this->processValue($value->getArguments()); - - $properties = $value->getProperties(); - $setters = $value->getMethodCalls(); - - // Any references before a "wither" are part of the constructor-instantiation graph - $lastWitherIndex = null; - foreach ($setters as $k => $call) { - if ($call[2] ?? false) { - $lastWitherIndex = $k; - } - } - - if (null !== $lastWitherIndex) { - $this->processValue($properties); - $setters = $properties = []; - - foreach ($value->getMethodCalls() as $k => $call) { - if (null === $lastWitherIndex) { - $setters[] = $call; - continue; - } - - if ($lastWitherIndex === $k) { - $lastWitherIndex = null; - } - - $this->processValue($call); - } - } - - $this->byConstructor = $byConstructor; - - if (!$this->onlyConstructorArguments) { - $this->processValue($properties); - $this->processValue($setters); - $this->processValue($value->getConfigurator()); - } - $this->lazy = $lazy; - - return $value; - } - - private function getDefinitionId(string $id): ?string - { - while (isset($this->aliases[$id])) { - $id = (string) $this->aliases[$id]; - } - - return isset($this->definitions[$id]) ? $id : null; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/AutoAliasServicePass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/AutoAliasServicePass.php deleted file mode 100644 index 3f070dc..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/AutoAliasServicePass.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; - -/** - * Sets a service to be an alias of another one, given a format pattern. - */ -class AutoAliasServicePass implements CompilerPassInterface -{ - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - foreach ($container->findTaggedServiceIds('auto_alias') as $serviceId => $tags) { - foreach ($tags as $tag) { - if (!isset($tag['format'])) { - throw new InvalidArgumentException(sprintf('Missing tag information "format" on auto_alias service "%s".', $serviceId)); - } - - $aliasId = $container->getParameterBag()->resolveValue($tag['format']); - if ($container->hasDefinition($aliasId) || $container->hasAlias($aliasId)) { - $alias = new Alias($aliasId, $container->getDefinition($serviceId)->isPublic()); - $container->setAlias($serviceId, $alias); - } - } - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/AutowirePass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/AutowirePass.php deleted file mode 100644 index f84a7fa..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/AutowirePass.php +++ /dev/null @@ -1,717 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\Config\Resource\ClassExistenceResource; -use Symfony\Component\DependencyInjection\Attribute\Autowire; -use Symfony\Component\DependencyInjection\Attribute\AutowireCallable; -use Symfony\Component\DependencyInjection\Attribute\AutowireDecorated; -use Symfony\Component\DependencyInjection\Attribute\MapDecorated; -use Symfony\Component\DependencyInjection\Attribute\Target; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\AutowiringFailedException; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\TypedReference; -use Symfony\Component\VarExporter\ProxyHelper; - -/** - * Inspects existing service definitions and wires the autowired ones using the type hints of their classes. - * - * @author Kévin Dunglas - * @author Nicolas Grekas - */ -class AutowirePass extends AbstractRecursivePass -{ - private array $types; - private array $ambiguousServiceTypes; - private array $autowiringAliases; - private ?string $lastFailure = null; - private bool $throwOnAutowiringException; - private ?string $decoratedClass = null; - private ?string $decoratedId = null; - private ?array $methodCalls = null; - private object $defaultArgument; - private ?\Closure $getPreviousValue = null; - private ?int $decoratedMethodIndex = null; - private ?int $decoratedMethodArgumentIndex = null; - private ?self $typesClone = null; - - public function __construct(bool $throwOnAutowireException = true) - { - $this->throwOnAutowiringException = $throwOnAutowireException; - $this->defaultArgument = new class() { - public $value; - public $names; - public $bag; - - public function withValue(\ReflectionParameter $parameter): self - { - $clone = clone $this; - $clone->value = $this->bag->escapeValue($parameter->getDefaultValue()); - - return $clone; - } - }; - } - - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - $this->defaultArgument->bag = $container->getParameterBag(); - - try { - $this->typesClone = clone $this; - parent::process($container); - } finally { - $this->decoratedClass = null; - $this->decoratedId = null; - $this->methodCalls = null; - $this->defaultArgument->bag = null; - $this->defaultArgument->names = null; - $this->getPreviousValue = null; - $this->decoratedMethodIndex = null; - $this->decoratedMethodArgumentIndex = null; - $this->typesClone = null; - } - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof Autowire) { - return $this->processValue($this->container->getParameterBag()->resolveValue($value->value)); - } - - if ($value instanceof AutowireDecorated || $value instanceof MapDecorated) { - $definition = $this->container->getDefinition($this->currentId); - - return new Reference($definition->innerServiceId ?? $this->currentId.'.inner', $definition->decorationOnInvalid ?? ContainerInterface::NULL_ON_INVALID_REFERENCE); - } - - try { - return $this->doProcessValue($value, $isRoot); - } catch (AutowiringFailedException $e) { - if ($this->throwOnAutowiringException) { - throw $e; - } - - $this->container->getDefinition($this->currentId)->addError($e->getMessageCallback() ?? $e->getMessage()); - - return parent::processValue($value, $isRoot); - } - } - - private function doProcessValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof TypedReference) { - foreach ($value->getAttributes() as $attribute) { - if ($attribute === $v = $this->processValue($attribute)) { - continue; - } - if (!$attribute instanceof Autowire || !$v instanceof Reference) { - return $v; - } - - $invalidBehavior = ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE !== $v->getInvalidBehavior() ? $v->getInvalidBehavior() : $value->getInvalidBehavior(); - $value = $v instanceof TypedReference - ? new TypedReference($v, $v->getType(), $invalidBehavior, $v->getName() ?? $value->getName(), array_merge($v->getAttributes(), $value->getAttributes())) - : new TypedReference($v, $value->getType(), $invalidBehavior, $value->getName(), $value->getAttributes()); - break; - } - if ($ref = $this->getAutowiredReference($value, true)) { - return $ref; - } - if (ContainerBuilder::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) { - $message = $this->createTypeNotFoundMessageCallback($value, 'it'); - - // since the error message varies by referenced id and $this->currentId, so should the id of the dummy errored definition - $this->container->register($id = sprintf('.errored.%s.%s', $this->currentId, (string) $value), $value->getType()) - ->addError($message); - - return new TypedReference($id, $value->getType(), $value->getInvalidBehavior(), $value->getName()); - } - } - $value = parent::processValue($value, $isRoot); - - if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { - return $value; - } - if (!$reflectionClass = $this->container->getReflectionClass($value->getClass(), false)) { - $this->container->log($this, sprintf('Skipping service "%s": Class or interface "%s" cannot be loaded.', $this->currentId, $value->getClass())); - - return $value; - } - - $this->methodCalls = $value->getMethodCalls(); - - try { - $constructor = $this->getConstructor($value, false); - } catch (RuntimeException $e) { - throw new AutowiringFailedException($this->currentId, $e->getMessage(), 0, $e); - } - - if ($constructor) { - array_unshift($this->methodCalls, [$constructor, $value->getArguments()]); - } - - $checkAttributes = !$value->hasTag('container.ignore_attributes'); - $this->methodCalls = $this->autowireCalls($reflectionClass, $isRoot, $checkAttributes); - - if ($constructor) { - [, $arguments] = array_shift($this->methodCalls); - - if ($arguments !== $value->getArguments()) { - $value->setArguments($arguments); - } - } - - if ($this->methodCalls !== $value->getMethodCalls()) { - $value->setMethodCalls($this->methodCalls); - } - - return $value; - } - - private function autowireCalls(\ReflectionClass $reflectionClass, bool $isRoot, bool $checkAttributes): array - { - $this->decoratedId = null; - $this->decoratedClass = null; - $this->getPreviousValue = null; - - if ($isRoot && ($definition = $this->container->getDefinition($this->currentId)) && null !== ($this->decoratedId = $definition->innerServiceId) && $this->container->has($this->decoratedId)) { - $this->decoratedClass = $this->container->findDefinition($this->decoratedId)->getClass(); - } - - $patchedIndexes = []; - - foreach ($this->methodCalls as $i => $call) { - [$method, $arguments] = $call; - - if ($method instanceof \ReflectionFunctionAbstract) { - $reflectionMethod = $method; - } else { - $definition = new Definition($reflectionClass->name); - try { - $reflectionMethod = $this->getReflectionMethod($definition, $method); - } catch (RuntimeException $e) { - if ($definition->getFactory()) { - continue; - } - throw $e; - } - } - - $arguments = $this->autowireMethod($reflectionMethod, $arguments, $checkAttributes, $i); - - if ($arguments !== $call[1]) { - $this->methodCalls[$i][1] = $arguments; - $patchedIndexes[] = $i; - } - } - - // use named arguments to skip complex default values - foreach ($patchedIndexes as $i) { - $namedArguments = null; - $arguments = $this->methodCalls[$i][1]; - - foreach ($arguments as $j => $value) { - if ($namedArguments && !$value instanceof $this->defaultArgument) { - unset($arguments[$j]); - $arguments[$namedArguments[$j]] = $value; - } - if ($namedArguments || !$value instanceof $this->defaultArgument) { - continue; - } - - if (\is_array($value->value) ? $value->value : \is_object($value->value)) { - unset($arguments[$j]); - $namedArguments = $value->names; - } else { - $arguments[$j] = $value->value; - } - } - - $this->methodCalls[$i][1] = $arguments; - } - - return $this->methodCalls; - } - - /** - * Autowires the constructor or a method. - * - * @throws AutowiringFailedException - */ - private function autowireMethod(\ReflectionFunctionAbstract $reflectionMethod, array $arguments, bool $checkAttributes, int $methodIndex): array - { - $class = $reflectionMethod instanceof \ReflectionMethod ? $reflectionMethod->class : $this->currentId; - $method = $reflectionMethod->name; - $parameters = $reflectionMethod->getParameters(); - if ($reflectionMethod->isVariadic()) { - array_pop($parameters); - } - $this->defaultArgument->names = new \ArrayObject(); - - foreach ($parameters as $index => $parameter) { - $this->defaultArgument->names[$index] = $parameter->name; - - if (\array_key_exists($parameter->name, $arguments)) { - $arguments[$index] = $arguments[$parameter->name]; - unset($arguments[$parameter->name]); - } - if (\array_key_exists($index, $arguments) && '' !== $arguments[$index]) { - continue; - } - - $type = ProxyHelper::exportType($parameter, true); - $target = null; - $name = Target::parseName($parameter, $target); - $target = $target ? [$target] : []; - - $getValue = function () use ($type, $parameter, $class, $method, $name, $target) { - if (!$value = $this->getAutowiredReference($ref = new TypedReference($type, $type, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $name, $target), false)) { - $failureMessage = $this->createTypeNotFoundMessageCallback($ref, sprintf('argument "$%s" of method "%s()"', $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method)); - - if ($parameter->isDefaultValueAvailable()) { - $value = $this->defaultArgument->withValue($parameter); - } elseif (!$parameter->allowsNull()) { - throw new AutowiringFailedException($this->currentId, $failureMessage); - } - } - - return $value; - }; - - if ($checkAttributes) { - foreach ($parameter->getAttributes(Autowire::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) { - $attribute = $attribute->newInstance(); - $invalidBehavior = $parameter->allowsNull() ? ContainerInterface::NULL_ON_INVALID_REFERENCE : ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE; - - try { - $value = $this->processValue(new TypedReference($type ?: '?', $type ?: 'mixed', $invalidBehavior, $name, [$attribute, ...$target])); - } catch (ParameterNotFoundException $e) { - if (!$parameter->isDefaultValueAvailable()) { - throw new AutowiringFailedException($this->currentId, $e->getMessage(), 0, $e); - } - $arguments[$index] = clone $this->defaultArgument; - $arguments[$index]->value = $parameter->getDefaultValue(); - - continue 2; - } - - if ($attribute instanceof AutowireCallable) { - $value = (new Definition($type = \is_string($attribute->lazy) ? $attribute->lazy : ($type ?: 'Closure'))) - ->setFactory(['Closure', 'fromCallable']) - ->setArguments([\is_array($value) ? $value + [1 => '__invoke'] : $value]) - ->setLazy($attribute->lazy || 'Closure' !== $type && 'callable' !== (string) $parameter->getType()); - } elseif ($lazy = $attribute->lazy) { - $definition = (new Definition($type)) - ->setFactory('current') - ->setArguments([[$value ??= $getValue()]]) - ->setLazy(true); - - if (!\is_array($lazy)) { - if (str_contains($type, '|')) { - throw new AutowiringFailedException($this->currentId, sprintf('Cannot use #[Autowire] with option "lazy: true" on union types for service "%s"; set the option to the interface(s) that should be proxied instead.', $this->currentId)); - } - $lazy = str_contains($type, '&') ? explode('&', $type) : []; - } - - if ($lazy) { - if (!class_exists($type) && !interface_exists($type, false)) { - $definition->setClass('object'); - } - foreach ($lazy as $v) { - $definition->addTag('proxy', ['interface' => $v]); - } - } - - if ($definition->getClass() !== (string) $value || $definition->getTag('proxy')) { - $value .= '.'.$this->container->hash([$definition->getClass(), $definition->getTag('proxy')]); - } - $this->container->setDefinition($value = '.lazy.'.$value, $definition); - $value = new Reference($value); - } - $arguments[$index] = $value; - - continue 2; - } - - foreach ($parameter->getAttributes(AutowireDecorated::class) as $attribute) { - $arguments[$index] = $this->processValue($attribute->newInstance()); - - continue 2; - } - - foreach ($parameter->getAttributes(MapDecorated::class) as $attribute) { - $arguments[$index] = $this->processValue($attribute->newInstance()); - - continue 2; - } - } - - if (!$type) { - if (isset($arguments[$index])) { - continue; - } - - // no default value? Then fail - if (!$parameter->isDefaultValueAvailable()) { - // For core classes, isDefaultValueAvailable() can - // be false when isOptional() returns true. If the - // argument *is* optional, allow it to be missing - if ($parameter->isOptional()) { - --$index; - break; - } - $type = ProxyHelper::exportType($parameter); - $type = $type ? sprintf('is type-hinted "%s"', preg_replace('/(^|[(|&])\\\\|^\?\\\\?/', '\1', $type)) : 'has no type-hint'; - - throw new AutowiringFailedException($this->currentId, sprintf('Cannot autowire service "%s": argument "$%s" of method "%s()" %s, you should configure its value explicitly.', $this->currentId, $parameter->name, $class !== $this->currentId ? $class.'::'.$method : $method, $type)); - } - - // specifically pass the default value - $arguments[$index] = $this->defaultArgument->withValue($parameter); - - continue; - } - - if ($this->decoratedClass && is_a($this->decoratedClass, $type, true)) { - if ($this->getPreviousValue) { - // The inner service is injected only if there is only 1 argument matching the type of the decorated class - // across all arguments of all autowired methods. - // If a second matching argument is found, the default behavior is restored. - - $getPreviousValue = $this->getPreviousValue; - $this->methodCalls[$this->decoratedMethodIndex][1][$this->decoratedMethodArgumentIndex] = $getPreviousValue(); - $this->decoratedClass = null; // Prevent further checks - } else { - $arguments[$index] = new TypedReference($this->decoratedId, $this->decoratedClass); - $this->getPreviousValue = $getValue; - $this->decoratedMethodIndex = $methodIndex; - $this->decoratedMethodArgumentIndex = $index; - - continue; - } - } - - $arguments[$index] = $getValue(); - } - - if ($parameters && !isset($arguments[++$index])) { - while (0 <= --$index) { - if (!$arguments[$index] instanceof $this->defaultArgument) { - break; - } - unset($arguments[$index]); - } - } - - // it's possible index 1 was set, then index 0, then 2, etc - // make sure that we re-order so they're injected as expected - ksort($arguments, \SORT_NATURAL); - - return $arguments; - } - - /** - * Returns a reference to the service matching the given type, if any. - */ - private function getAutowiredReference(TypedReference $reference, bool $filterType): ?TypedReference - { - $this->lastFailure = null; - $type = $reference->getType(); - - if ($type !== (string) $reference) { - return $reference; - } - - if ($filterType && false !== $m = strpbrk($type, '&|')) { - $types = array_diff(explode($m[0], $type), ['int', 'string', 'array', 'bool', 'float', 'iterable', 'object', 'callable', 'null']); - - sort($types); - - $type = implode($m[0], $types); - } - - $name = (array_filter($reference->getAttributes(), static fn ($a) => $a instanceof Target)[0] ?? null)?->name; - - if (null !== $name ??= $reference->getName()) { - if ($this->container->has($alias = $type.' $'.$name) && !$this->container->findDefinition($alias)->isAbstract()) { - return new TypedReference($alias, $type, $reference->getInvalidBehavior()); - } - - if (null !== ($alias = $this->getCombinedAlias($type, $name) ?? null) && !$this->container->findDefinition($alias)->isAbstract()) { - return new TypedReference($alias, $type, $reference->getInvalidBehavior()); - } - - if ($this->container->has($name) && !$this->container->findDefinition($name)->isAbstract()) { - foreach ($this->container->getAliases() as $id => $alias) { - if ($name === (string) $alias && str_starts_with($id, $type.' $')) { - return new TypedReference($name, $type, $reference->getInvalidBehavior()); - } - } - } - - if ($reference->getAttributes()) { - return null; - } - } - - if ($this->container->has($type) && !$this->container->findDefinition($type)->isAbstract()) { - return new TypedReference($type, $type, $reference->getInvalidBehavior()); - } - - if (null !== ($alias = $this->getCombinedAlias($type) ?? null) && !$this->container->findDefinition($alias)->isAbstract()) { - return new TypedReference($alias, $type, $reference->getInvalidBehavior()); - } - - return null; - } - - /** - * Populates the list of available types. - */ - private function populateAvailableTypes(ContainerBuilder $container): void - { - $this->types = []; - $this->ambiguousServiceTypes = []; - $this->autowiringAliases = []; - - foreach ($container->getDefinitions() as $id => $definition) { - $this->populateAvailableType($container, $id, $definition); - } - - foreach ($container->getAliases() as $id => $alias) { - $this->populateAutowiringAlias($id); - } - } - - /** - * Populates the list of available types for a given definition. - */ - private function populateAvailableType(ContainerBuilder $container, string $id, Definition $definition): void - { - // Never use abstract services - if ($definition->isAbstract()) { - return; - } - - if ('' === $id || '.' === $id[0] || $definition->isDeprecated() || !$reflectionClass = $container->getReflectionClass($definition->getClass(), false)) { - return; - } - - foreach ($reflectionClass->getInterfaces() as $reflectionInterface) { - $this->set($reflectionInterface->name, $id); - } - - do { - $this->set($reflectionClass->name, $id); - } while ($reflectionClass = $reflectionClass->getParentClass()); - - $this->populateAutowiringAlias($id); - } - - /** - * Associates a type and a service id if applicable. - */ - private function set(string $type, string $id): void - { - // is this already a type/class that is known to match multiple services? - if (isset($this->ambiguousServiceTypes[$type])) { - $this->ambiguousServiceTypes[$type][] = $id; - - return; - } - - // check to make sure the type doesn't match multiple services - if (!isset($this->types[$type]) || $this->types[$type] === $id) { - $this->types[$type] = $id; - - return; - } - - // keep an array of all services matching this type - if (!isset($this->ambiguousServiceTypes[$type])) { - $this->ambiguousServiceTypes[$type] = [$this->types[$type]]; - unset($this->types[$type]); - } - $this->ambiguousServiceTypes[$type][] = $id; - } - - private function createTypeNotFoundMessageCallback(TypedReference $reference, string $label): \Closure - { - if (null === $this->typesClone->container) { - $this->typesClone->container = new ContainerBuilder($this->container->getParameterBag()); - $this->typesClone->container->setAliases($this->container->getAliases()); - $this->typesClone->container->setDefinitions($this->container->getDefinitions()); - $this->typesClone->container->setResourceTracking(false); - } - $currentId = $this->currentId; - - return (fn () => $this->createTypeNotFoundMessage($reference, $label, $currentId))->bindTo($this->typesClone); - } - - private function createTypeNotFoundMessage(TypedReference $reference, string $label, string $currentId): string - { - $type = $reference->getType(); - - $i = null; - $namespace = $type; - do { - $namespace = substr($namespace, 0, $i); - - if ($this->container->hasDefinition($namespace) && $tag = $this->container->getDefinition($namespace)->getTag('container.excluded')) { - return sprintf('Cannot autowire service "%s": %s needs an instance of "%s" but this type has been excluded %s.', $currentId, $label, $type, $tag[0]['source'] ?? 'from autowiring'); - } - } while (false !== $i = strrpos($namespace, '\\')); - - if (!$r = $this->container->getReflectionClass($type, false)) { - // either $type does not exist or a parent class does not exist - try { - if (class_exists(ClassExistenceResource::class)) { - $resource = new ClassExistenceResource($type, false); - // isFresh() will explode ONLY if a parent class/trait does not exist - $resource->isFresh(0); - $parentMsg = false; - } else { - $parentMsg = "couldn't be loaded. Either it was not found or it is missing a parent class or a trait"; - } - } catch (\ReflectionException $e) { - $parentMsg = sprintf('is missing a parent class (%s)', $e->getMessage()); - } - - $message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ?: 'was not found'); - } elseif ($reference->getAttributes()) { - $message = $label; - $label = sprintf('"#[Target(\'%s\')" on', $reference->getName()); - } else { - $alternatives = $this->createTypeAlternatives($this->container, $reference); - $message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists'; - $message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives); - - if ($r->isInterface() && !$alternatives) { - $message .= ' Did you create a class that implements this interface?'; - } - } - - $message = sprintf('Cannot autowire service "%s": %s %s', $currentId, $label, $message); - - if (null !== $this->lastFailure) { - $message = $this->lastFailure."\n".$message; - $this->lastFailure = null; - } - - return $message; - } - - private function createTypeAlternatives(ContainerBuilder $container, TypedReference $reference): string - { - // try suggesting available aliases first - if ($message = $this->getAliasesSuggestionForType($container, $type = $reference->getType())) { - return ' '.$message; - } - if (!isset($this->ambiguousServiceTypes)) { - $this->populateAvailableTypes($container); - } - - $servicesAndAliases = $container->getServiceIds(); - if (null !== ($autowiringAliases = $this->autowiringAliases[$type] ?? null) && !isset($autowiringAliases[''])) { - return sprintf(' Available autowiring aliases for this %s are: "$%s".', class_exists($type, false) ? 'class' : 'interface', implode('", "$', $autowiringAliases)); - } - - if (!$container->has($type) && false !== $key = array_search(strtolower($type), array_map('strtolower', $servicesAndAliases))) { - return sprintf(' Did you mean "%s"?', $servicesAndAliases[$key]); - } elseif (isset($this->ambiguousServiceTypes[$type])) { - $message = sprintf('one of these existing services: "%s"', implode('", "', $this->ambiguousServiceTypes[$type])); - } elseif (isset($this->types[$type])) { - $message = sprintf('the existing "%s" service', $this->types[$type]); - } else { - return ''; - } - - return sprintf(' You should maybe alias this %s to %s.', class_exists($type, false) ? 'class' : 'interface', $message); - } - - private function getAliasesSuggestionForType(ContainerBuilder $container, string $type): ?string - { - $aliases = []; - foreach (class_parents($type) + class_implements($type) as $parent) { - if ($container->has($parent) && !$container->findDefinition($parent)->isAbstract()) { - $aliases[] = $parent; - } - } - - if (1 < $len = \count($aliases)) { - $message = 'Try changing the type-hint to one of its parents: '; - for ($i = 0, --$len; $i < $len; ++$i) { - $message .= sprintf('%s "%s", ', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]); - } - $message .= sprintf('or %s "%s".', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]); - - return $message; - } - - if ($aliases) { - return sprintf('Try changing the type-hint to "%s" instead.', $aliases[0]); - } - - return null; - } - - private function populateAutowiringAlias(string $id): void - { - if (!preg_match('/(?(DEFINE)(?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+))^((?&V)(?:\\\\(?&V))*+)(?: \$((?&V)))?$/', $id, $m)) { - return; - } - - $type = $m[2]; - $name = $m[3] ?? ''; - - if (class_exists($type, false) || interface_exists($type, false)) { - $this->autowiringAliases[$type][$name] = $name; - } - } - - private function getCombinedAlias(string $type, string $name = null): ?string - { - if (str_contains($type, '&')) { - $types = explode('&', $type); - } elseif (str_contains($type, '|')) { - $types = explode('|', $type); - } else { - return null; - } - - $alias = null; - $suffix = $name ? ' $'.$name : ''; - - foreach ($types as $type) { - if (!$this->container->hasAlias($type.$suffix)) { - return null; - } - - if (null === $alias) { - $alias = (string) $this->container->getAlias($type.$suffix); - } elseif ((string) $this->container->getAlias($type.$suffix) !== $alias) { - return null; - } - } - - return $alias; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php deleted file mode 100644 index a021280..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; - -/** - * Checks if arguments of methods are properly configured. - * - * @author Kévin Dunglas - * @author Nicolas Grekas - */ -class CheckArgumentsValidityPass extends AbstractRecursivePass -{ - private bool $throwExceptions; - - public function __construct(bool $throwExceptions = true) - { - $this->throwExceptions = $throwExceptions; - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if (!$value instanceof Definition) { - return parent::processValue($value, $isRoot); - } - - $i = 0; - $hasNamedArgs = false; - foreach ($value->getArguments() as $k => $v) { - if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $k)) { - $hasNamedArgs = true; - continue; - } - - if ($k !== $i++) { - if (!\is_int($k)) { - $msg = sprintf('Invalid constructor argument for service "%s": integer expected but found string "%s". Check your service definition.', $this->currentId, $k); - $value->addError($msg); - if ($this->throwExceptions) { - throw new RuntimeException($msg); - } - - break; - } - - $msg = sprintf('Invalid constructor argument %d for service "%s": argument %d must be defined before. Check your service definition.', 1 + $k, $this->currentId, $i); - $value->addError($msg); - if ($this->throwExceptions) { - throw new RuntimeException($msg); - } - } - - if ($hasNamedArgs) { - $msg = sprintf('Invalid constructor argument for service "%s": cannot use positional argument after named argument. Check your service definition.', $this->currentId); - $value->addError($msg); - if ($this->throwExceptions) { - throw new RuntimeException($msg); - } - - break; - } - } - - foreach ($value->getMethodCalls() as $methodCall) { - $i = 0; - $hasNamedArgs = false; - foreach ($methodCall[1] as $k => $v) { - if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $k)) { - $hasNamedArgs = true; - continue; - } - - if ($k !== $i++) { - if (!\is_int($k)) { - $msg = sprintf('Invalid argument for method call "%s" of service "%s": integer expected but found string "%s". Check your service definition.', $methodCall[0], $this->currentId, $k); - $value->addError($msg); - if ($this->throwExceptions) { - throw new RuntimeException($msg); - } - - break; - } - - $msg = sprintf('Invalid argument %d for method call "%s" of service "%s": argument %d must be defined before. Check your service definition.', 1 + $k, $methodCall[0], $this->currentId, $i); - $value->addError($msg); - if ($this->throwExceptions) { - throw new RuntimeException($msg); - } - } - - if ($hasNamedArgs) { - $msg = sprintf('Invalid argument for method call "%s" of service "%s": cannot use positional argument after named argument. Check your service definition.', $methodCall[0], $this->currentId); - $value->addError($msg); - if ($this->throwExceptions) { - throw new RuntimeException($msg); - } - - break; - } - } - } - - return null; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php deleted file mode 100644 index 1fb8935..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php +++ /dev/null @@ -1,80 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; - -/** - * Checks your services for circular references. - * - * References from method calls are ignored since we might be able to resolve - * these references depending on the order in which services are called. - * - * Circular reference from method calls will only be detected at run-time. - * - * @author Johannes M. Schmitt - */ -class CheckCircularReferencesPass implements CompilerPassInterface -{ - private array $currentPath; - private array $checkedNodes; - - /** - * Checks the ContainerBuilder object for circular references. - * - * @return void - */ - public function process(ContainerBuilder $container) - { - $graph = $container->getCompiler()->getServiceReferenceGraph(); - - $this->checkedNodes = []; - foreach ($graph->getNodes() as $id => $node) { - $this->currentPath = [$id]; - - $this->checkOutEdges($node->getOutEdges()); - } - } - - /** - * Checks for circular references. - * - * @param ServiceReferenceGraphEdge[] $edges An array of Edges - * - * @throws ServiceCircularReferenceException when a circular reference is found - */ - private function checkOutEdges(array $edges): void - { - foreach ($edges as $edge) { - $node = $edge->getDestNode(); - $id = $node->getId(); - - if (empty($this->checkedNodes[$id])) { - // Don't check circular references for lazy edges - if (!$node->getValue() || (!$edge->isLazy() && !$edge->isWeak())) { - $searchKey = array_search($id, $this->currentPath); - $this->currentPath[] = $id; - - if (false !== $searchKey) { - throw new ServiceCircularReferenceException($id, \array_slice($this->currentPath, $searchKey)); - } - - $this->checkOutEdges($node->getOutEdges()); - } - - $this->checkedNodes[$id] = true; - array_pop($this->currentPath); - } - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php deleted file mode 100644 index c62345f..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\EnvParameterException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Loader\FileLoader; - -/** - * This pass validates each definition individually only taking the information - * into account which is contained in the definition itself. - * - * Later passes can rely on the following, and specifically do not need to - * perform these checks themselves: - * - * - non synthetic, non abstract services always have a class set - * - synthetic services are always public - * - * @author Johannes M. Schmitt - */ -class CheckDefinitionValidityPass implements CompilerPassInterface -{ - /** - * Processes the ContainerBuilder to validate the Definition. - * - * @return void - * - * @throws RuntimeException When the Definition is invalid - */ - public function process(ContainerBuilder $container) - { - foreach ($container->getDefinitions() as $id => $definition) { - // synthetic service is public - if ($definition->isSynthetic() && !$definition->isPublic()) { - throw new RuntimeException(sprintf('A synthetic service ("%s") must be public.', $id)); - } - - // non-synthetic, non-abstract service has class - if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass() && !$definition->hasTag('container.service_locator') && (!$definition->getFactory() || !preg_match(FileLoader::ANONYMOUS_ID_REGEXP, $id))) { - if ($definition->getFactory()) { - throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); - } - if (class_exists($id) || interface_exists($id, false)) { - if (str_starts_with($id, '\\') && 1 < substr_count($id, '\\')) { - throw new RuntimeException(sprintf('The definition for "%s" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "%s" to get rid of this error.', $id, substr($id, 1))); - } - - throw new RuntimeException(sprintf('The definition for "%s" has no class attribute, and appears to reference a class or interface in the global namespace. Leaving out the "class" attribute is only allowed for namespaced classes. Please specify the class attribute explicitly to get rid of this error.', $id)); - } - - throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); - } - - // tag attribute values must be scalars - foreach ($definition->getTags() as $name => $tags) { - foreach ($tags as $attributes) { - $this->validateAttributes($id, $name, $attributes); - } - } - - if ($definition->isPublic() && !$definition->isPrivate()) { - $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); - if (null !== $usedEnvs) { - throw new EnvParameterException([$resolvedId], null, 'A service name ("%s") cannot contain dynamic values.'); - } - } - } - - foreach ($container->getAliases() as $id => $alias) { - if ($alias->isPublic() && !$alias->isPrivate()) { - $resolvedId = $container->resolveEnvPlaceholders($id, null, $usedEnvs); - if (null !== $usedEnvs) { - throw new EnvParameterException([$resolvedId], null, 'An alias name ("%s") cannot contain dynamic values.'); - } - } - } - } - - private function validateAttributes(string $id, string $tag, array $attributes, array $path = []): void - { - foreach ($attributes as $name => $value) { - if (\is_array($value)) { - $this->validateAttributes($id, $tag, $value, [...$path, $name]); - } elseif (!\is_scalar($value) && null !== $value) { - $name = implode('.', [...$path, $name]); - throw new RuntimeException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $tag, $name)); - } - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php deleted file mode 100644 index 8f828d3..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php +++ /dev/null @@ -1,105 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Checks that all references are pointing to a valid service. - * - * @author Johannes M. Schmitt - */ -class CheckExceptionOnInvalidReferenceBehaviorPass extends AbstractRecursivePass -{ - private array $serviceLocatorContextIds = []; - - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - $this->serviceLocatorContextIds = []; - foreach ($container->findTaggedServiceIds('container.service_locator_context') as $id => $tags) { - $this->serviceLocatorContextIds[$id] = $tags[0]['id']; - $container->getDefinition($id)->clearTag('container.service_locator_context'); - } - - try { - parent::process($container); - } finally { - $this->serviceLocatorContextIds = []; - } - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if (!$value instanceof Reference) { - return parent::processValue($value, $isRoot); - } - if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $value->getInvalidBehavior() || $this->container->has($id = (string) $value)) { - return $value; - } - - $currentId = $this->currentId; - $graph = $this->container->getCompiler()->getServiceReferenceGraph(); - - if (isset($this->serviceLocatorContextIds[$currentId])) { - $currentId = $this->serviceLocatorContextIds[$currentId]; - $locator = $this->container->getDefinition($this->currentId)->getFactory()[0]; - - foreach ($locator->getArgument(0) as $k => $v) { - if ($v->getValues()[0] === $value) { - if ($k !== $id) { - $currentId = $k.'" in the container provided to "'.$currentId; - } - throw new ServiceNotFoundException($id, $currentId, null, $this->getAlternatives($id)); - } - } - } - - if ('.' === $currentId[0] && $graph->hasNode($currentId)) { - foreach ($graph->getNode($currentId)->getInEdges() as $edge) { - if (!$edge->getValue() instanceof Reference || ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $edge->getValue()->getInvalidBehavior()) { - continue; - } - $sourceId = $edge->getSourceNode()->getId(); - - if ('.' !== $sourceId[0]) { - $currentId = $sourceId; - break; - } - } - } - - throw new ServiceNotFoundException($id, $currentId, null, $this->getAlternatives($id)); - } - - private function getAlternatives(string $id): array - { - $alternatives = []; - foreach ($this->container->getServiceIds() as $knownId) { - if ('' === $knownId || '.' === $knownId[0] || $knownId === $this->currentId) { - continue; - } - - $lev = levenshtein($id, $knownId); - if ($lev <= \strlen($id) / 3 || str_contains($knownId, $id)) { - $alternatives[] = $knownId; - } - } - - return $alternatives; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php deleted file mode 100644 index eb3385b..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Checks the validity of references. - * - * The following checks are performed by this pass: - * - target definitions are not abstract - * - * @author Johannes M. Schmitt - */ -class CheckReferenceValidityPass extends AbstractRecursivePass -{ - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($isRoot && $value instanceof Definition && ($value->isSynthetic() || $value->isAbstract())) { - return $value; - } - if ($value instanceof Reference && $this->container->hasDefinition((string) $value)) { - $targetDefinition = $this->container->getDefinition((string) $value); - - if ($targetDefinition->isAbstract()) { - throw new RuntimeException(sprintf('The definition "%s" has a reference to an abstract definition "%s". Abstract definitions cannot be the target of references.', $this->currentId, $value)); - } - } - - return parent::processValue($value, $isRoot); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/Compiler.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/Compiler.php deleted file mode 100644 index c8cbccb..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/Compiler.php +++ /dev/null @@ -1,104 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\EnvParameterException; - -/** - * This class is used to remove circular dependencies between individual passes. - * - * @author Johannes M. Schmitt - */ -class Compiler -{ - private PassConfig $passConfig; - private array $log = []; - private ServiceReferenceGraph $serviceReferenceGraph; - - public function __construct() - { - $this->passConfig = new PassConfig(); - $this->serviceReferenceGraph = new ServiceReferenceGraph(); - } - - public function getPassConfig(): PassConfig - { - return $this->passConfig; - } - - public function getServiceReferenceGraph(): ServiceReferenceGraph - { - return $this->serviceReferenceGraph; - } - - /** - * @return void - */ - public function addPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0) - { - $this->passConfig->addPass($pass, $type, $priority); - } - - /** - * @final - * - * @return void - */ - public function log(CompilerPassInterface $pass, string $message) - { - if (str_contains($message, "\n")) { - $message = str_replace("\n", "\n".$pass::class.': ', trim($message)); - } - - $this->log[] = $pass::class.': '.$message; - } - - public function getLog(): array - { - return $this->log; - } - - /** - * Run the Compiler and process all Passes. - * - * @return void - */ - public function compile(ContainerBuilder $container) - { - try { - foreach ($this->passConfig->getPasses() as $pass) { - $pass->process($container); - } - } catch (\Exception $e) { - $usedEnvs = []; - $prev = $e; - - do { - $msg = $prev->getMessage(); - - if ($msg !== $resolvedMsg = $container->resolveEnvPlaceholders($msg, null, $usedEnvs)) { - $r = new \ReflectionProperty($prev, 'message'); - $r->setValue($prev, $resolvedMsg); - } - } while ($prev = $prev->getPrevious()); - - if ($usedEnvs) { - $e = new EnvParameterException($usedEnvs, $e); - } - - throw $e; - } finally { - $this->getServiceReferenceGraph()->clear(); - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/CompilerPassInterface.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/CompilerPassInterface.php deleted file mode 100644 index 2ad4a04..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/CompilerPassInterface.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Interface that must be implemented by compilation passes. - * - * @author Johannes M. Schmitt - */ -interface CompilerPassInterface -{ - /** - * You can modify the container here before it is dumped to PHP code. - * - * @return void - */ - public function process(ContainerBuilder $container); -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php deleted file mode 100644 index d05878f..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Overwrites a service but keeps the overridden one. - * - * @author Christophe Coevoet - * @author Fabien Potencier - * @author Diego Saint Esteben - */ -class DecoratorServicePass extends AbstractRecursivePass -{ - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - $definitions = new \SplPriorityQueue(); - $order = \PHP_INT_MAX; - - foreach ($container->getDefinitions() as $id => $definition) { - if (!$decorated = $definition->getDecoratedService()) { - continue; - } - $definitions->insert([$id, $definition], [$decorated[2], --$order]); - } - $decoratingDefinitions = []; - $decoratedIds = []; - - $tagsToKeep = $container->hasParameter('container.behavior_describing_tags') - ? $container->getParameter('container.behavior_describing_tags') - : ['proxy', 'container.do_not_inline', 'container.service_locator', 'container.service_subscriber', 'container.service_subscriber.locator']; - - foreach ($definitions as [$id, $definition]) { - $decoratedService = $definition->getDecoratedService(); - [$inner, $renamedId] = $decoratedService; - $invalidBehavior = $decoratedService[3] ?? ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - - $definition->setDecoratedService(null); - - if (!$renamedId) { - $renamedId = $id.'.inner'; - } - - $decoratedIds[$inner] ??= $renamedId; - $this->currentId = $renamedId; - $this->processValue($definition); - - $definition->innerServiceId = $renamedId; - $definition->decorationOnInvalid = $invalidBehavior; - - // we create a new alias/service for the service we are replacing - // to be able to reference it in the new one - if ($container->hasAlias($inner)) { - $alias = $container->getAlias($inner); - $public = $alias->isPublic(); - $container->setAlias($renamedId, new Alias((string) $alias, false)); - $decoratedDefinition = $container->findDefinition($alias); - } elseif ($container->hasDefinition($inner)) { - $decoratedDefinition = $container->getDefinition($inner); - $public = $decoratedDefinition->isPublic(); - $decoratedDefinition->setPublic(false); - $container->setDefinition($renamedId, $decoratedDefinition); - $decoratingDefinitions[$inner] = $decoratedDefinition; - } elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) { - $container->removeDefinition($id); - continue; - } elseif (ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) { - $public = $definition->isPublic(); - $decoratedDefinition = null; - } else { - throw new ServiceNotFoundException($inner, $id); - } - - if ($decoratedDefinition?->isSynthetic()) { - throw new InvalidArgumentException(sprintf('A synthetic service cannot be decorated: service "%s" cannot decorate "%s".', $id, $inner)); - } - - if (isset($decoratingDefinitions[$inner])) { - $decoratingDefinition = $decoratingDefinitions[$inner]; - - $decoratingTags = $decoratingDefinition->getTags(); - $resetTags = []; - - // Behavior-describing tags must not be transferred out to decorators - foreach ($tagsToKeep as $containerTag) { - if (isset($decoratingTags[$containerTag])) { - $resetTags[$containerTag] = $decoratingTags[$containerTag]; - unset($decoratingTags[$containerTag]); - } - } - - $definition->setTags(array_merge($decoratingTags, $definition->getTags())); - $decoratingDefinition->setTags($resetTags); - $decoratingDefinitions[$inner] = $definition; - } - - $container->setAlias($inner, $id)->setPublic($public); - } - - foreach ($decoratingDefinitions as $inner => $definition) { - $definition->addTag('container.decorator', ['id' => $inner, 'inner' => $decoratedIds[$inner]]); - } - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof Reference && '.inner' === (string) $value) { - return new Reference($this->currentId, $value->getInvalidBehavior()); - } - - return parent::processValue($value, $isRoot); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php deleted file mode 100644 index 953b7f9..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * A pass to automatically process extensions if they implement - * CompilerPassInterface. - * - * @author Wouter J - */ -class ExtensionCompilerPass implements CompilerPassInterface -{ - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - foreach ($container->getExtensions() as $extension) { - if (!$extension instanceof CompilerPassInterface) { - continue; - } - - $extension->process($container); - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php deleted file mode 100644 index f4eb931..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php +++ /dev/null @@ -1,227 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Inline service definitions where this is possible. - * - * @author Johannes M. Schmitt - */ -class InlineServiceDefinitionsPass extends AbstractRecursivePass -{ - private ?AnalyzeServiceReferencesPass $analyzingPass; - private array $cloningIds = []; - private array $connectedIds = []; - private array $notInlinedIds = []; - private array $inlinedIds = []; - private array $notInlinableIds = []; - private ?ServiceReferenceGraph $graph = null; - - public function __construct(AnalyzeServiceReferencesPass $analyzingPass = null) - { - $this->analyzingPass = $analyzingPass; - } - - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - $this->container = $container; - if ($this->analyzingPass) { - $analyzedContainer = new ContainerBuilder(); - $analyzedContainer->setAliases($container->getAliases()); - $analyzedContainer->setDefinitions($container->getDefinitions()); - foreach ($container->getExpressionLanguageProviders() as $provider) { - $analyzedContainer->addExpressionLanguageProvider($provider); - } - } else { - $analyzedContainer = $container; - } - try { - $notInlinableIds = []; - $remainingInlinedIds = []; - $this->connectedIds = $this->notInlinedIds = $container->getDefinitions(); - do { - if ($this->analyzingPass) { - $analyzedContainer->setDefinitions(array_intersect_key($analyzedContainer->getDefinitions(), $this->connectedIds)); - $this->analyzingPass->process($analyzedContainer); - } - $this->graph = $analyzedContainer->getCompiler()->getServiceReferenceGraph(); - $notInlinedIds = $this->notInlinedIds; - $notInlinableIds += $this->notInlinableIds; - $this->connectedIds = $this->notInlinedIds = $this->inlinedIds = $this->notInlinableIds = []; - - foreach ($analyzedContainer->getDefinitions() as $id => $definition) { - if (!$this->graph->hasNode($id)) { - continue; - } - foreach ($this->graph->getNode($id)->getOutEdges() as $edge) { - if (isset($notInlinedIds[$edge->getSourceNode()->getId()])) { - $this->currentId = $id; - $this->processValue($definition, true); - break; - } - } - } - - foreach ($this->inlinedIds as $id => $isPublicOrNotShared) { - if ($isPublicOrNotShared) { - $remainingInlinedIds[$id] = $id; - } else { - $container->removeDefinition($id); - $analyzedContainer->removeDefinition($id); - } - } - } while ($this->inlinedIds && $this->analyzingPass); - - foreach ($remainingInlinedIds as $id) { - if (isset($notInlinableIds[$id])) { - continue; - } - - $definition = $container->getDefinition($id); - - if (!$definition->isShared() && !$definition->isPublic()) { - $container->removeDefinition($id); - } - } - } finally { - $this->container = null; - $this->connectedIds = $this->notInlinedIds = $this->inlinedIds = []; - $this->notInlinableIds = []; - $this->graph = null; - } - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof ArgumentInterface) { - // References found in ArgumentInterface::getValues() are not inlineable - return $value; - } - - if ($value instanceof Definition && $this->cloningIds) { - if ($value->isShared()) { - return $value; - } - $value = clone $value; - } - - if (!$value instanceof Reference) { - return parent::processValue($value, $isRoot); - } elseif (!$this->container->hasDefinition($id = (string) $value)) { - return $value; - } - - $definition = $this->container->getDefinition($id); - - if (isset($this->notInlinableIds[$id]) || !$this->isInlineableDefinition($id, $definition)) { - if ($this->currentId !== $id) { - $this->notInlinableIds[$id] = true; - } - - return $value; - } - - $this->container->log($this, sprintf('Inlined service "%s" to "%s".', $id, $this->currentId)); - $this->inlinedIds[$id] = $definition->isPublic() || !$definition->isShared(); - $this->notInlinedIds[$this->currentId] = true; - - if ($definition->isShared()) { - return $definition; - } - - if (isset($this->cloningIds[$id])) { - $ids = array_keys($this->cloningIds); - $ids[] = $id; - - throw new ServiceCircularReferenceException($id, \array_slice($ids, array_search($id, $ids))); - } - - $this->cloningIds[$id] = true; - try { - return $this->processValue($definition); - } finally { - unset($this->cloningIds[$id]); - } - } - - /** - * Checks if the definition is inlineable. - */ - private function isInlineableDefinition(string $id, Definition $definition): bool - { - if ($definition->hasErrors() || $definition->isDeprecated() || $definition->isLazy() || $definition->isSynthetic() || $definition->hasTag('container.do_not_inline')) { - return false; - } - - if (!$definition->isShared()) { - if (!$this->graph->hasNode($id)) { - return true; - } - - foreach ($this->graph->getNode($id)->getInEdges() as $edge) { - $srcId = $edge->getSourceNode()->getId(); - $this->connectedIds[$srcId] = true; - if ($edge->isWeak() || $edge->isLazy()) { - return !$this->connectedIds[$id] = true; - } - } - - return true; - } - - if ($definition->isPublic()) { - return false; - } - - if (!$this->graph->hasNode($id)) { - return true; - } - - if ($this->currentId === $id) { - return false; - } - $this->connectedIds[$id] = true; - - $srcIds = []; - $srcCount = 0; - foreach ($this->graph->getNode($id)->getInEdges() as $edge) { - $srcId = $edge->getSourceNode()->getId(); - $this->connectedIds[$srcId] = true; - if ($edge->isWeak() || $edge->isLazy()) { - return false; - } - $srcIds[$srcId] = true; - ++$srcCount; - } - - if (1 !== \count($srcIds)) { - $this->notInlinedIds[$id] = true; - - return false; - } - - if ($srcCount > 1 && \is_array($factory = $definition->getFactory()) && ($factory[0] instanceof Reference || $factory[0] instanceof Definition)) { - return false; - } - - return $this->container->getDefinition($srcId)->isShared(); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php deleted file mode 100644 index cd8ebfe..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php +++ /dev/null @@ -1,207 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\Config\Definition\BaseNode; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface; -use Symfony\Component\DependencyInjection\Extension\Extension; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; -use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; - -/** - * Merges extension configs into the container builder. - * - * @author Fabien Potencier - */ -class MergeExtensionConfigurationPass implements CompilerPassInterface -{ - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - $parameters = $container->getParameterBag()->all(); - $definitions = $container->getDefinitions(); - $aliases = $container->getAliases(); - $exprLangProviders = $container->getExpressionLanguageProviders(); - $configAvailable = class_exists(BaseNode::class); - - foreach ($container->getExtensions() as $extension) { - if ($extension instanceof PrependExtensionInterface) { - $extension->prepend($container); - } - } - - foreach ($container->getExtensions() as $name => $extension) { - if (!$config = $container->getExtensionConfig($name)) { - // this extension was not called - continue; - } - $resolvingBag = $container->getParameterBag(); - if ($resolvingBag instanceof EnvPlaceholderParameterBag && $extension instanceof Extension) { - // create a dedicated bag so that we can track env vars per-extension - $resolvingBag = new MergeExtensionConfigurationParameterBag($resolvingBag); - if ($configAvailable) { - BaseNode::setPlaceholderUniquePrefix($resolvingBag->getEnvPlaceholderUniquePrefix()); - } - } - $config = $resolvingBag->resolveValue($config); - - try { - $tmpContainer = new MergeExtensionConfigurationContainerBuilder($extension, $resolvingBag); - $tmpContainer->setResourceTracking($container->isTrackingResources()); - $tmpContainer->addObjectResource($extension); - if ($extension instanceof ConfigurationExtensionInterface && null !== $configuration = $extension->getConfiguration($config, $tmpContainer)) { - $tmpContainer->addObjectResource($configuration); - } - - foreach ($exprLangProviders as $provider) { - $tmpContainer->addExpressionLanguageProvider($provider); - } - - $extension->load($config, $tmpContainer); - } catch (\Exception $e) { - if ($resolvingBag instanceof MergeExtensionConfigurationParameterBag) { - $container->getParameterBag()->mergeEnvPlaceholders($resolvingBag); - } - - throw $e; - } - - if ($resolvingBag instanceof MergeExtensionConfigurationParameterBag) { - // don't keep track of env vars that are *overridden* when configs are merged - $resolvingBag->freezeAfterProcessing($extension, $tmpContainer); - } - - $container->merge($tmpContainer); - $container->getParameterBag()->add($parameters); - } - - $container->addDefinitions($definitions); - $container->addAliases($aliases); - } -} - -/** - * @internal - */ -class MergeExtensionConfigurationParameterBag extends EnvPlaceholderParameterBag -{ - private array $processedEnvPlaceholders; - - public function __construct(parent $parameterBag) - { - parent::__construct($parameterBag->all()); - $this->mergeEnvPlaceholders($parameterBag); - } - - public function freezeAfterProcessing(Extension $extension, ContainerBuilder $container): void - { - if (!$config = $extension->getProcessedConfigs()) { - // Extension::processConfiguration() wasn't called, we cannot know how configs were merged - return; - } - $this->processedEnvPlaceholders = []; - - // serialize config and container to catch env vars nested in object graphs - $config = serialize($config).serialize($container->getDefinitions()).serialize($container->getAliases()).serialize($container->getParameterBag()->all()); - - if (false === stripos($config, 'env_')) { - return; - } - - preg_match_all('/env_[a-f0-9]{16}_\w+_[a-f0-9]{32}/Ui', $config, $matches); - $usedPlaceholders = array_flip($matches[0]); - foreach (parent::getEnvPlaceholders() as $env => $placeholders) { - foreach ($placeholders as $placeholder) { - if (isset($usedPlaceholders[$placeholder])) { - $this->processedEnvPlaceholders[$env] = $placeholders; - break; - } - } - } - } - - public function getEnvPlaceholders(): array - { - return $this->processedEnvPlaceholders ?? parent::getEnvPlaceholders(); - } - - public function getUnusedEnvPlaceholders(): array - { - return !isset($this->processedEnvPlaceholders) ? [] : array_diff_key(parent::getEnvPlaceholders(), $this->processedEnvPlaceholders); - } -} - -/** - * A container builder preventing using methods that wouldn't have any effect from extensions. - * - * @internal - */ -class MergeExtensionConfigurationContainerBuilder extends ContainerBuilder -{ - private string $extensionClass; - - public function __construct(ExtensionInterface $extension, ParameterBagInterface $parameterBag = null) - { - parent::__construct($parameterBag); - - $this->extensionClass = $extension::class; - } - - public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): static - { - throw new LogicException(sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', get_debug_type($pass), $this->extensionClass)); - } - - public function registerExtension(ExtensionInterface $extension) - { - throw new LogicException(sprintf('You cannot register extension "%s" from "%s". Extensions must be registered before the container is compiled.', get_debug_type($extension), $this->extensionClass)); - } - - public function compile(bool $resolveEnvPlaceholders = false) - { - throw new LogicException(sprintf('Cannot compile the container in extension "%s".', $this->extensionClass)); - } - - public function resolveEnvPlaceholders(mixed $value, string|bool $format = null, array &$usedEnvs = null): mixed - { - if (true !== $format || !\is_string($value)) { - return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); - } - - $bag = $this->getParameterBag(); - $value = $bag->resolveValue($value); - - if (!$bag instanceof EnvPlaceholderParameterBag) { - return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); - } - - foreach ($bag->getEnvPlaceholders() as $env => $placeholders) { - if (!str_contains($env, ':')) { - continue; - } - foreach ($placeholders as $placeholder) { - if (false !== stripos($value, $placeholder)) { - throw new RuntimeException(sprintf('Using a cast in "env(%s)" is incompatible with resolution at compile time in "%s". The logic in the extension should be moved to a compiler pass, or an env parameter with no cast should be used instead.', $env, $this->extensionClass)); - } - } - } - - return parent::resolveEnvPlaceholders($value, $format, $usedEnvs); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/PassConfig.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/PassConfig.php deleted file mode 100644 index 16b24cc..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/PassConfig.php +++ /dev/null @@ -1,287 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; - -/** - * Compiler Pass Configuration. - * - * This class has a default configuration embedded. - * - * @author Johannes M. Schmitt - */ -class PassConfig -{ - public const TYPE_AFTER_REMOVING = 'afterRemoving'; - public const TYPE_BEFORE_OPTIMIZATION = 'beforeOptimization'; - public const TYPE_BEFORE_REMOVING = 'beforeRemoving'; - public const TYPE_OPTIMIZE = 'optimization'; - public const TYPE_REMOVE = 'removing'; - - private MergeExtensionConfigurationPass $mergePass; - private array $afterRemovingPasses; - private array $beforeOptimizationPasses; - private array $beforeRemovingPasses = []; - private array $optimizationPasses; - private array $removingPasses; - - public function __construct() - { - $this->mergePass = new MergeExtensionConfigurationPass(); - - $this->beforeOptimizationPasses = [ - 100 => [ - new ResolveClassPass(), - new RegisterAutoconfigureAttributesPass(), - new AutowireAsDecoratorPass(), - new AttributeAutoconfigurationPass(), - new ResolveInstanceofConditionalsPass(), - new RegisterEnvVarProcessorsPass(), - ], - -1000 => [new ExtensionCompilerPass()], - ]; - - $this->optimizationPasses = [[ - new AutoAliasServicePass(), - new ValidateEnvPlaceholdersPass(), - new ResolveDecoratorStackPass(), - new ResolveChildDefinitionsPass(), - new RegisterServiceSubscribersPass(), - new ResolveParameterPlaceHoldersPass(false, false), - new ResolveFactoryClassPass(), - new ResolveNamedArgumentsPass(), - new AutowireRequiredMethodsPass(), - new AutowireRequiredPropertiesPass(), - new ResolveBindingsPass(), - new ServiceLocatorTagPass(), - new DecoratorServicePass(), - new CheckDefinitionValidityPass(), - new AutowirePass(false), - new ServiceLocatorTagPass(), - new ResolveTaggedIteratorArgumentPass(), - new ResolveServiceSubscribersPass(), - new ResolveReferencesToAliasesPass(), - new ResolveInvalidReferencesPass(), - new AnalyzeServiceReferencesPass(true), - new CheckCircularReferencesPass(), - new CheckReferenceValidityPass(), - new CheckArgumentsValidityPass(false), - ]]; - - $this->removingPasses = [[ - new RemovePrivateAliasesPass(), - new ReplaceAliasByActualDefinitionPass(), - new RemoveAbstractDefinitionsPass(), - new RemoveUnusedDefinitionsPass(), - new AnalyzeServiceReferencesPass(), - new CheckExceptionOnInvalidReferenceBehaviorPass(), - new InlineServiceDefinitionsPass(new AnalyzeServiceReferencesPass()), - new AnalyzeServiceReferencesPass(), - new DefinitionErrorExceptionPass(), - ]]; - - $this->afterRemovingPasses = [ - 0 => [ - new ResolveHotPathPass(), - new ResolveNoPreloadPass(), - new AliasDeprecatedPublicServicesPass(), - ], - // Let build parameters be available as late as possible - -2048 => [new RemoveBuildParametersPass()], - ]; - } - - /** - * Returns all passes in order to be processed. - * - * @return CompilerPassInterface[] - */ - public function getPasses(): array - { - return array_merge( - [$this->mergePass], - $this->getBeforeOptimizationPasses(), - $this->getOptimizationPasses(), - $this->getBeforeRemovingPasses(), - $this->getRemovingPasses(), - $this->getAfterRemovingPasses() - ); - } - - /** - * Adds a pass. - * - * @return void - * - * @throws InvalidArgumentException when a pass type doesn't exist - */ - public function addPass(CompilerPassInterface $pass, string $type = self::TYPE_BEFORE_OPTIMIZATION, int $priority = 0) - { - $property = $type.'Passes'; - if (!isset($this->$property)) { - throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type)); - } - - $passes = &$this->$property; - - if (!isset($passes[$priority])) { - $passes[$priority] = []; - } - $passes[$priority][] = $pass; - } - - /** - * Gets all passes for the AfterRemoving pass. - * - * @return CompilerPassInterface[] - */ - public function getAfterRemovingPasses(): array - { - return $this->sortPasses($this->afterRemovingPasses); - } - - /** - * Gets all passes for the BeforeOptimization pass. - * - * @return CompilerPassInterface[] - */ - public function getBeforeOptimizationPasses(): array - { - return $this->sortPasses($this->beforeOptimizationPasses); - } - - /** - * Gets all passes for the BeforeRemoving pass. - * - * @return CompilerPassInterface[] - */ - public function getBeforeRemovingPasses(): array - { - return $this->sortPasses($this->beforeRemovingPasses); - } - - /** - * Gets all passes for the Optimization pass. - * - * @return CompilerPassInterface[] - */ - public function getOptimizationPasses(): array - { - return $this->sortPasses($this->optimizationPasses); - } - - /** - * Gets all passes for the Removing pass. - * - * @return CompilerPassInterface[] - */ - public function getRemovingPasses(): array - { - return $this->sortPasses($this->removingPasses); - } - - /** - * Gets the Merge pass. - */ - public function getMergePass(): CompilerPassInterface - { - return $this->mergePass; - } - - /** - * @return void - */ - public function setMergePass(CompilerPassInterface $pass) - { - $this->mergePass = $pass; - } - - /** - * Sets the AfterRemoving passes. - * - * @param CompilerPassInterface[] $passes - * - * @return void - */ - public function setAfterRemovingPasses(array $passes) - { - $this->afterRemovingPasses = [$passes]; - } - - /** - * Sets the BeforeOptimization passes. - * - * @param CompilerPassInterface[] $passes - * - * @return void - */ - public function setBeforeOptimizationPasses(array $passes) - { - $this->beforeOptimizationPasses = [$passes]; - } - - /** - * Sets the BeforeRemoving passes. - * - * @param CompilerPassInterface[] $passes - * - * @return void - */ - public function setBeforeRemovingPasses(array $passes) - { - $this->beforeRemovingPasses = [$passes]; - } - - /** - * Sets the Optimization passes. - * - * @param CompilerPassInterface[] $passes - * - * @return void - */ - public function setOptimizationPasses(array $passes) - { - $this->optimizationPasses = [$passes]; - } - - /** - * Sets the Removing passes. - * - * @param CompilerPassInterface[] $passes - * - * @return void - */ - public function setRemovingPasses(array $passes) - { - $this->removingPasses = [$passes]; - } - - /** - * Sort passes by priority. - * - * @param array $passes CompilerPassInterface instances with their priority as key - * - * @return CompilerPassInterface[] - */ - private function sortPasses(array $passes): array - { - if (0 === \count($passes)) { - return []; - } - - krsort($passes); - - // Flatten the array - return array_merge(...$passes); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php deleted file mode 100644 index 7017862..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php +++ /dev/null @@ -1,171 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; -use Symfony\Component\DependencyInjection\Attribute\AsTaggedItem; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\TypedReference; - -/** - * Trait that allows a generic method to find and sort service by priority option in the tag. - * - * @author Iltar van der Berg - */ -trait PriorityTaggedServiceTrait -{ - /** - * Finds all services with the given tag name and order them by their priority. - * - * The order of additions must be respected for services having the same priority, - * and knowing that the \SplPriorityQueue class does not respect the FIFO method, - * we should not use that class. - * - * @see https://bugs.php.net/53710 - * @see https://bugs.php.net/60926 - * - * @return Reference[] - */ - private function findAndSortTaggedServices(string|TaggedIteratorArgument $tagName, ContainerBuilder $container, array $exclude = []): array - { - $indexAttribute = $defaultIndexMethod = $needsIndexes = $defaultPriorityMethod = null; - - if ($tagName instanceof TaggedIteratorArgument) { - $indexAttribute = $tagName->getIndexAttribute(); - $defaultIndexMethod = $tagName->getDefaultIndexMethod(); - $needsIndexes = $tagName->needsIndexes(); - $defaultPriorityMethod = $tagName->getDefaultPriorityMethod() ?? 'getDefaultPriority'; - $exclude = array_merge($exclude, $tagName->getExclude()); - $tagName = $tagName->getTag(); - } - - $i = 0; - $services = []; - - foreach ($container->findTaggedServiceIds($tagName, true) as $serviceId => $attributes) { - if (\in_array($serviceId, $exclude, true)) { - continue; - } - - $defaultPriority = null; - $defaultIndex = null; - $definition = $container->getDefinition($serviceId); - $class = $definition->getClass(); - $class = $container->getParameterBag()->resolveValue($class) ?: null; - $checkTaggedItem = !$definition->hasTag($definition->isAutoconfigured() ? 'container.ignore_attributes' : $tagName); - - foreach ($attributes as $attribute) { - $index = $priority = null; - - if (isset($attribute['priority'])) { - $priority = $attribute['priority']; - } elseif (null === $defaultPriority && $defaultPriorityMethod && $class) { - $defaultPriority = PriorityTaggedServiceUtil::getDefault($container, $serviceId, $class, $defaultPriorityMethod, $tagName, 'priority', $checkTaggedItem); - } - $priority ??= $defaultPriority ??= 0; - - if (null === $indexAttribute && !$defaultIndexMethod && !$needsIndexes) { - $services[] = [$priority, ++$i, null, $serviceId, null]; - continue 2; - } - - if (null !== $indexAttribute && isset($attribute[$indexAttribute])) { - $index = $attribute[$indexAttribute]; - } elseif (null === $defaultIndex && $defaultPriorityMethod && $class) { - $defaultIndex = PriorityTaggedServiceUtil::getDefault($container, $serviceId, $class, $defaultIndexMethod ?? 'getDefaultName', $tagName, $indexAttribute, $checkTaggedItem); - } - $index ??= $defaultIndex ??= $serviceId; - - $services[] = [$priority, ++$i, $index, $serviceId, $class]; - } - } - - uasort($services, static fn ($a, $b) => $b[0] <=> $a[0] ?: $a[1] <=> $b[1]); - - $refs = []; - foreach ($services as [, , $index, $serviceId, $class]) { - if (!$class) { - $reference = new Reference($serviceId); - } elseif ($index === $serviceId) { - $reference = new TypedReference($serviceId, $class); - } else { - $reference = new TypedReference($serviceId, $class, ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, $index); - } - - if (null === $index) { - $refs[] = $reference; - } else { - $refs[$index] = $reference; - } - } - - return $refs; - } -} - -/** - * @internal - */ -class PriorityTaggedServiceUtil -{ - public static function getDefault(ContainerBuilder $container, string $serviceId, string $class, string $defaultMethod, string $tagName, ?string $indexAttribute, bool $checkTaggedItem): string|int|null - { - if (!($r = $container->getReflectionClass($class)) || (!$checkTaggedItem && !$r->hasMethod($defaultMethod))) { - return null; - } - - if ($checkTaggedItem && !$r->hasMethod($defaultMethod)) { - foreach ($r->getAttributes(AsTaggedItem::class) as $attribute) { - return 'priority' === $indexAttribute ? $attribute->newInstance()->priority : $attribute->newInstance()->index; - } - - return null; - } - - if (null !== $indexAttribute) { - $service = $class !== $serviceId ? sprintf('service "%s"', $serviceId) : 'on the corresponding service'; - $message = [sprintf('Either method "%s::%s()" should ', $class, $defaultMethod), sprintf(' or tag "%s" on %s is missing attribute "%s".', $tagName, $service, $indexAttribute)]; - } else { - $message = [sprintf('Method "%s::%s()" should ', $class, $defaultMethod), '.']; - } - - if (!($rm = $r->getMethod($defaultMethod))->isStatic()) { - throw new InvalidArgumentException(implode('be static', $message)); - } - - if (!$rm->isPublic()) { - throw new InvalidArgumentException(implode('be public', $message)); - } - - $default = $rm->invoke(null); - - if ('priority' === $indexAttribute) { - if (!\is_int($default)) { - throw new InvalidArgumentException(implode(sprintf('return int (got "%s")', get_debug_type($default)), $message)); - } - - return $default; - } - - if (\is_int($default)) { - $default = (string) $default; - } - - if (!\is_string($default)) { - throw new InvalidArgumentException(implode(sprintf('return string|int (got "%s")', get_debug_type($default)), $message)); - } - - return $default; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php deleted file mode 100644 index 7a42a39..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php +++ /dev/null @@ -1,141 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Psr\Container\ContainerInterface as PsrContainerInterface; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\DependencyInjection\Argument\BoundArgument; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\TypedReference; -use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Contracts\Service\Attribute\SubscribedService; -use Symfony\Contracts\Service\ServiceProviderInterface; -use Symfony\Contracts\Service\ServiceSubscriberInterface; - -/** - * Compiler pass to register tagged services that require a service locator. - * - * @author Nicolas Grekas - */ -class RegisterServiceSubscribersPass extends AbstractRecursivePass -{ - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if (!$value instanceof Definition || $value->isAbstract() || $value->isSynthetic() || !$value->hasTag('container.service_subscriber')) { - return parent::processValue($value, $isRoot); - } - - $serviceMap = []; - $autowire = $value->isAutowired(); - - foreach ($value->getTag('container.service_subscriber') as $attributes) { - if (!$attributes) { - $autowire = true; - continue; - } - ksort($attributes); - if ([] !== array_diff(array_keys($attributes), ['id', 'key'])) { - throw new InvalidArgumentException(sprintf('The "container.service_subscriber" tag accepts only the "key" and "id" attributes, "%s" given for service "%s".', implode('", "', array_keys($attributes)), $this->currentId)); - } - if (!\array_key_exists('id', $attributes)) { - throw new InvalidArgumentException(sprintf('Missing "id" attribute on "container.service_subscriber" tag with key="%s" for service "%s".', $attributes['key'], $this->currentId)); - } - if (!\array_key_exists('key', $attributes)) { - $attributes['key'] = $attributes['id']; - } - if (isset($serviceMap[$attributes['key']])) { - continue; - } - $serviceMap[$attributes['key']] = new Reference($attributes['id']); - } - $class = $value->getClass(); - - if (!$r = $this->container->getReflectionClass($class)) { - throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $this->currentId)); - } - if (!$r->isSubclassOf(ServiceSubscriberInterface::class)) { - throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $this->currentId, ServiceSubscriberInterface::class)); - } - $class = $r->name; - // to remove when symfony/dependency-injection will stop being compatible with symfony/framework-bundle<6.0 - $replaceDeprecatedSession = $this->container->has('.session.deprecated') && $r->isSubclassOf(AbstractController::class); - $subscriberMap = []; - - foreach ($class::getSubscribedServices() as $key => $type) { - $attributes = []; - - if ($type instanceof SubscribedService) { - $key = $type->key; - $attributes = $type->attributes; - $type = ($type->nullable ? '?' : '').($type->type ?? throw new InvalidArgumentException(sprintf('When "%s::getSubscribedServices()" returns "%s", a type must be set.', $class, SubscribedService::class))); - } - - if (!\is_string($type) || !preg_match('/(?(DEFINE)(?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+))(?(DEFINE)(?(?&cn)(?:\\\\(?&cn))*+))^\??(?&fqcn)(?:(?:\|(?&fqcn))*+|(?:&(?&fqcn))*+)$/', $type)) { - throw new InvalidArgumentException(sprintf('"%s::getSubscribedServices()" must return valid PHP types for service "%s" key "%s", "%s" returned.', $class, $this->currentId, $key, \is_string($type) ? $type : get_debug_type($type))); - } - if ($optionalBehavior = '?' === $type[0]) { - $type = substr($type, 1); - $optionalBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; - } - if (\is_int($name = $key)) { - $key = $type; - $name = null; - } - if (!isset($serviceMap[$key])) { - if (!$autowire) { - throw new InvalidArgumentException(sprintf('Service "%s" misses a "container.service_subscriber" tag with "key"/"id" attributes corresponding to entry "%s" as returned by "%s::getSubscribedServices()".', $this->currentId, $key, $class)); - } - if ($replaceDeprecatedSession && SessionInterface::class === $type) { - // This prevents triggering the deprecation when building the container - // to remove when symfony/dependency-injection will stop being compatible with symfony/framework-bundle<6.0 - $type = '.session.deprecated'; - } - $serviceMap[$key] = new Reference($type); - } - - if ($name) { - if (false !== $i = strpos($name, '::get')) { - $name = lcfirst(substr($name, 5 + $i)); - } elseif (str_contains($name, '::')) { - $name = null; - } - } - - if (null !== $name && !$this->container->has($name) && !$this->container->has($type.' $'.$name)) { - $camelCaseName = lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $name)))); - $name = $this->container->has($type.' $'.$camelCaseName) ? $camelCaseName : $name; - } - - $subscriberMap[$key] = new TypedReference((string) $serviceMap[$key], $type, $optionalBehavior ?: ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $name, $attributes); - unset($serviceMap[$key]); - } - - if ($serviceMap = array_keys($serviceMap)) { - $message = sprintf(1 < \count($serviceMap) ? 'keys "%s" do' : 'key "%s" does', str_replace('%', '%%', implode('", "', $serviceMap))); - throw new InvalidArgumentException(sprintf('Service %s not exist in the map returned by "%s::getSubscribedServices()" for service "%s".', $message, $class, $this->currentId)); - } - - $locatorRef = ServiceLocatorTagPass::register($this->container, $subscriberMap, $this->currentId); - - $value->addTag('container.service_subscriber.locator', ['id' => (string) $locatorRef]); - - $value->setBindings([ - PsrContainerInterface::class => new BoundArgument($locatorRef, false), - ServiceProviderInterface::class => new BoundArgument($locatorRef, false), - ] + $value->getBindings()); - - return parent::processValue($value); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php deleted file mode 100644 index d0ebfcc..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Removes abstract Definitions. - */ -class RemoveAbstractDefinitionsPass implements CompilerPassInterface -{ - /** - * Removes abstract definitions from the ContainerBuilder. - * - * @return void - */ - public function process(ContainerBuilder $container) - { - foreach ($container->getDefinitions() as $id => $definition) { - if ($definition->isAbstract()) { - $container->removeDefinition($id); - $container->log($this, sprintf('Removed service "%s"; reason: abstract.', $id)); - } - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php deleted file mode 100644 index 93c3fd2..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Remove private aliases from the container. They were only used to establish - * dependencies between services, and these dependencies have been resolved in - * one of the previous passes. - * - * @author Johannes M. Schmitt - */ -class RemovePrivateAliasesPass implements CompilerPassInterface -{ - /** - * Removes private aliases from the ContainerBuilder. - * - * @return void - */ - public function process(ContainerBuilder $container) - { - foreach ($container->getAliases() as $id => $alias) { - if ($alias->isPublic()) { - continue; - } - - $container->removeAlias($id); - $container->log($this, sprintf('Removed service "%s"; reason: private alias.', $id)); - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php deleted file mode 100644 index df97a62..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php +++ /dev/null @@ -1,89 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Removes unused service definitions from the container. - * - * @author Johannes M. Schmitt - * @author Nicolas Grekas - */ -class RemoveUnusedDefinitionsPass extends AbstractRecursivePass -{ - private array $connectedIds = []; - - /** - * Processes the ContainerBuilder to remove unused definitions. - * - * @return void - */ - public function process(ContainerBuilder $container) - { - try { - $this->enableExpressionProcessing(); - $this->container = $container; - $connectedIds = []; - $aliases = $container->getAliases(); - - foreach ($aliases as $id => $alias) { - if ($alias->isPublic()) { - $this->connectedIds[] = (string) $aliases[$id]; - } - } - - foreach ($container->getDefinitions() as $id => $definition) { - if ($definition->isPublic()) { - $connectedIds[$id] = true; - $this->processValue($definition); - } - } - - while ($this->connectedIds) { - $ids = $this->connectedIds; - $this->connectedIds = []; - foreach ($ids as $id) { - if (!isset($connectedIds[$id]) && $container->hasDefinition($id)) { - $connectedIds[$id] = true; - $this->processValue($container->getDefinition($id)); - } - } - } - - foreach ($container->getDefinitions() as $id => $definition) { - if (!isset($connectedIds[$id])) { - $container->removeDefinition($id); - $container->resolveEnvPlaceholders(!$definition->hasErrors() ? serialize($definition) : $definition); - $container->log($this, sprintf('Removed service "%s"; reason: unused.', $id)); - } - } - } finally { - $this->container = null; - $this->connectedIds = []; - } - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if (!$value instanceof Reference) { - return parent::processValue($value, $isRoot); - } - - if (ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE !== $value->getInvalidBehavior()) { - $this->connectedIds[] = (string) $value; - } - - return $value; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php deleted file mode 100644 index 808cde2..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Replaces aliases with actual service definitions, effectively removing these - * aliases. - * - * @author Johannes M. Schmitt - */ -class ReplaceAliasByActualDefinitionPass extends AbstractRecursivePass -{ - private array $replacements; - - /** - * Process the Container to replace aliases with service definitions. - * - * @return void - * - * @throws InvalidArgumentException if the service definition does not exist - */ - public function process(ContainerBuilder $container) - { - // First collect all alias targets that need to be replaced - $seenAliasTargets = []; - $replacements = []; - - foreach ($container->getAliases() as $definitionId => $target) { - $targetId = (string) $target; - // Special case: leave this target alone - if ('service_container' === $targetId) { - continue; - } - // Check if target needs to be replaced - if (isset($replacements[$targetId])) { - $container->setAlias($definitionId, $replacements[$targetId])->setPublic($target->isPublic()); - - if ($target->isDeprecated()) { - $container->getAlias($definitionId)->setDeprecated(...array_values($target->getDeprecation('%alias_id%'))); - } - } - // No need to process the same target twice - if (isset($seenAliasTargets[$targetId])) { - continue; - } - // Process new target - $seenAliasTargets[$targetId] = true; - try { - $definition = $container->getDefinition($targetId); - } catch (ServiceNotFoundException $e) { - if ('' !== $e->getId() && '@' === $e->getId()[0]) { - throw new ServiceNotFoundException($e->getId(), $e->getSourceId(), null, [substr($e->getId(), 1)]); - } - - throw $e; - } - if ($definition->isPublic()) { - continue; - } - // Remove private definition and schedule for replacement - $definition->setPublic($target->isPublic()); - $container->setDefinition($definitionId, $definition); - $container->removeDefinition($targetId); - $replacements[$targetId] = $definitionId; - - if ($target->isPublic() && $target->isDeprecated()) { - $definition->addTag('container.private', $target->getDeprecation('%service_id%')); - } - } - $this->replacements = $replacements; - - parent::process($container); - $this->replacements = []; - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof Reference && isset($this->replacements[$referenceId = (string) $value])) { - // Perform the replacement - $newId = $this->replacements[$referenceId]; - $value = new Reference($newId, $value->getInvalidBehavior()); - $this->container->log($this, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $this->currentId, $referenceId, $newId)); - } - - return parent::processValue($value, $isRoot); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php deleted file mode 100644 index 4688376..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ChildDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; - -/** - * @author Nicolas Grekas - */ -class ResolveClassPass implements CompilerPassInterface -{ - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - foreach ($container->getDefinitions() as $id => $definition) { - if ($definition->isSynthetic() || null !== $definition->getClass()) { - continue; - } - if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $id)) { - if ($definition instanceof ChildDefinition && !class_exists($id)) { - throw new InvalidArgumentException(sprintf('Service definition "%s" has a parent but no class, and its name looks like an FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id)); - } - $definition->setClass($id); - } - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php deleted file mode 100644 index 49e5f36..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; - -/** - * @author Maxime Steinhausser - */ -class ResolveFactoryClassPass extends AbstractRecursivePass -{ - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof Definition && \is_array($factory = $value->getFactory()) && null === $factory[0]) { - if (null === $class = $value->getClass()) { - throw new RuntimeException(sprintf('The "%s" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?', $this->currentId)); - } - - $factory[0] = $class; - $value->setFactory($factory); - } - - return parent::processValue($value, $isRoot); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php deleted file mode 100644 index fbce044..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php +++ /dev/null @@ -1,178 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ChildDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; - -/** - * Applies instanceof conditionals to definitions. - * - * @author Nicolas Grekas - */ -class ResolveInstanceofConditionalsPass implements CompilerPassInterface -{ - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - foreach ($container->getAutoconfiguredInstanceof() as $interface => $definition) { - if ($definition->getArguments()) { - throw new InvalidArgumentException(sprintf('Autoconfigured instanceof for type "%s" defines arguments but these are not supported and should be removed.', $interface)); - } - } - - $tagsToKeep = []; - - if ($container->hasParameter('container.behavior_describing_tags')) { - $tagsToKeep = $container->getParameter('container.behavior_describing_tags'); - } - - foreach ($container->getDefinitions() as $id => $definition) { - $container->setDefinition($id, $this->processDefinition($container, $id, $definition, $tagsToKeep)); - } - - if ($container->hasParameter('container.behavior_describing_tags')) { - $container->getParameterBag()->remove('container.behavior_describing_tags'); - } - } - - private function processDefinition(ContainerBuilder $container, string $id, Definition $definition, array $tagsToKeep): Definition - { - $instanceofConditionals = $definition->getInstanceofConditionals(); - $autoconfiguredInstanceof = $definition->isAutoconfigured() ? $container->getAutoconfiguredInstanceof() : []; - if (!$instanceofConditionals && !$autoconfiguredInstanceof) { - return $definition; - } - - if (!$class = $container->getParameterBag()->resolveValue($definition->getClass())) { - return $definition; - } - - $conditionals = $this->mergeConditionals($autoconfiguredInstanceof, $instanceofConditionals, $container); - - $definition->setInstanceofConditionals([]); - $shared = null; - $instanceofTags = []; - $instanceofCalls = []; - $instanceofBindings = []; - $reflectionClass = null; - $parent = $definition instanceof ChildDefinition ? $definition->getParent() : null; - - foreach ($conditionals as $interface => $instanceofDefs) { - if ($interface !== $class && !($reflectionClass ??= $container->getReflectionClass($class, false) ?: false)) { - continue; - } - - if ($interface !== $class && !is_subclass_of($class, $interface)) { - continue; - } - - foreach ($instanceofDefs as $key => $instanceofDef) { - /** @var ChildDefinition $instanceofDef */ - $instanceofDef = clone $instanceofDef; - $instanceofDef->setAbstract(true)->setParent($parent ?: '.abstract.instanceof.'.$id); - $parent = '.instanceof.'.$interface.'.'.$key.'.'.$id; - $container->setDefinition($parent, $instanceofDef); - $instanceofTags[] = [$interface, $instanceofDef->getTags()]; - $instanceofBindings = $instanceofDef->getBindings() + $instanceofBindings; - - foreach ($instanceofDef->getMethodCalls() as $methodCall) { - $instanceofCalls[] = $methodCall; - } - - $instanceofDef->setTags([]); - $instanceofDef->setMethodCalls([]); - $instanceofDef->setBindings([]); - - if (isset($instanceofDef->getChanges()['shared'])) { - $shared = $instanceofDef->isShared(); - } - } - } - - if ($parent) { - $bindings = $definition->getBindings(); - $abstract = $container->setDefinition('.abstract.instanceof.'.$id, $definition); - $definition->setBindings([]); - $definition = serialize($definition); - - if (Definition::class === $abstract::class) { - // cast Definition to ChildDefinition - $definition = substr_replace($definition, '53', 2, 2); - $definition = substr_replace($definition, 'Child', 44, 0); - } - /** @var ChildDefinition $definition */ - $definition = unserialize($definition); - $definition->setParent($parent); - - if (null !== $shared && !isset($definition->getChanges()['shared'])) { - $definition->setShared($shared); - } - - // Don't add tags to service decorators - $i = \count($instanceofTags); - while (0 <= --$i) { - [$interface, $tags] = $instanceofTags[$i]; - foreach ($tags as $k => $v) { - if (null === $definition->getDecoratedService() || $interface === $definition->getClass() || \in_array($k, $tagsToKeep, true)) { - foreach ($v as $v) { - if ($definition->hasTag($k) && \in_array($v, $definition->getTag($k))) { - continue; - } - $definition->addTag($k, $v); - } - } - } - } - - $definition->setMethodCalls(array_merge($instanceofCalls, $definition->getMethodCalls())); - $definition->setBindings($bindings + $instanceofBindings); - - // reset fields with "merge" behavior - $abstract - ->setBindings([]) - ->setArguments([]) - ->setMethodCalls([]) - ->setDecoratedService(null) - ->setTags([]) - ->setAbstract(true); - } - - return $definition; - } - - private function mergeConditionals(array $autoconfiguredInstanceof, array $instanceofConditionals, ContainerBuilder $container): array - { - // make each value an array of ChildDefinition - $conditionals = array_map(fn ($childDef) => [$childDef], $autoconfiguredInstanceof); - - foreach ($instanceofConditionals as $interface => $instanceofDef) { - // make sure the interface/class exists (but don't validate automaticInstanceofConditionals) - if (!$container->getReflectionClass($interface)) { - throw new RuntimeException(sprintf('"%s" is set as an "instanceof" conditional, but it does not exist.', $interface)); - } - - if (!isset($autoconfiguredInstanceof[$interface])) { - $conditionals[$interface] = []; - } - - $conditionals[$interface][] = $instanceofDef; - } - - return $conditionals; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php deleted file mode 100644 index 7a2a69a..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\TypedReference; - -/** - * Emulates the invalid behavior if the reference is not found within the - * container. - * - * @author Johannes M. Schmitt - */ -class ResolveInvalidReferencesPass implements CompilerPassInterface -{ - private ContainerBuilder $container; - private RuntimeException $signalingException; - private string $currentId; - - /** - * Process the ContainerBuilder to resolve invalid references. - * - * @return void - */ - public function process(ContainerBuilder $container) - { - $this->container = $container; - $this->signalingException = new RuntimeException('Invalid reference.'); - - try { - foreach ($container->getDefinitions() as $this->currentId => $definition) { - $this->processValue($definition); - } - } finally { - unset($this->container, $this->signalingException); - } - } - - /** - * Processes arguments to determine invalid references. - * - * @throws RuntimeException When an invalid reference is found - */ - private function processValue(mixed $value, int $rootLevel = 0, int $level = 0): mixed - { - if ($value instanceof ServiceClosureArgument) { - $value->setValues($this->processValue($value->getValues(), 1, 1)); - } elseif ($value instanceof ArgumentInterface) { - $value->setValues($this->processValue($value->getValues(), $rootLevel, 1 + $level)); - } elseif ($value instanceof Definition) { - if ($value->isSynthetic() || $value->isAbstract()) { - return $value; - } - $value->setArguments($this->processValue($value->getArguments(), 0)); - $value->setProperties($this->processValue($value->getProperties(), 1)); - $value->setMethodCalls($this->processValue($value->getMethodCalls(), 2)); - } elseif (\is_array($value)) { - $i = 0; - - foreach ($value as $k => $v) { - try { - if (false !== $i && $k !== $i++) { - $i = false; - } - if ($v !== $processedValue = $this->processValue($v, $rootLevel, 1 + $level)) { - $value[$k] = $processedValue; - } - } catch (RuntimeException $e) { - if ($rootLevel < $level || ($rootLevel && !$level)) { - unset($value[$k]); - } elseif ($rootLevel) { - throw $e; - } else { - $value[$k] = null; - } - } - } - - // Ensure numerically indexed arguments have sequential numeric keys. - if (false !== $i) { - $value = array_values($value); - } - } elseif ($value instanceof Reference) { - if ($this->container->hasDefinition($id = (string) $value) ? !$this->container->getDefinition($id)->hasTag('container.excluded') : $this->container->hasAlias($id)) { - return $value; - } - - $currentDefinition = $this->container->getDefinition($this->currentId); - - // resolve decorated service behavior depending on decorator service - if ($currentDefinition->innerServiceId === $id && ContainerInterface::NULL_ON_INVALID_REFERENCE === $currentDefinition->decorationOnInvalid) { - return null; - } - - $invalidBehavior = $value->getInvalidBehavior(); - - if (ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior && $value instanceof TypedReference && !$this->container->has($id)) { - $e = new ServiceNotFoundException($id, $this->currentId); - - // since the error message varies by $id and $this->currentId, so should the id of the dummy errored definition - $this->container->register($id = sprintf('.errored.%s.%s', $this->currentId, $id), $value->getType()) - ->addError($e->getMessage()); - - return new TypedReference($id, $value->getType(), $value->getInvalidBehavior()); - } - - // resolve invalid behavior - if (ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) { - $value = null; - } elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) { - if (0 < $level || $rootLevel) { - throw $this->signalingException; - } - $value = null; - } - } - - return $value; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php deleted file mode 100644 index 12fe6a6..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Argument\AbstractArgument; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\VarExporter\ProxyHelper; - -/** - * Resolves named arguments to their corresponding numeric index. - * - * @author Kévin Dunglas - */ -class ResolveNamedArgumentsPass extends AbstractRecursivePass -{ - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof AbstractArgument && $value->getText().'.' === $value->getTextWithContext()) { - $value->setContext(sprintf('A value found in service "%s"', $this->currentId)); - } - - if (!$value instanceof Definition) { - return parent::processValue($value, $isRoot); - } - - $calls = $value->getMethodCalls(); - $calls[] = ['__construct', $value->getArguments()]; - - foreach ($calls as $i => $call) { - [$method, $arguments] = $call; - $parameters = null; - $resolvedKeys = []; - $resolvedArguments = []; - - foreach ($arguments as $key => $argument) { - if ($argument instanceof AbstractArgument && $argument->getText().'.' === $argument->getTextWithContext()) { - $argument->setContext(sprintf('Argument '.(\is_int($key) ? 1 + $key : '"%3$s"').' of '.('__construct' === $method ? 'service "%s"' : 'method call "%s::%s()"'), $this->currentId, $method, $key)); - } - - if (\is_int($key)) { - $resolvedKeys[$key] = $key; - $resolvedArguments[$key] = $argument; - continue; - } - - if (null === $parameters) { - $r = $this->getReflectionMethod($value, $method); - $class = $r instanceof \ReflectionMethod ? $r->class : $this->currentId; - $method = $r->getName(); - $parameters = $r->getParameters(); - } - - if (isset($key[0]) && '$' !== $key[0] && !class_exists($key) && !interface_exists($key, false)) { - throw new InvalidArgumentException(sprintf('Invalid service "%s": did you forget to add the "$" prefix to argument "%s"?', $this->currentId, $key)); - } - - if (isset($key[0]) && '$' === $key[0]) { - foreach ($parameters as $j => $p) { - if ($key === '$'.$p->name) { - if ($p->isVariadic() && \is_array($argument)) { - foreach ($argument as $variadicArgument) { - $resolvedKeys[$j] = $j; - $resolvedArguments[$j++] = $variadicArgument; - } - } else { - $resolvedKeys[$j] = $p->name; - $resolvedArguments[$j] = $argument; - } - - continue 2; - } - } - - throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument named "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key)); - } - - if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) { - throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, get_debug_type($argument))); - } - - $typeFound = false; - foreach ($parameters as $j => $p) { - if (!\array_key_exists($j, $resolvedArguments) && ProxyHelper::exportType($p, true) === $key) { - $resolvedKeys[$j] = $p->name; - $resolvedArguments[$j] = $argument; - $typeFound = true; - } - } - - if (!$typeFound) { - throw new InvalidArgumentException(sprintf('Invalid service "%s": method "%s()" has no argument type-hinted as "%s". Check your service definition.', $this->currentId, $class !== $this->currentId ? $class.'::'.$method : $method, $key)); - } - } - - if ($resolvedArguments !== $call[1]) { - ksort($resolvedArguments); - - if (!$value->isAutowired() && !array_is_list($resolvedArguments)) { - ksort($resolvedKeys); - $resolvedArguments = array_combine($resolvedKeys, $resolvedArguments); - } - - $calls[$i][1] = $resolvedArguments; - } - } - - [, $arguments] = array_pop($calls); - - if ($arguments !== $value->getArguments()) { - $value->setArguments($arguments); - } - if ($calls !== $value->getMethodCalls()) { - $value->setMethodCalls($calls); - } - - foreach ($value->getProperties() as $key => $argument) { - if ($argument instanceof AbstractArgument && $argument->getText().'.' === $argument->getTextWithContext()) { - $argument->setContext(sprintf('Property "%s" of service "%s"', $key, $this->currentId)); - } - } - - return parent::processValue($value, $isRoot); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php deleted file mode 100644 index c4a1412..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php +++ /dev/null @@ -1,102 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; - -/** - * Resolves all parameter placeholders "%somevalue%" to their real values. - * - * @author Johannes M. Schmitt - */ -class ResolveParameterPlaceHoldersPass extends AbstractRecursivePass -{ - private ParameterBagInterface $bag; - - public function __construct( - private bool $resolveArrays = true, - private bool $throwOnResolveException = true, - ) { - } - - /** - * @return void - * - * @throws ParameterNotFoundException - */ - public function process(ContainerBuilder $container) - { - $this->bag = $container->getParameterBag(); - - try { - parent::process($container); - - $aliases = []; - foreach ($container->getAliases() as $name => $target) { - $this->currentId = $name; - $aliases[$this->bag->resolveValue($name)] = $target; - } - $container->setAliases($aliases); - } catch (ParameterNotFoundException $e) { - $e->setSourceId($this->currentId); - - throw $e; - } - - $this->bag->resolve(); - unset($this->bag); - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if (\is_string($value)) { - try { - $v = $this->bag->resolveValue($value); - } catch (ParameterNotFoundException $e) { - if ($this->throwOnResolveException) { - throw $e; - } - - $v = null; - $this->container->getDefinition($this->currentId)->addError($e->getMessage()); - } - - return $this->resolveArrays || !$v || !\is_array($v) ? $v : $value; - } - if ($value instanceof Definition) { - $value->setBindings($this->processValue($value->getBindings())); - $changes = $value->getChanges(); - if (isset($changes['class'])) { - $value->setClass($this->bag->resolveValue($value->getClass())); - } - if (isset($changes['file'])) { - $value->setFile($this->bag->resolveValue($value->getFile())); - } - $tags = $value->getTags(); - if (isset($tags['proxy'])) { - $tags['proxy'] = $this->bag->resolveValue($tags['proxy']); - $value->setTags($tags); - } - } - - $value = parent::processValue($value, $isRoot); - - if ($value && \is_array($value)) { - $value = array_combine($this->bag->resolveValue(array_keys($value)), $value); - } - - return $value; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php deleted file mode 100644 index 3176d40..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\Reference; - -/** - * Replaces all references to aliases with references to the actual service. - * - * @author Johannes M. Schmitt - */ -class ResolveReferencesToAliasesPass extends AbstractRecursivePass -{ - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - parent::process($container); - - foreach ($container->getAliases() as $id => $alias) { - $aliasId = (string) $alias; - $this->currentId = $id; - - if ($aliasId !== $defId = $this->getDefinitionId($aliasId, $container)) { - $container->setAlias($id, $defId)->setPublic($alias->isPublic()); - } - } - } - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if (!$value instanceof Reference) { - return parent::processValue($value, $isRoot); - } - - $defId = $this->getDefinitionId($id = (string) $value, $this->container); - - return $defId !== $id ? new Reference($defId, $value->getInvalidBehavior()) : $value; - } - - private function getDefinitionId(string $id, ContainerBuilder $container): string - { - if (!$container->hasAlias($id)) { - return $id; - } - - $alias = $container->getAlias($id); - - if ($alias->isDeprecated()) { - $referencingDefinition = $container->hasDefinition($this->currentId) ? $container->getDefinition($this->currentId) : $container->getAlias($this->currentId); - if (!$referencingDefinition->isDeprecated()) { - $deprecation = $alias->getDeprecation($id); - trigger_deprecation($deprecation['package'], $deprecation['version'], rtrim($deprecation['message'], '. ').'. It is being referenced by the "%s" '.($container->hasDefinition($this->currentId) ? 'service.' : 'alias.'), $this->currentId); - } - } - - $seen = []; - do { - if (isset($seen[$id])) { - throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), [$id])); - } - - $seen[$id] = true; - $id = (string) $container->getAlias($id); - } while ($container->hasAlias($id)); - - return $id; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php deleted file mode 100644 index 96ac6db..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php +++ /dev/null @@ -1,52 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Psr\Container\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Contracts\Service\ServiceProviderInterface; - -/** - * Compiler pass to inject their service locator to service subscribers. - * - * @author Nicolas Grekas - */ -class ResolveServiceSubscribersPass extends AbstractRecursivePass -{ - private ?string $serviceLocator = null; - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof Reference && $this->serviceLocator && \in_array((string) $value, [ContainerInterface::class, ServiceProviderInterface::class], true)) { - return new Reference($this->serviceLocator); - } - - if (!$value instanceof Definition) { - return parent::processValue($value, $isRoot); - } - - $serviceLocator = $this->serviceLocator; - $this->serviceLocator = null; - - if ($value->hasTag('container.service_subscriber.locator')) { - $this->serviceLocator = $value->getTag('container.service_subscriber.locator')[0]['id']; - $value->clearTag('container.service_subscriber.locator'); - } - - try { - return parent::processValue($value); - } finally { - $this->serviceLocator = $serviceLocator; - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php deleted file mode 100644 index 67103a7..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; -use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ServiceLocator; - -/** - * Applies the "container.service_locator" tag by wrapping references into ServiceClosureArgument instances. - * - * @author Nicolas Grekas - */ -final class ServiceLocatorTagPass extends AbstractRecursivePass -{ - use PriorityTaggedServiceTrait; - - protected function processValue(mixed $value, bool $isRoot = false): mixed - { - if ($value instanceof ServiceLocatorArgument) { - if ($value->getTaggedIteratorArgument()) { - $value->setValues($this->findAndSortTaggedServices($value->getTaggedIteratorArgument(), $this->container)); - } - - return self::register($this->container, $value->getValues()); - } - - if ($value instanceof Definition) { - $value->setBindings(parent::processValue($value->getBindings())); - } - - if (!$value instanceof Definition || !$value->hasTag('container.service_locator')) { - return parent::processValue($value, $isRoot); - } - - if (!$value->getClass()) { - $value->setClass(ServiceLocator::class); - } - - $services = $value->getArguments()[0] ?? null; - - if ($services instanceof TaggedIteratorArgument) { - $services = $this->findAndSortTaggedServices($services, $this->container); - } - - if (!\is_array($services)) { - throw new InvalidArgumentException(sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set.', $this->currentId)); - } - - $i = 0; - - foreach ($services as $k => $v) { - if ($v instanceof ServiceClosureArgument) { - continue; - } - - if ($i === $k) { - if ($v instanceof Reference) { - unset($services[$k]); - $k = (string) $v; - } - ++$i; - } elseif (\is_int($k)) { - $i = null; - } - - $services[$k] = new ServiceClosureArgument($v); - } - ksort($services); - - $value->setArgument(0, $services); - - $id = '.service_locator.'.ContainerBuilder::hash($value); - - if ($isRoot) { - if ($id !== $this->currentId) { - $this->container->setAlias($id, new Alias($this->currentId, false)); - } - - return $value; - } - - $this->container->setDefinition($id, $value->setPublic(false)); - - return new Reference($id); - } - - public static function register(ContainerBuilder $container, array $map, string $callerId = null): Reference - { - foreach ($map as $k => $v) { - $map[$k] = new ServiceClosureArgument($v); - } - - $locator = (new Definition(ServiceLocator::class)) - ->addArgument($map) - ->addTag('container.service_locator'); - - if (null !== $callerId && $container->hasDefinition($callerId)) { - $locator->setBindings($container->getDefinition($callerId)->getBindings()); - } - - if (!$container->hasDefinition($id = '.service_locator.'.ContainerBuilder::hash($locator))) { - $container->setDefinition($id, $locator); - } - - if (null !== $callerId) { - $locatorId = $id; - // Locators are shared when they hold the exact same list of factories; - // to have them specialized per consumer service, we use a cloning factory - // to derivate customized instances from the prototype one. - $container->register($id .= '.'.$callerId, ServiceLocator::class) - ->setFactory([new Reference($locatorId), 'withContext']) - ->addTag('container.service_locator_context', ['id' => $callerId]) - ->addArgument($callerId) - ->addArgument(new Reference('service_container')); - } - - return new Reference($id); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php deleted file mode 100644 index c90fc7a..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php +++ /dev/null @@ -1,99 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Reference; - -/** - * This is a directed graph of your services. - * - * This information can be used by your compiler passes instead of collecting - * it themselves which improves performance quite a lot. - * - * @author Johannes M. Schmitt - * - * @final - */ -class ServiceReferenceGraph -{ - /** - * @var ServiceReferenceGraphNode[] - */ - private array $nodes = []; - - public function hasNode(string $id): bool - { - return isset($this->nodes[$id]); - } - - /** - * Gets a node by identifier. - * - * @throws InvalidArgumentException if no node matches the supplied identifier - */ - public function getNode(string $id): ServiceReferenceGraphNode - { - if (!isset($this->nodes[$id])) { - throw new InvalidArgumentException(sprintf('There is no node with id "%s".', $id)); - } - - return $this->nodes[$id]; - } - - /** - * Returns all nodes. - * - * @return ServiceReferenceGraphNode[] - */ - public function getNodes(): array - { - return $this->nodes; - } - - /** - * Clears all nodes. - */ - public function clear(): void - { - foreach ($this->nodes as $node) { - $node->clear(); - } - $this->nodes = []; - } - - /** - * Connects 2 nodes together in the Graph. - */ - public function connect(?string $sourceId, mixed $sourceValue, ?string $destId, mixed $destValue = null, Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false): void - { - if (null === $sourceId || null === $destId) { - return; - } - - $sourceNode = $this->createNode($sourceId, $sourceValue); - $destNode = $this->createNode($destId, $destValue); - $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak, $byConstructor); - - $sourceNode->addOutEdge($edge); - $destNode->addInEdge($edge); - } - - private function createNode(string $id, mixed $value): ServiceReferenceGraphNode - { - if (isset($this->nodes[$id]) && $this->nodes[$id]->getValue() === $value) { - return $this->nodes[$id]; - } - - return $this->nodes[$id] = new ServiceReferenceGraphNode($id, $value); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php deleted file mode 100644 index b607164..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -/** - * Represents an edge in your service graph. - * - * Value is typically a reference. - * - * @author Johannes M. Schmitt - */ -class ServiceReferenceGraphEdge -{ - private ServiceReferenceGraphNode $sourceNode; - private ServiceReferenceGraphNode $destNode; - private mixed $value; - private bool $lazy; - private bool $weak; - private bool $byConstructor; - - public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, mixed $value = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false) - { - $this->sourceNode = $sourceNode; - $this->destNode = $destNode; - $this->value = $value; - $this->lazy = $lazy; - $this->weak = $weak; - $this->byConstructor = $byConstructor; - } - - /** - * Returns the value of the edge. - */ - public function getValue(): mixed - { - return $this->value; - } - - /** - * Returns the source node. - */ - public function getSourceNode(): ServiceReferenceGraphNode - { - return $this->sourceNode; - } - - /** - * Returns the destination node. - */ - public function getDestNode(): ServiceReferenceGraphNode - { - return $this->destNode; - } - - /** - * Returns true if the edge is lazy, meaning it's a dependency not requiring direct instantiation. - */ - public function isLazy(): bool - { - return $this->lazy; - } - - /** - * Returns true if the edge is weak, meaning it shouldn't prevent removing the target service. - */ - public function isWeak(): bool - { - return $this->weak; - } - - /** - * Returns true if the edge links with a constructor argument. - */ - public function isReferencedByConstructor(): bool - { - return $this->byConstructor; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php b/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php deleted file mode 100644 index e7f42f8..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php +++ /dev/null @@ -1,114 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Definition; - -/** - * Represents a node in your service graph. - * - * Value is typically a definition, or an alias. - * - * @author Johannes M. Schmitt - */ -class ServiceReferenceGraphNode -{ - private string $id; - private array $inEdges = []; - private array $outEdges = []; - private mixed $value; - - public function __construct(string $id, mixed $value) - { - $this->id = $id; - $this->value = $value; - } - - /** - * @return void - */ - public function addInEdge(ServiceReferenceGraphEdge $edge) - { - $this->inEdges[] = $edge; - } - - /** - * @return void - */ - public function addOutEdge(ServiceReferenceGraphEdge $edge) - { - $this->outEdges[] = $edge; - } - - /** - * Checks if the value of this node is an Alias. - */ - public function isAlias(): bool - { - return $this->value instanceof Alias; - } - - /** - * Checks if the value of this node is a Definition. - */ - public function isDefinition(): bool - { - return $this->value instanceof Definition; - } - - /** - * Returns the identifier. - */ - public function getId(): string - { - return $this->id; - } - - /** - * Returns the in edges. - * - * @return ServiceReferenceGraphEdge[] - */ - public function getInEdges(): array - { - return $this->inEdges; - } - - /** - * Returns the out edges. - * - * @return ServiceReferenceGraphEdge[] - */ - public function getOutEdges(): array - { - return $this->outEdges; - } - - /** - * Returns the value of this Node. - */ - public function getValue(): mixed - { - return $this->value; - } - - /** - * Clears all edges. - * - * @return void - */ - public function clear() - { - $this->inEdges = $this->outEdges = []; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php b/tests/integration/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php deleted file mode 100644 index b066b5f..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Config/ContainerParametersResource.php +++ /dev/null @@ -1,44 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Config; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * Tracks container parameters. - * - * @author Maxime Steinhausser - * - * @final - */ -class ContainerParametersResource implements ResourceInterface -{ - private array $parameters; - - /** - * @param array $parameters The container parameters to track - */ - public function __construct(array $parameters) - { - $this->parameters = $parameters; - } - - public function __toString(): string - { - return 'container_parameters_'.hash('xxh128', serialize($this->parameters)); - } - - public function getParameters(): array - { - return $this->parameters; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php b/tests/integration/vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php deleted file mode 100644 index 619c5e1..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Config; - -use Symfony\Component\Config\Resource\ResourceInterface; -use Symfony\Component\Config\ResourceCheckerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * @author Maxime Steinhausser - */ -class ContainerParametersResourceChecker implements ResourceCheckerInterface -{ - private ContainerInterface $container; - - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - public function supports(ResourceInterface $metadata): bool - { - return $metadata instanceof ContainerParametersResource; - } - - public function isFresh(ResourceInterface $resource, int $timestamp): bool - { - foreach ($resource->getParameters() as $key => $value) { - if (!$this->container->hasParameter($key) || $this->container->getParameter($key) !== $value) { - return false; - } - } - - return true; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Container.php b/tests/integration/vendor/symfony/dependency-injection/Container.php deleted file mode 100644 index 2b9eeb8..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Container.php +++ /dev/null @@ -1,420 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; -use Symfony\Component\DependencyInjection\Argument\ServiceLocator as ArgumentServiceLocator; -use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; -use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; -use Symfony\Contracts\Service\ResetInterface; - -// Help opcache.preload discover always-needed symbols -class_exists(RewindableGenerator::class); -class_exists(ArgumentServiceLocator::class); - -/** - * Container is a dependency injection container. - * - * It gives access to object instances (services). - * Services and parameters are simple key/pair stores. - * The container can have four possible behaviors when a service - * does not exist (or is not initialized for the last case): - * - * * EXCEPTION_ON_INVALID_REFERENCE: Throws an exception at compilation time (the default) - * * NULL_ON_INVALID_REFERENCE: Returns null - * * IGNORE_ON_INVALID_REFERENCE: Ignores the wrapping command asking for the reference - * (for instance, ignore a setter if the service does not exist) - * * IGNORE_ON_UNINITIALIZED_REFERENCE: Ignores/returns null for uninitialized services or invalid references - * * RUNTIME_EXCEPTION_ON_INVALID_REFERENCE: Throws an exception at runtime - * - * @author Fabien Potencier - * @author Johannes M. Schmitt - */ -class Container implements ContainerInterface, ResetInterface -{ - protected $parameterBag; - protected $services = []; - protected $privates = []; - protected $fileMap = []; - protected $methodMap = []; - protected $factories = []; - protected $aliases = []; - protected $loading = []; - protected $resolving = []; - protected $syntheticIds = []; - - private array $envCache = []; - private bool $compiled = false; - private \Closure $getEnv; - - private static $make; - - public function __construct(ParameterBagInterface $parameterBag = null) - { - $this->parameterBag = $parameterBag ?? new EnvPlaceholderParameterBag(); - } - - /** - * Compiles the container. - * - * This method does two things: - * - * * Parameter values are resolved; - * * The parameter bag is frozen. - * - * @return void - */ - public function compile() - { - $this->parameterBag->resolve(); - - $this->parameterBag = new FrozenParameterBag( - $this->parameterBag->all(), - $this->parameterBag instanceof ParameterBag ? $this->parameterBag->allDeprecated() : [] - ); - - $this->compiled = true; - } - - /** - * Returns true if the container is compiled. - */ - public function isCompiled(): bool - { - return $this->compiled; - } - - /** - * Gets the service container parameter bag. - */ - public function getParameterBag(): ParameterBagInterface - { - return $this->parameterBag; - } - - /** - * Gets a parameter. - * - * @return array|bool|string|int|float|\UnitEnum|null - * - * @throws ParameterNotFoundException if the parameter is not defined - */ - public function getParameter(string $name) - { - return $this->parameterBag->get($name); - } - - public function hasParameter(string $name): bool - { - return $this->parameterBag->has($name); - } - - /** - * @return void - */ - public function setParameter(string $name, array|bool|string|int|float|\UnitEnum|null $value) - { - $this->parameterBag->set($name, $value); - } - - /** - * Sets a service. - * - * Setting a synthetic service to null resets it: has() returns false and get() - * behaves in the same way as if the service was never created. - * - * @return void - */ - public function set(string $id, ?object $service) - { - // Runs the internal initializer; used by the dumped container to include always-needed files - if (isset($this->privates['service_container']) && $this->privates['service_container'] instanceof \Closure) { - $initialize = $this->privates['service_container']; - unset($this->privates['service_container']); - $initialize($this); - } - - if ('service_container' === $id) { - throw new InvalidArgumentException('You cannot set service "service_container".'); - } - - if (!(isset($this->fileMap[$id]) || isset($this->methodMap[$id]))) { - if (isset($this->syntheticIds[$id]) || !isset($this->getRemovedIds()[$id])) { - // no-op - } elseif (null === $service) { - throw new InvalidArgumentException(sprintf('The "%s" service is private, you cannot unset it.', $id)); - } else { - throw new InvalidArgumentException(sprintf('The "%s" service is private, you cannot replace it.', $id)); - } - } elseif (isset($this->services[$id])) { - throw new InvalidArgumentException(sprintf('The "%s" service is already initialized, you cannot replace it.', $id)); - } - - if (isset($this->aliases[$id])) { - unset($this->aliases[$id]); - } - - if (null === $service) { - unset($this->services[$id]); - - return; - } - - $this->services[$id] = $service; - } - - public function has(string $id): bool - { - if (isset($this->aliases[$id])) { - $id = $this->aliases[$id]; - } - if (isset($this->services[$id])) { - return true; - } - if ('service_container' === $id) { - return true; - } - - return isset($this->fileMap[$id]) || isset($this->methodMap[$id]); - } - - /** - * Gets a service. - * - * @throws ServiceCircularReferenceException When a circular reference is detected - * @throws ServiceNotFoundException When the service is not defined - * @throws \Exception if an exception has been thrown when the service has been resolved - * - * @see Reference - */ - public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object - { - return $this->services[$id] - ?? $this->services[$id = $this->aliases[$id] ?? $id] - ?? ('service_container' === $id ? $this : ($this->factories[$id] ?? self::$make ??= self::make(...))($this, $id, $invalidBehavior)); - } - - /** - * Creates a service. - * - * As a separate method to allow "get()" to use the really fast `??` operator. - */ - private static function make(self $container, string $id, int $invalidBehavior): ?object - { - if (isset($container->loading[$id])) { - throw new ServiceCircularReferenceException($id, array_merge(array_keys($container->loading), [$id])); - } - - $container->loading[$id] = true; - - try { - if (isset($container->fileMap[$id])) { - return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $container->load($container->fileMap[$id]); - } elseif (isset($container->methodMap[$id])) { - return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $container->{$container->methodMap[$id]}($container); - } - } catch (\Exception $e) { - unset($container->services[$id]); - - throw $e; - } finally { - unset($container->loading[$id]); - } - - if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { - if (!$id) { - throw new ServiceNotFoundException($id); - } - if (isset($container->syntheticIds[$id])) { - throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service is synthetic, it needs to be set at boot time before it can be used.', $id)); - } - if (isset($container->getRemovedIds()[$id])) { - throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.', $id)); - } - - $alternatives = []; - foreach ($container->getServiceIds() as $knownId) { - if ('' === $knownId || '.' === $knownId[0]) { - continue; - } - $lev = levenshtein($id, $knownId); - if ($lev <= \strlen($id) / 3 || str_contains($knownId, $id)) { - $alternatives[] = $knownId; - } - } - - throw new ServiceNotFoundException($id, null, null, $alternatives); - } - - return null; - } - - /** - * Returns true if the given service has actually been initialized. - */ - public function initialized(string $id): bool - { - if (isset($this->aliases[$id])) { - $id = $this->aliases[$id]; - } - - if ('service_container' === $id) { - return false; - } - - return isset($this->services[$id]); - } - - /** - * @return void - */ - public function reset() - { - $services = $this->services + $this->privates; - $this->services = $this->factories = $this->privates = []; - - foreach ($services as $service) { - try { - if ($service instanceof ResetInterface) { - $service->reset(); - } - } catch (\Throwable) { - continue; - } - } - } - - /** - * Gets all service ids. - * - * @return string[] - */ - public function getServiceIds(): array - { - return array_map('strval', array_unique(array_merge(['service_container'], array_keys($this->fileMap), array_keys($this->methodMap), array_keys($this->aliases), array_keys($this->services)))); - } - - /** - * Gets service ids that existed at compile time. - */ - public function getRemovedIds(): array - { - return []; - } - - /** - * Camelizes a string. - */ - public static function camelize(string $id): string - { - return strtr(ucwords(strtr($id, ['_' => ' ', '.' => '_ ', '\\' => '_ '])), [' ' => '']); - } - - /** - * A string to underscore. - */ - public static function underscore(string $id): string - { - return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\2', '\\1_\\2'], str_replace('_', '.', $id))); - } - - /** - * Creates a service by requiring its factory file. - * - * @return mixed - */ - protected function load(string $file) - { - return require $file; - } - - /** - * Fetches a variable from the environment. - * - * @throws EnvNotFoundException When the environment variable is not found and has no default value - */ - protected function getEnv(string $name): mixed - { - if (isset($this->resolving[$envName = "env($name)"])) { - throw new ParameterCircularReferenceException(array_keys($this->resolving)); - } - if (isset($this->envCache[$name]) || \array_key_exists($name, $this->envCache)) { - return $this->envCache[$name]; - } - if (!$this->has($id = 'container.env_var_processors_locator')) { - $this->set($id, new ServiceLocator([])); - } - $this->getEnv ??= $this->getEnv(...); - $processors = $this->get($id); - - if (false !== $i = strpos($name, ':')) { - $prefix = substr($name, 0, $i); - $localName = substr($name, 1 + $i); - } else { - $prefix = 'string'; - $localName = $name; - } - - if ($processors->has($prefix)) { - $processor = $processors->get($prefix); - } else { - $processor = new EnvVarProcessor($this); - if (false === $i) { - $prefix = ''; - } - } - - $this->resolving[$envName] = true; - try { - return $this->envCache[$name] = $processor->getEnv($prefix, $localName, $this->getEnv); - } finally { - unset($this->resolving[$envName]); - } - } - - /** - * @internal - */ - final protected function getService(string|false $registry, string $id, ?string $method, string|bool $load): mixed - { - if ('service_container' === $id) { - return $this; - } - if (\is_string($load)) { - throw new RuntimeException($load); - } - if (null === $method) { - return false !== $registry ? $this->{$registry}[$id] ?? null : null; - } - if (false !== $registry) { - return $this->{$registry}[$id] ??= $load ? $this->load($method) : $this->{$method}($this); - } - if (!$load) { - return $this->{$method}($this); - } - - return ($factory = $this->factories[$id] ?? $this->factories['service_container'][$id] ?? null) ? $factory($this) : $this->load($method); - } - - private function __clone() - { - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ContainerAwareInterface.php b/tests/integration/vendor/symfony/dependency-injection/ContainerAwareInterface.php deleted file mode 100644 index 084a321..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ContainerAwareInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -/** - * ContainerAwareInterface should be implemented by classes that depends on a Container. - * - * @author Fabien Potencier - */ -interface ContainerAwareInterface -{ - /** - * Sets the container. - * - * @return void - */ - public function setContainer(?ContainerInterface $container); -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ContainerAwareTrait.php b/tests/integration/vendor/symfony/dependency-injection/ContainerAwareTrait.php deleted file mode 100644 index 457d967..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ContainerAwareTrait.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -/** - * ContainerAware trait. - * - * @author Fabien Potencier - */ -trait ContainerAwareTrait -{ - /** - * @var ContainerInterface|null - */ - protected $container; - - /** - * @return void - */ - public function setContainer(ContainerInterface $container = null) - { - if (1 > \func_num_args()) { - trigger_deprecation('symfony/dependency-injection', '6.2', 'Calling "%s::%s()" without any arguments is deprecated, pass null explicitly instead.', __CLASS__, __FUNCTION__); - } - - $this->container = $container; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ContainerBuilder.php b/tests/integration/vendor/symfony/dependency-injection/ContainerBuilder.php deleted file mode 100644 index a7a9c14..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ContainerBuilder.php +++ /dev/null @@ -1,1721 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Composer\InstalledVersions; -use Symfony\Component\Config\Resource\ClassExistenceResource; -use Symfony\Component\Config\Resource\ComposerResource; -use Symfony\Component\Config\Resource\DirectoryResource; -use Symfony\Component\Config\Resource\FileExistenceResource; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Resource\GlobResource; -use Symfony\Component\Config\Resource\ReflectionClassResource; -use Symfony\Component\Config\Resource\ResourceInterface; -use Symfony\Component\DependencyInjection\Argument\AbstractArgument; -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Argument\LazyClosure; -use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceLocator; -use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; -use Symfony\Component\DependencyInjection\Attribute\Target; -use Symfony\Component\DependencyInjection\Compiler\Compiler; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\Compiler\PassConfig; -use Symfony\Component\DependencyInjection\Compiler\ResolveEnvPlaceholdersPass; -use Symfony\Component\DependencyInjection\Exception\BadMethodCallException; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface; -use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\LazyServiceInstantiator; -use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator; -use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; -use Symfony\Component\ExpressionLanguage\Expression; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -/** - * ContainerBuilder is a DI container that provides an API to easily describe services. - * - * @author Fabien Potencier - */ -class ContainerBuilder extends Container implements TaggedContainerInterface -{ - /** - * @var array - */ - private array $extensions = []; - - /** - * @var array - */ - private array $extensionsByNs = []; - - /** - * @var array - */ - private array $definitions = []; - - /** - * @var array - */ - private array $aliasDefinitions = []; - - /** - * @var array - */ - private array $resources = []; - - /** - * @var array>> - */ - private array $extensionConfigs = []; - - private Compiler $compiler; - private bool $trackResources; - private InstantiatorInterface $proxyInstantiator; - private ExpressionLanguage $expressionLanguage; - - /** - * @var ExpressionFunctionProviderInterface[] - */ - private array $expressionLanguageProviders = []; - - /** - * @var string[] with tag names used by findTaggedServiceIds - */ - private array $usedTags = []; - - /** - * @var string[][] a map of env var names to their placeholders - */ - private array $envPlaceholders = []; - - /** - * @var int[] a map of env vars to their resolution counter - */ - private array $envCounters = []; - - /** - * @var string[] the list of vendor directories - */ - private array $vendors; - - /** - * @var string[] the list of paths in vendor directories - */ - private array $pathsInVendor = []; - - /** - * @var array - */ - private array $autoconfiguredInstanceof = []; - - /** - * @var array - */ - private array $autoconfiguredAttributes = []; - - /** - * @var array - */ - private array $removedIds = []; - - /** - * @var array - */ - private array $removedBindingIds = []; - - private const INTERNAL_TYPES = [ - 'int' => true, - 'float' => true, - 'string' => true, - 'bool' => true, - 'resource' => true, - 'object' => true, - 'array' => true, - 'null' => true, - 'callable' => true, - 'iterable' => true, - 'mixed' => true, - ]; - - public function __construct(ParameterBagInterface $parameterBag = null) - { - parent::__construct($parameterBag); - - $this->trackResources = interface_exists(ResourceInterface::class); - $this->setDefinition('service_container', (new Definition(ContainerInterface::class))->setSynthetic(true)->setPublic(true)); - } - - /** - * @var array - */ - private array $classReflectors; - - /** - * Sets the track resources flag. - * - * If you are not using the loaders and therefore don't want - * to depend on the Config component, set this flag to false. - * - * @return void - */ - public function setResourceTracking(bool $track) - { - $this->trackResources = $track; - } - - /** - * Checks if resources are tracked. - */ - public function isTrackingResources(): bool - { - return $this->trackResources; - } - - /** - * Sets the instantiator to be used when fetching proxies. - * - * @return void - */ - public function setProxyInstantiator(InstantiatorInterface $proxyInstantiator) - { - $this->proxyInstantiator = $proxyInstantiator; - } - - /** - * @return void - */ - public function registerExtension(ExtensionInterface $extension) - { - $this->extensions[$extension->getAlias()] = $extension; - - if (false !== $extension->getNamespace()) { - $this->extensionsByNs[$extension->getNamespace()] = $extension; - } - } - - /** - * Returns an extension by alias or namespace. - * - * @throws LogicException if the extension is not registered - */ - public function getExtension(string $name): ExtensionInterface - { - if (isset($this->extensions[$name])) { - return $this->extensions[$name]; - } - - if (isset($this->extensionsByNs[$name])) { - return $this->extensionsByNs[$name]; - } - - throw new LogicException(sprintf('Container extension "%s" is not registered.', $name)); - } - - /** - * Returns all registered extensions. - * - * @return array - */ - public function getExtensions(): array - { - return $this->extensions; - } - - /** - * Checks if we have an extension. - */ - public function hasExtension(string $name): bool - { - return isset($this->extensions[$name]) || isset($this->extensionsByNs[$name]); - } - - /** - * Returns an array of resources loaded to build this configuration. - * - * @return ResourceInterface[] - */ - public function getResources(): array - { - return array_values($this->resources); - } - - /** - * @return $this - */ - public function addResource(ResourceInterface $resource): static - { - if (!$this->trackResources) { - return $this; - } - - if ($resource instanceof GlobResource && $this->inVendors($resource->getPrefix())) { - return $this; - } - - $this->resources[(string) $resource] = $resource; - - return $this; - } - - /** - * Sets the resources for this configuration. - * - * @param array $resources - * - * @return $this - */ - public function setResources(array $resources): static - { - if (!$this->trackResources) { - return $this; - } - - $this->resources = $resources; - - return $this; - } - - /** - * Adds the object class hierarchy as resources. - * - * @param object|string $object An object instance or class name - * - * @return $this - */ - public function addObjectResource(object|string $object): static - { - if ($this->trackResources) { - if (\is_object($object)) { - $object = $object::class; - } - if (!isset($this->classReflectors[$object])) { - $this->classReflectors[$object] = new \ReflectionClass($object); - } - $class = $this->classReflectors[$object]; - - foreach ($class->getInterfaceNames() as $name) { - if (null === $interface = &$this->classReflectors[$name]) { - $interface = new \ReflectionClass($name); - } - $file = $interface->getFileName(); - if (false !== $file && file_exists($file)) { - $this->fileExists($file); - } - } - do { - $file = $class->getFileName(); - if (false !== $file && file_exists($file)) { - $this->fileExists($file); - } - foreach ($class->getTraitNames() as $name) { - $this->addObjectResource($name); - } - } while ($class = $class->getParentClass()); - } - - return $this; - } - - /** - * Retrieves the requested reflection class and registers it for resource tracking. - * - * @throws \ReflectionException when a parent class/interface/trait is not found and $throw is true - * - * @final - */ - public function getReflectionClass(?string $class, bool $throw = true): ?\ReflectionClass - { - if (!$class = $this->getParameterBag()->resolveValue($class)) { - return null; - } - - if (isset(self::INTERNAL_TYPES[$class])) { - return null; - } - - $resource = $classReflector = null; - - try { - if (isset($this->classReflectors[$class])) { - $classReflector = $this->classReflectors[$class]; - } elseif (class_exists(ClassExistenceResource::class)) { - $resource = new ClassExistenceResource($class, false); - $classReflector = $resource->isFresh(0) ? false : new \ReflectionClass($class); - } else { - $classReflector = class_exists($class) ? new \ReflectionClass($class) : false; - } - } catch (\ReflectionException $e) { - if ($throw) { - throw $e; - } - } - - if ($this->trackResources) { - if (!$classReflector) { - $this->addResource($resource ?? new ClassExistenceResource($class, false)); - } elseif (!$classReflector->isInternal()) { - $path = $classReflector->getFileName(); - - if (!$this->inVendors($path)) { - $this->addResource(new ReflectionClassResource($classReflector, $this->vendors)); - } - } - $this->classReflectors[$class] = $classReflector; - } - - return $classReflector ?: null; - } - - /** - * Checks whether the requested file or directory exists and registers the result for resource tracking. - * - * @param string $path The file or directory path for which to check the existence - * @param bool|string $trackContents Whether to track contents of the given resource. If a string is passed, - * it will be used as pattern for tracking contents of the requested directory - * - * @final - */ - public function fileExists(string $path, bool|string $trackContents = true): bool - { - $exists = file_exists($path); - - if (!$this->trackResources || $this->inVendors($path)) { - return $exists; - } - - if (!$exists) { - $this->addResource(new FileExistenceResource($path)); - - return $exists; - } - - if (is_dir($path)) { - if ($trackContents) { - $this->addResource(new DirectoryResource($path, \is_string($trackContents) ? $trackContents : null)); - } else { - $this->addResource(new GlobResource($path, '/*', false)); - } - } elseif ($trackContents) { - $this->addResource(new FileResource($path)); - } - - return $exists; - } - - /** - * Loads the configuration for an extension. - * - * @param string $extension The extension alias or namespace - * @param array|null $values An array of values that customizes the extension - * - * @return $this - * - * @throws BadMethodCallException When this ContainerBuilder is compiled - * @throws \LogicException if the extension is not registered - */ - public function loadFromExtension(string $extension, array $values = null): static - { - if ($this->isCompiled()) { - throw new BadMethodCallException('Cannot load from an extension on a compiled container.'); - } - - $namespace = $this->getExtension($extension)->getAlias(); - - $this->extensionConfigs[$namespace][] = $values ?? []; - - return $this; - } - - /** - * Adds a compiler pass. - * - * @param string $type The type of compiler pass - * @param int $priority Used to sort the passes - * - * @return $this - */ - public function addCompilerPass(CompilerPassInterface $pass, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0): static - { - $this->getCompiler()->addPass($pass, $type, $priority); - - $this->addObjectResource($pass); - - return $this; - } - - /** - * Returns the compiler pass config which can then be modified. - */ - public function getCompilerPassConfig(): PassConfig - { - return $this->getCompiler()->getPassConfig(); - } - - /** - * Returns the compiler. - */ - public function getCompiler(): Compiler - { - return $this->compiler ??= new Compiler(); - } - - /** - * Sets a service. - * - * @return void - * - * @throws BadMethodCallException When this ContainerBuilder is compiled - */ - public function set(string $id, ?object $service) - { - if ($this->isCompiled() && (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())) { - // setting a synthetic service on a compiled container is alright - throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a compiled container is not allowed.', $id)); - } - - unset($this->definitions[$id], $this->aliasDefinitions[$id], $this->removedIds[$id]); - - parent::set($id, $service); - } - - /** - * Removes a service definition. - * - * @return void - */ - public function removeDefinition(string $id) - { - if (isset($this->definitions[$id])) { - unset($this->definitions[$id]); - $this->removedIds[$id] = true; - } - } - - public function has(string $id): bool - { - return isset($this->definitions[$id]) || isset($this->aliasDefinitions[$id]) || parent::has($id); - } - - /** - * @throws InvalidArgumentException when no definitions are available - * @throws ServiceCircularReferenceException When a circular reference is detected - * @throws ServiceNotFoundException When the service is not defined - * @throws \Exception - * - * @see Reference - */ - public function get(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): ?object - { - if ($this->isCompiled() && isset($this->removedIds[$id])) { - return ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $invalidBehavior ? parent::get($id) : null; - } - - return $this->doGet($id, $invalidBehavior); - } - - private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = null, bool $isConstructorArgument = false): mixed - { - if (isset($inlineServices[$id])) { - return $inlineServices[$id]; - } - if (null === $inlineServices) { - $isConstructorArgument = true; - $inlineServices = []; - } - try { - if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) { - return $this->privates[$id] ?? parent::get($id, $invalidBehavior); - } - if (null !== $service = $this->privates[$id] ?? parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) { - return $service; - } - } catch (ServiceCircularReferenceException $e) { - if ($isConstructorArgument) { - throw $e; - } - } - - if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) { - $alias = $this->aliasDefinitions[$id]; - - if ($alias->isDeprecated()) { - $deprecation = $alias->getDeprecation($id); - trigger_deprecation($deprecation['package'], $deprecation['version'], $deprecation['message']); - } - - return $this->doGet((string) $alias, $invalidBehavior, $inlineServices, $isConstructorArgument); - } - - try { - $definition = $this->getDefinition($id); - } catch (ServiceNotFoundException $e) { - if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $invalidBehavior) { - return null; - } - - throw $e; - } - - if ($definition->hasErrors() && $e = $definition->getErrors()) { - throw new RuntimeException(reset($e)); - } - - if ($isConstructorArgument) { - $this->loading[$id] = true; - } - - try { - return $this->createService($definition, $inlineServices, $isConstructorArgument, $id); - } finally { - if ($isConstructorArgument) { - unset($this->loading[$id]); - } - } - } - - /** - * Merges a ContainerBuilder with the current ContainerBuilder configuration. - * - * Service definitions overrides the current defined ones. - * - * But for parameters, they are overridden by the current ones. It allows - * the parameters passed to the container constructor to have precedence - * over the loaded ones. - * - * $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar'])); - * $loader = new LoaderXXX($container); - * $loader->load('resource_name'); - * $container->register('foo', 'stdClass'); - * - * In the above example, even if the loaded resource defines a foo - * parameter, the value will still be 'bar' as defined in the ContainerBuilder - * constructor. - * - * @return void - * - * @throws BadMethodCallException When this ContainerBuilder is compiled - */ - public function merge(self $container) - { - if ($this->isCompiled()) { - throw new BadMethodCallException('Cannot merge on a compiled container.'); - } - - foreach ($container->getDefinitions() as $id => $definition) { - if (!$definition->hasTag('container.excluded') || !$this->has($id)) { - $this->setDefinition($id, $definition); - } - } - $this->addAliases($container->getAliases()); - $parameterBag = $this->getParameterBag(); - $otherBag = $container->getParameterBag(); - $parameterBag->add($otherBag->all()); - - if ($parameterBag instanceof ParameterBag && $otherBag instanceof ParameterBag) { - foreach ($otherBag->allDeprecated() as $name => $deprecated) { - $parameterBag->deprecate($name, ...$deprecated); - } - } - - if ($this->trackResources) { - foreach ($container->getResources() as $resource) { - $this->addResource($resource); - } - } - - foreach ($this->extensions as $name => $extension) { - if (!isset($this->extensionConfigs[$name])) { - $this->extensionConfigs[$name] = []; - } - - $this->extensionConfigs[$name] = array_merge($this->extensionConfigs[$name], $container->getExtensionConfig($name)); - } - - if ($parameterBag instanceof EnvPlaceholderParameterBag && $otherBag instanceof EnvPlaceholderParameterBag) { - $envPlaceholders = $otherBag->getEnvPlaceholders(); - $parameterBag->mergeEnvPlaceholders($otherBag); - } else { - $envPlaceholders = []; - } - - foreach ($container->envCounters as $env => $count) { - if (!$count && !isset($envPlaceholders[$env])) { - continue; - } - if (!isset($this->envCounters[$env])) { - $this->envCounters[$env] = $count; - } else { - $this->envCounters[$env] += $count; - } - } - - foreach ($container->getAutoconfiguredInstanceof() as $interface => $childDefinition) { - if (isset($this->autoconfiguredInstanceof[$interface])) { - throw new InvalidArgumentException(sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same class/interface.', $interface)); - } - - $this->autoconfiguredInstanceof[$interface] = $childDefinition; - } - - foreach ($container->getAutoconfiguredAttributes() as $attribute => $configurator) { - if (isset($this->autoconfiguredAttributes[$attribute])) { - throw new InvalidArgumentException(sprintf('"%s" has already been autoconfigured and merge() does not support merging autoconfiguration for the same attribute.', $attribute)); - } - - $this->autoconfiguredAttributes[$attribute] = $configurator; - } - } - - /** - * Returns the configuration array for the given extension. - * - * @return array> - */ - public function getExtensionConfig(string $name): array - { - if (!isset($this->extensionConfigs[$name])) { - $this->extensionConfigs[$name] = []; - } - - return $this->extensionConfigs[$name]; - } - - /** - * Prepends a config array to the configs of the given extension. - * - * @param array $config - * - * @return void - */ - public function prependExtensionConfig(string $name, array $config) - { - if (!isset($this->extensionConfigs[$name])) { - $this->extensionConfigs[$name] = []; - } - - array_unshift($this->extensionConfigs[$name], $config); - } - - /** - * Deprecates a service container parameter. - * - * @throws ParameterNotFoundException if the parameter is not defined - */ - public function deprecateParameter(string $name, string $package, string $version, string $message = 'The parameter "%s" is deprecated.'): void - { - if (!$this->parameterBag instanceof ParameterBag) { - throw new BadMethodCallException(sprintf('The parameter bag must be an instance of "%s" to call "%s".', ParameterBag::class, __METHOD__)); - } - - $this->parameterBag->deprecate($name, $package, $version, $message); - } - - /** - * Compiles the container. - * - * This method passes the container to compiler - * passes whose job is to manipulate and optimize - * the container. - * - * The main compiler passes roughly do four things: - * - * * The extension configurations are merged; - * * Parameter values are resolved; - * * The parameter bag is frozen; - * * Extension loading is disabled. - * - * @param bool $resolveEnvPlaceholders Whether %env()% parameters should be resolved using the current - * env vars or be replaced by uniquely identifiable placeholders. - * Set to "true" when you want to use the current ContainerBuilder - * directly, keep to "false" when the container is dumped instead. - * - * @return void - */ - public function compile(bool $resolveEnvPlaceholders = false) - { - $compiler = $this->getCompiler(); - - if ($this->trackResources) { - foreach ($compiler->getPassConfig()->getPasses() as $pass) { - $this->addObjectResource($pass); - } - } - $bag = $this->getParameterBag(); - - if ($resolveEnvPlaceholders && $bag instanceof EnvPlaceholderParameterBag) { - $compiler->addPass(new ResolveEnvPlaceholdersPass(), PassConfig::TYPE_AFTER_REMOVING, -1000); - } - - $compiler->compile($this); - - foreach ($this->definitions as $id => $definition) { - if ($this->trackResources && $definition->isLazy()) { - $this->getReflectionClass($definition->getClass()); - } - } - - $this->extensionConfigs = []; - - if ($bag instanceof EnvPlaceholderParameterBag) { - if ($resolveEnvPlaceholders) { - $this->parameterBag = new ParameterBag($this->resolveEnvPlaceholders($bag->all(), true)); - } - - $this->envPlaceholders = $bag->getEnvPlaceholders(); - } - - parent::compile(); - - foreach ($this->definitions + $this->aliasDefinitions as $id => $definition) { - if (!$definition->isPublic() || $definition->isPrivate()) { - $this->removedIds[$id] = true; - } - } - } - - public function getServiceIds(): array - { - return array_map('strval', array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds()))); - } - - /** - * Gets removed service or alias ids. - * - * @return array - */ - public function getRemovedIds(): array - { - return $this->removedIds; - } - - /** - * Adds the service aliases. - * - * @param array $aliases - * - * @return void - */ - public function addAliases(array $aliases) - { - foreach ($aliases as $alias => $id) { - $this->setAlias($alias, $id); - } - } - - /** - * Sets the service aliases. - * - * @param array $aliases - * - * @return void - */ - public function setAliases(array $aliases) - { - $this->aliasDefinitions = []; - $this->addAliases($aliases); - } - - /** - * Sets an alias for an existing service. - * - * @throws InvalidArgumentException if the id is not a string or an Alias - * @throws InvalidArgumentException if the alias is for itself - */ - public function setAlias(string $alias, string|Alias $id): Alias - { - if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== strcspn($alias, "\0\r\n'")) { - throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias)); - } - - if (\is_string($id)) { - $id = new Alias($id); - } - - if ($alias === (string) $id) { - throw new InvalidArgumentException(sprintf('An alias cannot reference itself, got a circular reference on "%s".', $alias)); - } - - unset($this->definitions[$alias], $this->removedIds[$alias]); - - return $this->aliasDefinitions[$alias] = $id; - } - - /** - * @return void - */ - public function removeAlias(string $alias) - { - if (isset($this->aliasDefinitions[$alias])) { - unset($this->aliasDefinitions[$alias]); - $this->removedIds[$alias] = true; - } - } - - public function hasAlias(string $id): bool - { - return isset($this->aliasDefinitions[$id]); - } - - /** - * @return array - */ - public function getAliases(): array - { - return $this->aliasDefinitions; - } - - /** - * @throws InvalidArgumentException if the alias does not exist - */ - public function getAlias(string $id): Alias - { - if (!isset($this->aliasDefinitions[$id])) { - throw new InvalidArgumentException(sprintf('The service alias "%s" does not exist.', $id)); - } - - return $this->aliasDefinitions[$id]; - } - - /** - * Registers a service definition. - * - * This methods allows for simple registration of service definition - * with a fluid interface. - */ - public function register(string $id, string $class = null): Definition - { - return $this->setDefinition($id, new Definition($class)); - } - - /** - * Registers an autowired service definition. - * - * This method implements a shortcut for using setDefinition() with - * an autowired definition. - */ - public function autowire(string $id, string $class = null): Definition - { - return $this->setDefinition($id, (new Definition($class))->setAutowired(true)); - } - - /** - * Adds the service definitions. - * - * @param array $definitions - * - * @return void - */ - public function addDefinitions(array $definitions) - { - foreach ($definitions as $id => $definition) { - $this->setDefinition($id, $definition); - } - } - - /** - * Sets the service definitions. - * - * @param array $definitions - * - * @return void - */ - public function setDefinitions(array $definitions) - { - $this->definitions = []; - $this->addDefinitions($definitions); - } - - /** - * Gets all service definitions. - * - * @return array - */ - public function getDefinitions(): array - { - return $this->definitions; - } - - /** - * Sets a service definition. - * - * @throws BadMethodCallException When this ContainerBuilder is compiled - */ - public function setDefinition(string $id, Definition $definition): Definition - { - if ($this->isCompiled()) { - throw new BadMethodCallException('Adding definition to a compiled container is not allowed.'); - } - - if ('' === $id || '\\' === $id[-1] || \strlen($id) !== strcspn($id, "\0\r\n'")) { - throw new InvalidArgumentException(sprintf('Invalid service id: "%s".', $id)); - } - - unset($this->aliasDefinitions[$id], $this->removedIds[$id]); - - return $this->definitions[$id] = $definition; - } - - /** - * Returns true if a service definition exists under the given identifier. - */ - public function hasDefinition(string $id): bool - { - return isset($this->definitions[$id]); - } - - /** - * Gets a service definition. - * - * @throws ServiceNotFoundException if the service definition does not exist - */ - public function getDefinition(string $id): Definition - { - if (!isset($this->definitions[$id])) { - throw new ServiceNotFoundException($id); - } - - return $this->definitions[$id]; - } - - /** - * Gets a service definition by id or alias. - * - * The method "unaliases" recursively to return a Definition instance. - * - * @throws ServiceNotFoundException if the service definition does not exist - */ - public function findDefinition(string $id): Definition - { - $seen = []; - while (isset($this->aliasDefinitions[$id])) { - $id = (string) $this->aliasDefinitions[$id]; - - if (isset($seen[$id])) { - $seen = array_values($seen); - $seen = \array_slice($seen, array_search($id, $seen)); - $seen[] = $id; - - throw new ServiceCircularReferenceException($id, $seen); - } - - $seen[$id] = $id; - } - - return $this->getDefinition($id); - } - - /** - * Creates a service for a service definition. - * - * @throws RuntimeException When the factory definition is incomplete - * @throws RuntimeException When the service is a synthetic service - * @throws InvalidArgumentException When configure callable is not callable - */ - private function createService(Definition $definition, array &$inlineServices, bool $isConstructorArgument = false, string $id = null, bool|object $tryProxy = true): mixed - { - if (null === $id && isset($inlineServices[$h = spl_object_hash($definition)])) { - return $inlineServices[$h]; - } - - if ($definition instanceof ChildDefinition) { - throw new RuntimeException(sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id)); - } - - if ($definition->isSynthetic()) { - throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id)); - } - - if ($definition->isDeprecated()) { - $deprecation = $definition->getDeprecation($id); - trigger_deprecation($deprecation['package'], $deprecation['version'], $deprecation['message']); - } - - $parameterBag = $this->getParameterBag(); - $class = $parameterBag->resolveValue($definition->getClass()) ?: (['Closure', 'fromCallable'] === $definition->getFactory() ? 'Closure' : null); - - if (['Closure', 'fromCallable'] === $definition->getFactory() && ('Closure' !== $class || $definition->isLazy())) { - $callable = $parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArgument(0))); - - if ($callable instanceof Reference || $callable instanceof Definition) { - $callable = [$callable, '__invoke']; - } - - if (\is_array($callable) && ( - $callable[0] instanceof Reference - || $callable[0] instanceof Definition && !isset($inlineServices[spl_object_hash($callable[0])]) - )) { - $initializer = function () use ($callable, &$inlineServices) { - return $this->doResolveServices($callable[0], $inlineServices); - }; - - $proxy = eval('return '.LazyClosure::getCode('$initializer', $callable, $definition, $this, $id).';'); - $this->shareService($definition, $proxy, $id, $inlineServices); - - return $proxy; - } - } - - if (true === $tryProxy && $definition->isLazy() && ['Closure', 'fromCallable'] !== $definition->getFactory() - && !$tryProxy = !($proxy = $this->proxyInstantiator ??= new LazyServiceInstantiator()) || $proxy instanceof RealServiceInstantiator - ) { - $proxy = $proxy->instantiateProxy( - $this, - (clone $definition) - ->setClass($class) - ->setTags(($definition->hasTag('proxy') ? ['proxy' => $parameterBag->resolveValue($definition->getTag('proxy'))] : []) + $definition->getTags()), - $id, function ($proxy = false) use ($definition, &$inlineServices, $id) { - return $this->createService($definition, $inlineServices, true, $id, $proxy); - } - ); - $this->shareService($definition, $proxy, $id, $inlineServices); - - return $proxy; - } - - if (null !== $definition->getFile()) { - require_once $parameterBag->resolveValue($definition->getFile()); - } - - $arguments = $definition->getArguments(); - - if (null !== $factory = $definition->getFactory()) { - if (\is_array($factory)) { - $factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]]; - } elseif (!\is_string($factory)) { - throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory.', $id)); - } elseif (str_starts_with($factory, '@=')) { - $factory = fn (ServiceLocator $arguments) => $this->getExpressionLanguage()->evaluate(substr($factory, 2), ['container' => $this, 'args' => $arguments]); - $arguments = [new ServiceLocatorArgument($arguments)]; - } - } - - $arguments = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($arguments)), $inlineServices, $isConstructorArgument); - - if (null !== $id && $definition->isShared() && (isset($this->services[$id]) || isset($this->privates[$id])) && (true === $tryProxy || !$definition->isLazy())) { - return $this->services[$id] ?? $this->privates[$id]; - } - - if (!array_is_list($arguments)) { - $arguments = array_combine(array_map(fn ($k) => preg_replace('/^.*\\$/', '', $k), array_keys($arguments)), $arguments); - } - - if (null !== $factory) { - $service = $factory(...$arguments); - - if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) { - $r = new \ReflectionClass($factory[0]); - - if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) { - trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" factory class. It should either be deprecated or its factory upgraded.', $id, $r->name); - } - } - } else { - $r = new \ReflectionClass($class); - - if (\is_object($tryProxy)) { - if ($r->getConstructor()) { - $tryProxy->__construct(...$arguments); - } - - $service = $tryProxy; - } else { - $service = $r->getConstructor() ? $r->newInstanceArgs($arguments) : $r->newInstance(); - } - - if (!$definition->isDeprecated() && 0 < strpos($r->getDocComment(), "\n * @deprecated ")) { - trigger_deprecation('', '', 'The "%s" service relies on the deprecated "%s" class. It should either be deprecated or its implementation upgraded.', $id, $r->name); - } - } - - $lastWitherIndex = null; - foreach ($definition->getMethodCalls() as $k => $call) { - if ($call[2] ?? false) { - $lastWitherIndex = $k; - } - } - - if (null === $lastWitherIndex && (true === $tryProxy || !$definition->isLazy())) { - // share only if proxying failed, or if not a proxy, and if no withers are found - $this->shareService($definition, $service, $id, $inlineServices); - } - - $properties = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())), $inlineServices); - foreach ($properties as $name => $value) { - $service->$name = $value; - } - - foreach ($definition->getMethodCalls() as $k => $call) { - $service = $this->callMethod($service, $call, $inlineServices); - - if ($lastWitherIndex === $k && (true === $tryProxy || !$definition->isLazy())) { - // share only if proxying failed, or if not a proxy, and this is the last wither - $this->shareService($definition, $service, $id, $inlineServices); - } - } - - if ($callable = $definition->getConfigurator()) { - if (\is_array($callable)) { - $callable[0] = $parameterBag->resolveValue($callable[0]); - - if ($callable[0] instanceof Reference) { - $callable[0] = $this->doGet((string) $callable[0], $callable[0]->getInvalidBehavior(), $inlineServices); - } elseif ($callable[0] instanceof Definition) { - $callable[0] = $this->createService($callable[0], $inlineServices); - } - } - - if (!\is_callable($callable)) { - throw new InvalidArgumentException(sprintf('The configure callable for class "%s" is not a callable.', get_debug_type($service))); - } - - $callable($service); - } - - return $service; - } - - /** - * Replaces service references by the real service instance and evaluates expressions. - * - * @return mixed The same value with all service references replaced by - * the real service instances and all expressions evaluated - */ - public function resolveServices(mixed $value): mixed - { - return $this->doResolveServices($value); - } - - private function doResolveServices(mixed $value, array &$inlineServices = [], bool $isConstructorArgument = false): mixed - { - if (\is_array($value)) { - foreach ($value as $k => $v) { - $value[$k] = $this->doResolveServices($v, $inlineServices, $isConstructorArgument); - } - } elseif ($value instanceof ServiceClosureArgument) { - $reference = $value->getValues()[0]; - $value = fn () => $this->resolveServices($reference); - } elseif ($value instanceof IteratorArgument) { - $value = new RewindableGenerator(function () use ($value, &$inlineServices) { - foreach ($value->getValues() as $k => $v) { - foreach (self::getServiceConditionals($v) as $s) { - if (!$this->has($s)) { - continue 2; - } - } - foreach (self::getInitializedConditionals($v) as $s) { - if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE, $inlineServices)) { - continue 2; - } - } - - yield $k => $this->doResolveServices($v, $inlineServices); - } - }, function () use ($value): int { - $count = 0; - foreach ($value->getValues() as $v) { - foreach (self::getServiceConditionals($v) as $s) { - if (!$this->has($s)) { - continue 2; - } - } - foreach (self::getInitializedConditionals($v) as $s) { - if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)) { - continue 2; - } - } - - ++$count; - } - - return $count; - }); - } elseif ($value instanceof ServiceLocatorArgument) { - $refs = $types = []; - foreach ($value->getValues() as $k => $v) { - $refs[$k] = [$v, null]; - $types[$k] = $v instanceof TypedReference ? $v->getType() : '?'; - } - $value = new ServiceLocator($this->resolveServices(...), $refs, $types); - } elseif ($value instanceof Reference) { - $value = $this->doGet((string) $value, $value->getInvalidBehavior(), $inlineServices, $isConstructorArgument); - } elseif ($value instanceof Definition) { - $value = $this->createService($value, $inlineServices, $isConstructorArgument); - } elseif ($value instanceof Parameter) { - $value = $this->getParameter((string) $value); - } elseif ($value instanceof Expression) { - $value = $this->getExpressionLanguage()->evaluate($value, ['container' => $this]); - } elseif ($value instanceof AbstractArgument) { - throw new RuntimeException($value->getTextWithContext()); - } - - return $value; - } - - /** - * Returns service ids for a given tag. - * - * Example: - * - * $container->register('foo')->addTag('my.tag', ['hello' => 'world']); - * - * $serviceIds = $container->findTaggedServiceIds('my.tag'); - * foreach ($serviceIds as $serviceId => $tags) { - * foreach ($tags as $tag) { - * echo $tag['hello']; - * } - * } - * - * @return array An array of tags with the tagged service as key, holding a list of attribute arrays - */ - public function findTaggedServiceIds(string $name, bool $throwOnAbstract = false): array - { - $this->usedTags[] = $name; - $tags = []; - foreach ($this->getDefinitions() as $id => $definition) { - if ($definition->hasTag($name) && !$definition->hasTag('container.excluded')) { - if ($throwOnAbstract && $definition->isAbstract()) { - throw new InvalidArgumentException(sprintf('The service "%s" tagged "%s" must not be abstract.', $id, $name)); - } - $tags[$id] = $definition->getTag($name); - } - } - - return $tags; - } - - /** - * Returns all tags the defined services use. - * - * @return string[] - */ - public function findTags(): array - { - $tags = []; - foreach ($this->getDefinitions() as $id => $definition) { - $tags[] = array_keys($definition->getTags()); - } - - return array_unique(array_merge([], ...$tags)); - } - - /** - * Returns all tags not queried by findTaggedServiceIds. - * - * @return string[] - */ - public function findUnusedTags(): array - { - return array_values(array_diff($this->findTags(), $this->usedTags)); - } - - /** - * @return void - */ - public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) - { - $this->expressionLanguageProviders[] = $provider; - } - - /** - * @return ExpressionFunctionProviderInterface[] - */ - public function getExpressionLanguageProviders(): array - { - return $this->expressionLanguageProviders; - } - - /** - * Returns a ChildDefinition that will be used for autoconfiguring the interface/class. - */ - public function registerForAutoconfiguration(string $interface): ChildDefinition - { - if (!isset($this->autoconfiguredInstanceof[$interface])) { - $this->autoconfiguredInstanceof[$interface] = new ChildDefinition(''); - } - - return $this->autoconfiguredInstanceof[$interface]; - } - - /** - * Registers an attribute that will be used for autoconfiguring annotated classes. - * - * The third argument passed to the callable is the reflector of the - * class/method/property/parameter that the attribute targets. Using one or many of - * \ReflectionClass|\ReflectionMethod|\ReflectionProperty|\ReflectionParameter as a type-hint - * for this argument allows filtering which attributes should be passed to the callable. - * - * @template T - * - * @param class-string $attributeClass - * @param callable(ChildDefinition, T, \Reflector): void $configurator - */ - public function registerAttributeForAutoconfiguration(string $attributeClass, callable $configurator): void - { - $this->autoconfiguredAttributes[$attributeClass] = $configurator; - } - - /** - * Registers an autowiring alias that only binds to a specific argument name. - * - * The argument name is derived from $name if provided (from $id otherwise) - * using camel case: "foo.bar" or "foo_bar" creates an alias bound to - * "$fooBar"-named arguments with $type as type-hint. Such arguments will - * receive the service $id when autowiring is used. - */ - public function registerAliasForArgument(string $id, string $type, string $name = null): Alias - { - $name = (new Target($name ?? $id))->name; - - if (!preg_match('/^[a-zA-Z_\x7f-\xff]/', $name)) { - throw new InvalidArgumentException(sprintf('Invalid argument name "%s" for service "%s": the first character must be a letter.', $name, $id)); - } - - return $this->setAlias($type.' $'.$name, $id); - } - - /** - * Returns an array of ChildDefinition[] keyed by interface. - * - * @return array - */ - public function getAutoconfiguredInstanceof(): array - { - return $this->autoconfiguredInstanceof; - } - - /** - * @return array - */ - public function getAutoconfiguredAttributes(): array - { - return $this->autoconfiguredAttributes; - } - - /** - * Resolves env parameter placeholders in a string or an array. - * - * @param string|true|null $format A sprintf() format returning the replacement for each env var name or - * null to resolve back to the original "%env(VAR)%" format or - * true to resolve to the actual values of the referenced env vars - * @param array &$usedEnvs Env vars found while resolving are added to this array - * - * @return mixed The value with env parameters resolved if a string or an array is passed - */ - public function resolveEnvPlaceholders(mixed $value, string|bool $format = null, array &$usedEnvs = null): mixed - { - $bag = $this->getParameterBag(); - if (true === $format ??= '%%env(%s)%%') { - $value = $bag->resolveValue($value); - } - - if ($value instanceof Definition) { - $value = (array) $value; - } - - if (\is_array($value)) { - $result = []; - foreach ($value as $k => $v) { - $result[\is_string($k) ? $this->resolveEnvPlaceholders($k, $format, $usedEnvs) : $k] = $this->resolveEnvPlaceholders($v, $format, $usedEnvs); - } - - return $result; - } - - if (!\is_string($value) || 38 > \strlen($value) || false === stripos($value, 'env_')) { - return $value; - } - $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; - - $completed = false; - preg_match_all('/env_[a-f0-9]{16}_\w+_[a-f0-9]{32}/Ui', $value, $matches); - $usedPlaceholders = array_flip($matches[0]); - foreach ($envPlaceholders as $env => $placeholders) { - foreach ($placeholders as $placeholder) { - if (isset($usedPlaceholders[$placeholder])) { - if (true === $format) { - $resolved = $bag->escapeValue($this->getEnv($env)); - } else { - $resolved = sprintf($format, $env); - } - if ($placeholder === $value) { - $value = $resolved; - $completed = true; - } else { - if (!\is_string($resolved) && !is_numeric($resolved)) { - throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, get_debug_type($resolved), $this->resolveEnvPlaceholders($value))); - } - $value = str_ireplace($placeholder, $resolved, $value); - } - $usedEnvs[$env] = $env; - $this->envCounters[$env] = isset($this->envCounters[$env]) ? 1 + $this->envCounters[$env] : 1; - - if ($completed) { - break 2; - } - } - } - } - - return $value; - } - - /** - * Get statistics about env usage. - * - * @return int[] The number of time each env vars has been resolved - */ - public function getEnvCounters(): array - { - $bag = $this->getParameterBag(); - $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; - - foreach ($envPlaceholders as $env => $placeholders) { - if (!isset($this->envCounters[$env])) { - $this->envCounters[$env] = 0; - } - } - - return $this->envCounters; - } - - /** - * @final - */ - public function log(CompilerPassInterface $pass, string $message): void - { - $this->getCompiler()->log($pass, $this->resolveEnvPlaceholders($message)); - } - - /** - * Checks whether a class is available and will remain available in the "no-dev" mode of Composer. - * - * When parent packages are provided and if any of them is in dev-only mode, - * the class will be considered available even if it is also in dev-only mode. - * - * @throws \LogicException If dependencies have been installed with Composer 1 - */ - final public static function willBeAvailable(string $package, string $class, array $parentPackages): bool - { - if (!class_exists(InstalledVersions::class)) { - throw new \LogicException(sprintf('Calling "%s" when dependencies have been installed with Composer 1 is not supported. Consider upgrading to Composer 2.', __METHOD__)); - } - - if (!class_exists($class) && !interface_exists($class, false) && !trait_exists($class, false)) { - return false; - } - - if (!InstalledVersions::isInstalled($package) || InstalledVersions::isInstalled($package, false)) { - return true; - } - - // the package is installed but in dev-mode only, check if this applies to one of the parent packages too - - $rootPackage = InstalledVersions::getRootPackage()['name'] ?? ''; - - if ('symfony/symfony' === $rootPackage) { - return true; - } - - foreach ($parentPackages as $parentPackage) { - if ($rootPackage === $parentPackage || (InstalledVersions::isInstalled($parentPackage) && !InstalledVersions::isInstalled($parentPackage, false))) { - return true; - } - } - - return false; - } - - /** - * Gets removed binding ids. - * - * @return array - * - * @internal - */ - public function getRemovedBindingIds(): array - { - return $this->removedBindingIds; - } - - /** - * Removes bindings for a service. - * - * @internal - */ - public function removeBindings(string $id): void - { - if ($this->hasDefinition($id)) { - foreach ($this->getDefinition($id)->getBindings() as $key => $binding) { - [, $bindingId] = $binding->getValues(); - $this->removedBindingIds[(int) $bindingId] = true; - } - } - } - - /** - * @return string[] - * - * @internal - */ - public static function getServiceConditionals(mixed $value): array - { - $services = []; - - if (\is_array($value)) { - foreach ($value as $v) { - $services = array_unique(array_merge($services, self::getServiceConditionals($v))); - } - } elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) { - $services[] = (string) $value; - } - - return $services; - } - - /** - * @return string[] - * - * @internal - */ - public static function getInitializedConditionals(mixed $value): array - { - $services = []; - - if (\is_array($value)) { - foreach ($value as $v) { - $services = array_unique(array_merge($services, self::getInitializedConditionals($v))); - } - } elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior()) { - $services[] = (string) $value; - } - - return $services; - } - - /** - * Computes a reasonably unique hash of a serializable value. - */ - public static function hash(mixed $value): string - { - $hash = substr(base64_encode(hash('sha256', serialize($value), true)), 0, 7); - - return str_replace(['/', '+'], ['.', '_'], $hash); - } - - protected function getEnv(string $name): mixed - { - $value = parent::getEnv($name); - $bag = $this->getParameterBag(); - - if (!\is_string($value) || !$bag instanceof EnvPlaceholderParameterBag) { - return $value; - } - - $envPlaceholders = $bag->getEnvPlaceholders(); - if (isset($envPlaceholders[$name][$value])) { - $bag = new ParameterBag($bag->all()); - - return $bag->unescapeValue($bag->get("env($name)")); - } - foreach ($envPlaceholders as $env => $placeholders) { - if (isset($placeholders[$value])) { - return $this->getEnv($env); - } - } - - $this->resolving["env($name)"] = true; - try { - return $bag->unescapeValue($this->resolveEnvPlaceholders($bag->escapeValue($value), true)); - } finally { - unset($this->resolving["env($name)"]); - } - } - - private function callMethod(object $service, array $call, array &$inlineServices): mixed - { - foreach (self::getServiceConditionals($call[1]) as $s) { - if (!$this->has($s)) { - return $service; - } - } - foreach (self::getInitializedConditionals($call[1]) as $s) { - if (!$this->doGet($s, ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE, $inlineServices)) { - return $service; - } - } - - $result = $service->{$call[0]}(...$this->doResolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])), $inlineServices)); - - return empty($call[2]) ? $service : $result; - } - - private function shareService(Definition $definition, mixed $service, ?string $id, array &$inlineServices): void - { - $inlineServices[$id ?? spl_object_hash($definition)] = $service; - - if (null !== $id && $definition->isShared()) { - if ($definition->isPrivate() && $this->isCompiled()) { - $this->privates[$id] = $service; - } else { - $this->services[$id] = $service; - } - unset($this->loading[$id]); - } - } - - private function getExpressionLanguage(): ExpressionLanguage - { - if (!isset($this->expressionLanguage)) { - if (!class_exists(Expression::class)) { - throw new LogicException('Expressions cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); - } - $this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders, null, $this->getEnv(...)); - } - - return $this->expressionLanguage; - } - - private function inVendors(string $path): bool - { - $path = is_file($path) ? \dirname($path) : $path; - - if (isset($this->pathsInVendor[$path])) { - return $this->pathsInVendor[$path]; - } - - $this->vendors ??= (new ComposerResource())->getVendors(); - $path = realpath($path) ?: $path; - - if (isset($this->pathsInVendor[$path])) { - return $this->pathsInVendor[$path]; - } - - foreach ($this->vendors as $vendor) { - if (str_starts_with($path, $vendor) && false !== strpbrk(substr($path, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) { - $this->addResource(new FileResource($vendor.'/composer/installed.json')); - - return $this->pathsInVendor[$path] = true; - } - } - - return $this->pathsInVendor[$path] = false; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ContainerInterface.php b/tests/integration/vendor/symfony/dependency-injection/ContainerInterface.php deleted file mode 100644 index f70a8a9..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ContainerInterface.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Psr\Container\ContainerInterface as PsrContainerInterface; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; - -/** - * ContainerInterface is the interface implemented by service container classes. - * - * @author Fabien Potencier - * @author Johannes M. Schmitt - */ -interface ContainerInterface extends PsrContainerInterface -{ - public const RUNTIME_EXCEPTION_ON_INVALID_REFERENCE = 0; - public const EXCEPTION_ON_INVALID_REFERENCE = 1; - public const NULL_ON_INVALID_REFERENCE = 2; - public const IGNORE_ON_INVALID_REFERENCE = 3; - public const IGNORE_ON_UNINITIALIZED_REFERENCE = 4; - - /** - * @return void - */ - public function set(string $id, ?object $service); - - /** - * @template B of self::*_REFERENCE - * - * @param B $invalidBehavior - * - * @psalm-return (B is self::EXCEPTION_ON_INVALID_REFERENCE|self::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE ? object : object|null) - * - * @throws ServiceCircularReferenceException When a circular reference is detected - * @throws ServiceNotFoundException When the service is not defined - * - * @see Reference - */ - public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object; - - public function has(string $id): bool; - - /** - * Check for whether or not a service has been initialized. - */ - public function initialized(string $id): bool; - - /** - * @return array|bool|string|int|float|\UnitEnum|null - * - * @throws ParameterNotFoundException if the parameter is not defined - */ - public function getParameter(string $name); - - public function hasParameter(string $name): bool; - - /** - * @return void - */ - public function setParameter(string $name, array|bool|string|int|float|\UnitEnum|null $value); -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Definition.php b/tests/integration/vendor/symfony/dependency-injection/Definition.php deleted file mode 100644 index 3463805..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Definition.php +++ /dev/null @@ -1,813 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Symfony\Component\DependencyInjection\Argument\BoundArgument; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException; - -/** - * Definition represents a service definition. - * - * @author Fabien Potencier - */ -class Definition -{ - private const DEFAULT_DEPRECATION_TEMPLATE = 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.'; - - private ?string $class = null; - private ?string $file = null; - private string|array|null $factory = null; - private bool $shared = true; - private array $deprecation = []; - private array $properties = []; - private array $calls = []; - private array $instanceof = []; - private bool $autoconfigured = false; - private string|array|null $configurator = null; - private array $tags = []; - private bool $public = false; - private bool $synthetic = false; - private bool $abstract = false; - private bool $lazy = false; - private ?array $decoratedService = null; - private bool $autowired = false; - private array $changes = []; - private array $bindings = []; - private array $errors = []; - - protected $arguments = []; - - /** - * @internal - * - * Used to store the name of the inner id when using service decoration together with autowiring - */ - public ?string $innerServiceId = null; - - /** - * @internal - * - * Used to store the behavior to follow when using service decoration and the decorated service is invalid - */ - public ?int $decorationOnInvalid = null; - - public function __construct(string $class = null, array $arguments = []) - { - if (null !== $class) { - $this->setClass($class); - } - $this->arguments = $arguments; - } - - /** - * Returns all changes tracked for the Definition object. - */ - public function getChanges(): array - { - return $this->changes; - } - - /** - * Sets the tracked changes for the Definition object. - * - * @param array $changes An array of changes for this Definition - * - * @return $this - */ - public function setChanges(array $changes): static - { - $this->changes = $changes; - - return $this; - } - - /** - * Sets a factory. - * - * @param string|array|Reference|null $factory A PHP function, reference or an array containing a class/Reference and a method to call - * - * @return $this - */ - public function setFactory(string|array|Reference|null $factory): static - { - $this->changes['factory'] = true; - - if (\is_string($factory) && str_contains($factory, '::')) { - $factory = explode('::', $factory, 2); - } elseif ($factory instanceof Reference) { - $factory = [$factory, '__invoke']; - } - - $this->factory = $factory; - - return $this; - } - - /** - * Gets the factory. - * - * @return string|array|null The PHP function or an array containing a class/Reference and a method to call - */ - public function getFactory(): string|array|null - { - return $this->factory; - } - - /** - * Sets the service that this service is decorating. - * - * @param string|null $id The decorated service id, use null to remove decoration - * @param string|null $renamedId The new decorated service id - * - * @return $this - * - * @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals - */ - public function setDecoratedService(?string $id, string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): static - { - if ($renamedId && $id === $renamedId) { - throw new InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id)); - } - - $this->changes['decorated_service'] = true; - - if (null === $id) { - $this->decoratedService = null; - } else { - $this->decoratedService = [$id, $renamedId, $priority]; - - if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { - $this->decoratedService[] = $invalidBehavior; - } - } - - return $this; - } - - /** - * Gets the service that this service is decorating. - * - * @return array|null An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated - */ - public function getDecoratedService(): ?array - { - return $this->decoratedService; - } - - /** - * Sets the service class. - * - * @return $this - */ - public function setClass(?string $class): static - { - $this->changes['class'] = true; - - $this->class = $class; - - return $this; - } - - /** - * Gets the service class. - */ - public function getClass(): ?string - { - return $this->class; - } - - /** - * Sets the arguments to pass to the service constructor/factory method. - * - * @return $this - */ - public function setArguments(array $arguments): static - { - $this->arguments = $arguments; - - return $this; - } - - /** - * Sets the properties to define when creating the service. - * - * @return $this - */ - public function setProperties(array $properties): static - { - $this->properties = $properties; - - return $this; - } - - /** - * Gets the properties to define when creating the service. - */ - public function getProperties(): array - { - return $this->properties; - } - - /** - * Sets a specific property. - * - * @return $this - */ - public function setProperty(string $name, mixed $value): static - { - $this->properties[$name] = $value; - - return $this; - } - - /** - * Adds an argument to pass to the service constructor/factory method. - * - * @return $this - */ - public function addArgument(mixed $argument): static - { - $this->arguments[] = $argument; - - return $this; - } - - /** - * Replaces a specific argument. - * - * @return $this - * - * @throws OutOfBoundsException When the replaced argument does not exist - */ - public function replaceArgument(int|string $index, mixed $argument): static - { - if (0 === \count($this->arguments)) { - throw new OutOfBoundsException(sprintf('Cannot replace arguments for class "%s" if none have been configured yet.', $this->class)); - } - - if (\is_int($index) && ($index < 0 || $index > \count($this->arguments) - 1)) { - throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d] of the arguments of class "%s".', $index, \count($this->arguments) - 1, $this->class)); - } - - if (!\array_key_exists($index, $this->arguments)) { - throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist in class "%s".', $index, $this->class)); - } - - $this->arguments[$index] = $argument; - - return $this; - } - - /** - * Sets a specific argument. - * - * @return $this - */ - public function setArgument(int|string $key, mixed $value): static - { - $this->arguments[$key] = $value; - - return $this; - } - - /** - * Gets the arguments to pass to the service constructor/factory method. - */ - public function getArguments(): array - { - return $this->arguments; - } - - /** - * Gets an argument to pass to the service constructor/factory method. - * - * @throws OutOfBoundsException When the argument does not exist - */ - public function getArgument(int|string $index): mixed - { - if (!\array_key_exists($index, $this->arguments)) { - throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist in class "%s".', $index, $this->class)); - } - - return $this->arguments[$index]; - } - - /** - * Sets the methods to call after service initialization. - * - * @return $this - */ - public function setMethodCalls(array $calls = []): static - { - $this->calls = []; - foreach ($calls as $call) { - $this->addMethodCall($call[0], $call[1], $call[2] ?? false); - } - - return $this; - } - - /** - * Adds a method to call after service initialization. - * - * @param string $method The method name to call - * @param array $arguments An array of arguments to pass to the method call - * @param bool $returnsClone Whether the call returns the service instance or not - * - * @return $this - * - * @throws InvalidArgumentException on empty $method param - */ - public function addMethodCall(string $method, array $arguments = [], bool $returnsClone = false): static - { - if (empty($method)) { - throw new InvalidArgumentException('Method name cannot be empty.'); - } - $this->calls[] = $returnsClone ? [$method, $arguments, true] : [$method, $arguments]; - - return $this; - } - - /** - * Removes a method to call after service initialization. - * - * @return $this - */ - public function removeMethodCall(string $method): static - { - foreach ($this->calls as $i => $call) { - if ($call[0] === $method) { - unset($this->calls[$i]); - } - } - - return $this; - } - - /** - * Check if the current definition has a given method to call after service initialization. - */ - public function hasMethodCall(string $method): bool - { - foreach ($this->calls as $call) { - if ($call[0] === $method) { - return true; - } - } - - return false; - } - - /** - * Gets the methods to call after service initialization. - */ - public function getMethodCalls(): array - { - return $this->calls; - } - - /** - * Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class. - * - * @param ChildDefinition[] $instanceof - * - * @return $this - */ - public function setInstanceofConditionals(array $instanceof): static - { - $this->instanceof = $instanceof; - - return $this; - } - - /** - * Gets the definition templates to conditionally apply on the current definition, keyed by parent interface/class. - * - * @return ChildDefinition[] - */ - public function getInstanceofConditionals(): array - { - return $this->instanceof; - } - - /** - * Sets whether or not instanceof conditionals should be prepended with a global set. - * - * @return $this - */ - public function setAutoconfigured(bool $autoconfigured): static - { - $this->changes['autoconfigured'] = true; - - $this->autoconfigured = $autoconfigured; - - return $this; - } - - public function isAutoconfigured(): bool - { - return $this->autoconfigured; - } - - /** - * Sets tags for this definition. - * - * @return $this - */ - public function setTags(array $tags): static - { - $this->tags = $tags; - - return $this; - } - - /** - * Returns all tags. - */ - public function getTags(): array - { - return $this->tags; - } - - /** - * Gets a tag by name. - */ - public function getTag(string $name): array - { - return $this->tags[$name] ?? []; - } - - /** - * Adds a tag for this definition. - * - * @return $this - */ - public function addTag(string $name, array $attributes = []): static - { - $this->tags[$name][] = $attributes; - - return $this; - } - - /** - * Whether this definition has a tag with the given name. - */ - public function hasTag(string $name): bool - { - return isset($this->tags[$name]); - } - - /** - * Clears all tags for a given name. - * - * @return $this - */ - public function clearTag(string $name): static - { - unset($this->tags[$name]); - - return $this; - } - - /** - * Clears the tags for this definition. - * - * @return $this - */ - public function clearTags(): static - { - $this->tags = []; - - return $this; - } - - /** - * Sets a file to require before creating the service. - * - * @return $this - */ - public function setFile(?string $file): static - { - $this->changes['file'] = true; - - $this->file = $file; - - return $this; - } - - /** - * Gets the file to require before creating the service. - */ - public function getFile(): ?string - { - return $this->file; - } - - /** - * Sets if the service must be shared or not. - * - * @return $this - */ - public function setShared(bool $shared): static - { - $this->changes['shared'] = true; - - $this->shared = $shared; - - return $this; - } - - /** - * Whether this service is shared. - */ - public function isShared(): bool - { - return $this->shared; - } - - /** - * Sets the visibility of this service. - * - * @return $this - */ - public function setPublic(bool $boolean): static - { - $this->changes['public'] = true; - - $this->public = $boolean; - - return $this; - } - - /** - * Whether this service is public facing. - */ - public function isPublic(): bool - { - return $this->public; - } - - /** - * Whether this service is private. - */ - public function isPrivate(): bool - { - return !$this->public; - } - - /** - * Sets the lazy flag of this service. - * - * @return $this - */ - public function setLazy(bool $lazy): static - { - $this->changes['lazy'] = true; - - $this->lazy = $lazy; - - return $this; - } - - /** - * Whether this service is lazy. - */ - public function isLazy(): bool - { - return $this->lazy; - } - - /** - * Sets whether this definition is synthetic, that is not constructed by the - * container, but dynamically injected. - * - * @return $this - */ - public function setSynthetic(bool $boolean): static - { - $this->synthetic = $boolean; - - if (!isset($this->changes['public'])) { - $this->setPublic(true); - } - - return $this; - } - - /** - * Whether this definition is synthetic, that is not constructed by the - * container, but dynamically injected. - */ - public function isSynthetic(): bool - { - return $this->synthetic; - } - - /** - * Whether this definition is abstract, that means it merely serves as a - * template for other definitions. - * - * @return $this - */ - public function setAbstract(bool $boolean): static - { - $this->abstract = $boolean; - - return $this; - } - - /** - * Whether this definition is abstract, that means it merely serves as a - * template for other definitions. - */ - public function isAbstract(): bool - { - return $this->abstract; - } - - /** - * Whether this definition is deprecated, that means it should not be called - * anymore. - * - * @param string $package The name of the composer package that is triggering the deprecation - * @param string $version The version of the package that introduced the deprecation - * @param string $message The deprecation message to use - * - * @return $this - * - * @throws InvalidArgumentException when the message template is invalid - */ - public function setDeprecated(string $package, string $version, string $message): static - { - if ('' !== $message) { - if (preg_match('#[\r\n]|\*/#', $message)) { - throw new InvalidArgumentException('Invalid characters found in deprecation template.'); - } - - if (!str_contains($message, '%service_id%')) { - throw new InvalidArgumentException('The deprecation template must contain the "%service_id%" placeholder.'); - } - } - - $this->changes['deprecated'] = true; - $this->deprecation = ['package' => $package, 'version' => $version, 'message' => $message ?: self::DEFAULT_DEPRECATION_TEMPLATE]; - - return $this; - } - - /** - * Whether this definition is deprecated, that means it should not be called - * anymore. - */ - public function isDeprecated(): bool - { - return (bool) $this->deprecation; - } - - /** - * @param string $id Service id relying on this definition - */ - public function getDeprecation(string $id): array - { - return [ - 'package' => $this->deprecation['package'], - 'version' => $this->deprecation['version'], - 'message' => str_replace('%service_id%', $id, $this->deprecation['message']), - ]; - } - - /** - * Sets a configurator to call after the service is fully initialized. - * - * @param string|array|Reference|null $configurator A PHP function, reference or an array containing a class/Reference and a method to call - * - * @return $this - */ - public function setConfigurator(string|array|Reference|null $configurator): static - { - $this->changes['configurator'] = true; - - if (\is_string($configurator) && str_contains($configurator, '::')) { - $configurator = explode('::', $configurator, 2); - } elseif ($configurator instanceof Reference) { - $configurator = [$configurator, '__invoke']; - } - - $this->configurator = $configurator; - - return $this; - } - - /** - * Gets the configurator to call after the service is fully initialized. - */ - public function getConfigurator(): string|array|null - { - return $this->configurator; - } - - /** - * Is the definition autowired? - */ - public function isAutowired(): bool - { - return $this->autowired; - } - - /** - * Enables/disables autowiring. - * - * @return $this - */ - public function setAutowired(bool $autowired): static - { - $this->changes['autowired'] = true; - - $this->autowired = $autowired; - - return $this; - } - - /** - * Gets bindings. - * - * @return BoundArgument[] - */ - public function getBindings(): array - { - return $this->bindings; - } - - /** - * Sets bindings. - * - * Bindings map $named or FQCN arguments to values that should be - * injected in the matching parameters (of the constructor, of methods - * called and of controller actions). - * - * @return $this - */ - public function setBindings(array $bindings): static - { - foreach ($bindings as $key => $binding) { - if (0 < strpos($key, '$') && $key !== $k = preg_replace('/[ \t]*\$/', ' $', $key)) { - unset($bindings[$key]); - $bindings[$key = $k] = $binding; - } - if (!$binding instanceof BoundArgument) { - $bindings[$key] = new BoundArgument($binding); - } - } - - $this->bindings = $bindings; - - return $this; - } - - /** - * Add an error that occurred when building this Definition. - * - * @return $this - */ - public function addError(string|\Closure|Definition $error): static - { - if ($error instanceof self) { - $this->errors = array_merge($this->errors, $error->errors); - } else { - $this->errors[] = $error; - } - - return $this; - } - - /** - * Returns any errors that occurred while building this Definition. - */ - public function getErrors(): array - { - foreach ($this->errors as $i => $error) { - if ($error instanceof \Closure) { - $this->errors[$i] = (string) $error(); - } elseif (!\is_string($error)) { - $this->errors[$i] = (string) $error; - } - } - - return $this->errors; - } - - public function hasErrors(): bool - { - return (bool) $this->errors; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Dumper/Dumper.php b/tests/integration/vendor/symfony/dependency-injection/Dumper/Dumper.php deleted file mode 100644 index e7407b0..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Dumper/Dumper.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Dumper; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * Dumper is the abstract class for all built-in dumpers. - * - * @author Fabien Potencier - */ -abstract class Dumper implements DumperInterface -{ - protected $container; - - public function __construct(ContainerBuilder $container) - { - $this->container = $container; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Dumper/DumperInterface.php b/tests/integration/vendor/symfony/dependency-injection/Dumper/DumperInterface.php deleted file mode 100644 index 616b658..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Dumper/DumperInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Dumper; - -/** - * DumperInterface is the interface implemented by service container dumper classes. - * - * @author Fabien Potencier - */ -interface DumperInterface -{ - /** - * Dumps the service container. - */ - public function dump(array $options = []): string|array; -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php b/tests/integration/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php deleted file mode 100644 index 1134281..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php +++ /dev/null @@ -1,249 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Dumper; - -use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -use Symfony\Component\DependencyInjection\Parameter; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\Reference; - -/** - * GraphvizDumper dumps a service container as a graphviz file. - * - * You can convert the generated dot file with the dot utility (http://www.graphviz.org/): - * - * dot -Tpng container.dot > foo.png - * - * @author Fabien Potencier - */ -class GraphvizDumper extends Dumper -{ - private array $nodes; - private array $edges; - // All values should be strings - private array $options = [ - 'graph' => ['ratio' => 'compress'], - 'node' => ['fontsize' => '11', 'fontname' => 'Arial', 'shape' => 'record'], - 'edge' => ['fontsize' => '9', 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => '0.5'], - 'node.instance' => ['fillcolor' => '#9999ff', 'style' => 'filled'], - 'node.definition' => ['fillcolor' => '#eeeeee'], - 'node.missing' => ['fillcolor' => '#ff9999', 'style' => 'filled'], - ]; - - /** - * Dumps the service container as a graphviz graph. - * - * Available options: - * - * * graph: The default options for the whole graph - * * node: The default options for nodes - * * edge: The default options for edges - * * node.instance: The default options for services that are defined directly by object instances - * * node.definition: The default options for services that are defined via service definition instances - * * node.missing: The default options for missing services - */ - public function dump(array $options = []): string - { - foreach (['graph', 'node', 'edge', 'node.instance', 'node.definition', 'node.missing'] as $key) { - if (isset($options[$key])) { - $this->options[$key] = array_merge($this->options[$key], $options[$key]); - } - } - - $this->nodes = $this->findNodes(); - - $this->edges = []; - foreach ($this->container->getDefinitions() as $id => $definition) { - $this->edges[$id] = array_merge( - $this->findEdges($id, $definition->getArguments(), true, ''), - $this->findEdges($id, $definition->getProperties(), false, '') - ); - - foreach ($definition->getMethodCalls() as $call) { - $this->edges[$id] = array_merge( - $this->edges[$id], - $this->findEdges($id, $call[1], false, $call[0].'()') - ); - } - } - - return $this->container->resolveEnvPlaceholders($this->startDot().$this->addNodes().$this->addEdges().$this->endDot(), '__ENV_%s__'); - } - - private function addNodes(): string - { - $code = ''; - foreach ($this->nodes as $id => $node) { - $aliases = $this->getAliases($id); - - $code .= sprintf(" node_%s [label=\"%s\\n%s\\n\", shape=%s%s];\n", $this->dotize($id), $id.($aliases ? ' ('.implode(', ', $aliases).')' : ''), $node['class'], $this->options['node']['shape'], $this->addAttributes($node['attributes'])); - } - - return $code; - } - - private function addEdges(): string - { - $code = ''; - foreach ($this->edges as $id => $edges) { - foreach ($edges as $edge) { - $code .= sprintf(" node_%s -> node_%s [label=\"%s\" style=\"%s\"%s];\n", $this->dotize($id), $this->dotize($edge['to']), $edge['name'], $edge['required'] ? 'filled' : 'dashed', $edge['lazy'] ? ' color="#9999ff"' : ''); - } - } - - return $code; - } - - /** - * Finds all edges belonging to a specific service id. - */ - private function findEdges(string $id, array $arguments, bool $required, string $name, bool $lazy = false): array - { - $edges = []; - foreach ($arguments as $argument) { - if ($argument instanceof Parameter) { - $argument = $this->container->hasParameter($argument) ? $this->container->getParameter($argument) : null; - } elseif (\is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) { - $argument = $this->container->hasParameter($match[1]) ? $this->container->getParameter($match[1]) : null; - } - - if ($argument instanceof Reference) { - $lazyEdge = $lazy; - - if (!$this->container->has((string) $argument)) { - $this->nodes[(string) $argument] = ['name' => $name, 'required' => $required, 'class' => '', 'attributes' => $this->options['node.missing']]; - } elseif ('service_container' !== (string) $argument) { - $lazyEdge = $lazy || $this->container->getDefinition((string) $argument)->isLazy(); - } - - $edges[] = [['name' => $name, 'required' => $required, 'to' => $argument, 'lazy' => $lazyEdge]]; - } elseif ($argument instanceof ArgumentInterface) { - $edges[] = $this->findEdges($id, $argument->getValues(), $required, $name, true); - } elseif ($argument instanceof Definition) { - $edges[] = $this->findEdges($id, $argument->getArguments(), $required, ''); - $edges[] = $this->findEdges($id, $argument->getProperties(), false, ''); - - foreach ($argument->getMethodCalls() as $call) { - $edges[] = $this->findEdges($id, $call[1], false, $call[0].'()'); - } - } elseif (\is_array($argument)) { - $edges[] = $this->findEdges($id, $argument, $required, $name, $lazy); - } - } - - return array_merge([], ...$edges); - } - - private function findNodes(): array - { - $nodes = []; - - $container = $this->cloneContainer(); - - foreach ($container->getDefinitions() as $id => $definition) { - $class = $definition->getClass(); - - if (str_starts_with($class, '\\')) { - $class = substr($class, 1); - } - - try { - $class = $this->container->getParameterBag()->resolveValue($class); - } catch (ParameterNotFoundException) { - } - - $nodes[$id] = ['class' => str_replace('\\', '\\\\', $class), 'attributes' => array_merge($this->options['node.definition'], ['style' => $definition->isShared() ? 'filled' : 'dotted'])]; - $container->setDefinition($id, new Definition('stdClass')); - } - - foreach ($container->getServiceIds() as $id) { - if (\array_key_exists($id, $container->getAliases())) { - continue; - } - - if (!$container->hasDefinition($id)) { - $nodes[$id] = ['class' => str_replace('\\', '\\\\', $container->get($id)::class), 'attributes' => $this->options['node.instance']]; - } - } - - return $nodes; - } - - private function cloneContainer(): ContainerBuilder - { - $parameterBag = new ParameterBag($this->container->getParameterBag()->all()); - - $container = new ContainerBuilder($parameterBag); - $container->setDefinitions($this->container->getDefinitions()); - $container->setAliases($this->container->getAliases()); - $container->setResources($this->container->getResources()); - foreach ($this->container->getExtensions() as $extension) { - $container->registerExtension($extension); - } - - return $container; - } - - private function startDot(): string - { - return sprintf("digraph sc {\n %s\n node [%s];\n edge [%s];\n\n", - $this->addOptions($this->options['graph']), - $this->addOptions($this->options['node']), - $this->addOptions($this->options['edge']) - ); - } - - private function endDot(): string - { - return "}\n"; - } - - private function addAttributes(array $attributes): string - { - $code = []; - foreach ($attributes as $k => $v) { - $code[] = sprintf('%s="%s"', $k, $v); - } - - return $code ? ', '.implode(', ', $code) : ''; - } - - private function addOptions(array $options): string - { - $code = []; - foreach ($options as $k => $v) { - $code[] = sprintf('%s="%s"', $k, $v); - } - - return implode(' ', $code); - } - - private function dotize(string $id): string - { - return preg_replace('/\W/i', '_', $id); - } - - private function getAliases(string $id): array - { - $aliases = []; - foreach ($this->container->getAliases() as $alias => $origin) { - if ($id == $origin) { - $aliases[] = $alias; - } - } - - return $aliases; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Dumper/PhpDumper.php b/tests/integration/vendor/symfony/dependency-injection/Dumper/PhpDumper.php deleted file mode 100644 index 38270e1..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Dumper/PhpDumper.php +++ /dev/null @@ -1,2342 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Dumper; - -use Composer\Autoload\ClassLoader; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\DependencyInjection\Argument\AbstractArgument; -use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Argument\LazyClosure; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceLocator; -use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; -use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; -use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass; -use Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraphNode; -use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\EnvParameterException; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\ExpressionLanguage; -use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface; -use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\LazyServiceDumper; -use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper; -use Symfony\Component\DependencyInjection\Loader\FileLoader; -use Symfony\Component\DependencyInjection\Parameter; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ServiceLocator as BaseServiceLocator; -use Symfony\Component\DependencyInjection\TypedReference; -use Symfony\Component\DependencyInjection\Variable; -use Symfony\Component\ErrorHandler\DebugClassLoader; -use Symfony\Component\ExpressionLanguage\Expression; -use Symfony\Component\HttpKernel\Kernel; - -/** - * PhpDumper dumps a service container as a PHP class. - * - * @author Fabien Potencier - * @author Johannes M. Schmitt - */ -class PhpDumper extends Dumper -{ - /** - * Characters that might appear in the generated variable name as first character. - */ - public const FIRST_CHARS = 'abcdefghijklmnopqrstuvwxyz'; - - /** - * Characters that might appear in the generated variable name as any but the first character. - */ - public const NON_FIRST_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789_'; - - /** @var \SplObjectStorage|null */ - private ?\SplObjectStorage $definitionVariables = null; - private ?array $referenceVariables = null; - private int $variableCount; - private ?\SplObjectStorage $inlinedDefinitions = null; - private ?array $serviceCalls = null; - private array $reservedVariables = ['instance', 'class', 'this', 'container']; - private ExpressionLanguage $expressionLanguage; - private ?string $targetDirRegex = null; - private int $targetDirMaxMatches; - private string $docStar; - private array $serviceIdToMethodNameMap; - private array $usedMethodNames; - private string $namespace; - private bool $asFiles; - private string $hotPathTag; - private array $preloadTags; - private bool $inlineFactories; - private bool $inlineRequires; - private array $inlinedRequires = []; - private array $circularReferences = []; - private array $singleUsePrivateIds = []; - private array $preload = []; - private bool $addGetService = false; - private array $locatedIds = []; - private string $serviceLocatorTag; - private array $exportedVariables = []; - private array $dynamicParameters = []; - private string $baseClass; - private string $class; - private DumperInterface $proxyDumper; - private bool $hasProxyDumper = true; - - public function __construct(ContainerBuilder $container) - { - if (!$container->isCompiled()) { - throw new LogicException('Cannot dump an uncompiled container.'); - } - - parent::__construct($container); - } - - /** - * Sets the dumper to be used when dumping proxies in the generated container. - * - * @return void - */ - public function setProxyDumper(DumperInterface $proxyDumper) - { - $this->proxyDumper = $proxyDumper; - $this->hasProxyDumper = !$proxyDumper instanceof NullDumper; - } - - /** - * Dumps the service container as a PHP class. - * - * Available options: - * - * * class: The class name - * * base_class: The base class name - * * namespace: The class namespace - * * as_files: To split the container in several files - * - * @return string|array A PHP class representing the service container or an array of PHP files if the "as_files" option is set - * - * @throws EnvParameterException When an env var exists but has not been dumped - */ - public function dump(array $options = []): string|array - { - $this->locatedIds = []; - $this->targetDirRegex = null; - $this->inlinedRequires = []; - $this->exportedVariables = []; - $this->dynamicParameters = []; - $options = array_merge([ - 'class' => 'ProjectServiceContainer', - 'base_class' => 'Container', - 'namespace' => '', - 'as_files' => false, - 'debug' => true, - 'hot_path_tag' => 'container.hot_path', - 'preload_tags' => ['container.preload', 'container.no_preload'], - 'inline_factories_parameter' => 'container.dumper.inline_factories', // @deprecated since Symfony 6.3 - 'inline_class_loader_parameter' => 'container.dumper.inline_class_loader', // @deprecated since Symfony 6.3 - 'inline_factories' => null, - 'inline_class_loader' => null, - 'preload_classes' => [], - 'service_locator_tag' => 'container.service_locator', - 'build_time' => time(), - ], $options); - - $this->addGetService = false; - $this->namespace = $options['namespace']; - $this->asFiles = $options['as_files']; - $this->hotPathTag = $options['hot_path_tag']; - $this->preloadTags = $options['preload_tags']; - - $this->inlineFactories = false; - if (isset($options['inline_factories'])) { - $this->inlineFactories = $this->asFiles && $options['inline_factories']; - } elseif (!$options['inline_factories_parameter']) { - trigger_deprecation('symfony/dependency-injection', '6.3', 'Option "inline_factories_parameter" passed to "%s()" is deprecated, use option "inline_factories" instead.', __METHOD__); - } elseif ($this->container->hasParameter($options['inline_factories_parameter'])) { - trigger_deprecation('symfony/dependency-injection', '6.3', 'Option "inline_factories_parameter" passed to "%s()" is deprecated, use option "inline_factories" instead.', __METHOD__); - $this->inlineFactories = $this->asFiles && $this->container->getParameter($options['inline_factories_parameter']); - } - - $this->inlineRequires = $options['debug']; - if (isset($options['inline_class_loader'])) { - $this->inlineRequires = $options['inline_class_loader']; - } elseif (!$options['inline_class_loader_parameter']) { - trigger_deprecation('symfony/dependency-injection', '6.3', 'Option "inline_class_loader_parameter" passed to "%s()" is deprecated, use option "inline_class_loader" instead.', __METHOD__); - $this->inlineRequires = false; - } elseif ($this->container->hasParameter($options['inline_class_loader_parameter'])) { - trigger_deprecation('symfony/dependency-injection', '6.3', 'Option "inline_class_loader_parameter" passed to "%s()" is deprecated, use option "inline_class_loader" instead.', __METHOD__); - $this->inlineRequires = $this->container->getParameter($options['inline_class_loader_parameter']); - } - - $this->serviceLocatorTag = $options['service_locator_tag']; - $this->class = $options['class']; - - if (!str_starts_with($baseClass = $options['base_class'], '\\') && 'Container' !== $baseClass) { - $baseClass = sprintf('%s\%s', $options['namespace'] ? '\\'.$options['namespace'] : '', $baseClass); - $this->baseClass = $baseClass; - } elseif ('Container' === $baseClass) { - $this->baseClass = Container::class; - } else { - $this->baseClass = $baseClass; - } - - $this->initializeMethodNamesMap('Container' === $baseClass ? Container::class : $baseClass); - - if (!$this->hasProxyDumper) { - (new AnalyzeServiceReferencesPass(true, false))->process($this->container); - (new CheckCircularReferencesPass())->process($this->container); - } - - $this->analyzeReferences(); - $this->docStar = $options['debug'] ? '*' : ''; - - if (!empty($options['file']) && is_dir($dir = \dirname($options['file']))) { - // Build a regexp where the first root dirs are mandatory, - // but every other sub-dir is optional up to the full path in $dir - // Mandate at least 1 root dir and not more than 5 optional dirs. - - $dir = explode(\DIRECTORY_SEPARATOR, realpath($dir)); - $i = \count($dir); - - if (2 + (int) ('\\' === \DIRECTORY_SEPARATOR) <= $i) { - $regex = ''; - $lastOptionalDir = $i > 8 ? $i - 5 : (2 + (int) ('\\' === \DIRECTORY_SEPARATOR)); - $this->targetDirMaxMatches = $i - $lastOptionalDir; - - while (--$i >= $lastOptionalDir) { - $regex = sprintf('(%s%s)?', preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#'), $regex); - } - - do { - $regex = preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#').$regex; - } while (0 < --$i); - - $this->targetDirRegex = '#(^|file://|[:;, \|\r\n])'.preg_quote($dir[0], '#').$regex.'#'; - } - } - - $proxyClasses = $this->inlineFactories ? $this->generateProxyClasses() : null; - - if ($options['preload_classes']) { - $this->preload = array_combine($options['preload_classes'], $options['preload_classes']); - } - - $code = $this->addDefaultParametersMethod(); - $code = - $this->startClass($options['class'], $baseClass, $this->inlineFactories && $proxyClasses). - $this->addServices($services). - $this->addDeprecatedAliases(). - $code - ; - - $proxyClasses ??= $this->generateProxyClasses(); - - if ($this->addGetService) { - $code = preg_replace( - "/\r?\n\r?\n public function __construct.+?\\{\r?\n/s", - "\n protected \Closure \$getService;$0", - $code, - 1 - ); - } - - if ($this->asFiles) { - $fileTemplate = <<docStar} - * @internal This class has been auto-generated by the Symfony Dependency Injection Component. - */ -class %s extends {$options['class']} -{%s} - -EOF; - $files = []; - $preloadedFiles = []; - $ids = $this->container->getRemovedIds(); - foreach ($this->container->getDefinitions() as $id => $definition) { - if (!$definition->isPublic()) { - $ids[$id] = true; - } - } - if ($ids = array_keys($ids)) { - sort($ids); - $c = "doExport($id)." => true,\n"; - } - $files['removed-ids.php'] = $c."];\n"; - } - - if (!$this->inlineFactories) { - foreach ($this->generateServiceFiles($services) as $file => [$c, $preload]) { - $files[$file] = sprintf($fileTemplate, substr($file, 0, -4), $c); - - if ($preload) { - $preloadedFiles[$file] = $file; - } - } - foreach ($proxyClasses as $file => $c) { - $files[$file] = "endClass(); - - if ($this->inlineFactories && $proxyClasses) { - $files['proxy-classes.php'] = " $c) { - $code["Container{$hash}/{$file}"] = substr_replace($c, "namespace ? "\nnamespace {$this->namespace};\n" : ''; - $time = $options['build_time']; - $id = hash('crc32', $hash.$time); - $this->asFiles = false; - - if ($this->preload && null !== $autoloadFile = $this->getAutoloadFile()) { - $autoloadFile = trim($this->export($autoloadFile), '()\\'); - - $preloadedFiles = array_reverse($preloadedFiles); - if ('' !== $preloadedFiles = implode("';\nrequire __DIR__.'/", $preloadedFiles)) { - $preloadedFiles = "require __DIR__.'/$preloadedFiles';\n"; - } - - $code[$options['class'].'.preload.php'] = <<= 7.4 when preloading is desired - -use Symfony\Component\DependencyInjection\Dumper\Preloader; - -if (in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) { - return; -} - -require $autoloadFile; -(require __DIR__.'/{$options['class']}.php')->set(\\Container{$hash}\\{$options['class']}::class, null); -$preloadedFiles -\$classes = []; - -EOF; - - foreach ($this->preload as $class) { - if (!$class || str_contains($class, '$') || \in_array($class, ['int', 'float', 'string', 'bool', 'resource', 'object', 'array', 'null', 'callable', 'iterable', 'mixed', 'void'], true)) { - continue; - } - if (!(class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false)) || (new \ReflectionClass($class))->isUserDefined()) { - $code[$options['class'].'.preload.php'] .= sprintf("\$classes[] = '%s';\n", $class); - } - } - - $code[$options['class'].'.preload.php'] .= <<<'EOF' - -$preloaded = Preloader::preload($classes); - -EOF; - } - - $code[$options['class'].'.php'] = << '$hash', - 'container.build_id' => '$id', - 'container.build_time' => $time, -], __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}'); - -EOF; - } else { - $code .= $this->endClass(); - foreach ($proxyClasses as $c) { - $code .= $c; - } - } - - $this->targetDirRegex = null; - $this->inlinedRequires = []; - $this->circularReferences = []; - $this->locatedIds = []; - $this->exportedVariables = []; - $this->dynamicParameters = []; - $this->preload = []; - - $unusedEnvs = []; - foreach ($this->container->getEnvCounters() as $env => $use) { - if (!$use) { - $unusedEnvs[] = $env; - } - } - if ($unusedEnvs) { - throw new EnvParameterException($unusedEnvs, null, 'Environment variables "%s" are never used. Please, check your container\'s configuration.'); - } - - return $code; - } - - /** - * Retrieves the currently set proxy dumper or instantiates one. - */ - private function getProxyDumper(): DumperInterface - { - return $this->proxyDumper ??= new LazyServiceDumper($this->class); - } - - private function analyzeReferences(): void - { - (new AnalyzeServiceReferencesPass(false, $this->hasProxyDumper))->process($this->container); - $checkedNodes = []; - $this->circularReferences = []; - $this->singleUsePrivateIds = []; - foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) { - if (!$node->getValue() instanceof Definition) { - continue; - } - - if ($this->isSingleUsePrivateNode($node)) { - $this->singleUsePrivateIds[$id] = $id; - } - - $this->collectCircularReferences($id, $node->getOutEdges(), $checkedNodes); - } - - $this->container->getCompiler()->getServiceReferenceGraph()->clear(); - $this->singleUsePrivateIds = array_diff_key($this->singleUsePrivateIds, $this->circularReferences); - } - - private function collectCircularReferences(string $sourceId, array $edges, array &$checkedNodes, array &$loops = [], array $path = [], bool $byConstructor = true): void - { - $path[$sourceId] = $byConstructor; - $checkedNodes[$sourceId] = true; - foreach ($edges as $edge) { - $node = $edge->getDestNode(); - $id = $node->getId(); - if ($sourceId === $id || !$node->getValue() instanceof Definition || $edge->isWeak()) { - continue; - } - - if (isset($path[$id])) { - $loop = null; - $loopByConstructor = $edge->isReferencedByConstructor() && !$edge->isLazy(); - $pathInLoop = [$id, []]; - foreach ($path as $k => $pathByConstructor) { - if (null !== $loop) { - $loop[] = $k; - $pathInLoop[1][$k] = $pathByConstructor; - $loops[$k][] = &$pathInLoop; - $loopByConstructor = $loopByConstructor && $pathByConstructor; - } elseif ($k === $id) { - $loop = []; - } - } - $this->addCircularReferences($id, $loop, $loopByConstructor); - } elseif (!isset($checkedNodes[$id])) { - $this->collectCircularReferences($id, $node->getOutEdges(), $checkedNodes, $loops, $path, $edge->isReferencedByConstructor() && !$edge->isLazy()); - } elseif (isset($loops[$id])) { - // we already had detected loops for this edge - // let's check if we have a common ancestor in one of the detected loops - foreach ($loops[$id] as [$first, $loopPath]) { - if (!isset($path[$first])) { - continue; - } - // We have a common ancestor, let's fill the current path - $fillPath = null; - foreach ($loopPath as $k => $pathByConstructor) { - if (null !== $fillPath) { - $fillPath[$k] = $pathByConstructor; - } elseif ($k === $id) { - $fillPath = $path; - $fillPath[$k] = $pathByConstructor; - } - } - - // we can now build the loop - $loop = null; - $loopByConstructor = $edge->isReferencedByConstructor() && !$edge->isLazy(); - foreach ($fillPath as $k => $pathByConstructor) { - if (null !== $loop) { - $loop[] = $k; - $loopByConstructor = $loopByConstructor && $pathByConstructor; - } elseif ($k === $first) { - $loop = []; - } - } - $this->addCircularReferences($first, $loop, $loopByConstructor); - break; - } - } - } - unset($path[$sourceId]); - } - - private function addCircularReferences(string $sourceId, array $currentPath, bool $byConstructor): void - { - $currentId = $sourceId; - $currentPath = array_reverse($currentPath); - $currentPath[] = $currentId; - foreach ($currentPath as $parentId) { - if (empty($this->circularReferences[$parentId][$currentId])) { - $this->circularReferences[$parentId][$currentId] = $byConstructor; - } - - $currentId = $parentId; - } - } - - private function collectLineage(string $class, array &$lineage): void - { - if (isset($lineage[$class])) { - return; - } - if (!$r = $this->container->getReflectionClass($class, false)) { - return; - } - if (is_a($class, $this->baseClass, true)) { - return; - } - $file = $r->getFileName(); - if (str_ends_with($file, ') : eval()\'d code')) { - $file = substr($file, 0, strrpos($file, '(', -17)); - } - if (!$file || $this->doExport($file) === $exportedFile = $this->export($file)) { - return; - } - - $lineage[$class] = substr($exportedFile, 1, -1); - - if ($parent = $r->getParentClass()) { - $this->collectLineage($parent->name, $lineage); - } - - foreach ($r->getInterfaces() as $parent) { - $this->collectLineage($parent->name, $lineage); - } - - foreach ($r->getTraits() as $parent) { - $this->collectLineage($parent->name, $lineage); - } - - unset($lineage[$class]); - $lineage[$class] = substr($exportedFile, 1, -1); - } - - private function generateProxyClasses(): array - { - $proxyClasses = []; - $alreadyGenerated = []; - $definitions = $this->container->getDefinitions(); - $strip = '' === $this->docStar && method_exists(Kernel::class, 'stripComments'); - $proxyDumper = $this->getProxyDumper(); - ksort($definitions); - foreach ($definitions as $id => $definition) { - if (!$definition = $this->isProxyCandidate($definition, $asGhostObject, $id)) { - continue; - } - if (isset($alreadyGenerated[$asGhostObject][$class = $definition->getClass()])) { - continue; - } - $alreadyGenerated[$asGhostObject][$class] = true; - - foreach (array_column($definition->getTag('proxy'), 'interface') ?: [$class] as $r) { - if (!$r = $this->container->getReflectionClass($r)) { - continue; - } - do { - $file = $r->getFileName(); - if (str_ends_with($file, ') : eval()\'d code')) { - $file = substr($file, 0, strrpos($file, '(', -17)); - } - if (is_file($file)) { - $this->container->addResource(new FileResource($file)); - } - $r = $r->getParentClass() ?: null; - } while ($r?->isUserDefined()); - } - - if ("\n" === $proxyCode = "\n".$proxyDumper->getProxyCode($definition, $id)) { - continue; - } - - if ($this->inlineRequires) { - $lineage = []; - $this->collectLineage($class, $lineage); - - $code = ''; - foreach (array_diff_key(array_flip($lineage), $this->inlinedRequires) as $file => $class) { - if ($this->inlineFactories) { - $this->inlinedRequires[$file] = true; - } - $code .= sprintf("include_once %s;\n", $file); - } - - $proxyCode = $code.$proxyCode; - } - - if ($strip) { - $proxyCode = "inlineRequires ? substr($proxyCode, \strlen($code)) : $proxyCode, 3)[1]; - - if ($this->asFiles || $this->namespace) { - $proxyCode .= "\nif (!\\class_exists('$proxyClass', false)) {\n \\class_alias(__NAMESPACE__.'\\\\$proxyClass', '$proxyClass', false);\n}\n"; - } - - $proxyClasses[$proxyClass.'.php'] = $proxyCode; - } - - return $proxyClasses; - } - - private function addServiceInclude(string $cId, Definition $definition, bool $isProxyCandidate): string - { - $code = ''; - - if ($this->inlineRequires && (!$this->isHotPath($definition) || $isProxyCandidate)) { - $lineage = []; - foreach ($this->inlinedDefinitions as $def) { - if (!$def->isDeprecated()) { - foreach ($this->getClasses($def, $cId) as $class) { - $this->collectLineage($class, $lineage); - } - } - } - - foreach ($this->serviceCalls as $id => [$callCount, $behavior]) { - if ('service_container' !== $id && $id !== $cId - && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $behavior - && $this->container->has($id) - && $this->isTrivialInstance($def = $this->container->findDefinition($id)) - ) { - foreach ($this->getClasses($def, $cId) as $class) { - $this->collectLineage($class, $lineage); - } - } - } - - foreach (array_diff_key(array_flip($lineage), $this->inlinedRequires) as $file => $class) { - $code .= sprintf(" include_once %s;\n", $file); - } - } - - foreach ($this->inlinedDefinitions as $def) { - if ($file = $def->getFile()) { - $file = $this->dumpValue($file); - $file = '(' === $file[0] ? substr($file, 1, -1) : $file; - $code .= sprintf(" include_once %s;\n", $file); - } - } - - if ('' !== $code) { - $code .= "\n"; - } - - return $code; - } - - /** - * @throws InvalidArgumentException - * @throws RuntimeException - */ - private function addServiceInstance(string $id, Definition $definition, bool $isSimpleInstance): string - { - $class = $this->dumpValue($definition->getClass()); - - if (str_starts_with($class, "'") && !str_contains($class, '$') && !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) { - throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id)); - } - - $asGhostObject = false; - $isProxyCandidate = $this->isProxyCandidate($definition, $asGhostObject, $id); - $instantiation = ''; - - $lastWitherIndex = null; - foreach ($definition->getMethodCalls() as $k => $call) { - if ($call[2] ?? false) { - $lastWitherIndex = $k; - } - } - - if (!$isProxyCandidate && $definition->isShared() && !isset($this->singleUsePrivateIds[$id]) && null === $lastWitherIndex) { - $instantiation = sprintf('$container->%s[%s] = %s', $this->container->getDefinition($id)->isPublic() ? 'services' : 'privates', $this->doExport($id), $isSimpleInstance ? '' : '$instance'); - } elseif (!$isSimpleInstance) { - $instantiation = '$instance'; - } - - $return = ''; - if ($isSimpleInstance) { - $return = 'return '; - } else { - $instantiation .= ' = '; - } - - return $this->addNewInstance($definition, ' '.$return.$instantiation, $id, $asGhostObject); - } - - private function isTrivialInstance(Definition $definition): bool - { - if ($definition->hasErrors()) { - return true; - } - if ($definition->isSynthetic() || $definition->getFile() || $definition->getMethodCalls() || $definition->getProperties() || $definition->getConfigurator()) { - return false; - } - if ($definition->isDeprecated() || $definition->isLazy() || $definition->getFactory() || 3 < \count($definition->getArguments())) { - return false; - } - - foreach ($definition->getArguments() as $arg) { - if (!$arg || $arg instanceof Parameter) { - continue; - } - if (\is_array($arg) && 3 >= \count($arg)) { - foreach ($arg as $k => $v) { - if ($this->dumpValue($k) !== $this->dumpValue($k, false)) { - return false; - } - if (!$v || $v instanceof Parameter) { - continue; - } - if ($v instanceof Reference && $this->container->has($id = (string) $v) && $this->container->findDefinition($id)->isSynthetic()) { - continue; - } - if (!\is_scalar($v) || $this->dumpValue($v) !== $this->dumpValue($v, false)) { - return false; - } - } - } elseif ($arg instanceof Reference && $this->container->has($id = (string) $arg) && $this->container->findDefinition($id)->isSynthetic()) { - continue; - } elseif (!\is_scalar($arg) || $this->dumpValue($arg) !== $this->dumpValue($arg, false)) { - return false; - } - } - - return true; - } - - private function addServiceMethodCalls(Definition $definition, string $variableName, ?string $sharedNonLazyId): string - { - $lastWitherIndex = null; - foreach ($definition->getMethodCalls() as $k => $call) { - if ($call[2] ?? false) { - $lastWitherIndex = $k; - } - } - - $calls = ''; - foreach ($definition->getMethodCalls() as $k => $call) { - $arguments = []; - foreach ($call[1] as $i => $value) { - $arguments[] = (\is_string($i) ? $i.': ' : '').$this->dumpValue($value); - } - - $witherAssignation = ''; - - if ($call[2] ?? false) { - if (null !== $sharedNonLazyId && $lastWitherIndex === $k && 'instance' === $variableName) { - $witherAssignation = sprintf('$container->%s[\'%s\'] = ', $definition->isPublic() ? 'services' : 'privates', $sharedNonLazyId); - } - $witherAssignation .= sprintf('$%s = ', $variableName); - } - - $calls .= $this->wrapServiceConditionals($call[1], sprintf(" %s\$%s->%s(%s);\n", $witherAssignation, $variableName, $call[0], implode(', ', $arguments))); - } - - return $calls; - } - - private function addServiceProperties(Definition $definition, string $variableName = 'instance'): string - { - $code = ''; - foreach ($definition->getProperties() as $name => $value) { - $code .= sprintf(" \$%s->%s = %s;\n", $variableName, $name, $this->dumpValue($value)); - } - - return $code; - } - - private function addServiceConfigurator(Definition $definition, string $variableName = 'instance'): string - { - if (!$callable = $definition->getConfigurator()) { - return ''; - } - - if (\is_array($callable)) { - if ($callable[0] instanceof Reference - || ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0])) - ) { - return sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); - } - - $class = $this->dumpValue($callable[0]); - // If the class is a string we can optimize away - if (str_starts_with($class, "'") && !str_contains($class, '$')) { - return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class), $callable[1], $variableName); - } - - if (str_starts_with($class, 'new ')) { - return sprintf(" (%s)->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); - } - - return sprintf(" [%s, '%s'](\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); - } - - return sprintf(" %s(\$%s);\n", $callable, $variableName); - } - - private function addService(string $id, Definition $definition): array - { - $this->definitionVariables = new \SplObjectStorage(); - $this->referenceVariables = []; - $this->variableCount = 0; - $this->referenceVariables[$id] = new Variable('instance'); - - $return = []; - - if ($class = $definition->getClass()) { - $class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class); - $return[] = sprintf(str_starts_with($class, '%') ? '@return object A %1$s instance' : '@return \%s', ltrim($class, '\\')); - } elseif ($definition->getFactory()) { - $factory = $definition->getFactory(); - if (\is_string($factory) && !str_starts_with($factory, '@=')) { - $return[] = sprintf('@return object An instance returned by %s()', $factory); - } elseif (\is_array($factory) && (\is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) { - $class = $factory[0] instanceof Definition ? $factory[0]->getClass() : (string) $factory[0]; - $class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class); - $return[] = sprintf('@return object An instance returned by %s::%s()', $class, $factory[1]); - } - } - - if ($definition->isDeprecated()) { - if ($return && str_starts_with($return[\count($return) - 1], '@return')) { - $return[] = ''; - } - - $deprecation = $definition->getDeprecation($id); - $return[] = sprintf('@deprecated %s', ($deprecation['package'] || $deprecation['version'] ? "Since {$deprecation['package']} {$deprecation['version']}: " : '').$deprecation['message']); - } - - $return = str_replace("\n * \n", "\n *\n", implode("\n * ", $return)); - $return = $this->container->resolveEnvPlaceholders($return); - - $shared = $definition->isShared() ? ' shared' : ''; - $public = $definition->isPublic() ? 'public' : 'private'; - $autowired = $definition->isAutowired() ? ' autowired' : ''; - $asFile = $this->asFiles && !$this->inlineFactories && !$this->isHotPath($definition); - $methodName = $this->generateMethodName($id); - - if ($asFile || $definition->isLazy()) { - $lazyInitialization = ', $lazyLoad = true'; - } else { - $lazyInitialization = ''; - } - - $code = <<docStar} - * Gets the $public '$id'$shared$autowired service. - * - * $return -EOF; - $code = str_replace('*/', ' ', $code).<<hasErrors() && $e = $definition->getErrors()) { - $code .= sprintf(" throw new RuntimeException(%s);\n", $this->export(reset($e))); - } else { - $this->serviceCalls = []; - $this->inlinedDefinitions = $this->getDefinitionsFromArguments([$definition], null, $this->serviceCalls); - - if ($definition->isDeprecated()) { - $deprecation = $definition->getDeprecation($id); - $code .= sprintf(" trigger_deprecation(%s, %s, %s);\n\n", $this->export($deprecation['package']), $this->export($deprecation['version']), $this->export($deprecation['message'])); - } elseif ($definition->hasTag($this->hotPathTag) || !$definition->hasTag($this->preloadTags[1])) { - foreach ($this->inlinedDefinitions as $def) { - foreach ($this->getClasses($def, $id) as $class) { - $this->preload[$class] = $class; - } - } - } - - if (!$definition->isShared()) { - $factory = sprintf('$container->factories%s[%s]', $definition->isPublic() ? '' : "['service_container']", $this->doExport($id)); - } - - $asGhostObject = false; - if ($isProxyCandidate = $this->isProxyCandidate($definition, $asGhostObject, $id)) { - $definition = $isProxyCandidate; - - if (!$definition->isShared()) { - $code .= sprintf(' %s ??= ', $factory); - - if ($definition->isPublic()) { - $code .= sprintf("fn () => self::%s(\$container);\n\n", $asFile ? 'do' : $methodName); - } else { - $code .= sprintf("self::%s(...);\n\n", $asFile ? 'do' : $methodName); - } - } - $lazyLoad = $asGhostObject ? '$proxy' : 'false'; - - $factoryCode = $asFile ? sprintf('self::do($container, %s)', $lazyLoad) : sprintf('self::%s($container, %s)', $methodName, $lazyLoad); - $code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, $factoryCode); - } - - $c = $this->addServiceInclude($id, $definition, null !== $isProxyCandidate); - - if ('' !== $c && $isProxyCandidate && !$definition->isShared()) { - $c = implode("\n", array_map(fn ($line) => $line ? ' '.$line : $line, explode("\n", $c))); - $code .= " static \$include = true;\n\n"; - $code .= " if (\$include) {\n"; - $code .= $c; - $code .= " \$include = false;\n"; - $code .= " }\n\n"; - } else { - $code .= $c; - } - - $c = $this->addInlineService($id, $definition); - - if (!$isProxyCandidate && !$definition->isShared()) { - $c = implode("\n", array_map(fn ($line) => $line ? ' '.$line : $line, explode("\n", $c))); - $lazyloadInitialization = $definition->isLazy() ? ', $lazyLoad = true' : ''; - - $c = sprintf(" %s = function (\$container%s) {\n%s };\n\n return %1\$s(\$container);\n", $factory, $lazyloadInitialization, $c); - } - - $code .= $c; - } - - $code .= " }\n"; - - $this->definitionVariables = $this->inlinedDefinitions = null; - $this->referenceVariables = $this->serviceCalls = null; - - return [$file, $code]; - } - - private function addInlineVariables(string $id, Definition $definition, array $arguments, bool $forConstructor): string - { - $code = ''; - - foreach ($arguments as $argument) { - if (\is_array($argument)) { - $code .= $this->addInlineVariables($id, $definition, $argument, $forConstructor); - } elseif ($argument instanceof Reference) { - $code .= $this->addInlineReference($id, $definition, $argument, $forConstructor); - } elseif ($argument instanceof Definition) { - $code .= $this->addInlineService($id, $definition, $argument, $forConstructor); - } - } - - return $code; - } - - private function addInlineReference(string $id, Definition $definition, string $targetId, bool $forConstructor): string - { - while ($this->container->hasAlias($targetId)) { - $targetId = (string) $this->container->getAlias($targetId); - } - - [$callCount, $behavior] = $this->serviceCalls[$targetId]; - - if ($id === $targetId) { - return $this->addInlineService($id, $definition, $definition); - } - - if ('service_container' === $targetId || isset($this->referenceVariables[$targetId])) { - return ''; - } - - if ($this->container->hasDefinition($targetId) && ($def = $this->container->getDefinition($targetId)) && !$def->isShared()) { - return ''; - } - - $hasSelfRef = isset($this->circularReferences[$id][$targetId]) && !isset($this->definitionVariables[$definition]) && !($this->hasProxyDumper && $definition->isLazy()); - - if ($hasSelfRef && !$forConstructor && !$forConstructor = !$this->circularReferences[$id][$targetId]) { - $code = $this->addInlineService($id, $definition, $definition); - } else { - $code = ''; - } - - if (isset($this->referenceVariables[$targetId]) || (2 > $callCount && (!$hasSelfRef || !$forConstructor))) { - return $code; - } - - $name = $this->getNextVariableName(); - $this->referenceVariables[$targetId] = new Variable($name); - - $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null; - $code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference)); - - if (!$hasSelfRef || !$forConstructor) { - return $code; - } - - $code .= sprintf(<<<'EOTXT' - - if (isset($container->%s[%s])) { - return $container->%1$s[%2$s]; - } - -EOTXT - , - $this->container->getDefinition($id)->isPublic() ? 'services' : 'privates', - $this->doExport($id) - ); - - return $code; - } - - private function addInlineService(string $id, Definition $definition, Definition $inlineDef = null, bool $forConstructor = true): string - { - $code = ''; - - if ($isSimpleInstance = $isRootInstance = null === $inlineDef) { - foreach ($this->serviceCalls as $targetId => [$callCount, $behavior, $byConstructor]) { - if ($byConstructor && isset($this->circularReferences[$id][$targetId]) && !$this->circularReferences[$id][$targetId] && !($this->hasProxyDumper && $definition->isLazy())) { - $code .= $this->addInlineReference($id, $definition, $targetId, $forConstructor); - } - } - } - - if (isset($this->definitionVariables[$inlineDef ??= $definition])) { - return $code; - } - - $arguments = [$inlineDef->getArguments(), $inlineDef->getFactory()]; - - $code .= $this->addInlineVariables($id, $definition, $arguments, $forConstructor); - - if ($arguments = array_filter([$inlineDef->getProperties(), $inlineDef->getMethodCalls(), $inlineDef->getConfigurator()])) { - $isSimpleInstance = false; - } elseif ($definition !== $inlineDef && 2 > $this->inlinedDefinitions[$inlineDef]) { - return $code; - } - - $asGhostObject = false; - $isProxyCandidate = $this->isProxyCandidate($inlineDef, $asGhostObject, $id); - - if (isset($this->definitionVariables[$inlineDef])) { - $isSimpleInstance = false; - } else { - $name = $definition === $inlineDef ? 'instance' : $this->getNextVariableName(); - $this->definitionVariables[$inlineDef] = new Variable($name); - $code .= '' !== $code ? "\n" : ''; - - if ('instance' === $name) { - $code .= $this->addServiceInstance($id, $definition, $isSimpleInstance); - } else { - $code .= $this->addNewInstance($inlineDef, ' $'.$name.' = ', $id); - } - - if ('' !== $inline = $this->addInlineVariables($id, $definition, $arguments, false)) { - $code .= "\n".$inline."\n"; - } elseif ($arguments && 'instance' === $name) { - $code .= "\n"; - } - - $code .= $this->addServiceProperties($inlineDef, $name); - $code .= $this->addServiceMethodCalls($inlineDef, $name, !$isProxyCandidate && $inlineDef->isShared() && !isset($this->singleUsePrivateIds[$id]) ? $id : null); - $code .= $this->addServiceConfigurator($inlineDef, $name); - } - - if (!$isRootInstance || $isSimpleInstance) { - return $code; - } - - return $code."\n return \$instance;\n"; - } - - private function addServices(array &$services = null): string - { - $publicServices = $privateServices = ''; - $definitions = $this->container->getDefinitions(); - ksort($definitions); - foreach ($definitions as $id => $definition) { - if (!$definition->isSynthetic()) { - $services[$id] = $this->addService($id, $definition); - } elseif ($definition->hasTag($this->hotPathTag) || !$definition->hasTag($this->preloadTags[1])) { - $services[$id] = null; - - foreach ($this->getClasses($definition, $id) as $class) { - $this->preload[$class] = $class; - } - } - } - - foreach ($definitions as $id => $definition) { - if (!([$file, $code] = $services[$id]) || null !== $file) { - continue; - } - if ($definition->isPublic()) { - $publicServices .= $code; - } elseif (!$this->isTrivialInstance($definition) || isset($this->locatedIds[$id])) { - $privateServices .= $code; - } - } - - return $publicServices.$privateServices; - } - - private function generateServiceFiles(array $services): iterable - { - $definitions = $this->container->getDefinitions(); - ksort($definitions); - foreach ($definitions as $id => $definition) { - if (([$file, $code] = $services[$id]) && null !== $file && ($definition->isPublic() || !$this->isTrivialInstance($definition) || isset($this->locatedIds[$id]))) { - yield $file => [$code, $definition->hasTag($this->hotPathTag) || !$definition->hasTag($this->preloadTags[1]) && !$definition->isDeprecated() && !$definition->hasErrors()]; - } - } - } - - private function addNewInstance(Definition $definition, string $return = '', string $id = null, bool $asGhostObject = false): string - { - $tail = $return ? str_repeat(')', substr_count($return, '(') - substr_count($return, ')')).";\n" : ''; - - if (BaseServiceLocator::class === $definition->getClass() && $definition->hasTag($this->serviceLocatorTag)) { - $arguments = []; - foreach ($definition->getArgument(0) as $k => $argument) { - $arguments[$k] = $argument->getValues()[0]; - } - - return $return.$this->dumpValue(new ServiceLocatorArgument($arguments)).$tail; - } - - $arguments = []; - foreach ($definition->getArguments() as $i => $value) { - $arguments[] = (\is_string($i) ? $i.': ' : '').$this->dumpValue($value); - } - - if (null !== $definition->getFactory()) { - $callable = $definition->getFactory(); - - if ('current' === $callable && [0] === array_keys($definition->getArguments()) && \is_array($value) && [0] === array_keys($value)) { - return $return.$this->dumpValue($value[0]).$tail; - } - - if (['Closure', 'fromCallable'] === $callable) { - $callable = $definition->getArgument(0); - if ($callable instanceof ServiceClosureArgument) { - return $return.$this->dumpValue($callable).$tail; - } - - $arguments = ['...']; - - if ($callable instanceof Reference || $callable instanceof Definition) { - $callable = [$callable, '__invoke']; - } - } - - if (\is_string($callable) && str_starts_with($callable, '@=')) { - return $return.sprintf('(($args = %s) ? (%s) : null)', - $this->dumpValue(new ServiceLocatorArgument($definition->getArguments())), - $this->getExpressionLanguage()->compile(substr($callable, 2), ['container' => 'container', 'args' => 'args']) - ).$tail; - } - - if (!\is_array($callable)) { - return $return.sprintf('%s(%s)', $this->dumpLiteralClass($this->dumpValue($callable)), $arguments ? implode(', ', $arguments) : '').$tail; - } - - if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $callable[1])) { - throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s).', $callable[1] ?: 'n/a')); - } - - if (['...'] === $arguments && ($definition->isLazy() || 'Closure' !== ($definition->getClass() ?? 'Closure')) && ( - $callable[0] instanceof Reference - || ($callable[0] instanceof Definition && !$this->definitionVariables->contains($callable[0])) - )) { - $initializer = 'fn () => '.$this->dumpValue($callable[0]); - - return $return.LazyClosure::getCode($initializer, $callable, $definition, $this->container, $id).$tail; - } - - if ($callable[0] instanceof Reference - || ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0])) - ) { - return $return.sprintf('%s->%s(%s)', $this->dumpValue($callable[0]), $callable[1], $arguments ? implode(', ', $arguments) : '').$tail; - } - - $class = $this->dumpValue($callable[0]); - // If the class is a string we can optimize away - if (str_starts_with($class, "'") && !str_contains($class, '$')) { - if ("''" === $class) { - throw new RuntimeException(sprintf('Cannot dump definition: "%s" service is defined to be created by a factory but is missing the service reference, did you forget to define the factory service id or class?', $id ? 'The "'.$id.'"' : 'inline')); - } - - return $return.sprintf('%s::%s(%s)', $this->dumpLiteralClass($class), $callable[1], $arguments ? implode(', ', $arguments) : '').$tail; - } - - if (str_starts_with($class, 'new ')) { - return $return.sprintf('(%s)->%s(%s)', $class, $callable[1], $arguments ? implode(', ', $arguments) : '').$tail; - } - - return $return.sprintf("[%s, '%s'](%s)", $class, $callable[1], $arguments ? implode(', ', $arguments) : '').$tail; - } - - if (null === $class = $definition->getClass()) { - throw new RuntimeException('Cannot dump definitions which have no class nor factory.'); - } - - if (!$asGhostObject) { - return $return.sprintf('new %s(%s)', $this->dumpLiteralClass($this->dumpValue($class)), implode(', ', $arguments)).$tail; - } - - if (!method_exists($this->container->getParameterBag()->resolveValue($class), '__construct')) { - return $return.'$lazyLoad'.$tail; - } - - return $return.sprintf('($lazyLoad->__construct(%s) && false ?: $lazyLoad)', implode(', ', $arguments)).$tail; - } - - private function startClass(string $class, string $baseClass, bool $hasProxyClasses): string - { - $namespaceLine = !$this->asFiles && $this->namespace ? "\nnamespace {$this->namespace};\n" : ''; - - $code = <<docStar} - * @internal This class has been auto-generated by the Symfony Dependency Injection Component. - */ -class $class extends $baseClass -{ - private const DEPRECATED_PARAMETERS = []; - - protected \$parameters = []; - - public function __construct() - { - -EOF; - $code = str_replace(" private const DEPRECATED_PARAMETERS = [];\n\n", $this->addDeprecatedParameters(), $code); - if ($this->asFiles) { - $code = str_replace('__construct()', '__construct(private array $buildParameters = [], protected string $containerDir = __DIR__)', $code); - - if (null !== $this->targetDirRegex) { - $code = str_replace('$parameters = []', "\$targetDir;\n protected \$parameters = []", $code); - $code .= ' $this->targetDir = \\dirname($containerDir);'."\n"; - } - } - - if (Container::class !== $this->baseClass) { - $r = $this->container->getReflectionClass($this->baseClass, false); - if (null !== $r - && (null !== $constructor = $r->getConstructor()) - && 0 === $constructor->getNumberOfRequiredParameters() - && Container::class !== $constructor->getDeclaringClass()->name - ) { - $code .= " parent::__construct();\n"; - $code .= " \$this->parameterBag = null;\n\n"; - } - } - - if ($this->container->getParameterBag()->all()) { - $code .= " \$this->parameters = \$this->getDefaultParameters();\n\n"; - } - $code .= " \$this->services = \$this->privates = [];\n"; - - $code .= $this->addSyntheticIds(); - $code .= $this->addMethodMap(); - $code .= $this->asFiles && !$this->inlineFactories ? $this->addFileMap() : ''; - $code .= $this->addAliases(); - $code .= $this->addInlineRequires($hasProxyClasses); - $code .= <<addRemovedIds(); - - if ($this->asFiles && !$this->inlineFactories) { - $code .= <<<'EOF' - - protected function load($file, $lazyLoad = true): mixed - { - if (class_exists($class = __NAMESPACE__.'\\'.$file, false)) { - return $class::do($this, $lazyLoad); - } - - if ('.' === $file[-4]) { - $class = substr($class, 0, -4); - } else { - $file .= '.php'; - } - - $service = require $this->containerDir.\DIRECTORY_SEPARATOR.$file; - - return class_exists($class, false) ? $class::do($this, $lazyLoad) : $service; - } - -EOF; - } - - foreach ($this->container->getDefinitions() as $definition) { - if (!$definition->isLazy() || !$this->hasProxyDumper) { - continue; - } - - if ($this->asFiles && !$this->inlineFactories) { - $proxyLoader = "class_exists(\$class, false) || require __DIR__.'/'.\$class.'.php';\n\n "; - } else { - $proxyLoader = ''; - } - - $code .= <<container->getDefinitions(); - ksort($definitions); - foreach ($definitions as $id => $definition) { - if ($definition->isSynthetic() && 'service_container' !== $id) { - $code .= ' '.$this->doExport($id)." => true,\n"; - } - } - - return $code ? " \$this->syntheticIds = [\n{$code} ];\n" : ''; - } - - private function addRemovedIds(): string - { - $ids = $this->container->getRemovedIds(); - foreach ($this->container->getDefinitions() as $id => $definition) { - if (!$definition->isPublic()) { - $ids[$id] = true; - } - } - if (!$ids) { - return ''; - } - if ($this->asFiles) { - $code = "require \$this->containerDir.\\DIRECTORY_SEPARATOR.'removed-ids.php'"; - } else { - $code = ''; - $ids = array_keys($ids); - sort($ids); - foreach ($ids as $id) { - if (preg_match(FileLoader::ANONYMOUS_ID_REGEXP, $id)) { - continue; - } - $code .= ' '.$this->doExport($id)." => true,\n"; - } - - $code = "[\n{$code} ]"; - } - - return <<container->getParameterBag()) instanceof ParameterBag) { - return ''; - } - - if (!$deprecated = $bag->allDeprecated()) { - return ''; - } - $code = ''; - ksort($deprecated); - foreach ($deprecated as $param => $deprecation) { - $code .= ' '.$this->doExport($param).' => ['.implode(', ', array_map($this->doExport(...), $deprecation))."],\n"; - } - - return " private const DEPRECATED_PARAMETERS = [\n{$code} ];\n\n"; - } - - private function addMethodMap(): string - { - $code = ''; - $definitions = $this->container->getDefinitions(); - ksort($definitions); - foreach ($definitions as $id => $definition) { - if (!$definition->isSynthetic() && $definition->isPublic() && (!$this->asFiles || $this->inlineFactories || $this->isHotPath($definition))) { - $code .= ' '.$this->doExport($id).' => '.$this->doExport($this->generateMethodName($id)).",\n"; - } - } - - $aliases = $this->container->getAliases(); - foreach ($aliases as $alias => $id) { - if (!$id->isDeprecated()) { - continue; - } - $code .= ' '.$this->doExport($alias).' => '.$this->doExport($this->generateMethodName($alias)).",\n"; - } - - return $code ? " \$this->methodMap = [\n{$code} ];\n" : ''; - } - - private function addFileMap(): string - { - $code = ''; - $definitions = $this->container->getDefinitions(); - ksort($definitions); - foreach ($definitions as $id => $definition) { - if (!$definition->isSynthetic() && $definition->isPublic() && !$this->isHotPath($definition)) { - $code .= sprintf(" %s => '%s',\n", $this->doExport($id), $this->generateMethodName($id)); - } - } - - return $code ? " \$this->fileMap = [\n{$code} ];\n" : ''; - } - - private function addAliases(): string - { - if (!$aliases = $this->container->getAliases()) { - return "\n \$this->aliases = [];\n"; - } - - $code = " \$this->aliases = [\n"; - ksort($aliases); - foreach ($aliases as $alias => $id) { - if ($id->isDeprecated()) { - continue; - } - - $id = (string) $id; - while (isset($aliases[$id])) { - $id = (string) $aliases[$id]; - } - $code .= ' '.$this->doExport($alias).' => '.$this->doExport($id).",\n"; - } - - return $code." ];\n"; - } - - private function addDeprecatedAliases(): string - { - $code = ''; - $aliases = $this->container->getAliases(); - foreach ($aliases as $alias => $definition) { - if (!$definition->isDeprecated()) { - continue; - } - $public = $definition->isPublic() ? 'public' : 'private'; - $id = (string) $definition; - $methodNameAlias = $this->generateMethodName($alias); - $idExported = $this->export($id); - $deprecation = $definition->getDeprecation($alias); - $packageExported = $this->export($deprecation['package']); - $versionExported = $this->export($deprecation['version']); - $messageExported = $this->export($deprecation['message']); - $code .= <<docStar} - * Gets the $public '$alias' alias. - * - * @return object The "$id" service. - */ - protected static function {$methodNameAlias}(\$container) - { - trigger_deprecation($packageExported, $versionExported, $messageExported); - - return \$container->get($idExported); - } - -EOF; - } - - return $code; - } - - private function addInlineRequires(bool $hasProxyClasses): string - { - $lineage = []; - $hotPathServices = $this->hotPathTag && $this->inlineRequires ? $this->container->findTaggedServiceIds($this->hotPathTag) : []; - - foreach ($hotPathServices as $id => $tags) { - $definition = $this->container->getDefinition($id); - - if ($definition->isLazy() && $this->hasProxyDumper) { - continue; - } - - $inlinedDefinitions = $this->getDefinitionsFromArguments([$definition]); - - foreach ($inlinedDefinitions as $def) { - foreach ($this->getClasses($def, $id) as $class) { - $this->collectLineage($class, $lineage); - } - } - } - - $code = ''; - - foreach ($lineage as $file) { - if (!isset($this->inlinedRequires[$file])) { - $this->inlinedRequires[$file] = true; - $code .= sprintf("\n include_once %s;", $file); - } - } - - if ($hasProxyClasses) { - $code .= "\n include_once __DIR__.'/proxy-classes.php';"; - } - - return $code ? sprintf("\n \$this->privates['service_container'] = static function (\$container) {%s\n };\n", $code) : ''; - } - - private function addDefaultParametersMethod(): string - { - if (!$this->container->getParameterBag()->all()) { - return ''; - } - - $php = []; - $dynamicPhp = []; - - foreach ($this->container->getParameterBag()->all() as $key => $value) { - if ($key !== $resolvedKey = $this->container->resolveEnvPlaceholders($key)) { - throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: "%s".', $resolvedKey)); - } - $hasEnum = false; - $export = $this->exportParameters([$value], '', 12, $hasEnum); - $export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2); - - if ($hasEnum || preg_match("/\\\$container->(?:getEnv\('(?:[-.\w\\\\]*+:)*+\w++'\)|targetDir\.'')/", $export[1])) { - $dynamicPhp[$key] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]); - $this->dynamicParameters[$key] = true; - } else { - $php[] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]); - } - } - $parameters = sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', 8)); - - $code = <<<'EOF' - - public function getParameter(string $name): array|bool|string|int|float|\UnitEnum|null - { - if (isset(self::DEPRECATED_PARAMETERS[$name])) { - trigger_deprecation(...self::DEPRECATED_PARAMETERS[$name]); - } - - if (isset($this->buildParameters[$name])) { - return $this->buildParameters[$name]; - } - - if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters))) { - throw new ParameterNotFoundException($name); - } - if (isset($this->loadedDynamicParameters[$name])) { - return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); - } - - return $this->parameters[$name]; - } - - public function hasParameter(string $name): bool - { - if (isset($this->buildParameters[$name])) { - return true; - } - - return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || \array_key_exists($name, $this->parameters); - } - - public function setParameter(string $name, $value): void - { - throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); - } - - public function getParameterBag(): ParameterBagInterface - { - if (null === $this->parameterBag) { - $parameters = $this->parameters; - foreach ($this->loadedDynamicParameters as $name => $loaded) { - $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); - } - foreach ($this->buildParameters as $name => $value) { - $parameters[$name] = $value; - } - $this->parameterBag = new FrozenParameterBag($parameters, self::DEPRECATED_PARAMETERS); - } - - return $this->parameterBag; - } - -EOF; - - if (!$this->asFiles) { - $code = preg_replace('/^.*buildParameters.*\n.*\n.*\n\n?/m', '', $code); - } - - if (!($bag = $this->container->getParameterBag()) instanceof ParameterBag || !$bag->allDeprecated()) { - $code = preg_replace("/\n.*DEPRECATED_PARAMETERS.*\n.*\n.*\n/m", '', $code, 1); - $code = str_replace(', self::DEPRECATED_PARAMETERS', '', $code); - } - - if ($dynamicPhp) { - $loadedDynamicParameters = $this->exportParameters(array_combine(array_keys($dynamicPhp), array_fill(0, \count($dynamicPhp), false)), '', 8); - $getDynamicParameter = <<<'EOF' - $container = $this; - $value = match ($name) { -%s - default => throw new ParameterNotFoundException($name), - }; - $this->loadedDynamicParameters[$name] = true; - - return $this->dynamicParameters[$name] = $value; -EOF; - $getDynamicParameter = sprintf($getDynamicParameter, implode("\n", $dynamicPhp)); - } else { - $loadedDynamicParameters = '[]'; - $getDynamicParameter = str_repeat(' ', 8).'throw new ParameterNotFoundException($name);'; - } - - $code .= << $value) { - if (\is_array($value)) { - $value = $this->exportParameters($value, $path.'/'.$key, $indent + 4, $hasEnum); - } elseif ($value instanceof ArgumentInterface) { - throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', get_debug_type($value), $path.'/'.$key)); - } elseif ($value instanceof Variable) { - throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain variable references. Variable "%s" found in "%s".', $value, $path.'/'.$key)); - } elseif ($value instanceof Definition) { - throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain service definitions. Definition for "%s" found in "%s".', $value->getClass(), $path.'/'.$key)); - } elseif ($value instanceof Reference) { - throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain references to other services (reference to service "%s" found in "%s").', $value, $path.'/'.$key)); - } elseif ($value instanceof Expression) { - throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain expressions. Expression "%s" found in "%s".', $value, $path.'/'.$key)); - } elseif ($value instanceof \UnitEnum) { - $hasEnum = true; - $value = sprintf('\%s::%s', $value::class, $value->name); - } else { - $value = $this->export($value); - } - - $php[] = sprintf('%s%s => %s,', str_repeat(' ', $indent), $this->export($key), $value); - } - - return sprintf("[\n%s\n%s]", implode("\n", $php), str_repeat(' ', $indent - 4)); - } - - private function endClass(): string - { - return <<<'EOF' -} - -EOF; - } - - private function wrapServiceConditionals(mixed $value, string $code): string - { - if (!$condition = $this->getServiceConditionals($value)) { - return $code; - } - - // re-indent the wrapped code - $code = implode("\n", array_map(fn ($line) => $line ? ' '.$line : $line, explode("\n", $code))); - - return sprintf(" if (%s) {\n%s }\n", $condition, $code); - } - - private function getServiceConditionals(mixed $value): string - { - $conditions = []; - foreach (ContainerBuilder::getInitializedConditionals($value) as $service) { - if (!$this->container->hasDefinition($service)) { - return 'false'; - } - $conditions[] = sprintf('isset($container->%s[%s])', $this->container->getDefinition($service)->isPublic() ? 'services' : 'privates', $this->doExport($service)); - } - foreach (ContainerBuilder::getServiceConditionals($value) as $service) { - if ($this->container->hasDefinition($service) && !$this->container->getDefinition($service)->isPublic()) { - continue; - } - - $conditions[] = sprintf('$container->has(%s)', $this->doExport($service)); - } - - if (!$conditions) { - return ''; - } - - return implode(' && ', $conditions); - } - - private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = [], bool $byConstructor = null): \SplObjectStorage - { - $definitions ??= new \SplObjectStorage(); - - foreach ($arguments as $argument) { - if (\is_array($argument)) { - $this->getDefinitionsFromArguments($argument, $definitions, $calls, $byConstructor); - } elseif ($argument instanceof Reference) { - $id = (string) $argument; - - while ($this->container->hasAlias($id)) { - $id = (string) $this->container->getAlias($id); - } - - if (!isset($calls[$id])) { - $calls[$id] = [0, $argument->getInvalidBehavior(), $byConstructor]; - } else { - $calls[$id][1] = min($calls[$id][1], $argument->getInvalidBehavior()); - } - - ++$calls[$id][0]; - } elseif (!$argument instanceof Definition) { - // no-op - } elseif (isset($definitions[$argument])) { - $definitions[$argument] = 1 + $definitions[$argument]; - } else { - $definitions[$argument] = 1; - $arguments = [$argument->getArguments(), $argument->getFactory()]; - $this->getDefinitionsFromArguments($arguments, $definitions, $calls, null === $byConstructor || $byConstructor); - $arguments = [$argument->getProperties(), $argument->getMethodCalls(), $argument->getConfigurator()]; - $this->getDefinitionsFromArguments($arguments, $definitions, $calls, null !== $byConstructor && $byConstructor); - } - } - - return $definitions; - } - - /** - * @throws RuntimeException - */ - private function dumpValue(mixed $value, bool $interpolate = true): string - { - if (\is_array($value)) { - if ($value && $interpolate && false !== $param = array_search($value, $this->container->getParameterBag()->all(), true)) { - return $this->dumpValue("%$param%"); - } - $isList = array_is_list($value); - $code = []; - foreach ($value as $k => $v) { - $code[] = $isList ? $this->dumpValue($v, $interpolate) : sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate)); - } - - return sprintf('[%s]', implode(', ', $code)); - } elseif ($value instanceof ArgumentInterface) { - $scope = [$this->definitionVariables, $this->referenceVariables]; - $this->definitionVariables = $this->referenceVariables = null; - - try { - if ($value instanceof ServiceClosureArgument) { - $value = $value->getValues()[0]; - $code = $this->dumpValue($value, $interpolate); - - $returnedType = ''; - if ($value instanceof TypedReference) { - $returnedType = sprintf(': %s\%s', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $value->getInvalidBehavior() ? '' : '?', str_replace(['|', '&'], ['|\\', '&\\'], $value->getType())); - } - - $attribute = ''; - if ($value instanceof Reference) { - $attribute = 'name: '.$this->dumpValue((string) $value, $interpolate); - - if ($this->container->hasDefinition($value) && ($class = $this->container->findDefinition($value)->getClass()) && $class !== (string) $value) { - $attribute .= ', class: '.$this->dumpValue($class, $interpolate); - } - - $attribute = sprintf('#[\Closure(%s)] ', $attribute); - } - - return sprintf('%sfn ()%s => %s', $attribute, $returnedType, $code); - } - - if ($value instanceof IteratorArgument) { - if (!$values = $value->getValues()) { - return 'new RewindableGenerator(fn () => new \EmptyIterator(), 0)'; - } - - $code = []; - $code[] = 'new RewindableGenerator(function () use ($container) {'; - - $operands = [0]; - foreach ($values as $k => $v) { - ($c = $this->getServiceConditionals($v)) ? $operands[] = "(int) ($c)" : ++$operands[0]; - $v = $this->wrapServiceConditionals($v, sprintf(" yield %s => %s;\n", $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate))); - foreach (explode("\n", $v) as $v) { - if ($v) { - $code[] = ' '.$v; - } - } - } - - $code[] = sprintf(' }, %s)', \count($operands) > 1 ? 'fn () => '.implode(' + ', $operands) : $operands[0]); - - return implode("\n", $code); - } - - if ($value instanceof ServiceLocatorArgument) { - $serviceMap = ''; - $serviceTypes = ''; - foreach ($value->getValues() as $k => $v) { - if (!$v instanceof Reference) { - $serviceMap .= sprintf("\n %s => [%s],", $this->export($k), $this->dumpValue($v)); - $serviceTypes .= sprintf("\n %s => '?',", $this->export($k)); - continue; - } - $id = (string) $v; - while ($this->container->hasAlias($id)) { - $id = (string) $this->container->getAlias($id); - } - $definition = $this->container->getDefinition($id); - $load = !($definition->hasErrors() && $e = $definition->getErrors()) ? $this->asFiles && !$this->inlineFactories && !$this->isHotPath($definition) : reset($e); - $serviceMap .= sprintf("\n %s => [%s, %s, %s, %s],", - $this->export($k), - $this->export($definition->isShared() ? ($definition->isPublic() ? 'services' : 'privates') : false), - $this->doExport($id), - $this->export(ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $v->getInvalidBehavior() && !\is_string($load) ? $this->generateMethodName($id) : null), - $this->export($load) - ); - $serviceTypes .= sprintf("\n %s => %s,", $this->export($k), $this->export($v instanceof TypedReference ? $v->getType() : '?')); - $this->locatedIds[$id] = true; - } - $this->addGetService = true; - - return sprintf('new \%s($container->getService ??= $container->getService(...), [%s%s], [%s%s])', ServiceLocator::class, $serviceMap, $serviceMap ? "\n " : '', $serviceTypes, $serviceTypes ? "\n " : ''); - } - } finally { - [$this->definitionVariables, $this->referenceVariables] = $scope; - } - } elseif ($value instanceof Definition) { - if ($value->hasErrors() && $e = $value->getErrors()) { - return sprintf('throw new RuntimeException(%s)', $this->export(reset($e))); - } - if ($this->definitionVariables?->contains($value)) { - return $this->dumpValue($this->definitionVariables[$value], $interpolate); - } - if ($value->getMethodCalls()) { - throw new RuntimeException('Cannot dump definitions which have method calls.'); - } - if ($value->getProperties()) { - throw new RuntimeException('Cannot dump definitions which have properties.'); - } - if (null !== $value->getConfigurator()) { - throw new RuntimeException('Cannot dump definitions which have a configurator.'); - } - - return $this->addNewInstance($value); - } elseif ($value instanceof Variable) { - return '$'.$value; - } elseif ($value instanceof Reference) { - $id = (string) $value; - - while ($this->container->hasAlias($id)) { - $id = (string) $this->container->getAlias($id); - } - - if (null !== $this->referenceVariables && isset($this->referenceVariables[$id])) { - return $this->dumpValue($this->referenceVariables[$id], $interpolate); - } - - return $this->getServiceCall($id, $value); - } elseif ($value instanceof Expression) { - return $this->getExpressionLanguage()->compile((string) $value, ['container' => 'container']); - } elseif ($value instanceof Parameter) { - return $this->dumpParameter($value); - } elseif (true === $interpolate && \is_string($value)) { - if (preg_match('/^%([^%]+)%$/', $value, $match)) { - // we do this to deal with non string values (Boolean, integer, ...) - // the preg_replace_callback converts them to strings - return $this->dumpParameter($match[1]); - } else { - $replaceParameters = fn ($match) => "'.".$this->dumpParameter($match[2]).".'"; - - $code = str_replace('%%', '%', preg_replace_callback('/(?export($value))); - - return $code; - } - } elseif ($value instanceof \UnitEnum) { - return sprintf('\%s::%s', $value::class, $value->name); - } elseif ($value instanceof AbstractArgument) { - throw new RuntimeException($value->getTextWithContext()); - } elseif (\is_object($value) || \is_resource($value)) { - throw new RuntimeException(sprintf('Unable to dump a service container if a parameter is an object or a resource, got "%s".', get_debug_type($value))); - } - - return $this->export($value); - } - - /** - * Dumps a string to a literal (aka PHP Code) class value. - * - * @throws RuntimeException - */ - private function dumpLiteralClass(string $class): string - { - if (str_contains($class, '$')) { - return sprintf('${($_ = %s) && false ?: "_"}', $class); - } - if (!str_starts_with($class, "'") || !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) { - throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s).', $class ?: 'n/a')); - } - - $class = substr(str_replace('\\\\', '\\', $class), 1, -1); - - return str_starts_with($class, '\\') ? $class : '\\'.$class; - } - - private function dumpParameter(string $name): string - { - if (!$this->container->hasParameter($name) || ($this->dynamicParameters[$name] ?? false)) { - return sprintf('$container->getParameter(%s)', $this->doExport($name)); - } - - $value = $this->container->getParameter($name); - $dumpedValue = $this->dumpValue($value, false); - - if (!$value || !\is_array($value)) { - return $dumpedValue; - } - - return sprintf('$container->parameters[%s]', $this->doExport($name)); - } - - private function getServiceCall(string $id, Reference $reference = null): string - { - while ($this->container->hasAlias($id)) { - $id = (string) $this->container->getAlias($id); - } - - if ('service_container' === $id) { - return '$container'; - } - - if ($this->container->hasDefinition($id) && $definition = $this->container->getDefinition($id)) { - if ($definition->isSynthetic()) { - $code = sprintf('$container->get(%s%s)', $this->doExport($id), null !== $reference ? ', '.$reference->getInvalidBehavior() : ''); - } elseif (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { - $code = 'null'; - if (!$definition->isShared()) { - return $code; - } - } elseif ($this->isTrivialInstance($definition)) { - if ($definition->hasErrors() && $e = $definition->getErrors()) { - return sprintf('throw new RuntimeException(%s)', $this->export(reset($e))); - } - $code = $this->addNewInstance($definition, '', $id); - if ($definition->isShared() && !isset($this->singleUsePrivateIds[$id])) { - return sprintf('($container->%s[%s] ??= %s)', $definition->isPublic() ? 'services' : 'privates', $this->doExport($id), $code); - } - $code = "($code)"; - } else { - $code = $this->asFiles && !$this->inlineFactories && !$this->isHotPath($definition) ? "\$container->load('%s')" : 'self::%s($container)'; - $code = sprintf($code, $this->generateMethodName($id)); - - if (!$definition->isShared()) { - $factory = sprintf('$container->factories%s[%s]', $definition->isPublic() ? '' : "['service_container']", $this->doExport($id)); - $code = sprintf('(isset(%s) ? %1$s($container) : %s)', $factory, $code); - } - } - if ($definition->isShared() && !isset($this->singleUsePrivateIds[$id])) { - $code = sprintf('($container->%s[%s] ?? %s)', $definition->isPublic() ? 'services' : 'privates', $this->doExport($id), $code); - } - - return $code; - } - if (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { - return 'null'; - } - if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE < $reference->getInvalidBehavior()) { - $code = sprintf('$container->get(%s, ContainerInterface::NULL_ON_INVALID_REFERENCE)', $this->doExport($id)); - } else { - $code = sprintf('$container->get(%s)', $this->doExport($id)); - } - - return sprintf('($container->services[%s] ?? %s)', $this->doExport($id), $code); - } - - /** - * Initializes the method names map to avoid conflicts with the Container methods. - */ - private function initializeMethodNamesMap(string $class): void - { - $this->serviceIdToMethodNameMap = []; - $this->usedMethodNames = []; - - if ($reflectionClass = $this->container->getReflectionClass($class)) { - foreach ($reflectionClass->getMethods() as $method) { - $this->usedMethodNames[strtolower($method->getName())] = true; - } - } - } - - /** - * @throws InvalidArgumentException - */ - private function generateMethodName(string $id): string - { - if (isset($this->serviceIdToMethodNameMap[$id])) { - return $this->serviceIdToMethodNameMap[$id]; - } - - $i = strrpos($id, '\\'); - $name = Container::camelize(false !== $i && isset($id[1 + $i]) ? substr($id, 1 + $i) : $id); - $name = preg_replace('/[^a-zA-Z0-9_\x7f-\xff]/', '', $name); - $methodName = 'get'.$name.'Service'; - $suffix = 1; - - while (isset($this->usedMethodNames[strtolower($methodName)])) { - ++$suffix; - $methodName = 'get'.$name.$suffix.'Service'; - } - - $this->serviceIdToMethodNameMap[$id] = $methodName; - $this->usedMethodNames[strtolower($methodName)] = true; - - return $methodName; - } - - private function getNextVariableName(): string - { - $firstChars = self::FIRST_CHARS; - $firstCharsLength = \strlen($firstChars); - $nonFirstChars = self::NON_FIRST_CHARS; - $nonFirstCharsLength = \strlen($nonFirstChars); - - while (true) { - $name = ''; - $i = $this->variableCount; - - if ('' === $name) { - $name .= $firstChars[$i % $firstCharsLength]; - $i = (int) ($i / $firstCharsLength); - } - - while ($i > 0) { - --$i; - $name .= $nonFirstChars[$i % $nonFirstCharsLength]; - $i = (int) ($i / $nonFirstCharsLength); - } - - ++$this->variableCount; - - // check that the name is not reserved - if (\in_array($name, $this->reservedVariables, true)) { - continue; - } - - return $name; - } - } - - private function getExpressionLanguage(): ExpressionLanguage - { - if (!isset($this->expressionLanguage)) { - if (!class_exists(\Symfony\Component\ExpressionLanguage\ExpressionLanguage::class)) { - throw new LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed. Try running "composer require symfony/expression-language".'); - } - $providers = $this->container->getExpressionLanguageProviders(); - $this->expressionLanguage = new ExpressionLanguage(null, $providers, function ($arg) { - $id = '""' === substr_replace($arg, '', 1, -1) ? stripcslashes(substr($arg, 1, -1)) : null; - - if (null !== $id && ($this->container->hasAlias($id) || $this->container->hasDefinition($id))) { - return $this->getServiceCall($id); - } - - return sprintf('$container->get(%s)', $arg); - }); - - if ($this->container->isTrackingResources()) { - foreach ($providers as $provider) { - $this->container->addObjectResource($provider); - } - } - } - - return $this->expressionLanguage; - } - - private function isHotPath(Definition $definition): bool - { - return $this->hotPathTag && $definition->hasTag($this->hotPathTag) && !$definition->isDeprecated(); - } - - private function isSingleUsePrivateNode(ServiceReferenceGraphNode $node): bool - { - if ($node->getValue()->isPublic()) { - return false; - } - $ids = []; - foreach ($node->getInEdges() as $edge) { - if (!$value = $edge->getSourceNode()->getValue()) { - continue; - } - if ($edge->isLazy() || !$value instanceof Definition || !$value->isShared()) { - return false; - } - $ids[$edge->getSourceNode()->getId()] = true; - } - - return 1 === \count($ids); - } - - private function export(mixed $value): mixed - { - if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, \PREG_OFFSET_CAPTURE)) { - $suffix = $matches[0][1] + \strlen($matches[0][0]); - $matches[0][1] += \strlen($matches[1][0]); - $prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true).'.' : ''; - - if ('\\' === \DIRECTORY_SEPARATOR && isset($value[$suffix])) { - $cookie = '\\'.random_int(100000, \PHP_INT_MAX); - $suffix = '.'.$this->doExport(str_replace('\\', $cookie, substr($value, $suffix)), true); - $suffix = str_replace('\\'.$cookie, "'.\\DIRECTORY_SEPARATOR.'", $suffix); - } else { - $suffix = isset($value[$suffix]) ? '.'.$this->doExport(substr($value, $suffix), true) : ''; - } - - $dirname = $this->asFiles ? '$container->containerDir' : '__DIR__'; - $offset = 2 + $this->targetDirMaxMatches - \count($matches); - - if (0 < $offset) { - $dirname = sprintf('\dirname(__DIR__, %d)', $offset + (int) $this->asFiles); - } elseif ($this->asFiles) { - $dirname = "\$container->targetDir.''"; // empty string concatenation on purpose - } - - if ($prefix || $suffix) { - return sprintf('(%s%s%s)', $prefix, $dirname, $suffix); - } - - return $dirname; - } - - return $this->doExport($value, true); - } - - private function doExport(mixed $value, bool $resolveEnv = false): mixed - { - $shouldCacheValue = $resolveEnv && \is_string($value); - if ($shouldCacheValue && isset($this->exportedVariables[$value])) { - return $this->exportedVariables[$value]; - } - if (\is_string($value) && str_contains($value, "\n")) { - $cleanParts = explode("\n", $value); - $cleanParts = array_map(fn ($part) => var_export($part, true), $cleanParts); - $export = implode('."\n".', $cleanParts); - } else { - $export = var_export($value, true); - } - - if ($resolveEnv && "'" === $export[0] && $export !== $resolvedExport = $this->container->resolveEnvPlaceholders($export, "'.\$container->getEnv('string:%s').'")) { - $export = $resolvedExport; - if (str_ends_with($export, ".''")) { - $export = substr($export, 0, -3); - if ("'" === $export[1]) { - $export = substr_replace($export, '', 23, 7); - } - } - if ("'" === $export[1]) { - $export = substr($export, 3); - } - } - - if ($shouldCacheValue) { - $this->exportedVariables[$value] = $export; - } - - return $export; - } - - private function getAutoloadFile(): ?string - { - $file = null; - - foreach (spl_autoload_functions() as $autoloader) { - if (!\is_array($autoloader)) { - continue; - } - - if ($autoloader[0] instanceof DebugClassLoader) { - $autoloader = $autoloader[0]->getClassLoader(); - } - - if (!\is_array($autoloader) || !$autoloader[0] instanceof ClassLoader || !$autoloader[0]->findFile(__CLASS__)) { - continue; - } - - foreach (get_declared_classes() as $class) { - if (str_starts_with($class, 'ComposerAutoloaderInit') && $class::getLoader() === $autoloader[0]) { - $file = \dirname((new \ReflectionClass($class))->getFileName(), 2).'/autoload.php'; - - if (null !== $this->targetDirRegex && preg_match($this->targetDirRegex.'A', $file)) { - return $file; - } - } - } - } - - return $file; - } - - private function getClasses(Definition $definition, string $id): array - { - $classes = []; - $resolve = $this->container->getParameterBag()->resolveValue(...); - - while ($definition instanceof Definition) { - foreach ($definition->getTag($this->preloadTags[0]) as $tag) { - if (!isset($tag['class'])) { - throw new InvalidArgumentException(sprintf('Missing attribute "class" on tag "%s" for service "%s".', $this->preloadTags[0], $id)); - } - - $classes[] = trim($tag['class'], '\\'); - } - - if ($class = $definition->getClass()) { - $classes[] = trim($resolve($class), '\\'); - } - $factory = $definition->getFactory(); - - if (!\is_array($factory)) { - $factory = [$factory]; - } - - if (\is_string($factory[0])) { - $factory[0] = $resolve($factory[0]); - - if (false !== $i = strrpos($factory[0], '::')) { - $factory[0] = substr($factory[0], 0, $i); - } - $classes[] = trim($factory[0], '\\'); - } - - $definition = $factory[0]; - } - - return $classes; - } - - private function isProxyCandidate(Definition $definition, ?bool &$asGhostObject, string $id): ?Definition - { - $asGhostObject = false; - - if (['Closure', 'fromCallable'] === $definition->getFactory()) { - return null; - } - - if (!$definition->isLazy() || !$this->hasProxyDumper) { - return null; - } - - return $this->getProxyDumper()->isProxyCandidate($definition, $asGhostObject, $id) ? $definition : null; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Dumper/XmlDumper.php b/tests/integration/vendor/symfony/dependency-injection/Dumper/XmlDumper.php deleted file mode 100644 index 05d424d..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Dumper/XmlDumper.php +++ /dev/null @@ -1,431 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Dumper; - -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Argument\AbstractArgument; -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; -use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Parameter; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\ExpressionLanguage\Expression; - -/** - * XmlDumper dumps a service container as an XML string. - * - * @author Fabien Potencier - * @author Martin Hasoň - */ -class XmlDumper extends Dumper -{ - private \DOMDocument $document; - - /** - * Dumps the service container as an XML string. - */ - public function dump(array $options = []): string - { - $this->document = new \DOMDocument('1.0', 'utf-8'); - $this->document->formatOutput = true; - - $container = $this->document->createElementNS('http://symfony.com/schema/dic/services', 'container'); - $container->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); - $container->setAttribute('xsi:schemaLocation', 'http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd'); - - $this->addParameters($container); - $this->addServices($container); - - $this->document->appendChild($container); - $xml = $this->document->saveXML(); - unset($this->document); - - return $this->container->resolveEnvPlaceholders($xml); - } - - private function addParameters(\DOMElement $parent): void - { - $data = $this->container->getParameterBag()->all(); - if (!$data) { - return; - } - - if ($this->container->isCompiled()) { - $data = $this->escape($data); - } - - $parameters = $this->document->createElement('parameters'); - $parent->appendChild($parameters); - $this->convertParameters($data, 'parameter', $parameters); - } - - private function addMethodCalls(array $methodcalls, \DOMElement $parent): void - { - foreach ($methodcalls as $methodcall) { - $call = $this->document->createElement('call'); - $call->setAttribute('method', $methodcall[0]); - if (\count($methodcall[1])) { - $this->convertParameters($methodcall[1], 'argument', $call); - } - if ($methodcall[2] ?? false) { - $call->setAttribute('returns-clone', 'true'); - } - $parent->appendChild($call); - } - } - - private function addService(Definition $definition, ?string $id, \DOMElement $parent): void - { - $service = $this->document->createElement('service'); - if (null !== $id) { - $service->setAttribute('id', $id); - } - if ($class = $definition->getClass()) { - if (str_starts_with($class, '\\')) { - $class = substr($class, 1); - } - - $service->setAttribute('class', $class); - } - if (!$definition->isShared()) { - $service->setAttribute('shared', 'false'); - } - if ($definition->isPublic()) { - $service->setAttribute('public', 'true'); - } - if ($definition->isSynthetic()) { - $service->setAttribute('synthetic', 'true'); - } - if ($definition->isLazy()) { - $service->setAttribute('lazy', 'true'); - } - if (null !== $decoratedService = $definition->getDecoratedService()) { - [$decorated, $renamedId, $priority] = $decoratedService; - $service->setAttribute('decorates', $decorated); - - $decorationOnInvalid = $decoratedService[3] ?? ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - if (\in_array($decorationOnInvalid, [ContainerInterface::IGNORE_ON_INVALID_REFERENCE, ContainerInterface::NULL_ON_INVALID_REFERENCE], true)) { - $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE === $decorationOnInvalid ? 'null' : 'ignore'; - $service->setAttribute('decoration-on-invalid', $invalidBehavior); - } - if (null !== $renamedId) { - $service->setAttribute('decoration-inner-name', $renamedId); - } - if (0 !== $priority) { - $service->setAttribute('decoration-priority', $priority); - } - } - - $tags = $definition->getTags(); - $tags['container.error'] = array_map(fn ($e) => ['message' => $e], $definition->getErrors()); - foreach ($tags as $name => $tags) { - foreach ($tags as $attributes) { - $tag = $this->document->createElement('tag'); - if (!\array_key_exists('name', $attributes)) { - $tag->setAttribute('name', $name); - } else { - $tag->appendChild($this->document->createTextNode($name)); - } - - // Check if we have recursive attributes - if (array_filter($attributes, \is_array(...))) { - $this->addTagRecursiveAttributes($tag, $attributes); - } else { - foreach ($attributes as $key => $value) { - $tag->setAttribute($key, $value ?? ''); - } - } - $service->appendChild($tag); - } - } - - if ($definition->getFile()) { - $file = $this->document->createElement('file'); - $file->appendChild($this->document->createTextNode($definition->getFile())); - $service->appendChild($file); - } - - if ($parameters = $definition->getArguments()) { - $this->convertParameters($parameters, 'argument', $service); - } - - if ($parameters = $definition->getProperties()) { - $this->convertParameters($parameters, 'property', $service, 'name'); - } - - $this->addMethodCalls($definition->getMethodCalls(), $service); - - if ($callable = $definition->getFactory()) { - if (\is_array($callable) && ['Closure', 'fromCallable'] !== $callable && $definition->getClass() === $callable[0]) { - $service->setAttribute('constructor', $callable[1]); - } else { - $factory = $this->document->createElement('factory'); - - if (\is_array($callable) && $callable[0] instanceof Definition) { - $this->addService($callable[0], null, $factory); - $factory->setAttribute('method', $callable[1]); - } elseif (\is_array($callable)) { - if (null !== $callable[0]) { - $factory->setAttribute($callable[0] instanceof Reference ? 'service' : 'class', $callable[0]); - } - $factory->setAttribute('method', $callable[1]); - } else { - $factory->setAttribute('function', $callable); - } - $service->appendChild($factory); - } - } - - if ($definition->isDeprecated()) { - $deprecation = $definition->getDeprecation('%service_id%'); - $deprecated = $this->document->createElement('deprecated'); - $deprecated->appendChild($this->document->createTextNode($definition->getDeprecation('%service_id%')['message'])); - $deprecated->setAttribute('package', $deprecation['package']); - $deprecated->setAttribute('version', $deprecation['version']); - - $service->appendChild($deprecated); - } - - if ($definition->isAutowired()) { - $service->setAttribute('autowire', 'true'); - } - - if ($definition->isAutoconfigured()) { - $service->setAttribute('autoconfigure', 'true'); - } - - if ($definition->isAbstract()) { - $service->setAttribute('abstract', 'true'); - } - - if ($callable = $definition->getConfigurator()) { - $configurator = $this->document->createElement('configurator'); - - if (\is_array($callable) && $callable[0] instanceof Definition) { - $this->addService($callable[0], null, $configurator); - $configurator->setAttribute('method', $callable[1]); - } elseif (\is_array($callable)) { - $configurator->setAttribute($callable[0] instanceof Reference ? 'service' : 'class', $callable[0]); - $configurator->setAttribute('method', $callable[1]); - } else { - $configurator->setAttribute('function', $callable); - } - $service->appendChild($configurator); - } - - $parent->appendChild($service); - } - - private function addServiceAlias(string $alias, Alias $id, \DOMElement $parent): void - { - $service = $this->document->createElement('service'); - $service->setAttribute('id', $alias); - $service->setAttribute('alias', $id); - if ($id->isPublic()) { - $service->setAttribute('public', 'true'); - } - - if ($id->isDeprecated()) { - $deprecation = $id->getDeprecation('%alias_id%'); - $deprecated = $this->document->createElement('deprecated'); - $deprecated->appendChild($this->document->createTextNode($deprecation['message'])); - $deprecated->setAttribute('package', $deprecation['package']); - $deprecated->setAttribute('version', $deprecation['version']); - - $service->appendChild($deprecated); - } - - $parent->appendChild($service); - } - - private function addServices(\DOMElement $parent): void - { - $definitions = $this->container->getDefinitions(); - if (!$definitions) { - return; - } - - $services = $this->document->createElement('services'); - foreach ($definitions as $id => $definition) { - $this->addService($definition, $id, $services); - } - - $aliases = $this->container->getAliases(); - foreach ($aliases as $alias => $id) { - while (isset($aliases[(string) $id])) { - $id = $aliases[(string) $id]; - } - $this->addServiceAlias($alias, $id, $services); - } - $parent->appendChild($services); - } - - private function addTagRecursiveAttributes(\DOMElement $parent, array $attributes): void - { - foreach ($attributes as $name => $value) { - $attribute = $this->document->createElement('attribute'); - $attribute->setAttribute('name', $name); - - if (\is_array($value)) { - $this->addTagRecursiveAttributes($attribute, $value); - } else { - $attribute->appendChild($this->document->createTextNode($value)); - } - - $parent->appendChild($attribute); - } - } - - private function convertParameters(array $parameters, string $type, \DOMElement $parent, string $keyAttribute = 'key'): void - { - $withKeys = !array_is_list($parameters); - foreach ($parameters as $key => $value) { - $element = $this->document->createElement($type); - if ($withKeys) { - $element->setAttribute($keyAttribute, $key); - } - - if (\is_array($tag = $value)) { - $element->setAttribute('type', 'collection'); - $this->convertParameters($value, $type, $element, 'key'); - } elseif ($value instanceof TaggedIteratorArgument || ($value instanceof ServiceLocatorArgument && $tag = $value->getTaggedIteratorArgument())) { - $element->setAttribute('type', $value instanceof TaggedIteratorArgument ? 'tagged_iterator' : 'tagged_locator'); - $element->setAttribute('tag', $tag->getTag()); - - if (null !== $tag->getIndexAttribute()) { - $element->setAttribute('index-by', $tag->getIndexAttribute()); - - if (null !== $tag->getDefaultIndexMethod()) { - $element->setAttribute('default-index-method', $tag->getDefaultIndexMethod()); - } - if (null !== $tag->getDefaultPriorityMethod()) { - $element->setAttribute('default-priority-method', $tag->getDefaultPriorityMethod()); - } - } - if ($excludes = $tag->getExclude()) { - if (1 === \count($excludes)) { - $element->setAttribute('exclude', $excludes[0]); - } else { - foreach ($excludes as $exclude) { - $element->appendChild($this->document->createElement('exclude', $exclude)); - } - } - } - if (!$tag->excludeSelf()) { - $element->setAttribute('exclude-self', 'false'); - } - } elseif ($value instanceof IteratorArgument) { - $element->setAttribute('type', 'iterator'); - $this->convertParameters($value->getValues(), $type, $element, 'key'); - } elseif ($value instanceof ServiceLocatorArgument) { - $element->setAttribute('type', 'service_locator'); - $this->convertParameters($value->getValues(), $type, $element, 'key'); - } elseif ($value instanceof ServiceClosureArgument && !$value->getValues()[0] instanceof Reference) { - $element->setAttribute('type', 'service_closure'); - $this->convertParameters($value->getValues(), $type, $element, 'key'); - } elseif ($value instanceof Reference || $value instanceof ServiceClosureArgument) { - $element->setAttribute('type', 'service'); - if ($value instanceof ServiceClosureArgument) { - $element->setAttribute('type', 'service_closure'); - $value = $value->getValues()[0]; - } - $element->setAttribute('id', (string) $value); - $behavior = $value->getInvalidBehavior(); - if (ContainerInterface::NULL_ON_INVALID_REFERENCE == $behavior) { - $element->setAttribute('on-invalid', 'null'); - } elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behavior) { - $element->setAttribute('on-invalid', 'ignore'); - } elseif (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE == $behavior) { - $element->setAttribute('on-invalid', 'ignore_uninitialized'); - } - } elseif ($value instanceof Definition) { - $element->setAttribute('type', 'service'); - $this->addService($value, null, $element); - } elseif ($value instanceof Expression) { - $element->setAttribute('type', 'expression'); - $text = $this->document->createTextNode(self::phpToXml((string) $value)); - $element->appendChild($text); - } elseif (\is_string($value) && !preg_match('/^[^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]*+$/u', $value)) { - $element->setAttribute('type', 'binary'); - $text = $this->document->createTextNode(self::phpToXml(base64_encode($value))); - $element->appendChild($text); - } elseif ($value instanceof \UnitEnum) { - $element->setAttribute('type', 'constant'); - $element->appendChild($this->document->createTextNode(self::phpToXml($value))); - } elseif ($value instanceof AbstractArgument) { - $element->setAttribute('type', 'abstract'); - $text = $this->document->createTextNode(self::phpToXml($value->getText())); - $element->appendChild($text); - } else { - if (\in_array($value, ['null', 'true', 'false'], true)) { - $element->setAttribute('type', 'string'); - } - - if (\is_string($value) && (is_numeric($value) || preg_match('/^0b[01]*$/', $value) || preg_match('/^0x[0-9a-f]++$/i', $value))) { - $element->setAttribute('type', 'string'); - } - - $text = $this->document->createTextNode(self::phpToXml($value)); - $element->appendChild($text); - } - $parent->appendChild($element); - } - } - - /** - * Escapes arguments. - */ - private function escape(array $arguments): array - { - $args = []; - foreach ($arguments as $k => $v) { - if (\is_array($v)) { - $args[$k] = $this->escape($v); - } elseif (\is_string($v)) { - $args[$k] = str_replace('%', '%%', $v); - } else { - $args[$k] = $v; - } - } - - return $args; - } - - /** - * Converts php types to xml types. - * - * @throws RuntimeException When trying to dump object or resource - */ - public static function phpToXml(mixed $value): string - { - switch (true) { - case null === $value: - return 'null'; - case true === $value: - return 'true'; - case false === $value: - return 'false'; - case $value instanceof Parameter: - return '%'.$value.'%'; - case $value instanceof \UnitEnum: - return sprintf('%s::%s', $value::class, $value->name); - case \is_object($value) || \is_resource($value): - throw new RuntimeException(sprintf('Unable to dump a service container if a parameter is an object or a resource, got "%s".', get_debug_type($value))); - default: - return (string) $value; - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Dumper/YamlDumper.php b/tests/integration/vendor/symfony/dependency-injection/Dumper/YamlDumper.php deleted file mode 100644 index 5c96e3b..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Dumper/YamlDumper.php +++ /dev/null @@ -1,380 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Dumper; - -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Argument\AbstractArgument; -use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; -use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Parameter; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\ExpressionLanguage\Expression; -use Symfony\Component\Yaml\Dumper as YmlDumper; -use Symfony\Component\Yaml\Parser; -use Symfony\Component\Yaml\Tag\TaggedValue; -use Symfony\Component\Yaml\Yaml; - -/** - * YamlDumper dumps a service container as a YAML string. - * - * @author Fabien Potencier - */ -class YamlDumper extends Dumper -{ - private YmlDumper $dumper; - - /** - * Dumps the service container as an YAML string. - */ - public function dump(array $options = []): string - { - if (!class_exists(YmlDumper::class)) { - throw new LogicException('Unable to dump the container as the Symfony Yaml Component is not installed. Try running "composer require symfony/yaml".'); - } - - $this->dumper ??= new YmlDumper(); - - return $this->container->resolveEnvPlaceholders($this->addParameters()."\n".$this->addServices()); - } - - private function addService(string $id, Definition $definition): string - { - $code = " $id:\n"; - if ($class = $definition->getClass()) { - if (str_starts_with($class, '\\')) { - $class = substr($class, 1); - } - - $code .= sprintf(" class: %s\n", $this->dumper->dump($class)); - } - - if (!$definition->isPrivate()) { - $code .= sprintf(" public: %s\n", $definition->isPublic() ? 'true' : 'false'); - } - - $tagsCode = ''; - $tags = $definition->getTags(); - $tags['container.error'] = array_map(fn ($e) => ['message' => $e], $definition->getErrors()); - foreach ($tags as $name => $tags) { - foreach ($tags as $attributes) { - $att = []; - foreach ($attributes as $key => $value) { - $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); - } - $att = $att ? ': { '.implode(', ', $att).' }' : ''; - - $tagsCode .= sprintf(" - %s%s\n", $this->dumper->dump($name), $att); - } - } - if ($tagsCode) { - $code .= " tags:\n".$tagsCode; - } - - if ($definition->getFile()) { - $code .= sprintf(" file: %s\n", $this->dumper->dump($definition->getFile())); - } - - if ($definition->isSynthetic()) { - $code .= " synthetic: true\n"; - } - - if ($definition->isDeprecated()) { - $code .= " deprecated:\n"; - foreach ($definition->getDeprecation('%service_id%') as $key => $value) { - if ('' !== $value) { - $code .= sprintf(" %s: %s\n", $key, $this->dumper->dump($value)); - } - } - } - - if ($definition->isAutowired()) { - $code .= " autowire: true\n"; - } - - if ($definition->isAutoconfigured()) { - $code .= " autoconfigure: true\n"; - } - - if ($definition->isAbstract()) { - $code .= " abstract: true\n"; - } - - if ($definition->isLazy()) { - $code .= " lazy: true\n"; - } - - if ($definition->getArguments()) { - $code .= sprintf(" arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0)); - } - - if ($definition->getProperties()) { - $code .= sprintf(" properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0)); - } - - if ($definition->getMethodCalls()) { - $code .= sprintf(" calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12)); - } - - if (!$definition->isShared()) { - $code .= " shared: false\n"; - } - - if (null !== $decoratedService = $definition->getDecoratedService()) { - [$decorated, $renamedId, $priority] = $decoratedService; - $code .= sprintf(" decorates: %s\n", $decorated); - if (null !== $renamedId) { - $code .= sprintf(" decoration_inner_name: %s\n", $renamedId); - } - if (0 !== $priority) { - $code .= sprintf(" decoration_priority: %s\n", $priority); - } - - $decorationOnInvalid = $decoratedService[3] ?? ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - if (\in_array($decorationOnInvalid, [ContainerInterface::IGNORE_ON_INVALID_REFERENCE, ContainerInterface::NULL_ON_INVALID_REFERENCE])) { - $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE === $decorationOnInvalid ? 'null' : 'ignore'; - $code .= sprintf(" decoration_on_invalid: %s\n", $invalidBehavior); - } - } - - if ($callable = $definition->getFactory()) { - if (\is_array($callable) && ['Closure', 'fromCallable'] !== $callable && $definition->getClass() === $callable[0]) { - $code .= sprintf(" constructor: %s\n", $callable[1]); - } else { - $code .= sprintf(" factory: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0)); - } - } - - if ($callable = $definition->getConfigurator()) { - $code .= sprintf(" configurator: %s\n", $this->dumper->dump($this->dumpCallable($callable), 0)); - } - - return $code; - } - - private function addServiceAlias(string $alias, Alias $id): string - { - $deprecated = ''; - - if ($id->isDeprecated()) { - $deprecated = " deprecated:\n"; - - foreach ($id->getDeprecation('%alias_id%') as $key => $value) { - if ('' !== $value) { - $deprecated .= sprintf(" %s: %s\n", $key, $value); - } - } - } - - if (!$id->isDeprecated() && $id->isPrivate()) { - return sprintf(" %s: '@%s'\n", $alias, $id); - } - - if ($id->isPublic()) { - $deprecated = " public: true\n".$deprecated; - } - - return sprintf(" %s:\n alias: %s\n%s", $alias, $id, $deprecated); - } - - private function addServices(): string - { - if (!$this->container->getDefinitions()) { - return ''; - } - - $code = "services:\n"; - foreach ($this->container->getDefinitions() as $id => $definition) { - $code .= $this->addService($id, $definition); - } - - $aliases = $this->container->getAliases(); - foreach ($aliases as $alias => $id) { - while (isset($aliases[(string) $id])) { - $id = $aliases[(string) $id]; - } - $code .= $this->addServiceAlias($alias, $id); - } - - return $code; - } - - private function addParameters(): string - { - if (!$this->container->getParameterBag()->all()) { - return ''; - } - - $parameters = $this->prepareParameters($this->container->getParameterBag()->all(), $this->container->isCompiled()); - - return $this->dumper->dump(['parameters' => $parameters], 2); - } - - /** - * Dumps callable to YAML format. - */ - private function dumpCallable(mixed $callable): mixed - { - if (\is_array($callable)) { - if ($callable[0] instanceof Reference) { - $callable = [$this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]]; - } else { - $callable = [$callable[0], $callable[1]]; - } - } - - return $callable; - } - - /** - * Dumps the value to YAML format. - * - * @throws RuntimeException When trying to dump object or resource - */ - private function dumpValue(mixed $value): mixed - { - if ($value instanceof ServiceClosureArgument) { - $value = $value->getValues()[0]; - - return new TaggedValue('service_closure', $this->dumpValue($value)); - } - if ($value instanceof ArgumentInterface) { - $tag = $value; - - if ($value instanceof TaggedIteratorArgument || ($value instanceof ServiceLocatorArgument && $tag = $value->getTaggedIteratorArgument())) { - if (null === $tag->getIndexAttribute()) { - $content = $tag->getTag(); - } else { - $content = [ - 'tag' => $tag->getTag(), - 'index_by' => $tag->getIndexAttribute(), - ]; - - if (null !== $tag->getDefaultIndexMethod()) { - $content['default_index_method'] = $tag->getDefaultIndexMethod(); - } - if (null !== $tag->getDefaultPriorityMethod()) { - $content['default_priority_method'] = $tag->getDefaultPriorityMethod(); - } - } - if ($excludes = $tag->getExclude()) { - if (!\is_array($content)) { - $content = ['tag' => $content]; - } - $content['exclude'] = 1 === \count($excludes) ? $excludes[0] : $excludes; - } - if (!$tag->excludeSelf()) { - $content['exclude_self'] = false; - } - - return new TaggedValue($value instanceof TaggedIteratorArgument ? 'tagged_iterator' : 'tagged_locator', $content); - } - - if ($value instanceof IteratorArgument) { - $tag = 'iterator'; - } elseif ($value instanceof ServiceLocatorArgument) { - $tag = 'service_locator'; - } else { - throw new RuntimeException(sprintf('Unspecified Yaml tag for type "%s".', get_debug_type($value))); - } - - return new TaggedValue($tag, $this->dumpValue($value->getValues())); - } - - if (\is_array($value)) { - $code = []; - foreach ($value as $k => $v) { - $code[$k] = $this->dumpValue($v); - } - - return $code; - } elseif ($value instanceof Reference) { - return $this->getServiceCall((string) $value, $value); - } elseif ($value instanceof Parameter) { - return $this->getParameterCall((string) $value); - } elseif ($value instanceof Expression) { - return $this->getExpressionCall((string) $value); - } elseif ($value instanceof Definition) { - return new TaggedValue('service', (new Parser())->parse("_:\n".$this->addService('_', $value), Yaml::PARSE_CUSTOM_TAGS)['_']['_']); - } elseif ($value instanceof \UnitEnum) { - return new TaggedValue('php/const', sprintf('%s::%s', $value::class, $value->name)); - } elseif ($value instanceof AbstractArgument) { - return new TaggedValue('abstract', $value->getText()); - } elseif (\is_object($value) || \is_resource($value)) { - throw new RuntimeException(sprintf('Unable to dump a service container if a parameter is an object or a resource, got "%s".', get_debug_type($value))); - } - - return $value; - } - - private function getServiceCall(string $id, Reference $reference = null): string - { - if (null !== $reference) { - switch ($reference->getInvalidBehavior()) { - case ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE: break; - case ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE: break; - case ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE: return sprintf('@!%s', $id); - default: return sprintf('@?%s', $id); - } - } - - return sprintf('@%s', $id); - } - - private function getParameterCall(string $id): string - { - return sprintf('%%%s%%', $id); - } - - private function getExpressionCall(string $expression): string - { - return sprintf('@=%s', $expression); - } - - private function prepareParameters(array $parameters, bool $escape = true): array - { - $filtered = []; - foreach ($parameters as $key => $value) { - if (\is_array($value)) { - $value = $this->prepareParameters($value, $escape); - } elseif ($value instanceof Reference || \is_string($value) && str_starts_with($value, '@')) { - $value = '@'.$value; - } - - $filtered[$key] = $value; - } - - return $escape ? $this->escape($filtered) : $filtered; - } - - private function escape(array $arguments): array - { - $args = []; - foreach ($arguments as $k => $v) { - if (\is_array($v)) { - $args[$k] = $this->escape($v); - } elseif (\is_string($v)) { - $args[$k] = str_replace('%', '%%', $v); - } else { - $args[$k] = $v; - } - } - - return $args; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php deleted file mode 100644 index 5f22fa5..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * Thrown when a definition cannot be autowired. - */ -class AutowiringFailedException extends RuntimeException -{ - private string $serviceId; - private ?\Closure $messageCallback = null; - - public function __construct(string $serviceId, string|\Closure $message = '', int $code = 0, \Throwable $previous = null) - { - $this->serviceId = $serviceId; - - if ($message instanceof \Closure - && (\function_exists('xdebug_is_enabled') ? xdebug_is_enabled() : \function_exists('xdebug_info')) - ) { - $message = $message(); - } - - if (!$message instanceof \Closure) { - parent::__construct($message, $code, $previous); - - return; - } - - $this->messageCallback = $message; - parent::__construct('', $code, $previous); - - $this->message = new class($this->message, $this->messageCallback) { - private string|self $message; - private ?\Closure $messageCallback; - - public function __construct(&$message, &$messageCallback) - { - $this->message = &$message; - $this->messageCallback = &$messageCallback; - } - - public function __toString(): string - { - $messageCallback = $this->messageCallback; - $this->messageCallback = null; - - try { - return $this->message = $messageCallback(); - } catch (\Throwable $e) { - return $this->message = $e->getMessage(); - } - } - }; - } - - public function getMessageCallback(): ?\Closure - { - return $this->messageCallback; - } - - /** - * @return string - */ - public function getServiceId() - { - return $this->serviceId; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/BadMethodCallException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/BadMethodCallException.php deleted file mode 100644 index 959238e..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/BadMethodCallException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * Base BadMethodCallException for Dependency Injection component. - */ -class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php deleted file mode 100644 index 04ac848..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * This exception is thrown when an environment variable is not found. - * - * @author Nicolas Grekas - */ -class EnvNotFoundException extends InvalidArgumentException -{ -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/EnvParameterException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/EnvParameterException.php deleted file mode 100644 index 48b5e48..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/EnvParameterException.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * This exception wraps exceptions whose messages contain a reference to an env parameter. - * - * @author Nicolas Grekas - */ -class EnvParameterException extends InvalidArgumentException -{ - public function __construct(array $envs, \Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.') - { - parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/ExceptionInterface.php b/tests/integration/vendor/symfony/dependency-injection/Exception/ExceptionInterface.php deleted file mode 100644 index 6202df7..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/ExceptionInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -use Psr\Container\ContainerExceptionInterface; - -/** - * Base ExceptionInterface for Dependency Injection component. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - */ -interface ExceptionInterface extends ContainerExceptionInterface, \Throwable -{ -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/InvalidArgumentException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/InvalidArgumentException.php deleted file mode 100644 index 119bb7d..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/InvalidArgumentException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * Base InvalidArgumentException for Dependency Injection component. - * - * @author Bulat Shakirzyanov - */ -class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/LogicException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/LogicException.php deleted file mode 100644 index 17a070c..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/LogicException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * Base LogicException for Dependency Injection component. - */ -class LogicException extends \LogicException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/OutOfBoundsException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/OutOfBoundsException.php deleted file mode 100644 index a61f143..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/OutOfBoundsException.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * Base OutOfBoundsException for Dependency Injection component. - */ -class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php deleted file mode 100644 index 9fc3b50..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * This exception is thrown when a circular reference in a parameter is detected. - * - * @author Fabien Potencier - */ -class ParameterCircularReferenceException extends RuntimeException -{ - private array $parameters; - - public function __construct(array $parameters, \Throwable $previous = null) - { - parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous); - - $this->parameters = $parameters; - } - - /** - * @return array - */ - public function getParameters() - { - return $this->parameters; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php deleted file mode 100644 index 69f7b3a..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php +++ /dev/null @@ -1,120 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -use Psr\Container\NotFoundExceptionInterface; - -/** - * This exception is thrown when a non-existent parameter is used. - * - * @author Fabien Potencier - */ -class ParameterNotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface -{ - private string $key; - private ?string $sourceId; - private ?string $sourceKey; - private array $alternatives; - private ?string $nonNestedAlternative; - - /** - * @param string $key The requested parameter key - * @param string|null $sourceId The service id that references the non-existent parameter - * @param string|null $sourceKey The parameter key that references the non-existent parameter - * @param \Throwable|null $previous The previous exception - * @param string[] $alternatives Some parameter name alternatives - * @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters - */ - public function __construct(string $key, string $sourceId = null, string $sourceKey = null, \Throwable $previous = null, array $alternatives = [], string $nonNestedAlternative = null) - { - $this->key = $key; - $this->sourceId = $sourceId; - $this->sourceKey = $sourceKey; - $this->alternatives = $alternatives; - $this->nonNestedAlternative = $nonNestedAlternative; - - parent::__construct('', 0, $previous); - - $this->updateRepr(); - } - - /** - * @return void - */ - public function updateRepr() - { - if (null !== $this->sourceId) { - $this->message = sprintf('The service "%s" has a dependency on a non-existent parameter "%s".', $this->sourceId, $this->key); - } elseif (null !== $this->sourceKey) { - $this->message = sprintf('The parameter "%s" has a dependency on a non-existent parameter "%s".', $this->sourceKey, $this->key); - } elseif ('.' === ($this->key[0] ?? '')) { - $this->message = sprintf('Parameter "%s" not found. It was probably deleted during the compilation of the container.', $this->key); - } else { - $this->message = sprintf('You have requested a non-existent parameter "%s".', $this->key); - } - - if ($this->alternatives) { - if (1 == \count($this->alternatives)) { - $this->message .= ' Did you mean this: "'; - } else { - $this->message .= ' Did you mean one of these: "'; - } - $this->message .= implode('", "', $this->alternatives).'"?'; - } elseif (null !== $this->nonNestedAlternative) { - $this->message .= ' You cannot access nested array items, do you want to inject "'.$this->nonNestedAlternative.'" instead?'; - } - } - - /** - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * @return string|null - */ - public function getSourceId() - { - return $this->sourceId; - } - - /** - * @return string|null - */ - public function getSourceKey() - { - return $this->sourceKey; - } - - /** - * @return void - */ - public function setSourceId(?string $sourceId) - { - $this->sourceId = $sourceId; - - $this->updateRepr(); - } - - /** - * @return void - */ - public function setSourceKey(?string $sourceKey) - { - $this->sourceKey = $sourceKey; - - $this->updateRepr(); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/RuntimeException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/RuntimeException.php deleted file mode 100644 index 5c24541..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/RuntimeException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * Base RuntimeException for Dependency Injection component. - * - * @author Johannes M. Schmitt - */ -class RuntimeException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php deleted file mode 100644 index d62c225..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -/** - * This exception is thrown when a circular reference is detected. - * - * @author Johannes M. Schmitt - */ -class ServiceCircularReferenceException extends RuntimeException -{ - private string $serviceId; - private array $path; - - public function __construct(string $serviceId, array $path, \Throwable $previous = null) - { - parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous); - - $this->serviceId = $serviceId; - $this->path = $path; - } - - /** - * @return string - */ - public function getServiceId() - { - return $this->serviceId; - } - - /** - * @return array - */ - public function getPath() - { - return $this->path; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php b/tests/integration/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php deleted file mode 100644 index d56db77..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Exception; - -use Psr\Container\NotFoundExceptionInterface; - -/** - * This exception is thrown when a non-existent service is requested. - * - * @author Johannes M. Schmitt - */ -class ServiceNotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface -{ - private string $id; - private ?string $sourceId; - private array $alternatives; - - public function __construct(string $id, string $sourceId = null, \Throwable $previous = null, array $alternatives = [], string $msg = null) - { - if (null !== $msg) { - // no-op - } elseif (null === $sourceId) { - $msg = sprintf('You have requested a non-existent service "%s".', $id); - } else { - $msg = sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id); - } - - if ($alternatives) { - if (1 == \count($alternatives)) { - $msg .= ' Did you mean this: "'; - } else { - $msg .= ' Did you mean one of these: "'; - } - $msg .= implode('", "', $alternatives).'"?'; - } - - parent::__construct($msg, 0, $previous); - - $this->id = $id; - $this->sourceId = $sourceId; - $this->alternatives = $alternatives; - } - - /** - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * @return string|null - */ - public function getSourceId() - { - return $this->sourceId; - } - - /** - * @return array - */ - public function getAlternatives() - { - return $this->alternatives; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ExpressionLanguage.php b/tests/integration/vendor/symfony/dependency-injection/ExpressionLanguage.php deleted file mode 100644 index 1a7f5fd..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ExpressionLanguage.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Psr\Cache\CacheItemPoolInterface; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage; - -if (!class_exists(BaseExpressionLanguage::class)) { - return; -} - -/** - * Adds some function to the default ExpressionLanguage. - * - * @author Fabien Potencier - * - * @see ExpressionLanguageProvider - */ -class ExpressionLanguage extends BaseExpressionLanguage -{ - public function __construct(CacheItemPoolInterface $cache = null, array $providers = [], callable $serviceCompiler = null, \Closure $getEnv = null) - { - // prepend the default provider to let users override it easily - array_unshift($providers, new ExpressionLanguageProvider($serviceCompiler, $getEnv)); - - parent::__construct($cache, $providers); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php b/tests/integration/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php deleted file mode 100644 index d0cc1f7..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ExpressionLanguageProvider.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\ExpressionLanguage\ExpressionFunction; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; - -/** - * Define some ExpressionLanguage functions. - * - * To get a service, use service('request'). - * To get a parameter, use parameter('kernel.debug'). - * To get an env variable, use env('SOME_VARIABLE'). - * - * @author Fabien Potencier - */ -class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface -{ - private ?\Closure $serviceCompiler; - - private ?\Closure $getEnv; - - public function __construct(callable $serviceCompiler = null, \Closure $getEnv = null) - { - $this->serviceCompiler = null === $serviceCompiler ? null : $serviceCompiler(...); - $this->getEnv = $getEnv; - } - - public function getFunctions(): array - { - return [ - new ExpressionFunction('service', $this->serviceCompiler ?? fn ($arg) => sprintf('$container->get(%s)', $arg), fn (array $variables, $value) => $variables['container']->get($value)), - - new ExpressionFunction('parameter', fn ($arg) => sprintf('$container->getParameter(%s)', $arg), fn (array $variables, $value) => $variables['container']->getParameter($value)), - - new ExpressionFunction('env', fn ($arg) => sprintf('$container->getEnv(%s)', $arg), function (array $variables, $value) { - if (!$this->getEnv) { - throw new LogicException('You need to pass a getEnv closure to the expression langage provider to use the "env" function.'); - } - - return ($this->getEnv)($value); - }), - - new ExpressionFunction('arg', fn ($arg) => sprintf('$args?->get(%s)', $arg), fn (array $variables, $value) => $variables['args']?->get($value)), - ]; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php b/tests/integration/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php deleted file mode 100644 index a42967f..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Extension; - -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * ConfigurationExtensionInterface is the interface implemented by container extension classes. - * - * @author Kevin Bond - */ -interface ConfigurationExtensionInterface -{ - /** - * Returns extension configuration. - * - * @return ConfigurationInterface|null - */ - public function getConfiguration(array $config, ContainerBuilder $container); -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Extension/Extension.php b/tests/integration/vendor/symfony/dependency-injection/Extension/Extension.php deleted file mode 100644 index d0bd05e..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Extension/Extension.php +++ /dev/null @@ -1,135 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Extension; - -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\Config\Definition\Processor; -use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\BadMethodCallException; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\LogicException; - -/** - * Provides useful features shared by many extensions. - * - * @author Fabien Potencier - */ -abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface -{ - private array $processedConfigs = []; - - /** - * @return string|false - */ - public function getXsdValidationBasePath() - { - return false; - } - - /** - * @return string - */ - public function getNamespace() - { - return 'http://example.org/schema/dic/'.$this->getAlias(); - } - - /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * This convention is to remove the "Extension" postfix from the class - * name and then lowercase and underscore the result. So: - * - * AcmeHelloExtension - * - * becomes - * - * acme_hello - * - * This can be overridden in a sub-class to specify the alias manually. - * - * @throws BadMethodCallException When the extension name does not follow conventions - */ - public function getAlias(): string - { - $className = static::class; - if (!str_ends_with($className, 'Extension')) { - throw new BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); - } - $classBaseName = substr(strrchr($className, '\\'), 1, -9); - - return Container::underscore($classBaseName); - } - - /** - * @return ConfigurationInterface|null - */ - public function getConfiguration(array $config, ContainerBuilder $container) - { - $class = static::class; - - if (str_contains($class, "\0")) { - return null; // ignore anonymous classes - } - - $class = substr_replace($class, '\Configuration', strrpos($class, '\\')); - $class = $container->getReflectionClass($class); - - if (!$class) { - return null; - } - - if (!$class->implementsInterface(ConfigurationInterface::class)) { - throw new LogicException(sprintf('The extension configuration class "%s" must implement "%s".', $class->getName(), ConfigurationInterface::class)); - } - - if (!($constructor = $class->getConstructor()) || !$constructor->getNumberOfRequiredParameters()) { - return $class->newInstance(); - } - - return null; - } - - final protected function processConfiguration(ConfigurationInterface $configuration, array $configs): array - { - $processor = new Processor(); - - return $this->processedConfigs[] = $processor->processConfiguration($configuration, $configs); - } - - /** - * @internal - */ - final public function getProcessedConfigs(): array - { - try { - return $this->processedConfigs; - } finally { - $this->processedConfigs = []; - } - } - - /** - * @throws InvalidArgumentException When the config is not enableable - */ - protected function isConfigEnabled(ContainerBuilder $container, array $config): bool - { - if (!\array_key_exists('enabled', $config)) { - throw new InvalidArgumentException("The config array has no 'enabled' key."); - } - - return (bool) $container->getParameterBag()->resolveValue($config['enabled']); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Extension/ExtensionInterface.php b/tests/integration/vendor/symfony/dependency-injection/Extension/ExtensionInterface.php deleted file mode 100644 index bd57eef..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Extension/ExtensionInterface.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Extension; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * ExtensionInterface is the interface implemented by container extension classes. - * - * @author Fabien Potencier - */ -interface ExtensionInterface -{ - /** - * Loads a specific configuration. - * - * @param array> $configs - * - * @return void - * - * @throws \InvalidArgumentException When provided tag is not defined in this extension - */ - public function load(array $configs, ContainerBuilder $container); - - /** - * Returns the namespace to be used for this extension (XML namespace). - * - * @return string - */ - public function getNamespace(); - - /** - * Returns the base path for the XSD files. - * - * @return string|false - */ - public function getXsdValidationBasePath(); - - /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string - */ - public function getAlias(); -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Extension/PrependExtensionInterface.php b/tests/integration/vendor/symfony/dependency-injection/Extension/PrependExtensionInterface.php deleted file mode 100644 index 0df94e1..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Extension/PrependExtensionInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Extension; - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -interface PrependExtensionInterface -{ - /** - * Allow an extension to prepend the extension configurations. - * - * @return void - */ - public function prepend(ContainerBuilder $container); -} diff --git a/tests/integration/vendor/symfony/dependency-injection/LICENSE b/tests/integration/vendor/symfony/dependency-injection/LICENSE deleted file mode 100644 index 0138f8f..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-present Fabien Potencier - -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. diff --git a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php b/tests/integration/vendor/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php deleted file mode 100644 index f4c6b29..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\LazyProxy\Instantiator; - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; - -/** - * Lazy proxy instantiator, capable of instantiating a proxy given a container, the - * service definitions and a callback that produces the real service instance. - * - * @author Marco Pivetta - */ -interface InstantiatorInterface -{ - /** - * Instantiates a proxy object. - * - * @param string $id Identifier of the requested service - * @param callable(object=) $realInstantiator A callback that is capable of producing the real service instance - * - * @return object - */ - public function instantiateProxy(ContainerInterface $container, Definition $definition, string $id, callable $realInstantiator); -} diff --git a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php b/tests/integration/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php deleted file mode 100644 index a0c445e..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\LazyProxy\Instantiator; - -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; - -/** - * Noop proxy instantiator - produces the real service instead of a proxy instance. - * - * @author Marco Pivetta - */ -class RealServiceInstantiator implements InstantiatorInterface -{ - public function instantiateProxy(ContainerInterface $container, Definition $definition, string $id, callable $realInstantiator): object - { - return $realInstantiator(); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php b/tests/integration/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php deleted file mode 100644 index 5209777..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\LazyProxy\PhpDumper; - -use Symfony\Component\DependencyInjection\Definition; - -/** - * Lazy proxy dumper capable of generating the instantiation logic PHP code for proxied services. - * - * @author Marco Pivetta - */ -interface DumperInterface -{ - /** - * Inspects whether the given definitions should produce proxy instantiation logic in the dumped container. - * - * @param bool|null &$asGhostObject Set to true after the call if the proxy is a ghost object - * @param string|null $id - */ - public function isProxyCandidate(Definition $definition/* , bool &$asGhostObject = null, string $id = null */): bool; - - /** - * Generates the code to be used to instantiate a proxy in the dumped factory code. - */ - public function getProxyFactoryCode(Definition $definition, string $id, string $factoryCode): string; - - /** - * Generates the code for the lazy proxy. - * - * @param string|null $id - */ - public function getProxyCode(Definition $definition/* , string $id = null */): string; -} diff --git a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php b/tests/integration/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php deleted file mode 100644 index daa6fed..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\LazyProxy\PhpDumper; - -use Symfony\Component\DependencyInjection\Definition; - -/** - * Null dumper, negates any proxy code generation for any given service definition. - * - * @author Marco Pivetta - * - * @final - */ -class NullDumper implements DumperInterface -{ - public function isProxyCandidate(Definition $definition, bool &$asGhostObject = null, string $id = null): bool - { - return $asGhostObject = false; - } - - public function getProxyFactoryCode(Definition $definition, string $id, string $factoryCode): string - { - return ''; - } - - public function getProxyCode(Definition $definition, string $id = null): string - { - return ''; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php b/tests/integration/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php deleted file mode 100644 index bde7d6a..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\LazyProxy; - -trigger_deprecation('symfony/dependency-injection', '6.2', 'The "%s" class is deprecated, use "%s" instead.', ProxyHelper::class, \Symfony\Component\VarExporter\ProxyHelper::class); - -/** - * @author Nicolas Grekas - * - * @deprecated since Symfony 6.2, use VarExporter's ProxyHelper instead - */ -class ProxyHelper -{ - /** - * @return string|null The FQCN or builtin name of the type hint, or null when the type hint references an invalid self|parent context - */ - public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, bool $noBuiltin = false): ?string - { - if ($p instanceof \ReflectionParameter) { - $type = $p->getType(); - } else { - $type = $r->getReturnType(); - } - if (!$type) { - return null; - } - - return self::getTypeHintForType($type, $r, $noBuiltin); - } - - private static function getTypeHintForType(\ReflectionType $type, \ReflectionFunctionAbstract $r, bool $noBuiltin): ?string - { - $types = []; - $glue = '|'; - if ($type instanceof \ReflectionUnionType) { - $reflectionTypes = $type->getTypes(); - } elseif ($type instanceof \ReflectionIntersectionType) { - $reflectionTypes = $type->getTypes(); - $glue = '&'; - } elseif ($type instanceof \ReflectionNamedType) { - $reflectionTypes = [$type]; - } else { - return null; - } - - foreach ($reflectionTypes as $type) { - if ($type instanceof \ReflectionIntersectionType) { - $typeHint = self::getTypeHintForType($type, $r, $noBuiltin); - if (null === $typeHint) { - return null; - } - - $types[] = sprintf('(%s)', $typeHint); - - continue; - } - - if ($type->isBuiltin()) { - if (!$noBuiltin) { - $types[] = $type->getName(); - } - continue; - } - - $lcName = strtolower($type->getName()); - $prefix = $noBuiltin ? '' : '\\'; - - if ('self' !== $lcName && 'parent' !== $lcName) { - $types[] = $prefix.$type->getName(); - continue; - } - if (!$r instanceof \ReflectionMethod) { - continue; - } - if ('self' === $lcName) { - $types[] = $prefix.$r->getDeclaringClass()->name; - } else { - $types[] = ($parent = $r->getDeclaringClass()->getParentClass()) ? $prefix.$parent->name : null; - } - } - - sort($types); - - return $types ? implode($glue, $types) : null; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Loader/ClosureLoader.php b/tests/integration/vendor/symfony/dependency-injection/Loader/ClosureLoader.php deleted file mode 100644 index 94305ae..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Loader/ClosureLoader.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Loader; - -use Symfony\Component\Config\Loader\Loader; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -/** - * ClosureLoader loads service definitions from a PHP closure. - * - * The Closure has access to the container as its first argument. - * - * @author Fabien Potencier - */ -class ClosureLoader extends Loader -{ - private ContainerBuilder $container; - - public function __construct(ContainerBuilder $container, string $env = null) - { - $this->container = $container; - parent::__construct($env); - } - - public function load(mixed $resource, string $type = null): mixed - { - return $resource($this->container, $this->env); - } - - public function supports(mixed $resource, string $type = null): bool - { - return $resource instanceof \Closure; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php b/tests/integration/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php deleted file mode 100644 index 1b5e81d..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php +++ /dev/null @@ -1,50 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Loader; - -/** - * DirectoryLoader is a recursive loader to go through directories. - * - * @author Sebastien Lavoie - */ -class DirectoryLoader extends FileLoader -{ - public function load(mixed $file, string $type = null): mixed - { - $file = rtrim($file, '/'); - $path = $this->locator->locate($file); - $this->container->fileExists($path, false); - - foreach (scandir($path) as $dir) { - if ('.' !== $dir[0]) { - if (is_dir($path.'/'.$dir)) { - $dir .= '/'; // append / to allow recursion - } - - $this->setCurrentDir($path); - - $this->import($dir, null, false, $path); - } - } - - return null; - } - - public function supports(mixed $resource, string $type = null): bool - { - if ('directory' === $type) { - return true; - } - - return null === $type && \is_string($resource) && str_ends_with($resource, '/'); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Loader/FileLoader.php b/tests/integration/vendor/symfony/dependency-injection/Loader/FileLoader.php deleted file mode 100644 index 86543c1..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Loader/FileLoader.php +++ /dev/null @@ -1,329 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Loader; - -use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; -use Symfony\Component\Config\Exception\LoaderLoadException; -use Symfony\Component\Config\FileLocatorInterface; -use Symfony\Component\Config\Loader\FileLoader as BaseFileLoader; -use Symfony\Component\Config\Loader\Loader; -use Symfony\Component\Config\Resource\GlobResource; -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Attribute\AsAlias; -use Symfony\Component\DependencyInjection\Attribute\Exclude; -use Symfony\Component\DependencyInjection\Attribute\When; -use Symfony\Component\DependencyInjection\ChildDefinition; -use Symfony\Component\DependencyInjection\Compiler\RegisterAutoconfigureAttributesPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\LogicException; - -/** - * FileLoader is the abstract class used by all built-in loaders that are file based. - * - * @author Fabien Potencier - */ -abstract class FileLoader extends BaseFileLoader -{ - public const ANONYMOUS_ID_REGEXP = '/^\.\d+_[^~]*+~[._a-zA-Z\d]{7}$/'; - - protected $container; - protected $isLoadingInstanceof = false; - protected $instanceof = []; - protected $interfaces = []; - protected $singlyImplemented = []; - /** @var array */ - protected $aliases = []; - protected $autoRegisterAliasesForSinglyImplementedInterfaces = true; - - public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, string $env = null) - { - $this->container = $container; - - parent::__construct($locator, $env); - } - - /** - * @param bool|string $ignoreErrors Whether errors should be ignored; pass "not_found" to ignore only when the loaded resource is not found - */ - public function import(mixed $resource, string $type = null, bool|string $ignoreErrors = false, string $sourceResource = null, $exclude = null): mixed - { - $args = \func_get_args(); - - if ($ignoreNotFound = 'not_found' === $ignoreErrors) { - $args[2] = false; - } elseif (!\is_bool($ignoreErrors)) { - throw new \TypeError(sprintf('Invalid argument $ignoreErrors provided to "%s::import()": boolean or "not_found" expected, "%s" given.', static::class, get_debug_type($ignoreErrors))); - } - - try { - return parent::import(...$args); - } catch (LoaderLoadException $e) { - if (!$ignoreNotFound || !($prev = $e->getPrevious()) instanceof FileLocatorFileNotFoundException) { - throw $e; - } - - foreach ($prev->getTrace() as $frame) { - if ('import' === ($frame['function'] ?? null) && is_a($frame['class'] ?? '', Loader::class, true)) { - break; - } - } - - if (__FILE__ !== $frame['file']) { - throw $e; - } - } - - return null; - } - - /** - * Registers a set of classes as services using PSR-4 for discovery. - * - * @param Definition $prototype A definition to use as template - * @param string $namespace The namespace prefix of classes in the scanned directory - * @param string $resource The directory to look for classes, glob-patterns allowed - * @param string|string[]|null $exclude A globbed path of files to exclude or an array of globbed paths of files to exclude - * @param string|null $source The path to the file that defines the auto-discovery rule - * - * @return void - */ - public function registerClasses(Definition $prototype, string $namespace, string $resource, string|array $exclude = null/* , string $source = null */) - { - if (!str_ends_with($namespace, '\\')) { - throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": "%s".', $namespace)); - } - if (!preg_match('/^(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+\\\\)++$/', $namespace)) { - throw new InvalidArgumentException(sprintf('Namespace is not a valid PSR-4 prefix: "%s".', $namespace)); - } - // This can happen with YAML files - if (\is_array($exclude) && \in_array(null, $exclude, true)) { - throw new InvalidArgumentException('The exclude list must not contain a "null" value.'); - } - // This can happen with XML files - if (\is_array($exclude) && \in_array('', $exclude, true)) { - throw new InvalidArgumentException('The exclude list must not contain an empty value.'); - } - - $source = \func_num_args() > 4 ? func_get_arg(4) : null; - $autoconfigureAttributes = new RegisterAutoconfigureAttributesPass(); - $autoconfigureAttributes = $autoconfigureAttributes->accept($prototype) ? $autoconfigureAttributes : null; - $classes = $this->findClasses($namespace, $resource, (array) $exclude, $autoconfigureAttributes, $source); - // prepare for deep cloning - $serializedPrototype = serialize($prototype); - - foreach ($classes as $class => $errorMessage) { - if (null === $errorMessage && $autoconfigureAttributes) { - $r = $this->container->getReflectionClass($class); - if ($r->getAttributes(Exclude::class)[0] ?? null) { - $this->addContainerExcludedTag($class, $source); - continue; - } - if ($this->env) { - $attribute = null; - foreach ($r->getAttributes(When::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) { - if ($this->env === $attribute->newInstance()->env) { - $attribute = null; - break; - } - } - if (null !== $attribute) { - $this->addContainerExcludedTag($class, $source); - continue; - } - } - } - - if (interface_exists($class, false)) { - $this->interfaces[] = $class; - } else { - $this->setDefinition($class, $definition = unserialize($serializedPrototype)); - if (null !== $errorMessage) { - $definition->addError($errorMessage); - - continue; - } - $definition->setClass($class); - - $interfaces = []; - foreach (class_implements($class, false) as $interface) { - $this->singlyImplemented[$interface] = ($this->singlyImplemented[$interface] ?? $class) !== $class ? false : $class; - $interfaces[] = $interface; - } - - if (!$autoconfigureAttributes) { - continue; - } - $r = $this->container->getReflectionClass($class); - $defaultAlias = 1 === \count($interfaces) ? $interfaces[0] : null; - foreach ($r->getAttributes(AsAlias::class) as $attr) { - /** @var AsAlias $attribute */ - $attribute = $attr->newInstance(); - $alias = $attribute->id ?? $defaultAlias; - $public = $attribute->public; - if (null === $alias) { - throw new LogicException(sprintf('Alias cannot be automatically determined for class "%s". If you have used the #[AsAlias] attribute with a class implementing multiple interfaces, add the interface you want to alias to the first parameter of #[AsAlias].', $class)); - } - if (isset($this->aliases[$alias])) { - throw new LogicException(sprintf('The "%s" alias has already been defined with the #[AsAlias] attribute in "%s".', $alias, $this->aliases[$alias])); - } - $this->aliases[$alias] = new Alias($class, $public); - } - } - } - - foreach ($this->aliases as $alias => $aliasDefinition) { - $this->container->setAlias($alias, $aliasDefinition); - } - - if ($this->autoRegisterAliasesForSinglyImplementedInterfaces) { - $this->registerAliasesForSinglyImplementedInterfaces(); - } - } - - /** - * @return void - */ - public function registerAliasesForSinglyImplementedInterfaces() - { - foreach ($this->interfaces as $interface) { - if (!empty($this->singlyImplemented[$interface]) && !isset($this->aliases[$interface]) && !$this->container->has($interface)) { - $this->container->setAlias($interface, $this->singlyImplemented[$interface]); - } - } - - $this->interfaces = $this->singlyImplemented = $this->aliases = []; - } - - /** - * Registers a definition in the container with its instanceof-conditionals. - * - * @return void - */ - protected function setDefinition(string $id, Definition $definition) - { - $this->container->removeBindings($id); - - foreach ($definition->getTag('container.error') as $error) { - if (isset($error['message'])) { - $definition->addError($error['message']); - } - } - - if ($this->isLoadingInstanceof) { - if (!$definition instanceof ChildDefinition) { - throw new InvalidArgumentException(sprintf('Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, get_debug_type($definition))); - } - $this->instanceof[$id] = $definition; - } else { - $this->container->setDefinition($id, $definition->setInstanceofConditionals($this->instanceof)); - } - } - - private function findClasses(string $namespace, string $pattern, array $excludePatterns, ?RegisterAutoconfigureAttributesPass $autoconfigureAttributes, ?string $source): array - { - $parameterBag = $this->container->getParameterBag(); - - $excludePaths = []; - $excludePrefix = null; - $excludePatterns = $parameterBag->unescapeValue($parameterBag->resolveValue($excludePatterns)); - foreach ($excludePatterns as $excludePattern) { - foreach ($this->glob($excludePattern, true, $resource, true, true) as $path => $info) { - $excludePrefix ??= $resource->getPrefix(); - - // normalize Windows slashes and remove trailing slashes - $excludePaths[rtrim(str_replace('\\', '/', $path), '/')] = true; - } - } - - $pattern = $parameterBag->unescapeValue($parameterBag->resolveValue($pattern)); - $classes = []; - $prefixLen = null; - foreach ($this->glob($pattern, true, $resource, false, false, $excludePaths) as $path => $info) { - if (null === $prefixLen) { - $prefixLen = \strlen($resource->getPrefix()); - - if ($excludePrefix && !str_starts_with($excludePrefix, $resource->getPrefix())) { - throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $namespace, $excludePattern, $pattern)); - } - } - - if (isset($excludePaths[str_replace('\\', '/', $path)])) { - continue; - } - - if (!str_ends_with($path, '.php')) { - continue; - } - $class = $namespace.ltrim(str_replace('/', '\\', substr($path, $prefixLen, -4)), '\\'); - - if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+$/', $class)) { - continue; - } - - try { - $r = $this->container->getReflectionClass($class); - } catch (\ReflectionException $e) { - $classes[$class] = $e->getMessage(); - continue; - } - // check to make sure the expected class exists - if (!$r) { - throw new InvalidArgumentException(sprintf('Expected to find class "%s" in file "%s" while importing services from resource "%s", but it was not found! Check the namespace prefix used with the resource.', $class, $path, $pattern)); - } - - if ($r->isInstantiable() || $r->isInterface()) { - $classes[$class] = null; - } - - if ($autoconfigureAttributes && !$r->isInstantiable()) { - $autoconfigureAttributes->processClass($this->container, $r); - } - } - - // track only for new & removed files - if ($resource instanceof GlobResource) { - $this->container->addResource($resource); - } else { - foreach ($resource as $path) { - $this->container->fileExists($path, false); - } - } - - if (null !== $prefixLen) { - foreach ($excludePaths as $path => $_) { - $class = $namespace.ltrim(str_replace('/', '\\', substr($path, $prefixLen, str_ends_with($path, '.php') ? -4 : null)), '\\'); - $this->addContainerExcludedTag($class, $source); - } - } - - return $classes; - } - - private function addContainerExcludedTag(string $class, ?string $source): void - { - if ($this->container->has($class)) { - return; - } - - static $attributes = []; - - if (null !== $source && !isset($attributes[$source])) { - $attributes[$source] = ['source' => sprintf('in "%s/%s"', basename(\dirname($source)), basename($source))]; - } - - $this->container->register($class, $class) - ->setAbstract(true) - ->addTag('container.excluded', null !== $source ? $attributes[$source] : []); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Loader/IniFileLoader.php b/tests/integration/vendor/symfony/dependency-injection/Loader/IniFileLoader.php deleted file mode 100644 index c177790..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Loader/IniFileLoader.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Loader; - -use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; - -/** - * IniFileLoader loads parameters from INI files. - * - * @author Fabien Potencier - */ -class IniFileLoader extends FileLoader -{ - public function load(mixed $resource, string $type = null): mixed - { - $path = $this->locator->locate($resource); - - $this->container->fileExists($path); - - // first pass to catch parsing errors - $result = parse_ini_file($path, true); - if (false === $result || [] === $result) { - throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $resource)); - } - - // real raw parsing - $result = parse_ini_file($path, true, \INI_SCANNER_RAW); - - if (isset($result['parameters']) && \is_array($result['parameters'])) { - foreach ($result['parameters'] as $key => $value) { - if (\is_array($value)) { - $this->container->setParameter($key, array_map($this->phpize(...), $value)); - } else { - $this->container->setParameter($key, $this->phpize($value)); - } - } - } - - if ($this->env && \is_array($result['parameters@'.$this->env] ?? null)) { - foreach ($result['parameters@'.$this->env] as $key => $value) { - $this->container->setParameter($key, $this->phpize($value)); - } - } - - return null; - } - - public function supports(mixed $resource, string $type = null): bool - { - if (!\is_string($resource)) { - return false; - } - - if (null === $type && 'ini' === pathinfo($resource, \PATHINFO_EXTENSION)) { - return true; - } - - return 'ini' === $type; - } - - /** - * Note that the following features are not supported: - * * strings with escaped quotes are not supported "foo\"bar"; - * * string concatenation ("foo" "bar"). - */ - private function phpize(string $value): mixed - { - // trim on the right as comments removal keep whitespaces - if ($value !== $v = rtrim($value)) { - $value = '""' === substr_replace($v, '', 1, -1) ? substr($v, 1, -1) : $v; - } - $lowercaseValue = strtolower($value); - - return match (true) { - \defined($value) => \constant($value), - 'yes' === $lowercaseValue, - 'on' === $lowercaseValue => true, - 'no' === $lowercaseValue, - 'off' === $lowercaseValue, - 'none' === $lowercaseValue => false, - isset($value[1]) && ( - ("'" === $value[0] && "'" === $value[\strlen($value) - 1]) - || ('"' === $value[0] && '"' === $value[\strlen($value) - 1]) - ) => substr($value, 1, -1), // quoted string - default => XmlUtils::phpize($value), - }; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php b/tests/integration/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php deleted file mode 100644 index e56fb51..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php +++ /dev/null @@ -1,206 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Loader; - -use Symfony\Component\Config\Builder\ConfigBuilderGenerator; -use Symfony\Component\Config\Builder\ConfigBuilderGeneratorInterface; -use Symfony\Component\Config\Builder\ConfigBuilderInterface; -use Symfony\Component\Config\FileLocatorInterface; -use Symfony\Component\DependencyInjection\Attribute\When; -use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; - -/** - * PhpFileLoader loads service definitions from a PHP file. - * - * The PHP file is required and the $container variable can be - * used within the file to change the container. - * - * @author Fabien Potencier - */ -class PhpFileLoader extends FileLoader -{ - protected $autoRegisterAliasesForSinglyImplementedInterfaces = false; - private ?ConfigBuilderGeneratorInterface $generator; - - public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, string $env = null, ConfigBuilderGeneratorInterface $generator = null) - { - parent::__construct($container, $locator, $env); - $this->generator = $generator; - } - - public function load(mixed $resource, string $type = null): mixed - { - // the container and loader variables are exposed to the included file below - $container = $this->container; - $loader = $this; - - $path = $this->locator->locate($resource); - $this->setCurrentDir(\dirname($path)); - $this->container->fileExists($path); - - // the closure forbids access to the private scope in the included file - $load = \Closure::bind(function ($path, $env) use ($container, $loader, $resource, $type) { - return include $path; - }, $this, ProtectedPhpFileLoader::class); - - try { - $callback = $load($path, $this->env); - - if (\is_object($callback) && \is_callable($callback)) { - $this->executeCallback($callback, new ContainerConfigurator($this->container, $this, $this->instanceof, $path, $resource, $this->env), $path); - } - } finally { - $this->instanceof = []; - $this->registerAliasesForSinglyImplementedInterfaces(); - } - - return null; - } - - public function supports(mixed $resource, string $type = null): bool - { - if (!\is_string($resource)) { - return false; - } - - if (null === $type && 'php' === pathinfo($resource, \PATHINFO_EXTENSION)) { - return true; - } - - return 'php' === $type; - } - - /** - * Resolve the parameters to the $callback and execute it. - */ - private function executeCallback(callable $callback, ContainerConfigurator $containerConfigurator, string $path): void - { - $callback = $callback(...); - $arguments = []; - $configBuilders = []; - $r = new \ReflectionFunction($callback); - - $attribute = null; - foreach ($r->getAttributes(When::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) { - if ($this->env === $attribute->newInstance()->env) { - $attribute = null; - break; - } - } - if (null !== $attribute) { - return; - } - - foreach ($r->getParameters() as $parameter) { - $reflectionType = $parameter->getType(); - if (!$reflectionType instanceof \ReflectionNamedType) { - throw new \InvalidArgumentException(sprintf('Could not resolve argument "$%s" for "%s". You must typehint it (for example with "%s" or "%s").', $parameter->getName(), $path, ContainerConfigurator::class, ContainerBuilder::class)); - } - $type = $reflectionType->getName(); - - switch ($type) { - case ContainerConfigurator::class: - $arguments[] = $containerConfigurator; - break; - case ContainerBuilder::class: - $arguments[] = $this->container; - break; - case FileLoader::class: - case self::class: - $arguments[] = $this; - break; - case 'string': - if (null !== $this->env && 'env' === $parameter->getName()) { - $arguments[] = $this->env; - break; - } - // no break - default: - try { - $configBuilder = $this->configBuilder($type); - } catch (InvalidArgumentException|\LogicException $e) { - throw new \InvalidArgumentException(sprintf('Could not resolve argument "%s" for "%s".', $type.' $'.$parameter->getName(), $path), 0, $e); - } - $configBuilders[] = $configBuilder; - $arguments[] = $configBuilder; - } - } - - // Force load ContainerConfigurator to make env(), param() etc available. - class_exists(ContainerConfigurator::class); - - $callback(...$arguments); - - /** @var ConfigBuilderInterface $configBuilder */ - foreach ($configBuilders as $configBuilder) { - $containerConfigurator->extension($configBuilder->getExtensionAlias(), $configBuilder->toArray()); - } - } - - /** - * @param string $namespace FQCN string for a class implementing ConfigBuilderInterface - */ - private function configBuilder(string $namespace): ConfigBuilderInterface - { - if (!class_exists(ConfigBuilderGenerator::class)) { - throw new \LogicException('You cannot use the config builder as the Config component is not installed. Try running "composer require symfony/config".'); - } - - if (null === $this->generator) { - throw new \LogicException('You cannot use the ConfigBuilders without providing a class implementing ConfigBuilderGeneratorInterface.'); - } - - // If class exists and implements ConfigBuilderInterface - if (class_exists($namespace) && is_subclass_of($namespace, ConfigBuilderInterface::class)) { - return new $namespace(); - } - - // If it does not start with Symfony\Config\ we don't know how to handle this - if (!str_starts_with($namespace, 'Symfony\\Config\\')) { - throw new InvalidArgumentException(sprintf('Could not find or generate class "%s".', $namespace)); - } - - // Try to get the extension alias - $alias = Container::underscore(substr($namespace, 15, -6)); - - if (str_contains($alias, '\\')) { - throw new InvalidArgumentException('You can only use "root" ConfigBuilders from "Symfony\\Config\\" namespace. Nested classes like "Symfony\\Config\\Framework\\CacheConfig" cannot be used.'); - } - - if (!$this->container->hasExtension($alias)) { - $extensions = array_filter(array_map(fn (ExtensionInterface $ext) => $ext->getAlias(), $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s". Looked for namespace "%s", found "%s".', $namespace, $alias, $extensions ? implode('", "', $extensions) : 'none')); - } - - $extension = $this->container->getExtension($alias); - if (!$extension instanceof ConfigurationExtensionInterface) { - throw new \LogicException(sprintf('You cannot use the config builder for "%s" because the extension does not implement "%s".', $namespace, ConfigurationExtensionInterface::class)); - } - - $configuration = $extension->getConfiguration([], $this->container); - $loader = $this->generator->build($configuration); - - return $loader(); - } -} - -/** - * @internal - */ -final class ProtectedPhpFileLoader extends PhpFileLoader -{ -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php b/tests/integration/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php deleted file mode 100644 index b6eb673..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php +++ /dev/null @@ -1,863 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Loader; - -use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Argument\AbstractArgument; -use Symfony\Component\DependencyInjection\Argument\BoundArgument; -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; -use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; -use Symfony\Component\DependencyInjection\ChildDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\ExpressionLanguage\Expression; - -/** - * XmlFileLoader loads XML files service definitions. - * - * @author Fabien Potencier - */ -class XmlFileLoader extends FileLoader -{ - public const NS = 'http://symfony.com/schema/dic/services'; - - protected $autoRegisterAliasesForSinglyImplementedInterfaces = false; - - public function load(mixed $resource, string $type = null): mixed - { - $path = $this->locator->locate($resource); - - $xml = $this->parseFileToDOM($path); - - $this->container->fileExists($path); - - $this->loadXml($xml, $path); - - if ($this->env) { - $xpath = new \DOMXPath($xml); - $xpath->registerNamespace('container', self::NS); - foreach ($xpath->query(sprintf('//container:when[@env="%s"]', $this->env)) ?: [] as $root) { - $env = $this->env; - $this->env = null; - try { - $this->loadXml($xml, $path, $root); - } finally { - $this->env = $env; - } - } - } - - return null; - } - - private function loadXml(\DOMDocument $xml, string $path, \DOMNode $root = null): void - { - $defaults = $this->getServiceDefaults($xml, $path, $root); - - // anonymous services - $this->processAnonymousServices($xml, $path, $root); - - // imports - $this->parseImports($xml, $path, $root); - - // parameters - $this->parseParameters($xml, $path, $root); - - // extensions - $this->loadFromExtensions($xml, $root); - - // services - try { - $this->parseDefinitions($xml, $path, $defaults, $root); - } finally { - $this->instanceof = []; - $this->registerAliasesForSinglyImplementedInterfaces(); - } - } - - public function supports(mixed $resource, string $type = null): bool - { - if (!\is_string($resource)) { - return false; - } - - if (null === $type && 'xml' === pathinfo($resource, \PATHINFO_EXTENSION)) { - return true; - } - - return 'xml' === $type; - } - - private function parseParameters(\DOMDocument $xml, string $file, \DOMNode $root = null): void - { - if ($parameters = $this->getChildren($root ?? $xml->documentElement, 'parameters')) { - $this->container->getParameterBag()->add($this->getArgumentsAsPhp($parameters[0], 'parameter', $file)); - } - } - - private function parseImports(\DOMDocument $xml, string $file, \DOMNode $root = null): void - { - $xpath = new \DOMXPath($xml); - $xpath->registerNamespace('container', self::NS); - - if (false === $imports = $xpath->query('.//container:imports/container:import', $root)) { - return; - } - - $defaultDirectory = \dirname($file); - foreach ($imports as $import) { - $this->setCurrentDir($defaultDirectory); - $this->import($import->getAttribute('resource'), XmlUtils::phpize($import->getAttribute('type')) ?: null, XmlUtils::phpize($import->getAttribute('ignore-errors')) ?: false, $file); - } - } - - private function parseDefinitions(\DOMDocument $xml, string $file, Definition $defaults, \DOMNode $root = null): void - { - $xpath = new \DOMXPath($xml); - $xpath->registerNamespace('container', self::NS); - - if (false === $services = $xpath->query('.//container:services/container:service|.//container:services/container:prototype|.//container:services/container:stack', $root)) { - return; - } - $this->setCurrentDir(\dirname($file)); - - $this->instanceof = []; - $this->isLoadingInstanceof = true; - $instanceof = $xpath->query('.//container:services/container:instanceof', $root); - foreach ($instanceof as $service) { - $this->setDefinition((string) $service->getAttribute('id'), $this->parseDefinition($service, $file, new Definition())); - } - - $this->isLoadingInstanceof = false; - foreach ($services as $service) { - if ('stack' === $service->tagName) { - $service->setAttribute('parent', '-'); - $definition = $this->parseDefinition($service, $file, $defaults) - ->setTags(array_merge_recursive(['container.stack' => [[]]], $defaults->getTags())) - ; - $this->setDefinition($id = (string) $service->getAttribute('id'), $definition); - $stack = []; - - foreach ($this->getChildren($service, 'service') as $k => $frame) { - $k = $frame->getAttribute('id') ?: $k; - $frame->setAttribute('id', $id.'" at index "'.$k); - - if ($alias = $frame->getAttribute('alias')) { - $this->validateAlias($frame, $file); - $stack[$k] = new Reference($alias); - } else { - $stack[$k] = $this->parseDefinition($frame, $file, $defaults) - ->setInstanceofConditionals($this->instanceof); - } - } - - $definition->setArguments($stack); - } elseif (null !== $definition = $this->parseDefinition($service, $file, $defaults)) { - if ('prototype' === $service->tagName) { - $excludes = array_column($this->getChildren($service, 'exclude'), 'nodeValue'); - if ($service->hasAttribute('exclude')) { - if (\count($excludes) > 0) { - throw new InvalidArgumentException('You cannot use both the attribute "exclude" and tags at the same time.'); - } - $excludes = [$service->getAttribute('exclude')]; - } - $this->registerClasses($definition, (string) $service->getAttribute('namespace'), (string) $service->getAttribute('resource'), $excludes, $file); - } else { - $this->setDefinition((string) $service->getAttribute('id'), $definition); - } - } - } - } - - private function getServiceDefaults(\DOMDocument $xml, string $file, \DOMNode $root = null): Definition - { - $xpath = new \DOMXPath($xml); - $xpath->registerNamespace('container', self::NS); - - if (null === $defaultsNode = $xpath->query('.//container:services/container:defaults', $root)->item(0)) { - return new Definition(); - } - - $defaultsNode->setAttribute('id', ''); - - return $this->parseDefinition($defaultsNode, $file, new Definition()); - } - - /** - * Parses an individual Definition. - */ - private function parseDefinition(\DOMElement $service, string $file, Definition $defaults): ?Definition - { - if ($alias = $service->getAttribute('alias')) { - $this->validateAlias($service, $file); - - $this->container->setAlias($service->getAttribute('id'), $alias = new Alias($alias)); - if ($publicAttr = $service->getAttribute('public')) { - $alias->setPublic(XmlUtils::phpize($publicAttr)); - } elseif ($defaults->getChanges()['public'] ?? false) { - $alias->setPublic($defaults->isPublic()); - } - - if ($deprecated = $this->getChildren($service, 'deprecated')) { - $message = $deprecated[0]->nodeValue ?: ''; - $package = $deprecated[0]->getAttribute('package') ?: ''; - $version = $deprecated[0]->getAttribute('version') ?: ''; - - if (!$deprecated[0]->hasAttribute('package')) { - throw new InvalidArgumentException(sprintf('Missing attribute "package" at node "deprecated" in "%s".', $file)); - } - - if (!$deprecated[0]->hasAttribute('version')) { - throw new InvalidArgumentException(sprintf('Missing attribute "version" at node "deprecated" in "%s".', $file)); - } - - $alias->setDeprecated($package, $version, $message); - } - - return null; - } - - if ($this->isLoadingInstanceof) { - $definition = new ChildDefinition(''); - } elseif ($parent = $service->getAttribute('parent')) { - $definition = new ChildDefinition($parent); - } else { - $definition = new Definition(); - } - - if ($defaults->getChanges()['public'] ?? false) { - $definition->setPublic($defaults->isPublic()); - } - $definition->setAutowired($defaults->isAutowired()); - $definition->setAutoconfigured($defaults->isAutoconfigured()); - $definition->setChanges([]); - - foreach (['class', 'public', 'shared', 'synthetic', 'abstract'] as $key) { - if ($value = $service->getAttribute($key)) { - $method = 'set'.$key; - $definition->$method(XmlUtils::phpize($value)); - } - } - - if ($value = $service->getAttribute('lazy')) { - $definition->setLazy((bool) $value = XmlUtils::phpize($value)); - if (\is_string($value)) { - $definition->addTag('proxy', ['interface' => $value]); - } - } - - if ($value = $service->getAttribute('autowire')) { - $definition->setAutowired(XmlUtils::phpize($value)); - } - - if ($value = $service->getAttribute('autoconfigure')) { - $definition->setAutoconfigured(XmlUtils::phpize($value)); - } - - if ($files = $this->getChildren($service, 'file')) { - $definition->setFile($files[0]->nodeValue); - } - - if ($deprecated = $this->getChildren($service, 'deprecated')) { - $message = $deprecated[0]->nodeValue ?: ''; - $package = $deprecated[0]->getAttribute('package') ?: ''; - $version = $deprecated[0]->getAttribute('version') ?: ''; - - if (!$deprecated[0]->hasAttribute('package')) { - throw new InvalidArgumentException(sprintf('Missing attribute "package" at node "deprecated" in "%s".', $file)); - } - - if (!$deprecated[0]->hasAttribute('version')) { - throw new InvalidArgumentException(sprintf('Missing attribute "version" at node "deprecated" in "%s".', $file)); - } - - $definition->setDeprecated($package, $version, $message); - } - - $definition->setArguments($this->getArgumentsAsPhp($service, 'argument', $file, $definition instanceof ChildDefinition)); - $definition->setProperties($this->getArgumentsAsPhp($service, 'property', $file)); - - if ($factories = $this->getChildren($service, 'factory')) { - $factory = $factories[0]; - if ($function = $factory->getAttribute('function')) { - $definition->setFactory($function); - } elseif ($expression = $factory->getAttribute('expression')) { - if (!class_exists(Expression::class)) { - throw new \LogicException('The "expression" attribute cannot be used on factories without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); - } - $definition->setFactory('@='.$expression); - } else { - if ($childService = $factory->getAttribute('service')) { - $class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); - } else { - $class = $factory->hasAttribute('class') ? $factory->getAttribute('class') : null; - } - - $definition->setFactory([$class, $factory->getAttribute('method') ?: '__invoke']); - } - } - - if ($constructor = $service->getAttribute('constructor')) { - if (null !== $definition->getFactory()) { - throw new LogicException(sprintf('The "%s" service cannot declare a factory as well as a constructor.', $service->getAttribute('id'))); - } - - $definition->setFactory([null, $constructor]); - } - - if ($configurators = $this->getChildren($service, 'configurator')) { - $configurator = $configurators[0]; - if ($function = $configurator->getAttribute('function')) { - $definition->setConfigurator($function); - } else { - if ($childService = $configurator->getAttribute('service')) { - $class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); - } else { - $class = $configurator->getAttribute('class'); - } - - $definition->setConfigurator([$class, $configurator->getAttribute('method') ?: '__invoke']); - } - } - - foreach ($this->getChildren($service, 'call') as $call) { - $definition->addMethodCall($call->getAttribute('method'), $this->getArgumentsAsPhp($call, 'argument', $file), XmlUtils::phpize($call->getAttribute('returns-clone'))); - } - - $tags = $this->getChildren($service, 'tag'); - - foreach ($tags as $tag) { - $tagNameComesFromAttribute = $tag->childElementCount || '' === $tag->nodeValue; - if ('' === $tagName = $tagNameComesFromAttribute ? $tag->getAttribute('name') : $tag->nodeValue) { - throw new InvalidArgumentException(sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', (string) $service->getAttribute('id'), $file)); - } - - $parameters = $this->getTagAttributes($tag, sprintf('The attribute name of tag "%s" for service "%s" in %s must be a non-empty string.', $tagName, (string) $service->getAttribute('id'), $file)); - foreach ($tag->attributes as $name => $node) { - if ($tagNameComesFromAttribute && 'name' === $name) { - continue; - } - - if (str_contains($name, '-') && !str_contains($name, '_') && !\array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) { - $parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue); - } - // keep not normalized key - $parameters[$name] = XmlUtils::phpize($node->nodeValue); - } - - $definition->addTag($tagName, $parameters); - } - - $definition->setTags(array_merge_recursive($definition->getTags(), $defaults->getTags())); - - $bindings = $this->getArgumentsAsPhp($service, 'bind', $file); - $bindingType = $this->isLoadingInstanceof ? BoundArgument::INSTANCEOF_BINDING : BoundArgument::SERVICE_BINDING; - foreach ($bindings as $argument => $value) { - $bindings[$argument] = new BoundArgument($value, true, $bindingType, $file); - } - - // deep clone, to avoid multiple process of the same instance in the passes - $bindings = array_merge(unserialize(serialize($defaults->getBindings())), $bindings); - - if ($bindings) { - $definition->setBindings($bindings); - } - - if ($decorates = $service->getAttribute('decorates')) { - $decorationOnInvalid = $service->getAttribute('decoration-on-invalid') ?: 'exception'; - if ('exception' === $decorationOnInvalid) { - $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - } elseif ('ignore' === $decorationOnInvalid) { - $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; - } elseif ('null' === $decorationOnInvalid) { - $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; - } else { - throw new InvalidArgumentException(sprintf('Invalid value "%s" for attribute "decoration-on-invalid" on service "%s". Did you mean "exception", "ignore" or "null" in "%s"?', $decorationOnInvalid, $service->getAttribute('id'), $file)); - } - - $renameId = $service->hasAttribute('decoration-inner-name') ? $service->getAttribute('decoration-inner-name') : null; - $priority = $service->hasAttribute('decoration-priority') ? $service->getAttribute('decoration-priority') : 0; - - $definition->setDecoratedService($decorates, $renameId, $priority, $invalidBehavior); - } - - if ($callable = $this->getChildren($service, 'from-callable')) { - if ($definition instanceof ChildDefinition) { - throw new InvalidArgumentException(sprintf('Attribute "parent" is unsupported when using "" on service "%s".', (string) $service->getAttribute('id'))); - } - - foreach ([ - 'Attribute "synthetic"' => 'isSynthetic', - 'Attribute "file"' => 'getFile', - 'Tag ""' => 'getFactory', - 'Tag ""' => 'getArguments', - 'Tag ""' => 'getProperties', - 'Tag ""' => 'getConfigurator', - 'Tag ""' => 'getMethodCalls', - ] as $key => $method) { - if ($definition->$method()) { - throw new InvalidArgumentException($key.sprintf(' is unsupported when using "" on service "%s".', (string) $service->getAttribute('id'))); - } - } - - $definition->setFactory(['Closure', 'fromCallable']); - - if ('Closure' !== ($definition->getClass() ?? 'Closure')) { - $definition->setLazy(true); - } else { - $definition->setClass('Closure'); - } - - $callable = $callable[0]; - if ($function = $callable->getAttribute('function')) { - $definition->setArguments([$function]); - } elseif ($expression = $callable->getAttribute('expression')) { - if (!class_exists(Expression::class)) { - throw new \LogicException('The "expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); - } - $definition->setArguments(['@='.$expression]); - } else { - if ($childService = $callable->getAttribute('service')) { - $class = new Reference($childService, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); - } else { - $class = $callable->hasAttribute('class') ? $callable->getAttribute('class') : null; - } - - $definition->setArguments([[$class, $callable->getAttribute('method') ?: '__invoke']]); - } - } - - return $definition; - } - - /** - * Parses an XML file to a \DOMDocument. - * - * @throws InvalidArgumentException When loading of XML file returns error - */ - private function parseFileToDOM(string $file): \DOMDocument - { - try { - $dom = XmlUtils::loadFile($file, $this->validateSchema(...)); - } catch (\InvalidArgumentException $e) { - throw new InvalidArgumentException(sprintf('Unable to parse file "%s": ', $file).$e->getMessage(), $e->getCode(), $e); - } - - $this->validateExtensions($dom, $file); - - return $dom; - } - - /** - * Processes anonymous services. - */ - private function processAnonymousServices(\DOMDocument $xml, string $file, \DOMNode $root = null): void - { - $definitions = []; - $count = 0; - $suffix = '~'.ContainerBuilder::hash($file); - - $xpath = new \DOMXPath($xml); - $xpath->registerNamespace('container', self::NS); - - // anonymous services as arguments/properties - if (false !== $nodes = $xpath->query('.//container:argument[@type="service"][not(@id)]|.//container:property[@type="service"][not(@id)]|.//container:bind[not(@id)]|.//container:factory[not(@service)]|.//container:configurator[not(@service)]', $root)) { - foreach ($nodes as $node) { - if ($services = $this->getChildren($node, 'service')) { - // give it a unique name - $id = sprintf('.%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')).$suffix); - $node->setAttribute('id', $id); - $node->setAttribute('service', $id); - - $definitions[$id] = [$services[0], $file]; - $services[0]->setAttribute('id', $id); - - // anonymous services are always private - // we could not use the constant false here, because of XML parsing - $services[0]->setAttribute('public', 'false'); - } - } - } - - // anonymous services "in the wild" - if (false !== $nodes = $xpath->query('.//container:services/container:service[not(@id)]', $root)) { - foreach ($nodes as $node) { - throw new InvalidArgumentException(sprintf('Top-level services must have "id" attribute, none found in "%s" at line %d.', $file, $node->getLineNo())); - } - } - - // resolve definitions - uksort($definitions, 'strnatcmp'); - foreach (array_reverse($definitions) as $id => [$domElement, $file]) { - if (null !== $definition = $this->parseDefinition($domElement, $file, new Definition())) { - $this->setDefinition($id, $definition); - } - } - } - - private function getArgumentsAsPhp(\DOMElement $node, string $name, string $file, bool $isChildDefinition = false): array - { - $arguments = []; - foreach ($this->getChildren($node, $name) as $arg) { - if ($arg->hasAttribute('name')) { - $arg->setAttribute('key', $arg->getAttribute('name')); - } - - // this is used by ChildDefinition to overwrite a specific - // argument of the parent definition - if ($arg->hasAttribute('index')) { - $key = ($isChildDefinition ? 'index_' : '').$arg->getAttribute('index'); - } elseif (!$arg->hasAttribute('key')) { - // Append an empty argument, then fetch its key to overwrite it later - $arguments[] = null; - $keys = array_keys($arguments); - $key = array_pop($keys); - } else { - $key = $arg->getAttribute('key'); - } - - $trim = $arg->hasAttribute('trim') && XmlUtils::phpize($arg->getAttribute('trim')); - $onInvalid = $arg->getAttribute('on-invalid'); - $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - if ('ignore' == $onInvalid) { - $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; - } elseif ('ignore_uninitialized' == $onInvalid) { - $invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; - } elseif ('null' == $onInvalid) { - $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; - } - - switch ($type = $arg->getAttribute('type')) { - case 'service': - if ('' === $arg->getAttribute('id')) { - throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="service" has no or empty "id" attribute in "%s".', $name, $file)); - } - - $arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior); - break; - case 'expression': - if (!class_exists(Expression::class)) { - throw new \LogicException('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); - } - - $arguments[$key] = new Expression($arg->nodeValue); - break; - case 'collection': - $arguments[$key] = $this->getArgumentsAsPhp($arg, $name, $file); - break; - case 'iterator': - $arg = $this->getArgumentsAsPhp($arg, $name, $file); - $arguments[$key] = new IteratorArgument($arg); - break; - case 'closure': - case 'service_closure': - if ('' !== $arg->getAttribute('id')) { - $arg = new Reference($arg->getAttribute('id'), $invalidBehavior); - } else { - $arg = $this->getArgumentsAsPhp($arg, $name, $file); - } - $arguments[$key] = match ($type) { - 'service_closure' => new ServiceClosureArgument($arg), - 'closure' => (new Definition('Closure')) - ->setFactory(['Closure', 'fromCallable']) - ->addArgument($arg), - }; - break; - case 'service_locator': - $arg = $this->getArgumentsAsPhp($arg, $name, $file); - - if (isset($arg[0])) { - trigger_deprecation('symfony/dependency-injection', '6.3', 'Skipping "key" argument or using integers as values in a "service_locator" tag is deprecated. The keys will default to the IDs of the original services in 7.0.'); - } - - $arguments[$key] = new ServiceLocatorArgument($arg); - break; - case 'tagged': - case 'tagged_iterator': - case 'tagged_locator': - $forLocator = 'tagged_locator' === $type; - - if (!$arg->getAttribute('tag')) { - throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="%s" has no or empty "tag" attribute in "%s".', $name, $type, $file)); - } - - $excludes = array_column($this->getChildren($arg, 'exclude'), 'nodeValue'); - if ($arg->hasAttribute('exclude')) { - if (\count($excludes) > 0) { - throw new InvalidArgumentException('You cannot use both the attribute "exclude" and tags at the same time.'); - } - $excludes = [$arg->getAttribute('exclude')]; - } - - $arguments[$key] = new TaggedIteratorArgument($arg->getAttribute('tag'), $arg->getAttribute('index-by') ?: null, $arg->getAttribute('default-index-method') ?: null, $forLocator, $arg->getAttribute('default-priority-method') ?: null, $excludes, !$arg->hasAttribute('exclude-self') || XmlUtils::phpize($arg->getAttribute('exclude-self'))); - - if ($forLocator) { - $arguments[$key] = new ServiceLocatorArgument($arguments[$key]); - } - break; - case 'binary': - if (false === $value = base64_decode($arg->nodeValue)) { - throw new InvalidArgumentException(sprintf('Tag "<%s>" with type="binary" is not a valid base64 encoded string.', $name)); - } - $arguments[$key] = $value; - break; - case 'abstract': - $arguments[$key] = new AbstractArgument($arg->nodeValue); - break; - case 'string': - $arguments[$key] = $trim ? trim($arg->nodeValue) : $arg->nodeValue; - break; - case 'constant': - $arguments[$key] = \constant(trim($arg->nodeValue)); - break; - default: - $arguments[$key] = XmlUtils::phpize($trim ? trim($arg->nodeValue) : $arg->nodeValue); - } - } - - return $arguments; - } - - /** - * Get child elements by name. - * - * @return \DOMElement[] - */ - private function getChildren(\DOMNode $node, string $name): array - { - $children = []; - foreach ($node->childNodes as $child) { - if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) { - $children[] = $child; - } - } - - return $children; - } - - private function getTagAttributes(\DOMNode $node, string $missingName): array - { - $parameters = []; - $children = $this->getChildren($node, 'attribute'); - - foreach ($children as $childNode) { - if ('' === $name = $childNode->getAttribute('name')) { - throw new InvalidArgumentException($missingName); - } - - if ($this->getChildren($childNode, 'attribute')) { - $parameters[$name] = $this->getTagAttributes($childNode, $missingName); - } else { - if (str_contains($name, '-') && !str_contains($name, '_') && !\array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) { - $parameters[$normalizedName] = XmlUtils::phpize($childNode->nodeValue); - } - // keep not normalized key - $parameters[$name] = XmlUtils::phpize($childNode->nodeValue); - } - } - - return $parameters; - } - - /** - * Validates a documents XML schema. - * - * @throws RuntimeException When extension references a non-existent XSD file - */ - public function validateSchema(\DOMDocument $dom): bool - { - $schemaLocations = ['http://symfony.com/schema/dic/services' => str_replace('\\', '/', __DIR__.'/schema/dic/services/services-1.0.xsd')]; - - if ($element = $dom->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')) { - $items = preg_split('/\s+/', $element); - for ($i = 0, $nb = \count($items); $i < $nb; $i += 2) { - if (!$this->container->hasExtension($items[$i])) { - continue; - } - - if (($extension = $this->container->getExtension($items[$i])) && false !== $extension->getXsdValidationBasePath()) { - $ns = $extension->getNamespace(); - $path = str_replace([$ns, str_replace('http://', 'https://', $ns)], str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]); - - if (!is_file($path)) { - throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s".', get_debug_type($extension), $path)); - } - - $schemaLocations[$items[$i]] = $path; - } - } - } - - $tmpfiles = []; - $imports = ''; - foreach ($schemaLocations as $namespace => $location) { - $parts = explode('/', $location); - $locationstart = 'file:///'; - if (0 === stripos($location, 'phar://')) { - $tmpfile = tempnam(sys_get_temp_dir(), 'symfony'); - if ($tmpfile) { - copy($location, $tmpfile); - $tmpfiles[] = $tmpfile; - $parts = explode('/', str_replace('\\', '/', $tmpfile)); - } else { - array_shift($parts); - $locationstart = 'phar:///'; - } - } elseif ('\\' === \DIRECTORY_SEPARATOR && str_starts_with($location, '\\\\')) { - $locationstart = ''; - } - $drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; - $location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts)); - - $imports .= sprintf(' '."\n", $namespace, $location); - } - - $source = << - - - -$imports - -EOF - ; - - if ($this->shouldEnableEntityLoader()) { - $disableEntities = libxml_disable_entity_loader(false); - $valid = @$dom->schemaValidateSource($source); - libxml_disable_entity_loader($disableEntities); - } else { - $valid = @$dom->schemaValidateSource($source); - } - foreach ($tmpfiles as $tmpfile) { - @unlink($tmpfile); - } - - return $valid; - } - - private function shouldEnableEntityLoader(): bool - { - static $dom, $schema; - if (null === $dom) { - $dom = new \DOMDocument(); - $dom->loadXML(''); - - $tmpfile = tempnam(sys_get_temp_dir(), 'symfony'); - register_shutdown_function(static function () use ($tmpfile) { - @unlink($tmpfile); - }); - $schema = ' - - -'; - file_put_contents($tmpfile, ' - - - -'); - } - - return !@$dom->schemaValidateSource($schema); - } - - private function validateAlias(\DOMElement $alias, string $file): void - { - foreach ($alias->attributes as $name => $node) { - if (!\in_array($name, ['alias', 'id', 'public'])) { - throw new InvalidArgumentException(sprintf('Invalid attribute "%s" defined for alias "%s" in "%s".', $name, $alias->getAttribute('id'), $file)); - } - } - - foreach ($alias->childNodes as $child) { - if (!$child instanceof \DOMElement || self::NS !== $child->namespaceURI) { - continue; - } - if ('deprecated' !== $child->localName) { - throw new InvalidArgumentException(sprintf('Invalid child element "%s" defined for alias "%s" in "%s".', $child->localName, $alias->getAttribute('id'), $file)); - } - } - } - - /** - * Validates an extension. - * - * @throws InvalidArgumentException When no extension is found corresponding to a tag - */ - private function validateExtensions(\DOMDocument $dom, string $file): void - { - foreach ($dom->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement || 'http://symfony.com/schema/dic/services' === $node->namespaceURI) { - continue; - } - - // can it be handled by an extension? - if (!$this->container->hasExtension($node->namespaceURI)) { - $extensionNamespaces = array_filter(array_map(fn (ExtensionInterface $ext) => $ext->getNamespace(), $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? implode('", "', $extensionNamespaces) : 'none')); - } - } - } - - /** - * Loads from an extension. - */ - private function loadFromExtensions(\DOMDocument $xml): void - { - foreach ($xml->documentElement->childNodes as $node) { - if (!$node instanceof \DOMElement || self::NS === $node->namespaceURI) { - continue; - } - - $values = static::convertDomElementToArray($node); - if (!\is_array($values)) { - $values = []; - } - - $this->container->loadFromExtension($node->namespaceURI, $values); - } - } - - /** - * Converts a \DOMElement object to a PHP array. - * - * The following rules applies during the conversion: - * - * * Each tag is converted to a key value or an array - * if there is more than one "value" - * - * * The content of a tag is set under a "value" key (bar) - * if the tag also has some nested tags - * - * * The attributes are converted to keys () - * - * * The nested-tags are converted to keys (bar) - * - * @param \DOMElement $element A \DOMElement instance - */ - public static function convertDomElementToArray(\DOMElement $element): mixed - { - return XmlUtils::convertDomElementToArray($element); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php b/tests/integration/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php deleted file mode 100644 index 822b45e..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php +++ /dev/null @@ -1,985 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Loader; - -use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Argument\AbstractArgument; -use Symfony\Component\DependencyInjection\Argument\BoundArgument; -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; -use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; -use Symfony\Component\DependencyInjection\ChildDefinition; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\ExpressionLanguage\Expression; -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Parser as YamlParser; -use Symfony\Component\Yaml\Tag\TaggedValue; -use Symfony\Component\Yaml\Yaml; - -/** - * YamlFileLoader loads YAML files service definitions. - * - * @author Fabien Potencier - */ -class YamlFileLoader extends FileLoader -{ - private const SERVICE_KEYWORDS = [ - 'alias' => 'alias', - 'parent' => 'parent', - 'class' => 'class', - 'shared' => 'shared', - 'synthetic' => 'synthetic', - 'lazy' => 'lazy', - 'public' => 'public', - 'abstract' => 'abstract', - 'deprecated' => 'deprecated', - 'factory' => 'factory', - 'file' => 'file', - 'arguments' => 'arguments', - 'properties' => 'properties', - 'configurator' => 'configurator', - 'calls' => 'calls', - 'tags' => 'tags', - 'decorates' => 'decorates', - 'decoration_inner_name' => 'decoration_inner_name', - 'decoration_priority' => 'decoration_priority', - 'decoration_on_invalid' => 'decoration_on_invalid', - 'autowire' => 'autowire', - 'autoconfigure' => 'autoconfigure', - 'bind' => 'bind', - 'constructor' => 'constructor', - ]; - - private const PROTOTYPE_KEYWORDS = [ - 'resource' => 'resource', - 'namespace' => 'namespace', - 'exclude' => 'exclude', - 'parent' => 'parent', - 'shared' => 'shared', - 'lazy' => 'lazy', - 'public' => 'public', - 'abstract' => 'abstract', - 'deprecated' => 'deprecated', - 'factory' => 'factory', - 'arguments' => 'arguments', - 'properties' => 'properties', - 'configurator' => 'configurator', - 'calls' => 'calls', - 'tags' => 'tags', - 'autowire' => 'autowire', - 'autoconfigure' => 'autoconfigure', - 'bind' => 'bind', - 'constructor' => 'constructor', - ]; - - private const INSTANCEOF_KEYWORDS = [ - 'shared' => 'shared', - 'lazy' => 'lazy', - 'public' => 'public', - 'properties' => 'properties', - 'configurator' => 'configurator', - 'calls' => 'calls', - 'tags' => 'tags', - 'autowire' => 'autowire', - 'bind' => 'bind', - 'constructor' => 'constructor', - ]; - - private const DEFAULTS_KEYWORDS = [ - 'public' => 'public', - 'tags' => 'tags', - 'autowire' => 'autowire', - 'autoconfigure' => 'autoconfigure', - 'bind' => 'bind', - ]; - - private YamlParser $yamlParser; - - private int $anonymousServicesCount; - private string $anonymousServicesSuffix; - - protected $autoRegisterAliasesForSinglyImplementedInterfaces = false; - - public function load(mixed $resource, string $type = null): mixed - { - $path = $this->locator->locate($resource); - - $content = $this->loadFile($path); - - $this->container->fileExists($path); - - // empty file - if (null === $content) { - return null; - } - - $this->loadContent($content, $path); - - // per-env configuration - if ($this->env && isset($content['when@'.$this->env])) { - if (!\is_array($content['when@'.$this->env])) { - throw new InvalidArgumentException(sprintf('The "when@%s" key should contain an array in "%s". Check your YAML syntax.', $this->env, $path)); - } - - $env = $this->env; - $this->env = null; - try { - $this->loadContent($content['when@'.$env], $path); - } finally { - $this->env = $env; - } - } - - return null; - } - - private function loadContent(array $content, string $path): void - { - // imports - $this->parseImports($content, $path); - - // parameters - if (isset($content['parameters'])) { - if (!\is_array($content['parameters'])) { - throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in "%s". Check your YAML syntax.', $path)); - } - - foreach ($content['parameters'] as $key => $value) { - $this->container->setParameter($key, $this->resolveServices($value, $path, true)); - } - } - - // extensions - $this->loadFromExtensions($content); - - // services - $this->anonymousServicesCount = 0; - $this->anonymousServicesSuffix = '~'.ContainerBuilder::hash($path); - $this->setCurrentDir(\dirname($path)); - try { - $this->parseDefinitions($content, $path); - } finally { - $this->instanceof = []; - $this->registerAliasesForSinglyImplementedInterfaces(); - } - } - - public function supports(mixed $resource, string $type = null): bool - { - if (!\is_string($resource)) { - return false; - } - - if (null === $type && \in_array(pathinfo($resource, \PATHINFO_EXTENSION), ['yaml', 'yml'], true)) { - return true; - } - - return \in_array($type, ['yaml', 'yml'], true); - } - - private function parseImports(array $content, string $file): void - { - if (!isset($content['imports'])) { - return; - } - - if (!\is_array($content['imports'])) { - throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in "%s". Check your YAML syntax.', $file)); - } - - $defaultDirectory = \dirname($file); - foreach ($content['imports'] as $import) { - if (!\is_array($import)) { - $import = ['resource' => $import]; - } - if (!isset($import['resource'])) { - throw new InvalidArgumentException(sprintf('An import should provide a resource in "%s". Check your YAML syntax.', $file)); - } - - $this->setCurrentDir($defaultDirectory); - $this->import($import['resource'], $import['type'] ?? null, $import['ignore_errors'] ?? false, $file); - } - } - - private function parseDefinitions(array $content, string $file, bool $trackBindings = true): void - { - if (!isset($content['services'])) { - return; - } - - if (!\is_array($content['services'])) { - throw new InvalidArgumentException(sprintf('The "services" key should contain an array in "%s". Check your YAML syntax.', $file)); - } - - if (\array_key_exists('_instanceof', $content['services'])) { - $instanceof = $content['services']['_instanceof']; - unset($content['services']['_instanceof']); - - if (!\is_array($instanceof)) { - throw new InvalidArgumentException(sprintf('Service "_instanceof" key must be an array, "%s" given in "%s".', get_debug_type($instanceof), $file)); - } - $this->instanceof = []; - $this->isLoadingInstanceof = true; - foreach ($instanceof as $id => $service) { - if (!$service || !\is_array($service)) { - throw new InvalidArgumentException(sprintf('Type definition "%s" must be a non-empty array within "_instanceof" in "%s". Check your YAML syntax.', $id, $file)); - } - if (\is_string($service) && str_starts_with($service, '@')) { - throw new InvalidArgumentException(sprintf('Type definition "%s" cannot be an alias within "_instanceof" in "%s". Check your YAML syntax.', $id, $file)); - } - $this->parseDefinition($id, $service, $file, [], false, $trackBindings); - } - } - - $this->isLoadingInstanceof = false; - $defaults = $this->parseDefaults($content, $file); - foreach ($content['services'] as $id => $service) { - $this->parseDefinition($id, $service, $file, $defaults, false, $trackBindings); - } - } - - /** - * @throws InvalidArgumentException - */ - private function parseDefaults(array &$content, string $file): array - { - if (!\array_key_exists('_defaults', $content['services'])) { - return []; - } - $defaults = $content['services']['_defaults']; - unset($content['services']['_defaults']); - - if (!\is_array($defaults)) { - throw new InvalidArgumentException(sprintf('Service "_defaults" key must be an array, "%s" given in "%s".', get_debug_type($defaults), $file)); - } - - foreach ($defaults as $key => $default) { - if (!isset(self::DEFAULTS_KEYWORDS[$key])) { - throw new InvalidArgumentException(sprintf('The configuration key "%s" cannot be used to define a default value in "%s". Allowed keys are "%s".', $key, $file, implode('", "', self::DEFAULTS_KEYWORDS))); - } - } - - if (isset($defaults['tags'])) { - if (!\is_array($tags = $defaults['tags'])) { - throw new InvalidArgumentException(sprintf('Parameter "tags" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file)); - } - - foreach ($tags as $tag) { - if (!\is_array($tag)) { - $tag = ['name' => $tag]; - } - - if (1 === \count($tag) && \is_array(current($tag))) { - $name = key($tag); - $tag = current($tag); - } else { - if (!isset($tag['name'])) { - throw new InvalidArgumentException(sprintf('A "tags" entry in "_defaults" is missing a "name" key in "%s".', $file)); - } - $name = $tag['name']; - unset($tag['name']); - } - - if (!\is_string($name) || '' === $name) { - throw new InvalidArgumentException(sprintf('The tag name in "_defaults" must be a non-empty string in "%s".', $file)); - } - - $this->validateAttributes(sprintf('Tag "%s", attribute "%s" in "_defaults" must be of a scalar-type in "%s". Check your YAML syntax.', $name, '%s', $file), $tag); - } - } - - if (isset($defaults['bind'])) { - if (!\is_array($defaults['bind'])) { - throw new InvalidArgumentException(sprintf('Parameter "bind" in "_defaults" must be an array in "%s". Check your YAML syntax.', $file)); - } - - foreach ($this->resolveServices($defaults['bind'], $file) as $argument => $value) { - $defaults['bind'][$argument] = new BoundArgument($value, true, BoundArgument::DEFAULTS_BINDING, $file); - } - } - - return $defaults; - } - - private function isUsingShortSyntax(array $service): bool - { - foreach ($service as $key => $value) { - if (\is_string($key) && ('' === $key || ('$' !== $key[0] && !str_contains($key, '\\')))) { - return false; - } - } - - return true; - } - - /** - * @throws InvalidArgumentException When tags are invalid - */ - private function parseDefinition(string $id, array|string|null $service, string $file, array $defaults, bool $return = false, bool $trackBindings = true): Definition|Alias|null - { - if (preg_match('/^_[a-zA-Z0-9_]*$/', $id)) { - throw new InvalidArgumentException(sprintf('Service names that start with an underscore are reserved. Rename the "%s" service or define it in XML instead.', $id)); - } - - if (\is_string($service) && str_starts_with($service, '@')) { - $alias = new Alias(substr($service, 1)); - - if (isset($defaults['public'])) { - $alias->setPublic($defaults['public']); - } - - return $return ? $alias : $this->container->setAlias($id, $alias); - } - - if (\is_array($service) && $this->isUsingShortSyntax($service)) { - $service = ['arguments' => $service]; - } - - if (!\is_array($service ??= [])) { - throw new InvalidArgumentException(sprintf('A service definition must be an array or a string starting with "@" but "%s" found for service "%s" in "%s". Check your YAML syntax.', get_debug_type($service), $id, $file)); - } - - if (isset($service['stack'])) { - if (!\is_array($service['stack'])) { - throw new InvalidArgumentException(sprintf('A stack must be an array of definitions, "%s" given for service "%s" in "%s". Check your YAML syntax.', get_debug_type($service), $id, $file)); - } - - $stack = []; - - foreach ($service['stack'] as $k => $frame) { - if (\is_array($frame) && 1 === \count($frame) && !isset(self::SERVICE_KEYWORDS[key($frame)])) { - $frame = [ - 'class' => key($frame), - 'arguments' => current($frame), - ]; - } - - if (\is_array($frame) && isset($frame['stack'])) { - throw new InvalidArgumentException(sprintf('Service stack "%s" cannot contain another stack in "%s".', $id, $file)); - } - - $definition = $this->parseDefinition($id.'" at index "'.$k, $frame, $file, $defaults, true); - - if ($definition instanceof Definition) { - $definition->setInstanceofConditionals($this->instanceof); - } - - $stack[$k] = $definition; - } - - if ($diff = array_diff(array_keys($service), ['stack', 'public', 'deprecated'])) { - throw new InvalidArgumentException(sprintf('Invalid attribute "%s"; supported ones are "public" and "deprecated" for service "%s" in "%s". Check your YAML syntax.', implode('", "', $diff), $id, $file)); - } - - $service = [ - 'parent' => '', - 'arguments' => $stack, - 'tags' => ['container.stack'], - 'public' => $service['public'] ?? null, - 'deprecated' => $service['deprecated'] ?? null, - ]; - } - - $definition = isset($service[0]) && $service[0] instanceof Definition ? array_shift($service) : null; - $return = null === $definition ? $return : true; - - if (isset($service['from_callable'])) { - foreach (['alias', 'parent', 'synthetic', 'factory', 'file', 'arguments', 'properties', 'configurator', 'calls'] as $key) { - if (isset($service['factory'])) { - throw new InvalidArgumentException(sprintf('The configuration key "%s" is unsupported for the service "%s" when using "from_callable" in "%s".', $key, $id, $file)); - } - } - - if ('Closure' !== $service['class'] ??= 'Closure') { - $service['lazy'] = true; - } - - $service['factory'] = ['Closure', 'fromCallable']; - $service['arguments'] = [$service['from_callable']]; - unset($service['from_callable']); - } - - $this->checkDefinition($id, $service, $file); - - if (isset($service['alias'])) { - $alias = new Alias($service['alias']); - - if (isset($service['public'])) { - $alias->setPublic($service['public']); - } elseif (isset($defaults['public'])) { - $alias->setPublic($defaults['public']); - } - - foreach ($service as $key => $value) { - if (!\in_array($key, ['alias', 'public', 'deprecated'])) { - throw new InvalidArgumentException(sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias", "public" and "deprecated".', $key, $id, $file)); - } - - if ('deprecated' === $key) { - $deprecation = \is_array($value) ? $value : ['message' => $value]; - - if (!isset($deprecation['package'])) { - throw new InvalidArgumentException(sprintf('Missing attribute "package" of the "deprecated" option in "%s".', $file)); - } - - if (!isset($deprecation['version'])) { - throw new InvalidArgumentException(sprintf('Missing attribute "version" of the "deprecated" option in "%s".', $file)); - } - - $alias->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message'] ?? ''); - } - } - - return $return ? $alias : $this->container->setAlias($id, $alias); - } - - if (null !== $definition) { - // no-op - } elseif ($this->isLoadingInstanceof) { - $definition = new ChildDefinition(''); - } elseif (isset($service['parent'])) { - if ('' !== $service['parent'] && '@' === $service['parent'][0]) { - throw new InvalidArgumentException(sprintf('The value of the "parent" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $id, $service['parent'], substr($service['parent'], 1))); - } - - $definition = new ChildDefinition($service['parent']); - } else { - $definition = new Definition(); - } - - if (isset($defaults['public'])) { - $definition->setPublic($defaults['public']); - } - if (isset($defaults['autowire'])) { - $definition->setAutowired($defaults['autowire']); - } - if (isset($defaults['autoconfigure'])) { - $definition->setAutoconfigured($defaults['autoconfigure']); - } - - $definition->setChanges([]); - - if (isset($service['class'])) { - $definition->setClass($service['class']); - } - - if (isset($service['shared'])) { - $definition->setShared($service['shared']); - } - - if (isset($service['synthetic'])) { - $definition->setSynthetic($service['synthetic']); - } - - if (isset($service['lazy'])) { - $definition->setLazy((bool) $service['lazy']); - if (\is_string($service['lazy'])) { - $definition->addTag('proxy', ['interface' => $service['lazy']]); - } - } - - if (isset($service['public'])) { - $definition->setPublic($service['public']); - } - - if (isset($service['abstract'])) { - $definition->setAbstract($service['abstract']); - } - - if (isset($service['deprecated'])) { - $deprecation = \is_array($service['deprecated']) ? $service['deprecated'] : ['message' => $service['deprecated']]; - - if (!isset($deprecation['package'])) { - throw new InvalidArgumentException(sprintf('Missing attribute "package" of the "deprecated" option in "%s".', $file)); - } - - if (!isset($deprecation['version'])) { - throw new InvalidArgumentException(sprintf('Missing attribute "version" of the "deprecated" option in "%s".', $file)); - } - - $definition->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message'] ?? ''); - } - - if (isset($service['factory'])) { - $definition->setFactory($this->parseCallable($service['factory'], 'factory', $id, $file)); - } - - if (isset($service['constructor'])) { - if (null !== $definition->getFactory()) { - throw new LogicException(sprintf('The "%s" service cannot declare a factory as well as a constructor.', $id)); - } - - $definition->setFactory([null, $service['constructor']]); - } - - if (isset($service['file'])) { - $definition->setFile($service['file']); - } - - if (isset($service['arguments'])) { - $definition->setArguments($this->resolveServices($service['arguments'], $file)); - } - - if (isset($service['properties'])) { - $definition->setProperties($this->resolveServices($service['properties'], $file)); - } - - if (isset($service['configurator'])) { - $definition->setConfigurator($this->parseCallable($service['configurator'], 'configurator', $id, $file)); - } - - if (isset($service['calls'])) { - if (!\is_array($service['calls'])) { - throw new InvalidArgumentException(sprintf('Parameter "calls" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); - } - - foreach ($service['calls'] as $k => $call) { - if (!\is_array($call) && (!\is_string($k) || !$call instanceof TaggedValue)) { - throw new InvalidArgumentException(sprintf('Invalid method call for service "%s": expected map or array, "%s" given in "%s".', $id, $call instanceof TaggedValue ? '!'.$call->getTag() : get_debug_type($call), $file)); - } - - if (\is_string($k)) { - throw new InvalidArgumentException(sprintf('Invalid method call for service "%s", did you forgot a leading dash before "%s: ..." in "%s"?', $id, $k, $file)); - } - - if (isset($call['method']) && \is_string($call['method'])) { - $method = $call['method']; - $args = $call['arguments'] ?? []; - $returnsClone = $call['returns_clone'] ?? false; - } else { - if (1 === \count($call) && \is_string(key($call))) { - $method = key($call); - $args = $call[$method]; - - if ($args instanceof TaggedValue) { - if ('returns_clone' !== $args->getTag()) { - throw new InvalidArgumentException(sprintf('Unsupported tag "!%s", did you mean "!returns_clone" for service "%s" in "%s"?', $args->getTag(), $id, $file)); - } - - $returnsClone = true; - $args = $args->getValue(); - } else { - $returnsClone = false; - } - } elseif (empty($call[0])) { - throw new InvalidArgumentException(sprintf('Invalid call for service "%s": the method must be defined as the first index of an array or as the only key of a map in "%s".', $id, $file)); - } else { - $method = $call[0]; - $args = $call[1] ?? []; - $returnsClone = $call[2] ?? false; - } - } - - if (!\is_array($args)) { - throw new InvalidArgumentException(sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in "%s". Check your YAML syntax.', $method, $id, $file)); - } - - $args = $this->resolveServices($args, $file); - $definition->addMethodCall($method, $args, $returnsClone); - } - } - - $tags = $service['tags'] ?? []; - if (!\is_array($tags)) { - throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); - } - - if (isset($defaults['tags'])) { - $tags = array_merge($tags, $defaults['tags']); - } - - foreach ($tags as $tag) { - if (!\is_array($tag)) { - $tag = ['name' => $tag]; - } - - if (1 === \count($tag) && \is_array(current($tag))) { - $name = key($tag); - $tag = current($tag); - } else { - if (!isset($tag['name'])) { - throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in "%s".', $id, $file)); - } - $name = $tag['name']; - unset($tag['name']); - } - - if (!\is_string($name) || '' === $name) { - throw new InvalidArgumentException(sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', $id, $file)); - } - - $this->validateAttributes(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in "%s". Check your YAML syntax.', $id, $name, '%s', $file), $tag); - - $definition->addTag($name, $tag); - } - - if (null !== $decorates = $service['decorates'] ?? null) { - if ('' !== $decorates && '@' === $decorates[0]) { - throw new InvalidArgumentException(sprintf('The value of the "decorates" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $id, $service['decorates'], substr($decorates, 1))); - } - - $decorationOnInvalid = \array_key_exists('decoration_on_invalid', $service) ? $service['decoration_on_invalid'] : 'exception'; - if ('exception' === $decorationOnInvalid) { - $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - } elseif ('ignore' === $decorationOnInvalid) { - $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; - } elseif (null === $decorationOnInvalid) { - $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; - } elseif ('null' === $decorationOnInvalid) { - throw new InvalidArgumentException(sprintf('Invalid value "%s" for attribute "decoration_on_invalid" on service "%s". Did you mean null (without quotes) in "%s"?', $decorationOnInvalid, $id, $file)); - } else { - throw new InvalidArgumentException(sprintf('Invalid value "%s" for attribute "decoration_on_invalid" on service "%s". Did you mean "exception", "ignore" or null in "%s"?', $decorationOnInvalid, $id, $file)); - } - - $renameId = $service['decoration_inner_name'] ?? null; - $priority = $service['decoration_priority'] ?? 0; - - $definition->setDecoratedService($decorates, $renameId, $priority, $invalidBehavior); - } - - if (isset($service['autowire'])) { - $definition->setAutowired($service['autowire']); - } - - if (isset($defaults['bind']) || isset($service['bind'])) { - // deep clone, to avoid multiple process of the same instance in the passes - $bindings = $definition->getBindings(); - $bindings += isset($defaults['bind']) ? unserialize(serialize($defaults['bind'])) : []; - - if (isset($service['bind'])) { - if (!\is_array($service['bind'])) { - throw new InvalidArgumentException(sprintf('Parameter "bind" must be an array for service "%s" in "%s". Check your YAML syntax.', $id, $file)); - } - - $bindings = array_merge($bindings, $this->resolveServices($service['bind'], $file)); - $bindingType = $this->isLoadingInstanceof ? BoundArgument::INSTANCEOF_BINDING : BoundArgument::SERVICE_BINDING; - foreach ($bindings as $argument => $value) { - if (!$value instanceof BoundArgument) { - $bindings[$argument] = new BoundArgument($value, $trackBindings, $bindingType, $file); - } - } - } - - $definition->setBindings($bindings); - } - - if (isset($service['autoconfigure'])) { - $definition->setAutoconfigured($service['autoconfigure']); - } - - if (\array_key_exists('namespace', $service) && !\array_key_exists('resource', $service)) { - throw new InvalidArgumentException(sprintf('A "resource" attribute must be set when the "namespace" attribute is set for service "%s" in "%s". Check your YAML syntax.', $id, $file)); - } - - if ($return) { - if (\array_key_exists('resource', $service)) { - throw new InvalidArgumentException(sprintf('Invalid "resource" attribute found for service "%s" in "%s". Check your YAML syntax.', $id, $file)); - } - - return $definition; - } - - if (\array_key_exists('resource', $service)) { - if (!\is_string($service['resource'])) { - throw new InvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in "%s". Check your YAML syntax.', $id, $file)); - } - $exclude = $service['exclude'] ?? null; - $namespace = $service['namespace'] ?? $id; - $this->registerClasses($definition, $namespace, $service['resource'], $exclude, $file); - } else { - $this->setDefinition($id, $definition); - } - - return null; - } - - /** - * @throws InvalidArgumentException When errors occur - */ - private function parseCallable(mixed $callable, string $parameter, string $id, string $file): string|array|Reference - { - if (\is_string($callable)) { - if (str_starts_with($callable, '@=')) { - if ('factory' !== $parameter) { - throw new InvalidArgumentException(sprintf('Using expressions in "%s" for the "%s" service is not supported in "%s".', $parameter, $id, $file)); - } - if (!class_exists(Expression::class)) { - throw new \LogicException('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); - } - - return $callable; - } - - if ('' !== $callable && '@' === $callable[0]) { - if (!str_contains($callable, ':')) { - return [$this->resolveServices($callable, $file), '__invoke']; - } - - throw new InvalidArgumentException(sprintf('The value of the "%s" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s" in "%s").', $parameter, $id, $callable, substr($callable, 1), $file)); - } - - return $callable; - } - - if (\is_array($callable)) { - if (isset($callable[0]) && isset($callable[1])) { - return [$this->resolveServices($callable[0], $file), $callable[1]]; - } - - if ('factory' === $parameter && isset($callable[1]) && null === $callable[0]) { - return $callable; - } - - throw new InvalidArgumentException(sprintf('Parameter "%s" must contain an array with two elements for service "%s" in "%s". Check your YAML syntax.', $parameter, $id, $file)); - } - - throw new InvalidArgumentException(sprintf('Parameter "%s" must be a string or an array for service "%s" in "%s". Check your YAML syntax.', $parameter, $id, $file)); - } - - /** - * Loads a YAML file. - * - * @throws InvalidArgumentException when the given file is not a local file or when it does not exist - */ - protected function loadFile(string $file): ?array - { - if (!class_exists(\Symfony\Component\Yaml\Parser::class)) { - throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed. Try running "composer require symfony/yaml".'); - } - - if (!stream_is_local($file)) { - throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file)); - } - - if (!is_file($file)) { - throw new InvalidArgumentException(sprintf('The file "%s" does not exist.', $file)); - } - - $this->yamlParser ??= new YamlParser(); - - try { - $configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS); - } catch (ParseException $e) { - throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: ', $file).$e->getMessage(), 0, $e); - } - - return $this->validate($configuration, $file); - } - - /** - * Validates a YAML file. - * - * @throws InvalidArgumentException When service file is not valid - */ - private function validate(mixed $content, string $file): ?array - { - if (null === $content) { - return $content; - } - - if (!\is_array($content)) { - throw new InvalidArgumentException(sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file)); - } - - foreach ($content as $namespace => $data) { - if (\in_array($namespace, ['imports', 'parameters', 'services']) || str_starts_with($namespace, 'when@')) { - continue; - } - - if (!$this->container->hasExtension($namespace)) { - $extensionNamespaces = array_filter(array_map(fn (ExtensionInterface $ext) => $ext->getAlias(), $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); - } - } - - return $content; - } - - private function resolveServices(mixed $value, string $file, bool $isParameter = false): mixed - { - if ($value instanceof TaggedValue) { - $argument = $value->getValue(); - - if ('closure' === $value->getTag()) { - $argument = $this->resolveServices($argument, $file, $isParameter); - - return (new Definition('Closure')) - ->setFactory(['Closure', 'fromCallable']) - ->addArgument($argument); - } - if ('iterator' === $value->getTag()) { - if (!\is_array($argument)) { - throw new InvalidArgumentException(sprintf('"!iterator" tag only accepts sequences in "%s".', $file)); - } - $argument = $this->resolveServices($argument, $file, $isParameter); - - return new IteratorArgument($argument); - } - if ('service_closure' === $value->getTag()) { - $argument = $this->resolveServices($argument, $file, $isParameter); - - return new ServiceClosureArgument($argument); - } - if ('service_locator' === $value->getTag()) { - if (!\is_array($argument)) { - throw new InvalidArgumentException(sprintf('"!service_locator" tag only accepts maps in "%s".', $file)); - } - - $argument = $this->resolveServices($argument, $file, $isParameter); - - if (isset($argument[0])) { - trigger_deprecation('symfony/dependency-injection', '6.3', 'Using integers as keys in a "!service_locator" tag is deprecated. The keys will default to the IDs of the original services in 7.0.'); - } - - return new ServiceLocatorArgument($argument); - } - if (\in_array($value->getTag(), ['tagged', 'tagged_iterator', 'tagged_locator'], true)) { - $forLocator = 'tagged_locator' === $value->getTag(); - - if (\is_array($argument) && isset($argument['tag']) && $argument['tag']) { - if ($diff = array_diff(array_keys($argument), $supportedKeys = ['tag', 'index_by', 'default_index_method', 'default_priority_method', 'exclude', 'exclude_self'])) { - throw new InvalidArgumentException(sprintf('"!%s" tag contains unsupported key "%s"; supported ones are "%s".', $value->getTag(), implode('", "', $diff), implode('", "', $supportedKeys))); - } - - $argument = new TaggedIteratorArgument($argument['tag'], $argument['index_by'] ?? null, $argument['default_index_method'] ?? null, $forLocator, $argument['default_priority_method'] ?? null, (array) ($argument['exclude'] ?? null), $argument['exclude_self'] ?? true); - } elseif (\is_string($argument) && $argument) { - $argument = new TaggedIteratorArgument($argument, null, null, $forLocator); - } else { - throw new InvalidArgumentException(sprintf('"!%s" tags only accept a non empty string or an array with a key "tag" in "%s".', $value->getTag(), $file)); - } - - if ($forLocator) { - $argument = new ServiceLocatorArgument($argument); - } - - return $argument; - } - if ('service' === $value->getTag()) { - if ($isParameter) { - throw new InvalidArgumentException(sprintf('Using an anonymous service in a parameter is not allowed in "%s".', $file)); - } - - $isLoadingInstanceof = $this->isLoadingInstanceof; - $this->isLoadingInstanceof = false; - $instanceof = $this->instanceof; - $this->instanceof = []; - - $id = sprintf('.%d_%s', ++$this->anonymousServicesCount, preg_replace('/^.*\\\\/', '', $argument['class'] ?? '').$this->anonymousServicesSuffix); - $this->parseDefinition($id, $argument, $file, []); - - if (!$this->container->hasDefinition($id)) { - throw new InvalidArgumentException(sprintf('Creating an alias using the tag "!service" is not allowed in "%s".', $file)); - } - - $this->container->getDefinition($id); - - $this->isLoadingInstanceof = $isLoadingInstanceof; - $this->instanceof = $instanceof; - - return new Reference($id); - } - if ('abstract' === $value->getTag()) { - return new AbstractArgument($value->getValue()); - } - - throw new InvalidArgumentException(sprintf('Unsupported tag "!%s".', $value->getTag())); - } - - if (\is_array($value)) { - foreach ($value as $k => $v) { - $value[$k] = $this->resolveServices($v, $file, $isParameter); - } - } elseif (\is_string($value) && str_starts_with($value, '@=')) { - if ($isParameter) { - throw new InvalidArgumentException(sprintf('Using expressions in parameters is not allowed in "%s".', $file)); - } - - if (!class_exists(Expression::class)) { - throw new \LogicException('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'); - } - - return new Expression(substr($value, 2)); - } elseif (\is_string($value) && str_starts_with($value, '@')) { - if (str_starts_with($value, '@@')) { - $value = substr($value, 1); - $invalidBehavior = null; - } elseif (str_starts_with($value, '@!')) { - $value = substr($value, 2); - $invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE; - } elseif (str_starts_with($value, '@?')) { - $value = substr($value, 2); - $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; - } else { - $value = substr($value, 1); - $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; - } - - if (null !== $invalidBehavior) { - $value = new Reference($value, $invalidBehavior); - } - } - - return $value; - } - - private function loadFromExtensions(array $content): void - { - foreach ($content as $namespace => $values) { - if (\in_array($namespace, ['imports', 'parameters', 'services']) || str_starts_with($namespace, 'when@')) { - continue; - } - - if (!\is_array($values) && null !== $values) { - $values = []; - } - - $this->container->loadFromExtension($namespace, $values); - } - } - - private function checkDefinition(string $id, array $definition, string $file): void - { - if ($this->isLoadingInstanceof) { - $keywords = self::INSTANCEOF_KEYWORDS; - } elseif (isset($definition['resource']) || isset($definition['namespace'])) { - $keywords = self::PROTOTYPE_KEYWORDS; - } else { - $keywords = self::SERVICE_KEYWORDS; - } - - foreach ($definition as $key => $value) { - if (!isset($keywords[$key])) { - throw new InvalidArgumentException(sprintf('The configuration key "%s" is unsupported for definition "%s" in "%s". Allowed configuration keys are "%s".', $key, $id, $file, implode('", "', $keywords))); - } - } - } - - private function validateAttributes(string $message, array $attributes, array $path = []): void - { - foreach ($attributes as $name => $value) { - if (\is_array($value)) { - $this->validateAttributes($message, $value, [...$path, $name]); - } elseif (!\is_scalar($value ?? '')) { - $name = implode('.', [...$path, $name]); - throw new InvalidArgumentException(sprintf($message, $name)); - } - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Loader/schema/dic/services/services-1.0.xsd b/tests/integration/vendor/symfony/dependency-injection/Loader/schema/dic/services/services-1.0.xsd deleted file mode 100644 index c071e34..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Loader/schema/dic/services/services-1.0.xsd +++ /dev/null @@ -1,396 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/integration/vendor/symfony/dependency-injection/Parameter.php b/tests/integration/vendor/symfony/dependency-injection/Parameter.php deleted file mode 100644 index 90dcc92..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Parameter.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -/** - * Parameter represents a parameter reference. - * - * @author Fabien Potencier - */ -class Parameter -{ - private string $id; - - public function __construct(string $id) - { - $this->id = $id; - } - - public function __toString(): string - { - return $this->id; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php b/tests/integration/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php deleted file mode 100644 index 9c66e1f..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\ParameterBag; - -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; - -/** - * @author Nicolas Grekas - */ -class EnvPlaceholderParameterBag extends ParameterBag -{ - private string $envPlaceholderUniquePrefix; - private array $envPlaceholders = []; - private array $unusedEnvPlaceholders = []; - private array $providedTypes = []; - - private static int $counter = 0; - - public function get(string $name): array|bool|string|int|float|\UnitEnum|null - { - if (str_starts_with($name, 'env(') && str_ends_with($name, ')') && 'env()' !== $name) { - $env = substr($name, 4, -1); - - if (isset($this->envPlaceholders[$env])) { - foreach ($this->envPlaceholders[$env] as $placeholder) { - return $placeholder; // return first result - } - } - if (isset($this->unusedEnvPlaceholders[$env])) { - foreach ($this->unusedEnvPlaceholders[$env] as $placeholder) { - return $placeholder; // return first result - } - } - if (!preg_match('/^(?:[-.\w\\\\]*+:)*+\w++$/', $env)) { - throw new InvalidArgumentException(sprintf('Invalid %s name: only "word" characters are allowed.', $name)); - } - if ($this->has($name) && null !== ($defaultValue = parent::get($name)) && !\is_string($defaultValue)) { - throw new RuntimeException(sprintf('The default value of an env() parameter must be a string or null, but "%s" given to "%s".', get_debug_type($defaultValue), $name)); - } - - $uniqueName = hash('xxh128', $name.'_'.self::$counter++); - $placeholder = sprintf('%s_%s_%s', $this->getEnvPlaceholderUniquePrefix(), strtr($env, ':-.\\', '____'), $uniqueName); - $this->envPlaceholders[$env][$placeholder] = $placeholder; - - return $placeholder; - } - - return parent::get($name); - } - - /** - * Gets the common env placeholder prefix for env vars created by this bag. - */ - public function getEnvPlaceholderUniquePrefix(): string - { - if (!isset($this->envPlaceholderUniquePrefix)) { - $reproducibleEntropy = unserialize(serialize($this->parameters)); - array_walk_recursive($reproducibleEntropy, function (&$v) { $v = null; }); - $this->envPlaceholderUniquePrefix = 'env_'.substr(hash('xxh128', serialize($reproducibleEntropy)), -16); - } - - return $this->envPlaceholderUniquePrefix; - } - - /** - * Returns the map of env vars used in the resolved parameter values to their placeholders. - * - * @return string[][] A map of env var names to their placeholders - */ - public function getEnvPlaceholders(): array - { - return $this->envPlaceholders; - } - - public function getUnusedEnvPlaceholders(): array - { - return $this->unusedEnvPlaceholders; - } - - /** - * @return void - */ - public function clearUnusedEnvPlaceholders() - { - $this->unusedEnvPlaceholders = []; - } - - /** - * Merges the env placeholders of another EnvPlaceholderParameterBag. - * - * @return void - */ - public function mergeEnvPlaceholders(self $bag) - { - if ($newPlaceholders = $bag->getEnvPlaceholders()) { - $this->envPlaceholders += $newPlaceholders; - - foreach ($newPlaceholders as $env => $placeholders) { - $this->envPlaceholders[$env] += $placeholders; - } - } - - if ($newUnusedPlaceholders = $bag->getUnusedEnvPlaceholders()) { - $this->unusedEnvPlaceholders += $newUnusedPlaceholders; - - foreach ($newUnusedPlaceholders as $env => $placeholders) { - $this->unusedEnvPlaceholders[$env] += $placeholders; - } - } - } - - /** - * Maps env prefixes to their corresponding PHP types. - * - * @return void - */ - public function setProvidedTypes(array $providedTypes) - { - $this->providedTypes = $providedTypes; - } - - /** - * Gets the PHP types corresponding to env() parameter prefixes. - * - * @return string[][] - */ - public function getProvidedTypes(): array - { - return $this->providedTypes; - } - - /** - * @return void - */ - public function resolve() - { - if ($this->resolved) { - return; - } - parent::resolve(); - - foreach ($this->envPlaceholders as $env => $placeholders) { - if ($this->has($name = "env($env)") && null !== ($default = $this->parameters[$name]) && !\is_string($default)) { - throw new RuntimeException(sprintf('The default value of env parameter "%s" must be a string or null, "%s" given.', $env, get_debug_type($default))); - } - } - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php b/tests/integration/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php deleted file mode 100644 index 1ede090..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\ParameterBag; - -use Symfony\Component\DependencyInjection\Exception\LogicException; - -/** - * Holds read-only parameters. - * - * @author Fabien Potencier - */ -class FrozenParameterBag extends ParameterBag -{ - /** - * For performance reasons, the constructor assumes that - * all keys are already lowercased. - * - * This is always the case when used internally. - */ - public function __construct( - array $parameters = [], - protected array $deprecatedParameters = [], - ) { - $this->parameters = $parameters; - $this->resolved = true; - } - - /** - * @return never - */ - public function clear() - { - throw new LogicException('Impossible to call clear() on a frozen ParameterBag.'); - } - - /** - * @return never - */ - public function add(array $parameters) - { - throw new LogicException('Impossible to call add() on a frozen ParameterBag.'); - } - - /** - * @return never - */ - public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value) - { - throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); - } - - /** - * @return never - */ - public function deprecate(string $name, string $package, string $version, string $message = 'The parameter "%s" is deprecated.') - { - throw new LogicException('Impossible to call deprecate() on a frozen ParameterBag.'); - } - - /** - * @return never - */ - public function remove(string $name) - { - throw new LogicException('Impossible to call remove() on a frozen ParameterBag.'); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php b/tests/integration/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php deleted file mode 100644 index 6ba8a4c..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php +++ /dev/null @@ -1,301 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\ParameterBag; - -use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; - -/** - * Holds parameters. - * - * @author Fabien Potencier - */ -class ParameterBag implements ParameterBagInterface -{ - protected $parameters = []; - protected $resolved = false; - protected array $deprecatedParameters = []; - - public function __construct(array $parameters = []) - { - $this->add($parameters); - } - - /** - * @return void - */ - public function clear() - { - $this->parameters = []; - } - - /** - * @return void - */ - public function add(array $parameters) - { - foreach ($parameters as $key => $value) { - $this->set($key, $value); - } - } - - public function all(): array - { - return $this->parameters; - } - - public function allDeprecated(): array - { - return $this->deprecatedParameters; - } - - public function get(string $name): array|bool|string|int|float|\UnitEnum|null - { - if (!\array_key_exists($name, $this->parameters)) { - if (!$name) { - throw new ParameterNotFoundException($name); - } - - $alternatives = []; - foreach ($this->parameters as $key => $parameterValue) { - $lev = levenshtein($name, $key); - if ($lev <= \strlen($name) / 3 || str_contains($key, $name)) { - $alternatives[] = $key; - } - } - - $nonNestedAlternative = null; - if (!\count($alternatives) && str_contains($name, '.')) { - $namePartsLength = array_map('strlen', explode('.', $name)); - $key = substr($name, 0, -1 * (1 + array_pop($namePartsLength))); - while (\count($namePartsLength)) { - if ($this->has($key)) { - if (\is_array($this->get($key))) { - $nonNestedAlternative = $key; - } - break; - } - - $key = substr($key, 0, -1 * (1 + array_pop($namePartsLength))); - } - } - - throw new ParameterNotFoundException($name, null, null, null, $alternatives, $nonNestedAlternative); - } - - if (isset($this->deprecatedParameters[$name])) { - trigger_deprecation(...$this->deprecatedParameters[$name]); - } - - return $this->parameters[$name]; - } - - /** - * @return void - */ - public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value) - { - if (is_numeric($name)) { - trigger_deprecation('symfony/dependency-injection', '6.2', sprintf('Using numeric parameter name "%s" is deprecated and will throw as of 7.0.', $name)); - // uncomment the following line in 7.0 - // throw new InvalidArgumentException(sprintf('The parameter name "%s" cannot be numeric.', $name)); - } - - $this->parameters[$name] = $value; - } - - /** - * Deprecates a service container parameter. - * - * @return void - * - * @throws ParameterNotFoundException if the parameter is not defined - */ - public function deprecate(string $name, string $package, string $version, string $message = 'The parameter "%s" is deprecated.') - { - if (!\array_key_exists($name, $this->parameters)) { - throw new ParameterNotFoundException($name); - } - - $this->deprecatedParameters[$name] = [$package, $version, $message, $name]; - } - - public function has(string $name): bool - { - return \array_key_exists($name, $this->parameters); - } - - /** - * @return void - */ - public function remove(string $name) - { - unset($this->parameters[$name], $this->deprecatedParameters[$name]); - } - - /** - * @return void - */ - public function resolve() - { - if ($this->resolved) { - return; - } - - $parameters = []; - foreach ($this->parameters as $key => $value) { - try { - $value = $this->resolveValue($value); - $parameters[$key] = $this->unescapeValue($value); - } catch (ParameterNotFoundException $e) { - $e->setSourceKey($key); - - throw $e; - } - } - - $this->parameters = $parameters; - $this->resolved = true; - } - - /** - * Replaces parameter placeholders (%name%) by their values. - * - * @template TValue of array|scalar - * - * @param TValue $value - * @param array $resolving An array of keys that are being resolved (used internally to detect circular references) - * - * @return (TValue is scalar ? array|scalar : array) - * - * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist - * @throws ParameterCircularReferenceException if a circular reference if detected - * @throws RuntimeException when a given parameter has a type problem - */ - public function resolveValue(mixed $value, array $resolving = []): mixed - { - if (\is_array($value)) { - $args = []; - foreach ($value as $key => $v) { - $resolvedKey = \is_string($key) ? $this->resolveValue($key, $resolving) : $key; - if (!\is_scalar($resolvedKey) && !$resolvedKey instanceof \Stringable) { - throw new RuntimeException(sprintf('Array keys must be a scalar-value, but found key "%s" to resolve to type "%s".', $key, get_debug_type($resolvedKey))); - } - - $args[$resolvedKey] = $this->resolveValue($v, $resolving); - } - - return $args; - } - - if (!\is_string($value) || 2 > \strlen($value)) { - return $value; - } - - return $this->resolveString($value, $resolving); - } - - /** - * Resolves parameters inside a string. - * - * @param array $resolving An array of keys that are being resolved (used internally to detect circular references) - * - * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist - * @throws ParameterCircularReferenceException if a circular reference if detected - * @throws RuntimeException when a given parameter has a type problem - */ - public function resolveString(string $value, array $resolving = []): mixed - { - // we do this to deal with non string values (Boolean, integer, ...) - // as the preg_replace_callback throw an exception when trying - // a non-string in a parameter value - if (preg_match('/^%([^%\s]+)%$/', $value, $match)) { - $key = $match[1]; - - if (isset($resolving[$key])) { - throw new ParameterCircularReferenceException(array_keys($resolving)); - } - - $resolving[$key] = true; - - return $this->resolved ? $this->get($key) : $this->resolveValue($this->get($key), $resolving); - } - - return preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($resolving, $value) { - // skip %% - if (!isset($match[1])) { - return '%%'; - } - - $key = $match[1]; - if (isset($resolving[$key])) { - throw new ParameterCircularReferenceException(array_keys($resolving)); - } - - $resolved = $this->get($key); - - if (!\is_string($resolved) && !is_numeric($resolved)) { - throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type "%s" inside string value "%s".', $key, get_debug_type($resolved), $value)); - } - - $resolved = (string) $resolved; - $resolving[$key] = true; - - return $this->isResolved() ? $resolved : $this->resolveString($resolved, $resolving); - }, $value); - } - - /** - * @return bool - */ - public function isResolved() - { - return $this->resolved; - } - - public function escapeValue(mixed $value): mixed - { - if (\is_string($value)) { - return str_replace('%', '%%', $value); - } - - if (\is_array($value)) { - $result = []; - foreach ($value as $k => $v) { - $result[$k] = $this->escapeValue($v); - } - - return $result; - } - - return $value; - } - - public function unescapeValue(mixed $value): mixed - { - if (\is_string($value)) { - return str_replace('%%', '%', $value); - } - - if (\is_array($value)) { - $result = []; - foreach ($value as $k => $v) { - $result[$k] = $this->unescapeValue($v); - } - - return $result; - } - - return $value; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ParameterBag/ParameterBagInterface.php b/tests/integration/vendor/symfony/dependency-injection/ParameterBag/ParameterBagInterface.php deleted file mode 100644 index 18ddfde..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ParameterBag/ParameterBagInterface.php +++ /dev/null @@ -1,100 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\ParameterBag; - -use Symfony\Component\DependencyInjection\Exception\LogicException; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; - -/** - * ParameterBagInterface is the interface implemented by objects that manage service container parameters. - * - * @author Fabien Potencier - */ -interface ParameterBagInterface -{ - /** - * Clears all parameters. - * - * @return void - * - * @throws LogicException if the ParameterBagInterface cannot be cleared - */ - public function clear(); - - /** - * Adds parameters to the service container parameters. - * - * @return void - * - * @throws LogicException if the parameter cannot be added - */ - public function add(array $parameters); - - /** - * Gets the service container parameters. - */ - public function all(): array; - - /** - * Gets a service container parameter. - * - * @throws ParameterNotFoundException if the parameter is not defined - */ - public function get(string $name): array|bool|string|int|float|\UnitEnum|null; - - /** - * Removes a parameter. - * - * @return void - */ - public function remove(string $name); - - /** - * Sets a service container parameter. - * - * @return void - * - * @throws LogicException if the parameter cannot be set - */ - public function set(string $name, array|bool|string|int|float|\UnitEnum|null $value); - - /** - * Returns true if a parameter name is defined. - */ - public function has(string $name): bool; - - /** - * Replaces parameter placeholders (%name%) by their values for all parameters. - * - * @return void - */ - public function resolve(); - - /** - * Replaces parameter placeholders (%name%) by their values. - * - * @return mixed - * - * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist - */ - public function resolveValue(mixed $value); - - /** - * Escape parameter placeholders %. - */ - public function escapeValue(mixed $value): mixed; - - /** - * Unescape parameter placeholders %. - */ - public function unescapeValue(mixed $value): mixed; -} diff --git a/tests/integration/vendor/symfony/dependency-injection/README.md b/tests/integration/vendor/symfony/dependency-injection/README.md deleted file mode 100644 index fa6719a..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/README.md +++ /dev/null @@ -1,14 +0,0 @@ -DependencyInjection Component -============================= - -The DependencyInjection component allows you to standardize and centralize the -way objects are constructed in your application. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/dependency_injection.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/tests/integration/vendor/symfony/dependency-injection/Reference.php b/tests/integration/vendor/symfony/dependency-injection/Reference.php deleted file mode 100644 index 2a89dda..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Reference.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -/** - * Reference represents a service reference. - * - * @author Fabien Potencier - */ -class Reference -{ - private string $id; - private int $invalidBehavior; - - public function __construct(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) - { - $this->id = $id; - $this->invalidBehavior = $invalidBehavior; - } - - public function __toString(): string - { - return $this->id; - } - - /** - * Returns the behavior to be used when the service does not exist. - */ - public function getInvalidBehavior(): int - { - return $this->invalidBehavior; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/ServiceLocator.php b/tests/integration/vendor/symfony/dependency-injection/ServiceLocator.php deleted file mode 100644 index 516e92f..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/ServiceLocator.php +++ /dev/null @@ -1,151 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -use Psr\Container\ContainerExceptionInterface; -use Psr\Container\NotFoundExceptionInterface; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; -use Symfony\Contracts\Service\ServiceLocatorTrait; -use Symfony\Contracts\Service\ServiceProviderInterface; -use Symfony\Contracts\Service\ServiceSubscriberInterface; - -/** - * @author Robin Chalas - * @author Nicolas Grekas - * - * @template-covariant T of mixed - * - * @implements ServiceProviderInterface - */ -class ServiceLocator implements ServiceProviderInterface, \Countable -{ - use ServiceLocatorTrait { - get as private doGet; - } - - private ?string $externalId = null; - private ?Container $container = null; - - public function get(string $id): mixed - { - if (!$this->externalId) { - return $this->doGet($id); - } - - try { - return $this->doGet($id); - } catch (RuntimeException $e) { - $what = sprintf('service "%s" required by "%s"', $id, $this->externalId); - $message = preg_replace('/service "\.service_locator\.[^"]++"/', $what, $e->getMessage()); - - if ($e->getMessage() === $message) { - $message = sprintf('Cannot resolve %s: %s', $what, $message); - } - - $r = new \ReflectionProperty($e, 'message'); - $r->setValue($e, $message); - - throw $e; - } - } - - public function __invoke(string $id) - { - return isset($this->factories[$id]) ? $this->get($id) : null; - } - - /** - * @internal - */ - public function withContext(string $externalId, Container $container): static - { - $locator = clone $this; - $locator->externalId = $externalId; - $locator->container = $container; - - return $locator; - } - - public function count(): int - { - return \count($this->getProvidedServices()); - } - - private function createNotFoundException(string $id): NotFoundExceptionInterface - { - if ($this->loading) { - $msg = sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $this->formatAlternatives()); - - return new ServiceNotFoundException($id, end($this->loading) ?: null, null, [], $msg); - } - - $class = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS, 4); - $class = isset($class[3]['object']) ? $class[3]['object']::class : null; - $externalId = $this->externalId ?: $class; - - $msg = []; - $msg[] = sprintf('Service "%s" not found:', $id); - - if (!$this->container) { - $class = null; - } elseif ($this->container->has($id) || isset($this->container->getRemovedIds()[$id])) { - $msg[] = 'even though it exists in the app\'s container,'; - } else { - try { - $this->container->get($id); - $class = null; - } catch (ServiceNotFoundException $e) { - if ($e->getAlternatives()) { - $msg[] = sprintf('did you mean %s? Anyway,', $this->formatAlternatives($e->getAlternatives(), 'or')); - } else { - $class = null; - } - } - } - if ($externalId) { - $msg[] = sprintf('the container inside "%s" is a smaller service locator that %s', $externalId, $this->formatAlternatives()); - } else { - $msg[] = sprintf('the current service locator %s', $this->formatAlternatives()); - } - - if (!$class) { - // no-op - } elseif (is_subclass_of($class, ServiceSubscriberInterface::class)) { - $msg[] = sprintf('Unless you need extra laziness, try using dependency injection instead. Otherwise, you need to declare it using "%s::getSubscribedServices()".', preg_replace('/([^\\\\]++\\\\)++/', '', $class)); - } else { - $msg[] = 'Try using dependency injection instead.'; - } - - return new ServiceNotFoundException($id, end($this->loading) ?: null, null, [], implode(' ', $msg)); - } - - private function createCircularReferenceException(string $id, array $path): ContainerExceptionInterface - { - return new ServiceCircularReferenceException($id, $path); - } - - private function formatAlternatives(array $alternatives = null, string $separator = 'and'): string - { - $format = '"%s"%s'; - if (null === $alternatives) { - if (!$alternatives = array_keys($this->factories)) { - return 'is empty...'; - } - $format = sprintf('only knows about the %s service%s.', $format, 1 < \count($alternatives) ? 's' : ''); - } - $last = array_pop($alternatives); - - return sprintf($format, $alternatives ? implode('", "', $alternatives) : $last, $alternatives ? sprintf(' %s "%s"', $separator, $last) : ''); - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/TaggedContainerInterface.php b/tests/integration/vendor/symfony/dependency-injection/TaggedContainerInterface.php deleted file mode 100644 index a108a99..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/TaggedContainerInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -/** - * TaggedContainerInterface is the interface implemented when a container knows how to deals with tags. - * - * @author Fabien Potencier - */ -interface TaggedContainerInterface extends ContainerInterface -{ - /** - * Returns service ids for a given tag. - * - * @param string $name The tag name - */ - public function findTaggedServiceIds(string $name): array; -} diff --git a/tests/integration/vendor/symfony/dependency-injection/TypedReference.php b/tests/integration/vendor/symfony/dependency-injection/TypedReference.php deleted file mode 100644 index 9b431cd..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/TypedReference.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -/** - * Represents a PHP type-hinted service reference. - * - * @author Nicolas Grekas - */ -class TypedReference extends Reference -{ - private string $type; - private ?string $name; - private array $attributes; - - /** - * @param string $id The service identifier - * @param string $type The PHP type of the identified service - * @param int $invalidBehavior The behavior when the service does not exist - * @param string|null $name The name of the argument targeting the service - * @param array $attributes The attributes to be used - */ - public function __construct(string $id, string $type, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, string $name = null, array $attributes = []) - { - $this->name = $type === $id ? $name : null; - parent::__construct($id, $invalidBehavior); - $this->type = $type; - $this->attributes = $attributes; - } - - /** - * @return string - */ - public function getType() - { - return $this->type; - } - - public function getName(): ?string - { - return $this->name; - } - - public function getAttributes(): array - { - return $this->attributes; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/Variable.php b/tests/integration/vendor/symfony/dependency-injection/Variable.php deleted file mode 100644 index bb275ce..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/Variable.php +++ /dev/null @@ -1,40 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection; - -/** - * Represents a variable. - * - * $var = new Variable('a'); - * - * will be dumped as - * - * $a - * - * by the PHP dumper. - * - * @author Johannes M. Schmitt - */ -class Variable -{ - private string $name; - - public function __construct(string $name) - { - $this->name = $name; - } - - public function __toString(): string - { - return $this->name; - } -} diff --git a/tests/integration/vendor/symfony/dependency-injection/composer.json b/tests/integration/vendor/symfony/dependency-injection/composer.json deleted file mode 100644 index 7949058..0000000 --- a/tests/integration/vendor/symfony/dependency-injection/composer.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "symfony/dependency-injection", - "type": "library", - "description": "Allows you to standardize and centralize the way objects are constructed in your application", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/service-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.2.10" - }, - "require-dev": { - "symfony/yaml": "^5.4|^6.0", - "symfony/config": "^6.1", - "symfony/expression-language": "^5.4|^6.0" - }, - "conflict": { - "ext-psr": "<1.1|>=2", - "symfony/config": "<6.1", - "symfony/finder": "<5.4", - "symfony/proxy-manager-bridge": "<6.3", - "symfony/yaml": "<5.4" - }, - "provide": { - "psr/container-implementation": "1.1|2.0", - "symfony/service-implementation": "1.1|2.0|3.0" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\DependencyInjection\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/CHANGELOG.md b/tests/integration/vendor/symfony/event-dispatcher/CHANGELOG.md deleted file mode 100644 index 76b2eab..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/CHANGELOG.md +++ /dev/null @@ -1,96 +0,0 @@ -CHANGELOG -========= - -6.0 ---- - - * Remove `LegacyEventDispatcherProxy` - -5.4 ---- - - * Allow `#[AsEventListener]` attribute on methods - -5.3 ---- - - * Add `#[AsEventListener]` attribute for declaring listeners on PHP 8 - -5.1.0 ------ - - * The `LegacyEventDispatcherProxy` class has been deprecated. - * Added an optional `dispatcher` attribute to the listener and subscriber tags in `RegisterListenerPass`. - -5.0.0 ------ - - * The signature of the `EventDispatcherInterface::dispatch()` method has been changed to `dispatch($event, string $eventName = null): object`. - * The `Event` class has been removed in favor of `Symfony\Contracts\EventDispatcher\Event`. - * The `TraceableEventDispatcherInterface` has been removed. - * The `WrappedListener` class is now final. - -4.4.0 ------ - - * `AddEventAliasesPass` has been added, allowing applications and bundles to extend the event alias mapping used by `RegisterListenersPass`. - * Made the `event` attribute of the `kernel.event_listener` tag optional for FQCN events. - -4.3.0 ------ - - * The signature of the `EventDispatcherInterface::dispatch()` method should be updated to `dispatch($event, string $eventName = null)`, not doing so is deprecated - * deprecated the `Event` class, use `Symfony\Contracts\EventDispatcher\Event` instead - -4.1.0 ------ - - * added support for invokable event listeners tagged with `kernel.event_listener` by default - * The `TraceableEventDispatcher::getOrphanedEvents()` method has been added. - * The `TraceableEventDispatcherInterface` has been deprecated. - -4.0.0 ------ - - * removed the `ContainerAwareEventDispatcher` class - * added the `reset()` method to the `TraceableEventDispatcherInterface` - -3.4.0 ------ - - * Implementing `TraceableEventDispatcherInterface` without the `reset()` method has been deprecated. - -3.3.0 ------ - - * The ContainerAwareEventDispatcher class has been deprecated. Use EventDispatcher with closure factories instead. - -3.0.0 ------ - - * The method `getListenerPriority($eventName, $listener)` has been added to the - `EventDispatcherInterface`. - * The methods `Event::setDispatcher()`, `Event::getDispatcher()`, `Event::setName()` - and `Event::getName()` have been removed. - The event dispatcher and the event name are passed to the listener call. - -2.5.0 ------ - - * added Debug\TraceableEventDispatcher (originally in HttpKernel) - * changed Debug\TraceableEventDispatcherInterface to extend EventDispatcherInterface - * added RegisterListenersPass (originally in HttpKernel) - -2.1.0 ------ - - * added TraceableEventDispatcherInterface - * added ContainerAwareEventDispatcher - * added a reference to the EventDispatcher on the Event - * added a reference to the Event name on the event - * added fluid interface to the dispatch() method which now returns the Event - object - * added GenericEvent event class - * added the possibility for subscribers to subscribe several times for the - same event - * added ImmutableEventDispatcher diff --git a/tests/integration/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/tests/integration/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php deleted file mode 100644 index f1b9823..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php +++ /dev/null @@ -1,376 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Psr\EventDispatcher\StoppableEventInterface; -use Psr\Log\LoggerInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Contracts\Service\ResetInterface; - -/** - * Collects some data about event listeners. - * - * This event dispatcher delegates the dispatching to another one. - * - * @author Fabien Potencier - */ -class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterface -{ - protected $logger; - protected $stopwatch; - - /** - * @var \SplObjectStorage|null - */ - private ?\SplObjectStorage $callStack = null; - private EventDispatcherInterface $dispatcher; - private array $wrappedListeners = []; - private array $orphanedEvents = []; - private ?RequestStack $requestStack; - private string $currentRequestHash = ''; - - public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null, RequestStack $requestStack = null) - { - $this->dispatcher = $dispatcher; - $this->stopwatch = $stopwatch; - $this->logger = $logger; - $this->requestStack = $requestStack; - } - - /** - * @return void - */ - public function addListener(string $eventName, callable|array $listener, int $priority = 0) - { - $this->dispatcher->addListener($eventName, $listener, $priority); - } - - /** - * @return void - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - $this->dispatcher->addSubscriber($subscriber); - } - - /** - * @return void - */ - public function removeListener(string $eventName, callable|array $listener) - { - if (isset($this->wrappedListeners[$eventName])) { - foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) { - if ($wrappedListener->getWrappedListener() === $listener || ($listener instanceof \Closure && $wrappedListener->getWrappedListener() == $listener)) { - $listener = $wrappedListener; - unset($this->wrappedListeners[$eventName][$index]); - break; - } - } - } - - $this->dispatcher->removeListener($eventName, $listener); - } - - /** - * @return void - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - $this->dispatcher->removeSubscriber($subscriber); - } - - public function getListeners(string $eventName = null): array - { - return $this->dispatcher->getListeners($eventName); - } - - public function getListenerPriority(string $eventName, callable|array $listener): ?int - { - // we might have wrapped listeners for the event (if called while dispatching) - // in that case get the priority by wrapper - if (isset($this->wrappedListeners[$eventName])) { - foreach ($this->wrappedListeners[$eventName] as $wrappedListener) { - if ($wrappedListener->getWrappedListener() === $listener || ($listener instanceof \Closure && $wrappedListener->getWrappedListener() == $listener)) { - return $this->dispatcher->getListenerPriority($eventName, $wrappedListener); - } - } - } - - return $this->dispatcher->getListenerPriority($eventName, $listener); - } - - public function hasListeners(string $eventName = null): bool - { - return $this->dispatcher->hasListeners($eventName); - } - - public function dispatch(object $event, string $eventName = null): object - { - $eventName ??= $event::class; - - $this->callStack ??= new \SplObjectStorage(); - - $currentRequestHash = $this->currentRequestHash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : ''; - - if (null !== $this->logger && $event instanceof StoppableEventInterface && $event->isPropagationStopped()) { - $this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName)); - } - - $this->preProcess($eventName); - try { - $this->beforeDispatch($eventName, $event); - try { - $e = $this->stopwatch->start($eventName, 'section'); - try { - $this->dispatcher->dispatch($event, $eventName); - } finally { - if ($e->isStarted()) { - $e->stop(); - } - } - } finally { - $this->afterDispatch($eventName, $event); - } - } finally { - $this->currentRequestHash = $currentRequestHash; - $this->postProcess($eventName); - } - - return $event; - } - - public function getCalledListeners(Request $request = null): array - { - if (null === $this->callStack) { - return []; - } - - $hash = $request ? spl_object_hash($request) : null; - $called = []; - foreach ($this->callStack as $listener) { - [$eventName, $requestHash] = $this->callStack->getInfo(); - if (null === $hash || $hash === $requestHash) { - $called[] = $listener->getInfo($eventName); - } - } - - return $called; - } - - public function getNotCalledListeners(Request $request = null): array - { - try { - $allListeners = $this->dispatcher instanceof EventDispatcher ? $this->getListenersWithPriority() : $this->getListenersWithoutPriority(); - } catch (\Exception $e) { - $this->logger?->info('An exception was thrown while getting the uncalled listeners.', ['exception' => $e]); - - // unable to retrieve the uncalled listeners - return []; - } - - $hash = $request ? spl_object_hash($request) : null; - $calledListeners = []; - - if (null !== $this->callStack) { - foreach ($this->callStack as $calledListener) { - [, $requestHash] = $this->callStack->getInfo(); - - if (null === $hash || $hash === $requestHash) { - $calledListeners[] = $calledListener->getWrappedListener(); - } - } - } - - $notCalled = []; - - foreach ($allListeners as $eventName => $listeners) { - foreach ($listeners as [$listener, $priority]) { - if (!\in_array($listener, $calledListeners, true)) { - if (!$listener instanceof WrappedListener) { - $listener = new WrappedListener($listener, null, $this->stopwatch, $this, $priority); - } - $notCalled[] = $listener->getInfo($eventName); - } - } - } - - uasort($notCalled, $this->sortNotCalledListeners(...)); - - return $notCalled; - } - - public function getOrphanedEvents(Request $request = null): array - { - if ($request) { - return $this->orphanedEvents[spl_object_hash($request)] ?? []; - } - - if (!$this->orphanedEvents) { - return []; - } - - return array_merge(...array_values($this->orphanedEvents)); - } - - /** - * @return void - */ - public function reset() - { - $this->callStack = null; - $this->orphanedEvents = []; - $this->currentRequestHash = ''; - } - - /** - * Proxies all method calls to the original event dispatcher. - * - * @param string $method The method name - * @param array $arguments The method arguments - */ - public function __call(string $method, array $arguments): mixed - { - return $this->dispatcher->{$method}(...$arguments); - } - - /** - * Called before dispatching the event. - * - * @return void - */ - protected function beforeDispatch(string $eventName, object $event) - { - } - - /** - * Called after dispatching the event. - * - * @return void - */ - protected function afterDispatch(string $eventName, object $event) - { - } - - private function preProcess(string $eventName): void - { - if (!$this->dispatcher->hasListeners($eventName)) { - $this->orphanedEvents[$this->currentRequestHash][] = $eventName; - - return; - } - - foreach ($this->dispatcher->getListeners($eventName) as $listener) { - $priority = $this->getListenerPriority($eventName, $listener); - $wrappedListener = new WrappedListener($listener instanceof WrappedListener ? $listener->getWrappedListener() : $listener, null, $this->stopwatch, $this); - $this->wrappedListeners[$eventName][] = $wrappedListener; - $this->dispatcher->removeListener($eventName, $listener); - $this->dispatcher->addListener($eventName, $wrappedListener, $priority); - $this->callStack->attach($wrappedListener, [$eventName, $this->currentRequestHash]); - } - } - - private function postProcess(string $eventName): void - { - unset($this->wrappedListeners[$eventName]); - $skipped = false; - foreach ($this->dispatcher->getListeners($eventName) as $listener) { - if (!$listener instanceof WrappedListener) { // #12845: a new listener was added during dispatch. - continue; - } - // Unwrap listener - $priority = $this->getListenerPriority($eventName, $listener); - $this->dispatcher->removeListener($eventName, $listener); - $this->dispatcher->addListener($eventName, $listener->getWrappedListener(), $priority); - - if (null !== $this->logger) { - $context = ['event' => $eventName, 'listener' => $listener->getPretty()]; - } - - if ($listener->wasCalled()) { - $this->logger?->debug('Notified event "{event}" to listener "{listener}".', $context); - } else { - $this->callStack->detach($listener); - } - - if (null !== $this->logger && $skipped) { - $this->logger->debug('Listener "{listener}" was not called for event "{event}".', $context); - } - - if ($listener->stoppedPropagation()) { - $this->logger?->debug('Listener "{listener}" stopped propagation of the event "{event}".', $context); - - $skipped = true; - } - } - } - - private function sortNotCalledListeners(array $a, array $b): int - { - if (0 !== $cmp = strcmp($a['event'], $b['event'])) { - return $cmp; - } - - if (\is_int($a['priority']) && !\is_int($b['priority'])) { - return 1; - } - - if (!\is_int($a['priority']) && \is_int($b['priority'])) { - return -1; - } - - if ($a['priority'] === $b['priority']) { - return 0; - } - - if ($a['priority'] > $b['priority']) { - return -1; - } - - return 1; - } - - private function getListenersWithPriority(): array - { - $result = []; - - $allListeners = new \ReflectionProperty(EventDispatcher::class, 'listeners'); - $allListeners->setAccessible(true); - - foreach ($allListeners->getValue($this->dispatcher) as $eventName => $listenersByPriority) { - foreach ($listenersByPriority as $priority => $listeners) { - foreach ($listeners as $listener) { - $result[$eventName][] = [$listener, $priority]; - } - } - } - - return $result; - } - - private function getListenersWithoutPriority(): array - { - $result = []; - - foreach ($this->getListeners() as $eventName => $listeners) { - foreach ($listeners as $listener) { - $result[$eventName][] = [$listener, null]; - } - } - - return $result; - } -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/Debug/WrappedListener.php b/tests/integration/vendor/symfony/event-dispatcher/Debug/WrappedListener.php deleted file mode 100644 index 6e0de1d..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/Debug/WrappedListener.php +++ /dev/null @@ -1,144 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Psr\EventDispatcher\StoppableEventInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Component\VarDumper\Caster\ClassStub; - -/** - * @author Fabien Potencier - */ -final class WrappedListener -{ - private string|array|object $listener; - private ?\Closure $optimizedListener; - private string $name; - private bool $called = false; - private bool $stoppedPropagation = false; - private Stopwatch $stopwatch; - private ?EventDispatcherInterface $dispatcher; - private string $pretty; - private string $callableRef; - private ClassStub|string $stub; - private ?int $priority = null; - private static bool $hasClassStub; - - public function __construct(callable|array $listener, ?string $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null, int $priority = null) - { - $this->listener = $listener; - $this->optimizedListener = $listener instanceof \Closure ? $listener : (\is_callable($listener) ? $listener(...) : null); - $this->stopwatch = $stopwatch; - $this->dispatcher = $dispatcher; - $this->priority = $priority; - - if (\is_array($listener)) { - [$this->name, $this->callableRef] = $this->parseListener($listener); - $this->pretty = $this->name.'::'.$listener[1]; - $this->callableRef .= '::'.$listener[1]; - } elseif ($listener instanceof \Closure) { - $r = new \ReflectionFunction($listener); - if (str_contains($r->name, '{closure}')) { - $this->pretty = $this->name = 'closure'; - } elseif ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) { - $this->name = $class->name; - $this->pretty = $this->name.'::'.$r->name; - } else { - $this->pretty = $this->name = $r->name; - } - } elseif (\is_string($listener)) { - $this->pretty = $this->name = $listener; - } else { - $this->name = get_debug_type($listener); - $this->pretty = $this->name.'::__invoke'; - $this->callableRef = $listener::class.'::__invoke'; - } - - if (null !== $name) { - $this->name = $name; - } - - self::$hasClassStub ??= class_exists(ClassStub::class); - } - - public function getWrappedListener(): callable|array - { - return $this->listener; - } - - public function wasCalled(): bool - { - return $this->called; - } - - public function stoppedPropagation(): bool - { - return $this->stoppedPropagation; - } - - public function getPretty(): string - { - return $this->pretty; - } - - public function getInfo(string $eventName): array - { - $this->stub ??= self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->callableRef ?? $this->listener) : $this->pretty.'()'; - - return [ - 'event' => $eventName, - 'priority' => $this->priority ??= $this->dispatcher?->getListenerPriority($eventName, $this->listener), - 'pretty' => $this->pretty, - 'stub' => $this->stub, - ]; - } - - public function __invoke(object $event, string $eventName, EventDispatcherInterface $dispatcher): void - { - $dispatcher = $this->dispatcher ?: $dispatcher; - - $this->called = true; - $this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener); - - $e = $this->stopwatch->start($this->name, 'event_listener'); - - try { - ($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher); - } finally { - if ($e->isStarted()) { - $e->stop(); - } - } - - if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) { - $this->stoppedPropagation = true; - } - } - - private function parseListener(array $listener): array - { - if ($listener[0] instanceof \Closure) { - foreach ((new \ReflectionFunction($listener[0]))->getAttributes(\Closure::class) as $attribute) { - if ($name = $attribute->getArguments()['name'] ?? false) { - return [$name, $attribute->getArguments()['class'] ?? $name]; - } - } - } - - if (\is_object($listener[0])) { - return [get_debug_type($listener[0]), $listener[0]::class]; - } - - return [$listener[0], $listener[0]]; - } -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/tests/integration/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php deleted file mode 100644 index 866f4e6..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ /dev/null @@ -1,216 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\DependencyInjection; - -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Contracts\EventDispatcher\Event; - -/** - * Compiler pass to register tagged services for an event dispatcher. - */ -class RegisterListenersPass implements CompilerPassInterface -{ - private array $hotPathEvents = []; - private array $noPreloadEvents = []; - - /** - * @return $this - */ - public function setHotPathEvents(array $hotPathEvents): static - { - $this->hotPathEvents = array_flip($hotPathEvents); - - return $this; - } - - /** - * @return $this - */ - public function setNoPreloadEvents(array $noPreloadEvents): static - { - $this->noPreloadEvents = array_flip($noPreloadEvents); - - return $this; - } - - /** - * @return void - */ - public function process(ContainerBuilder $container) - { - if (!$container->hasDefinition('event_dispatcher') && !$container->hasAlias('event_dispatcher')) { - return; - } - - $aliases = []; - - if ($container->hasParameter('event_dispatcher.event_aliases')) { - $aliases = $container->getParameter('event_dispatcher.event_aliases'); - } - - $globalDispatcherDefinition = $container->findDefinition('event_dispatcher'); - - foreach ($container->findTaggedServiceIds('kernel.event_listener', true) as $id => $events) { - $noPreload = 0; - - foreach ($events as $event) { - $priority = $event['priority'] ?? 0; - - if (!isset($event['event'])) { - if ($container->getDefinition($id)->hasTag('kernel.event_subscriber')) { - continue; - } - - $event['method'] ??= '__invoke'; - $event['event'] = $this->getEventFromTypeDeclaration($container, $id, $event['method']); - } - - $event['event'] = $aliases[$event['event']] ?? $event['event']; - - if (!isset($event['method'])) { - $event['method'] = 'on'.preg_replace_callback([ - '/(?<=\b|_)[a-z]/i', - '/[^a-z0-9]/i', - ], fn ($matches) => strtoupper($matches[0]), $event['event']); - $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']); - - if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method'])) { - if (!$r->hasMethod('__invoke')) { - throw new InvalidArgumentException(sprintf('None of the "%s" or "__invoke" methods exist for the service "%s". Please define the "method" attribute on "kernel.event_listener" tags.', $event['method'], $id)); - } - - $event['method'] = '__invoke'; - } - } - - $dispatcherDefinition = $globalDispatcherDefinition; - if (isset($event['dispatcher'])) { - $dispatcherDefinition = $container->findDefinition($event['dispatcher']); - } - - $dispatcherDefinition->addMethodCall('addListener', [$event['event'], [new ServiceClosureArgument(new Reference($id)), $event['method']], $priority]); - - if (isset($this->hotPathEvents[$event['event']])) { - $container->getDefinition($id)->addTag('container.hot_path'); - } elseif (isset($this->noPreloadEvents[$event['event']])) { - ++$noPreload; - } - } - - if ($noPreload && \count($events) === $noPreload) { - $container->getDefinition($id)->addTag('container.no_preload'); - } - } - - $extractingDispatcher = new ExtractingEventDispatcher(); - - foreach ($container->findTaggedServiceIds('kernel.event_subscriber', true) as $id => $tags) { - $def = $container->getDefinition($id); - - // We must assume that the class value has been correctly filled, even if the service is created by a factory - $class = $def->getClass(); - - if (!$r = $container->getReflectionClass($class)) { - throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); - } - if (!$r->isSubclassOf(EventSubscriberInterface::class)) { - throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, EventSubscriberInterface::class)); - } - $class = $r->name; - - $dispatcherDefinitions = []; - foreach ($tags as $attributes) { - if (!isset($attributes['dispatcher']) || isset($dispatcherDefinitions[$attributes['dispatcher']])) { - continue; - } - - $dispatcherDefinitions[$attributes['dispatcher']] = $container->findDefinition($attributes['dispatcher']); - } - - if (!$dispatcherDefinitions) { - $dispatcherDefinitions = [$globalDispatcherDefinition]; - } - - $noPreload = 0; - ExtractingEventDispatcher::$aliases = $aliases; - ExtractingEventDispatcher::$subscriber = $class; - $extractingDispatcher->addSubscriber($extractingDispatcher); - foreach ($extractingDispatcher->listeners as $args) { - $args[1] = [new ServiceClosureArgument(new Reference($id)), $args[1]]; - foreach ($dispatcherDefinitions as $dispatcherDefinition) { - $dispatcherDefinition->addMethodCall('addListener', $args); - } - - if (isset($this->hotPathEvents[$args[0]])) { - $container->getDefinition($id)->addTag('container.hot_path'); - } elseif (isset($this->noPreloadEvents[$args[0]])) { - ++$noPreload; - } - } - if ($noPreload && \count($extractingDispatcher->listeners) === $noPreload) { - $container->getDefinition($id)->addTag('container.no_preload'); - } - $extractingDispatcher->listeners = []; - ExtractingEventDispatcher::$aliases = []; - } - } - - private function getEventFromTypeDeclaration(ContainerBuilder $container, string $id, string $method): string - { - if ( - null === ($class = $container->getDefinition($id)->getClass()) - || !($r = $container->getReflectionClass($class, false)) - || !$r->hasMethod($method) - || 1 > ($m = $r->getMethod($method))->getNumberOfParameters() - || !($type = $m->getParameters()[0]->getType()) instanceof \ReflectionNamedType - || $type->isBuiltin() - || Event::class === ($name = $type->getName()) - ) { - throw new InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); - } - - return $name; - } -} - -/** - * @internal - */ -class ExtractingEventDispatcher extends EventDispatcher implements EventSubscriberInterface -{ - public array $listeners = []; - - public static array $aliases = []; - public static string $subscriber; - - public function addListener(string $eventName, callable|array $listener, int $priority = 0): void - { - $this->listeners[] = [$eventName, $listener[1], $priority]; - } - - public static function getSubscribedEvents(): array - { - $events = []; - - foreach ([self::$subscriber, 'getSubscribedEvents']() as $eventName => $params) { - $events[self::$aliases[$eventName] ?? $eventName] = $params; - } - - return $events; - } -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/EventDispatcher.php b/tests/integration/vendor/symfony/event-dispatcher/EventDispatcher.php deleted file mode 100644 index 327803a..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/EventDispatcher.php +++ /dev/null @@ -1,270 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -use Psr\EventDispatcher\StoppableEventInterface; -use Symfony\Component\EventDispatcher\Debug\WrappedListener; - -/** - * The EventDispatcherInterface is the central point of Symfony's event listener system. - * - * Listeners are registered on the manager and events are dispatched through the - * manager. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Fabien Potencier - * @author Jordi Boggiano - * @author Jordan Alliot - * @author Nicolas Grekas - */ -class EventDispatcher implements EventDispatcherInterface -{ - private array $listeners = []; - private array $sorted = []; - private array $optimized; - - public function __construct() - { - if (__CLASS__ === static::class) { - $this->optimized = []; - } - } - - public function dispatch(object $event, string $eventName = null): object - { - $eventName ??= $event::class; - - if (isset($this->optimized)) { - $listeners = $this->optimized[$eventName] ?? (empty($this->listeners[$eventName]) ? [] : $this->optimizeListeners($eventName)); - } else { - $listeners = $this->getListeners($eventName); - } - - if ($listeners) { - $this->callListeners($listeners, $eventName, $event); - } - - return $event; - } - - public function getListeners(string $eventName = null): array - { - if (null !== $eventName) { - if (empty($this->listeners[$eventName])) { - return []; - } - - if (!isset($this->sorted[$eventName])) { - $this->sortListeners($eventName); - } - - return $this->sorted[$eventName]; - } - - foreach ($this->listeners as $eventName => $eventListeners) { - if (!isset($this->sorted[$eventName])) { - $this->sortListeners($eventName); - } - } - - return array_filter($this->sorted); - } - - public function getListenerPriority(string $eventName, callable|array $listener): ?int - { - if (empty($this->listeners[$eventName])) { - return null; - } - - if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && 2 >= \count($listener)) { - $listener[0] = $listener[0](); - $listener[1] ??= '__invoke'; - } - - foreach ($this->listeners[$eventName] as $priority => &$listeners) { - foreach ($listeners as &$v) { - if ($v !== $listener && \is_array($v) && isset($v[0]) && $v[0] instanceof \Closure && 2 >= \count($v)) { - $v[0] = $v[0](); - $v[1] ??= '__invoke'; - } - if ($v === $listener || ($listener instanceof \Closure && $v == $listener)) { - return $priority; - } - } - } - - return null; - } - - public function hasListeners(string $eventName = null): bool - { - if (null !== $eventName) { - return !empty($this->listeners[$eventName]); - } - - foreach ($this->listeners as $eventListeners) { - if ($eventListeners) { - return true; - } - } - - return false; - } - - /** - * @return void - */ - public function addListener(string $eventName, callable|array $listener, int $priority = 0) - { - $this->listeners[$eventName][$priority][] = $listener; - unset($this->sorted[$eventName], $this->optimized[$eventName]); - } - - /** - * @return void - */ - public function removeListener(string $eventName, callable|array $listener) - { - if (empty($this->listeners[$eventName])) { - return; - } - - if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && 2 >= \count($listener)) { - $listener[0] = $listener[0](); - $listener[1] ??= '__invoke'; - } - - foreach ($this->listeners[$eventName] as $priority => &$listeners) { - foreach ($listeners as $k => &$v) { - if ($v !== $listener && \is_array($v) && isset($v[0]) && $v[0] instanceof \Closure && 2 >= \count($v)) { - $v[0] = $v[0](); - $v[1] ??= '__invoke'; - } - if ($v === $listener || ($listener instanceof \Closure && $v == $listener)) { - unset($listeners[$k], $this->sorted[$eventName], $this->optimized[$eventName]); - } - } - - if (!$listeners) { - unset($this->listeners[$eventName][$priority]); - } - } - } - - /** - * @return void - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (\is_string($params)) { - $this->addListener($eventName, [$subscriber, $params]); - } elseif (\is_string($params[0])) { - $this->addListener($eventName, [$subscriber, $params[0]], $params[1] ?? 0); - } else { - foreach ($params as $listener) { - $this->addListener($eventName, [$subscriber, $listener[0]], $listener[1] ?? 0); - } - } - } - } - - /** - * @return void - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (\is_array($params) && \is_array($params[0])) { - foreach ($params as $listener) { - $this->removeListener($eventName, [$subscriber, $listener[0]]); - } - } else { - $this->removeListener($eventName, [$subscriber, \is_string($params) ? $params : $params[0]]); - } - } - } - - /** - * Triggers the listeners of an event. - * - * This method can be overridden to add functionality that is executed - * for each listener. - * - * @param callable[] $listeners The event listeners - * @param string $eventName The name of the event to dispatch - * @param object $event The event object to pass to the event handlers/listeners - * - * @return void - */ - protected function callListeners(iterable $listeners, string $eventName, object $event) - { - $stoppable = $event instanceof StoppableEventInterface; - - foreach ($listeners as $listener) { - if ($stoppable && $event->isPropagationStopped()) { - break; - } - $listener($event, $eventName, $this); - } - } - - /** - * Sorts the internal list of listeners for the given event by priority. - */ - private function sortListeners(string $eventName): void - { - krsort($this->listeners[$eventName]); - $this->sorted[$eventName] = []; - - foreach ($this->listeners[$eventName] as &$listeners) { - foreach ($listeners as &$listener) { - if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && 2 >= \count($listener)) { - $listener[0] = $listener[0](); - $listener[1] ??= '__invoke'; - } - $this->sorted[$eventName][] = $listener; - } - } - } - - /** - * Optimizes the internal list of listeners for the given event by priority. - */ - private function optimizeListeners(string $eventName): array - { - krsort($this->listeners[$eventName]); - $this->optimized[$eventName] = []; - - foreach ($this->listeners[$eventName] as &$listeners) { - foreach ($listeners as &$listener) { - $closure = &$this->optimized[$eventName][]; - if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && 2 >= \count($listener)) { - $closure = static function (...$args) use (&$listener, &$closure) { - if ($listener[0] instanceof \Closure) { - $listener[0] = $listener[0](); - $listener[1] ??= '__invoke'; - } - ($closure = $listener(...))(...$args); - }; - } else { - $closure = $listener instanceof WrappedListener ? $listener : $listener(...); - } - } - } - - return $this->optimized[$eventName]; - } -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/EventDispatcherInterface.php b/tests/integration/vendor/symfony/event-dispatcher/EventDispatcherInterface.php deleted file mode 100644 index 3cd94c9..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/EventDispatcherInterface.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface; - -/** - * The EventDispatcherInterface is the central point of Symfony's event listener system. - * Listeners are registered on the manager and events are dispatched through the - * manager. - * - * @author Bernhard Schussek - */ -interface EventDispatcherInterface extends ContractsEventDispatcherInterface -{ - /** - * Adds an event listener that listens on the specified events. - * - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) - * - * @return void - */ - public function addListener(string $eventName, callable $listener, int $priority = 0); - - /** - * Adds an event subscriber. - * - * The subscriber is asked for all the events it is - * interested in and added as a listener for these events. - * - * @return void - */ - public function addSubscriber(EventSubscriberInterface $subscriber); - - /** - * Removes an event listener from the specified events. - * - * @return void - */ - public function removeListener(string $eventName, callable $listener); - - /** - * @return void - */ - public function removeSubscriber(EventSubscriberInterface $subscriber); - - /** - * Gets the listeners of a specific event or all listeners sorted by descending priority. - * - * @return array - */ - public function getListeners(string $eventName = null): array; - - /** - * Gets the listener priority for a specific event. - * - * Returns null if the event or the listener does not exist. - */ - public function getListenerPriority(string $eventName, callable $listener): ?int; - - /** - * Checks whether an event has any registered listeners. - */ - public function hasListeners(string $eventName = null): bool; -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/EventSubscriberInterface.php b/tests/integration/vendor/symfony/event-dispatcher/EventSubscriberInterface.php deleted file mode 100644 index 2085e42..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/EventSubscriberInterface.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * An EventSubscriber knows itself what events it is interested in. - * If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes - * {@link getSubscribedEvents} and registers the subscriber as a listener for all - * returned events. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - */ -interface EventSubscriberInterface -{ - /** - * Returns an array of event names this subscriber wants to listen to. - * - * The array keys are event names and the value can be: - * - * * The method name to call (priority defaults to 0) - * * An array composed of the method name to call and the priority - * * An array of arrays composed of the method names to call and respective - * priorities, or 0 if unset - * - * For instance: - * - * * ['eventName' => 'methodName'] - * * ['eventName' => ['methodName', $priority]] - * * ['eventName' => [['methodName1', $priority], ['methodName2']]] - * - * The code must not depend on runtime state as it will only be called at compile time. - * All logic depending on runtime state must be put into the individual methods handling the events. - * - * @return array> - */ - public static function getSubscribedEvents(); -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/GenericEvent.php b/tests/integration/vendor/symfony/event-dispatcher/GenericEvent.php deleted file mode 100644 index 68a2030..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/GenericEvent.php +++ /dev/null @@ -1,158 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -use Symfony\Contracts\EventDispatcher\Event; - -/** - * Event encapsulation class. - * - * Encapsulates events thus decoupling the observer from the subject they encapsulate. - * - * @author Drak - * - * @implements \ArrayAccess - * @implements \IteratorAggregate - */ -class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate -{ - protected $subject; - protected $arguments; - - /** - * Encapsulate an event with $subject and $args. - * - * @param mixed $subject The subject of the event, usually an object or a callable - * @param array $arguments Arguments to store in the event - */ - public function __construct(mixed $subject = null, array $arguments = []) - { - $this->subject = $subject; - $this->arguments = $arguments; - } - - /** - * Getter for subject property. - */ - public function getSubject(): mixed - { - return $this->subject; - } - - /** - * Get argument by key. - * - * @throws \InvalidArgumentException if key is not found - */ - public function getArgument(string $key): mixed - { - if ($this->hasArgument($key)) { - return $this->arguments[$key]; - } - - throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key)); - } - - /** - * Add argument to event. - * - * @return $this - */ - public function setArgument(string $key, mixed $value): static - { - $this->arguments[$key] = $value; - - return $this; - } - - /** - * Getter for all arguments. - */ - public function getArguments(): array - { - return $this->arguments; - } - - /** - * Set args property. - * - * @return $this - */ - public function setArguments(array $args = []): static - { - $this->arguments = $args; - - return $this; - } - - /** - * Has argument. - */ - public function hasArgument(string $key): bool - { - return \array_key_exists($key, $this->arguments); - } - - /** - * ArrayAccess for argument getter. - * - * @param string $key Array key - * - * @throws \InvalidArgumentException if key does not exist in $this->args - */ - public function offsetGet(mixed $key): mixed - { - return $this->getArgument($key); - } - - /** - * ArrayAccess for argument setter. - * - * @param string $key Array key to set - */ - public function offsetSet(mixed $key, mixed $value): void - { - $this->setArgument($key, $value); - } - - /** - * ArrayAccess for unset argument. - * - * @param string $key Array key - */ - public function offsetUnset(mixed $key): void - { - if ($this->hasArgument($key)) { - unset($this->arguments[$key]); - } - } - - /** - * ArrayAccess has argument. - * - * @param string $key Array key - */ - public function offsetExists(mixed $key): bool - { - return $this->hasArgument($key); - } - - /** - * IteratorAggregate for iterating over the object like an array. - * - * @return \ArrayIterator - */ - public function getIterator(): \ArrayIterator - { - return new \ArrayIterator($this->arguments); - } -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php b/tests/integration/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php deleted file mode 100644 index d385d3f..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/ImmutableEventDispatcher.php +++ /dev/null @@ -1,79 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * A read-only proxy for an event dispatcher. - * - * @author Bernhard Schussek - */ -class ImmutableEventDispatcher implements EventDispatcherInterface -{ - private EventDispatcherInterface $dispatcher; - - public function __construct(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - public function dispatch(object $event, string $eventName = null): object - { - return $this->dispatcher->dispatch($event, $eventName); - } - - /** - * @return never - */ - public function addListener(string $eventName, callable|array $listener, int $priority = 0) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * @return never - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * @return never - */ - public function removeListener(string $eventName, callable|array $listener) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * @return never - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - public function getListeners(string $eventName = null): array - { - return $this->dispatcher->getListeners($eventName); - } - - public function getListenerPriority(string $eventName, callable|array $listener): ?int - { - return $this->dispatcher->getListenerPriority($eventName, $listener); - } - - public function hasListeners(string $eventName = null): bool - { - return $this->dispatcher->hasListeners($eventName); - } -} diff --git a/tests/integration/vendor/symfony/event-dispatcher/LICENSE b/tests/integration/vendor/symfony/event-dispatcher/LICENSE deleted file mode 100644 index 0138f8f..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-present Fabien Potencier - -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. diff --git a/tests/integration/vendor/symfony/event-dispatcher/README.md b/tests/integration/vendor/symfony/event-dispatcher/README.md deleted file mode 100644 index dcdb68d..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/README.md +++ /dev/null @@ -1,15 +0,0 @@ -EventDispatcher Component -========================= - -The EventDispatcher component provides tools that allow your application -components to communicate with each other by dispatching events and listening to -them. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/event_dispatcher.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/tests/integration/vendor/symfony/event-dispatcher/composer.json b/tests/integration/vendor/symfony/event-dispatcher/composer.json deleted file mode 100644 index 2870378..0000000 --- a/tests/integration/vendor/symfony/event-dispatcher/composer.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "symfony/event-dispatcher", - "type": "library", - "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1", - "symfony/event-dispatcher-contracts": "^2.5|^3" - }, - "require-dev": { - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/expression-language": "^5.4|^6.0", - "symfony/config": "^5.4|^6.0", - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-foundation": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^5.4|^6.0", - "psr/log": "^1|^2|^3" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/service-contracts": "<2.5" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0|3.0" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/tests/integration/vendor/symfony/filesystem/CHANGELOG.md b/tests/integration/vendor/symfony/filesystem/CHANGELOG.md deleted file mode 100644 index fcb7170..0000000 --- a/tests/integration/vendor/symfony/filesystem/CHANGELOG.md +++ /dev/null @@ -1,82 +0,0 @@ -CHANGELOG -========= - -5.4 ---- - - * Add `Path` class - * Add `$lock` argument to `Filesystem::appendToFile()` - -5.0.0 ------ - - * `Filesystem::dumpFile()` and `appendToFile()` don't accept arrays anymore - -4.4.0 ------ - - * support for passing a `null` value to `Filesystem::isAbsolutePath()` is deprecated and will be removed in 5.0 - * `tempnam()` now accepts a third argument `$suffix`. - -4.3.0 ------ - - * support for passing arrays to `Filesystem::dumpFile()` is deprecated and will be removed in 5.0 - * support for passing arrays to `Filesystem::appendToFile()` is deprecated and will be removed in 5.0 - -4.0.0 ------ - - * removed `LockHandler` - * Support for passing relative paths to `Filesystem::makePathRelative()` has been removed. - -3.4.0 ------ - - * support for passing relative paths to `Filesystem::makePathRelative()` is deprecated and will be removed in 4.0 - -3.3.0 ------ - - * added `appendToFile()` to append contents to existing files - -3.2.0 ------ - - * added `readlink()` as a platform independent method to read links - -3.0.0 ------ - - * removed `$mode` argument from `Filesystem::dumpFile()` - -2.8.0 ------ - - * added tempnam() a stream aware version of PHP's native tempnam() - -2.6.0 ------ - - * added LockHandler - -2.3.12 ------- - - * deprecated dumpFile() file mode argument. - -2.3.0 ------ - - * added the dumpFile() method to atomically write files - -2.2.0 ------ - - * added a delete option for the mirror() method - -2.1.0 ------ - - * 24eb396 : BC Break : mkdir() function now throws exception in case of failure instead of returning Boolean value - * created the component diff --git a/tests/integration/vendor/symfony/filesystem/Exception/ExceptionInterface.php b/tests/integration/vendor/symfony/filesystem/Exception/ExceptionInterface.php deleted file mode 100644 index fc438d9..0000000 --- a/tests/integration/vendor/symfony/filesystem/Exception/ExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem\Exception; - -/** - * Exception interface for all exceptions thrown by the component. - * - * @author Romain Neutron - */ -interface ExceptionInterface extends \Throwable -{ -} diff --git a/tests/integration/vendor/symfony/filesystem/Exception/FileNotFoundException.php b/tests/integration/vendor/symfony/filesystem/Exception/FileNotFoundException.php deleted file mode 100644 index 48b6408..0000000 --- a/tests/integration/vendor/symfony/filesystem/Exception/FileNotFoundException.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem\Exception; - -/** - * Exception class thrown when a file couldn't be found. - * - * @author Fabien Potencier - * @author Christian Gärtner - */ -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); - } -} diff --git a/tests/integration/vendor/symfony/filesystem/Exception/IOException.php b/tests/integration/vendor/symfony/filesystem/Exception/IOException.php deleted file mode 100644 index a3c5445..0000000 --- a/tests/integration/vendor/symfony/filesystem/Exception/IOException.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem\Exception; - -/** - * Exception class thrown when a filesystem operation failure happens. - * - * @author Romain Neutron - * @author Christian Gärtner - * @author Fabien Potencier - */ -class IOException extends \RuntimeException implements IOExceptionInterface -{ - private ?string $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(): ?string - { - return $this->path; - } -} diff --git a/tests/integration/vendor/symfony/filesystem/Exception/IOExceptionInterface.php b/tests/integration/vendor/symfony/filesystem/Exception/IOExceptionInterface.php deleted file mode 100644 index 90c71db..0000000 --- a/tests/integration/vendor/symfony/filesystem/Exception/IOExceptionInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem\Exception; - -/** - * IOException interface for file and input/output stream related exceptions thrown by the component. - * - * @author Christian Gärtner - */ -interface IOExceptionInterface extends ExceptionInterface -{ - /** - * Returns the associated path for the exception. - */ - public function getPath(): ?string; -} diff --git a/tests/integration/vendor/symfony/filesystem/Filesystem.php b/tests/integration/vendor/symfony/filesystem/Filesystem.php deleted file mode 100644 index a379ce1..0000000 --- a/tests/integration/vendor/symfony/filesystem/Filesystem.php +++ /dev/null @@ -1,767 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Filesystem; - -use Symfony\Component\Filesystem\Exception\FileNotFoundException; -use Symfony\Component\Filesystem\Exception\InvalidArgumentException; -use Symfony\Component\Filesystem\Exception\IOException; - -/** - * Provides basic utility to manipulate the file system. - * - * @author Fabien Potencier - */ -class Filesystem -{ - private static $lastError; - - /** - * Copies a file. - * - * If the target file is older than the origin file, it's always overwritten. - * If the target file is newer, it is overwritten only when the - * $overwriteNewerFiles option is set to true. - * - * @return void - * - * @throws FileNotFoundException When originFile doesn't exist - * @throws IOException When copy fails - */ - public function copy(string $originFile, string $targetFile, bool $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) { - // https://bugs.php.net/64634 - if (!$source = self::box('fopen', $originFile, 'r')) { - throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile); - } - - // Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default - if (!$target = self::box('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).self::$lastError, 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) { - // Like `cp`, preserve executable permission bits - self::box('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); - } - } - } - } - - /** - * Creates a directory recursively. - * - * @return void - * - * @throws IOException On any directory creation failure - */ - public function mkdir(string|iterable $dirs, int $mode = 0777) - { - foreach ($this->toIterable($dirs) as $dir) { - if (is_dir($dir)) { - continue; - } - - if (!self::box('mkdir', $dir, $mode, true) && !is_dir($dir)) { - throw new IOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir); - } - } - } - - /** - * Checks the existence of files or directories. - */ - public function exists(string|iterable $files): bool - { - $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; - } - - /** - * Sets access and modification time of file. - * - * @param int|null $time The touch time as a Unix timestamp, if not supplied the current system time is used - * @param int|null $atime The access time as a Unix timestamp, if not supplied the current system time is used - * - * @return void - * - * @throws IOException When touch fails - */ - public function touch(string|iterable $files, int $time = null, int $atime = null) - { - foreach ($this->toIterable($files) as $file) { - if (!($time ? self::box('touch', $file, $time, $atime) : self::box('touch', $file))) { - throw new IOException(sprintf('Failed to touch "%s": ', $file).self::$lastError, 0, null, $file); - } - } - } - - /** - * Removes files or directories. - * - * @return void - * - * @throws IOException When removal fails - */ - public function remove(string|iterable $files) - { - if ($files instanceof \Traversable) { - $files = iterator_to_array($files, false); - } elseif (!\is_array($files)) { - $files = [$files]; - } - - self::doRemove($files, false); - } - - private static function doRemove(array $files, bool $isRecursive): void - { - $files = array_reverse($files); - foreach ($files as $file) { - if (is_link($file)) { - // See https://bugs.php.net/52176 - 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)) { - if (!$isRecursive) { - $tmpName = \dirname(realpath($file)).'/.'.strrev(strtr(base64_encode(random_bytes(2)), '/=', '-_')); - - if (file_exists($tmpName)) { - try { - self::doRemove([$tmpName], true); - } catch (IOException) { - } - } - - if (!file_exists($tmpName) && self::box('rename', $file, $tmpName)) { - $origFile = $file; - $file = $tmpName; - } else { - $origFile = null; - } - } - - $filesystemIterator = new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS); - self::doRemove(iterator_to_array($filesystemIterator, true), true); - - if (!self::box('rmdir', $file) && file_exists($file) && !$isRecursive) { - $lastError = self::$lastError; - - if (null !== $origFile && self::box('rename', $file, $origFile)) { - $file = $origFile; - } - - throw new IOException(sprintf('Failed to remove directory "%s": ', $file).$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); - } - } - } - - /** - * Change mode for an array of files or directories. - * - * @param int $mode The new mode (octal) - * @param int $umask The mode mask (octal) - * @param bool $recursive Whether change the mod recursively or not - * - * @return void - * - * @throws IOException When the change fails - */ - public function chmod(string|iterable $files, int $mode, int $umask = 0000, bool $recursive = false) - { - foreach ($this->toIterable($files) as $file) { - if (!self::box('chmod', $file, $mode & ~$umask)) { - throw new IOException(sprintf('Failed to chmod file "%s": ', $file).self::$lastError, 0, null, $file); - } - if ($recursive && is_dir($file) && !is_link($file)) { - $this->chmod(new \FilesystemIterator($file), $mode, $umask, true); - } - } - } - - /** - * Change the owner of an array of files or directories. - * - * @param string|int $user A user name or number - * @param bool $recursive Whether change the owner recursively or not - * - * @return void - * - * @throws IOException When the change fails - */ - public function chown(string|iterable $files, string|int $user, bool $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 (!self::box('lchown', $file, $user)) { - throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file); - } - } else { - if (!self::box('chown', $file, $user)) { - throw new IOException(sprintf('Failed to chown file "%s": ', $file).self::$lastError, 0, null, $file); - } - } - } - } - - /** - * Change the group of an array of files or directories. - * - * @param string|int $group A group name or number - * @param bool $recursive Whether change the group recursively or not - * - * @return void - * - * @throws IOException When the change fails - */ - public function chgrp(string|iterable $files, string|int $group, bool $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 (!self::box('lchgrp', $file, $group)) { - throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file); - } - } else { - if (!self::box('chgrp', $file, $group)) { - throw new IOException(sprintf('Failed to chgrp file "%s": ', $file).self::$lastError, 0, null, $file); - } - } - } - } - - /** - * Renames a file or a directory. - * - * @return void - * - * @throws IOException When target file or directory already exists - * @throws IOException When origin cannot be renamed - */ - public function rename(string $origin, string $target, bool $overwrite = false) - { - // we check that target does not exist - if (!$overwrite && $this->isReadable($target)) { - throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); - } - - if (!self::box('rename', $origin, $target)) { - if (is_dir($origin)) { - // See https://bugs.php.net/54097 & https://php.net/rename#113943 - $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]); - $this->remove($origin); - - return; - } - throw new IOException(sprintf('Cannot rename "%s" to "%s": ', $origin, $target).self::$lastError, 0, null, $target); - } - } - - /** - * Tells whether a file exists and is readable. - * - * @throws IOException When windows path is longer than 258 characters - */ - 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); - } - - /** - * Creates a symbolic link or copy a directory. - * - * @return void - * - * @throws IOException When symlink fails - */ - public function symlink(string $originDir, string $targetDir, bool $copyOnWindows = false) - { - self::assertFunctionExists('symlink'); - - 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'); - } - } - - /** - * Creates a hard link, or several hard links to a file. - * - * @param string|string[] $targetFiles The target file(s) - * - * @return void - * - * @throws FileNotFoundException When original file is missing or not a file - * @throws IOException When link fails, including if link already exists - */ - public function hardlink(string $originFile, string|iterable $targetFiles) - { - self::assertFunctionExists('link'); - - 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'); - } - } - } - - /** - * @param string $linkType Name of the link type, typically 'symbolic' or 'hard' - */ - private function linkException(string $origin, string $target, string $linkType): never - { - 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).self::$lastError, 0, null, $target); - } - - /** - * Resolves links in paths. - * - * With $canonicalize = false (default) - * - if $path does not exist or is not a link, returns null - * - if $path is a link, returns the next direct target of the link without considering the existence of the target - * - * With $canonicalize = true - * - if $path does not exist, returns null - * - if $path exists, returns its absolute fully resolved final version - */ - public function readlink(string $path, bool $canonicalize = false): ?string - { - if (!$canonicalize && !is_link($path)) { - return null; - } - - if ($canonicalize) { - if (!$this->exists($path)) { - return null; - } - - return realpath($path); - } - - return readlink($path); - } - - /** - * Given an existing path, convert it to a path relative to a given starting path. - */ - public function makePathRelative(string $endPath, string $startPath): string - { - 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)); - } - - // Normalize separators on Windows - if ('\\' === \DIRECTORY_SEPARATOR) { - $endPath = str_replace('\\', '/', $endPath); - $startPath = str_replace('\\', '/', $startPath); - } - - $splitDriveLetter = fn ($path) => (\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) { - // End path is on another drive, so no relative path exists - return $endDriveLetter.':/'.($endPathArr ? implode('/', $endPathArr).'/' : ''); - } - - // Find for which directory the common path stops - $index = 0; - while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) { - ++$index; - } - - // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels) - if (1 === \count($startPathArr) && '' === $startPathArr[0]) { - $depth = 0; - } else { - $depth = \count($startPathArr) - $index; - } - - // Repeated "../" for each level need to reach the common path - $traverser = str_repeat('../', $depth); - - $endPathRemainder = implode('/', \array_slice($endPathArr, $index)); - - // Construct $endPath from traversing to the common path, then to the remaining $endPath - $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : ''); - - return '' === $relativePath ? './' : $relativePath; - } - - /** - * Mirrors a directory to another. - * - * Copies files and directories from the origin directory into the target directory. By default: - * - * - existing files in the target directory will be overwritten, except if they are newer (see the `override` option) - * - files in the target directory that do not exist in the source directory will not be deleted (see the `delete` option) - * - * @param \Traversable|null $iterator Iterator that filters which files and directories to copy, if null a recursive iterator is created - * @param array $options An array of boolean options - * Valid options are: - * - $options['override'] If true, target files newer than origin files are overwritten (see copy(), defaults to false) - * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink(), defaults to false) - * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) - * - * @return void - * - * @throws IOException When file type is unknown - */ - public function mirror(string $originDir, string $targetDir, \Traversable $iterator = null, array $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); - } - - // Iterate in destination folder to remove obsolete entries - 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); - } - } - } - - /** - * Returns whether the file path is an absolute path. - */ - public function isAbsolutePath(string $file): bool - { - return '' !== $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) - ); - } - - /** - * Creates a temporary file with support for custom stream wrappers. - * - * @param string $prefix The prefix of the generated temporary filename - * Note: Windows uses only the first three characters of prefix - * @param string $suffix The suffix of the generated temporary filename - * - * @return string The new temporary filename (with path), or throw an exception on failure - */ - public function tempnam(string $dir, string $prefix, string $suffix = ''): string - { - [$scheme, $hierarchy] = $this->getSchemeAndHierarchy($dir); - - // If no scheme or scheme is "file" or "gs" (Google Cloud) create temp file in local filesystem - if ((null === $scheme || 'file' === $scheme || 'gs' === $scheme) && '' === $suffix) { - // If tempnam failed or no scheme return the filename otherwise prepend the scheme - if ($tmpFile = self::box('tempnam', $hierarchy, $prefix)) { - if (null !== $scheme && 'gs' !== $scheme) { - return $scheme.'://'.$tmpFile; - } - - return $tmpFile; - } - - throw new IOException('A temporary file could not be created: '.self::$lastError); - } - - // Loop until we create a valid temp file or have reached 10 attempts - for ($i = 0; $i < 10; ++$i) { - // Create a unique filename - $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true).$suffix; - - // Use fopen instead of file_exists as some streams do not support stat - // Use mode 'x+' to atomically check existence and create to avoid a TOCTOU vulnerability - if (!$handle = self::box('fopen', $tmpFile, 'x+')) { - continue; - } - - // Close the file if it was successfully opened - self::box('fclose', $handle); - - return $tmpFile; - } - - throw new IOException('A temporary file could not be created: '.self::$lastError); - } - - /** - * Atomically dumps content into a file. - * - * @param string|resource $content The data to write into the file - * - * @return void - * - * @throws IOException if the file cannot be written to - */ - public function dumpFile(string $filename, $content) - { - if (\is_array($content)) { - throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__)); - } - - $dir = \dirname($filename); - - if (is_link($filename) && $linkTarget = $this->readlink($filename)) { - $this->dumpFile(Path::makeAbsolute($linkTarget, $dir), $content); - - return; - } - - if (!is_dir($dir)) { - $this->mkdir($dir); - } - - // Will create a temp file with 0600 access rights - // when the filesystem supports chmod. - $tmpFile = $this->tempnam($dir, basename($filename)); - - try { - if (false === self::box('file_put_contents', $tmpFile, $content)) { - throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename); - } - - self::box('chmod', $tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask()); - - $this->rename($tmpFile, $filename, true); - } finally { - if (file_exists($tmpFile)) { - self::box('unlink', $tmpFile); - } - } - } - - /** - * Appends content to an existing file. - * - * @param string|resource $content The content to append - * @param bool $lock Whether the file should be locked when writing to it - * - * @return void - * - * @throws IOException If the file is not writable - */ - public function appendToFile(string $filename, $content/* , bool $lock = false */) - { - if (\is_array($content)) { - throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be string or resource, array given.', __METHOD__)); - } - - $dir = \dirname($filename); - - if (!is_dir($dir)) { - $this->mkdir($dir); - } - - $lock = \func_num_args() > 2 && func_get_arg(2); - - if (false === self::box('file_put_contents', $filename, $content, \FILE_APPEND | ($lock ? \LOCK_EX : 0))) { - throw new IOException(sprintf('Failed to write file "%s": ', $filename).self::$lastError, 0, null, $filename); - } - } - - private function toIterable(string|iterable $files): iterable - { - return is_iterable($files) ? $files : [$files]; - } - - /** - * Gets a 2-tuple of scheme (may be null) and hierarchical part of a filename (e.g. file:///tmp -> [file, tmp]). - */ - private function getSchemeAndHierarchy(string $filename): array - { - $components = explode('://', $filename, 2); - - return 2 === \count($components) ? [$components[0], $components[1]] : [null, $components[0]]; - } - - private static function assertFunctionExists(string $func): void - { - if (!\function_exists($func)) { - throw new IOException(sprintf('Unable to perform filesystem operation because the "%s()" function has been disabled.', $func)); - } - } - - private static function box(string $func, mixed ...$args): mixed - { - self::assertFunctionExists($func); - - self::$lastError = null; - set_error_handler(__CLASS__.'::handleError'); - try { - return $func(...$args); - } finally { - restore_error_handler(); - } - } - - /** - * @internal - */ - public static function handleError(int $type, string $msg): void - { - self::$lastError = $msg; - } -} diff --git a/tests/integration/vendor/symfony/filesystem/LICENSE b/tests/integration/vendor/symfony/filesystem/LICENSE deleted file mode 100644 index 0138f8f..0000000 --- a/tests/integration/vendor/symfony/filesystem/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-present Fabien Potencier - -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. diff --git a/tests/integration/vendor/symfony/filesystem/README.md b/tests/integration/vendor/symfony/filesystem/README.md deleted file mode 100644 index f2f6d45..0000000 --- a/tests/integration/vendor/symfony/filesystem/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Filesystem Component -==================== - -The Filesystem component provides basic utilities for the filesystem. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/filesystem.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/tests/integration/vendor/symfony/filesystem/composer.json b/tests/integration/vendor/symfony/filesystem/composer.json deleted file mode 100644 index 10a7a53..0000000 --- a/tests/integration/vendor/symfony/filesystem/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "symfony/filesystem", - "type": "library", - "description": "Provides basic utilities for the filesystem", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Filesystem\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/tests/integration/vendor/symfony/polyfill-mbstring/LICENSE b/tests/integration/vendor/symfony/polyfill-mbstring/LICENSE deleted file mode 100644 index 4cd8bdd..0000000 --- a/tests/integration/vendor/symfony/polyfill-mbstring/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015-2019 Fabien Potencier - -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. diff --git a/tests/integration/vendor/symfony/polyfill-mbstring/Mbstring.php b/tests/integration/vendor/symfony/polyfill-mbstring/Mbstring.php deleted file mode 100644 index bce5c4a..0000000 --- a/tests/integration/vendor/symfony/polyfill-mbstring/Mbstring.php +++ /dev/null @@ -1,874 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Polyfill\Mbstring; - -/** - * Partial mbstring implementation in PHP, iconv based, UTF-8 centric. - * - * Implemented: - * - mb_chr - Returns a specific character from its Unicode code point - * - mb_convert_encoding - Convert character encoding - * - mb_convert_variables - Convert character code in variable(s) - * - mb_decode_mimeheader - Decode string in MIME header field - * - mb_encode_mimeheader - Encode string for MIME header XXX NATIVE IMPLEMENTATION IS REALLY BUGGED - * - mb_decode_numericentity - Decode HTML numeric string reference to character - * - mb_encode_numericentity - Encode character to HTML numeric string reference - * - mb_convert_case - Perform case folding on a string - * - mb_detect_encoding - Detect character encoding - * - mb_get_info - Get internal settings of mbstring - * - mb_http_input - Detect HTTP input character encoding - * - mb_http_output - Set/Get HTTP output character encoding - * - mb_internal_encoding - Set/Get internal character encoding - * - mb_list_encodings - Returns an array of all supported encodings - * - mb_ord - Returns the Unicode code point of a character - * - mb_output_handler - Callback function converts character encoding in output buffer - * - mb_scrub - Replaces ill-formed byte sequences with substitute characters - * - mb_strlen - Get string length - * - mb_strpos - Find position of first occurrence of string in a string - * - mb_strrpos - Find position of last occurrence of a string in a string - * - mb_str_split - Convert a string to an array - * - mb_strtolower - Make a string lowercase - * - mb_strtoupper - Make a string uppercase - * - mb_substitute_character - Set/Get substitution character - * - mb_substr - Get part of string - * - mb_stripos - Finds position of first occurrence of a string within another, case insensitive - * - mb_stristr - Finds first occurrence of a string within another, case insensitive - * - mb_strrchr - Finds the last occurrence of a character in a string within another - * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive - * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive - * - mb_strstr - Finds first occurrence of a string within another - * - mb_strwidth - Return width of string - * - mb_substr_count - Count the number of substring occurrences - * - * Not implemented: - * - mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) - * - mb_ereg_* - Regular expression with multibyte support - * - mb_parse_str - Parse GET/POST/COOKIE data and set global variable - * - mb_preferred_mime_name - Get MIME charset string - * - mb_regex_encoding - Returns current encoding for multibyte regex as string - * - mb_regex_set_options - Set/Get the default options for mbregex functions - * - mb_send_mail - Send encoded mail - * - mb_split - Split multibyte string using regular expression - * - mb_strcut - Get part of string - * - mb_strimwidth - Get truncated string with specified width - * - * @author Nicolas Grekas - * - * @internal - */ -final class Mbstring -{ - public const MB_CASE_FOLD = \PHP_INT_MAX; - - private const CASE_FOLD = [ - ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"], - ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], - ]; - - private static $encodingList = ['ASCII', 'UTF-8']; - private static $language = 'neutral'; - private static $internalEncoding = 'UTF-8'; - - public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) - { - if (\is_array($fromEncoding) || (null !== $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]+/', [__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, &...$vars) - { - $ok = true; - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { - if (false === $v = self::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) || (80000 > \PHP_VERSION_ID && !$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 ''; // Instead of null (cf. mb_encode_numericentity). - } - - $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) { - // collector_decode_htmlnumericentity ignores $convmap[$i + 3] - $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 self::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) || (80000 > \PHP_VERSION_ID && !$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; // Instead of '' (cf. mb_decode_numericentity). - } - - 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 = ["\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, [__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::CASE_FOLD[0], self::CASE_FOLD[1], $s); - } - - static $lower = null; - if (null === $lower) { - $lower = self::getData('lowerCase'); - } - $map = $lower; - } - - static $ulenMask = ["\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; - } - - $normalizedEncoding = self::getEncoding($encoding); - - if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) { - self::$internalEncoding = $normalizedEncoding; - - return true; - } - - if (80000 > \PHP_VERSION_ID) { - return false; - } - - throw new \ValueError(sprintf('Argument #1 ($encoding) must be a valid encoding, "%s" given', $encoding)); - } - - public static function mb_language($lang = null) - { - if (null === $lang) { - return self::$language; - } - - switch ($normalizedLang = strtolower($lang)) { - case 'uni': - case 'neutral': - self::$language = $normalizedLang; - - return true; - } - - if (80000 > \PHP_VERSION_ID) { - return false; - } - - throw new \ValueError(sprintf('Argument #1 ($language) must be a valid language, "%s" given', $lang)); - } - - public static function mb_list_encodings() - { - return ['UTF-8']; - } - - public static function mb_encoding_aliases($encoding) - { - switch (strtoupper($encoding)) { - case 'UTF8': - case 'UTF-8': - return ['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, [$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; - } - // no break - 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) { - if (80000 > \PHP_VERSION_ID) { - trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING); - - return false; - } - - return 0; - } - - 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 = '' !== $needle || 80000 > \PHP_VERSION_ID - ? iconv_strrpos($haystack, $needle, $encoding) - : self::mb_strlen($haystack, $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) { - if (80000 > \PHP_VERSION_ID) { - trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING); - - return false; - } - - throw new \ValueError('Argument #2 ($length) must be greater than 0'); - } - - 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, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); - } - - $result = []; - $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 (null === $c) { - return 'none'; - } - if (0 === strcasecmp($c, 'none')) { - return true; - } - if (80000 > \PHP_VERSION_ID) { - return false; - } - if (\is_int($c) || 'long' === $c || 'entity' === $c) { - return false; - } - - throw new \ValueError('Argument #1 ($substitute_character) must be "none", "long", "entity" or a valid codepoint'); - } - - 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) { - $pos = strrpos($haystack, $needle); - } else { - $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 = [ - '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; - } -} diff --git a/tests/integration/vendor/symfony/polyfill-mbstring/README.md b/tests/integration/vendor/symfony/polyfill-mbstring/README.md deleted file mode 100644 index 478b40d..0000000 --- a/tests/integration/vendor/symfony/polyfill-mbstring/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Symfony Polyfill / Mbstring -=========================== - -This component provides a partial, native PHP implementation for the -[Mbstring](https://php.net/mbstring) extension. - -More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). - -License -======= - -This library is released under the [MIT license](LICENSE). diff --git a/tests/integration/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/tests/integration/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php deleted file mode 100644 index fac60b0..0000000 --- a/tests/integration/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +++ /dev/null @@ -1,1397 +0,0 @@ - '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', - '𐐀' => '𐐨', - '𐐁' => '𐐩', - '𐐂' => '𐐪', - '𐐃' => '𐐫', - '𐐄' => '𐐬', - '𐐅' => '𐐭', - '𐐆' => '𐐮', - '𐐇' => '𐐯', - '𐐈' => '𐐰', - '𐐉' => '𐐱', - '𐐊' => '𐐲', - '𐐋' => '𐐳', - '𐐌' => '𐐴', - '𐐍' => '𐐵', - '𐐎' => '𐐶', - '𐐏' => '𐐷', - '𐐐' => '𐐸', - '𐐑' => '𐐹', - '𐐒' => '𐐺', - '𐐓' => '𐐻', - '𐐔' => '𐐼', - '𐐕' => '𐐽', - '𐐖' => '𐐾', - '𐐗' => '𐐿', - '𐐘' => '𐑀', - '𐐙' => '𐑁', - '𐐚' => '𐑂', - '𐐛' => '𐑃', - '𐐜' => '𐑄', - '𐐝' => '𐑅', - '𐐞' => '𐑆', - '𐐟' => '𐑇', - '𐐠' => '𐑈', - '𐐡' => '𐑉', - '𐐢' => '𐑊', - '𐐣' => '𐑋', - '𐐤' => '𐑌', - '𐐥' => '𐑍', - '𐐦' => '𐑎', - '𐐧' => '𐑏', - '𐒰' => '𐓘', - '𐒱' => '𐓙', - '𐒲' => '𐓚', - '𐒳' => '𐓛', - '𐒴' => '𐓜', - '𐒵' => '𐓝', - '𐒶' => '𐓞', - '𐒷' => '𐓟', - '𐒸' => '𐓠', - '𐒹' => '𐓡', - '𐒺' => '𐓢', - '𐒻' => '𐓣', - '𐒼' => '𐓤', - '𐒽' => '𐓥', - '𐒾' => '𐓦', - '𐒿' => '𐓧', - '𐓀' => '𐓨', - '𐓁' => '𐓩', - '𐓂' => '𐓪', - '𐓃' => '𐓫', - '𐓄' => '𐓬', - '𐓅' => '𐓭', - '𐓆' => '𐓮', - '𐓇' => '𐓯', - '𐓈' => '𐓰', - '𐓉' => '𐓱', - '𐓊' => '𐓲', - '𐓋' => '𐓳', - '𐓌' => '𐓴', - '𐓍' => '𐓵', - '𐓎' => '𐓶', - '𐓏' => '𐓷', - '𐓐' => '𐓸', - '𐓑' => '𐓹', - '𐓒' => '𐓺', - '𐓓' => '𐓻', - '𐲀' => '𐳀', - '𐲁' => '𐳁', - '𐲂' => '𐳂', - '𐲃' => '𐳃', - '𐲄' => '𐳄', - '𐲅' => '𐳅', - '𐲆' => '𐳆', - '𐲇' => '𐳇', - '𐲈' => '𐳈', - '𐲉' => '𐳉', - '𐲊' => '𐳊', - '𐲋' => '𐳋', - '𐲌' => '𐳌', - '𐲍' => '𐳍', - '𐲎' => '𐳎', - '𐲏' => '𐳏', - '𐲐' => '𐳐', - '𐲑' => '𐳑', - '𐲒' => '𐳒', - '𐲓' => '𐳓', - '𐲔' => '𐳔', - '𐲕' => '𐳕', - '𐲖' => '𐳖', - '𐲗' => '𐳗', - '𐲘' => '𐳘', - '𐲙' => '𐳙', - '𐲚' => '𐳚', - '𐲛' => '𐳛', - '𐲜' => '𐳜', - '𐲝' => '𐳝', - '𐲞' => '𐳞', - '𐲟' => '𐳟', - '𐲠' => '𐳠', - '𐲡' => '𐳡', - '𐲢' => '𐳢', - '𐲣' => '𐳣', - '𐲤' => '𐳤', - '𐲥' => '𐳥', - '𐲦' => '𐳦', - '𐲧' => '𐳧', - '𐲨' => '𐳨', - '𐲩' => '𐳩', - '𐲪' => '𐳪', - '𐲫' => '𐳫', - '𐲬' => '𐳬', - '𐲭' => '𐳭', - '𐲮' => '𐳮', - '𐲯' => '𐳯', - '𐲰' => '𐳰', - '𐲱' => '𐳱', - '𐲲' => '𐳲', - '𑢠' => '𑣀', - '𑢡' => '𑣁', - '𑢢' => '𑣂', - '𑢣' => '𑣃', - '𑢤' => '𑣄', - '𑢥' => '𑣅', - '𑢦' => '𑣆', - '𑢧' => '𑣇', - '𑢨' => '𑣈', - '𑢩' => '𑣉', - '𑢪' => '𑣊', - '𑢫' => '𑣋', - '𑢬' => '𑣌', - '𑢭' => '𑣍', - '𑢮' => '𑣎', - '𑢯' => '𑣏', - '𑢰' => '𑣐', - '𑢱' => '𑣑', - '𑢲' => '𑣒', - '𑢳' => '𑣓', - '𑢴' => '𑣔', - '𑢵' => '𑣕', - '𑢶' => '𑣖', - '𑢷' => '𑣗', - '𑢸' => '𑣘', - '𑢹' => '𑣙', - '𑢺' => '𑣚', - '𑢻' => '𑣛', - '𑢼' => '𑣜', - '𑢽' => '𑣝', - '𑢾' => '𑣞', - '𑢿' => '𑣟', - '𖹀' => '𖹠', - '𖹁' => '𖹡', - '𖹂' => '𖹢', - '𖹃' => '𖹣', - '𖹄' => '𖹤', - '𖹅' => '𖹥', - '𖹆' => '𖹦', - '𖹇' => '𖹧', - '𖹈' => '𖹨', - '𖹉' => '𖹩', - '𖹊' => '𖹪', - '𖹋' => '𖹫', - '𖹌' => '𖹬', - '𖹍' => '𖹭', - '𖹎' => '𖹮', - '𖹏' => '𖹯', - '𖹐' => '𖹰', - '𖹑' => '𖹱', - '𖹒' => '𖹲', - '𖹓' => '𖹳', - '𖹔' => '𖹴', - '𖹕' => '𖹵', - '𖹖' => '𖹶', - '𖹗' => '𖹷', - '𖹘' => '𖹸', - '𖹙' => '𖹹', - '𖹚' => '𖹺', - '𖹛' => '𖹻', - '𖹜' => '𖹼', - '𖹝' => '𖹽', - '𖹞' => '𖹾', - '𖹟' => '𖹿', - '𞤀' => '𞤢', - '𞤁' => '𞤣', - '𞤂' => '𞤤', - '𞤃' => '𞤥', - '𞤄' => '𞤦', - '𞤅' => '𞤧', - '𞤆' => '𞤨', - '𞤇' => '𞤩', - '𞤈' => '𞤪', - '𞤉' => '𞤫', - '𞤊' => '𞤬', - '𞤋' => '𞤭', - '𞤌' => '𞤮', - '𞤍' => '𞤯', - '𞤎' => '𞤰', - '𞤏' => '𞤱', - '𞤐' => '𞤲', - '𞤑' => '𞤳', - '𞤒' => '𞤴', - '𞤓' => '𞤵', - '𞤔' => '𞤶', - '𞤕' => '𞤷', - '𞤖' => '𞤸', - '𞤗' => '𞤹', - '𞤘' => '𞤺', - '𞤙' => '𞤻', - '𞤚' => '𞤼', - '𞤛' => '𞤽', - '𞤜' => '𞤾', - '𞤝' => '𞤿', - '𞤞' => '𞥀', - '𞤟' => '𞥁', - '𞤠' => '𞥂', - '𞤡' => '𞥃', -); diff --git a/tests/integration/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php b/tests/integration/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php deleted file mode 100644 index 56b9cb8..0000000 --- a/tests/integration/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +++ /dev/null @@ -1,1489 +0,0 @@ - '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', - '𐐨' => '𐐀', - '𐐩' => '𐐁', - '𐐪' => '𐐂', - '𐐫' => '𐐃', - '𐐬' => '𐐄', - '𐐭' => '𐐅', - '𐐮' => '𐐆', - '𐐯' => '𐐇', - '𐐰' => '𐐈', - '𐐱' => '𐐉', - '𐐲' => '𐐊', - '𐐳' => '𐐋', - '𐐴' => '𐐌', - '𐐵' => '𐐍', - '𐐶' => '𐐎', - '𐐷' => '𐐏', - '𐐸' => '𐐐', - '𐐹' => '𐐑', - '𐐺' => '𐐒', - '𐐻' => '𐐓', - '𐐼' => '𐐔', - '𐐽' => '𐐕', - '𐐾' => '𐐖', - '𐐿' => '𐐗', - '𐑀' => '𐐘', - '𐑁' => '𐐙', - '𐑂' => '𐐚', - '𐑃' => '𐐛', - '𐑄' => '𐐜', - '𐑅' => '𐐝', - '𐑆' => '𐐞', - '𐑇' => '𐐟', - '𐑈' => '𐐠', - '𐑉' => '𐐡', - '𐑊' => '𐐢', - '𐑋' => '𐐣', - '𐑌' => '𐐤', - '𐑍' => '𐐥', - '𐑎' => '𐐦', - '𐑏' => '𐐧', - '𐓘' => '𐒰', - '𐓙' => '𐒱', - '𐓚' => '𐒲', - '𐓛' => '𐒳', - '𐓜' => '𐒴', - '𐓝' => '𐒵', - '𐓞' => '𐒶', - '𐓟' => '𐒷', - '𐓠' => '𐒸', - '𐓡' => '𐒹', - '𐓢' => '𐒺', - '𐓣' => '𐒻', - '𐓤' => '𐒼', - '𐓥' => '𐒽', - '𐓦' => '𐒾', - '𐓧' => '𐒿', - '𐓨' => '𐓀', - '𐓩' => '𐓁', - '𐓪' => '𐓂', - '𐓫' => '𐓃', - '𐓬' => '𐓄', - '𐓭' => '𐓅', - '𐓮' => '𐓆', - '𐓯' => '𐓇', - '𐓰' => '𐓈', - '𐓱' => '𐓉', - '𐓲' => '𐓊', - '𐓳' => '𐓋', - '𐓴' => '𐓌', - '𐓵' => '𐓍', - '𐓶' => '𐓎', - '𐓷' => '𐓏', - '𐓸' => '𐓐', - '𐓹' => '𐓑', - '𐓺' => '𐓒', - '𐓻' => '𐓓', - '𐳀' => '𐲀', - '𐳁' => '𐲁', - '𐳂' => '𐲂', - '𐳃' => '𐲃', - '𐳄' => '𐲄', - '𐳅' => '𐲅', - '𐳆' => '𐲆', - '𐳇' => '𐲇', - '𐳈' => '𐲈', - '𐳉' => '𐲉', - '𐳊' => '𐲊', - '𐳋' => '𐲋', - '𐳌' => '𐲌', - '𐳍' => '𐲍', - '𐳎' => '𐲎', - '𐳏' => '𐲏', - '𐳐' => '𐲐', - '𐳑' => '𐲑', - '𐳒' => '𐲒', - '𐳓' => '𐲓', - '𐳔' => '𐲔', - '𐳕' => '𐲕', - '𐳖' => '𐲖', - '𐳗' => '𐲗', - '𐳘' => '𐲘', - '𐳙' => '𐲙', - '𐳚' => '𐲚', - '𐳛' => '𐲛', - '𐳜' => '𐲜', - '𐳝' => '𐲝', - '𐳞' => '𐲞', - '𐳟' => '𐲟', - '𐳠' => '𐲠', - '𐳡' => '𐲡', - '𐳢' => '𐲢', - '𐳣' => '𐲣', - '𐳤' => '𐲤', - '𐳥' => '𐲥', - '𐳦' => '𐲦', - '𐳧' => '𐲧', - '𐳨' => '𐲨', - '𐳩' => '𐲩', - '𐳪' => '𐲪', - '𐳫' => '𐲫', - '𐳬' => '𐲬', - '𐳭' => '𐲭', - '𐳮' => '𐲮', - '𐳯' => '𐲯', - '𐳰' => '𐲰', - '𐳱' => '𐲱', - '𐳲' => '𐲲', - '𑣀' => '𑢠', - '𑣁' => '𑢡', - '𑣂' => '𑢢', - '𑣃' => '𑢣', - '𑣄' => '𑢤', - '𑣅' => '𑢥', - '𑣆' => '𑢦', - '𑣇' => '𑢧', - '𑣈' => '𑢨', - '𑣉' => '𑢩', - '𑣊' => '𑢪', - '𑣋' => '𑢫', - '𑣌' => '𑢬', - '𑣍' => '𑢭', - '𑣎' => '𑢮', - '𑣏' => '𑢯', - '𑣐' => '𑢰', - '𑣑' => '𑢱', - '𑣒' => '𑢲', - '𑣓' => '𑢳', - '𑣔' => '𑢴', - '𑣕' => '𑢵', - '𑣖' => '𑢶', - '𑣗' => '𑢷', - '𑣘' => '𑢸', - '𑣙' => '𑢹', - '𑣚' => '𑢺', - '𑣛' => '𑢻', - '𑣜' => '𑢼', - '𑣝' => '𑢽', - '𑣞' => '𑢾', - '𑣟' => '𑢿', - '𖹠' => '𖹀', - '𖹡' => '𖹁', - '𖹢' => '𖹂', - '𖹣' => '𖹃', - '𖹤' => '𖹄', - '𖹥' => '𖹅', - '𖹦' => '𖹆', - '𖹧' => '𖹇', - '𖹨' => '𖹈', - '𖹩' => '𖹉', - '𖹪' => '𖹊', - '𖹫' => '𖹋', - '𖹬' => '𖹌', - '𖹭' => '𖹍', - '𖹮' => '𖹎', - '𖹯' => '𖹏', - '𖹰' => '𖹐', - '𖹱' => '𖹑', - '𖹲' => '𖹒', - '𖹳' => '𖹓', - '𖹴' => '𖹔', - '𖹵' => '𖹕', - '𖹶' => '𖹖', - '𖹷' => '𖹗', - '𖹸' => '𖹘', - '𖹹' => '𖹙', - '𖹺' => '𖹚', - '𖹻' => '𖹛', - '𖹼' => '𖹜', - '𖹽' => '𖹝', - '𖹾' => '𖹞', - '𖹿' => '𖹟', - '𞤢' => '𞤀', - '𞤣' => '𞤁', - '𞤤' => '𞤂', - '𞤥' => '𞤃', - '𞤦' => '𞤄', - '𞤧' => '𞤅', - '𞤨' => '𞤆', - '𞤩' => '𞤇', - '𞤪' => '𞤈', - '𞤫' => '𞤉', - '𞤬' => '𞤊', - '𞤭' => '𞤋', - '𞤮' => '𞤌', - '𞤯' => '𞤍', - '𞤰' => '𞤎', - '𞤱' => '𞤏', - '𞤲' => '𞤐', - '𞤳' => '𞤑', - '𞤴' => '𞤒', - '𞤵' => '𞤓', - '𞤶' => '𞤔', - '𞤷' => '𞤕', - '𞤸' => '𞤖', - '𞤹' => '𞤗', - '𞤺' => '𞤘', - '𞤻' => '𞤙', - '𞤼' => '𞤚', - '𞤽' => '𞤛', - '𞤾' => '𞤜', - '𞤿' => '𞤝', - '𞥀' => '𞤞', - '𞥁' => '𞤟', - '𞥂' => '𞤠', - '𞥃' => '𞤡', - 'ß' => 'SS', - 'ff' => 'FF', - 'fi' => 'FI', - 'fl' => 'FL', - 'ffi' => 'FFI', - 'ffl' => 'FFL', - 'ſt' => 'ST', - 'st' => 'ST', - 'և' => 'ԵՒ', - 'ﬓ' => 'ՄՆ', - 'ﬔ' => 'ՄԵ', - 'ﬕ' => 'ՄԻ', - 'ﬖ' => 'ՎՆ', - 'ﬗ' => 'ՄԽ', - 'ʼn' => 'ʼN', - 'ΐ' => 'Ϊ́', - 'ΰ' => 'Ϋ́', - 'ǰ' => 'J̌', - 'ẖ' => 'H̱', - 'ẗ' => 'T̈', - 'ẘ' => 'W̊', - 'ẙ' => 'Y̊', - 'ẚ' => 'Aʾ', - 'ὐ' => 'Υ̓', - 'ὒ' => 'Υ̓̀', - 'ὔ' => 'Υ̓́', - 'ὖ' => 'Υ̓͂', - 'ᾶ' => 'Α͂', - 'ῆ' => 'Η͂', - 'ῒ' => 'Ϊ̀', - 'ΐ' => 'Ϊ́', - 'ῖ' => 'Ι͂', - 'ῗ' => 'Ϊ͂', - 'ῢ' => 'Ϋ̀', - 'ΰ' => 'Ϋ́', - 'ῤ' => 'Ρ̓', - 'ῦ' => 'Υ͂', - 'ῧ' => 'Ϋ͂', - 'ῶ' => 'Ω͂', - 'ᾈ' => 'ἈΙ', - 'ᾉ' => 'ἉΙ', - 'ᾊ' => 'ἊΙ', - 'ᾋ' => 'ἋΙ', - 'ᾌ' => 'ἌΙ', - 'ᾍ' => 'ἍΙ', - 'ᾎ' => 'ἎΙ', - 'ᾏ' => 'ἏΙ', - 'ᾘ' => 'ἨΙ', - 'ᾙ' => 'ἩΙ', - 'ᾚ' => 'ἪΙ', - 'ᾛ' => 'ἫΙ', - 'ᾜ' => 'ἬΙ', - 'ᾝ' => 'ἭΙ', - 'ᾞ' => 'ἮΙ', - 'ᾟ' => 'ἯΙ', - 'ᾨ' => 'ὨΙ', - 'ᾩ' => 'ὩΙ', - 'ᾪ' => 'ὪΙ', - 'ᾫ' => 'ὫΙ', - 'ᾬ' => 'ὬΙ', - 'ᾭ' => 'ὭΙ', - 'ᾮ' => 'ὮΙ', - 'ᾯ' => 'ὯΙ', - 'ᾼ' => 'ΑΙ', - 'ῌ' => 'ΗΙ', - 'ῼ' => 'ΩΙ', - 'ᾲ' => 'ᾺΙ', - 'ᾴ' => 'ΆΙ', - 'ῂ' => 'ῊΙ', - 'ῄ' => 'ΉΙ', - 'ῲ' => 'ῺΙ', - 'ῴ' => 'ΏΙ', - 'ᾷ' => 'Α͂Ι', - 'ῇ' => 'Η͂Ι', - 'ῷ' => 'Ω͂Ι', -); diff --git a/tests/integration/vendor/symfony/polyfill-mbstring/bootstrap.php b/tests/integration/vendor/symfony/polyfill-mbstring/bootstrap.php deleted file mode 100644 index 1fedd1f..0000000 --- a/tests/integration/vendor/symfony/polyfill-mbstring/bootstrap.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -use Symfony\Polyfill\Mbstring as p; - -if (\PHP_VERSION_ID >= 80000) { - return require __DIR__.'/bootstrap80.php'; -} - -if (!function_exists('mb_convert_encoding')) { - function mb_convert_encoding($string, $to_encoding, $from_encoding = null) { return p\Mbstring::mb_convert_encoding($string, $to_encoding, $from_encoding); } -} -if (!function_exists('mb_decode_mimeheader')) { - function mb_decode_mimeheader($string) { return p\Mbstring::mb_decode_mimeheader($string); } -} -if (!function_exists('mb_encode_mimeheader')) { - function mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { return p\Mbstring::mb_encode_mimeheader($string, $charset, $transfer_encoding, $newline, $indent); } -} -if (!function_exists('mb_decode_numericentity')) { - function mb_decode_numericentity($string, $map, $encoding = null) { return p\Mbstring::mb_decode_numericentity($string, $map, $encoding); } -} -if (!function_exists('mb_encode_numericentity')) { - function mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { return p\Mbstring::mb_encode_numericentity($string, $map, $encoding, $hex); } -} -if (!function_exists('mb_convert_case')) { - function mb_convert_case($string, $mode, $encoding = null) { return p\Mbstring::mb_convert_case($string, $mode, $encoding); } -} -if (!function_exists('mb_internal_encoding')) { - function mb_internal_encoding($encoding = null) { return p\Mbstring::mb_internal_encoding($encoding); } -} -if (!function_exists('mb_language')) { - function mb_language($language = null) { return p\Mbstring::mb_language($language); } -} -if (!function_exists('mb_list_encodings')) { - function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } -} -if (!function_exists('mb_encoding_aliases')) { - function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } -} -if (!function_exists('mb_check_encoding')) { - function mb_check_encoding($value = null, $encoding = null) { return p\Mbstring::mb_check_encoding($value, $encoding); } -} -if (!function_exists('mb_detect_encoding')) { - function mb_detect_encoding($string, $encodings = null, $strict = false) { return p\Mbstring::mb_detect_encoding($string, $encodings, $strict); } -} -if (!function_exists('mb_detect_order')) { - function mb_detect_order($encoding = null) { return p\Mbstring::mb_detect_order($encoding); } -} -if (!function_exists('mb_parse_str')) { - function mb_parse_str($string, &$result = []) { parse_str($string, $result); return (bool) $result; } -} -if (!function_exists('mb_strlen')) { - function mb_strlen($string, $encoding = null) { return p\Mbstring::mb_strlen($string, $encoding); } -} -if (!function_exists('mb_strpos')) { - function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strpos($haystack, $needle, $offset, $encoding); } -} -if (!function_exists('mb_strtolower')) { - function mb_strtolower($string, $encoding = null) { return p\Mbstring::mb_strtolower($string, $encoding); } -} -if (!function_exists('mb_strtoupper')) { - function mb_strtoupper($string, $encoding = null) { return p\Mbstring::mb_strtoupper($string, $encoding); } -} -if (!function_exists('mb_substitute_character')) { - function mb_substitute_character($substitute_character = null) { return p\Mbstring::mb_substitute_character($substitute_character); } -} -if (!function_exists('mb_substr')) { - function mb_substr($string, $start, $length = 2147483647, $encoding = null) { return p\Mbstring::mb_substr($string, $start, $length, $encoding); } -} -if (!function_exists('mb_stripos')) { - function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_stripos($haystack, $needle, $offset, $encoding); } -} -if (!function_exists('mb_stristr')) { - function mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_stristr($haystack, $needle, $before_needle, $encoding); } -} -if (!function_exists('mb_strrchr')) { - function mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrchr($haystack, $needle, $before_needle, $encoding); } -} -if (!function_exists('mb_strrichr')) { - function mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strrichr($haystack, $needle, $before_needle, $encoding); } -} -if (!function_exists('mb_strripos')) { - function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strripos($haystack, $needle, $offset, $encoding); } -} -if (!function_exists('mb_strrpos')) { - function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Mbstring::mb_strrpos($haystack, $needle, $offset, $encoding); } -} -if (!function_exists('mb_strstr')) { - function mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { return p\Mbstring::mb_strstr($haystack, $needle, $before_needle, $encoding); } -} -if (!function_exists('mb_get_info')) { - function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } -} -if (!function_exists('mb_http_output')) { - function mb_http_output($encoding = null) { return p\Mbstring::mb_http_output($encoding); } -} -if (!function_exists('mb_strwidth')) { - function mb_strwidth($string, $encoding = null) { return p\Mbstring::mb_strwidth($string, $encoding); } -} -if (!function_exists('mb_substr_count')) { - function mb_substr_count($haystack, $needle, $encoding = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $encoding); } -} -if (!function_exists('mb_output_handler')) { - function mb_output_handler($string, $status) { return p\Mbstring::mb_output_handler($string, $status); } -} -if (!function_exists('mb_http_input')) { - function mb_http_input($type = null) { return p\Mbstring::mb_http_input($type); } -} - -if (!function_exists('mb_convert_variables')) { - function mb_convert_variables($to_encoding, $from_encoding, &...$vars) { return p\Mbstring::mb_convert_variables($to_encoding, $from_encoding, ...$vars); } -} - -if (!function_exists('mb_ord')) { - function mb_ord($string, $encoding = null) { return p\Mbstring::mb_ord($string, $encoding); } -} -if (!function_exists('mb_chr')) { - function mb_chr($codepoint, $encoding = null) { return p\Mbstring::mb_chr($codepoint, $encoding); } -} -if (!function_exists('mb_scrub')) { - function mb_scrub($string, $encoding = null) { $encoding = null === $encoding ? mb_internal_encoding() : $encoding; return mb_convert_encoding($string, $encoding, $encoding); } -} -if (!function_exists('mb_str_split')) { - function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); } -} - -if (extension_loaded('mbstring')) { - return; -} - -if (!defined('MB_CASE_UPPER')) { - define('MB_CASE_UPPER', 0); -} -if (!defined('MB_CASE_LOWER')) { - define('MB_CASE_LOWER', 1); -} -if (!defined('MB_CASE_TITLE')) { - define('MB_CASE_TITLE', 2); -} diff --git a/tests/integration/vendor/symfony/polyfill-mbstring/composer.json b/tests/integration/vendor/symfony/polyfill-mbstring/composer.json deleted file mode 100644 index 4489553..0000000 --- a/tests/integration/vendor/symfony/polyfill-mbstring/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "symfony/polyfill-mbstring", - "type": "library", - "description": "Symfony polyfill for the Mbstring extension", - "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "autoload": { - "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, - "files": [ "bootstrap.php" ] - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "minimum-stability": "dev", - "extra": { - "branch-alias": { - "dev-main": "1.27-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - } -} diff --git a/tests/integration/vendor/symfony/translation/CHANGELOG.md b/tests/integration/vendor/symfony/translation/CHANGELOG.md deleted file mode 100644 index 07ba0d0..0000000 --- a/tests/integration/vendor/symfony/translation/CHANGELOG.md +++ /dev/null @@ -1,196 +0,0 @@ -CHANGELOG -========= - -6.2.7 ------ - - * [BC BREAK] The following data providers for `ProviderFactoryTestCase` are now static: - `supportsProvider()`, `createProvider()`, `unsupportedSchemeProvider()`and `incompleteDsnProvider()` - * [BC BREAK] `ProviderTestCase::toStringProvider()` is now static - -6.2 ---- - - * Deprecate `PhpStringTokenParser` - * Deprecate `PhpExtractor` in favor of `PhpAstExtractor` - * Add `PhpAstExtractor` (requires [nikic/php-parser](https://github.com/nikic/php-parser) to be installed) - -6.1 ---- - - * Parameters implementing `TranslatableInterface` are processed - * Add the file extension to the `XliffFileDumper` constructor - -5.4 ---- - - * Add `github` format & autodetection to render errors as annotations when - running the XLIFF linter command in a Github Actions environment. - * Translation providers are not experimental anymore - -5.3 ---- - - * Add `translation:pull` and `translation:push` commands to manage translations with third-party providers - * Add `TranslatorBagInterface::getCatalogues` method - * Add support to load XLIFF string in `XliffFileLoader` - -5.2.0 ------ - - * added support for calling `trans` with ICU formatted messages - * added `PseudoLocalizationTranslator` - * added `TranslatableMessage` objects that represent a message that can be translated - * added the `t()` function to easily create `TranslatableMessage` objects - * Added support for extracting messages from `TranslatableMessage` objects - -5.1.0 ------ - - * added support for `name` attribute on `unit` element from xliff2 to be used as a translation key instead of always the `source` element - -5.0.0 ------ - - * removed support for using `null` as the locale in `Translator` - * removed `TranslatorInterface` - * removed `MessageSelector` - * removed `ChoiceMessageFormatterInterface` - * removed `PluralizationRule` - * removed `Interval` - * removed `transChoice()` methods, use the trans() method instead with a %count% parameter - * removed `FileDumper::setBackup()` and `TranslationWriter::disableBackup()` - * removed `MessageFormatter::choiceFormat()` - * added argument `$filename` to `PhpExtractor::parseTokens()` - * removed support for implicit STDIN usage in the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit. - -4.4.0 ------ - - * deprecated support for using `null` as the locale in `Translator` - * deprecated accepting STDIN implicitly when using the `lint:xliff` command, use `lint:xliff -` (append a dash) instead to make it explicit. - * Marked the `TranslationDataCollector` class as `@final`. - -4.3.0 ------ - - * Improved Xliff 1.2 loader to load the original file's metadata - * Added `TranslatorPathsPass` - -4.2.0 ------ - - * Started using ICU parent locales as fallback locales. - * allow using the ICU message format using domains with the "+intl-icu" suffix - * deprecated `Translator::transChoice()` in favor of using `Translator::trans()` with a `%count%` parameter - * deprecated `TranslatorInterface` in favor of `Symfony\Contracts\Translation\TranslatorInterface` - * deprecated `MessageSelector`, `Interval` and `PluralizationRules`; use `IdentityTranslator` instead - * Added `IntlFormatter` and `IntlFormatterInterface` - * added support for multiple files and directories in `XliffLintCommand` - * Marked `Translator::getFallbackLocales()` and `TranslationDataCollector::getFallbackLocales()` as internal - -4.1.0 ------ - - * The `FileDumper::setBackup()` method is deprecated. - * The `TranslationWriter::disableBackup()` method is deprecated. - * The `XliffFileDumper` will write "name" on the "unit" node when dumping XLIFF 2.0. - -4.0.0 ------ - - * removed the backup feature of the `FileDumper` class - * removed `TranslationWriter::writeTranslations()` method - * removed support for passing `MessageSelector` instances to the constructor of the `Translator` class - -3.4.0 ------ - - * Added `TranslationDumperPass` - * Added `TranslationExtractorPass` - * Added `TranslatorPass` - * Added `TranslationReader` and `TranslationReaderInterface` - * Added `` section to the Xliff 2.0 dumper. - * Improved Xliff 2.0 loader to load `` section. - * Added `TranslationWriterInterface` - * Deprecated `TranslationWriter::writeTranslations` in favor of `TranslationWriter::write` - * added support for adding custom message formatter and decoupling the default one. - * Added `PhpExtractor` - * Added `PhpStringTokenParser` - -3.2.0 ------ - - * Added support for escaping `|` in plural translations with double pipe. - -3.1.0 ------ - - * Deprecated the backup feature of the file dumper classes. - -3.0.0 ------ - - * removed `FileDumper::format()` method. - * Changed the visibility of the locale property in `Translator` from protected to private. - -2.8.0 ------ - - * deprecated FileDumper::format(), overwrite FileDumper::formatCatalogue() instead. - * deprecated Translator::getMessages(), rely on TranslatorBagInterface::getCatalogue() instead. - * added `FileDumper::formatCatalogue` which allows format the catalogue without dumping it into file. - * added option `json_encoding` to JsonFileDumper - * added options `as_tree`, `inline` to YamlFileDumper - * added support for XLIFF 2.0. - * added support for XLIFF target and tool attributes. - * added message parameters to DataCollectorTranslator. - * [DEPRECATION] The `DiffOperation` class has been deprecated and - will be removed in Symfony 3.0, since its operation has nothing to do with 'diff', - so the class name is misleading. The `TargetOperation` class should be used for - this use-case instead. - -2.7.0 ------ - - * added DataCollectorTranslator for collecting the translated messages. - -2.6.0 ------ - - * added possibility to cache catalogues - * added TranslatorBagInterface - * added LoggingTranslator - * added Translator::getMessages() for retrieving the message catalogue as an array - -2.5.0 ------ - - * added relative file path template to the file dumpers - * added optional backup to the file dumpers - * changed IcuResFileDumper to extend FileDumper - -2.3.0 ------ - - * added classes to make operations on catalogues (like making a diff or a merge on 2 catalogues) - * added Translator::getFallbackLocales() - * deprecated Translator::setFallbackLocale() in favor of the new Translator::setFallbackLocales() method - -2.2.0 ------ - - * QtTranslationsLoader class renamed to QtFileLoader. QtTranslationsLoader is deprecated and will be removed in 2.3. - * [BC BREAK] uniformized the exception thrown by the load() method when an error occurs. The load() method now - throws Symfony\Component\Translation\Exception\NotFoundResourceException when a resource cannot be found - and Symfony\Component\Translation\Exception\InvalidResourceException when a resource is invalid. - * changed the exception class thrown by some load() methods from \RuntimeException to \InvalidArgumentException - (IcuDatFileLoader, IcuResFileLoader and QtFileLoader) - -2.1.0 ------ - - * added support for more than one fallback locale - * added support for extracting translation messages from templates (Twig and PHP) - * added dumpers for translation catalogs - * added support for QT, gettext, and ResourceBundles diff --git a/tests/integration/vendor/symfony/translation/Catalogue/AbstractOperation.php b/tests/integration/vendor/symfony/translation/Catalogue/AbstractOperation.php deleted file mode 100644 index 65eea0b..0000000 --- a/tests/integration/vendor/symfony/translation/Catalogue/AbstractOperation.php +++ /dev/null @@ -1,190 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Catalogue; - -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\Exception\LogicException; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\MessageCatalogueInterface; - -/** - * Base catalogues binary operation class. - * - * A catalogue binary operation performs operation on - * source (the left argument) and target (the right argument) catalogues. - * - * @author Jean-François Simon - */ -abstract class AbstractOperation implements OperationInterface -{ - public const OBSOLETE_BATCH = 'obsolete'; - public const NEW_BATCH = 'new'; - public const ALL_BATCH = 'all'; - - protected $source; - protected $target; - protected $result; - - /** - * @var array|null The domains affected by this operation - */ - private $domains; - - /** - * This array stores 'all', 'new' and 'obsolete' messages for all valid domains. - * - * The data structure of this array is as follows: - * - * [ - * 'domain 1' => [ - * 'all' => [...], - * 'new' => [...], - * 'obsolete' => [...] - * ], - * 'domain 2' => [ - * 'all' => [...], - * 'new' => [...], - * 'obsolete' => [...] - * ], - * ... - * ] - * - * @var array The array that stores 'all', 'new' and 'obsolete' messages - */ - protected $messages; - - /** - * @throws LogicException - */ - public function __construct(MessageCatalogueInterface $source, MessageCatalogueInterface $target) - { - if ($source->getLocale() !== $target->getLocale()) { - throw new LogicException('Operated catalogues must belong to the same locale.'); - } - - $this->source = $source; - $this->target = $target; - $this->result = new MessageCatalogue($source->getLocale()); - $this->messages = []; - } - - public function getDomains(): array - { - if (null === $this->domains) { - $domains = []; - foreach ([$this->source, $this->target] as $catalogue) { - foreach ($catalogue->getDomains() as $domain) { - $domains[$domain] = $domain; - - if ($catalogue->all($domainIcu = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX)) { - $domains[$domainIcu] = $domainIcu; - } - } - } - - $this->domains = array_values($domains); - } - - return $this->domains; - } - - public function getMessages(string $domain): array - { - if (!\in_array($domain, $this->getDomains())) { - throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain)); - } - - if (!isset($this->messages[$domain][self::ALL_BATCH])) { - $this->processDomain($domain); - } - - return $this->messages[$domain][self::ALL_BATCH]; - } - - public function getNewMessages(string $domain): array - { - if (!\in_array($domain, $this->getDomains())) { - throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain)); - } - - if (!isset($this->messages[$domain][self::NEW_BATCH])) { - $this->processDomain($domain); - } - - return $this->messages[$domain][self::NEW_BATCH]; - } - - public function getObsoleteMessages(string $domain): array - { - if (!\in_array($domain, $this->getDomains())) { - throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain)); - } - - if (!isset($this->messages[$domain][self::OBSOLETE_BATCH])) { - $this->processDomain($domain); - } - - return $this->messages[$domain][self::OBSOLETE_BATCH]; - } - - public function getResult(): MessageCatalogueInterface - { - foreach ($this->getDomains() as $domain) { - if (!isset($this->messages[$domain])) { - $this->processDomain($domain); - } - } - - return $this->result; - } - - /** - * @param self::*_BATCH $batch - */ - public function moveMessagesToIntlDomainsIfPossible(string $batch = self::ALL_BATCH): void - { - // If MessageFormatter class does not exists, intl domains are not supported. - if (!class_exists(\MessageFormatter::class)) { - return; - } - - foreach ($this->getDomains() as $domain) { - $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; - $messages = match ($batch) { - self::OBSOLETE_BATCH => $this->getObsoleteMessages($domain), - self::NEW_BATCH => $this->getNewMessages($domain), - self::ALL_BATCH => $this->getMessages($domain), - default => throw new \InvalidArgumentException(sprintf('$batch argument must be one of ["%s", "%s", "%s"].', self::ALL_BATCH, self::NEW_BATCH, self::OBSOLETE_BATCH)), - }; - - if (!$messages || (!$this->source->all($intlDomain) && $this->source->all($domain))) { - continue; - } - - $result = $this->getResult(); - $allIntlMessages = $result->all($intlDomain); - $currentMessages = array_diff_key($messages, $result->all($domain)); - $result->replace($currentMessages, $domain); - $result->replace($allIntlMessages + $messages, $intlDomain); - } - } - - /** - * Performs operation on source and target catalogues for the given domain and - * stores the results. - * - * @param string $domain The domain which the operation will be performed for - * - * @return void - */ - abstract protected function processDomain(string $domain); -} diff --git a/tests/integration/vendor/symfony/translation/Catalogue/MergeOperation.php b/tests/integration/vendor/symfony/translation/Catalogue/MergeOperation.php deleted file mode 100644 index 1b777a8..0000000 --- a/tests/integration/vendor/symfony/translation/Catalogue/MergeOperation.php +++ /dev/null @@ -1,72 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Catalogue; - -use Symfony\Component\Translation\MessageCatalogueInterface; - -/** - * Merge operation between two catalogues as follows: - * all = source ∪ target = {x: x ∈ source ∨ x ∈ target} - * new = all ∖ source = {x: x ∈ target ∧ x ∉ source} - * obsolete = source ∖ all = {x: x ∈ source ∧ x ∉ source ∧ x ∉ target} = ∅ - * Basically, the result contains messages from both catalogues. - * - * @author Jean-François Simon - */ -class MergeOperation extends AbstractOperation -{ - /** - * @return void - */ - protected function processDomain(string $domain) - { - $this->messages[$domain] = [ - 'all' => [], - 'new' => [], - 'obsolete' => [], - ]; - $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; - - foreach ($this->target->getCatalogueMetadata('', $domain) ?? [] as $key => $value) { - if (null === $this->result->getCatalogueMetadata($key, $domain)) { - $this->result->setCatalogueMetadata($key, $value, $domain); - } - } - - foreach ($this->target->getCatalogueMetadata('', $intlDomain) ?? [] as $key => $value) { - if (null === $this->result->getCatalogueMetadata($key, $intlDomain)) { - $this->result->setCatalogueMetadata($key, $value, $intlDomain); - } - } - - foreach ($this->source->all($domain) as $id => $message) { - $this->messages[$domain]['all'][$id] = $message; - $d = $this->source->defines($id, $intlDomain) ? $intlDomain : $domain; - $this->result->add([$id => $message], $d); - if (null !== $keyMetadata = $this->source->getMetadata($id, $d)) { - $this->result->setMetadata($id, $keyMetadata, $d); - } - } - - foreach ($this->target->all($domain) as $id => $message) { - if (!$this->source->has($id, $domain)) { - $this->messages[$domain]['all'][$id] = $message; - $this->messages[$domain]['new'][$id] = $message; - $d = $this->target->defines($id, $intlDomain) ? $intlDomain : $domain; - $this->result->add([$id => $message], $d); - if (null !== $keyMetadata = $this->target->getMetadata($id, $d)) { - $this->result->setMetadata($id, $keyMetadata, $d); - } - } - } - } -} diff --git a/tests/integration/vendor/symfony/translation/Catalogue/OperationInterface.php b/tests/integration/vendor/symfony/translation/Catalogue/OperationInterface.php deleted file mode 100644 index 1fe9534..0000000 --- a/tests/integration/vendor/symfony/translation/Catalogue/OperationInterface.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Catalogue; - -use Symfony\Component\Translation\MessageCatalogueInterface; - -/** - * Represents an operation on catalogue(s). - * - * An instance of this interface performs an operation on one or more catalogues and - * stores intermediate and final results of the operation. - * - * The first catalogue in its argument(s) is called the 'source catalogue' or 'source' and - * the following results are stored: - * - * Messages: also called 'all', are valid messages for the given domain after the operation is performed. - * - * New Messages: also called 'new' (new = all ∖ source = {x: x ∈ all ∧ x ∉ source}). - * - * Obsolete Messages: also called 'obsolete' (obsolete = source ∖ all = {x: x ∈ source ∧ x ∉ all}). - * - * Result: also called 'result', is the resulting catalogue for the given domain that holds the same messages as 'all'. - * - * @author Jean-François Simon - */ -interface OperationInterface -{ - /** - * Returns domains affected by operation. - */ - public function getDomains(): array; - - /** - * Returns all valid messages ('all') after operation. - */ - public function getMessages(string $domain): array; - - /** - * Returns new messages ('new') after operation. - */ - public function getNewMessages(string $domain): array; - - /** - * Returns obsolete messages ('obsolete') after operation. - */ - public function getObsoleteMessages(string $domain): array; - - /** - * Returns resulting catalogue ('result'). - */ - public function getResult(): MessageCatalogueInterface; -} diff --git a/tests/integration/vendor/symfony/translation/Catalogue/TargetOperation.php b/tests/integration/vendor/symfony/translation/Catalogue/TargetOperation.php deleted file mode 100644 index 2c0ec72..0000000 --- a/tests/integration/vendor/symfony/translation/Catalogue/TargetOperation.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Catalogue; - -use Symfony\Component\Translation\MessageCatalogueInterface; - -/** - * Target operation between two catalogues: - * intersection = source ∩ target = {x: x ∈ source ∧ x ∈ target} - * all = intersection ∪ (target ∖ intersection) = target - * new = all ∖ source = {x: x ∈ target ∧ x ∉ source} - * obsolete = source ∖ all = source ∖ target = {x: x ∈ source ∧ x ∉ target} - * Basically, the result contains messages from the target catalogue. - * - * @author Michael Lee - */ -class TargetOperation extends AbstractOperation -{ - /** - * @return void - */ - protected function processDomain(string $domain) - { - $this->messages[$domain] = [ - 'all' => [], - 'new' => [], - 'obsolete' => [], - ]; - $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; - - foreach ($this->target->getCatalogueMetadata('', $domain) ?? [] as $key => $value) { - if (null === $this->result->getCatalogueMetadata($key, $domain)) { - $this->result->setCatalogueMetadata($key, $value, $domain); - } - } - - foreach ($this->target->getCatalogueMetadata('', $intlDomain) ?? [] as $key => $value) { - if (null === $this->result->getCatalogueMetadata($key, $intlDomain)) { - $this->result->setCatalogueMetadata($key, $value, $intlDomain); - } - } - - // For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``, - // because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} - // - // For 'new' messages, the code can't be simplified as ``array_diff_assoc($this->target->all($domain), $this->source->all($domain));`` - // because doing so will not exclude messages like {x: x ∈ target ∧ x ∉ source.all ∧ x ∈ source.fallback} - // - // For 'obsolete' messages, the code can't be simplified as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))`` - // because doing so will not exclude messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} - - foreach ($this->source->all($domain) as $id => $message) { - if ($this->target->has($id, $domain)) { - $this->messages[$domain]['all'][$id] = $message; - $d = $this->source->defines($id, $intlDomain) ? $intlDomain : $domain; - $this->result->add([$id => $message], $d); - if (null !== $keyMetadata = $this->source->getMetadata($id, $d)) { - $this->result->setMetadata($id, $keyMetadata, $d); - } - } else { - $this->messages[$domain]['obsolete'][$id] = $message; - } - } - - foreach ($this->target->all($domain) as $id => $message) { - if (!$this->source->has($id, $domain)) { - $this->messages[$domain]['all'][$id] = $message; - $this->messages[$domain]['new'][$id] = $message; - $d = $this->target->defines($id, $intlDomain) ? $intlDomain : $domain; - $this->result->add([$id => $message], $d); - if (null !== $keyMetadata = $this->target->getMetadata($id, $d)) { - $this->result->setMetadata($id, $keyMetadata, $d); - } - } - } - } -} diff --git a/tests/integration/vendor/symfony/translation/Command/XliffLintCommand.php b/tests/integration/vendor/symfony/translation/Command/XliffLintCommand.php deleted file mode 100644 index ba68635..0000000 --- a/tests/integration/vendor/symfony/translation/Command/XliffLintCommand.php +++ /dev/null @@ -1,285 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Command; - -use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Console\CI\GithubActionReporter; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Exception\RuntimeException; -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\Style\SymfonyStyle; -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\Util\XliffUtils; - -/** - * Validates XLIFF files syntax and outputs encountered errors. - * - * @author Grégoire Pineau - * @author Robin Chalas - * @author Javier Eguiluz - */ -#[AsCommand(name: 'lint:xliff', description: 'Lint an XLIFF file and outputs encountered errors')] -class XliffLintCommand extends Command -{ - private string $format; - private bool $displayCorrectFiles; - private ?\Closure $directoryIteratorProvider; - private ?\Closure $isReadableProvider; - private bool $requireStrictFileNames; - - public function __construct(string $name = null, callable $directoryIteratorProvider = null, callable $isReadableProvider = null, bool $requireStrictFileNames = true) - { - parent::__construct($name); - - $this->directoryIteratorProvider = null === $directoryIteratorProvider ? null : $directoryIteratorProvider(...); - $this->isReadableProvider = null === $isReadableProvider ? null : $isReadableProvider(...); - $this->requireStrictFileNames = $requireStrictFileNames; - } - - /** - * @return void - */ - protected function configure() - { - $this - ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN') - ->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions()))) - ->setHelp(<<%command.name% command lints an XLIFF file and outputs to STDOUT -the first encountered syntax error. - -You can validates XLIFF contents passed from STDIN: - - cat filename | php %command.full_name% - - -You can also validate the syntax of a file: - - php %command.full_name% filename - -Or of a whole directory: - - php %command.full_name% dirname - php %command.full_name% dirname --format=json - -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $io = new SymfonyStyle($input, $output); - $filenames = (array) $input->getArgument('filename'); - $this->format = $input->getOption('format') ?? (GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt'); - $this->displayCorrectFiles = $output->isVerbose(); - - if (['-'] === $filenames) { - return $this->display($io, [$this->validate(file_get_contents('php://stdin'))]); - } - - if (!$filenames) { - throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); - } - - $filesInfo = []; - foreach ($filenames as $filename) { - if (!$this->isReadable($filename)) { - throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); - } - - foreach ($this->getFiles($filename) as $file) { - $filesInfo[] = $this->validate(file_get_contents($file), $file); - } - } - - return $this->display($io, $filesInfo); - } - - private function validate(string $content, string $file = null): array - { - $errors = []; - - // Avoid: Warning DOMDocument::loadXML(): Empty string supplied as input - if ('' === trim($content)) { - return ['file' => $file, 'valid' => true]; - } - - $internal = libxml_use_internal_errors(true); - - $document = new \DOMDocument(); - $document->loadXML($content); - - if (null !== $targetLanguage = $this->getTargetLanguageFromFile($document)) { - $normalizedLocalePattern = sprintf('(%s|%s)', preg_quote($targetLanguage, '/'), preg_quote(str_replace('-', '_', $targetLanguage), '/')); - // strict file names require translation files to be named '____.locale.xlf' - // otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed - // also, the regexp matching must be case-insensitive, as defined for 'target-language' values - // http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#target-language - $expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.(?i:%s)\.(?:xlf|xliff)/', $normalizedLocalePattern) : sprintf('/^(?:.*\.(?i:%s)|(?i:%s)\..*)\.(?:xlf|xliff)/', $normalizedLocalePattern, $normalizedLocalePattern); - - if (0 === preg_match($expectedFilenamePattern, basename($file))) { - $errors[] = [ - 'line' => -1, - 'column' => -1, - 'message' => sprintf('There is a mismatch between the language included in the file name ("%s") and the "%s" value used in the "target-language" attribute of the file.', basename($file), $targetLanguage), - ]; - } - } - - foreach (XliffUtils::validateSchema($document) as $xmlError) { - $errors[] = [ - 'line' => $xmlError['line'], - 'column' => $xmlError['column'], - 'message' => $xmlError['message'], - ]; - } - - libxml_clear_errors(); - libxml_use_internal_errors($internal); - - return ['file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors]; - } - - private function display(SymfonyStyle $io, array $files): int - { - return match ($this->format) { - 'txt' => $this->displayTxt($io, $files), - 'json' => $this->displayJson($io, $files), - 'github' => $this->displayTxt($io, $files, true), - default => throw new InvalidArgumentException(sprintf('Supported formats are "%s".', implode('", "', $this->getAvailableFormatOptions()))), - }; - } - - private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false): int - { - $countFiles = \count($filesInfo); - $erroredFiles = 0; - $githubReporter = $errorAsGithubAnnotations ? new GithubActionReporter($io) : null; - - foreach ($filesInfo as $info) { - if ($info['valid'] && $this->displayCorrectFiles) { - $io->comment('OK'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); - } elseif (!$info['valid']) { - ++$erroredFiles; - $io->text(' ERROR '.($info['file'] ? sprintf(' in %s', $info['file']) : '')); - $io->listing(array_map(function ($error) use ($info, $githubReporter) { - // general document errors have a '-1' line number - $line = -1 === $error['line'] ? null : $error['line']; - - $githubReporter?->error($error['message'], $info['file'], $line, null !== $line ? $error['column'] : null); - - return null === $line ? $error['message'] : sprintf('Line %d, Column %d: %s', $line, $error['column'], $error['message']); - }, $info['messages'])); - } - } - - if (0 === $erroredFiles) { - $io->success(sprintf('All %d XLIFF files contain valid syntax.', $countFiles)); - } else { - $io->warning(sprintf('%d XLIFF files have valid syntax and %d contain errors.', $countFiles - $erroredFiles, $erroredFiles)); - } - - return min($erroredFiles, 1); - } - - private function displayJson(SymfonyStyle $io, array $filesInfo): int - { - $errors = 0; - - array_walk($filesInfo, function (&$v) use (&$errors) { - $v['file'] = (string) $v['file']; - if (!$v['valid']) { - ++$errors; - } - }); - - $io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); - - return min($errors, 1); - } - - /** - * @return iterable<\SplFileInfo> - */ - private function getFiles(string $fileOrDirectory): iterable - { - if (is_file($fileOrDirectory)) { - yield new \SplFileInfo($fileOrDirectory); - - return; - } - - foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!\in_array($file->getExtension(), ['xlf', 'xliff'])) { - continue; - } - - yield $file; - } - } - - /** - * @return iterable<\SplFileInfo> - */ - private function getDirectoryIterator(string $directory): iterable - { - $default = fn ($directory) => new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), - \RecursiveIteratorIterator::LEAVES_ONLY - ); - - if (null !== $this->directoryIteratorProvider) { - return ($this->directoryIteratorProvider)($directory, $default); - } - - return $default($directory); - } - - private function isReadable(string $fileOrDirectory): bool - { - $default = fn ($fileOrDirectory) => is_readable($fileOrDirectory); - - if (null !== $this->isReadableProvider) { - return ($this->isReadableProvider)($fileOrDirectory, $default); - } - - return $default($fileOrDirectory); - } - - private function getTargetLanguageFromFile(\DOMDocument $xliffContents): ?string - { - foreach ($xliffContents->getElementsByTagName('file')[0]->attributes ?? [] as $attribute) { - if ('target-language' === $attribute->nodeName) { - return $attribute->nodeValue; - } - } - - return null; - } - - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - if ($input->mustSuggestOptionValuesFor('format')) { - $suggestions->suggestValues($this->getAvailableFormatOptions()); - } - } - - private function getAvailableFormatOptions(): array - { - return ['txt', 'json', 'github']; - } -} diff --git a/tests/integration/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/tests/integration/vendor/symfony/translation/DataCollector/TranslationDataCollector.php deleted file mode 100644 index cdbba8c..0000000 --- a/tests/integration/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ /dev/null @@ -1,148 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\DataCollector\DataCollector; -use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; -use Symfony\Component\Translation\DataCollectorTranslator; -use Symfony\Component\VarDumper\Cloner\Data; - -/** - * @author Abdellatif Ait boudad - * - * @final - */ -class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface -{ - private DataCollectorTranslator $translator; - - public function __construct(DataCollectorTranslator $translator) - { - $this->translator = $translator; - } - - public function lateCollect(): void - { - $messages = $this->sanitizeCollectedMessages($this->translator->getCollectedMessages()); - - $this->data += $this->computeCount($messages); - $this->data['messages'] = $messages; - - $this->data = $this->cloneVar($this->data); - } - - public function collect(Request $request, Response $response, \Throwable $exception = null): void - { - $this->data['locale'] = $this->translator->getLocale(); - $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); - } - - public function reset(): void - { - $this->data = []; - } - - public function getMessages(): array|Data - { - return $this->data['messages'] ?? []; - } - - public function getCountMissings(): int - { - return $this->data[DataCollectorTranslator::MESSAGE_MISSING] ?? 0; - } - - public function getCountFallbacks(): int - { - return $this->data[DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK] ?? 0; - } - - public function getCountDefines(): int - { - return $this->data[DataCollectorTranslator::MESSAGE_DEFINED] ?? 0; - } - - public function getLocale() - { - return !empty($this->data['locale']) ? $this->data['locale'] : null; - } - - /** - * @internal - */ - public function getFallbackLocales() - { - return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : []; - } - - public function getName(): string - { - return 'translation'; - } - - private function sanitizeCollectedMessages(array $messages): array - { - $result = []; - foreach ($messages as $key => $message) { - $messageId = $message['locale'].$message['domain'].$message['id']; - - if (!isset($result[$messageId])) { - $message['count'] = 1; - $message['parameters'] = !empty($message['parameters']) ? [$message['parameters']] : []; - $messages[$key]['translation'] = $this->sanitizeString($message['translation']); - $result[$messageId] = $message; - } else { - if (!empty($message['parameters'])) { - $result[$messageId]['parameters'][] = $message['parameters']; - } - - ++$result[$messageId]['count']; - } - - unset($messages[$key]); - } - - return $result; - } - - private function computeCount(array $messages): array - { - $count = [ - DataCollectorTranslator::MESSAGE_DEFINED => 0, - DataCollectorTranslator::MESSAGE_MISSING => 0, - DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK => 0, - ]; - - foreach ($messages as $message) { - ++$count[$message['state']]; - } - - return $count; - } - - private function sanitizeString(string $string, int $length = 80): string - { - $string = trim(preg_replace('/\s+/', ' ', $string)); - - if (false !== $encoding = mb_detect_encoding($string, null, true)) { - if (mb_strlen($string, $encoding) > $length) { - return mb_substr($string, 0, $length - 3, $encoding).'...'; - } - } elseif (\strlen($string) > $length) { - return substr($string, 0, $length - 3).'...'; - } - - return $string; - } -} diff --git a/tests/integration/vendor/symfony/translation/DataCollectorTranslator.php b/tests/integration/vendor/symfony/translation/DataCollectorTranslator.php deleted file mode 100644 index 0e584da..0000000 --- a/tests/integration/vendor/symfony/translation/DataCollectorTranslator.php +++ /dev/null @@ -1,146 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Contracts\Translation\LocaleAwareInterface; -use Symfony\Contracts\Translation\TranslatorInterface; - -/** - * @author Abdellatif Ait boudad - */ -class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface, WarmableInterface -{ - public const MESSAGE_DEFINED = 0; - public const MESSAGE_MISSING = 1; - public const MESSAGE_EQUALS_FALLBACK = 2; - - private TranslatorInterface $translator; - private array $messages = []; - - /** - * @param TranslatorInterface&TranslatorBagInterface&LocaleAwareInterface $translator - */ - public function __construct(TranslatorInterface $translator) - { - if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) { - throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', get_debug_type($translator))); - } - - $this->translator = $translator; - } - - public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string - { - $trans = $this->translator->trans($id = (string) $id, $parameters, $domain, $locale); - $this->collectMessage($locale, $domain, $id, $trans, $parameters); - - return $trans; - } - - /** - * @return void - */ - public function setLocale(string $locale) - { - $this->translator->setLocale($locale); - } - - public function getLocale(): string - { - return $this->translator->getLocale(); - } - - public function getCatalogue(string $locale = null): MessageCatalogueInterface - { - return $this->translator->getCatalogue($locale); - } - - public function getCatalogues(): array - { - return $this->translator->getCatalogues(); - } - - /** - * @return string[] - */ - public function warmUp(string $cacheDir): array - { - if ($this->translator instanceof WarmableInterface) { - return (array) $this->translator->warmUp($cacheDir); - } - - return []; - } - - /** - * Gets the fallback locales. - */ - public function getFallbackLocales(): array - { - if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) { - return $this->translator->getFallbackLocales(); - } - - return []; - } - - /** - * Passes through all unknown calls onto the translator object. - */ - public function __call(string $method, array $args) - { - return $this->translator->{$method}(...$args); - } - - public function getCollectedMessages(): array - { - return $this->messages; - } - - private function collectMessage(?string $locale, ?string $domain, string $id, string $translation, ?array $parameters = []): void - { - $domain ??= 'messages'; - - $catalogue = $this->translator->getCatalogue($locale); - $locale = $catalogue->getLocale(); - $fallbackLocale = null; - if ($catalogue->defines($id, $domain)) { - $state = self::MESSAGE_DEFINED; - } elseif ($catalogue->has($id, $domain)) { - $state = self::MESSAGE_EQUALS_FALLBACK; - - $fallbackCatalogue = $catalogue->getFallbackCatalogue(); - while ($fallbackCatalogue) { - if ($fallbackCatalogue->defines($id, $domain)) { - $fallbackLocale = $fallbackCatalogue->getLocale(); - break; - } - $fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue(); - } - } else { - $state = self::MESSAGE_MISSING; - } - - $this->messages[] = [ - 'locale' => $locale, - 'fallbackLocale' => $fallbackLocale, - 'domain' => $domain, - 'id' => $id, - 'translation' => $translation, - 'parameters' => $parameters, - 'state' => $state, - 'transChoiceNumber' => isset($parameters['%count%']) && is_numeric($parameters['%count%']) ? $parameters['%count%'] : null, - ]; - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/CsvFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/CsvFileDumper.php deleted file mode 100644 index 8f54752..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/CsvFileDumper.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * CsvFileDumper generates a csv formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class CsvFileDumper extends FileDumper -{ - private string $delimiter = ';'; - private string $enclosure = '"'; - - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - $handle = fopen('php://memory', 'r+'); - - foreach ($messages->all($domain) as $source => $target) { - fputcsv($handle, [$source, $target], $this->delimiter, $this->enclosure); - } - - rewind($handle); - $output = stream_get_contents($handle); - fclose($handle); - - return $output; - } - - /** - * Sets the delimiter and escape character for CSV. - * - * @return void - */ - public function setCsvControl(string $delimiter = ';', string $enclosure = '"') - { - $this->delimiter = $delimiter; - $this->enclosure = $enclosure; - } - - protected function getExtension(): string - { - return 'csv'; - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/DumperInterface.php b/tests/integration/vendor/symfony/translation/Dumper/DumperInterface.php deleted file mode 100644 index 6bf4293..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/DumperInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * DumperInterface is the interface implemented by all translation dumpers. - * There is no common option. - * - * @author Michel Salib - */ -interface DumperInterface -{ - /** - * Dumps the message catalogue. - * - * @param array $options Options that are used by the dumper - * - * @return void - */ - public function dump(MessageCatalogue $messages, array $options = []); -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/FileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/FileDumper.php deleted file mode 100644 index ed2c278..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/FileDumper.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\Exception\RuntimeException; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s). - * - * Options: - * - path (mandatory): the directory where the files should be saved - * - * @author Michel Salib - */ -abstract class FileDumper implements DumperInterface -{ - /** - * A template for the relative paths to files. - * - * @var string - */ - protected $relativePathTemplate = '%domain%.%locale%.%extension%'; - - /** - * Sets the template for the relative paths to files. - * - * @param string $relativePathTemplate A template for the relative paths to files - * - * @return void - */ - public function setRelativePathTemplate(string $relativePathTemplate) - { - $this->relativePathTemplate = $relativePathTemplate; - } - - /** - * @return void - */ - public function dump(MessageCatalogue $messages, array $options = []) - { - if (!\array_key_exists('path', $options)) { - throw new InvalidArgumentException('The file dumper needs a path option.'); - } - - // save a file for each domain - foreach ($messages->getDomains() as $domain) { - $fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale()); - if (!file_exists($fullpath)) { - $directory = \dirname($fullpath); - if (!file_exists($directory) && !@mkdir($directory, 0777, true)) { - throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory)); - } - } - - $intlDomain = $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX; - $intlMessages = $messages->all($intlDomain); - - if ($intlMessages) { - $intlPath = $options['path'].'/'.$this->getRelativePath($intlDomain, $messages->getLocale()); - file_put_contents($intlPath, $this->formatCatalogue($messages, $intlDomain, $options)); - - $messages->replace([], $intlDomain); - - try { - if ($messages->all($domain)) { - file_put_contents($fullpath, $this->formatCatalogue($messages, $domain, $options)); - } - continue; - } finally { - $messages->replace($intlMessages, $intlDomain); - } - } - - file_put_contents($fullpath, $this->formatCatalogue($messages, $domain, $options)); - } - } - - /** - * Transforms a domain of a message catalogue to its string representation. - */ - abstract public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string; - - /** - * Gets the file extension of the dumper. - */ - abstract protected function getExtension(): string; - - /** - * Gets the relative file path using the template. - */ - private function getRelativePath(string $domain, string $locale): string - { - return strtr($this->relativePathTemplate, [ - '%domain%' => $domain, - '%locale%' => $locale, - '%extension%' => $this->getExtension(), - ]); - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/IcuResFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/IcuResFileDumper.php deleted file mode 100644 index 72c1ec0..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * IcuResDumper generates an ICU ResourceBundle formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class IcuResFileDumper extends FileDumper -{ - protected $relativePathTemplate = '%domain%/%locale%.%extension%'; - - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - $data = $indexes = $resources = ''; - - foreach ($messages->all($domain) as $source => $target) { - $indexes .= pack('v', \strlen($data) + 28); - $data .= $source."\0"; - } - - $data .= $this->writePadding($data); - - $keyTop = $this->getPosition($data); - - foreach ($messages->all($domain) as $source => $target) { - $resources .= pack('V', $this->getPosition($data)); - - $data .= pack('V', \strlen($target)) - .mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8') - .$this->writePadding($data) - ; - } - - $resOffset = $this->getPosition($data); - - $data .= pack('v', \count($messages->all($domain))) - .$indexes - .$this->writePadding($data) - .$resources - ; - - $bundleTop = $this->getPosition($data); - - $root = pack('V7', - $resOffset + (2 << 28), // Resource Offset + Resource Type - 6, // Index length - $keyTop, // Index keys top - $bundleTop, // Index resources top - $bundleTop, // Index bundle top - \count($messages->all($domain)), // Index max table length - 0 // Index attributes - ); - - $header = pack('vC2v4C12@32', - 32, // Header size - 0xDA, 0x27, // Magic number 1 and 2 - 20, 0, 0, 2, // Rest of the header, ..., Size of a char - 0x52, 0x65, 0x73, 0x42, // Data format identifier - 1, 2, 0, 0, // Data version - 1, 4, 0, 0 // Unicode version - ); - - return $header.$root.$data; - } - - private function writePadding(string $data): ?string - { - $padding = \strlen($data) % 4; - - return $padding ? str_repeat("\xAA", 4 - $padding) : null; - } - - private function getPosition(string $data): float|int - { - return (\strlen($data) + 28) / 4; - } - - protected function getExtension(): string - { - return 'res'; - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/IniFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/IniFileDumper.php deleted file mode 100644 index 6cbdef6..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/IniFileDumper.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * IniFileDumper generates an ini formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class IniFileDumper extends FileDumper -{ - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - $output = ''; - - foreach ($messages->all($domain) as $source => $target) { - $escapeTarget = str_replace('"', '\"', $target); - $output .= $source.'="'.$escapeTarget."\"\n"; - } - - return $output; - } - - protected function getExtension(): string - { - return 'ini'; - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/JsonFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/JsonFileDumper.php deleted file mode 100644 index e503539..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/JsonFileDumper.php +++ /dev/null @@ -1,34 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * JsonFileDumper generates an json formatted string representation of a message catalogue. - * - * @author singles - */ -class JsonFileDumper extends FileDumper -{ - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - $flags = $options['json_encoding'] ?? \JSON_PRETTY_PRINT; - - return json_encode($messages->all($domain), $flags); - } - - protected function getExtension(): string - { - return 'json'; - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/MoFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/MoFileDumper.php deleted file mode 100644 index 9ded5f4..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/MoFileDumper.php +++ /dev/null @@ -1,76 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\Loader\MoFileLoader; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * MoFileDumper generates a gettext formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class MoFileDumper extends FileDumper -{ - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - $sources = $targets = $sourceOffsets = $targetOffsets = ''; - $offsets = []; - $size = 0; - - foreach ($messages->all($domain) as $source => $target) { - $offsets[] = array_map('strlen', [$sources, $source, $targets, $target]); - $sources .= "\0".$source; - $targets .= "\0".$target; - ++$size; - } - - $header = [ - 'magicNumber' => MoFileLoader::MO_LITTLE_ENDIAN_MAGIC, - 'formatRevision' => 0, - 'count' => $size, - 'offsetId' => MoFileLoader::MO_HEADER_SIZE, - 'offsetTranslated' => MoFileLoader::MO_HEADER_SIZE + (8 * $size), - 'sizeHashes' => 0, - 'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size), - ]; - - $sourcesSize = \strlen($sources); - $sourcesStart = $header['offsetHashes'] + 1; - - foreach ($offsets as $offset) { - $sourceOffsets .= $this->writeLong($offset[1]) - .$this->writeLong($offset[0] + $sourcesStart); - $targetOffsets .= $this->writeLong($offset[3]) - .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); - } - - $output = implode('', array_map($this->writeLong(...), $header)) - .$sourceOffsets - .$targetOffsets - .$sources - .$targets - ; - - return $output; - } - - protected function getExtension(): string - { - return 'mo'; - } - - private function writeLong(mixed $str): string - { - return pack('V*', $str); - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/PhpFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/PhpFileDumper.php deleted file mode 100644 index 51e9066..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/PhpFileDumper.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * PhpFileDumper generates PHP files from a message catalogue. - * - * @author Michel Salib - */ -class PhpFileDumper extends FileDumper -{ - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - return "all($domain), true).";\n"; - } - - protected function getExtension(): string - { - return 'php'; - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/PoFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/PoFileDumper.php deleted file mode 100644 index a2d0deb..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/PoFileDumper.php +++ /dev/null @@ -1,131 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * PoFileDumper generates a gettext formatted string representation of a message catalogue. - * - * @author Stealth35 - */ -class PoFileDumper extends FileDumper -{ - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - $output = 'msgid ""'."\n"; - $output .= 'msgstr ""'."\n"; - $output .= '"Content-Type: text/plain; charset=UTF-8\n"'."\n"; - $output .= '"Content-Transfer-Encoding: 8bit\n"'."\n"; - $output .= '"Language: '.$messages->getLocale().'\n"'."\n"; - $output .= "\n"; - - $newLine = false; - foreach ($messages->all($domain) as $source => $target) { - if ($newLine) { - $output .= "\n"; - } else { - $newLine = true; - } - $metadata = $messages->getMetadata($source, $domain); - - if (isset($metadata['comments'])) { - $output .= $this->formatComments($metadata['comments']); - } - if (isset($metadata['flags'])) { - $output .= $this->formatComments(implode(',', (array) $metadata['flags']), ','); - } - if (isset($metadata['sources'])) { - $output .= $this->formatComments(implode(' ', (array) $metadata['sources']), ':'); - } - - $sourceRules = $this->getStandardRules($source); - $targetRules = $this->getStandardRules($target); - if (2 == \count($sourceRules) && [] !== $targetRules) { - $output .= sprintf('msgid "%s"'."\n", $this->escape($sourceRules[0])); - $output .= sprintf('msgid_plural "%s"'."\n", $this->escape($sourceRules[1])); - foreach ($targetRules as $i => $targetRule) { - $output .= sprintf('msgstr[%d] "%s"'."\n", $i, $this->escape($targetRule)); - } - } else { - $output .= sprintf('msgid "%s"'."\n", $this->escape($source)); - $output .= sprintf('msgstr "%s"'."\n", $this->escape($target)); - } - } - - return $output; - } - - private function getStandardRules(string $id): array - { - // Partly copied from TranslatorTrait::trans. - $parts = []; - if (preg_match('/^\|++$/', $id)) { - $parts = explode('|', $id); - } elseif (preg_match_all('/(?:\|\||[^\|])++/', $id, $matches)) { - $parts = $matches[0]; - } - - $intervalRegexp = <<<'EOF' -/^(?P - ({\s* - (\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*) - \s*}) - - | - - (?P[\[\]]) - \s* - (?P-Inf|\-?\d+(\.\d+)?) - \s*,\s* - (?P\+?Inf|\-?\d+(\.\d+)?) - \s* - (?P[\[\]]) -)\s*(?P.*?)$/xs -EOF; - - $standardRules = []; - foreach ($parts as $part) { - $part = trim(str_replace('||', '|', $part)); - - if (preg_match($intervalRegexp, $part)) { - // Explicit rule is not a standard rule. - return []; - } else { - $standardRules[] = $part; - } - } - - return $standardRules; - } - - protected function getExtension(): string - { - return 'po'; - } - - private function escape(string $str): string - { - return addcslashes($str, "\0..\37\42\134"); - } - - private function formatComments(string|array $comments, string $prefix = ''): ?string - { - $output = null; - - foreach ((array) $comments as $comment) { - $output .= sprintf('#%s %s'."\n", $prefix, $comment); - } - - return $output; - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/QtFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/QtFileDumper.php deleted file mode 100644 index 0373e9c..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/QtFileDumper.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * QtFileDumper generates ts files from a message catalogue. - * - * @author Benjamin Eberlei - */ -class QtFileDumper extends FileDumper -{ - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - $dom = new \DOMDocument('1.0', 'utf-8'); - $dom->formatOutput = true; - $ts = $dom->appendChild($dom->createElement('TS')); - $context = $ts->appendChild($dom->createElement('context')); - $context->appendChild($dom->createElement('name', $domain)); - - foreach ($messages->all($domain) as $source => $target) { - $message = $context->appendChild($dom->createElement('message')); - $metadata = $messages->getMetadata($source, $domain); - if (isset($metadata['sources'])) { - foreach ((array) $metadata['sources'] as $location) { - $loc = explode(':', $location, 2); - $location = $message->appendChild($dom->createElement('location')); - $location->setAttribute('filename', $loc[0]); - if (isset($loc[1])) { - $location->setAttribute('line', $loc[1]); - } - } - } - $message->appendChild($dom->createElement('source', $source)); - $message->appendChild($dom->createElement('translation', $target)); - } - - return $dom->saveXML(); - } - - protected function getExtension(): string - { - return 'ts'; - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/XliffFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/XliffFileDumper.php deleted file mode 100644 index 22f0227..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/XliffFileDumper.php +++ /dev/null @@ -1,221 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * XliffFileDumper generates xliff files from a message catalogue. - * - * @author Michel Salib - */ -class XliffFileDumper extends FileDumper -{ - public function __construct( - private string $extension = 'xlf', - ) { - } - - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - $xliffVersion = '1.2'; - if (\array_key_exists('xliff_version', $options)) { - $xliffVersion = $options['xliff_version']; - } - - if (\array_key_exists('default_locale', $options)) { - $defaultLocale = $options['default_locale']; - } else { - $defaultLocale = \Locale::getDefault(); - } - - if ('1.2' === $xliffVersion) { - return $this->dumpXliff1($defaultLocale, $messages, $domain, $options); - } - if ('2.0' === $xliffVersion) { - return $this->dumpXliff2($defaultLocale, $messages, $domain); - } - - throw new InvalidArgumentException(sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion)); - } - - protected function getExtension(): string - { - return $this->extension; - } - - private function dumpXliff1(string $defaultLocale, MessageCatalogue $messages, ?string $domain, array $options = []): string - { - $toolInfo = ['tool-id' => 'symfony', 'tool-name' => 'Symfony']; - if (\array_key_exists('tool_info', $options)) { - $toolInfo = array_merge($toolInfo, $options['tool_info']); - } - - $dom = new \DOMDocument('1.0', 'utf-8'); - $dom->formatOutput = true; - - $xliff = $dom->appendChild($dom->createElement('xliff')); - $xliff->setAttribute('version', '1.2'); - $xliff->setAttribute('xmlns', 'urn:oasis:names:tc:xliff:document:1.2'); - - $xliffFile = $xliff->appendChild($dom->createElement('file')); - $xliffFile->setAttribute('source-language', str_replace('_', '-', $defaultLocale)); - $xliffFile->setAttribute('target-language', str_replace('_', '-', $messages->getLocale())); - $xliffFile->setAttribute('datatype', 'plaintext'); - $xliffFile->setAttribute('original', 'file.ext'); - - $xliffHead = $xliffFile->appendChild($dom->createElement('header')); - $xliffTool = $xliffHead->appendChild($dom->createElement('tool')); - foreach ($toolInfo as $id => $value) { - $xliffTool->setAttribute($id, $value); - } - - if ($catalogueMetadata = $messages->getCatalogueMetadata('', $domain) ?? []) { - $xliffPropGroup = $xliffHead->appendChild($dom->createElement('prop-group')); - foreach ($catalogueMetadata as $key => $value) { - $xliffProp = $xliffPropGroup->appendChild($dom->createElement('prop')); - $xliffProp->setAttribute('prop-type', $key); - $xliffProp->appendChild($dom->createTextNode($value)); - } - } - - $xliffBody = $xliffFile->appendChild($dom->createElement('body')); - foreach ($messages->all($domain) as $source => $target) { - $translation = $dom->createElement('trans-unit'); - - $translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._')); - $translation->setAttribute('resname', $source); - - $s = $translation->appendChild($dom->createElement('source')); - $s->appendChild($dom->createTextNode($source)); - - // Does the target contain characters requiring a CDATA section? - $text = 1 === preg_match('/[&<>]/', $target) ? $dom->createCDATASection($target) : $dom->createTextNode($target); - - $targetElement = $dom->createElement('target'); - $metadata = $messages->getMetadata($source, $domain); - if ($this->hasMetadataArrayInfo('target-attributes', $metadata)) { - foreach ($metadata['target-attributes'] as $name => $value) { - $targetElement->setAttribute($name, $value); - } - } - $t = $translation->appendChild($targetElement); - $t->appendChild($text); - - if ($this->hasMetadataArrayInfo('notes', $metadata)) { - foreach ($metadata['notes'] as $note) { - if (!isset($note['content'])) { - continue; - } - - $n = $translation->appendChild($dom->createElement('note')); - $n->appendChild($dom->createTextNode($note['content'])); - - if (isset($note['priority'])) { - $n->setAttribute('priority', $note['priority']); - } - - if (isset($note['from'])) { - $n->setAttribute('from', $note['from']); - } - } - } - - $xliffBody->appendChild($translation); - } - - return $dom->saveXML(); - } - - private function dumpXliff2(string $defaultLocale, MessageCatalogue $messages, ?string $domain): string - { - $dom = new \DOMDocument('1.0', 'utf-8'); - $dom->formatOutput = true; - - $xliff = $dom->appendChild($dom->createElement('xliff')); - $xliff->setAttribute('xmlns', 'urn:oasis:names:tc:xliff:document:2.0'); - $xliff->setAttribute('version', '2.0'); - $xliff->setAttribute('srcLang', str_replace('_', '-', $defaultLocale)); - $xliff->setAttribute('trgLang', str_replace('_', '-', $messages->getLocale())); - - $xliffFile = $xliff->appendChild($dom->createElement('file')); - if (str_ends_with($domain, MessageCatalogue::INTL_DOMAIN_SUFFIX)) { - $xliffFile->setAttribute('id', substr($domain, 0, -\strlen(MessageCatalogue::INTL_DOMAIN_SUFFIX)).'.'.$messages->getLocale()); - } else { - $xliffFile->setAttribute('id', $domain.'.'.$messages->getLocale()); - } - - if ($catalogueMetadata = $messages->getCatalogueMetadata('', $domain) ?? []) { - $xliff->setAttribute('xmlns:m', 'urn:oasis:names:tc:xliff:metadata:2.0'); - $xliffMetadata = $xliffFile->appendChild($dom->createElement('m:metadata')); - foreach ($catalogueMetadata as $key => $value) { - $xliffMeta = $xliffMetadata->appendChild($dom->createElement('prop')); - $xliffMeta->setAttribute('type', $key); - $xliffMeta->appendChild($dom->createTextNode($value)); - } - } - - foreach ($messages->all($domain) as $source => $target) { - $translation = $dom->createElement('unit'); - $translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._')); - - if (\strlen($source) <= 80) { - $translation->setAttribute('name', $source); - } - - $metadata = $messages->getMetadata($source, $domain); - - // Add notes section - if ($this->hasMetadataArrayInfo('notes', $metadata)) { - $notesElement = $dom->createElement('notes'); - foreach ($metadata['notes'] as $note) { - $n = $dom->createElement('note'); - $n->appendChild($dom->createTextNode($note['content'] ?? '')); - unset($note['content']); - - foreach ($note as $name => $value) { - $n->setAttribute($name, $value); - } - $notesElement->appendChild($n); - } - $translation->appendChild($notesElement); - } - - $segment = $translation->appendChild($dom->createElement('segment')); - - $s = $segment->appendChild($dom->createElement('source')); - $s->appendChild($dom->createTextNode($source)); - - // Does the target contain characters requiring a CDATA section? - $text = 1 === preg_match('/[&<>]/', $target) ? $dom->createCDATASection($target) : $dom->createTextNode($target); - - $targetElement = $dom->createElement('target'); - if ($this->hasMetadataArrayInfo('target-attributes', $metadata)) { - foreach ($metadata['target-attributes'] as $name => $value) { - $targetElement->setAttribute($name, $value); - } - } - $t = $segment->appendChild($targetElement); - $t->appendChild($text); - - $xliffFile->appendChild($translation); - } - - return $dom->saveXML(); - } - - private function hasMetadataArrayInfo(string $key, array $metadata = null): bool - { - return is_iterable($metadata[$key] ?? null); - } -} diff --git a/tests/integration/vendor/symfony/translation/Dumper/YamlFileDumper.php b/tests/integration/vendor/symfony/translation/Dumper/YamlFileDumper.php deleted file mode 100644 index d267033..0000000 --- a/tests/integration/vendor/symfony/translation/Dumper/YamlFileDumper.php +++ /dev/null @@ -1,56 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Dumper; - -use Symfony\Component\Translation\Exception\LogicException; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Util\ArrayConverter; -use Symfony\Component\Yaml\Yaml; - -/** - * YamlFileDumper generates yaml files from a message catalogue. - * - * @author Michel Salib - */ -class YamlFileDumper extends FileDumper -{ - private string $extension; - - public function __construct(string $extension = 'yml') - { - $this->extension = $extension; - } - - public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string - { - if (!class_exists(Yaml::class)) { - throw new LogicException('Dumping translations in the YAML format requires the Symfony Yaml component.'); - } - - $data = $messages->all($domain); - - if (isset($options['as_tree']) && $options['as_tree']) { - $data = ArrayConverter::expandToTree($data); - } - - if (isset($options['inline']) && ($inline = (int) $options['inline']) > 0) { - return Yaml::dump($data, $inline); - } - - return Yaml::dump($data); - } - - protected function getExtension(): string - { - return $this->extension; - } -} diff --git a/tests/integration/vendor/symfony/translation/Exception/ExceptionInterface.php b/tests/integration/vendor/symfony/translation/Exception/ExceptionInterface.php deleted file mode 100644 index 8f9c54e..0000000 --- a/tests/integration/vendor/symfony/translation/Exception/ExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Exception interface for all exceptions thrown by the component. - * - * @author Fabien Potencier - */ -interface ExceptionInterface extends \Throwable -{ -} diff --git a/tests/integration/vendor/symfony/translation/Exception/InvalidArgumentException.php b/tests/integration/vendor/symfony/translation/Exception/InvalidArgumentException.php deleted file mode 100644 index 90d0669..0000000 --- a/tests/integration/vendor/symfony/translation/Exception/InvalidArgumentException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Base InvalidArgumentException for the Translation component. - * - * @author Abdellatif Ait boudad - */ -class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/translation/Exception/InvalidResourceException.php b/tests/integration/vendor/symfony/translation/Exception/InvalidResourceException.php deleted file mode 100644 index cf07943..0000000 --- a/tests/integration/vendor/symfony/translation/Exception/InvalidResourceException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Thrown when a resource cannot be loaded. - * - * @author Fabien Potencier - */ -class InvalidResourceException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/translation/Exception/LogicException.php b/tests/integration/vendor/symfony/translation/Exception/LogicException.php deleted file mode 100644 index 9019c7e..0000000 --- a/tests/integration/vendor/symfony/translation/Exception/LogicException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Base LogicException for Translation component. - * - * @author Abdellatif Ait boudad - */ -class LogicException extends \LogicException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/translation/Exception/NotFoundResourceException.php b/tests/integration/vendor/symfony/translation/Exception/NotFoundResourceException.php deleted file mode 100644 index cff73ae..0000000 --- a/tests/integration/vendor/symfony/translation/Exception/NotFoundResourceException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Thrown when a resource does not exist. - * - * @author Fabien Potencier - */ -class NotFoundResourceException extends \InvalidArgumentException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/translation/Exception/RuntimeException.php b/tests/integration/vendor/symfony/translation/Exception/RuntimeException.php deleted file mode 100644 index dcd7940..0000000 --- a/tests/integration/vendor/symfony/translation/Exception/RuntimeException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Exception; - -/** - * Base RuntimeException for the Translation component. - * - * @author Abdellatif Ait boudad - */ -class RuntimeException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/translation/Extractor/AbstractFileExtractor.php b/tests/integration/vendor/symfony/translation/Extractor/AbstractFileExtractor.php deleted file mode 100644 index 4c088b9..0000000 --- a/tests/integration/vendor/symfony/translation/Extractor/AbstractFileExtractor.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Extractor; - -use Symfony\Component\Translation\Exception\InvalidArgumentException; - -/** - * Base class used by classes that extract translation messages from files. - * - * @author Marcos D. Sánchez - */ -abstract class AbstractFileExtractor -{ - protected function extractFiles(string|iterable $resource): iterable - { - if (is_iterable($resource)) { - $files = []; - foreach ($resource as $file) { - if ($this->canBeExtracted($file)) { - $files[] = $this->toSplFileInfo($file); - } - } - } elseif (is_file($resource)) { - $files = $this->canBeExtracted($resource) ? [$this->toSplFileInfo($resource)] : []; - } else { - $files = $this->extractFromDirectory($resource); - } - - return $files; - } - - private function toSplFileInfo(string $file): \SplFileInfo - { - return new \SplFileInfo($file); - } - - /** - * @throws InvalidArgumentException - */ - protected function isFile(string $file): bool - { - if (!is_file($file)) { - throw new InvalidArgumentException(sprintf('The "%s" file does not exist.', $file)); - } - - return true; - } - - /** - * @return bool - */ - abstract protected function canBeExtracted(string $file); - - /** - * @return iterable - */ - abstract protected function extractFromDirectory(string|array $resource); -} diff --git a/tests/integration/vendor/symfony/translation/Extractor/ChainExtractor.php b/tests/integration/vendor/symfony/translation/Extractor/ChainExtractor.php deleted file mode 100644 index d36f7f3..0000000 --- a/tests/integration/vendor/symfony/translation/Extractor/ChainExtractor.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Extractor; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * ChainExtractor extracts translation messages from template files. - * - * @author Michel Salib - */ -class ChainExtractor implements ExtractorInterface -{ - /** - * The extractors. - * - * @var ExtractorInterface[] - */ - private array $extractors = []; - - /** - * Adds a loader to the translation extractor. - * - * @return void - */ - public function addExtractor(string $format, ExtractorInterface $extractor) - { - $this->extractors[$format] = $extractor; - } - - /** - * @return void - */ - public function setPrefix(string $prefix) - { - foreach ($this->extractors as $extractor) { - $extractor->setPrefix($prefix); - } - } - - /** - * @return void - */ - public function extract(string|iterable $directory, MessageCatalogue $catalogue) - { - foreach ($this->extractors as $extractor) { - $extractor->extract($directory, $catalogue); - } - } -} diff --git a/tests/integration/vendor/symfony/translation/Extractor/ExtractorInterface.php b/tests/integration/vendor/symfony/translation/Extractor/ExtractorInterface.php deleted file mode 100644 index 642130a..0000000 --- a/tests/integration/vendor/symfony/translation/Extractor/ExtractorInterface.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Extractor; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * Extracts translation messages from a directory or files to the catalogue. - * New found messages are injected to the catalogue using the prefix. - * - * @author Michel Salib - */ -interface ExtractorInterface -{ - /** - * Extracts translation messages from files, a file or a directory to the catalogue. - * - * @param string|iterable $resource Files, a file or a directory - * - * @return void - */ - public function extract(string|iterable $resource, MessageCatalogue $catalogue); - - /** - * Sets the prefix that should be used for new found messages. - * - * @return void - */ - public function setPrefix(string $prefix); -} diff --git a/tests/integration/vendor/symfony/translation/IdentityTranslator.php b/tests/integration/vendor/symfony/translation/IdentityTranslator.php deleted file mode 100644 index 46875ed..0000000 --- a/tests/integration/vendor/symfony/translation/IdentityTranslator.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Contracts\Translation\LocaleAwareInterface; -use Symfony\Contracts\Translation\TranslatorInterface; -use Symfony\Contracts\Translation\TranslatorTrait; - -/** - * IdentityTranslator does not translate anything. - * - * @author Fabien Potencier - */ -class IdentityTranslator implements TranslatorInterface, LocaleAwareInterface -{ - use TranslatorTrait; -} diff --git a/tests/integration/vendor/symfony/translation/LICENSE b/tests/integration/vendor/symfony/translation/LICENSE deleted file mode 100644 index 0138f8f..0000000 --- a/tests/integration/vendor/symfony/translation/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-present Fabien Potencier - -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. diff --git a/tests/integration/vendor/symfony/translation/Loader/ArrayLoader.php b/tests/integration/vendor/symfony/translation/Loader/ArrayLoader.php deleted file mode 100644 index e63a7d0..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/ArrayLoader.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\MessageCatalogue; - -/** - * ArrayLoader loads translations from a PHP array. - * - * @author Fabien Potencier - */ -class ArrayLoader implements LoaderInterface -{ - public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue - { - $resource = $this->flatten($resource); - $catalogue = new MessageCatalogue($locale); - $catalogue->add($resource, $domain); - - return $catalogue; - } - - /** - * Flattens an nested array of translations. - * - * The scheme used is: - * 'key' => ['key2' => ['key3' => 'value']] - * Becomes: - * 'key.key2.key3' => 'value' - */ - private function flatten(array $messages): array - { - $result = []; - foreach ($messages as $key => $value) { - if (\is_array($value)) { - foreach ($this->flatten($value) as $k => $v) { - if (null !== $v) { - $result[$key.'.'.$k] = $v; - } - } - } elseif (null !== $value) { - $result[$key] = $value; - } - } - - return $result; - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/CsvFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/CsvFileLoader.php deleted file mode 100644 index 7f2f96b..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/CsvFileLoader.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\NotFoundResourceException; - -/** - * CsvFileLoader loads translations from CSV files. - * - * @author Saša Stamenković - */ -class CsvFileLoader extends FileLoader -{ - private string $delimiter = ';'; - private string $enclosure = '"'; - private string $escape = '\\'; - - protected function loadResource(string $resource): array - { - $messages = []; - - try { - $file = new \SplFileObject($resource, 'rb'); - } catch (\RuntimeException $e) { - throw new NotFoundResourceException(sprintf('Error opening file "%s".', $resource), 0, $e); - } - - $file->setFlags(\SplFileObject::READ_CSV | \SplFileObject::SKIP_EMPTY); - $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); - - foreach ($file as $data) { - if (false === $data) { - continue; - } - - if (!str_starts_with($data[0], '#') && isset($data[1]) && 2 === \count($data)) { - $messages[$data[0]] = $data[1]; - } - } - - return $messages; - } - - /** - * Sets the delimiter, enclosure, and escape character for CSV. - * - * @return void - */ - public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\') - { - $this->delimiter = $delimiter; - $this->enclosure = $enclosure; - $this->escape = $escape; - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/FileLoader.php b/tests/integration/vendor/symfony/translation/Loader/FileLoader.php deleted file mode 100644 index 877c3bb..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/FileLoader.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * @author Abdellatif Ait boudad - */ -abstract class FileLoader extends ArrayLoader -{ - public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - $messages = $this->loadResource($resource); - - // empty resource - $messages ??= []; - - // not an array - if (!\is_array($messages)) { - throw new InvalidResourceException(sprintf('Unable to load file "%s".', $resource)); - } - - $catalogue = parent::load($messages, $locale, $domain); - - if (class_exists(FileResource::class)) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } - - /** - * @throws InvalidResourceException if stream content has an invalid format - */ - abstract protected function loadResource(string $resource): array; -} diff --git a/tests/integration/vendor/symfony/translation/Loader/IcuDatFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/IcuDatFileLoader.php deleted file mode 100644 index 76e4e7f..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/IcuDatFileLoader.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * IcuResFileLoader loads translations from a resource bundle. - * - * @author stealth35 - */ -class IcuDatFileLoader extends IcuResFileLoader -{ - public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue - { - if (!stream_is_local($resource.'.dat')) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource.'.dat')) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - try { - $rb = new \ResourceBundle($locale, $resource); - } catch (\Exception) { - $rb = null; - } - - if (!$rb) { - throw new InvalidResourceException(sprintf('Cannot load resource "%s".', $resource)); - } elseif (intl_is_failure($rb->getErrorCode())) { - throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode()); - } - - $messages = $this->flatten($rb); - $catalogue = new MessageCatalogue($locale); - $catalogue->add($messages, $domain); - - if (class_exists(FileResource::class)) { - $catalogue->addResource(new FileResource($resource.'.dat')); - } - - return $catalogue; - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/IcuResFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/IcuResFileLoader.php deleted file mode 100644 index 94d55b8..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/IcuResFileLoader.php +++ /dev/null @@ -1,86 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Config\Resource\DirectoryResource; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * IcuResFileLoader loads translations from a resource bundle. - * - * @author stealth35 - */ -class IcuResFileLoader implements LoaderInterface -{ - public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue - { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!is_dir($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - try { - $rb = new \ResourceBundle($locale, $resource); - } catch (\Exception) { - $rb = null; - } - - if (!$rb) { - throw new InvalidResourceException(sprintf('Cannot load resource "%s".', $resource)); - } elseif (intl_is_failure($rb->getErrorCode())) { - throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode()); - } - - $messages = $this->flatten($rb); - $catalogue = new MessageCatalogue($locale); - $catalogue->add($messages, $domain); - - if (class_exists(DirectoryResource::class)) { - $catalogue->addResource(new DirectoryResource($resource)); - } - - return $catalogue; - } - - /** - * Flattens an ResourceBundle. - * - * The scheme used is: - * key { key2 { key3 { "value" } } } - * Becomes: - * 'key.key2.key3' => 'value' - * - * This function takes an array by reference and will modify it - * - * @param \ResourceBundle $rb The ResourceBundle that will be flattened - * @param array $messages Used internally for recursive calls - * @param string|null $path Current path being parsed, used internally for recursive calls - */ - protected function flatten(\ResourceBundle $rb, array &$messages = [], string $path = null): array - { - foreach ($rb as $key => $value) { - $nodePath = $path ? $path.'.'.$key : $key; - if ($value instanceof \ResourceBundle) { - $this->flatten($value, $messages, $nodePath); - } else { - $messages[$nodePath] = $value; - } - } - - return $messages; - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/IniFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/IniFileLoader.php deleted file mode 100644 index 3126896..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/IniFileLoader.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -/** - * IniFileLoader loads translations from an ini file. - * - * @author stealth35 - */ -class IniFileLoader extends FileLoader -{ - protected function loadResource(string $resource): array - { - return parse_ini_file($resource, true); - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/JsonFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/JsonFileLoader.php deleted file mode 100644 index 385553e..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/JsonFileLoader.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; - -/** - * JsonFileLoader loads translations from an json file. - * - * @author singles - */ -class JsonFileLoader extends FileLoader -{ - protected function loadResource(string $resource): array - { - $messages = []; - if ($data = file_get_contents($resource)) { - $messages = json_decode($data, true); - - if (0 < $errorCode = json_last_error()) { - throw new InvalidResourceException('Error parsing JSON: '.$this->getJSONErrorMessage($errorCode)); - } - } - - return $messages; - } - - /** - * Translates JSON_ERROR_* constant into meaningful message. - */ - private function getJSONErrorMessage(int $errorCode): string - { - return match ($errorCode) { - \JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', - \JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', - \JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', - \JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', - \JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', - default => 'Unknown error', - }; - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/LoaderInterface.php b/tests/integration/vendor/symfony/translation/Loader/LoaderInterface.php deleted file mode 100644 index 29d5560..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/LoaderInterface.php +++ /dev/null @@ -1,32 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * LoaderInterface is the interface implemented by all translation loaders. - * - * @author Fabien Potencier - */ -interface LoaderInterface -{ - /** - * Loads a locale. - * - * @throws NotFoundResourceException when the resource cannot be found - * @throws InvalidResourceException when the resource cannot be loaded - */ - public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue; -} diff --git a/tests/integration/vendor/symfony/translation/Loader/MoFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/MoFileLoader.php deleted file mode 100644 index 8427c39..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/MoFileLoader.php +++ /dev/null @@ -1,138 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; - -/** - * @copyright Copyright (c) 2010, Union of RAD http://union-of-rad.org (http://lithify.me/) - */ -class MoFileLoader extends FileLoader -{ - /** - * Magic used for validating the format of an MO file as well as - * detecting if the machine used to create that file was little endian. - */ - public const MO_LITTLE_ENDIAN_MAGIC = 0x950412DE; - - /** - * Magic used for validating the format of an MO file as well as - * detecting if the machine used to create that file was big endian. - */ - public const MO_BIG_ENDIAN_MAGIC = 0xDE120495; - - /** - * The size of the header of an MO file in bytes. - */ - public const MO_HEADER_SIZE = 28; - - /** - * Parses machine object (MO) format, independent of the machine's endian it - * was created on. Both 32bit and 64bit systems are supported. - */ - protected function loadResource(string $resource): array - { - $stream = fopen($resource, 'r'); - - $stat = fstat($stream); - - if ($stat['size'] < self::MO_HEADER_SIZE) { - throw new InvalidResourceException('MO stream content has an invalid format.'); - } - $magic = unpack('V1', fread($stream, 4)); - $magic = hexdec(substr(dechex(current($magic)), -8)); - - if (self::MO_LITTLE_ENDIAN_MAGIC == $magic) { - $isBigEndian = false; - } elseif (self::MO_BIG_ENDIAN_MAGIC == $magic) { - $isBigEndian = true; - } else { - throw new InvalidResourceException('MO stream content has an invalid format.'); - } - - // formatRevision - $this->readLong($stream, $isBigEndian); - $count = $this->readLong($stream, $isBigEndian); - $offsetId = $this->readLong($stream, $isBigEndian); - $offsetTranslated = $this->readLong($stream, $isBigEndian); - // sizeHashes - $this->readLong($stream, $isBigEndian); - // offsetHashes - $this->readLong($stream, $isBigEndian); - - $messages = []; - - for ($i = 0; $i < $count; ++$i) { - $pluralId = null; - $translated = null; - - fseek($stream, $offsetId + $i * 8); - - $length = $this->readLong($stream, $isBigEndian); - $offset = $this->readLong($stream, $isBigEndian); - - if ($length < 1) { - continue; - } - - fseek($stream, $offset); - $singularId = fread($stream, $length); - - if (str_contains($singularId, "\000")) { - [$singularId, $pluralId] = explode("\000", $singularId); - } - - fseek($stream, $offsetTranslated + $i * 8); - $length = $this->readLong($stream, $isBigEndian); - $offset = $this->readLong($stream, $isBigEndian); - - if ($length < 1) { - continue; - } - - fseek($stream, $offset); - $translated = fread($stream, $length); - - if (str_contains($translated, "\000")) { - $translated = explode("\000", $translated); - } - - $ids = ['singular' => $singularId, 'plural' => $pluralId]; - $item = compact('ids', 'translated'); - - if (!empty($item['ids']['singular'])) { - $id = $item['ids']['singular']; - if (isset($item['ids']['plural'])) { - $id .= '|'.$item['ids']['plural']; - } - $messages[$id] = stripcslashes(implode('|', (array) $item['translated'])); - } - } - - fclose($stream); - - return array_filter($messages); - } - - /** - * Reads an unsigned long from stream respecting endianness. - * - * @param resource $stream - */ - private function readLong($stream, bool $isBigEndian): int - { - $result = unpack($isBigEndian ? 'N1' : 'V1', fread($stream, 4)); - $result = current($result); - - return (int) substr($result, -8); - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/PhpFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/PhpFileLoader.php deleted file mode 100644 index 93f23cd..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/PhpFileLoader.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -/** - * PhpFileLoader loads translations from PHP files returning an array of translations. - * - * @author Fabien Potencier - */ -class PhpFileLoader extends FileLoader -{ - private static ?array $cache = []; - - protected function loadResource(string $resource): array - { - if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOL))) { - self::$cache = null; - } - - if (null === self::$cache) { - return require $resource; - } - - return self::$cache[$resource] ??= require $resource; - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/PoFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/PoFileLoader.php deleted file mode 100644 index 620d973..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/PoFileLoader.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -/** - * @copyright Copyright (c) 2010, Union of RAD https://github.com/UnionOfRAD/lithium - * @copyright Copyright (c) 2012, Clemens Tolboom - */ -class PoFileLoader extends FileLoader -{ - /** - * Parses portable object (PO) format. - * - * From https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files - * we should be able to parse files having: - * - * white-space - * # translator-comments - * #. extracted-comments - * #: reference... - * #, flag... - * #| msgid previous-untranslated-string - * msgid untranslated-string - * msgstr translated-string - * - * extra or different lines are: - * - * #| msgctxt previous-context - * #| msgid previous-untranslated-string - * msgctxt context - * - * #| msgid previous-untranslated-string-singular - * #| msgid_plural previous-untranslated-string-plural - * msgid untranslated-string-singular - * msgid_plural untranslated-string-plural - * msgstr[0] translated-string-case-0 - * ... - * msgstr[N] translated-string-case-n - * - * The definition states: - * - white-space and comments are optional. - * - msgid "" that an empty singleline defines a header. - * - * This parser sacrifices some features of the reference implementation the - * differences to that implementation are as follows. - * - No support for comments spanning multiple lines. - * - Translator and extracted comments are treated as being the same type. - * - Message IDs are allowed to have other encodings as just US-ASCII. - * - * Items with an empty id are ignored. - */ - protected function loadResource(string $resource): array - { - $stream = fopen($resource, 'r'); - - $defaults = [ - 'ids' => [], - 'translated' => null, - ]; - - $messages = []; - $item = $defaults; - $flags = []; - - while ($line = fgets($stream)) { - $line = trim($line); - - if ('' === $line) { - // Whitespace indicated current item is done - if (!\in_array('fuzzy', $flags)) { - $this->addMessage($messages, $item); - } - $item = $defaults; - $flags = []; - } elseif (str_starts_with($line, '#,')) { - $flags = array_map('trim', explode(',', substr($line, 2))); - } elseif (str_starts_with($line, 'msgid "')) { - // We start a new msg so save previous - // TODO: this fails when comments or contexts are added - $this->addMessage($messages, $item); - $item = $defaults; - $item['ids']['singular'] = substr($line, 7, -1); - } elseif (str_starts_with($line, 'msgstr "')) { - $item['translated'] = substr($line, 8, -1); - } elseif ('"' === $line[0]) { - $continues = isset($item['translated']) ? 'translated' : 'ids'; - - if (\is_array($item[$continues])) { - end($item[$continues]); - $item[$continues][key($item[$continues])] .= substr($line, 1, -1); - } else { - $item[$continues] .= substr($line, 1, -1); - } - } elseif (str_starts_with($line, 'msgid_plural "')) { - $item['ids']['plural'] = substr($line, 14, -1); - } elseif (str_starts_with($line, 'msgstr[')) { - $size = strpos($line, ']'); - $item['translated'][(int) substr($line, 7, 1)] = substr($line, $size + 3, -1); - } - } - // save last item - if (!\in_array('fuzzy', $flags)) { - $this->addMessage($messages, $item); - } - fclose($stream); - - return $messages; - } - - /** - * Save a translation item to the messages. - * - * A .po file could contain by error missing plural indexes. We need to - * fix these before saving them. - */ - private function addMessage(array &$messages, array $item): void - { - if (!empty($item['ids']['singular'])) { - $id = stripcslashes($item['ids']['singular']); - if (isset($item['ids']['plural'])) { - $id .= '|'.stripcslashes($item['ids']['plural']); - } - - $translated = (array) $item['translated']; - // PO are by definition indexed so sort by index. - ksort($translated); - // Make sure every index is filled. - end($translated); - $count = key($translated); - // Fill missing spots with '-'. - $empties = array_fill(0, $count + 1, '-'); - $translated += $empties; - ksort($translated); - - $messages[$id] = stripcslashes(implode('|', $translated)); - } - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/QtFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/QtFileLoader.php deleted file mode 100644 index 235f85e..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/QtFileLoader.php +++ /dev/null @@ -1,78 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Translation\Exception\RuntimeException; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * QtFileLoader loads translations from QT Translations XML files. - * - * @author Benjamin Eberlei - */ -class QtFileLoader implements LoaderInterface -{ - public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue - { - if (!class_exists(XmlUtils::class)) { - throw new RuntimeException('Loading translations from the QT format requires the Symfony Config component.'); - } - - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - try { - $dom = XmlUtils::loadFile($resource); - } catch (\InvalidArgumentException $e) { - throw new InvalidResourceException(sprintf('Unable to load "%s".', $resource), $e->getCode(), $e); - } - - $internalErrors = libxml_use_internal_errors(true); - libxml_clear_errors(); - - $xpath = new \DOMXPath($dom); - $nodes = $xpath->evaluate('//TS/context/name[text()="'.$domain.'"]'); - - $catalogue = new MessageCatalogue($locale); - if (1 == $nodes->length) { - $translations = $nodes->item(0)->nextSibling->parentNode->parentNode->getElementsByTagName('message'); - foreach ($translations as $translation) { - $translationValue = (string) $translation->getElementsByTagName('translation')->item(0)->nodeValue; - - if (!empty($translationValue)) { - $catalogue->set( - (string) $translation->getElementsByTagName('source')->item(0)->nodeValue, - $translationValue, - $domain - ); - } - } - - if (class_exists(FileResource::class)) { - $catalogue->addResource(new FileResource($resource)); - } - } - - libxml_use_internal_errors($internalErrors); - - return $catalogue; - } -} diff --git a/tests/integration/vendor/symfony/translation/Loader/XliffFileLoader.php b/tests/integration/vendor/symfony/translation/Loader/XliffFileLoader.php deleted file mode 100644 index 34cad36..0000000 --- a/tests/integration/vendor/symfony/translation/Loader/XliffFileLoader.php +++ /dev/null @@ -1,233 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Util\Exception\InvalidXmlException; -use Symfony\Component\Config\Util\Exception\XmlParsingException; -use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Translation\Exception\RuntimeException; -use Symfony\Component\Translation\MessageCatalogue; -use Symfony\Component\Translation\Util\XliffUtils; - -/** - * XliffFileLoader loads translations from XLIFF files. - * - * @author Fabien Potencier - */ -class XliffFileLoader implements LoaderInterface -{ - public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue - { - if (!class_exists(XmlUtils::class)) { - throw new RuntimeException('Loading translations from the Xliff format requires the Symfony Config component.'); - } - - if (!$this->isXmlString($resource)) { - if (!stream_is_local($resource)) { - throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource)); - } - - if (!file_exists($resource)) { - throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource)); - } - - if (!is_file($resource)) { - throw new InvalidResourceException(sprintf('This is neither a file nor an XLIFF string "%s".', $resource)); - } - } - - try { - if ($this->isXmlString($resource)) { - $dom = XmlUtils::parse($resource); - } else { - $dom = XmlUtils::loadFile($resource); - } - } catch (\InvalidArgumentException|XmlParsingException|InvalidXmlException $e) { - throw new InvalidResourceException(sprintf('Unable to load "%s": ', $resource).$e->getMessage(), $e->getCode(), $e); - } - - if ($errors = XliffUtils::validateSchema($dom)) { - throw new InvalidResourceException(sprintf('Invalid resource provided: "%s"; Errors: ', $resource).XliffUtils::getErrorsAsString($errors)); - } - - $catalogue = new MessageCatalogue($locale); - $this->extract($dom, $catalogue, $domain); - - if (is_file($resource) && class_exists(FileResource::class)) { - $catalogue->addResource(new FileResource($resource)); - } - - return $catalogue; - } - - private function extract(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain): void - { - $xliffVersion = XliffUtils::getVersionNumber($dom); - - if ('1.2' === $xliffVersion) { - $this->extractXliff1($dom, $catalogue, $domain); - } - - if ('2.0' === $xliffVersion) { - $this->extractXliff2($dom, $catalogue, $domain); - } - } - - /** - * Extract messages and metadata from DOMDocument into a MessageCatalogue. - */ - private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain): void - { - $xml = simplexml_import_dom($dom); - $encoding = $dom->encoding ? strtoupper($dom->encoding) : null; - - $namespace = 'urn:oasis:names:tc:xliff:document:1.2'; - $xml->registerXPathNamespace('xliff', $namespace); - - foreach ($xml->xpath('//xliff:file') as $file) { - $fileAttributes = $file->attributes(); - - $file->registerXPathNamespace('xliff', $namespace); - - foreach ($file->xpath('.//xliff:prop') as $prop) { - $catalogue->setCatalogueMetadata($prop->attributes()['prop-type'], (string) $prop, $domain); - } - - foreach ($file->xpath('.//xliff:trans-unit') as $translation) { - $attributes = $translation->attributes(); - - if (!(isset($attributes['resname']) || isset($translation->source))) { - continue; - } - - $source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source; - // If the xlf file has another encoding specified, try to convert it because - // simple_xml will always return utf-8 encoded values - $target = $this->utf8ToCharset((string) ($translation->target ?? $translation->source), $encoding); - - $catalogue->set((string) $source, $target, $domain); - - $metadata = [ - 'source' => (string) $translation->source, - 'file' => [ - 'original' => (string) $fileAttributes['original'], - ], - ]; - if ($notes = $this->parseNotesMetadata($translation->note, $encoding)) { - $metadata['notes'] = $notes; - } - - if (isset($translation->target) && $translation->target->attributes()) { - $metadata['target-attributes'] = []; - foreach ($translation->target->attributes() as $key => $value) { - $metadata['target-attributes'][$key] = (string) $value; - } - } - - if (isset($attributes['id'])) { - $metadata['id'] = (string) $attributes['id']; - } - - $catalogue->setMetadata((string) $source, $metadata, $domain); - } - } - } - - private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain): void - { - $xml = simplexml_import_dom($dom); - $encoding = $dom->encoding ? strtoupper($dom->encoding) : null; - - $xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:2.0'); - - foreach ($xml->xpath('//xliff:unit') as $unit) { - foreach ($unit->segment as $segment) { - $attributes = $unit->attributes(); - $source = $attributes['name'] ?? $segment->source; - - // If the xlf file has another encoding specified, try to convert it because - // simple_xml will always return utf-8 encoded values - $target = $this->utf8ToCharset((string) ($segment->target ?? $segment->source), $encoding); - - $catalogue->set((string) $source, $target, $domain); - - $metadata = []; - if (isset($segment->target) && $segment->target->attributes()) { - $metadata['target-attributes'] = []; - foreach ($segment->target->attributes() as $key => $value) { - $metadata['target-attributes'][$key] = (string) $value; - } - } - - if (isset($unit->notes)) { - $metadata['notes'] = []; - foreach ($unit->notes->note as $noteNode) { - $note = []; - foreach ($noteNode->attributes() as $key => $value) { - $note[$key] = (string) $value; - } - $note['content'] = (string) $noteNode; - $metadata['notes'][] = $note; - } - } - - $catalogue->setMetadata((string) $source, $metadata, $domain); - } - } - } - - /** - * Convert a UTF8 string to the specified encoding. - */ - private function utf8ToCharset(string $content, string $encoding = null): string - { - if ('UTF-8' !== $encoding && !empty($encoding)) { - return mb_convert_encoding($content, $encoding, 'UTF-8'); - } - - return $content; - } - - private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, string $encoding = null): array - { - $notes = []; - - if (null === $noteElement) { - return $notes; - } - - /** @var \SimpleXMLElement $xmlNote */ - foreach ($noteElement as $xmlNote) { - $noteAttributes = $xmlNote->attributes(); - $note = ['content' => $this->utf8ToCharset((string) $xmlNote, $encoding)]; - if (isset($noteAttributes['priority'])) { - $note['priority'] = (int) $noteAttributes['priority']; - } - - if (isset($noteAttributes['from'])) { - $note['from'] = (string) $noteAttributes['from']; - } - - $notes[] = $note; - } - - return $notes; - } - - private function isXmlString(string $resource): bool - { - return str_starts_with($resource, ' - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Loader; - -use Symfony\Component\Translation\Exception\InvalidResourceException; -use Symfony\Component\Translation\Exception\LogicException; -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Parser as YamlParser; -use Symfony\Component\Yaml\Yaml; - -/** - * YamlFileLoader loads translations from Yaml files. - * - * @author Fabien Potencier - */ -class YamlFileLoader extends FileLoader -{ - private $yamlParser; - - protected function loadResource(string $resource): array - { - if (null === $this->yamlParser) { - if (!class_exists(\Symfony\Component\Yaml\Parser::class)) { - throw new LogicException('Loading translations from the YAML format requires the Symfony Yaml component.'); - } - - $this->yamlParser = new YamlParser(); - } - - try { - $messages = $this->yamlParser->parseFile($resource, Yaml::PARSE_CONSTANT); - } catch (ParseException $e) { - throw new InvalidResourceException(sprintf('The file "%s" does not contain valid YAML: ', $resource).$e->getMessage(), 0, $e); - } - - if (null !== $messages && !\is_array($messages)) { - throw new InvalidResourceException(sprintf('Unable to load file "%s".', $resource)); - } - - return $messages ?: []; - } -} diff --git a/tests/integration/vendor/symfony/translation/LoggingTranslator.php b/tests/integration/vendor/symfony/translation/LoggingTranslator.php deleted file mode 100644 index e107bf2..0000000 --- a/tests/integration/vendor/symfony/translation/LoggingTranslator.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Psr\Log\LoggerInterface; -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Contracts\Translation\LocaleAwareInterface; -use Symfony\Contracts\Translation\TranslatorInterface; - -/** - * @author Abdellatif Ait boudad - */ -class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface -{ - private TranslatorInterface $translator; - private LoggerInterface $logger; - - /** - * @param TranslatorInterface&TranslatorBagInterface&LocaleAwareInterface $translator The translator must implement TranslatorBagInterface - */ - public function __construct(TranslatorInterface $translator, LoggerInterface $logger) - { - if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) { - throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', get_debug_type($translator))); - } - - $this->translator = $translator; - $this->logger = $logger; - } - - public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string - { - $trans = $this->translator->trans($id = (string) $id, $parameters, $domain, $locale); - $this->log($id, $domain, $locale); - - return $trans; - } - - /** - * @return void - */ - public function setLocale(string $locale) - { - $prev = $this->translator->getLocale(); - $this->translator->setLocale($locale); - if ($prev === $locale) { - return; - } - - $this->logger->debug(sprintf('The locale of the translator has changed from "%s" to "%s".', $prev, $locale)); - } - - public function getLocale(): string - { - return $this->translator->getLocale(); - } - - public function getCatalogue(string $locale = null): MessageCatalogueInterface - { - return $this->translator->getCatalogue($locale); - } - - public function getCatalogues(): array - { - return $this->translator->getCatalogues(); - } - - /** - * Gets the fallback locales. - */ - public function getFallbackLocales(): array - { - if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) { - return $this->translator->getFallbackLocales(); - } - - return []; - } - - /** - * Passes through all unknown calls onto the translator object. - */ - public function __call(string $method, array $args) - { - return $this->translator->{$method}(...$args); - } - - /** - * Logs for missing translations. - */ - private function log(string $id, ?string $domain, ?string $locale): void - { - $domain ??= 'messages'; - - $catalogue = $this->translator->getCatalogue($locale); - if ($catalogue->defines($id, $domain)) { - return; - } - - if ($catalogue->has($id, $domain)) { - $this->logger->debug('Translation use fallback catalogue.', ['id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale()]); - } else { - $this->logger->warning('Translation not found.', ['id' => $id, 'domain' => $domain, 'locale' => $catalogue->getLocale()]); - } - } -} diff --git a/tests/integration/vendor/symfony/translation/MessageCatalogue.php b/tests/integration/vendor/symfony/translation/MessageCatalogue.php deleted file mode 100644 index 379d947..0000000 --- a/tests/integration/vendor/symfony/translation/MessageCatalogue.php +++ /dev/null @@ -1,338 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\Config\Resource\ResourceInterface; -use Symfony\Component\Translation\Exception\LogicException; - -/** - * @author Fabien Potencier - */ -class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterface, CatalogueMetadataAwareInterface -{ - private array $messages = []; - private array $metadata = []; - private array $catalogueMetadata = []; - private array $resources = []; - private string $locale; - private ?MessageCatalogueInterface $fallbackCatalogue = null; - private ?self $parent = null; - - /** - * @param array $messages An array of messages classified by domain - */ - public function __construct(string $locale, array $messages = []) - { - $this->locale = $locale; - $this->messages = $messages; - } - - public function getLocale(): string - { - return $this->locale; - } - - public function getDomains(): array - { - $domains = []; - - foreach ($this->messages as $domain => $messages) { - if (str_ends_with($domain, self::INTL_DOMAIN_SUFFIX)) { - $domain = substr($domain, 0, -\strlen(self::INTL_DOMAIN_SUFFIX)); - } - $domains[$domain] = $domain; - } - - return array_values($domains); - } - - public function all(string $domain = null): array - { - if (null !== $domain) { - // skip messages merge if intl-icu requested explicitly - if (str_ends_with($domain, self::INTL_DOMAIN_SUFFIX)) { - return $this->messages[$domain] ?? []; - } - - return ($this->messages[$domain.self::INTL_DOMAIN_SUFFIX] ?? []) + ($this->messages[$domain] ?? []); - } - - $allMessages = []; - - foreach ($this->messages as $domain => $messages) { - if (str_ends_with($domain, self::INTL_DOMAIN_SUFFIX)) { - $domain = substr($domain, 0, -\strlen(self::INTL_DOMAIN_SUFFIX)); - $allMessages[$domain] = $messages + ($allMessages[$domain] ?? []); - } else { - $allMessages[$domain] = ($allMessages[$domain] ?? []) + $messages; - } - } - - return $allMessages; - } - - /** - * @return void - */ - public function set(string $id, string $translation, string $domain = 'messages') - { - $this->add([$id => $translation], $domain); - } - - public function has(string $id, string $domain = 'messages'): bool - { - if (isset($this->messages[$domain][$id]) || isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) { - return true; - } - - if (null !== $this->fallbackCatalogue) { - return $this->fallbackCatalogue->has($id, $domain); - } - - return false; - } - - public function defines(string $id, string $domain = 'messages'): bool - { - return isset($this->messages[$domain][$id]) || isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id]); - } - - public function get(string $id, string $domain = 'messages'): string - { - if (isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) { - return $this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id]; - } - - if (isset($this->messages[$domain][$id])) { - return $this->messages[$domain][$id]; - } - - if (null !== $this->fallbackCatalogue) { - return $this->fallbackCatalogue->get($id, $domain); - } - - return $id; - } - - /** - * @return void - */ - public function replace(array $messages, string $domain = 'messages') - { - unset($this->messages[$domain], $this->messages[$domain.self::INTL_DOMAIN_SUFFIX]); - - $this->add($messages, $domain); - } - - /** - * @return void - */ - public function add(array $messages, string $domain = 'messages') - { - $altDomain = str_ends_with($domain, self::INTL_DOMAIN_SUFFIX) ? substr($domain, 0, -\strlen(self::INTL_DOMAIN_SUFFIX)) : $domain.self::INTL_DOMAIN_SUFFIX; - foreach ($messages as $id => $message) { - unset($this->messages[$altDomain][$id]); - $this->messages[$domain][$id] = $message; - } - - if ([] === ($this->messages[$altDomain] ?? null)) { - unset($this->messages[$altDomain]); - } - } - - /** - * @return void - */ - public function addCatalogue(MessageCatalogueInterface $catalogue) - { - if ($catalogue->getLocale() !== $this->locale) { - throw new LogicException(sprintf('Cannot add a catalogue for locale "%s" as the current locale for this catalogue is "%s".', $catalogue->getLocale(), $this->locale)); - } - - foreach ($catalogue->all() as $domain => $messages) { - if ($intlMessages = $catalogue->all($domain.self::INTL_DOMAIN_SUFFIX)) { - $this->add($intlMessages, $domain.self::INTL_DOMAIN_SUFFIX); - $messages = array_diff_key($messages, $intlMessages); - } - $this->add($messages, $domain); - } - - foreach ($catalogue->getResources() as $resource) { - $this->addResource($resource); - } - - if ($catalogue instanceof MetadataAwareInterface) { - $metadata = $catalogue->getMetadata('', ''); - $this->addMetadata($metadata); - } - - if ($catalogue instanceof CatalogueMetadataAwareInterface) { - $catalogueMetadata = $catalogue->getCatalogueMetadata('', ''); - $this->addCatalogueMetadata($catalogueMetadata); - } - } - - /** - * @return void - */ - public function addFallbackCatalogue(MessageCatalogueInterface $catalogue) - { - // detect circular references - $c = $catalogue; - while ($c = $c->getFallbackCatalogue()) { - if ($c->getLocale() === $this->getLocale()) { - throw new LogicException(sprintf('Circular reference detected when adding a fallback catalogue for locale "%s".', $catalogue->getLocale())); - } - } - - $c = $this; - do { - if ($c->getLocale() === $catalogue->getLocale()) { - throw new LogicException(sprintf('Circular reference detected when adding a fallback catalogue for locale "%s".', $catalogue->getLocale())); - } - - foreach ($catalogue->getResources() as $resource) { - $c->addResource($resource); - } - } while ($c = $c->parent); - - $catalogue->parent = $this; - $this->fallbackCatalogue = $catalogue; - - foreach ($catalogue->getResources() as $resource) { - $this->addResource($resource); - } - } - - public function getFallbackCatalogue(): ?MessageCatalogueInterface - { - return $this->fallbackCatalogue; - } - - public function getResources(): array - { - return array_values($this->resources); - } - - /** - * @return void - */ - public function addResource(ResourceInterface $resource) - { - $this->resources[$resource->__toString()] = $resource; - } - - public function getMetadata(string $key = '', string $domain = 'messages'): mixed - { - if ('' == $domain) { - return $this->metadata; - } - - if (isset($this->metadata[$domain])) { - if ('' == $key) { - return $this->metadata[$domain]; - } - - if (isset($this->metadata[$domain][$key])) { - return $this->metadata[$domain][$key]; - } - } - - return null; - } - - /** - * @return void - */ - public function setMetadata(string $key, mixed $value, string $domain = 'messages') - { - $this->metadata[$domain][$key] = $value; - } - - /** - * @return void - */ - public function deleteMetadata(string $key = '', string $domain = 'messages') - { - if ('' == $domain) { - $this->metadata = []; - } elseif ('' == $key) { - unset($this->metadata[$domain]); - } else { - unset($this->metadata[$domain][$key]); - } - } - - public function getCatalogueMetadata(string $key = '', string $domain = 'messages'): mixed - { - if (!$domain) { - return $this->catalogueMetadata; - } - - if (isset($this->catalogueMetadata[$domain])) { - if (!$key) { - return $this->catalogueMetadata[$domain]; - } - - if (isset($this->catalogueMetadata[$domain][$key])) { - return $this->catalogueMetadata[$domain][$key]; - } - } - - return null; - } - - /** - * @return void - */ - public function setCatalogueMetadata(string $key, mixed $value, string $domain = 'messages') - { - $this->catalogueMetadata[$domain][$key] = $value; - } - - /** - * @return void - */ - public function deleteCatalogueMetadata(string $key = '', string $domain = 'messages') - { - if (!$domain) { - $this->catalogueMetadata = []; - } elseif (!$key) { - unset($this->catalogueMetadata[$domain]); - } else { - unset($this->catalogueMetadata[$domain][$key]); - } - } - - /** - * Adds current values with the new values. - * - * @param array $values Values to add - */ - private function addMetadata(array $values): void - { - foreach ($values as $domain => $keys) { - foreach ($keys as $key => $value) { - $this->setMetadata($key, $value, $domain); - } - } - } - - private function addCatalogueMetadata(array $values): void - { - foreach ($values as $domain => $keys) { - foreach ($keys as $key => $value) { - $this->setCatalogueMetadata($key, $value, $domain); - } - } - } -} diff --git a/tests/integration/vendor/symfony/translation/MessageCatalogueInterface.php b/tests/integration/vendor/symfony/translation/MessageCatalogueInterface.php deleted file mode 100644 index ed819f1..0000000 --- a/tests/integration/vendor/symfony/translation/MessageCatalogueInterface.php +++ /dev/null @@ -1,134 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\Config\Resource\ResourceInterface; - -/** - * MessageCatalogueInterface. - * - * @author Fabien Potencier - */ -interface MessageCatalogueInterface -{ - public const INTL_DOMAIN_SUFFIX = '+intl-icu'; - - /** - * Gets the catalogue locale. - */ - public function getLocale(): string; - - /** - * Gets the domains. - */ - public function getDomains(): array; - - /** - * Gets the messages within a given domain. - * - * If $domain is null, it returns all messages. - */ - public function all(string $domain = null): array; - - /** - * Sets a message translation. - * - * @param string $id The message id - * @param string $translation The messages translation - * @param string $domain The domain name - * - * @return void - */ - public function set(string $id, string $translation, string $domain = 'messages'); - - /** - * Checks if a message has a translation. - * - * @param string $id The message id - * @param string $domain The domain name - */ - public function has(string $id, string $domain = 'messages'): bool; - - /** - * Checks if a message has a translation (it does not take into account the fallback mechanism). - * - * @param string $id The message id - * @param string $domain The domain name - */ - public function defines(string $id, string $domain = 'messages'): bool; - - /** - * Gets a message translation. - * - * @param string $id The message id - * @param string $domain The domain name - */ - public function get(string $id, string $domain = 'messages'): string; - - /** - * Sets translations for a given domain. - * - * @param array $messages An array of translations - * @param string $domain The domain name - * - * @return void - */ - public function replace(array $messages, string $domain = 'messages'); - - /** - * Adds translations for a given domain. - * - * @param array $messages An array of translations - * @param string $domain The domain name - * - * @return void - */ - public function add(array $messages, string $domain = 'messages'); - - /** - * Merges translations from the given Catalogue into the current one. - * - * The two catalogues must have the same locale. - * - * @return void - */ - public function addCatalogue(self $catalogue); - - /** - * Merges translations from the given Catalogue into the current one - * only when the translation does not exist. - * - * This is used to provide default translations when they do not exist for the current locale. - * - * @return void - */ - public function addFallbackCatalogue(self $catalogue); - - /** - * Gets the fallback catalogue. - */ - public function getFallbackCatalogue(): ?self; - - /** - * Returns an array of resources loaded to build this collection. - * - * @return ResourceInterface[] - */ - public function getResources(): array; - - /** - * Adds a resource for this collection. - * - * @return void - */ - public function addResource(ResourceInterface $resource); -} diff --git a/tests/integration/vendor/symfony/translation/MetadataAwareInterface.php b/tests/integration/vendor/symfony/translation/MetadataAwareInterface.php deleted file mode 100644 index 39e5326..0000000 --- a/tests/integration/vendor/symfony/translation/MetadataAwareInterface.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -/** - * This interface is used to get, set, and delete metadata about the translation messages. - * - * @author Fabien Potencier - */ -interface MetadataAwareInterface -{ - /** - * Gets metadata for the given domain and key. - * - * Passing an empty domain will return an array with all metadata indexed by - * domain and then by key. Passing an empty key will return an array with all - * metadata for the given domain. - * - * @return mixed The value that was set or an array with the domains/keys or null - */ - public function getMetadata(string $key = '', string $domain = 'messages'): mixed; - - /** - * Adds metadata to a message domain. - * - * @return void - */ - public function setMetadata(string $key, mixed $value, string $domain = 'messages'); - - /** - * Deletes metadata for the given key and domain. - * - * Passing an empty domain will delete all metadata. Passing an empty key will - * delete all metadata for the given domain. - * - * @return void - */ - public function deleteMetadata(string $key = '', string $domain = 'messages'); -} diff --git a/tests/integration/vendor/symfony/translation/README.md b/tests/integration/vendor/symfony/translation/README.md deleted file mode 100644 index 8c981a6..0000000 --- a/tests/integration/vendor/symfony/translation/README.md +++ /dev/null @@ -1,46 +0,0 @@ -Translation Component -===================== - -The Translation component provides tools to internationalize your application. - -Getting Started ---------------- - -``` -$ composer require symfony/translation -``` - -```php -use Symfony\Component\Translation\Translator; -use Symfony\Component\Translation\Loader\ArrayLoader; - -$translator = new Translator('fr_FR'); -$translator->addLoader('array', new ArrayLoader()); -$translator->addResource('array', [ - 'Hello World!' => 'Bonjour !', -], 'fr_FR'); - -echo $translator->trans('Hello World!'); // outputs « Bonjour ! » -``` - -Sponsor -------- - -The Translation component for Symfony 6.3 is [backed][1] by: - - * [Crowdin][2], a cloud-based localization management software helping teams to go global and stay agile. - -Help Symfony by [sponsoring][3] its development! - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/translation.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) - -[1]: https://symfony.com/backers -[2]: https://crowdin.com -[3]: https://symfony.com/sponsor diff --git a/tests/integration/vendor/symfony/translation/Translator.php b/tests/integration/vendor/symfony/translation/Translator.php deleted file mode 100644 index 132138e..0000000 --- a/tests/integration/vendor/symfony/translation/Translator.php +++ /dev/null @@ -1,472 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\Config\ConfigCacheFactory; -use Symfony\Component\Config\ConfigCacheFactoryInterface; -use Symfony\Component\Config\ConfigCacheInterface; -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Translation\Exception\RuntimeException; -use Symfony\Component\Translation\Formatter\IntlFormatterInterface; -use Symfony\Component\Translation\Formatter\MessageFormatter; -use Symfony\Component\Translation\Formatter\MessageFormatterInterface; -use Symfony\Component\Translation\Loader\LoaderInterface; -use Symfony\Contracts\Translation\LocaleAwareInterface; -use Symfony\Contracts\Translation\TranslatableInterface; -use Symfony\Contracts\Translation\TranslatorInterface; - -// Help opcache.preload discover always-needed symbols -class_exists(MessageCatalogue::class); - -/** - * @author Fabien Potencier - */ -class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface -{ - /** - * @var MessageCatalogueInterface[] - */ - protected $catalogues = []; - - private string $locale; - - /** - * @var string[] - */ - private array $fallbackLocales = []; - - /** - * @var LoaderInterface[] - */ - private array $loaders = []; - - private array $resources = []; - - private MessageFormatterInterface $formatter; - - private ?string $cacheDir; - - private bool $debug; - - private array $cacheVary; - - private ?ConfigCacheFactoryInterface $configCacheFactory; - - private array $parentLocales; - - private bool $hasIntlFormatter; - - /** - * @throws InvalidArgumentException If a locale contains invalid characters - */ - public function __construct(string $locale, MessageFormatterInterface $formatter = null, string $cacheDir = null, bool $debug = false, array $cacheVary = []) - { - $this->setLocale($locale); - - $this->formatter = $formatter ??= new MessageFormatter(); - $this->cacheDir = $cacheDir; - $this->debug = $debug; - $this->cacheVary = $cacheVary; - $this->hasIntlFormatter = $formatter instanceof IntlFormatterInterface; - } - - /** - * @return void - */ - public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) - { - $this->configCacheFactory = $configCacheFactory; - } - - /** - * Adds a Loader. - * - * @param string $format The name of the loader (@see addResource()) - * - * @return void - */ - public function addLoader(string $format, LoaderInterface $loader) - { - $this->loaders[$format] = $loader; - } - - /** - * Adds a Resource. - * - * @param string $format The name of the loader (@see addLoader()) - * @param mixed $resource The resource name - * - * @return void - * - * @throws InvalidArgumentException If the locale contains invalid characters - */ - public function addResource(string $format, mixed $resource, string $locale, string $domain = null) - { - $domain ??= 'messages'; - - $this->assertValidLocale($locale); - $locale ?: $locale = class_exists(\Locale::class) ? \Locale::getDefault() : 'en'; - - $this->resources[$locale][] = [$format, $resource, $domain]; - - if (\in_array($locale, $this->fallbackLocales)) { - $this->catalogues = []; - } else { - unset($this->catalogues[$locale]); - } - } - - /** - * @return void - */ - public function setLocale(string $locale) - { - $this->assertValidLocale($locale); - $this->locale = $locale; - } - - public function getLocale(): string - { - return $this->locale ?: (class_exists(\Locale::class) ? \Locale::getDefault() : 'en'); - } - - /** - * Sets the fallback locales. - * - * @param string[] $locales - * - * @return void - * - * @throws InvalidArgumentException If a locale contains invalid characters - */ - public function setFallbackLocales(array $locales) - { - // needed as the fallback locales are linked to the already loaded catalogues - $this->catalogues = []; - - foreach ($locales as $locale) { - $this->assertValidLocale($locale); - } - - $this->fallbackLocales = $this->cacheVary['fallback_locales'] = $locales; - } - - /** - * Gets the fallback locales. - * - * @internal - */ - public function getFallbackLocales(): array - { - return $this->fallbackLocales; - } - - public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string - { - if (null === $id || '' === $id) { - return ''; - } - - $domain ??= 'messages'; - - $catalogue = $this->getCatalogue($locale); - $locale = $catalogue->getLocale(); - while (!$catalogue->defines($id, $domain)) { - if ($cat = $catalogue->getFallbackCatalogue()) { - $catalogue = $cat; - $locale = $catalogue->getLocale(); - } else { - break; - } - } - - $parameters = array_map(fn ($parameter) => $parameter instanceof TranslatableInterface ? $parameter->trans($this, $locale) : $parameter, $parameters); - - $len = \strlen(MessageCatalogue::INTL_DOMAIN_SUFFIX); - if ($this->hasIntlFormatter - && ($catalogue->defines($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX) - || (\strlen($domain) > $len && 0 === substr_compare($domain, MessageCatalogue::INTL_DOMAIN_SUFFIX, -$len, $len))) - ) { - return $this->formatter->formatIntl($catalogue->get($id, $domain), $locale, $parameters); - } - - return $this->formatter->format($catalogue->get($id, $domain), $locale, $parameters); - } - - public function getCatalogue(string $locale = null): MessageCatalogueInterface - { - if (!$locale) { - $locale = $this->getLocale(); - } else { - $this->assertValidLocale($locale); - } - - if (!isset($this->catalogues[$locale])) { - $this->loadCatalogue($locale); - } - - return $this->catalogues[$locale]; - } - - public function getCatalogues(): array - { - return array_values($this->catalogues); - } - - /** - * Gets the loaders. - * - * @return LoaderInterface[] - */ - protected function getLoaders(): array - { - return $this->loaders; - } - - /** - * @return void - */ - protected function loadCatalogue(string $locale) - { - if (null === $this->cacheDir) { - $this->initializeCatalogue($locale); - } else { - $this->initializeCacheCatalogue($locale); - } - } - - /** - * @return void - */ - protected function initializeCatalogue(string $locale) - { - $this->assertValidLocale($locale); - - try { - $this->doLoadCatalogue($locale); - } catch (NotFoundResourceException $e) { - if (!$this->computeFallbackLocales($locale)) { - throw $e; - } - } - $this->loadFallbackCatalogues($locale); - } - - private function initializeCacheCatalogue(string $locale): void - { - if (isset($this->catalogues[$locale])) { - /* Catalogue already initialized. */ - return; - } - - $this->assertValidLocale($locale); - $cache = $this->getConfigCacheFactory()->cache($this->getCatalogueCachePath($locale), - function (ConfigCacheInterface $cache) use ($locale) { - $this->dumpCatalogue($locale, $cache); - } - ); - - if (isset($this->catalogues[$locale])) { - /* Catalogue has been initialized as it was written out to cache. */ - return; - } - - /* Read catalogue from cache. */ - $this->catalogues[$locale] = include $cache->getPath(); - } - - private function dumpCatalogue(string $locale, ConfigCacheInterface $cache): void - { - $this->initializeCatalogue($locale); - $fallbackContent = $this->getFallbackContent($this->catalogues[$locale]); - - $content = sprintf(<<getAllMessages($this->catalogues[$locale]), true), - $fallbackContent - ); - - $cache->write($content, $this->catalogues[$locale]->getResources()); - } - - private function getFallbackContent(MessageCatalogue $catalogue): string - { - $fallbackContent = ''; - $current = ''; - $replacementPattern = '/[^a-z0-9_]/i'; - $fallbackCatalogue = $catalogue->getFallbackCatalogue(); - while ($fallbackCatalogue) { - $fallback = $fallbackCatalogue->getLocale(); - $fallbackSuffix = ucfirst(preg_replace($replacementPattern, '_', $fallback)); - $currentSuffix = ucfirst(preg_replace($replacementPattern, '_', $current)); - - $fallbackContent .= sprintf(<<<'EOF' -$catalogue%s = new MessageCatalogue('%s', %s); -$catalogue%s->addFallbackCatalogue($catalogue%s); - -EOF - , - $fallbackSuffix, - $fallback, - var_export($this->getAllMessages($fallbackCatalogue), true), - $currentSuffix, - $fallbackSuffix - ); - $current = $fallbackCatalogue->getLocale(); - $fallbackCatalogue = $fallbackCatalogue->getFallbackCatalogue(); - } - - return $fallbackContent; - } - - private function getCatalogueCachePath(string $locale): string - { - return $this->cacheDir.'/catalogue.'.$locale.'.'.strtr(substr(base64_encode(hash('sha256', serialize($this->cacheVary), true)), 0, 7), '/', '_').'.php'; - } - - /** - * @internal - */ - protected function doLoadCatalogue(string $locale): void - { - $this->catalogues[$locale] = new MessageCatalogue($locale); - - if (isset($this->resources[$locale])) { - foreach ($this->resources[$locale] as $resource) { - if (!isset($this->loaders[$resource[0]])) { - if (\is_string($resource[1])) { - throw new RuntimeException(sprintf('No loader is registered for the "%s" format when loading the "%s" resource.', $resource[0], $resource[1])); - } - - throw new RuntimeException(sprintf('No loader is registered for the "%s" format.', $resource[0])); - } - $this->catalogues[$locale]->addCatalogue($this->loaders[$resource[0]]->load($resource[1], $locale, $resource[2])); - } - } - } - - private function loadFallbackCatalogues(string $locale): void - { - $current = $this->catalogues[$locale]; - - foreach ($this->computeFallbackLocales($locale) as $fallback) { - if (!isset($this->catalogues[$fallback])) { - $this->initializeCatalogue($fallback); - } - - $fallbackCatalogue = new MessageCatalogue($fallback, $this->getAllMessages($this->catalogues[$fallback])); - foreach ($this->catalogues[$fallback]->getResources() as $resource) { - $fallbackCatalogue->addResource($resource); - } - $current->addFallbackCatalogue($fallbackCatalogue); - $current = $fallbackCatalogue; - } - } - - /** - * @return array - */ - protected function computeFallbackLocales(string $locale) - { - $this->parentLocales ??= json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'), true); - - $originLocale = $locale; - $locales = []; - - while ($locale) { - $parent = $this->parentLocales[$locale] ?? null; - - if ($parent) { - $locale = 'root' !== $parent ? $parent : null; - } elseif (\function_exists('locale_parse')) { - $localeSubTags = locale_parse($locale); - $locale = null; - if (1 < \count($localeSubTags)) { - array_pop($localeSubTags); - $locale = locale_compose($localeSubTags) ?: null; - } - } elseif ($i = strrpos($locale, '_') ?: strrpos($locale, '-')) { - $locale = substr($locale, 0, $i); - } else { - $locale = null; - } - - if (null !== $locale) { - $locales[] = $locale; - } - } - - foreach ($this->fallbackLocales as $fallback) { - if ($fallback === $originLocale) { - continue; - } - - $locales[] = $fallback; - } - - return array_unique($locales); - } - - /** - * Asserts that the locale is valid, throws an Exception if not. - * - * @return void - * - * @throws InvalidArgumentException If the locale contains invalid characters - */ - protected function assertValidLocale(string $locale) - { - if (!preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) { - throw new InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale)); - } - } - - /** - * Provides the ConfigCache factory implementation, falling back to a - * default implementation if necessary. - */ - private function getConfigCacheFactory(): ConfigCacheFactoryInterface - { - $this->configCacheFactory ??= new ConfigCacheFactory($this->debug); - - return $this->configCacheFactory; - } - - private function getAllMessages(MessageCatalogueInterface $catalogue): array - { - $allMessages = []; - - foreach ($catalogue->all() as $domain => $messages) { - if ($intlMessages = $catalogue->all($domain.MessageCatalogue::INTL_DOMAIN_SUFFIX)) { - $allMessages[$domain.MessageCatalogue::INTL_DOMAIN_SUFFIX] = $intlMessages; - $messages = array_diff_key($messages, $intlMessages); - } - if ($messages) { - $allMessages[$domain] = $messages; - } - } - - return $allMessages; - } -} diff --git a/tests/integration/vendor/symfony/translation/TranslatorBagInterface.php b/tests/integration/vendor/symfony/translation/TranslatorBagInterface.php deleted file mode 100644 index a787acf..0000000 --- a/tests/integration/vendor/symfony/translation/TranslatorBagInterface.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation; - -use Symfony\Component\Translation\Exception\InvalidArgumentException; - -/** - * @author Abdellatif Ait boudad - */ -interface TranslatorBagInterface -{ - /** - * Gets the catalogue by locale. - * - * @param string|null $locale The locale or null to use the default - * - * @throws InvalidArgumentException If the locale contains invalid characters - */ - public function getCatalogue(string $locale = null): MessageCatalogueInterface; - - /** - * Returns all catalogues of the instance. - * - * @return MessageCatalogueInterface[] - */ - public function getCatalogues(): array; -} diff --git a/tests/integration/vendor/symfony/translation/Util/ArrayConverter.php b/tests/integration/vendor/symfony/translation/Util/ArrayConverter.php deleted file mode 100644 index 8938e54..0000000 --- a/tests/integration/vendor/symfony/translation/Util/ArrayConverter.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Util; - -/** - * ArrayConverter generates tree like structure from a message catalogue. - * e.g. this - * 'foo.bar1' => 'test1', - * 'foo.bar2' => 'test2' - * converts to follows: - * foo: - * bar1: test1 - * bar2: test2. - * - * @author Gennady Telegin - */ -class ArrayConverter -{ - /** - * Converts linear messages array to tree-like array. - * For example this array('foo.bar' => 'value') will be converted to ['foo' => ['bar' => 'value']]. - * - * @param array $messages Linear messages array - */ - public static function expandToTree(array $messages): array - { - $tree = []; - - foreach ($messages as $id => $value) { - $referenceToElement = &self::getElementByPath($tree, explode('.', $id)); - - $referenceToElement = $value; - - unset($referenceToElement); - } - - return $tree; - } - - private static function &getElementByPath(array &$tree, array $parts): mixed - { - $elem = &$tree; - $parentOfElem = null; - - foreach ($parts as $i => $part) { - if (isset($elem[$part]) && \is_string($elem[$part])) { - /* Process next case: - * 'foo': 'test1', - * 'foo.bar': 'test2' - * - * $tree['foo'] was string before we found array {bar: test2}. - * Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2'; - */ - $elem = &$elem[implode('.', \array_slice($parts, $i))]; - break; - } - $parentOfElem = &$elem; - $elem = &$elem[$part]; - } - - if ($elem && \is_array($elem) && $parentOfElem) { - /* Process next case: - * 'foo.bar': 'test1' - * 'foo': 'test2' - * - * $tree['foo'] was array = {bar: 'test1'} before we found string constant `foo`. - * Cancel treating $tree['foo'] as array and cancel back it expansion, - * e.g. make it $tree['foo.bar'] = 'test1' again. - */ - self::cancelExpand($parentOfElem, $part, $elem); - } - - return $elem; - } - - private static function cancelExpand(array &$tree, string $prefix, array $node): void - { - $prefix .= '.'; - - foreach ($node as $id => $value) { - if (\is_string($value)) { - $tree[$prefix.$id] = $value; - } else { - self::cancelExpand($tree, $prefix.$id, $value); - } - } - } -} diff --git a/tests/integration/vendor/symfony/translation/Writer/TranslationWriter.php b/tests/integration/vendor/symfony/translation/Writer/TranslationWriter.php deleted file mode 100644 index 61e03cb..0000000 --- a/tests/integration/vendor/symfony/translation/Writer/TranslationWriter.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Translation\Writer; - -use Symfony\Component\Translation\Dumper\DumperInterface; -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Translation\Exception\RuntimeException; -use Symfony\Component\Translation\MessageCatalogue; - -/** - * TranslationWriter writes translation messages. - * - * @author Michel Salib - */ -class TranslationWriter implements TranslationWriterInterface -{ - /** - * @var array - */ - private array $dumpers = []; - - /** - * Adds a dumper to the writer. - * - * @return void - */ - public function addDumper(string $format, DumperInterface $dumper) - { - $this->dumpers[$format] = $dumper; - } - - /** - * Obtains the list of supported formats. - */ - public function getFormats(): array - { - return array_keys($this->dumpers); - } - - /** - * Writes translation from the catalogue according to the selected format. - * - * @param string $format The format to use to dump the messages - * @param array $options Options that are passed to the dumper - * - * @return void - * - * @throws InvalidArgumentException - */ - public function write(MessageCatalogue $catalogue, string $format, array $options = []) - { - if (!isset($this->dumpers[$format])) { - throw new InvalidArgumentException(sprintf('There is no dumper associated with format "%s".', $format)); - } - - // get the right dumper - $dumper = $this->dumpers[$format]; - - if (isset($options['path']) && !is_dir($options['path']) && !@mkdir($options['path'], 0777, true) && !is_dir($options['path'])) { - throw new RuntimeException(sprintf('Translation Writer was not able to create directory "%s".', $options['path'])); - } - - // save - $dumper->dump($catalogue, $options); - } -} diff --git a/tests/integration/vendor/symfony/translation/composer.json b/tests/integration/vendor/symfony/translation/composer.json deleted file mode 100644 index ee8e415..0000000 --- a/tests/integration/vendor/symfony/translation/composer.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "symfony/translation", - "type": "library", - "description": "Provides tools to internationalize your application", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.5|^3.0" - }, - "require-dev": { - "nikic/php-parser": "^4.13", - "symfony/config": "^5.4|^6.0", - "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/http-client-contracts": "^2.5|^3.0", - "symfony/http-kernel": "^5.4|^6.0", - "symfony/intl": "^5.4|^6.0", - "symfony/polyfill-intl-icu": "^1.21", - "symfony/routing": "^5.4|^6.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", - "psr/log": "^1|^2|^3" - }, - "conflict": { - "symfony/config": "<5.4", - "symfony/dependency-injection": "<5.4", - "symfony/http-client-contracts": "<2.5", - "symfony/http-kernel": "<5.4", - "symfony/service-contracts": "<2.5", - "symfony/twig-bundle": "<5.4", - "symfony/yaml": "<5.4", - "symfony/console": "<5.4" - }, - "provide": { - "symfony/translation-implementation": "2.3|3.0" - }, - "autoload": { - "files": [ "Resources/functions.php" ], - "psr-4": { "Symfony\\Component\\Translation\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "minimum-stability": "dev" -} diff --git a/tests/integration/vendor/symfony/yaml/CHANGELOG.md b/tests/integration/vendor/symfony/yaml/CHANGELOG.md deleted file mode 100644 index 0c2021f..0000000 --- a/tests/integration/vendor/symfony/yaml/CHANGELOG.md +++ /dev/null @@ -1,253 +0,0 @@ -CHANGELOG -========= - -6.3 ---- - - * Add support to dump int keys as strings by using the `Yaml::DUMP_NUMERIC_KEY_AS_STRING` flag - -6.2 ---- - - * Add support for `!php/enum` and `!php/enum *->value` - * Deprecate the `!php/const:` tag in key which will be replaced by the `!php/const` tag (without the colon) since 3.4 - -6.1 ---- - - * In cases where it will likely improve readability, strings containing single quotes will be double-quoted - -5.4 ---- - - * Add new `lint:yaml dirname --exclude=/dirname/foo.yaml --exclude=/dirname/bar.yaml` - option to exclude one or more specific files from multiple file list - * Allow negatable for the parse tags option with `--no-parse-tags` - -5.3 ---- - - * Added `github` format support & autodetection to render errors as annotations - when running the YAML linter command in a Github Action environment. - -5.1.0 ------ - - * Added support for parsing numbers prefixed with `0o` as octal numbers. - * Deprecated support for parsing numbers starting with `0` as octal numbers. They will be parsed as strings as of Symfony 6.0. Prefix numbers with `0o` - so that they are parsed as octal numbers. - - Before: - - ```yaml - Yaml::parse('072'); - ``` - - After: - - ```yaml - Yaml::parse('0o72'); - ``` - - * Added `yaml-lint` binary. - * Deprecated using the `!php/object` and `!php/const` tags without a value. - -5.0.0 ------ - - * Removed support for mappings inside multi-line strings. - * removed support for implicit STDIN usage in the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. - -4.4.0 ------ - - * Added support for parsing the inline notation spanning multiple lines. - * Added support to dump `null` as `~` by using the `Yaml::DUMP_NULL_AS_TILDE` flag. - * deprecated accepting STDIN implicitly when using the `lint:yaml` command, use `lint:yaml -` (append a dash) instead to make it explicit. - -4.3.0 ------ - - * Using a mapping inside a multi-line string is deprecated and will throw a `ParseException` in 5.0. - -4.2.0 ------ - - * added support for multiple files or directories in `LintCommand` - -4.0.0 ------ - - * The behavior of the non-specific tag `!` is changed and now forces - non-evaluating your values. - * complex mappings will throw a `ParseException` - * support for the comma as a group separator for floats has been dropped, use - the underscore instead - * support for the `!!php/object` tag has been dropped, use the `!php/object` - tag instead - * duplicate mapping keys throw a `ParseException` - * non-string mapping keys throw a `ParseException`, use the `Yaml::PARSE_KEYS_AS_STRINGS` - flag to cast them to strings - * `%` at the beginning of an unquoted string throw a `ParseException` - * mappings with a colon (`:`) that is not followed by a whitespace throw a - `ParseException` - * the `Dumper::setIndentation()` method has been removed - * being able to pass boolean options to the `Yaml::parse()`, `Yaml::dump()`, - `Parser::parse()`, and `Dumper::dump()` methods to configure the behavior of - the parser and dumper is no longer supported, pass bitmask flags instead - * the constructor arguments of the `Parser` class have been removed - * the `Inline` class is internal and no longer part of the BC promise - * removed support for the `!str` tag, use the `!!str` tag instead - * added support for tagged scalars. - - ```yml - Yaml::parse('!foo bar', Yaml::PARSE_CUSTOM_TAGS); - // returns TaggedValue('foo', 'bar'); - ``` - -3.4.0 ------ - - * added support for parsing YAML files using the `Yaml::parseFile()` or `Parser::parseFile()` method - - * the `Dumper`, `Parser`, and `Yaml` classes are marked as final - - * Deprecated the `!php/object:` tag which will be replaced by the - `!php/object` tag (without the colon) in 4.0. - - * Deprecated the `!php/const:` tag which will be replaced by the - `!php/const` tag (without the colon) in 4.0. - - * Support for the `!str` tag is deprecated, use the `!!str` tag instead. - - * Deprecated using the non-specific tag `!` as its behavior will change in 4.0. - It will force non-evaluating your values in 4.0. Use plain integers or `!!float` instead. - -3.3.0 ------ - - * Starting an unquoted string with a question mark followed by a space is - deprecated and will throw a `ParseException` in Symfony 4.0. - - * Deprecated support for implicitly parsing non-string mapping keys as strings. - Mapping keys that are no strings will lead to a `ParseException` in Symfony - 4.0. Use quotes to opt-in for keys to be parsed as strings. - - Before: - - ```php - $yaml = << new A(), 'bar' => 1], 0, 0, Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE | Yaml::DUMP_OBJECT); - ``` - -3.0.0 ------ - - * Yaml::parse() now throws an exception when a blackslash is not escaped - in double-quoted strings - -2.8.0 ------ - - * Deprecated usage of a colon in an unquoted mapping value - * Deprecated usage of @, \`, | and > at the beginning of an unquoted string - * When surrounding strings with double-quotes, you must now escape `\` characters. Not - escaping those characters (when surrounded by double-quotes) is deprecated. - - Before: - - ```yml - class: "Foo\Var" - ``` - - After: - - ```yml - class: "Foo\\Var" - ``` - -2.1.0 ------ - - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) diff --git a/tests/integration/vendor/symfony/yaml/Command/LintCommand.php b/tests/integration/vendor/symfony/yaml/Command/LintCommand.php deleted file mode 100644 index 95352ac..0000000 --- a/tests/integration/vendor/symfony/yaml/Command/LintCommand.php +++ /dev/null @@ -1,276 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Command; - -use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Console\CI\GithubActionReporter; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Completion\CompletionInput; -use Symfony\Component\Console\Completion\CompletionSuggestions; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\RuntimeException; -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\Style\SymfonyStyle; -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Parser; -use Symfony\Component\Yaml\Yaml; - -/** - * Validates YAML files syntax and outputs encountered errors. - * - * @author Grégoire Pineau - * @author Robin Chalas - */ -#[AsCommand(name: 'lint:yaml', description: 'Lint a YAML file and outputs encountered errors')] -class LintCommand extends Command -{ - private Parser $parser; - private ?string $format = null; - private bool $displayCorrectFiles; - private ?\Closure $directoryIteratorProvider; - private ?\Closure $isReadableProvider; - - public function __construct(string $name = null, callable $directoryIteratorProvider = null, callable $isReadableProvider = null) - { - parent::__construct($name); - - $this->directoryIteratorProvider = null === $directoryIteratorProvider ? null : $directoryIteratorProvider(...); - $this->isReadableProvider = null === $isReadableProvider ? null : $isReadableProvider(...); - } - - /** - * @return void - */ - protected function configure() - { - $this - ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN') - ->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions()))) - ->addOption('exclude', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path(s) to exclude') - ->addOption('parse-tags', null, InputOption::VALUE_NEGATABLE, 'Parse custom tags', null) - ->setHelp(<<%command.name% command lints a YAML file and outputs to STDOUT -the first encountered syntax error. - -You can validates YAML contents passed from STDIN: - - cat filename | php %command.full_name% - - -You can also validate the syntax of a file: - - php %command.full_name% filename - -Or of a whole directory: - - php %command.full_name% dirname - php %command.full_name% dirname --format=json - -You can also exclude one or more specific files: - - php %command.full_name% dirname --exclude="dirname/foo.yaml" --exclude="dirname/bar.yaml" - -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output): int - { - $io = new SymfonyStyle($input, $output); - $filenames = (array) $input->getArgument('filename'); - $excludes = $input->getOption('exclude'); - $this->format = $input->getOption('format'); - $flags = $input->getOption('parse-tags'); - - if (null === $this->format) { - // Autodetect format according to CI environment - $this->format = class_exists(GithubActionReporter::class) && GithubActionReporter::isGithubActionEnvironment() ? 'github' : 'txt'; - } - - $flags = $flags ? Yaml::PARSE_CUSTOM_TAGS : 0; - - $this->displayCorrectFiles = $output->isVerbose(); - - if (['-'] === $filenames) { - return $this->display($io, [$this->validate(file_get_contents('php://stdin'), $flags)]); - } - - if (!$filenames) { - throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); - } - - $filesInfo = []; - foreach ($filenames as $filename) { - if (!$this->isReadable($filename)) { - throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); - } - - foreach ($this->getFiles($filename) as $file) { - if (!\in_array($file->getPathname(), $excludes, true)) { - $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file); - } - } - } - - return $this->display($io, $filesInfo); - } - - private function validate(string $content, int $flags, string $file = null): array - { - $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) { - if (\E_USER_DEPRECATED === $level) { - throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); - } - - return $prevErrorHandler ? $prevErrorHandler($level, $message, $file, $line) : false; - }); - - try { - $this->getParser()->parse($content, Yaml::PARSE_CONSTANT | $flags); - } catch (ParseException $e) { - return ['file' => $file, 'line' => $e->getParsedLine(), 'valid' => false, 'message' => $e->getMessage()]; - } finally { - restore_error_handler(); - } - - return ['file' => $file, 'valid' => true]; - } - - private function display(SymfonyStyle $io, array $files): int - { - return match ($this->format) { - 'txt' => $this->displayTxt($io, $files), - 'json' => $this->displayJson($io, $files), - 'github' => $this->displayTxt($io, $files, true), - default => throw new InvalidArgumentException(sprintf('Supported formats are "%s".', implode('", "', $this->getAvailableFormatOptions()))), - }; - } - - private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false): int - { - $countFiles = \count($filesInfo); - $erroredFiles = 0; - $suggestTagOption = false; - - if ($errorAsGithubAnnotations) { - $githubReporter = new GithubActionReporter($io); - } - - foreach ($filesInfo as $info) { - if ($info['valid'] && $this->displayCorrectFiles) { - $io->comment('OK'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); - } elseif (!$info['valid']) { - ++$erroredFiles; - $io->text(' ERROR '.($info['file'] ? sprintf(' in %s', $info['file']) : '')); - $io->text(sprintf(' >> %s', $info['message'])); - - if (str_contains($info['message'], 'PARSE_CUSTOM_TAGS')) { - $suggestTagOption = true; - } - - if ($errorAsGithubAnnotations) { - $githubReporter->error($info['message'], $info['file'] ?? 'php://stdin', $info['line']); - } - } - } - - if (0 === $erroredFiles) { - $io->success(sprintf('All %d YAML files contain valid syntax.', $countFiles)); - } else { - $io->warning(sprintf('%d YAML files have valid syntax and %d contain errors.%s', $countFiles - $erroredFiles, $erroredFiles, $suggestTagOption ? ' Use the --parse-tags option if you want parse custom tags.' : '')); - } - - return min($erroredFiles, 1); - } - - private function displayJson(SymfonyStyle $io, array $filesInfo): int - { - $errors = 0; - - array_walk($filesInfo, function (&$v) use (&$errors) { - $v['file'] = (string) $v['file']; - if (!$v['valid']) { - ++$errors; - } - - if (isset($v['message']) && str_contains($v['message'], 'PARSE_CUSTOM_TAGS')) { - $v['message'] .= ' Use the --parse-tags option if you want parse custom tags.'; - } - }); - - $io->writeln(json_encode($filesInfo, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES)); - - return min($errors, 1); - } - - private function getFiles(string $fileOrDirectory): iterable - { - if (is_file($fileOrDirectory)) { - yield new \SplFileInfo($fileOrDirectory); - - return; - } - - foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!\in_array($file->getExtension(), ['yml', 'yaml'])) { - continue; - } - - yield $file; - } - } - - private function getParser(): Parser - { - return $this->parser ??= new Parser(); - } - - private function getDirectoryIterator(string $directory): iterable - { - $default = fn ($directory) => new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), - \RecursiveIteratorIterator::LEAVES_ONLY - ); - - if (null !== $this->directoryIteratorProvider) { - return ($this->directoryIteratorProvider)($directory, $default); - } - - return $default($directory); - } - - private function isReadable(string $fileOrDirectory): bool - { - $default = is_readable(...); - - if (null !== $this->isReadableProvider) { - return ($this->isReadableProvider)($fileOrDirectory, $default); - } - - return $default($fileOrDirectory); - } - - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void - { - if ($input->mustSuggestOptionValuesFor('format')) { - $suggestions->suggestValues($this->getAvailableFormatOptions()); - } - } - - private function getAvailableFormatOptions(): array - { - return ['txt', 'json', 'github']; - } -} diff --git a/tests/integration/vendor/symfony/yaml/Dumper.php b/tests/integration/vendor/symfony/yaml/Dumper.php deleted file mode 100644 index 04646c5..0000000 --- a/tests/integration/vendor/symfony/yaml/Dumper.php +++ /dev/null @@ -1,178 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Tag\TaggedValue; - -/** - * Dumper dumps PHP variables to YAML strings. - * - * @author Fabien Potencier - * - * @final - */ -class Dumper -{ - /** - * The amount of spaces to use for indentation of nested nodes. - */ - private int $indentation; - - public function __construct(int $indentation = 4) - { - if ($indentation < 1) { - throw new \InvalidArgumentException('The indentation must be greater than zero.'); - } - - $this->indentation = $indentation; - } - - /** - * Dumps a PHP value to YAML. - * - * @param mixed $input The PHP value - * @param int $inline The level where you switch to inline YAML - * @param int $indent The level of indentation (used internally) - * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string - */ - public function dump(mixed $input, int $inline = 0, int $indent = 0, int $flags = 0): string - { - $output = ''; - $prefix = $indent ? str_repeat(' ', $indent) : ''; - $dumpObjectAsInlineMap = true; - - if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) { - $dumpObjectAsInlineMap = empty((array) $input); - } - - if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) { - $output .= $prefix.Inline::dump($input, $flags); - } elseif ($input instanceof TaggedValue) { - $output .= $this->dumpTaggedValue($input, $inline, $indent, $flags, $prefix); - } else { - $dumpAsMap = Inline::isHash($input); - - foreach ($input as $key => $value) { - if ('' !== $output && "\n" !== $output[-1]) { - $output .= "\n"; - } - - if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) { - $key = (string) $key; - } - - if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && str_contains($value, "\n") && !str_contains($value, "\r")) { - $blockIndentationIndicator = $this->getBlockIndentationIndicator($value); - - if (isset($value[-2]) && "\n" === $value[-2] && "\n" === $value[-1]) { - $blockChompingIndicator = '+'; - } elseif ("\n" === $value[-1]) { - $blockChompingIndicator = ''; - } else { - $blockChompingIndicator = '-'; - } - - $output .= sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator); - - foreach (explode("\n", $value) as $row) { - if ('' === $row) { - $output .= "\n"; - } else { - $output .= sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); - } - } - - continue; - } - - if ($value instanceof TaggedValue) { - $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); - - if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { - $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); - $output .= sprintf(' |%s', $blockIndentationIndicator); - - foreach (explode("\n", $value->getValue()) as $row) { - $output .= sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); - } - - continue; - } - - if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { - $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n"; - } else { - $output .= "\n"; - $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags); - } - - continue; - } - - $dumpObjectAsInlineMap = true; - - if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) { - $dumpObjectAsInlineMap = empty((array) $value); - } - - $willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value); - - $output .= sprintf('%s%s%s%s', - $prefix, - $dumpAsMap ? Inline::dump($key, $flags).':' : '-', - $willBeInlined ? ' ' : "\n", - $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags) - ).($willBeInlined ? "\n" : ''); - } - } - - return $output; - } - - private function dumpTaggedValue(TaggedValue $value, int $inline, int $indent, int $flags, string $prefix): string - { - $output = sprintf('%s!%s', $prefix ? $prefix.' ' : '', $value->getTag()); - - if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { - $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); - $output .= sprintf(' |%s', $blockIndentationIndicator); - - foreach (explode("\n", $value->getValue()) as $row) { - $output .= sprintf("\n%s%s%s", $prefix, str_repeat(' ', $this->indentation), $row); - } - - return $output; - } - - if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { - return $output.' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n"; - } - - return $output."\n".$this->dump($value->getValue(), $inline - 1, $indent, $flags); - } - - private function getBlockIndentationIndicator(string $value): string - { - $lines = explode("\n", $value); - - // If the first line (that is neither empty nor contains only spaces) - // starts with a space character, the spec requires a block indentation indicator - // http://www.yaml.org/spec/1.2/spec.html#id2793979 - foreach ($lines as $line) { - if ('' !== trim($line, ' ')) { - return (' ' === substr($line, 0, 1)) ? (string) $this->indentation : ''; - } - } - - return ''; - } -} diff --git a/tests/integration/vendor/symfony/yaml/Escaper.php b/tests/integration/vendor/symfony/yaml/Escaper.php deleted file mode 100644 index e8090d8..0000000 --- a/tests/integration/vendor/symfony/yaml/Escaper.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -/** - * Escaper encapsulates escaping rules for single and double-quoted - * YAML strings. - * - * @author Matthew Lewinski - * - * @internal - */ -class Escaper -{ - // Characters that would cause a dumped string to require double quoting. - public const REGEX_CHARACTER_TO_ESCAPE = "[\\x00-\\x1f]|\x7f|\xc2\x85|\xc2\xa0|\xe2\x80\xa8|\xe2\x80\xa9"; - - // Mapping arrays for escaping a double quoted string. The backslash is - // first to ensure proper escaping because str_replace operates iteratively - // on the input arrays. This ordering of the characters avoids the use of strtr, - // which performs more slowly. - private const ESCAPEES = ['\\', '\\\\', '\\"', '"', - "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", - "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", - "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", - "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\x7f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", - ]; - private const ESCAPED = ['\\\\', '\\"', '\\\\', '\\"', - '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', - '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', - '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', - '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\x7f', - '\\N', '\\_', '\\L', '\\P', - ]; - - /** - * Determines if a PHP value would require double quoting in YAML. - * - * @param string $value A PHP value - */ - public static function requiresDoubleQuoting(string $value): bool - { - return 0 < preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); - } - - /** - * Escapes and surrounds a PHP value with double quotes. - * - * @param string $value A PHP value - */ - public static function escapeWithDoubleQuotes(string $value): string - { - return sprintf('"%s"', str_replace(self::ESCAPEES, self::ESCAPED, $value)); - } - - /** - * Determines if a PHP value would require single quoting in YAML. - * - * @param string $value A PHP value - */ - public static function requiresSingleQuoting(string $value): bool - { - // Determines if a PHP value is entirely composed of a value that would - // require single quoting in YAML. - if (\in_array(strtolower($value), ['null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'])) { - return true; - } - - // Determines if the PHP value contains any single characters that would - // cause it to require single quoting in YAML. - return 0 < preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` \p{Zs}]/xu', $value); - } - - /** - * Escapes and surrounds a PHP value with single quotes. - * - * @param string $value A PHP value - */ - public static function escapeWithSingleQuotes(string $value): string - { - return sprintf("'%s'", str_replace('\'', '\'\'', $value)); - } -} diff --git a/tests/integration/vendor/symfony/yaml/Exception/DumpException.php b/tests/integration/vendor/symfony/yaml/Exception/DumpException.php deleted file mode 100644 index cce972f..0000000 --- a/tests/integration/vendor/symfony/yaml/Exception/DumpException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during dumping. - * - * @author Fabien Potencier - */ -class DumpException extends RuntimeException -{ -} diff --git a/tests/integration/vendor/symfony/yaml/Exception/ExceptionInterface.php b/tests/integration/vendor/symfony/yaml/Exception/ExceptionInterface.php deleted file mode 100644 index 9091316..0000000 --- a/tests/integration/vendor/symfony/yaml/Exception/ExceptionInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception interface for all exceptions thrown by the component. - * - * @author Fabien Potencier - */ -interface ExceptionInterface extends \Throwable -{ -} diff --git a/tests/integration/vendor/symfony/yaml/Exception/ParseException.php b/tests/integration/vendor/symfony/yaml/Exception/ParseException.php deleted file mode 100644 index c1a77ad..0000000 --- a/tests/integration/vendor/symfony/yaml/Exception/ParseException.php +++ /dev/null @@ -1,132 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during parsing. - * - * @author Fabien Potencier - */ -class ParseException extends RuntimeException -{ - private ?string $parsedFile; - private int $parsedLine; - private ?string $snippet; - private string $rawMessage; - - /** - * @param string $message The error message - * @param int $parsedLine The line where the error occurred - * @param string|null $snippet The snippet of code near the problem - * @param string|null $parsedFile The file name where the error occurred - */ - public function __construct(string $message, int $parsedLine = -1, string $snippet = null, string $parsedFile = null, \Throwable $previous = null) - { - $this->parsedFile = $parsedFile; - $this->parsedLine = $parsedLine; - $this->snippet = $snippet; - $this->rawMessage = $message; - - $this->updateRepr(); - - parent::__construct($this->message, 0, $previous); - } - - /** - * Gets the snippet of code near the error. - */ - public function getSnippet(): string - { - return $this->snippet; - } - - /** - * Sets the snippet of code near the error. - * - * @return void - */ - public function setSnippet(string $snippet) - { - $this->snippet = $snippet; - - $this->updateRepr(); - } - - /** - * Gets the filename where the error occurred. - * - * This method returns null if a string is parsed. - */ - public function getParsedFile(): string - { - return $this->parsedFile; - } - - /** - * Sets the filename where the error occurred. - * - * @return void - */ - public function setParsedFile(string $parsedFile) - { - $this->parsedFile = $parsedFile; - - $this->updateRepr(); - } - - /** - * Gets the line where the error occurred. - */ - public function getParsedLine(): int - { - return $this->parsedLine; - } - - /** - * Sets the line where the error occurred. - * - * @return void - */ - public function setParsedLine(int $parsedLine) - { - $this->parsedLine = $parsedLine; - - $this->updateRepr(); - } - - private function updateRepr(): void - { - $this->message = $this->rawMessage; - - $dot = false; - if (str_ends_with($this->message, '.')) { - $this->message = substr($this->message, 0, -1); - $dot = true; - } - - if (null !== $this->parsedFile) { - $this->message .= sprintf(' in %s', json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE)); - } - - if ($this->parsedLine >= 0) { - $this->message .= sprintf(' at line %d', $this->parsedLine); - } - - if ($this->snippet) { - $this->message .= sprintf(' (near "%s")', $this->snippet); - } - - if ($dot) { - $this->message .= '.'; - } - } -} diff --git a/tests/integration/vendor/symfony/yaml/Exception/RuntimeException.php b/tests/integration/vendor/symfony/yaml/Exception/RuntimeException.php deleted file mode 100644 index 3f36b73..0000000 --- a/tests/integration/vendor/symfony/yaml/Exception/RuntimeException.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Exception; - -/** - * Exception class thrown when an error occurs during parsing. - * - * @author Romain Neutron - */ -class RuntimeException extends \RuntimeException implements ExceptionInterface -{ -} diff --git a/tests/integration/vendor/symfony/yaml/Inline.php b/tests/integration/vendor/symfony/yaml/Inline.php deleted file mode 100644 index c2a93ba..0000000 --- a/tests/integration/vendor/symfony/yaml/Inline.php +++ /dev/null @@ -1,828 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\DumpException; -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Tag\TaggedValue; - -/** - * Inline implements a YAML parser/dumper for the YAML inline syntax. - * - * @author Fabien Potencier - * - * @internal - */ -class Inline -{ - public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; - - public static int $parsedLineNumber = -1; - public static ?string $parsedFilename = null; - - private static bool $exceptionOnInvalidType = false; - private static bool $objectSupport = false; - private static bool $objectForMap = false; - private static bool $constantSupport = false; - - public static function initialize(int $flags, int $parsedLineNumber = null, string $parsedFilename = null): void - { - self::$exceptionOnInvalidType = (bool) (Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE & $flags); - self::$objectSupport = (bool) (Yaml::PARSE_OBJECT & $flags); - self::$objectForMap = (bool) (Yaml::PARSE_OBJECT_FOR_MAP & $flags); - self::$constantSupport = (bool) (Yaml::PARSE_CONSTANT & $flags); - self::$parsedFilename = $parsedFilename; - - if (null !== $parsedLineNumber) { - self::$parsedLineNumber = $parsedLineNumber; - } - } - - /** - * Converts a YAML string to a PHP value. - * - * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior - * @param array $references Mapping of variable names to values - * - * @throws ParseException - */ - public static function parse(string $value = null, int $flags = 0, array &$references = []): mixed - { - self::initialize($flags); - - $value = trim($value); - - if ('' === $value) { - return ''; - } - - $i = 0; - $tag = self::parseTag($value, $i, $flags); - switch ($value[$i]) { - case '[': - $result = self::parseSequence($value, $flags, $i, $references); - ++$i; - break; - case '{': - $result = self::parseMapping($value, $flags, $i, $references); - ++$i; - break; - default: - $result = self::parseScalar($value, $flags, null, $i, true, $references); - } - - // some comments are allowed at the end - if (preg_replace('/\s*#.*$/A', '', substr($value, $i))) { - throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - if (null !== $tag && '' !== $tag) { - return new TaggedValue($tag, $result); - } - - return $result; - } - - /** - * Dumps a given PHP variable to a YAML string. - * - * @param mixed $value The PHP variable to convert - * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string - * - * @throws DumpException When trying to dump PHP resource - */ - public static function dump(mixed $value, int $flags = 0): string - { - switch (true) { - case \is_resource($value): - if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { - throw new DumpException(sprintf('Unable to dump PHP resources in a YAML file ("%s").', get_resource_type($value))); - } - - return self::dumpNull($flags); - case $value instanceof \DateTimeInterface: - return $value->format(match (true) { - !$length = \strlen(rtrim($value->format('u'), '0')) => 'c', - $length < 4 => 'Y-m-d\TH:i:s.vP', - default => 'Y-m-d\TH:i:s.uP', - }); - case $value instanceof \UnitEnum: - return sprintf('!php/const %s::%s', $value::class, $value->name); - case \is_object($value): - if ($value instanceof TaggedValue) { - return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags); - } - - if (Yaml::DUMP_OBJECT & $flags) { - return '!php/object '.self::dump(serialize($value)); - } - - if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) { - return self::dumpHashArray($value, $flags); - } - - if (Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE & $flags) { - throw new DumpException('Object support when dumping a YAML file has been disabled.'); - } - - return self::dumpNull($flags); - case \is_array($value): - return self::dumpArray($value, $flags); - case null === $value: - return self::dumpNull($flags); - case true === $value: - return 'true'; - case false === $value: - return 'false'; - case \is_int($value): - return $value; - case is_numeric($value) && false === strpbrk($value, "\f\n\r\t\v"): - $locale = setlocale(\LC_NUMERIC, 0); - if (false !== $locale) { - setlocale(\LC_NUMERIC, 'C'); - } - if (\is_float($value)) { - $repr = (string) $value; - if (is_infinite($value)) { - $repr = str_ireplace('INF', '.Inf', $repr); - } elseif (floor($value) == $value && $repr == $value) { - // Preserve float data type since storing a whole number will result in integer value. - if (!str_contains($repr, 'E')) { - $repr = $repr.'.0'; - } - } - } else { - $repr = \is_string($value) ? "'$value'" : (string) $value; - } - if (false !== $locale) { - setlocale(\LC_NUMERIC, $locale); - } - - return $repr; - case '' == $value: - return "''"; - case self::isBinaryString($value): - return '!!binary '.base64_encode($value); - case Escaper::requiresDoubleQuoting($value): - return Escaper::escapeWithDoubleQuotes($value); - case Escaper::requiresSingleQuoting($value): - $singleQuoted = Escaper::escapeWithSingleQuotes($value); - if (!str_contains($value, "'")) { - return $singleQuoted; - } - // Attempt double-quoting the string instead to see if it's more efficient. - $doubleQuoted = Escaper::escapeWithDoubleQuotes($value); - - return \strlen($doubleQuoted) < \strlen($singleQuoted) ? $doubleQuoted : $singleQuoted; - case Parser::preg_match('{^[0-9]+[_0-9]*$}', $value): - case Parser::preg_match(self::getHexRegex(), $value): - case Parser::preg_match(self::getTimestampRegex(), $value): - return Escaper::escapeWithSingleQuotes($value); - default: - return $value; - } - } - - /** - * Check if given array is hash or just normal indexed array. - */ - public static function isHash(array|\ArrayObject|\stdClass $value): bool - { - if ($value instanceof \stdClass || $value instanceof \ArrayObject) { - return true; - } - - $expectedKey = 0; - - foreach ($value as $key => $val) { - if ($key !== $expectedKey++) { - return true; - } - } - - return false; - } - - /** - * Dumps a PHP array to a YAML string. - * - * @param array $value The PHP array to dump - * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string - */ - private static function dumpArray(array $value, int $flags): string - { - // array - if (($value || Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE & $flags) && !self::isHash($value)) { - $output = []; - foreach ($value as $val) { - $output[] = self::dump($val, $flags); - } - - return sprintf('[%s]', implode(', ', $output)); - } - - return self::dumpHashArray($value, $flags); - } - - /** - * Dumps hash array to a YAML string. - * - * @param array|\ArrayObject|\stdClass $value The hash array to dump - * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string - */ - private static function dumpHashArray(array|\ArrayObject|\stdClass $value, int $flags): string - { - $output = []; - foreach ($value as $key => $val) { - if (\is_int($key) && Yaml::DUMP_NUMERIC_KEY_AS_STRING & $flags) { - $key = (string) $key; - } - - $output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags)); - } - - return sprintf('{ %s }', implode(', ', $output)); - } - - private static function dumpNull(int $flags): string - { - if (Yaml::DUMP_NULL_AS_TILDE & $flags) { - return '~'; - } - - return 'null'; - } - - /** - * Parses a YAML scalar. - * - * @throws ParseException When malformed inline YAML string is parsed - */ - public static function parseScalar(string $scalar, int $flags = 0, array $delimiters = null, int &$i = 0, bool $evaluate = true, array &$references = [], bool &$isQuoted = null): mixed - { - if (\in_array($scalar[$i], ['"', "'"], true)) { - // quoted scalar - $isQuoted = true; - $output = self::parseQuotedScalar($scalar, $i); - - if (null !== $delimiters) { - $tmp = ltrim(substr($scalar, $i), " \n"); - if ('' === $tmp) { - throw new ParseException(sprintf('Unexpected end of line, expected one of "%s".', implode('', $delimiters)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - if (!\in_array($tmp[0], $delimiters)) { - throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - } - } else { - // "normal" string - $isQuoted = false; - - if (!$delimiters) { - $output = substr($scalar, $i); - $i += \strlen($output); - - // remove comments - if (Parser::preg_match('/[ \t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) { - $output = substr($output, 0, $match[0][1]); - } - } elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { - $output = $match[1]; - $i += \strlen($output); - $output = trim($output); - } else { - throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename); - } - - // a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >) - if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0] || '%' === $output[0])) { - throw new ParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]), self::$parsedLineNumber + 1, $output, self::$parsedFilename); - } - - if ($evaluate) { - $output = self::evaluateScalar($output, $flags, $references, $isQuoted); - } - } - - return $output; - } - - /** - * Parses a YAML quoted scalar. - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseQuotedScalar(string $scalar, int &$i = 0): string - { - if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { - throw new ParseException(sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - $output = substr($match[0], 1, -1); - - $unescaper = new Unescaper(); - if ('"' == $scalar[$i]) { - $output = $unescaper->unescapeDoubleQuotedString($output); - } else { - $output = $unescaper->unescapeSingleQuotedString($output); - } - - $i += \strlen($match[0]); - - return $output; - } - - /** - * Parses a YAML sequence. - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseSequence(string $sequence, int $flags, int &$i = 0, array &$references = []): array - { - $output = []; - $len = \strlen($sequence); - ++$i; - - // [foo, bar, ...] - while ($i < $len) { - if (']' === $sequence[$i]) { - return $output; - } - if (',' === $sequence[$i] || ' ' === $sequence[$i]) { - ++$i; - - continue; - } - - $tag = self::parseTag($sequence, $i, $flags); - switch ($sequence[$i]) { - case '[': - // nested sequence - $value = self::parseSequence($sequence, $flags, $i, $references); - break; - case '{': - // nested mapping - $value = self::parseMapping($sequence, $flags, $i, $references); - break; - default: - $value = self::parseScalar($sequence, $flags, [',', ']'], $i, null === $tag, $references, $isQuoted); - - // the value can be an array if a reference has been resolved to an array var - if (\is_string($value) && !$isQuoted && str_contains($value, ': ')) { - // embedded mapping? - try { - $pos = 0; - $value = self::parseMapping('{'.$value.'}', $flags, $pos, $references); - } catch (\InvalidArgumentException) { - // no, it's not - } - } - - if (!$isQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) { - $references[$matches['ref']] = $matches['value']; - $value = $matches['value']; - } - - --$i; - } - - if (null !== $tag && '' !== $tag) { - $value = new TaggedValue($tag, $value); - } - - $output[] = $value; - - ++$i; - } - - throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $sequence), self::$parsedLineNumber + 1, null, self::$parsedFilename); - } - - /** - * Parses a YAML mapping. - * - * @throws ParseException When malformed inline YAML string is parsed - */ - private static function parseMapping(string $mapping, int $flags, int &$i = 0, array &$references = []): array|\stdClass - { - $output = []; - $len = \strlen($mapping); - ++$i; - $allowOverwrite = false; - - // {foo: bar, bar:foo, ...} - while ($i < $len) { - switch ($mapping[$i]) { - case ' ': - case ',': - case "\n": - ++$i; - continue 2; - case '}': - if (self::$objectForMap) { - return (object) $output; - } - - return $output; - } - - // key - $offsetBeforeKeyParsing = $i; - $isKeyQuoted = \in_array($mapping[$i], ['"', "'"], true); - $key = self::parseScalar($mapping, $flags, [':', ' '], $i, false); - - if ($offsetBeforeKeyParsing === $i) { - throw new ParseException('Missing mapping key.', self::$parsedLineNumber + 1, $mapping); - } - - if ('!php/const' === $key || '!php/enum' === $key) { - $key .= ' '.self::parseScalar($mapping, $flags, [':'], $i, false); - $key = self::evaluateScalar($key, $flags); - } - - if (false === $i = strpos($mapping, ':', $i)) { - break; - } - - if (!$isKeyQuoted) { - $evaluatedKey = self::evaluateScalar($key, $flags, $references); - - if ('' !== $key && $evaluatedKey !== $key && !\is_string($evaluatedKey) && !\is_int($evaluatedKey)) { - throw new ParseException('Implicit casting of incompatible mapping keys to strings is not supported. Quote your evaluable mapping keys instead.', self::$parsedLineNumber + 1, $mapping); - } - } - - if (!$isKeyQuoted && (!isset($mapping[$i + 1]) || !\in_array($mapping[$i + 1], [' ', ',', '[', ']', '{', '}', "\n"], true))) { - throw new ParseException('Colons must be followed by a space or an indication character (i.e. " ", ",", "[", "]", "{", "}").', self::$parsedLineNumber + 1, $mapping); - } - - if ('<<' === $key) { - $allowOverwrite = true; - } - - while ($i < $len) { - if (':' === $mapping[$i] || ' ' === $mapping[$i] || "\n" === $mapping[$i]) { - ++$i; - - continue; - } - - $tag = self::parseTag($mapping, $i, $flags); - switch ($mapping[$i]) { - case '[': - // nested sequence - $value = self::parseSequence($mapping, $flags, $i, $references); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - // But overwriting is allowed when a merge node is used in current block. - if ('<<' === $key) { - foreach ($value as $parsedValue) { - $output += $parsedValue; - } - } elseif ($allowOverwrite || !isset($output[$key])) { - if (null !== $tag) { - $output[$key] = new TaggedValue($tag, $value); - } else { - $output[$key] = $value; - } - } elseif (isset($output[$key])) { - throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); - } - break; - case '{': - // nested mapping - $value = self::parseMapping($mapping, $flags, $i, $references); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - // But overwriting is allowed when a merge node is used in current block. - if ('<<' === $key) { - $output += $value; - } elseif ($allowOverwrite || !isset($output[$key])) { - if (null !== $tag) { - $output[$key] = new TaggedValue($tag, $value); - } else { - $output[$key] = $value; - } - } elseif (isset($output[$key])) { - throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); - } - break; - default: - $value = self::parseScalar($mapping, $flags, [',', '}', "\n"], $i, null === $tag, $references, $isValueQuoted); - // Spec: Keys MUST be unique; first one wins. - // Parser cannot abort this mapping earlier, since lines - // are processed sequentially. - // But overwriting is allowed when a merge node is used in current block. - if ('<<' === $key) { - $output += $value; - } elseif ($allowOverwrite || !isset($output[$key])) { - if (!$isValueQuoted && \is_string($value) && '' !== $value && '&' === $value[0] && Parser::preg_match(Parser::REFERENCE_PATTERN, $value, $matches)) { - $references[$matches['ref']] = $matches['value']; - $value = $matches['value']; - } - - if (null !== $tag) { - $output[$key] = new TaggedValue($tag, $value); - } else { - $output[$key] = $value; - } - } elseif (isset($output[$key])) { - throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), self::$parsedLineNumber + 1, $mapping); - } - --$i; - } - ++$i; - - continue 2; - } - } - - throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $mapping), self::$parsedLineNumber + 1, null, self::$parsedFilename); - } - - /** - * Evaluates scalars and replaces magic values. - * - * @throws ParseException when object parsing support was disabled and the parser detected a PHP object or when a reference could not be resolved - */ - private static function evaluateScalar(string $scalar, int $flags, array &$references = [], bool &$isQuotedString = null): mixed - { - $isQuotedString = false; - $scalar = trim($scalar); - - if (str_starts_with($scalar, '*')) { - if (false !== $pos = strpos($scalar, '#')) { - $value = substr($scalar, 1, $pos - 2); - } else { - $value = substr($scalar, 1); - } - - // an unquoted * - if (false === $value || '' === $value) { - throw new ParseException('A reference must contain at least one character.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - if (!\array_key_exists($value, $references)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $value), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - return $references[$value]; - } - - $scalarLower = strtolower($scalar); - - switch (true) { - case 'null' === $scalarLower: - case '' === $scalar: - case '~' === $scalar: - return null; - case 'true' === $scalarLower: - return true; - case 'false' === $scalarLower: - return false; - case '!' === $scalar[0]: - switch (true) { - case str_starts_with($scalar, '!!str '): - $s = (string) substr($scalar, 6); - - if (\in_array($s[0] ?? '', ['"', "'"], true)) { - $isQuotedString = true; - $s = self::parseQuotedScalar($s); - } - - return $s; - case str_starts_with($scalar, '! '): - return substr($scalar, 2); - case str_starts_with($scalar, '!php/object'): - if (self::$objectSupport) { - if (!isset($scalar[12])) { - throw new ParseException('Missing value for tag "!php/object".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return unserialize(self::parseScalar(substr($scalar, 12))); - } - - if (self::$exceptionOnInvalidType) { - throw new ParseException('Object support when parsing a YAML file has been disabled.', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return null; - case str_starts_with($scalar, '!php/const'): - if (self::$constantSupport) { - if (!isset($scalar[11])) { - throw new ParseException('Missing value for tag "!php/const".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - $i = 0; - if (\defined($const = self::parseScalar(substr($scalar, 11), 0, null, $i, false))) { - return \constant($const); - } - - throw new ParseException(sprintf('The constant "%s" is not defined.', $const), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - if (self::$exceptionOnInvalidType) { - throw new ParseException(sprintf('The string "%s" could not be parsed as a constant. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return null; - case str_starts_with($scalar, '!php/enum'): - if (self::$constantSupport) { - if (!isset($scalar[11])) { - throw new ParseException('Missing value for tag "!php/enum".', self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - $i = 0; - $enum = self::parseScalar(substr($scalar, 10), 0, null, $i, false); - if ($useValue = str_ends_with($enum, '->value')) { - $enum = substr($enum, 0, -7); - } - if (!\defined($enum)) { - throw new ParseException(sprintf('The enum "%s" is not defined.', $enum), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - $value = \constant($enum); - - if (!$value instanceof \UnitEnum) { - throw new ParseException(sprintf('The string "%s" is not the name of a valid enum.', $enum), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - if (!$useValue) { - return $value; - } - if (!$value instanceof \BackedEnum) { - throw new ParseException(sprintf('The enum "%s" defines no value next to its name.', $enum), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return $value->value; - } - if (self::$exceptionOnInvalidType) { - throw new ParseException(sprintf('The string "%s" could not be parsed as an enum. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser?', $scalar), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return null; - case str_starts_with($scalar, '!!float '): - return (float) substr($scalar, 8); - case str_starts_with($scalar, '!!binary '): - return self::evaluateBinaryScalar(substr($scalar, 9)); - } - - throw new ParseException(sprintf('The string "%s" could not be parsed as it uses an unsupported built-in tag.', $scalar), self::$parsedLineNumber, $scalar, self::$parsedFilename); - case preg_match('/^(?:\+|-)?0o(?P[0-7_]++)$/', $scalar, $matches): - $value = str_replace('_', '', $matches['value']); - - if ('-' === $scalar[0]) { - return -octdec($value); - } - - return octdec($value); - case \in_array($scalar[0], ['+', '-', '.'], true) || is_numeric($scalar[0]): - if (Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) { - $scalar = str_replace('_', '', $scalar); - } - - switch (true) { - case ctype_digit($scalar): - case '-' === $scalar[0] && ctype_digit(substr($scalar, 1)): - $cast = (int) $scalar; - - return ($scalar === (string) $cast) ? $cast : $scalar; - case is_numeric($scalar): - case Parser::preg_match(self::getHexRegex(), $scalar): - $scalar = str_replace('_', '', $scalar); - - return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar; - case '.inf' === $scalarLower: - case '.nan' === $scalarLower: - return -log(0); - case '-.inf' === $scalarLower: - return log(0); - case Parser::preg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/', $scalar): - return (float) str_replace('_', '', $scalar); - case Parser::preg_match(self::getTimestampRegex(), $scalar): - // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. - $time = new \DateTimeImmutable($scalar, new \DateTimeZone('UTC')); - - if (Yaml::PARSE_DATETIME & $flags) { - return $time; - } - - if ('' !== rtrim($time->format('u'), '0')) { - return (float) $time->format('U.u'); - } - - try { - if (false !== $scalar = $time->getTimestamp()) { - return $scalar; - } - } catch (\ValueError) { - // no-op - } - - return $time->format('U'); - } - } - - return (string) $scalar; - } - - private static function parseTag(string $value, int &$i, int $flags): ?string - { - if ('!' !== $value[$i]) { - return null; - } - - $tagLength = strcspn($value, " \t\n[]{},", $i + 1); - $tag = substr($value, $i + 1, $tagLength); - - $nextOffset = $i + $tagLength + 1; - $nextOffset += strspn($value, ' ', $nextOffset); - - if ('' === $tag && (!isset($value[$nextOffset]) || \in_array($value[$nextOffset], [']', '}', ','], true))) { - throw new ParseException('Using the unquoted scalar value "!" is not supported. You must quote it.', self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - // Is followed by a scalar and is a built-in tag - if ('' !== $tag && (!isset($value[$nextOffset]) || !\in_array($value[$nextOffset], ['[', '{'], true)) && ('!' === $tag[0] || \in_array($tag, ['str', 'php/const', 'php/enum', 'php/object'], true))) { - // Manage in {@link self::evaluateScalar()} - return null; - } - - $i = $nextOffset; - - // Built-in tags - if ('' !== $tag && '!' === $tag[0]) { - throw new ParseException(sprintf('The built-in tag "!%s" is not implemented.', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - if ('' !== $tag && !isset($value[$i])) { - throw new ParseException(sprintf('Missing value for tag "%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - if ('' === $tag || Yaml::PARSE_CUSTOM_TAGS & $flags) { - return $tag; - } - - throw new ParseException(sprintf('Tags support is not enabled. Enable the "Yaml::PARSE_CUSTOM_TAGS" flag to use "!%s".', $tag), self::$parsedLineNumber + 1, $value, self::$parsedFilename); - } - - public static function evaluateBinaryScalar(string $scalar): string - { - $parsedBinaryData = self::parseScalar(preg_replace('/\s/', '', $scalar)); - - if (0 !== (\strlen($parsedBinaryData) % 4)) { - throw new ParseException(sprintf('The normalized base64 encoded data (data without whitespace characters) length must be a multiple of four (%d bytes given).', \strlen($parsedBinaryData)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - if (!Parser::preg_match('#^[A-Z0-9+/]+={0,2}$#i', $parsedBinaryData)) { - throw new ParseException(sprintf('The base64 encoded data (%s) contains invalid characters.', $parsedBinaryData), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); - } - - return base64_decode($parsedBinaryData, true); - } - - private static function isBinaryString(string $value): bool - { - return !preg_match('//u', $value) || preg_match('/[^\x00\x07-\x0d\x1B\x20-\xff]/', $value); - } - - /** - * Gets a regex that matches a YAML date. - * - * @see http://www.yaml.org/spec/1.2/spec.html#id2761573 - */ - private static function getTimestampRegex(): string - { - return <<[0-9][0-9][0-9][0-9]) - -(?P[0-9][0-9]?) - -(?P[0-9][0-9]?) - (?:(?:[Tt]|[ \t]+) - (?P[0-9][0-9]?) - :(?P[0-9][0-9]) - :(?P[0-9][0-9]) - (?:\.(?P[0-9]*))? - (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) - (?::(?P[0-9][0-9]))?))?)? - $~x -EOF; - } - - /** - * Gets a regex that matches a YAML number in hexadecimal notation. - */ - private static function getHexRegex(): string - { - return '~^0x[0-9a-f_]++$~i'; - } -} diff --git a/tests/integration/vendor/symfony/yaml/LICENSE b/tests/integration/vendor/symfony/yaml/LICENSE deleted file mode 100644 index 0138f8f..0000000 --- a/tests/integration/vendor/symfony/yaml/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2004-present Fabien Potencier - -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. diff --git a/tests/integration/vendor/symfony/yaml/Parser.php b/tests/integration/vendor/symfony/yaml/Parser.php deleted file mode 100644 index ddfbcfd..0000000 --- a/tests/integration/vendor/symfony/yaml/Parser.php +++ /dev/null @@ -1,1246 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; -use Symfony\Component\Yaml\Tag\TaggedValue; - -/** - * Parser parses YAML strings to convert them to PHP arrays. - * - * @author Fabien Potencier - * - * @final - */ -class Parser -{ - public const TAG_PATTERN = '(?P![\w!.\/:-]+)'; - public const BLOCK_SCALAR_HEADER_PATTERN = '(?P\||>)(?P\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P +#.*)?'; - public const REFERENCE_PATTERN = '#^&(?P[^ ]++) *+(?P.*)#u'; - - private ?string $filename = null; - private int $offset = 0; - private int $numberOfParsedLines = 0; - private ?int $totalNumberOfLines = null; - private array $lines = []; - private int $currentLineNb = -1; - private string $currentLine = ''; - private array $refs = []; - private array $skippedLineNumbers = []; - private array $locallySkippedLineNumbers = []; - private array $refsBeingParsed = []; - - /** - * Parses a YAML file into a PHP value. - * - * @param string $filename The path to the YAML file to be parsed - * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior - * - * @throws ParseException If the file could not be read or the YAML is not valid - */ - public function parseFile(string $filename, int $flags = 0): mixed - { - if (!is_file($filename)) { - throw new ParseException(sprintf('File "%s" does not exist.', $filename)); - } - - if (!is_readable($filename)) { - throw new ParseException(sprintf('File "%s" cannot be read.', $filename)); - } - - $this->filename = $filename; - - try { - return $this->parse(file_get_contents($filename), $flags); - } finally { - $this->filename = null; - } - } - - /** - * Parses a YAML string to a PHP value. - * - * @param string $value A YAML string - * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior - * - * @throws ParseException If the YAML is not valid - */ - public function parse(string $value, int $flags = 0): mixed - { - if (false === preg_match('//u', $value)) { - throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename); - } - - $this->refs = []; - - try { - $data = $this->doParse($value, $flags); - } finally { - $this->refsBeingParsed = []; - $this->offset = 0; - $this->lines = []; - $this->currentLine = ''; - $this->numberOfParsedLines = 0; - $this->refs = []; - $this->skippedLineNumbers = []; - $this->locallySkippedLineNumbers = []; - $this->totalNumberOfLines = null; - } - - return $data; - } - - private function doParse(string $value, int $flags): mixed - { - $this->currentLineNb = -1; - $this->currentLine = ''; - $value = $this->cleanup($value); - $this->lines = explode("\n", $value); - $this->numberOfParsedLines = \count($this->lines); - $this->locallySkippedLineNumbers = []; - $this->totalNumberOfLines ??= $this->numberOfParsedLines; - - if (!$this->moveToNextLine()) { - return null; - } - - $data = []; - $context = null; - $allowOverwrite = false; - - while ($this->isCurrentLineEmpty()) { - if (!$this->moveToNextLine()) { - return null; - } - } - - // Resolves the tag and returns if end of the document - if (null !== ($tag = $this->getLineTag($this->currentLine, $flags, false)) && !$this->moveToNextLine()) { - return new TaggedValue($tag, ''); - } - - do { - if ($this->isCurrentLineEmpty()) { - continue; - } - - // tab? - if ("\t" === $this->currentLine[0]) { - throw new ParseException('A YAML file cannot contain tabs as indentation.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - Inline::initialize($flags, $this->getRealCurrentLineNb(), $this->filename); - - $isRef = $mergeNode = false; - if ('-' === $this->currentLine[0] && self::preg_match('#^\-((?P\s+)(?P.+))?$#u', rtrim($this->currentLine), $values)) { - if ($context && 'mapping' == $context) { - throw new ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - $context = 'sequence'; - - if (isset($values['value']) && '&' === $values['value'][0] && self::preg_match(self::REFERENCE_PATTERN, $values['value'], $matches)) { - $isRef = $matches['ref']; - $this->refsBeingParsed[] = $isRef; - $values['value'] = $matches['value']; - } - - if (isset($values['value'][1]) && '?' === $values['value'][0] && ' ' === $values['value'][1]) { - throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - // array - if (isset($values['value']) && str_starts_with(ltrim($values['value'], ' '), '-')) { - // Inline first child - $currentLineNumber = $this->getRealCurrentLineNb(); - - $sequenceIndentation = \strlen($values['leadspaces']) + 1; - $sequenceYaml = substr($this->currentLine, $sequenceIndentation); - $sequenceYaml .= "\n".$this->getNextEmbedBlock($sequenceIndentation, true); - - $data[] = $this->parseBlock($currentLineNumber, rtrim($sequenceYaml), $flags); - } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || str_starts_with(ltrim($values['value'], ' '), '#')) { - $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true) ?? '', $flags); - } elseif (null !== $subTag = $this->getLineTag(ltrim($values['value'], ' '), $flags)) { - $data[] = new TaggedValue( - $subTag, - $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $flags) - ); - } else { - if ( - isset($values['leadspaces']) - && ( - '!' === $values['value'][0] - || self::preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+?))?\s*$#u', $this->trimTag($values['value']), $matches) - ) - ) { - // this is a compact notation element, add to next block and parse - $block = $values['value']; - if ($this->isNextLineIndented()) { - $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); - } - - $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags); - } else { - $data[] = $this->parseValue($values['value'], $flags, $context); - } - } - if ($isRef) { - $this->refs[$isRef] = end($data); - array_pop($this->refsBeingParsed); - } - } elseif ( - // @todo in 7.0 remove legacy "(?:!?!php/const:)?" - self::preg_match('#^(?P(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(( |\t)++(?P.+))?$#u', rtrim($this->currentLine), $values) - && (!str_contains($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"])) - ) { - if (str_starts_with($values['key'], '!php/const:')) { - trigger_deprecation('symfony/yaml', '6.2', 'YAML syntax for key "%s" is deprecated and replaced by "!php/const %s".', $values['key'], substr($values['key'], 11)); - } - - if ($context && 'sequence' == $context) { - throw new ParseException('You cannot define a mapping item when in a sequence.', $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - $context = 'mapping'; - - try { - $key = Inline::parseScalar($values['key']); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - - if (!\is_string($key) && !\is_int($key)) { - throw new ParseException((is_numeric($key) ? 'Numeric' : 'Non-string').' keys are not supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - // Convert float keys to strings, to avoid being converted to integers by PHP - if (\is_float($key)) { - $key = (string) $key; - } - - if ('<<' === $key && (!isset($values['value']) || '&' !== $values['value'][0] || !self::preg_match('#^&(?P[^ ]+)#u', $values['value'], $refMatches))) { - $mergeNode = true; - $allowOverwrite = true; - if (isset($values['value'][0]) && '*' === $values['value'][0]) { - $refName = substr(rtrim($values['value']), 1); - if (!\array_key_exists($refName, $this->refs)) { - if (false !== $pos = array_search($refName, $this->refsBeingParsed, true)) { - throw new ParseException(sprintf('Circular reference [%s] detected for reference "%s".', implode(', ', array_merge(\array_slice($this->refsBeingParsed, $pos), [$refName])), $refName), $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - - throw new ParseException(sprintf('Reference "%s" does not exist.', $refName), $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - $refValue = $this->refs[$refName]; - - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $refValue instanceof \stdClass) { - $refValue = (array) $refValue; - } - - if (!\is_array($refValue)) { - throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - $data += $refValue; // array union - } else { - if (isset($values['value']) && '' !== $values['value']) { - $value = $values['value']; - } else { - $value = $this->getNextEmbedBlock(); - } - $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $flags); - - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsed instanceof \stdClass) { - $parsed = (array) $parsed; - } - - if (!\is_array($parsed)) { - throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - if (isset($parsed[0])) { - // If the value associated with the merge key is a sequence, then this sequence is expected to contain mapping nodes - // and each of these nodes is merged in turn according to its order in the sequence. Keys in mapping nodes earlier - // in the sequence override keys specified in later mapping nodes. - foreach ($parsed as $parsedItem) { - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $parsedItem instanceof \stdClass) { - $parsedItem = (array) $parsedItem; - } - - if (!\is_array($parsedItem)) { - throw new ParseException('Merge items must be arrays.', $this->getRealCurrentLineNb() + 1, $parsedItem, $this->filename); - } - - $data += $parsedItem; // array union - } - } else { - // If the value associated with the key is a single mapping node, each of its key/value pairs is inserted into the - // current mapping, unless the key already exists in it. - $data += $parsed; // array union - } - } - } elseif ('<<' !== $key && isset($values['value']) && '&' === $values['value'][0] && self::preg_match(self::REFERENCE_PATTERN, $values['value'], $matches)) { - $isRef = $matches['ref']; - $this->refsBeingParsed[] = $isRef; - $values['value'] = $matches['value']; - } - - $subTag = null; - if ($mergeNode) { - // Merge keys - } elseif (!isset($values['value']) || '' === $values['value'] || str_starts_with($values['value'], '#') || (null !== $subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) { - // hash - // if next line is less indented or equal, then it means that the current value is null - if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if ($allowOverwrite || !isset($data[$key])) { - if (null !== $subTag) { - $data[$key] = new TaggedValue($subTag, ''); - } else { - $data[$key] = null; - } - } else { - throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - } else { - // remember the parsed line number here in case we need it to provide some contexts in error messages below - $realCurrentLineNbKey = $this->getRealCurrentLineNb(); - $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags); - if ('<<' === $key) { - $this->refs[$refMatches['ref']] = $value; - - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $value instanceof \stdClass) { - $value = (array) $value; - } - - $data += $value; - } elseif ($allowOverwrite || !isset($data[$key])) { - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if (null !== $subTag) { - $data[$key] = new TaggedValue($subTag, $value); - } else { - $data[$key] = $value; - } - } else { - throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $realCurrentLineNbKey + 1, $this->currentLine); - } - } - } else { - $value = $this->parseValue(rtrim($values['value']), $flags, $context); - // Spec: Keys MUST be unique; first one wins. - // But overwriting is allowed when a merge node is used in current block. - if ($allowOverwrite || !isset($data[$key])) { - $data[$key] = $value; - } else { - throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - } - if ($isRef) { - $this->refs[$isRef] = $data[$key]; - array_pop($this->refsBeingParsed); - } - } elseif ('"' === $this->currentLine[0] || "'" === $this->currentLine[0]) { - if (null !== $context) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - try { - return Inline::parse($this->lexInlineQuotedString(), $flags, $this->refs); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } elseif ('{' === $this->currentLine[0]) { - if (null !== $context) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - try { - $parsedMapping = Inline::parse($this->lexInlineMapping(), $flags, $this->refs); - - while ($this->moveToNextLine()) { - if (!$this->isCurrentLineEmpty()) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } - - return $parsedMapping; - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } elseif ('[' === $this->currentLine[0]) { - if (null !== $context) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - try { - $parsedSequence = Inline::parse($this->lexInlineSequence(), $flags, $this->refs); - - while ($this->moveToNextLine()) { - if (!$this->isCurrentLineEmpty()) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } - - return $parsedSequence; - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } else { - // multiple documents are not supported - if ('---' === $this->currentLine) { - throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - - if ($deprecatedUsage = (isset($this->currentLine[1]) && '?' === $this->currentLine[0] && ' ' === $this->currentLine[1])) { - throw new ParseException('Complex mappings are not supported.', $this->getRealCurrentLineNb() + 1, $this->currentLine); - } - - // 1-liner optionally followed by newline(s) - if (\is_string($value) && $this->lines[0] === trim($value)) { - try { - $value = Inline::parse($this->lines[0], $flags, $this->refs); - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - - return $value; - } - - // try to parse the value as a multi-line string as a last resort - if (0 === $this->currentLineNb) { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = false; - $value = ''; - - foreach ($this->lines as $line) { - $trimmedLine = trim($line); - if ('#' === ($trimmedLine[0] ?? '')) { - continue; - } - // If the indentation is not consistent at offset 0, it is to be considered as a ParseError - if (0 === $this->offset && !$deprecatedUsage && isset($line[0]) && ' ' === $line[0]) { - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - if (str_contains($line, ': ')) { - throw new ParseException('Mapping values are not allowed in multi-line blocks.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - - if ('' === $trimmedLine) { - $value .= "\n"; - } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { - $value .= ' '; - } - - if ('' !== $trimmedLine && str_ends_with($line, '\\')) { - $value .= ltrim(substr($line, 0, -1)); - } elseif ('' !== $trimmedLine) { - $value .= $trimmedLine; - } - - if ('' === $trimmedLine) { - $previousLineWasNewline = true; - $previousLineWasTerminatedWithBackslash = false; - } elseif (str_ends_with($line, '\\')) { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = true; - } else { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = false; - } - } - - try { - return Inline::parse(trim($value)); - } catch (ParseException) { - // fall-through to the ParseException thrown below - } - } - - throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } while ($this->moveToNextLine()); - - if (null !== $tag) { - $data = new TaggedValue($tag, $data); - } - - if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && 'mapping' === $context && !\is_object($data)) { - $object = new \stdClass(); - - foreach ($data as $key => $value) { - $object->$key = $value; - } - - $data = $object; - } - - return empty($data) ? null : $data; - } - - private function parseBlock(int $offset, string $yaml, int $flags): mixed - { - $skippedLineNumbers = $this->skippedLineNumbers; - - foreach ($this->locallySkippedLineNumbers as $lineNumber) { - if ($lineNumber < $offset) { - continue; - } - - $skippedLineNumbers[] = $lineNumber; - } - - $parser = new self(); - $parser->offset = $offset; - $parser->totalNumberOfLines = $this->totalNumberOfLines; - $parser->skippedLineNumbers = $skippedLineNumbers; - $parser->refs = &$this->refs; - $parser->refsBeingParsed = $this->refsBeingParsed; - - return $parser->doParse($yaml, $flags); - } - - /** - * Returns the current line number (takes the offset into account). - * - * @internal - */ - public function getRealCurrentLineNb(): int - { - $realCurrentLineNumber = $this->currentLineNb + $this->offset; - - foreach ($this->skippedLineNumbers as $skippedLineNumber) { - if ($skippedLineNumber > $realCurrentLineNumber) { - break; - } - - ++$realCurrentLineNumber; - } - - return $realCurrentLineNumber; - } - - private function getCurrentLineIndentation(): int - { - if (' ' !== ($this->currentLine[0] ?? '')) { - return 0; - } - - return \strlen($this->currentLine) - \strlen(ltrim($this->currentLine, ' ')); - } - - /** - * Returns the next embed block of YAML. - * - * @param int|null $indentation The indent level at which the block is to be read, or null for default - * @param bool $inSequence True if the enclosing data structure is a sequence - * - * @throws ParseException When indentation problem are detected - */ - private function getNextEmbedBlock(int $indentation = null, bool $inSequence = false): string - { - $oldLineIndentation = $this->getCurrentLineIndentation(); - - if (!$this->moveToNextLine()) { - return ''; - } - - if (null === $indentation) { - $newIndent = null; - $movements = 0; - - do { - $EOF = false; - - // empty and comment-like lines do not influence the indentation depth - if ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { - $EOF = !$this->moveToNextLine(); - - if (!$EOF) { - ++$movements; - } - } else { - $newIndent = $this->getCurrentLineIndentation(); - } - } while (!$EOF && null === $newIndent); - - for ($i = 0; $i < $movements; ++$i) { - $this->moveToPreviousLine(); - } - - $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem(); - - if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) { - throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } else { - $newIndent = $indentation; - } - - $data = []; - - if ($this->getCurrentLineIndentation() >= $newIndent) { - $data[] = substr($this->currentLine, $newIndent ?? 0); - } elseif ($this->isCurrentLineEmpty() || $this->isCurrentLineComment()) { - $data[] = $this->currentLine; - } else { - $this->moveToPreviousLine(); - - return ''; - } - - if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) { - // the previous line contained a dash but no item content, this line is a sequence item with the same indentation - // and therefore no nested list or mapping - $this->moveToPreviousLine(); - - return ''; - } - - $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); - $isItComment = $this->isCurrentLineComment(); - - while ($this->moveToNextLine()) { - if ($isItComment && !$isItUnindentedCollection) { - $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem(); - $isItComment = $this->isCurrentLineComment(); - } - - $indent = $this->getCurrentLineIndentation(); - - if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) { - $this->moveToPreviousLine(); - break; - } - - if ($this->isCurrentLineBlank()) { - $data[] = substr($this->currentLine, $newIndent); - continue; - } - - if ($indent >= $newIndent) { - $data[] = substr($this->currentLine, $newIndent); - } elseif ($this->isCurrentLineComment()) { - $data[] = $this->currentLine; - } elseif (0 == $indent) { - $this->moveToPreviousLine(); - - break; - } else { - throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename); - } - } - - return implode("\n", $data); - } - - private function hasMoreLines(): bool - { - return (\count($this->lines) - 1) > $this->currentLineNb; - } - - /** - * Moves the parser to the next line. - */ - private function moveToNextLine(): bool - { - if ($this->currentLineNb >= $this->numberOfParsedLines - 1) { - return false; - } - - $this->currentLine = $this->lines[++$this->currentLineNb]; - - return true; - } - - /** - * Moves the parser to the previous line. - */ - private function moveToPreviousLine(): bool - { - if ($this->currentLineNb < 1) { - return false; - } - - $this->currentLine = $this->lines[--$this->currentLineNb]; - - return true; - } - - /** - * Parses a YAML value. - * - * @param string $value A YAML value - * @param int $flags A bit field of Yaml::PARSE_* constants to customize the YAML parser behavior - * @param string $context The parser context (either sequence or mapping) - * - * @throws ParseException When reference does not exist - */ - private function parseValue(string $value, int $flags, string $context): mixed - { - if (str_starts_with($value, '*')) { - if (false !== $pos = strpos($value, '#')) { - $value = substr($value, 1, $pos - 2); - } else { - $value = substr($value, 1); - } - - if (!\array_key_exists($value, $this->refs)) { - if (false !== $pos = array_search($value, $this->refsBeingParsed, true)) { - throw new ParseException(sprintf('Circular reference [%s] detected for reference "%s".', implode(', ', array_merge(\array_slice($this->refsBeingParsed, $pos), [$value])), $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - - throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine, $this->filename); - } - - return $this->refs[$value]; - } - - if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { - $modifiers = $matches['modifiers'] ?? ''; - - $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int) $modifiers)); - - if ('' !== $matches['tag'] && '!' !== $matches['tag']) { - if ('!!binary' === $matches['tag']) { - return Inline::evaluateBinaryScalar($data); - } - - return new TaggedValue(substr($matches['tag'], 1), $data); - } - - return $data; - } - - try { - if ('' !== $value && '{' === $value[0]) { - $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); - - return Inline::parse($this->lexInlineMapping($cursor), $flags, $this->refs); - } elseif ('' !== $value && '[' === $value[0]) { - $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); - - return Inline::parse($this->lexInlineSequence($cursor), $flags, $this->refs); - } - - switch ($value[0] ?? '') { - case '"': - case "'": - $cursor = \strlen(rtrim($this->currentLine)) - \strlen(rtrim($value)); - $parsedValue = Inline::parse($this->lexInlineQuotedString($cursor), $flags, $this->refs); - - if (isset($this->currentLine[$cursor]) && preg_replace('/\s*(#.*)?$/A', '', substr($this->currentLine, $cursor))) { - throw new ParseException(sprintf('Unexpected characters near "%s".', substr($this->currentLine, $cursor))); - } - - return $parsedValue; - default: - $lines = []; - - while ($this->moveToNextLine()) { - // unquoted strings end before the first unindented line - if (0 === $this->getCurrentLineIndentation()) { - $this->moveToPreviousLine(); - - break; - } - - $lines[] = trim($this->currentLine); - } - - for ($i = 0, $linesCount = \count($lines), $previousLineBlank = false; $i < $linesCount; ++$i) { - if ('' === $lines[$i]) { - $value .= "\n"; - $previousLineBlank = true; - } elseif ($previousLineBlank) { - $value .= $lines[$i]; - $previousLineBlank = false; - } else { - $value .= ' '.$lines[$i]; - $previousLineBlank = false; - } - } - - Inline::$parsedLineNumber = $this->getRealCurrentLineNb(); - - $parsedValue = Inline::parse($value, $flags, $this->refs); - - if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && str_contains($parsedValue, ': ')) { - throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename); - } - - return $parsedValue; - } - } catch (ParseException $e) { - $e->setParsedLine($this->getRealCurrentLineNb() + 1); - $e->setSnippet($this->currentLine); - - throw $e; - } - } - - /** - * Parses a block scalar. - * - * @param string $style The style indicator that was used to begin this block scalar (| or >) - * @param string $chomping The chomping indicator that was used to begin this block scalar (+ or -) - * @param int $indentation The indentation indicator that was used to begin this block scalar - */ - private function parseBlockScalar(string $style, string $chomping = '', int $indentation = 0): string - { - $notEOF = $this->moveToNextLine(); - if (!$notEOF) { - return ''; - } - - $isCurrentLineBlank = $this->isCurrentLineBlank(); - $blockLines = []; - - // leading blank lines are consumed before determining indentation - while ($notEOF && $isCurrentLineBlank) { - // newline only if not EOF - if ($notEOF = $this->moveToNextLine()) { - $blockLines[] = ''; - $isCurrentLineBlank = $this->isCurrentLineBlank(); - } - } - - // determine indentation if not specified - if (0 === $indentation) { - $currentLineLength = \strlen($this->currentLine); - - for ($i = 0; $i < $currentLineLength && ' ' === $this->currentLine[$i]; ++$i) { - ++$indentation; - } - } - - if ($indentation > 0) { - $pattern = sprintf('/^ {%d}(.*)$/', $indentation); - - while ( - $notEOF && ( - $isCurrentLineBlank - || self::preg_match($pattern, $this->currentLine, $matches) - ) - ) { - if ($isCurrentLineBlank && \strlen($this->currentLine) > $indentation) { - $blockLines[] = substr($this->currentLine, $indentation); - } elseif ($isCurrentLineBlank) { - $blockLines[] = ''; - } else { - $blockLines[] = $matches[1]; - } - - // newline only if not EOF - if ($notEOF = $this->moveToNextLine()) { - $isCurrentLineBlank = $this->isCurrentLineBlank(); - } - } - } elseif ($notEOF) { - $blockLines[] = ''; - } - - if ($notEOF) { - $blockLines[] = ''; - $this->moveToPreviousLine(); - } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) { - $blockLines[] = ''; - } - - // folded style - if ('>' === $style) { - $text = ''; - $previousLineIndented = false; - $previousLineBlank = false; - - for ($i = 0, $blockLinesCount = \count($blockLines); $i < $blockLinesCount; ++$i) { - if ('' === $blockLines[$i]) { - $text .= "\n"; - $previousLineIndented = false; - $previousLineBlank = true; - } elseif (' ' === $blockLines[$i][0]) { - $text .= "\n".$blockLines[$i]; - $previousLineIndented = true; - $previousLineBlank = false; - } elseif ($previousLineIndented) { - $text .= "\n".$blockLines[$i]; - $previousLineIndented = false; - $previousLineBlank = false; - } elseif ($previousLineBlank || 0 === $i) { - $text .= $blockLines[$i]; - $previousLineIndented = false; - $previousLineBlank = false; - } else { - $text .= ' '.$blockLines[$i]; - $previousLineIndented = false; - $previousLineBlank = false; - } - } - } else { - $text = implode("\n", $blockLines); - } - - // deal with trailing newlines - if ('' === $chomping) { - $text = preg_replace('/\n+$/', "\n", $text); - } elseif ('-' === $chomping) { - $text = preg_replace('/\n+$/', '', $text); - } - - return $text; - } - - /** - * Returns true if the next line is indented. - */ - private function isNextLineIndented(): bool - { - $currentIndentation = $this->getCurrentLineIndentation(); - $movements = 0; - - do { - $EOF = !$this->moveToNextLine(); - - if (!$EOF) { - ++$movements; - } - } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); - - if ($EOF) { - return false; - } - - $ret = $this->getCurrentLineIndentation() > $currentIndentation; - - for ($i = 0; $i < $movements; ++$i) { - $this->moveToPreviousLine(); - } - - return $ret; - } - - private function isCurrentLineEmpty(): bool - { - return $this->isCurrentLineBlank() || $this->isCurrentLineComment(); - } - - private function isCurrentLineBlank(): bool - { - return '' === $this->currentLine || '' === trim($this->currentLine, ' '); - } - - private function isCurrentLineComment(): bool - { - // checking explicitly the first char of the trim is faster than loops or strpos - $ltrimmedLine = '' !== $this->currentLine && ' ' === $this->currentLine[0] ? ltrim($this->currentLine, ' ') : $this->currentLine; - - return '' !== $ltrimmedLine && '#' === $ltrimmedLine[0]; - } - - private function isCurrentLineLastLineInDocument(): bool - { - return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1); - } - - private function cleanup(string $value): string - { - $value = str_replace(["\r\n", "\r"], "\n", $value); - - // strip YAML header - $count = 0; - $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count); - $this->offset += $count; - - // remove leading comments - $trimmedValue = preg_replace('#^(\#.*?\n)+#s', '', $value, -1, $count); - if (1 === $count) { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - } - - // remove start of the document marker (---) - $trimmedValue = preg_replace('#^\-\-\-.*?\n#s', '', $value, -1, $count); - if (1 === $count) { - // items have been removed, update the offset - $this->offset += substr_count($value, "\n") - substr_count($trimmedValue, "\n"); - $value = $trimmedValue; - - // remove end of the document marker (...) - $value = preg_replace('#\.\.\.\s*$#', '', $value); - } - - return $value; - } - - private function isNextLineUnIndentedCollection(): bool - { - $currentIndentation = $this->getCurrentLineIndentation(); - $movements = 0; - - do { - $EOF = !$this->moveToNextLine(); - - if (!$EOF) { - ++$movements; - } - } while (!$EOF && ($this->isCurrentLineEmpty() || $this->isCurrentLineComment())); - - if ($EOF) { - return false; - } - - $ret = $this->getCurrentLineIndentation() === $currentIndentation && $this->isStringUnIndentedCollectionItem(); - - for ($i = 0; $i < $movements; ++$i) { - $this->moveToPreviousLine(); - } - - return $ret; - } - - private function isStringUnIndentedCollectionItem(): bool - { - return '-' === rtrim($this->currentLine) || str_starts_with($this->currentLine, '- '); - } - - /** - * A local wrapper for "preg_match" which will throw a ParseException if there - * is an internal error in the PCRE engine. - * - * This avoids us needing to check for "false" every time PCRE is used - * in the YAML engine - * - * @throws ParseException on a PCRE internal error - * - * @internal - */ - public static function preg_match(string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0): int - { - if (false === $ret = preg_match($pattern, $subject, $matches, $flags, $offset)) { - throw new ParseException(preg_last_error_msg()); - } - - return $ret; - } - - /** - * Trim the tag on top of the value. - * - * Prevent values such as "!foo {quz: bar}" to be considered as - * a mapping block. - */ - private function trimTag(string $value): string - { - if ('!' === $value[0]) { - return ltrim(substr($value, 1, strcspn($value, " \r\n", 1)), ' '); - } - - return $value; - } - - private function getLineTag(string $value, int $flags, bool $nextLineCheck = true): ?string - { - if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^'.self::TAG_PATTERN.' *( +#.*)?$/', $value, $matches)) { - return null; - } - - if ($nextLineCheck && !$this->isNextLineIndented()) { - return null; - } - - $tag = substr($matches['tag'], 1); - - // Built-in tags - if ($tag && '!' === $tag[0]) { - throw new ParseException(sprintf('The built-in tag "!%s" is not implemented.', $tag), $this->getRealCurrentLineNb() + 1, $value, $this->filename); - } - - if (Yaml::PARSE_CUSTOM_TAGS & $flags) { - return $tag; - } - - throw new ParseException(sprintf('Tags support is not enabled. You must use the flag "Yaml::PARSE_CUSTOM_TAGS" to use "%s".', $matches['tag']), $this->getRealCurrentLineNb() + 1, $value, $this->filename); - } - - private function lexInlineQuotedString(int &$cursor = 0): string - { - $quotation = $this->currentLine[$cursor]; - $value = $quotation; - ++$cursor; - - $previousLineWasNewline = true; - $previousLineWasTerminatedWithBackslash = false; - $lineNumber = 0; - - do { - if (++$lineNumber > 1) { - $cursor += strspn($this->currentLine, ' ', $cursor); - } - - if ($this->isCurrentLineBlank()) { - $value .= "\n"; - } elseif (!$previousLineWasNewline && !$previousLineWasTerminatedWithBackslash) { - $value .= ' '; - } - - for (; \strlen($this->currentLine) > $cursor; ++$cursor) { - switch ($this->currentLine[$cursor]) { - case '\\': - if ("'" === $quotation) { - $value .= '\\'; - } elseif (isset($this->currentLine[++$cursor])) { - $value .= '\\'.$this->currentLine[$cursor]; - } - - break; - case $quotation: - ++$cursor; - - if ("'" === $quotation && isset($this->currentLine[$cursor]) && "'" === $this->currentLine[$cursor]) { - $value .= "''"; - break; - } - - return $value.$quotation; - default: - $value .= $this->currentLine[$cursor]; - } - } - - if ($this->isCurrentLineBlank()) { - $previousLineWasNewline = true; - $previousLineWasTerminatedWithBackslash = false; - } elseif ('\\' === $this->currentLine[-1]) { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = true; - } else { - $previousLineWasNewline = false; - $previousLineWasTerminatedWithBackslash = false; - } - - if ($this->hasMoreLines()) { - $cursor = 0; - } - } while ($this->moveToNextLine()); - - throw new ParseException('Malformed inline YAML string.'); - } - - private function lexUnquotedString(int &$cursor): string - { - $offset = $cursor; - $cursor += strcspn($this->currentLine, '[]{},: ', $cursor); - - if ($cursor === $offset) { - throw new ParseException('Malformed unquoted YAML string.'); - } - - return substr($this->currentLine, $offset, $cursor - $offset); - } - - private function lexInlineMapping(int &$cursor = 0): string - { - return $this->lexInlineStructure($cursor, '}'); - } - - private function lexInlineSequence(int &$cursor = 0): string - { - return $this->lexInlineStructure($cursor, ']'); - } - - private function lexInlineStructure(int &$cursor, string $closingTag): string - { - $value = $this->currentLine[$cursor]; - ++$cursor; - - do { - $this->consumeWhitespaces($cursor); - - while (isset($this->currentLine[$cursor])) { - switch ($this->currentLine[$cursor]) { - case '"': - case "'": - $value .= $this->lexInlineQuotedString($cursor); - break; - case ':': - case ',': - $value .= $this->currentLine[$cursor]; - ++$cursor; - break; - case '{': - $value .= $this->lexInlineMapping($cursor); - break; - case '[': - $value .= $this->lexInlineSequence($cursor); - break; - case $closingTag: - $value .= $this->currentLine[$cursor]; - ++$cursor; - - return $value; - case '#': - break 2; - default: - $value .= $this->lexUnquotedString($cursor); - } - - if ($this->consumeWhitespaces($cursor)) { - $value .= ' '; - } - } - - if ($this->hasMoreLines()) { - $cursor = 0; - } - } while ($this->moveToNextLine()); - - throw new ParseException('Malformed inline YAML string.'); - } - - private function consumeWhitespaces(int &$cursor): bool - { - $whitespacesConsumed = 0; - - do { - $whitespaceOnlyTokenLength = strspn($this->currentLine, ' ', $cursor); - $whitespacesConsumed += $whitespaceOnlyTokenLength; - $cursor += $whitespaceOnlyTokenLength; - - if (isset($this->currentLine[$cursor])) { - return 0 < $whitespacesConsumed; - } - - if ($this->hasMoreLines()) { - $cursor = 0; - } - } while ($this->moveToNextLine()); - - return 0 < $whitespacesConsumed; - } -} diff --git a/tests/integration/vendor/symfony/yaml/README.md b/tests/integration/vendor/symfony/yaml/README.md deleted file mode 100644 index ac25024..0000000 --- a/tests/integration/vendor/symfony/yaml/README.md +++ /dev/null @@ -1,13 +0,0 @@ -Yaml Component -============== - -The Yaml component loads and dumps YAML files. - -Resources ---------- - - * [Documentation](https://symfony.com/doc/current/components/yaml.html) - * [Contributing](https://symfony.com/doc/current/contributing/index.html) - * [Report issues](https://github.com/symfony/symfony/issues) and - [send Pull Requests](https://github.com/symfony/symfony/pulls) - in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/tests/integration/vendor/symfony/yaml/Tag/TaggedValue.php b/tests/integration/vendor/symfony/yaml/Tag/TaggedValue.php deleted file mode 100644 index 3e09b93..0000000 --- a/tests/integration/vendor/symfony/yaml/Tag/TaggedValue.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml\Tag; - -/** - * @author Nicolas Grekas - * @author Guilhem N. - */ -final class TaggedValue -{ - private string $tag; - private mixed $value; - - public function __construct(string $tag, mixed $value) - { - $this->tag = $tag; - $this->value = $value; - } - - public function getTag(): string - { - return $this->tag; - } - - public function getValue(): mixed - { - return $this->value; - } -} diff --git a/tests/integration/vendor/symfony/yaml/Unescaper.php b/tests/integration/vendor/symfony/yaml/Unescaper.php deleted file mode 100644 index 9e640ff..0000000 --- a/tests/integration/vendor/symfony/yaml/Unescaper.php +++ /dev/null @@ -1,108 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; - -/** - * Unescaper encapsulates unescaping rules for single and double-quoted - * YAML strings. - * - * @author Matthew Lewinski - * - * @internal - */ -class Unescaper -{ - /** - * Regex fragment that matches an escaped character in a double quoted string. - */ - public const REGEX_ESCAPED_CHARACTER = '\\\\(x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|.)'; - - /** - * Unescapes a single quoted string. - * - * @param string $value A single quoted string - */ - public function unescapeSingleQuotedString(string $value): string - { - return str_replace('\'\'', '\'', $value); - } - - /** - * Unescapes a double quoted string. - * - * @param string $value A double quoted string - */ - public function unescapeDoubleQuotedString(string $value): string - { - $callback = fn ($match) => $this->unescapeCharacter($match[0]); - - // evaluate the string - return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value); - } - - /** - * Unescapes a character that was found in a double-quoted string. - * - * @param string $value An escaped character - */ - private function unescapeCharacter(string $value): string - { - return match ($value[1]) { - '0' => "\x0", - 'a' => "\x7", - 'b' => "\x8", - 't' => "\t", - "\t" => "\t", - 'n' => "\n", - 'v' => "\xB", - 'f' => "\xC", - 'r' => "\r", - 'e' => "\x1B", - ' ' => ' ', - '"' => '"', - '/' => '/', - '\\' => '\\', - // U+0085 NEXT LINE - 'N' => "\xC2\x85", - // U+00A0 NO-BREAK SPACE - '_' => "\xC2\xA0", - // U+2028 LINE SEPARATOR - 'L' => "\xE2\x80\xA8", - // U+2029 PARAGRAPH SEPARATOR - 'P' => "\xE2\x80\xA9", - 'x' => self::utf8chr(hexdec(substr($value, 2, 2))), - 'u' => self::utf8chr(hexdec(substr($value, 2, 4))), - 'U' => self::utf8chr(hexdec(substr($value, 2, 8))), - default => throw new ParseException(sprintf('Found unknown escape character "%s".', $value)), - }; - } - - /** - * Get the UTF-8 character for the given code point. - */ - private static function utf8chr(int $c): string - { - if (0x80 > $c %= 0x200000) { - return \chr($c); - } - if (0x800 > $c) { - return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); - } - if (0x10000 > $c) { - return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); - } - - return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); - } -} diff --git a/tests/integration/vendor/symfony/yaml/Yaml.php b/tests/integration/vendor/symfony/yaml/Yaml.php deleted file mode 100644 index e2d2af7..0000000 --- a/tests/integration/vendor/symfony/yaml/Yaml.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Yaml; - -use Symfony\Component\Yaml\Exception\ParseException; - -/** - * Yaml offers convenience methods to load and dump YAML. - * - * @author Fabien Potencier - * - * @final - */ -class Yaml -{ - public const DUMP_OBJECT = 1; - public const PARSE_EXCEPTION_ON_INVALID_TYPE = 2; - public const PARSE_OBJECT = 4; - public const PARSE_OBJECT_FOR_MAP = 8; - public const DUMP_EXCEPTION_ON_INVALID_TYPE = 16; - public const PARSE_DATETIME = 32; - public const DUMP_OBJECT_AS_MAP = 64; - public const DUMP_MULTI_LINE_LITERAL_BLOCK = 128; - public const PARSE_CONSTANT = 256; - public const PARSE_CUSTOM_TAGS = 512; - public const DUMP_EMPTY_ARRAY_AS_SEQUENCE = 1024; - public const DUMP_NULL_AS_TILDE = 2048; - public const DUMP_NUMERIC_KEY_AS_STRING = 4096; - - /** - * Parses a YAML file into a PHP value. - * - * Usage: - * - * $array = Yaml::parseFile('config.yml'); - * print_r($array); - * - * @param string $filename The path to the YAML file to be parsed - * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior - * - * @throws ParseException If the file could not be read or the YAML is not valid - */ - public static function parseFile(string $filename, int $flags = 0): mixed - { - $yaml = new Parser(); - - return $yaml->parseFile($filename, $flags); - } - - /** - * Parses YAML into a PHP value. - * - * Usage: - * - * $array = Yaml::parse(file_get_contents('config.yml')); - * print_r($array); - * - * - * @param string $input A string containing YAML - * @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior - * - * @throws ParseException If the YAML is not valid - */ - public static function parse(string $input, int $flags = 0): mixed - { - $yaml = new Parser(); - - return $yaml->parse($input, $flags); - } - - /** - * Dumps a PHP value to a YAML string. - * - * The dump method, when supplied with an array, will do its best - * to convert the array into friendly YAML. - * - * @param mixed $input The PHP value - * @param int $inline The level where you switch to inline YAML - * @param int $indent The amount of spaces to use for indentation of nested nodes - * @param int $flags A bit field of DUMP_* constants to customize the dumped YAML string - */ - public static function dump(mixed $input, int $inline = 2, int $indent = 4, int $flags = 0): string - { - $yaml = new Dumper($indent); - - return $yaml->dump($input, $inline, 0, $flags); - } -} diff --git a/tests/integration/vendor/symfony/yaml/composer.json b/tests/integration/vendor/symfony/yaml/composer.json deleted file mode 100644 index 3b648af..0000000 --- a/tests/integration/vendor/symfony/yaml/composer.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "symfony/yaml", - "type": "library", - "description": "Loads and dumps YAML files", - "keywords": [], - "homepage": "https://symfony.com", - "license": "MIT", - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "symfony/console": "^5.4|^6.0" - }, - "conflict": { - "symfony/console": "<5.4" - }, - "autoload": { - "psr-4": { "Symfony\\Component\\Yaml\\": "" }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "bin": [ - "Resources/bin/yaml-lint" - ], - "minimum-stability": "dev" -}