From 1b5e06c8db45ddf88637844e03acd7640de5b3c1 Mon Sep 17 00:00:00 2001 From: bueltge Date: Mon, 15 Dec 2014 11:37:30 +0100 Subject: [PATCH] play with phpunit + travics-ci --- .travis.yml | 8 +- composer.json | 27 + composer.lock | 341 + phpunit.xml.dist | 15 + tests/bootstrap.php | 6 + tests/test-gimmick.php | 15 + vendor/autoload.php | 7 + vendor/bin/pdepend | 1 + vendor/bin/phpmd | 1 + vendor/composer/ClassLoader.php | 387 + vendor/composer/autoload_classmap.php | 9 + vendor/composer/autoload_namespaces.php | 15 + vendor/composer/autoload_psr4.php | 9 + vendor/composer/autoload_real.php | 50 + vendor/composer/installed.json | 335 + vendor/composer/installers/.editorconfig | 10 + vendor/composer/installers/.gitignore | 3 + vendor/composer/installers/.travis.yml | 14 + vendor/composer/installers/LICENSE | 19 + vendor/composer/installers/README.md | 187 + vendor/composer/installers/composer.json | 75 + vendor/composer/installers/phpunit.xml.dist | 25 + .../src/Composer/Installers/AglInstaller.php | 21 + .../Installers/AnnotateCmsInstaller.php | 11 + .../Composer/Installers/AsgardInstaller.php | 45 + .../src/Composer/Installers/BaseInstaller.php | 131 + .../Composer/Installers/BitrixInstaller.php | 11 + .../Composer/Installers/CakePHPInstaller.php | 145 + .../src/Composer/Installers/ChefInstaller.php | 11 + .../Installers/CodeIgniterInstaller.php | 11 + .../Installers/Concrete5Installer.php | 12 + .../Composer/Installers/CraftInstaller.php | 9 + .../Composer/Installers/CroogoInstaller.php | 21 + .../Composer/Installers/DokuWikiInstaller.php | 50 + .../Composer/Installers/DolibarrInstaller.php | 16 + .../Composer/Installers/DrupalInstaller.php | 13 + .../src/Composer/Installers/ElggInstaller.php | 9 + .../src/Composer/Installers/FuelInstaller.php | 11 + .../Composer/Installers/FuelphpInstaller.php | 9 + .../src/Composer/Installers/GravInstaller.php | 30 + .../Composer/Installers/HuradInstaller.php | 25 + .../src/Composer/Installers/Installer.php | 159 + .../Composer/Installers/JoomlaInstaller.php | 15 + .../Composer/Installers/KirbyInstaller.php | 9 + .../Composer/Installers/KohanaInstaller.php | 9 + .../Composer/Installers/LaravelInstaller.php | 9 + .../Composer/Installers/LithiumInstaller.php | 10 + .../Installers/MODULEWorkInstaller.php | 9 + .../Composer/Installers/MODXEvoInstaller.php | 16 + .../Composer/Installers/MagentoInstaller.php | 11 + .../src/Composer/Installers/MakoInstaller.php | 9 + .../Installers/MediaWikiInstaller.php | 50 + .../Installers/MicroweberInstaller.php | 111 + .../Composer/Installers/MoodleInstaller.php | 47 + .../Composer/Installers/OctoberInstaller.php | 46 + .../src/Composer/Installers/OxidInstaller.php | 11 + .../src/Composer/Installers/PPIInstaller.php | 9 + .../Composer/Installers/PhpBBInstaller.php | 11 + .../Composer/Installers/PimcoreInstaller.php | 21 + .../Composer/Installers/PiwikInstaller.php | 32 + .../Composer/Installers/PuppetInstaller.php | 11 + .../Composer/Installers/RedaxoInstaller.php | 10 + .../Installers/RoundcubeInstaller.php | 22 + .../Composer/Installers/ShopwareInstaller.php | 58 + .../Installers/SilverStripeInstaller.php | 36 + .../Composer/Installers/Symfony1Installer.php | 26 + .../Composer/Installers/TYPO3CmsInstaller.php | 14 + .../Installers/TYPO3FlowInstaller.php | 38 + .../Composer/Installers/TheliaInstaller.php | 12 + .../src/Composer/Installers/TuskInstaller.php | 14 + .../Composer/Installers/WHMCSInstaller.php | 10 + .../Composer/Installers/WolfCMSInstaller.php | 9 + .../Installers/WordPressInstaller.php | 11 + .../src/Composer/Installers/ZendInstaller.php | 11 + .../Composer/Installers/ZikulaInstaller.php | 10 + vendor/composer/installers/src/bootstrap.php | 13 + .../Installers/Test/AsgardInstallerTest.php | 61 + .../Installers/Test/CakePHPInstallerTest.php | 163 + .../Installers/Test/DokuWikiInstallerTest.php | 89 + .../Installers/Test/GravInstallerTest.php | 63 + .../Installers/Test/InstallerTest.php | 412 + .../Test/MediaWikiInstallerTest.php | 66 + .../Installers/Test/OctoberInstallerTest.php | 66 + .../Installers/Test/PimcoreInstallerTest.php | 44 + .../Installers/Test/PiwikInstallerTest.php | 63 + .../Composer/Installers/Test/TestCase.php | 64 + .../composer/installers/tests/bootstrap.php | 4 + vendor/pdepend/pdepend/CHANGELOG | 416 + vendor/pdepend/pdepend/LICENSE | 31 + vendor/pdepend/pdepend/Vagrantfile | 64 + vendor/pdepend/pdepend/build.properties | 16 + vendor/pdepend/pdepend/composer.json | 21 + vendor/pdepend/pdepend/scripts/compare.sh | 13 + .../pdepend/scripts/update-version.php | 188 + vendor/pdepend/pdepend/src/bin/pdepend | 72 + vendor/pdepend/pdepend/src/bin/pdepend.bat | 46 + vendor/pdepend/pdepend/src/bin/pdepend.php | 67 + .../pdepend/src/conf/phar_bootstrap.stub | 61 + .../src/main/php/PDepend/Application.php | 198 + .../main/php/PDepend/DbusUI/ResultPrinter.php | 198 + .../Compiler/ProcessListenerPass.php | 69 + .../DependencyInjection/Configuration.php | 120 + .../PDepend/DependencyInjection/Extension.php | 136 + .../DependencyInjection/ExtensionManager.php | 93 + .../DependencyInjection/PdependExtension.php | 127 + .../pdepend/src/main/php/PDepend/Engine.php | 688 ++ .../php/PDepend/Input/CompositeFilter.php | 89 + .../php/PDepend/Input/ExcludePathFilter.php | 123 + .../php/PDepend/Input/ExtensionFilter.php | 84 + .../src/main/php/PDepend/Input/Filter.php | 61 + .../src/main/php/PDepend/Input/Iterator.php | 118 + .../php/PDepend/Metrics/AbstractAnalyzer.php | 147 + .../Metrics/AbstractCachingAnalyzer.php | 137 + .../php/PDepend/Metrics/AggregateAnalyzer.php | 69 + .../src/main/php/PDepend/Metrics/Analyzer.php | 96 + .../Metrics/Analyzer/ClassLevelAnalyzer.php | 409 + .../Metrics/Analyzer/CodeRankAnalyzer.php | 236 + .../CodeRankAnalyzer/CodeRankStrategyI.php | 61 + .../CodeRankAnalyzer/InheritanceStrategy.php | 151 + .../CodeRankAnalyzer/MethodStrategy.php | 148 + .../CodeRankAnalyzer/PropertyStrategy.php | 130 + .../CodeRankAnalyzer/StrategyFactory.php | 125 + .../Metrics/Analyzer/CohesionAnalyzer.php | 155 + .../Metrics/Analyzer/CouplingAnalyzer.php | 455 ++ .../Metrics/Analyzer/CrapIndexAnalyzer.php | 272 + .../Analyzer/CyclomaticComplexityAnalyzer.php | 464 ++ .../Metrics/Analyzer/DependencyAnalyzer.php | 480 ++ .../Metrics/Analyzer/HierarchyAnalyzer.php | 318 + .../Metrics/Analyzer/InheritanceAnalyzer.php | 355 + .../Analyzer/NPathComplexityAnalyzer.php | 567 ++ .../Metrics/Analyzer/NodeCountAnalyzer.php | 329 + .../Metrics/Analyzer/NodeLocAnalyzer.php | 485 ++ .../PDepend/Metrics/AnalyzerCacheAware.php | 66 + .../php/PDepend/Metrics/AnalyzerFactory.php | 88 + .../PDepend/Metrics/AnalyzerFilterAware.php | 56 + .../php/PDepend/Metrics/AnalyzerIterator.php | 75 + .../php/PDepend/Metrics/AnalyzerListener.php | 71 + .../php/PDepend/Metrics/AnalyzerNodeAware.php | 72 + .../PDepend/Metrics/AnalyzerProjectAware.php | 70 + .../src/main/php/PDepend/ProcessListener.php | 120 + .../php/PDepend/Report/CodeAwareGenerator.php | 62 + .../php/PDepend/Report/FileAwareGenerator.php | 61 + .../main/php/PDepend/Report/Jdepend/Chart.php | 248 + .../main/php/PDepend/Report/Jdepend/Xml.php | 351 + .../main/php/PDepend/Report/Jdepend/chart.svg | 587 ++ .../PDepend/Report/NoLogOutputException.php | 66 + .../php/PDepend/Report/Overview/Pyramid.php | 333 + .../php/PDepend/Report/Overview/pyramid.svg | 769 ++ .../php/PDepend/Report/ReportGenerator.php | 79 + .../PDepend/Report/ReportGeneratorFactory.php | 118 + .../main/php/PDepend/Report/Summary/Xml.php | 439 ++ .../Source/AST/ASTAllocationExpression.php | 82 + .../php/PDepend/Source/AST/ASTArguments.php | 80 + .../main/php/PDepend/Source/AST/ASTArray.php | 78 + .../PDepend/Source/AST/ASTArrayElement.php | 112 + .../Source/AST/ASTArrayIndexExpression.php | 80 + .../php/PDepend/Source/AST/ASTArtifact.php | 76 + .../PDepend/Source/AST/ASTArtifactList.php | 228 + .../AST/ASTArtifactList/ArtifactFilter.php | 63 + .../CollectionArtifactFilter.php | 120 + .../ASTArtifactList/NullArtifactFilter.php | 66 + .../ASTArtifactList/PackageArtifactFilter.php | 102 + .../Source/AST/ASTAssignmentExpression.php | 67 + .../Source/AST/ASTBooleanAndExpression.php | 69 + .../Source/AST/ASTBooleanOrExpression.php | 69 + .../PDepend/Source/AST/ASTBreakStatement.php | 83 + .../PDepend/Source/AST/ASTCastExpression.php | 181 + .../PDepend/Source/AST/ASTCatchStatement.php | 67 + .../main/php/PDepend/Source/AST/ASTClass.php | 204 + .../PDepend/Source/AST/ASTClassFqnPostfix.php | 81 + ...InterfaceRecursiveInheritanceException.php | 71 + .../AST/ASTClassOrInterfaceReference.php | 126 + .../ASTClassOrInterfaceReferenceIterator.php | 89 + .../PDepend/Source/AST/ASTClassReference.php | 83 + .../PDepend/Source/AST/ASTCloneExpression.php | 69 + .../php/PDepend/Source/AST/ASTClosure.php | 145 + .../php/PDepend/Source/AST/ASTComment.php | 67 + .../PDepend/Source/AST/ASTCompilationUnit.php | 404 + .../ASTCompilationUnitNotFoundException.php | 65 + .../Source/AST/ASTCompoundExpression.php | 83 + .../Source/AST/ASTCompoundVariable.php | 79 + .../Source/AST/ASTConditionalExpression.php | 75 + .../php/PDepend/Source/AST/ASTConstant.php | 69 + .../Source/AST/ASTConstantDeclarator.php | 135 + .../Source/AST/ASTConstantDefinition.php | 77 + .../PDepend/Source/AST/ASTConstantPostfix.php | 74 + .../Source/AST/ASTContinueStatement.php | 83 + .../Source/AST/ASTDeclareStatement.php | 130 + .../Source/AST/ASTDoWhileStatement.php | 69 + .../PDepend/Source/AST/ASTEchoStatement.php | 69 + .../PDepend/Source/AST/ASTElseIfStatement.php | 84 + .../PDepend/Source/AST/ASTEvalExpression.php | 69 + .../PDepend/Source/AST/ASTExitExpression.php | 69 + .../php/PDepend/Source/AST/ASTExpression.php | 69 + .../Source/AST/ASTFieldDeclaration.php | 181 + .../Source/AST/ASTFinallyStatement.php | 67 + .../php/PDepend/Source/AST/ASTForInit.php | 73 + .../PDepend/Source/AST/ASTForStatement.php | 69 + .../php/PDepend/Source/AST/ASTForUpdate.php | 75 + .../Source/AST/ASTForeachStatement.php | 69 + .../PDepend/Source/AST/ASTFormalParameter.php | 107 + .../Source/AST/ASTFormalParameters.php | 87 + .../php/PDepend/Source/AST/ASTFunction.php | 176 + .../PDepend/Source/AST/ASTFunctionPostfix.php | 79 + .../PDepend/Source/AST/ASTGlobalStatement.php | 69 + .../PDepend/Source/AST/ASTGotoStatement.php | 69 + .../php/PDepend/Source/AST/ASTHeredoc.php | 87 + .../php/PDepend/Source/AST/ASTIdentifier.php | 70 + .../php/PDepend/Source/AST/ASTIfStatement.php | 81 + .../Source/AST/ASTIncludeExpression.php | 108 + .../PDepend/Source/AST/ASTIndexExpression.php | 56 + .../Source/AST/ASTInstanceOfExpression.php | 69 + .../php/PDepend/Source/AST/ASTInterface.php | 145 + .../php/PDepend/Source/AST/ASTInvocation.php | 60 + .../PDepend/Source/AST/ASTIssetExpression.php | 69 + .../PDepend/Source/AST/ASTLabelStatement.php | 69 + .../PDepend/Source/AST/ASTListExpression.php | 69 + .../php/PDepend/Source/AST/ASTLiteral.php | 69 + .../Source/AST/ASTLogicalAndExpression.php | 69 + .../Source/AST/ASTLogicalOrExpression.php | 69 + .../Source/AST/ASTLogicalXorExpression.php | 69 + .../Source/AST/ASTMemberPrimaryPrefix.php | 99 + .../main/php/PDepend/Source/AST/ASTMethod.php | 233 + .../PDepend/Source/AST/ASTMethodPostfix.php | 79 + .../php/PDepend/Source/AST/ASTNamespace.php | 319 + .../main/php/PDepend/Source/AST/ASTNode.php | 540 ++ .../php/PDepend/Source/AST/ASTParameter.php | 395 + .../PDepend/Source/AST/ASTParentReference.php | 130 + .../Source/AST/ASTPostfixExpression.php | 69 + .../Source/AST/ASTPreDecrementExpression.php | 69 + .../Source/AST/ASTPreIncrementExpression.php | 69 + .../PDepend/Source/AST/ASTPrimitiveType.php | 81 + .../php/PDepend/Source/AST/ASTProperty.php | 369 + .../PDepend/Source/AST/ASTPropertyPostfix.php | 83 + .../Source/AST/ASTRequireExpression.php | 108 + .../PDepend/Source/AST/ASTReturnStatement.php | 83 + .../main/php/PDepend/Source/AST/ASTScope.php | 69 + .../PDepend/Source/AST/ASTScopeStatement.php | 69 + .../PDepend/Source/AST/ASTSelfReference.php | 149 + .../Source/AST/ASTShiftLeftExpression.php | 83 + .../Source/AST/ASTShiftRightExpression.php | 83 + .../php/PDepend/Source/AST/ASTStatement.php | 69 + .../PDepend/Source/AST/ASTStaticReference.php | 86 + .../AST/ASTStaticVariableDeclaration.php | 83 + .../main/php/PDepend/Source/AST/ASTString.php | 81 + .../Source/AST/ASTStringIndexExpression.php | 75 + .../php/PDepend/Source/AST/ASTSwitchLabel.php | 109 + .../PDepend/Source/AST/ASTSwitchStatement.php | 67 + .../PDepend/Source/AST/ASTThrowStatement.php | 69 + .../main/php/PDepend/Source/AST/ASTTrait.php | 123 + .../PDepend/Source/AST/ASTTraitAdaptation.php | 69 + .../Source/AST/ASTTraitAdaptationAlias.php | 140 + .../AST/ASTTraitAdaptationPrecedence.php | 69 + .../AST/ASTTraitMethodCollisionException.php | 43 + .../PDepend/Source/AST/ASTTraitReference.php | 83 + .../Source/AST/ASTTraitUseStatement.php | 212 + .../PDepend/Source/AST/ASTTryStatement.php | 69 + .../main/php/PDepend/Source/AST/ASTType.php | 90 + .../php/PDepend/Source/AST/ASTTypeArray.php | 94 + .../PDepend/Source/AST/ASTTypeCallable.php | 81 + .../PDepend/Source/AST/ASTUnaryExpression.php | 83 + .../PDepend/Source/AST/ASTUnsetStatement.php | 69 + .../main/php/PDepend/Source/AST/ASTValue.php | 107 + .../php/PDepend/Source/AST/ASTVariable.php | 87 + .../Source/AST/ASTVariableDeclarator.php | 114 + .../Source/AST/ASTVariableVariable.php | 83 + .../PDepend/Source/AST/ASTWhileStatement.php | 69 + .../PDepend/Source/AST/ASTYieldStatement.php | 83 + .../Source/AST/AbstractASTArtifact.php | 197 + .../Source/AST/AbstractASTCallable.php | 488 ++ .../AST/AbstractASTClassOrInterface.php | 368 + .../PDepend/Source/AST/AbstractASTType.php | 516 ++ .../src/main/php/PDepend/Source/AST/State.php | 92 + .../Source/ASTVisitor/ASTVisitListener.php | 208 + .../PDepend/Source/ASTVisitor/ASTVisitor.php | 167 + .../ASTVisitor/AbstractASTVisitListener.php | 286 + .../Source/ASTVisitor/AbstractASTVisitor.php | 519 ++ .../php/PDepend/Source/Builder/Builder.php | 1225 +++ .../PDepend/Source/Builder/BuilderContext.php | 121 + .../BuilderContext/GlobalBuilderContext.php | 174 + .../Source/Language/PHP/AbstractPHPParser.php | 6703 +++++++++++++++++ .../Source/Language/PHP/PHPBuilder.php | 2336 ++++++ .../Source/Language/PHP/PHPParserGeneric.php | 349 + .../PHP/PHPTokenizerHelperVersion52.php | 128 + .../Language/PHP/PHPTokenizerInternal.php | 706 ++ .../Source/Parser/InvalidStateException.php | 73 + .../Source/Parser/MissingValueException.php | 78 + .../PDepend/Source/Parser/ParserException.php | 53 + .../php/PDepend/Source/Parser/SymbolTable.php | 140 + .../PDepend/Source/Parser/TokenException.php | 56 + .../php/PDepend/Source/Parser/TokenStack.php | 120 + .../Source/Parser/TokenStreamEndException.php | 70 + .../Parser/UnexpectedTokenException.php | 73 + .../php/PDepend/Source/Tokenizer/Token.php | 114 + .../PDepend/Source/Tokenizer/Tokenizer.php | 188 + .../php/PDepend/Source/Tokenizer/Tokens.php | 857 +++ .../src/main/php/PDepend/TextUI/Command.php | 630 ++ .../main/php/PDepend/TextUI/ResultPrinter.php | 232 + .../src/main/php/PDepend/TextUI/Runner.php | 347 + .../php/PDepend/Util/Cache/CacheDriver.php | 110 + .../php/PDepend/Util/Cache/CacheFactory.php | 143 + .../Cache/Driver/File/FileCacheDirectory.php | 226 + .../Util/Cache/Driver/FileCacheDriver.php | 277 + .../Util/Cache/Driver/MemoryCacheDriver.php | 213 + .../main/php/PDepend/Util/Configuration.php | 128 + .../PDepend/Util/ConfigurationInstance.php | 80 + .../PDepend/Util/Coverage/CloverReport.php | 151 + .../php/PDepend/Util/Coverage/Factory.php | 92 + .../main/php/PDepend/Util/Coverage/Report.php | 62 + .../src/main/php/PDepend/Util/FileUtil.php | 92 + .../src/main/php/PDepend/Util/IdBuilder.php | 162 + .../main/php/PDepend/Util/ImageConvert.php | 181 + .../pdepend/src/main/php/PDepend/Util/Log.php | 110 + .../src/main/php/PDepend/Util/MathUtil.php | 87 + .../src/main/php/PDepend/Util/Type.php | 407 + .../src/main/php/PDepend/Util/Workarounds.php | 90 + .../main/resources/schema/configuration.xsd | 46 + .../pdepend/src/main/resources/services.xml | 111 + vendor/phpmd/phpmd/.gitignore | 5 + vendor/phpmd/phpmd/.gitmodules | 3 + vendor/phpmd/phpmd/.travis.yml | 23 + vendor/phpmd/phpmd/AUTHORS.rst | 38 + vendor/phpmd/phpmd/CHANGELOG | 137 + vendor/phpmd/phpmd/LICENSE | 31 + vendor/phpmd/phpmd/README.rst | 116 + vendor/phpmd/phpmd/build.properties | 17 + vendor/phpmd/phpmd/build.xml | 108 + vendor/phpmd/phpmd/composer.json | 24 + vendor/phpmd/phpmd/composer.lock | 218 + vendor/phpmd/phpmd/phpunit.xml.dist | 13 + vendor/phpmd/phpmd/src/bin/phpmd | 122 + vendor/phpmd/phpmd/src/bin/phpmd.bat | 45 + .../phpmd/phpmd/src/conf/phar_bootstrap.stub | 21 + .../phpmd/src/main/php/PHPMD/AbstractNode.php | 302 + .../src/main/php/PHPMD/AbstractRenderer.php | 115 + .../phpmd/src/main/php/PHPMD/AbstractRule.php | 427 ++ .../src/main/php/PHPMD/AbstractWriter.php | 64 + .../phpmd/src/main/php/PHPMD/Node/ASTNode.php | 143 + .../php/PHPMD/Node/AbstractCallableNode.php | 78 + .../src/main/php/PHPMD/Node/AbstractNode.php | 80 + .../main/php/PHPMD/Node/AbstractTypeNode.php | 129 + .../src/main/php/PHPMD/Node/Annotation.php | 119 + .../src/main/php/PHPMD/Node/Annotations.php | 104 + .../src/main/php/PHPMD/Node/ClassNode.php | 73 + .../src/main/php/PHPMD/Node/FunctionNode.php | 89 + .../src/main/php/PHPMD/Node/InterfaceNode.php | 68 + .../src/main/php/PHPMD/Node/MethodNode.php | 169 + .../src/main/php/PHPMD/Node/TraitNode.php | 68 + .../phpmd/phpmd/src/main/php/PHPMD/PHPMD.php | 243 + .../phpmd/phpmd/src/main/php/PHPMD/Parser.php | 313 + .../src/main/php/PHPMD/ParserFactory.php | 180 + .../src/main/php/PHPMD/ProcessingError.php | 122 + .../main/php/PHPMD/Renderer/HTMLRenderer.php | 188 + .../main/php/PHPMD/Renderer/TextRenderer.php | 92 + .../main/php/PHPMD/Renderer/XMLRenderer.php | 162 + .../phpmd/phpmd/src/main/php/PHPMD/Report.php | 207 + .../phpmd/phpmd/src/main/php/PHPMD/Rule.php | 235 + .../php/PHPMD/Rule/AbstractLocalVariable.php | 195 + .../src/main/php/PHPMD/Rule/ClassAware.php | 57 + .../Rule/CleanCode/BooleanArgumentFlag.php | 89 + .../PHPMD/Rule/CleanCode/ElseExpression.php | 101 + .../php/PHPMD/Rule/CleanCode/StaticAccess.php | 105 + .../Rule/Controversial/CamelCaseClassName.php | 82 + .../Controversial/CamelCaseMethodName.php | 108 + .../Controversial/CamelCaseParameterName.php | 84 + .../Controversial/CamelCasePropertyName.php | 83 + .../Controversial/CamelCaseVariableName.php | 104 + .../PHPMD/Rule/Controversial/Superglobals.php | 97 + .../php/PHPMD/Rule/CyclomaticComplexity.php | 86 + .../Rule/Design/CouplingBetweenObjects.php | 77 + .../PHPMD/Rule/Design/DepthOfInheritance.php | 84 + .../php/PHPMD/Rule/Design/EvalExpression.php | 75 + .../php/PHPMD/Rule/Design/ExitExpression.php | 75 + .../php/PHPMD/Rule/Design/GotoStatement.php | 77 + .../main/php/PHPMD/Rule/Design/LongClass.php | 85 + .../main/php/PHPMD/Rule/Design/LongMethod.php | 90 + .../PHPMD/Rule/Design/LongParameterList.php | 87 + .../php/PHPMD/Rule/Design/NpathComplexity.php | 88 + .../PHPMD/Rule/Design/NumberOfChildren.php | 84 + .../php/PHPMD/Rule/Design/TooManyFields.php | 85 + .../php/PHPMD/Rule/Design/TooManyMethods.php | 128 + .../PHPMD/Rule/Design/WeightedMethodCount.php | 80 + .../php/PHPMD/Rule/ExcessivePublicCount.php | 85 + .../src/main/php/PHPMD/Rule/FunctionAware.php | 57 + .../main/php/PHPMD/Rule/InterfaceAware.php | 57 + .../src/main/php/PHPMD/Rule/MethodAware.php | 57 + .../Rule/Naming/BooleanGetMethodName.php | 129 + .../Rule/Naming/ConstantNamingConventions.php | 78 + .../ConstructorWithNameAsEnclosingClass.php | 80 + .../php/PHPMD/Rule/Naming/LongVariable.php | 207 + .../php/PHPMD/Rule/Naming/ShortMethodName.php | 85 + .../php/PHPMD/Rule/Naming/ShortVariable.php | 232 + .../php/PHPMD/Rule/UnusedFormalParameter.php | 196 + .../php/PHPMD/Rule/UnusedLocalVariable.php | 211 + .../php/PHPMD/Rule/UnusedPrivateField.php | 220 + .../php/PHPMD/Rule/UnusedPrivateMethod.php | 166 + .../PHPMD/RuleClassFileNotFoundException.php | 67 + .../php/PHPMD/RuleClassNotFoundException.php | 66 + .../phpmd/src/main/php/PHPMD/RuleSet.php | 301 + .../src/main/php/PHPMD/RuleSetFactory.php | 527 ++ .../php/PHPMD/RuleSetNotFoundException.php | 66 + .../src/main/php/PHPMD/RuleViolation.php | 241 + .../src/main/php/PHPMD/TextUI/Command.php | 188 + .../php/PHPMD/TextUI/CommandLineOptions.php | 500 ++ .../main/php/PHPMD/Writer/StreamWriter.php | 110 + .../src/main/resources/rulesets/cleancode.xml | 97 + .../src/main/resources/rulesets/codesize.xml | 397 + .../main/resources/rulesets/controversial.xml | 149 + .../src/main/resources/rulesets/design.xml | 193 + .../src/main/resources/rulesets/naming.xml | 362 + .../main/resources/rulesets/unusedcode.xml | 99 + vendor/phpmd/phpmd/src/site/docx/changes.xml | 458 ++ .../src/site/resources/config/authors.ini | 14 + .../src/site/resources/config/binaries.ini | 41 + .../site/resources/config/content/blog.ini | 27 + .../site/resources/config/display/sitemap.ini | 37 + .../src/site/resources/config/handlers.ini | 50 + .../src/site/resources/config/metadata.ini | 19 + .../phpmd/src/site/resources/config/site.ini | 76 + .../site/resources/override/html/footer.ezt | 36 + .../site/resources/override/html/formats.ezt | 21 + .../site/resources/override/html/layout.ezt | 111 + .../resources/override/html/navigation.ezt | 5 + .../override/html/navigation/item.ezt | 15 + .../site/resources/override/html/release.ezt | 6 + .../src/site/resources/web/css/print.css | 36 + .../src/site/resources/web/css/screen.css | 251 + .../phpmd/src/site/resources/web/favicon.ico | Bin 0 -> 1150 bytes .../src/site/resources/web/images/box.png | Bin 0 -> 23974 bytes .../src/site/resources/web/images/logo.png | Bin 0 -> 23849 bytes vendor/phpmd/phpmd/src/site/rst/.index.xml | 32 + vendor/phpmd/phpmd/src/site/rst/about.rst | 32 + .../src/site/rst/documentation/.index.xml | 23 + .../src/site/rst/documentation/ant-task.rst | 115 + .../rst/documentation/creating-a-ruleset.rst | 197 + .../src/site/rst/documentation/index.rst | 109 + .../rst/documentation/suppress-warnings.rst | 71 + .../documentation/writing-a-phpmd-rule.rst | 418 + .../phpmd/src/site/rst/download/.index.xml | 18 + .../site/rst/download/extensions/.index.xml | 6 + .../site/rst/download/extensions/index.rst | 63 + .../phpmd/src/site/rst/download/index.rst | 62 + .../src/site/rst/download/releases/.index.xml | 24 + .../rst/download/releases/1.0.0/.index.xml | 7 + .../rst/download/releases/1.0.0/changelog.rst | 30 + .../rst/download/releases/1.0.1/.index.xml | 7 + .../rst/download/releases/1.0.1/changelog.rst | 33 + .../rst/download/releases/1.1.0/.index.xml | 7 + .../rst/download/releases/1.1.0/changelog.rst | 56 + .../rst/download/releases/1.1.1/.index.xml | 7 + .../rst/download/releases/1.1.1/changelog.rst | 28 + .../src/site/rst/download/releases/index.rst | 8 + .../phpmd/src/site/rst/people-behind.rst | 85 + vendor/phpmd/phpmd/src/site/rst/robots.txt | 35 + .../phpmd/phpmd/src/site/rst/rules/.index.xml | 27 + .../phpmd/src/site/rst/rules/cleancode.rst | 72 + .../phpmd/src/site/rst/rules/codesize.rst | 283 + .../src/site/rst/rules/controversial.rst | 103 + .../phpmd/phpmd/src/site/rst/rules/design.rst | 161 + .../phpmd/phpmd/src/site/rst/rules/index.rst | 112 + .../phpmd/phpmd/src/site/rst/rules/naming.rst | 161 + .../phpmd/src/site/rst/rules/unusedcode.rst | 85 + .../phpmd/src/site/rst/support/.index.xml | 7 + .../phpmd/src/site/rst/support/index.rst | 40 + vendor/phpmd/phpmd/src/site/scripts/pmd.xsl | 279 + .../phpmd/src/site/scripts/update-rules.php | 143 + .../phpmd/src/test/php/PHPMD/AbstractTest.php | 562 ++ .../CommandLineInputFileOptionTest.php | 119 + .../CouplingBetweenObjectsIntegrationTest.php | 93 + .../GotoStatementIntegrationTest.php | 89 + .../src/test/php/PHPMD/Node/ASTNodeTest.php | 134 + .../test/php/PHPMD/Node/AnnotationTest.php | 149 + .../test/php/PHPMD/Node/AnnotationsTest.php | 140 + .../src/test/php/PHPMD/Node/ClassNodeTest.php | 96 + .../src/test/php/PHPMD/Node/FunctionTest.php | 92 + .../test/php/PHPMD/Node/MethodNodeTest.php | 219 + .../phpmd/src/test/php/PHPMD/PMDTest.php | 195 + .../src/test/php/PHPMD/ParserFactoryTest.php | 198 + .../phpmd/src/test/php/PHPMD/ParserTest.php | 259 + .../test/php/PHPMD/ProcessingErrorTest.php | 113 + .../php/PHPMD/Regression/AbstractTest.php | 78 + ...ilesAndDirectoriesAsInputTicket001Test.php | 107 + ...licCountRuleNeverExecutedTicket015Test.php | 83 + ...ariableAndFormalParameterTicket007Test.php | 87 + ...lePrivatePropertiesTicket010096717Test.php | 93 + .../MaximumNestingLevelTicket24975295Test.php | 91 + ...cVariablesFlaggedAsUnusedTicket020Test.php | 74 + ...perGlobalsFlaggedAsUnusedTicket019Test.php | 74 + ...NotAppliesToUnusedPrivateMethod036Test.php | 77 + .../UnusedParameterArgvTicket14990109Test.php | 96 + .../php/PHPMD/Renderer/HTMLRendererTest.php | 147 + .../php/PHPMD/Renderer/TextRendererTest.php | 145 + .../php/PHPMD/Renderer/XMLRendererTest.php | 140 + .../phpmd/src/test/php/PHPMD/ReportTest.php | 217 + .../Rule/CleanCode/ElseExpressionTest.php | 29 + .../PHPMD/Rule/CleanCode/StaticAccessTest.php | 43 + .../Controversial/CamelCaseMethodNameTest.php | 163 + .../PHPMD/Rule/CyclomaticComplexityTest.php | 114 + .../Design/CouplingBetweenObjectsTest.php | 103 + .../Rule/Design/DepthOfInheritanceTest.php | 103 + .../PHPMD/Rule/Design/EvalExpressionTest.php | 136 + .../PHPMD/Rule/Design/ExitExpressionTest.php | 136 + .../PHPMD/Rule/Design/GotoStatementTest.php | 116 + .../php/PHPMD/Rule/Design/LongClassTest.php | 135 + .../php/PHPMD/Rule/Design/LongMethodTest.php | 135 + .../Rule/Design/LongParameterListTest.php | 181 + .../PHPMD/Rule/Design/NpathComplexityTest.php | 115 + .../Rule/Design/NumberOfChildrenTest.php | 103 + .../PHPMD/Rule/Design/TooManyFieldsTest.php | 103 + .../PHPMD/Rule/Design/TooManyMethodsTest.php | 175 + .../Rule/Design/WeightedMethodCountTest.php | 113 + .../PHPMD/Rule/ExcessivePublicCountTest.php | 102 + .../Rule/Naming/BooleanGetMethodNameTest.php | 184 + .../Naming/ConstantNamingConventionsTest.php | 112 + ...onstructorWithNameAsEnclosingClassTest.php | 100 + .../PHPMD/Rule/Naming/LongVariableTest.php | 336 + .../PHPMD/Rule/Naming/ShortMethodNameTest.php | 141 + .../PHPMD/Rule/Naming/ShortVariableTest.php | 384 + .../PHPMD/Rule/UnusedFormalParameterTest.php | 469 ++ .../PHPMD/Rule/UnusedLocalVariableTest.php | 550 ++ .../php/PHPMD/Rule/UnusedPrivateFieldTest.php | 305 + .../PHPMD/Rule/UnusedPrivateMethodTest.php | 264 + .../src/test/php/PHPMD/RuleSetFactoryTest.php | 669 ++ .../phpmd/src/test/php/PHPMD/RuleSetTest.php | 135 + .../phpmd/src/test/php/PHPMD/RuleTest.php | 174 + .../src/test/php/PHPMD/RuleViolationTest.php | 110 + .../php/PHPMD/Stubs/ClassNotFoundRule.php | 2 + .../src/test/php/PHPMD/Stubs/RuleStub.php | 89 + .../src/test/php/PHPMD/Stubs/WriterStub.php | 97 + .../PHPMD/TextUI/CommandLineOptionsTest.php | 246 + .../src/test/php/PHPMD/TextUI/CommandTest.php | 106 + vendor/phpmd/phpmd/src/test/php/bootstrap.php | 54 + .../CommandLineInputFileOption/Class1.php | 7 + .../CommandLineInputFileOption/Class2.php | 6 + .../CommandLineInputFileOption/Class3.php | 7 + .../CommandLineInputFileOption/inputfile.txt | 2 + ...tContainsCouplingBetweenObjectsWarning.php | 105 + ...testReportContainsGotoStatementWarning.php | 10 + ...etParentTypeReturnsClassForClassMethod.php | 15 + ...TypeReturnsInterfaceForInterfaceMethod.php | 9 + ...ssWarningsDelegatesToParentClassMethod.php | 16 + ...rningsDelegatesToParentInterfaceMethod.php | 16 + ...sWarningsExecutesDefaultImplementation.php | 22 + ...turnsFalseForImplementedAbstractMethod.php | 14 + ...urnsFalseForImplementedInterfaceMethod.php | 14 + ...eturnsFalseForInheritMethodDeclaration.php | 17 + ...arationReturnsTrueForMethodDeclaration.php | 8 + ...urnsTrueForMethodDeclarationWithParent.php | 17 + .../files/ParserFactory/Directory/Test.php | 5 + .../files/ParserFactory/File/Test.php | 5 + .../files/Regression/001/source/FooBar.php | 5 + ...UsedInDoubleQuoteStringGetsNotReported.php | 8 + ...UsedInDoubleQuoteStringGetsNotReported.php | 10 + ...stRuleNotAppliesForLongPrivateProperty.php | 5 + ...NotAppliesForLongPrivateStaticProperty.php | 5 + ...testRuleSetInvokesRuleForClassInstance.php | 5 + ...leDoesNotApplyToAnySuperGlobalVariable.php | 19 + ...leDoesNotApplyToAnyStaticLocalVariable.php | 11 + ...teMethodWithSuppressWarningsAnnotation.php | 11 + ...esNotApplyToFunctionParameterNamedArgv.php | 8 + ...DoesNotApplyToMethodParameterNamedArgv.php | 11 + ...UsedInDoubleQuoteStringGetsNotReported.php | 85 + ...mesToMethodWithMultipleElseExpressions.php | 17 + ...tRuleAppliesToMethodWithElseExpression.php | 11 + ...otAppliesToMethodWithoutElseExpression.php | 11 + .../testRuleAppliesToStaticMethodAccess.php | 9 + .../testRuleNotAppliesToConstantAccess.php | 9 + .../testRuleNotAppliesToDynamicMethodCall.php | 10 + .../testRuleNotAppliesToParentStaticCall.php | 9 + .../testRuleNotAppliesToSelfStaticCall.php | 11 + ...tRuleDoesApplyForMethodNameWithCapital.php | 8 + ...eDoesApplyForMethodNameWithUnderscores.php | 8 + ...MethodNameWithUnderscoreWhenNotAllowed.php | 8 + ...testRuleDoesNotApplyForValidMethodName.php | 8 + ...lidMethodNameWithUnderscoreWhenAllowed.php | 8 + ...tipleTimesToFunctionWithEvalExpression.php | 10 + ...ultipleTimesToMethodWithEvalExpression.php | 13 + ...uleAppliesToFunctionWithEvalExpression.php | 5 + ...tRuleAppliesToMethodWithEvalExpression.php | 8 + ...AppliesToFunctionWithoutEvalExpression.php | 5 + ...otAppliesToMethodWithoutEvalExpression.php | 8 + ...tipleTimesToFunctionWithExitExpression.php | 10 + ...ultipleTimesToMethodWithExitExpression.php | 13 + ...uleAppliesToFunctionWithExitExpression.php | 5 + ...tRuleAppliesToMethodWithExitExpression.php | 8 + ...AppliesToFunctionWithoutExitExpression.php | 5 + ...otAppliesToMethodWithoutExitExpression.php | 8 + ...RuleAppliesToFunctionWithGotoStatement.php | 10 + ...stRuleAppliesToMethodWithGotoStatement.php | 13 + ...tAppliesToFunctionWithoutGotoStatement.php | 5 + ...NotAppliesToMethodWithoutGotoStatement.php | 8 + ...oMethodStartingWithGetAndReturningBool.php | 8 + ...thodStartingWithGetAndReturningBoolean.php | 11 + ...thodStartingWithGetAndReturningBoolean.php | 11 + ...resParametersWhenNotExplicitConfigured.php | 8 + ...tRuleNotAppliesToMethodStartingWithHas.php | 8 + ...stRuleNotAppliesToMethodStartingWithIs.php | 8 + ...ppliesToMethodWithReturnTypeNotBoolean.php | 8 + ...ppliesWhenParametersAreExplicitEnabled.php | 8 + ...ToClassConstantWithLowerCaseCharacters.php | 7 + ...terfaceConstantWithLowerCaseCharacters.php | 5 + ...ToClassConstantWithUpperCaseCharacters.php | 7 + ...terfaceConstantWithUpperCaseCharacters.php | 9 + ...ConstructorMethodNamedAsEnclosingClass.php | 8 + ...odNamedAsEnclosingClassCaseInsensitive.php | 8 + ...esToMethodNamedSimilarToEnclosingClass.php | 8 + ...ndParameterWithNameLongerThanThreshold.php | 10 + ...liesToFieldWithNameLongerThanThreshold.php | 5 + ...onParameterWithNameLongerThanThreshold.php | 5 + ...eAppliesToIdenticalVariableOnlyOneTime.php | 11 + ...riablesInDifferentContextsSeveralTimes.php | 13 + ...eInFunctionWithNameLongerThanThreshold.php | 5 + ...bleInMethodWithNameLongerThanThreshold.php | 8 + ...odParameterWithNameLongerThanThreshold.php | 8 + ...stRuleNotAppliesForLongPrivateProperty.php | 5 + ...NotAppliesForLongPrivateStaticProperty.php | 5 + ...AppliesToFieldWithNameEqualToThreshold.php | 5 + ...iesToFieldWithNameShorterThanThreshold.php | 5 + ...nParameterWithNameSmallerThanThreshold.php | 5 + ...ableInFunctionWithNameEqualToThreshold.php | 5 + ...InFunctionWithNameSmallerThanThreshold.php | 5 + ...riableInMethodWithNameEqualToThreshold.php | 8 + ...leInMethodWithNameShorterThanThreshold.php | 8 + ...dParameterWithNameShorterThanThreshold.php | 8 + ...AppliesToStaticMembersAccessedInMethod.php | 10 + ...ToFunctionWithNameShorterThanThreshold.php | 5 + ...esToMethodWithNameShorterThanThreshold.php | 8 + ...liesToFunctionWithNameEqualToThreshold.php | 5 + ...sToFunctionWithNameLongerThanThreshold.php | 5 + ...ppliesToMethodWithNameEqualToThreshold.php | 8 + ...iesToMethodWithNameLongerThanThreshold.php | 8 + ...dParameterWithNameShorterThanThreshold.php | 7 + ...iesToFieldWithNameShorterThanThreshold.php | 5 + ...nParameterWithNameShorterThanThreshold.php | 5 + ...eAppliesToIdenticalVariableOnlyOneTime.php | 11 + ...riablesInDifferentContextsSeveralTimes.php | 13 + ...InFunctionWithNameShorterThanThreshold.php | 5 + ...leInMethodWithNameShorterThanThreshold.php | 8 + ...dParameterWithNameShorterThanThreshold.php | 5 + ...AppliesToFieldWithNameEqualToThreshold.php | 5 + ...iesToFieldWithNameGreaterThanThreshold.php | 5 + ...onParameterWithNameLongerThanThreshold.php | 5 + ...ableInFunctionWithNameEqualToThreshold.php | 5 + ...eInFunctionWithNameLongerThanThreshold.php | 5 + ...riableInMethodWithNameEqualToThreshold.php | 8 + ...bleInMethodWithNameLongerThanThreshold.php | 8 + ...odParameterWithNameLongerThanThreshold.php | 5 + ...pliesToShortVariableNameAsForLoopIndex.php | 7 + ...sToShortVariableNameAsForeachLoopIndex.php | 7 + ...iesToShortVariableNameInCatchStatement.php | 7 + ...AppliesToStaticMembersAccessedInMethod.php | 10 + ...otAppliesToVariablesFromExceptionsList.php | 11 + ...meterWhenSimilarStaticMemberIsAccessed.php | 10 + ...AppliesToFunctionUnusedFormalParameter.php | 5 + ...leAppliesToMethodUnusedFormalParameter.php | 8 + ...oMultipleFunctionUnusedFormalParameter.php | 5 + ...sToMultipleMethodUnusedFormalParameter.php | 8 + ...otApplyToAbstractMethodFormalParameter.php | 5 + ...ormalParameterUsedInCompoundExpression.php | 10 + ...oesNotApplyToImplementedAbstractMethod.php | 14 + ...esNotApplyToImplementedInterfaceMethod.php | 14 + .../testRuleDoesNotApplyToInheritMethod.php | 17 + ...DoesNotApplyToInnerFunctionDeclaration.php | 12 + ...tApplyToInterfaceMethodFormalParameter.php | 5 + .../testRuleDoesNotApplyToMethodArgument.php | 8 + ...tApplyToMethodArgumentUsedAsArrayIndex.php | 10 + ...uleDoesNotApplyToMethodWithFuncGetArgs.php | 8 + ...tApplyToMethodWithInheritdocAnnotation.php | 11 + ...ethodWithInheritdocAnnotationCamelCase.php | 11 + ...oesNotApplyToParameterUsedAsArrayIndex.php | 8 + ...esNotApplyToParameterUsedAsStringIndex.php | 8 + ...lParameterUsedInMethodCompoundVariable.php | 8 + ...arameterUsedInPropertyCompoundVariable.php | 8 + ...t_compact_function_rule_does_not_apply.php | 8 + ...n_rule_only_applies_to_used_parameters.php | 8 + ...t_function_rule_works_case_insensitive.php | 8 + ...c_get_args_rule_works_case_insensitive.php | 8 + ...d_compact_function_rule_does_not_apply.php | 11 + ...n_rule_only_applies_to_used_parameters.php | 11 + ...t_function_rule_works_case_insensitive.php | 11 + ...tionParametersDoNotHideUnusedVariables.php | 9 + ...iableWithSameNameAsStaticArrayProperty.php | 11 + ...alVariableWithSameNameAsStaticProperty.php | 10 + .../testRuleAppliesToUnusedLocalVariable.php | 8 + .../testRuleDoesNotApplyToArgcSuperGlobal.php | 8 + .../testRuleDoesNotApplyToArgvSuperGlobal.php | 8 + .../testRuleDoesNotApplyToCatchStatement.php | 11 + .../testRuleDoesNotApplyToCompactFunction.php | 9 + ...estRuleDoesNotApplyToCookieSuperGlobal.php | 8 + .../testRuleDoesNotApplyToDynamicProperty.php | 9 + .../testRuleDoesNotApplyToEnvSuperGlobal.php | 8 + ...testRuleDoesNotApplyToFilesSuperGlobal.php | 8 + .../testRuleDoesNotApplyToGetSuperGlobal.php | 8 + ...stRuleDoesNotApplyToGlobalsSuperGlobal.php | 8 + ...esNotApplyToHttpRawPostDataSuperGlobal.php | 8 + ...otApplyToLocalVariableUsedAsArrayIndex.php | 10 + ...tApplyToLocalVariableUsedAsStringIndex.php | 10 + ...yToLocalVariableUsedInCompoundVariable.php | 11 + .../testRuleDoesNotApplyToMethodArgument.php | 9 + ...oesNotApplyToNamespacedCompactFunction.php | 12 + .../testRuleDoesNotApplyToPostSuperGlobal.php | 8 + ...stRuleDoesNotApplyToRequestSuperGlobal.php | 8 + ...estRuleDoesNotApplyToServerSuperGlobal.php | 8 + ...stRuleDoesNotApplyToSessionSuperGlobal.php | 8 + ...tRuleDoesNotApplyToStaticArrayProperty.php | 10 + ...RuleDoesNotApplyToStaticObjectProperty.php | 10 + .../testRuleDoesNotApplyToStaticProperty.php | 10 + .../testRuleDoesNotApplyToThisVariable.php | 8 + ...otApplyToUnusedLocalVariableInFunction.php | 7 + ...sNotApplyToUnusedLocalVariableInMethod.php | 10 + ...testRuleDoesNotApplyToUnusedParameters.php | 8 + ...t_function_rule_works_case_insensitive.php | 10 + ...t_function_rule_works_case_insensitive.php | 13 + .../testRuleAppliesToUnusedPrivateField.php | 5 + ...tRuleAppliesToUnusedPrivateStaticField.php | 5 + ...ithSameNameIsAccessedOnDifferentObject.php | 10 + ...ocalVariableIsUsedInStaticMemberPrefix.php | 15 + ...WithSameNameIsAccessedOnDifferentClass.php | 10 + ...ticFieldWithSameNameIsAccessedOnParent.php | 10 + ...otApplyToClassNameAccessedPrivateField.php | 10 + ...eDoesNotApplyToPrivateArrayFieldAccess.php | 10 + ...ApplyToPrivateFieldInChainedMethodCall.php | 13 + ...otApplyToPrivateStringIndexFieldAccess.php | 10 + ...DoesNotApplyToSelfAccessedPrivateField.php | 10 + ...esNotApplyToStaticAccessedPrivateField.php | 10 + ...DoesNotApplyToThisAccessedPrivateField.php | 10 + ...RuleDoesNotApplyToUnusedProtectedField.php | 5 + ...estRuleDoesNotApplyToUnusedPublicField.php | 5 + ...otResultInFatalErrorByCallingNonObject.php | 10 + ...sToParentReferencedUnusedPrivateMethod.php | 13 + .../testRuleAppliesToUnusedPrivateMethod.php | 8 + ...RuleAppliesToUnusedStaticPrivateMethod.php | 8 + ...WhenMethodIsReferencedOnDifferentClass.php | 13 + ...henMethodIsReferencedOnDifferentObject.php | 13 + ...thodWithSimilarNameIsInInvocationChain.php | 18 + ...henPropertyWithSimilarNameIsReferenced.php | 13 + ...oesNotApplyToClassNameReferencedMethod.php | 13 + ...stRuleDoesNotApplyToPrivateCloneMethod.php | 8 + ...stRuleDoesNotApplyToPrivateConstructor.php | 8 + ...pplyToPrivateMethodInChainedMethodCall.php | 13 + ...leDoesNotApplyToPrivatePhp4Constructor.php | 8 + ...RuleDoesNotApplyToSelfReferencedMethod.php | 13 + ...leDoesNotApplyToStaticReferencedMethod.php | 13 + ...RuleDoesNotApplyToThisReferencedMethod.php | 13 + ...estApplyInvokesRuleWhenStrictModeIsSet.php | 8 + ...nvokesRuleWhenSuppressAnnotationExists.php | 8 + .../TextUI/CommandLineOptions/inputfile.txt | 2 + .../src/test/resources/files/pdepend.xml.dist | 15 + .../test/resources/files/pmd/default-xml.xml | 8 + .../resources/files/pmd/single-directory.xml | 21 + .../test/resources/files/pmd/single-file.xml | 8 + .../files/renderer/xml_renderer_expected1.xml | 16 + .../xml_renderer_processing_errors.xml | 6 + .../alternative-property-value-syntax.xml | 23 + .../files/rulesets/exclude-pattern.xml | 22 + .../resources/files/rulesets/pmd-refset1.xml | 16 + .../files/rulesets/refset-exclude-all.xml | 18 + .../files/rulesets/refset-exclude-one.xml | 17 + .../test/resources/files/rulesets/refset1.xml | 13 + .../test/resources/files/rulesets/refset2.xml | 13 + .../test/resources/files/rulesets/refset3.xml | 19 + .../test/resources/files/rulesets/refset4.xml | 16 + .../rulesets/set-class-file-not-found.xml | 15 + .../files/rulesets/set-class-not-found.xml | 15 + .../files/rulesets/set-invalid-xml.xml | 4 + .../test/resources/files/rulesets/set1.xml | 29 + .../test/resources/files/rulesets/set2.xml | 31 + .../resources/files/source/ccn_function.php | 35 + .../resources/files/source/npath_method.php4 | 15 + .../source/source_with_npath_violation.php | 19 + .../source/source_without_violations.php | 14 + .../Symfony/Component/Config/.gitignore | 3 + .../Symfony/Component/Config/CHANGELOG.md | 21 + .../Symfony/Component/Config/ConfigCache.php | 126 + .../Component/Config/Definition/ArrayNode.php | 390 + .../Component/Config/Definition/BaseNode.php | 359 + .../Config/Definition/BooleanNode.php | 39 + .../Builder/ArrayNodeDefinition.php | 488 ++ .../Builder/BooleanNodeDefinition.php | 42 + .../Definition/Builder/EnumNodeDefinition.php | 53 + .../Config/Definition/Builder/ExprBuilder.php | 236 + .../Builder/FloatNodeDefinition.php | 32 + .../Builder/IntegerNodeDefinition.php | 32 + .../Definition/Builder/MergeBuilder.php | 72 + .../Config/Definition/Builder/NodeBuilder.php | 246 + .../Definition/Builder/NodeDefinition.php | 343 + .../Builder/NodeParentInterface.php | 21 + .../Builder/NormalizationBuilder.php | 67 + .../Builder/NumericNodeDefinition.php | 61 + .../Builder/ParentNodeDefinitionInterface.php | 26 + .../Builder/ScalarNodeDefinition.php | 32 + .../Config/Definition/Builder/TreeBuilder.php | 63 + .../Definition/Builder/ValidationBuilder.php | 51 + .../Builder/VariableNodeDefinition.php | 64 + .../Definition/ConfigurationInterface.php | 27 + .../Definition/Dumper/XmlReferenceDumper.php | 300 + .../Definition/Dumper/YamlReferenceDumper.php | 199 + .../Component/Config/Definition/EnumNode.php | 58 + .../Exception/DuplicateKeyException.php | 22 + .../Config/Definition/Exception/Exception.php | 21 + .../Exception/ForbiddenOverwriteException.php | 22 + .../InvalidConfigurationException.php | 33 + .../Exception/InvalidDefinitionException.php | 21 + .../Exception/InvalidTypeException.php | 21 + .../Exception/UnsetKeyException.php | 22 + .../Component/Config/Definition/FloatNode.php | 40 + .../Config/Definition/IntegerNode.php | 35 + .../Config/Definition/NodeInterface.php | 87 + .../Config/Definition/NumericNode.php | 55 + .../Component/Config/Definition/Processor.php | 97 + .../Definition/PrototypeNodeInterface.php | 27 + .../Config/Definition/PrototypedArrayNode.php | 331 + .../Config/Definition/ReferenceDumper.php | 21 + .../Config/Definition/ScalarNode.php | 46 + .../Config/Definition/VariableNode.php | 114 + ...LoaderImportCircularReferenceException.php | 27 + .../Exception/FileLoaderLoadException.php | 81 + .../Symfony/Component/Config/FileLocator.php | 95 + .../Component/Config/FileLocatorInterface.php | 31 + .../config/Symfony/Component/Config/LICENSE | 19 + .../Config/Loader/DelegatingLoader.php | 55 + .../Component/Config/Loader/FileLoader.php | 124 + .../Component/Config/Loader/Loader.php | 78 + .../Config/Loader/LoaderInterface.php | 54 + .../Config/Loader/LoaderResolver.php | 75 + .../Config/Loader/LoaderResolverInterface.php | 30 + .../config/Symfony/Component/Config/README.md | 17 + .../Config/Resource/DirectoryResource.php | 99 + .../Config/Resource/FileResource.php | 75 + .../Config/Resource/ResourceInterface.php | 43 + .../Config/Tests/ConfigCacheTest.php | 138 + .../Config/Tests/Definition/ArrayNodeTest.php | 160 + .../Tests/Definition/BooleanNodeTest.php | 60 + .../Builder/ArrayNodeDefinitionTest.php | 207 + .../Builder/EnumNodeDefinitionTest.php | 46 + .../Definition/Builder/ExprBuilderTest.php | 216 + .../Definition/Builder/NodeBuilderTest.php | 94 + .../Builder/NumericNodeDefinitionTest.php | 93 + .../Definition/Builder/TreeBuilderTest.php | 127 + .../Dumper/XmlReferenceDumperTest.php | 80 + .../Dumper/YamlReferenceDumperTest.php | 67 + .../Config/Tests/Definition/EnumNodeTest.php | 41 + .../Tests/Definition/FinalizationTest.php | 73 + .../Config/Tests/Definition/FloatNodeTest.php | 64 + .../Tests/Definition/IntegerNodeTest.php | 61 + .../Config/Tests/Definition/MergeTest.php | 195 + .../Tests/Definition/NormalizationTest.php | 229 + .../Definition/PrototypedArrayNodeTest.php | 180 + .../Tests/Definition/ScalarNodeTest.php | 60 + .../Config/Tests/FileLocatorTest.php | 119 + .../Config/Tests/Fixtures/Again/foo.xml | 0 .../Fixtures/Builder/BarNodeDefinition.php | 21 + .../Tests/Fixtures/Builder/NodeBuilder.php | 34 + .../Builder/VariableNodeDefinition.php | 18 + .../Configuration/ExampleConfiguration.php | 71 + .../Tests/Fixtures/Util/document_type.xml | 3 + .../Config/Tests/Fixtures/Util/invalid.xml | 2 + .../Tests/Fixtures/Util/invalid_schema.xml | 2 + .../Config/Tests/Fixtures/Util/schema.xsd | 9 + .../Config/Tests/Fixtures/Util/valid.xml | 3 + .../Component/Config/Tests/Fixtures/foo.xml | 0 .../Tests/Loader/DelegatingLoaderTest.php | 83 + .../Config/Tests/Loader/FileLoaderTest.php | 107 + .../Tests/Loader/LoaderResolverTest.php | 56 + .../Config/Tests/Loader/LoaderTest.php | 117 + .../Tests/Resource/DirectoryResourceTest.php | 152 + .../Tests/Resource/FileResourceTest.php | 58 + .../Config/Tests/Util/XmlUtilsTest.php | 190 + .../Component/Config/Util/XmlUtils.php | 236 + .../Symfony/Component/Config/composer.json | 32 + .../Symfony/Component/Config/phpunit.xml.dist | 25 + .../Component/DependencyInjection/.gitignore | 3 + .../Component/DependencyInjection/Alias.php | 71 + .../DependencyInjection/CHANGELOG.md | 35 + .../Compiler/AnalyzeServiceReferencesPass.php | 148 + .../Compiler/CheckCircularReferencesPass.php | 79 + .../Compiler/CheckDefinitionValidityPass.php | 90 + ...xceptionOnInvalidReferenceBehaviorPass.php | 64 + .../Compiler/CheckReferenceValidityPass.php | 167 + .../DependencyInjection/Compiler/Compiler.php | 120 + .../Compiler/CompilerPassInterface.php | 33 + .../Compiler/DecoratorServicePass.php | 54 + .../Compiler/InlineServiceDefinitionsPass.php | 152 + .../Compiler/LoggingFormatter.php | 45 + .../MergeExtensionConfigurationPass.php | 59 + .../Compiler/PassConfig.php | 256 + .../RemoveAbstractDefinitionsPass.php | 39 + .../Compiler/RemovePrivateAliasesPass.php | 44 + .../Compiler/RemoveUnusedDefinitionsPass.php | 84 + .../Compiler/RepeatablePassInterface.php | 28 + .../Compiler/RepeatedPass.php | 88 + .../ReplaceAliasByActualDefinitionPass.php | 125 + .../ResolveDefinitionTemplatesPass.php | 154 + .../Compiler/ResolveInvalidReferencesPass.php | 105 + .../ResolveParameterPlaceHoldersPass.php | 63 + .../ResolveReferencesToAliasesPass.php | 99 + .../Compiler/ServiceReferenceGraph.php | 114 + .../Compiler/ServiceReferenceGraphEdge.php | 70 + .../Compiler/ServiceReferenceGraphNode.php | 122 + .../DependencyInjection/Container.php | 567 ++ .../DependencyInjection/ContainerAware.php | 41 + .../ContainerAwareInterface.php | 31 + .../ContainerAwareTrait.php | 35 + .../DependencyInjection/ContainerBuilder.php | 1169 +++ .../ContainerInterface.php | 158 + .../DependencyInjection/Definition.php | 742 ++ .../DefinitionDecorator.php | 218 + .../DependencyInjection/Dumper/Dumper.php | 38 + .../Dumper/DumperInterface.php | 33 + .../Dumper/GraphvizDumper.php | 302 + .../DependencyInjection/Dumper/PhpDumper.php | 1429 ++++ .../DependencyInjection/Dumper/XmlDumper.php | 337 + .../DependencyInjection/Dumper/YamlDumper.php | 336 + .../Exception/BadMethodCallException.php | 19 + .../Exception/ExceptionInterface.php | 22 + .../Exception/InactiveScopeException.php | 41 + .../Exception/InvalidArgumentException.php | 21 + .../Exception/LogicException.php | 19 + .../Exception/OutOfBoundsException.php | 19 + .../ParameterCircularReferenceException.php | 34 + .../Exception/ParameterNotFoundException.php | 95 + .../Exception/RuntimeException.php | 21 + .../ScopeCrossingInjectionException.php | 65 + .../ScopeWideningInjectionException.php | 64 + .../ServiceCircularReferenceException.php | 41 + .../Exception/ServiceNotFoundException.php | 56 + .../ExpressionLanguage.php | 42 + .../ConfigurationExtensionInterface.php | 33 + .../Extension/Extension.php | 124 + .../Extension/ExtensionInterface.php | 65 + .../Extension/PrependExtensionInterface.php | 24 + .../IntrospectableContainerInterface.php | 32 + .../Component/DependencyInjection/LICENSE | 19 + .../Instantiator/InstantiatorInterface.php | 37 + .../Instantiator/RealServiceInstantiator.php | 33 + .../LazyProxy/PhpDumper/DumperInterface.php | 50 + .../LazyProxy/PhpDumper/NullDumper.php | 46 + .../Loader/ClosureLoader.php | 53 + .../DependencyInjection/Loader/FileLoader.php | 39 + .../Loader/IniFileLoader.php | 52 + .../Loader/PhpFileLoader.php | 49 + .../Loader/XmlFileLoader.php | 528 ++ .../Loader/YamlFileLoader.php | 392 + .../schema/dic/services/services-1.0.xsd | 189 + .../DependencyInjection/Parameter.php | 44 + .../ParameterBag/FrozenParameterBag.php | 72 + .../ParameterBag/ParameterBag.php | 304 + .../ParameterBag/ParameterBagInterface.php | 115 + .../Component/DependencyInjection/README.md | 81 + .../DependencyInjection/Reference.php | 72 + .../Component/DependencyInjection/Scope.php | 50 + .../DependencyInjection/ScopeInterface.php | 32 + .../DependencyInjection/SimpleXMLElement.php | 114 + .../TaggedContainerInterface.php | 33 + .../AnalyzeServiceReferencesPassTest.php | 149 + .../CheckCircularReferencesPassTest.php | 137 + .../CheckDefinitionValidityPassTest.php | 91 + ...tionOnInvalidReferenceBehaviorPassTest.php | 71 + .../CheckReferenceValidityPassTest.php | 98 + .../Compiler/DecoratorServicePassTest.php | 81 + .../InlineServiceDefinitionsPassTest.php | 245 + .../Tests/Compiler/IntegrationTest.php | 114 + .../RemoveUnusedDefinitionsPassTest.php | 116 + ...ReplaceAliasByActualDefinitionPassTest.php | 59 + .../ResolveDefinitionTemplatesPassTest.php | 181 + .../ResolveInvalidReferencesPassTest.php | 83 + .../ResolveReferencesToAliasesPassTest.php | 67 + .../Tests/ContainerBuilderTest.php | 818 ++ .../Tests/ContainerTest.php | 597 ++ .../Tests/CrossCheckTest.php | 96 + .../Tests/DefinitionDecoratorTest.php | 120 + .../Tests/DefinitionTest.php | 336 + .../Tests/Dumper/GraphvizDumperTest.php | 80 + .../Tests/Dumper/PhpDumperTest.php | 217 + .../Tests/Dumper/XmlDumperTest.php | 134 + .../Tests/Dumper/YamlDumperTest.php | 59 + .../Tests/Extension/ExtensionTest.php | 81 + .../Tests/Fixtures/containers/container10.php | 14 + .../Tests/Fixtures/containers/container11.php | 12 + .../Tests/Fixtures/containers/container12.php | 13 + .../Tests/Fixtures/containers/container13.php | 16 + .../Tests/Fixtures/containers/container14.php | 11 + .../Tests/Fixtures/containers/container15.php | 11 + .../Tests/Fixtures/containers/container16.php | 11 + .../Tests/Fixtures/containers/container17.php | 10 + .../Tests/Fixtures/containers/container18.php | 14 + .../Tests/Fixtures/containers/container8.php | 14 + .../Tests/Fixtures/containers/container9.php | 107 + .../Tests/Fixtures/containers/interfaces1.php | 25 + .../Tests/Fixtures/containers/interfaces2.php | 34 + .../Tests/Fixtures/graphviz/services1.dot | 7 + .../Tests/Fixtures/graphviz/services10-1.dot | 10 + .../Tests/Fixtures/graphviz/services10.dot | 10 + .../Tests/Fixtures/graphviz/services13.dot | 10 + .../Tests/Fixtures/graphviz/services14.dot | 7 + .../Tests/Fixtures/graphviz/services17.dot | 8 + .../Tests/Fixtures/graphviz/services18.dot | 8 + .../Tests/Fixtures/graphviz/services9.dot | 40 + .../Fixtures/includes/ProjectExtension.php | 40 + .../includes/ProjectWithXsdExtension.php | 19 + .../ProjectWithXsdExtensionInPhar.phar | Bin 0 -> 1138 bytes .../Tests/Fixtures/includes/classes.php | 61 + .../Tests/Fixtures/includes/createphar.php | 47 + .../Tests/Fixtures/includes/foo.php | 38 + .../Fixtures/includes/schema/project-1.0.xsd | 13 + .../Tests/Fixtures/ini/nonvalid.ini | 2 + .../Tests/Fixtures/ini/parameters.ini | 3 + .../Tests/Fixtures/ini/parameters1.ini | 3 + .../Tests/Fixtures/ini/parameters2.ini | 2 + .../Tests/Fixtures/php/services1-1.php | 27 + .../Tests/Fixtures/php/services1.php | 26 + .../Tests/Fixtures/php/services10.php | 111 + .../Tests/Fixtures/php/services11.php | 53 + .../Tests/Fixtures/php/services12.php | 110 + .../Tests/Fixtures/php/services8.php | 51 + .../Tests/Fixtures/php/services9.php | 347 + .../Tests/Fixtures/php/services9_compiled.php | 343 + .../Tests/Fixtures/php/simple.php | 3 + .../Fixtures/xml/extension1/services.xml | 14 + .../Fixtures/xml/extension2/services.xml | 14 + .../Fixtures/xml/extensions/services1.xml | 19 + .../Fixtures/xml/extensions/services2.xml | 19 + .../Fixtures/xml/extensions/services3.xml | 19 + .../Fixtures/xml/extensions/services4.xml | 6 + .../Fixtures/xml/extensions/services5.xml | 11 + .../Fixtures/xml/extensions/services6.xml | 11 + .../Fixtures/xml/extensions/services7.xml | 11 + .../Tests/Fixtures/xml/namespaces.xml | 17 + .../Tests/Fixtures/xml/nonvalid.xml | 3 + .../Tests/Fixtures/xml/services1.xml | 2 + .../Tests/Fixtures/xml/services10.xml | 16 + .../Tests/Fixtures/xml/services13.xml | 9 + .../Tests/Fixtures/xml/services14.xml | 19 + .../Tests/Fixtures/xml/services2.xml | 31 + .../Tests/Fixtures/xml/services3.xml | 13 + .../Tests/Fixtures/xml/services4.xml | 13 + .../Fixtures/xml/services4_bad_import.xml | 9 + .../Tests/Fixtures/xml/services5.xml | 21 + .../Tests/Fixtures/xml/services6.xml | 56 + .../Tests/Fixtures/xml/services7.xml | 9 + .../Tests/Fixtures/xml/services8.xml | 22 + .../Tests/Fixtures/xml/services9.xml | 97 + .../Tests/Fixtures/xml/withdoctype.xml | 3 + .../Tests/Fixtures/yaml/bad_calls.yml | 4 + .../Tests/Fixtures/yaml/bad_import.yml | 2 + .../Tests/Fixtures/yaml/bad_imports.yml | 2 + .../Tests/Fixtures/yaml/bad_parameters.yml | 2 + .../Tests/Fixtures/yaml/bad_service.yml | 2 + .../Tests/Fixtures/yaml/bad_services.yml | 1 + .../Tests/Fixtures/yaml/badtag1.yml | 5 + .../Tests/Fixtures/yaml/badtag2.yml | 6 + .../Tests/Fixtures/yaml/badtag3.yml | 6 + .../Tests/Fixtures/yaml/badtag4.yml | 6 + .../Tests/Fixtures/yaml/nonvalid1.yml | 2 + .../Tests/Fixtures/yaml/nonvalid2.yml | 1 + .../Tests/Fixtures/yaml/services1.yml | 1 + .../Tests/Fixtures/yaml/services10.yml | 9 + .../Tests/Fixtures/yaml/services11.yml | 1 + .../Tests/Fixtures/yaml/services13.yml | 3 + .../Tests/Fixtures/yaml/services2.yml | 12 + .../Tests/Fixtures/yaml/services3.yml | 5 + .../Tests/Fixtures/yaml/services4.yml | 7 + .../Fixtures/yaml/services4_bad_import.yml | 2 + .../Tests/Fixtures/yaml/services6.yml | 37 + .../Tests/Fixtures/yaml/services7.yml | 2 + .../Tests/Fixtures/yaml/services8.yml | 7 + .../Tests/Fixtures/yaml/services9.yml | 92 + .../RealServiceInstantiatorTest.php | 37 + .../LazyProxy/PhpDumper/NullDumperTest.php | 35 + .../Tests/Loader/ClosureLoaderTest.php | 43 + .../Tests/Loader/IniFileLoaderTest.php | 80 + .../Tests/Loader/PhpFileLoaderTest.php | 43 + .../Tests/Loader/XmlFileLoaderTest.php | 455 ++ .../Tests/Loader/YamlFileLoaderTest.php | 243 + .../ParameterBag/FrozenParameterBagTest.php | 60 + .../Tests/ParameterBag/ParameterBagTest.php | 279 + .../Tests/ParameterTest.php | 26 + .../Tests/ReferenceTest.php | 32 + .../DependencyInjection/Variable.php | 50 + .../DependencyInjection/composer.json | 41 + .../DependencyInjection/phpunit.xml.dist | 25 + .../Symfony/Component/Filesystem/.gitignore | 3 + .../Symfony/Component/Filesystem/CHANGELOG.md | 23 + .../Exception/ExceptionInterface.php | 23 + .../Exception/FileNotFoundException.php | 34 + .../Filesystem/Exception/IOException.php | 41 + .../Exception/IOExceptionInterface.php | 27 + .../Component/Filesystem/Filesystem.php | 490 ++ .../Symfony/Component/Filesystem/LICENSE | 19 + .../Symfony/Component/Filesystem/README.md | 47 + .../Filesystem/Tests/ExceptionTest.php | 46 + .../Filesystem/Tests/FilesystemTest.php | 922 +++ .../Filesystem/Tests/FilesystemTestCase.php | 127 + .../Component/Filesystem/composer.json | 31 + .../Component/Filesystem/phpunit.xml.dist | 23 + 1095 files changed, 108320 insertions(+), 2 deletions(-) create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 phpunit.xml.dist create mode 100644 tests/bootstrap.php create mode 100644 tests/test-gimmick.php create mode 100644 vendor/autoload.php create mode 120000 vendor/bin/pdepend create mode 120000 vendor/bin/phpmd create mode 100644 vendor/composer/ClassLoader.php create mode 100644 vendor/composer/autoload_classmap.php create mode 100644 vendor/composer/autoload_namespaces.php create mode 100644 vendor/composer/autoload_psr4.php create mode 100644 vendor/composer/autoload_real.php create mode 100644 vendor/composer/installed.json create mode 100644 vendor/composer/installers/.editorconfig create mode 100644 vendor/composer/installers/.gitignore create mode 100644 vendor/composer/installers/.travis.yml create mode 100644 vendor/composer/installers/LICENSE create mode 100644 vendor/composer/installers/README.md create mode 100644 vendor/composer/installers/composer.json create mode 100644 vendor/composer/installers/phpunit.xml.dist create mode 100644 vendor/composer/installers/src/Composer/Installers/AglInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/BaseInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/ChefInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php create mode 100644 vendor/composer/installers/src/Composer/Installers/CraftInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/ElggInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/FuelInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/GravInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/HuradInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/Installer.php create mode 100644 vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/MakoInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/OxidInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/PPIInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php create mode 100644 vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/TuskInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/ZendInstaller.php create mode 100644 vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php create mode 100644 vendor/composer/installers/src/bootstrap.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/AsgardInstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php create mode 100644 vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php create mode 100644 vendor/composer/installers/tests/bootstrap.php create mode 100644 vendor/pdepend/pdepend/CHANGELOG create mode 100644 vendor/pdepend/pdepend/LICENSE create mode 100644 vendor/pdepend/pdepend/Vagrantfile create mode 100644 vendor/pdepend/pdepend/build.properties create mode 100644 vendor/pdepend/pdepend/composer.json create mode 100755 vendor/pdepend/pdepend/scripts/compare.sh create mode 100755 vendor/pdepend/pdepend/scripts/update-version.php create mode 100755 vendor/pdepend/pdepend/src/bin/pdepend create mode 100644 vendor/pdepend/pdepend/src/bin/pdepend.bat create mode 100755 vendor/pdepend/pdepend/src/bin/pdepend.php create mode 100644 vendor/pdepend/pdepend/src/conf/phar_bootstrap.stub create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Application.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/DbusUI/ResultPrinter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/DependencyInjection/Compiler/ProcessListenerPass.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/DependencyInjection/Configuration.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/DependencyInjection/Extension.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/DependencyInjection/ExtensionManager.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/DependencyInjection/PdependExtension.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Engine.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Input/CompositeFilter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Input/ExcludePathFilter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Input/ExtensionFilter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Input/Filter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Input/Iterator.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AbstractAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AbstractCachingAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AggregateAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/ClassLevelAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/CodeRankStrategyI.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/InheritanceStrategy.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/MethodStrategy.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/PropertyStrategy.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CodeRankAnalyzer/StrategyFactory.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CohesionAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CouplingAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CrapIndexAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/CyclomaticComplexityAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/DependencyAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/HierarchyAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/InheritanceAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/NPathComplexityAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/NodeCountAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/Analyzer/NodeLocAnalyzer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AnalyzerCacheAware.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AnalyzerFactory.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AnalyzerFilterAware.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AnalyzerIterator.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AnalyzerListener.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AnalyzerNodeAware.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Metrics/AnalyzerProjectAware.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/ProcessListener.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/CodeAwareGenerator.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/FileAwareGenerator.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/Jdepend/Chart.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/Jdepend/Xml.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/Jdepend/chart.svg create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/NoLogOutputException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/Overview/Pyramid.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/Overview/pyramid.svg create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/ReportGenerator.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/ReportGeneratorFactory.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Report/Summary/Xml.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTAllocationExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArguments.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArray.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArrayElement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArrayIndexExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifact.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList/ArtifactFilter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList/CollectionArtifactFilter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList/NullArtifactFilter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTArtifactList/PackageArtifactFilter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTAssignmentExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTBooleanAndExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTBooleanOrExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTBreakStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTCastExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTCatchStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTClass.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTClassFqnPostfix.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTClassOrInterfaceRecursiveInheritanceException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTClassOrInterfaceReference.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTClassOrInterfaceReferenceIterator.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTClassReference.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTCloneExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTClosure.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTComment.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTCompilationUnit.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTCompilationUnitNotFoundException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTCompoundExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTCompoundVariable.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTConditionalExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTConstant.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTConstantDeclarator.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTConstantDefinition.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTConstantPostfix.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTContinueStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTDeclareStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTDoWhileStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTEchoStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTElseIfStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTEvalExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTExitExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTFieldDeclaration.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTFinallyStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTForInit.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTForStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTForUpdate.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTForeachStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTFormalParameter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTFormalParameters.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTFunction.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTFunctionPostfix.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTGlobalStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTGotoStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTHeredoc.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTIdentifier.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTIfStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTIncludeExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTIndexExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTInstanceOfExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTInterface.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTInvocation.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTIssetExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTLabelStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTListExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTLiteral.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTLogicalAndExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTLogicalOrExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTLogicalXorExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTMemberPrimaryPrefix.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTMethod.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTMethodPostfix.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTNamespace.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTNode.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTParameter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTParentReference.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTPostfixExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTPreDecrementExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTPreIncrementExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTPrimitiveType.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTProperty.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTPropertyPostfix.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTRequireExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTReturnStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTScope.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTScopeStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTSelfReference.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTShiftLeftExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTShiftRightExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTStaticReference.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTStaticVariableDeclaration.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTString.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTStringIndexExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTSwitchLabel.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTSwitchStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTThrowStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTrait.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTraitAdaptation.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTraitAdaptationAlias.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTraitAdaptationPrecedence.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTraitMethodCollisionException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTraitReference.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTraitUseStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTryStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTType.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTypeArray.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTTypeCallable.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTUnaryExpression.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTUnsetStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTValue.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTVariable.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTVariableDeclarator.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTVariableVariable.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTWhileStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/ASTYieldStatement.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/AbstractASTArtifact.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/AbstractASTCallable.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/AbstractASTClassOrInterface.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/AbstractASTType.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/AST/State.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/ASTVisitor/ASTVisitListener.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/ASTVisitor/ASTVisitor.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/ASTVisitor/AbstractASTVisitListener.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/ASTVisitor/AbstractASTVisitor.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Builder/Builder.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Builder/BuilderContext.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Builder/BuilderContext/GlobalBuilderContext.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/AbstractPHPParser.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPBuilder.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPParserGeneric.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerHelperVersion52.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/InvalidStateException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/MissingValueException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/ParserException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/SymbolTable.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/TokenException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/TokenStack.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/TokenStreamEndException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Parser/UnexpectedTokenException.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Tokenizer/Token.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Tokenizer/Tokenizer.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Source/Tokenizer/Tokens.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/TextUI/Command.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/TextUI/ResultPrinter.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/TextUI/Runner.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Cache/CacheDriver.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Cache/CacheFactory.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Cache/Driver/File/FileCacheDirectory.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Cache/Driver/FileCacheDriver.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Cache/Driver/MemoryCacheDriver.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Configuration.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/ConfigurationInstance.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Coverage/CloverReport.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Coverage/Factory.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Coverage/Report.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/FileUtil.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/IdBuilder.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/ImageConvert.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Log.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/MathUtil.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Type.php create mode 100644 vendor/pdepend/pdepend/src/main/php/PDepend/Util/Workarounds.php create mode 100644 vendor/pdepend/pdepend/src/main/resources/schema/configuration.xsd create mode 100644 vendor/pdepend/pdepend/src/main/resources/services.xml create mode 100644 vendor/phpmd/phpmd/.gitignore create mode 100644 vendor/phpmd/phpmd/.gitmodules create mode 100644 vendor/phpmd/phpmd/.travis.yml create mode 100644 vendor/phpmd/phpmd/AUTHORS.rst create mode 100644 vendor/phpmd/phpmd/CHANGELOG create mode 100644 vendor/phpmd/phpmd/LICENSE create mode 100644 vendor/phpmd/phpmd/README.rst create mode 100644 vendor/phpmd/phpmd/build.properties create mode 100644 vendor/phpmd/phpmd/build.xml create mode 100644 vendor/phpmd/phpmd/composer.json create mode 100644 vendor/phpmd/phpmd/composer.lock create mode 100644 vendor/phpmd/phpmd/phpunit.xml.dist create mode 100755 vendor/phpmd/phpmd/src/bin/phpmd create mode 100644 vendor/phpmd/phpmd/src/bin/phpmd.bat create mode 100644 vendor/phpmd/phpmd/src/conf/phar_bootstrap.stub create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/AbstractNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/AbstractRenderer.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/AbstractRule.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/AbstractWriter.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/ASTNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/AbstractCallableNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/AbstractNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/AbstractTypeNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/Annotation.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/Annotations.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/ClassNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/FunctionNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/InterfaceNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/MethodNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Node/TraitNode.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/PHPMD.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Parser.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/ParserFactory.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/ProcessingError.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Renderer/HTMLRenderer.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Renderer/TextRenderer.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Renderer/XMLRenderer.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Report.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/AbstractLocalVariable.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/ClassAware.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/CleanCode/BooleanArgumentFlag.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/CleanCode/ElseExpression.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/CleanCode/StaticAccess.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Controversial/CamelCaseClassName.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Controversial/CamelCaseMethodName.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Controversial/CamelCaseParameterName.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Controversial/CamelCasePropertyName.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Controversial/CamelCaseVariableName.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Controversial/Superglobals.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/CyclomaticComplexity.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/CouplingBetweenObjects.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/DepthOfInheritance.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/EvalExpression.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/ExitExpression.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/GotoStatement.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/LongClass.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/LongMethod.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/LongParameterList.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/NpathComplexity.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/NumberOfChildren.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/TooManyFields.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/TooManyMethods.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Design/WeightedMethodCount.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/ExcessivePublicCount.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/FunctionAware.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/InterfaceAware.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/MethodAware.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Naming/BooleanGetMethodName.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Naming/ConstantNamingConventions.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Naming/ConstructorWithNameAsEnclosingClass.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Naming/LongVariable.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Naming/ShortMethodName.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/Naming/ShortVariable.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/UnusedFormalParameter.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/UnusedLocalVariable.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/UnusedPrivateField.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Rule/UnusedPrivateMethod.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/RuleClassFileNotFoundException.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/RuleClassNotFoundException.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSet.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetFactory.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/RuleSetNotFoundException.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/RuleViolation.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/TextUI/Command.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/TextUI/CommandLineOptions.php create mode 100644 vendor/phpmd/phpmd/src/main/php/PHPMD/Writer/StreamWriter.php create mode 100644 vendor/phpmd/phpmd/src/main/resources/rulesets/cleancode.xml create mode 100644 vendor/phpmd/phpmd/src/main/resources/rulesets/codesize.xml create mode 100644 vendor/phpmd/phpmd/src/main/resources/rulesets/controversial.xml create mode 100644 vendor/phpmd/phpmd/src/main/resources/rulesets/design.xml create mode 100644 vendor/phpmd/phpmd/src/main/resources/rulesets/naming.xml create mode 100644 vendor/phpmd/phpmd/src/main/resources/rulesets/unusedcode.xml create mode 100644 vendor/phpmd/phpmd/src/site/docx/changes.xml create mode 100644 vendor/phpmd/phpmd/src/site/resources/config/authors.ini create mode 100644 vendor/phpmd/phpmd/src/site/resources/config/binaries.ini create mode 100644 vendor/phpmd/phpmd/src/site/resources/config/content/blog.ini create mode 100644 vendor/phpmd/phpmd/src/site/resources/config/display/sitemap.ini create mode 100644 vendor/phpmd/phpmd/src/site/resources/config/handlers.ini create mode 100644 vendor/phpmd/phpmd/src/site/resources/config/metadata.ini create mode 100644 vendor/phpmd/phpmd/src/site/resources/config/site.ini create mode 100644 vendor/phpmd/phpmd/src/site/resources/override/html/footer.ezt create mode 100644 vendor/phpmd/phpmd/src/site/resources/override/html/formats.ezt create mode 100644 vendor/phpmd/phpmd/src/site/resources/override/html/layout.ezt create mode 100644 vendor/phpmd/phpmd/src/site/resources/override/html/navigation.ezt create mode 100644 vendor/phpmd/phpmd/src/site/resources/override/html/navigation/item.ezt create mode 100644 vendor/phpmd/phpmd/src/site/resources/override/html/release.ezt create mode 100644 vendor/phpmd/phpmd/src/site/resources/web/css/print.css create mode 100644 vendor/phpmd/phpmd/src/site/resources/web/css/screen.css create mode 100644 vendor/phpmd/phpmd/src/site/resources/web/favicon.ico create mode 100644 vendor/phpmd/phpmd/src/site/resources/web/images/box.png create mode 100644 vendor/phpmd/phpmd/src/site/resources/web/images/logo.png create mode 100644 vendor/phpmd/phpmd/src/site/rst/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/about.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/documentation/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/documentation/ant-task.rst create mode 100755 vendor/phpmd/phpmd/src/site/rst/documentation/creating-a-ruleset.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/documentation/index.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/documentation/suppress-warnings.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/documentation/writing-a-phpmd-rule.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/extensions/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/extensions/index.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/index.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.0/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.0/changelog.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.1/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.1/changelog.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.0/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.0/changelog.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.1/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.1/changelog.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/download/releases/index.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/people-behind.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/robots.txt create mode 100644 vendor/phpmd/phpmd/src/site/rst/rules/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/rules/cleancode.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/rules/codesize.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/rules/controversial.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/rules/design.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/rules/index.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/rules/naming.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/rules/unusedcode.rst create mode 100644 vendor/phpmd/phpmd/src/site/rst/support/.index.xml create mode 100644 vendor/phpmd/phpmd/src/site/rst/support/index.rst create mode 100644 vendor/phpmd/phpmd/src/site/scripts/pmd.xsl create mode 100755 vendor/phpmd/phpmd/src/site/scripts/update-rules.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/AbstractTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/CommandLineInputFileOptionTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/CouplingBetweenObjectsIntegrationTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/GotoStatementIntegrationTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Node/ASTNodeTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Node/AnnotationTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Node/AnnotationsTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Node/ClassNodeTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Node/FunctionTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Node/MethodNodeTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/PMDTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/ParserFactoryTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/ParserTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/ProcessingErrorTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/AbstractTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/AcceptsFilesAndDirectoriesAsInputTicket001Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/ExcessivePublicCountRuleNeverExecutedTicket015Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/InvalidUnusedLocalVariableAndFormalParameterTicket007Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/LongVariablePrivatePropertiesTicket010096717Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/MaximumNestingLevelTicket24975295Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/StaticVariablesFlaggedAsUnusedTicket020Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/SuperGlobalsFlaggedAsUnusedTicket019Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/SuppressWarningsNotAppliesToUnusedPrivateMethod036Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/UnusedParameterArgvTicket14990109Test.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/HTMLRendererTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/TextRendererTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/XMLRendererTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/ReportTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CleanCode/ElseExpressionTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CleanCode/StaticAccessTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Controversial/CamelCaseMethodNameTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CyclomaticComplexityTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/CouplingBetweenObjectsTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/DepthOfInheritanceTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/EvalExpressionTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/ExitExpressionTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/GotoStatementTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongClassTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongMethodTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongParameterListTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/NpathComplexityTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/NumberOfChildrenTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/TooManyFieldsTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/TooManyMethodsTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/WeightedMethodCountTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/ExcessivePublicCountTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/BooleanGetMethodNameTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ConstantNamingConventionsTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ConstructorWithNameAsEnclosingClassTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/LongVariableTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ShortMethodNameTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ShortVariableTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedFormalParameterTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedLocalVariableTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedPrivateFieldTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedPrivateMethodTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/RuleSetFactoryTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/RuleSetTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/RuleTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/RuleViolationTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/ClassNotFoundRule.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/RuleStub.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/WriterStub.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/TextUI/CommandLineOptionsTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/PHPMD/TextUI/CommandTest.php create mode 100644 vendor/phpmd/phpmd/src/test/php/bootstrap.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Integration/CommandLineInputFileOption/Class1.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Integration/CommandLineInputFileOption/Class2.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Integration/CommandLineInputFileOption/Class3.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Integration/CommandLineInputFileOption/inputfile.txt create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Integration/CouplingBetweenObjectsIntegration/testReportContainsCouplingBetweenObjectsWarning.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Integration/GotoStatementIntegration/testReportContainsGotoStatementWarning.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testGetParentTypeReturnsClassForClassMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testGetParentTypeReturnsInterfaceForInterfaceMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testHasSuppressWarningsDelegatesToParentClassMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testHasSuppressWarningsDelegatesToParentInterfaceMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testHasSuppressWarningsExecutesDefaultImplementation.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testIsDeclarationReturnsFalseForImplementedAbstractMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testIsDeclarationReturnsFalseForImplementedInterfaceMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testIsDeclarationReturnsFalseForInheritMethodDeclaration.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testIsDeclarationReturnsTrueForMethodDeclaration.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Node/MethodNode/testIsDeclarationReturnsTrueForMethodDeclarationWithParent.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/ParserFactory/Directory/Test.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/ParserFactory/File/Test.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/001/source/FooBar.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/007/testFormalParameterUsedInDoubleQuoteStringGetsNotReported.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/007/testLocalVariableUsedInDoubleQuoteStringGetsNotReported.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/010096717/testRuleNotAppliesForLongPrivateProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/010096717/testRuleNotAppliesForLongPrivateStaticProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/015/testRuleSetInvokesRuleForClassInstance.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/019/testRuleDoesNotApplyToAnySuperGlobalVariable.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/020/testRuleDoesNotApplyToAnyStaticLocalVariable.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/036/testRuleDoesNotApplyToPrivateMethodWithSuppressWarningsAnnotation.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/14990109/testRuleDoesNotApplyToFunctionParameterNamedArgv.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/14990109/testRuleDoesNotApplyToMethodParameterNamedArgv.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Regression/24975295/testLocalVariableUsedInDoubleQuoteStringGetsNotReported.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/ElseExpression/testRuleAppliesMultipleTimesToMethodWithMultipleElseExpressions.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/ElseExpression/testRuleAppliesToMethodWithElseExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/ElseExpression/testRuleNotAppliesToMethodWithoutElseExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/StaticAccess/testRuleAppliesToStaticMethodAccess.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/StaticAccess/testRuleNotAppliesToConstantAccess.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/StaticAccess/testRuleNotAppliesToDynamicMethodCall.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/StaticAccess/testRuleNotAppliesToParentStaticCall.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/StaticAccess/testRuleNotAppliesToSelfStaticCall.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Controversial/CamelCaseMethodName/testRuleDoesApplyForMethodNameWithCapital.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Controversial/CamelCaseMethodName/testRuleDoesApplyForMethodNameWithUnderscores.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Controversial/CamelCaseMethodName/testRuleDoesApplyForValidMethodNameWithUnderscoreWhenNotAllowed.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Controversial/CamelCaseMethodName/testRuleDoesNotApplyForValidMethodName.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Controversial/CamelCaseMethodName/testRuleDoesNotApplyForValidMethodNameWithUnderscoreWhenAllowed.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/EvalExpression/testRuleAppliesMultipleTimesToFunctionWithEvalExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/EvalExpression/testRuleAppliesMultipleTimesToMethodWithEvalExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/EvalExpression/testRuleAppliesToFunctionWithEvalExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/EvalExpression/testRuleAppliesToMethodWithEvalExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/EvalExpression/testRuleNotAppliesToFunctionWithoutEvalExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/EvalExpression/testRuleNotAppliesToMethodWithoutEvalExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/ExitExpression/testRuleAppliesMultipleTimesToFunctionWithExitExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/ExitExpression/testRuleAppliesMultipleTimesToMethodWithExitExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/ExitExpression/testRuleAppliesToFunctionWithExitExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/ExitExpression/testRuleAppliesToMethodWithExitExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/ExitExpression/testRuleNotAppliesToFunctionWithoutExitExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/ExitExpression/testRuleNotAppliesToMethodWithoutExitExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/GotoStatement/testRuleAppliesToFunctionWithGotoStatement.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/GotoStatement/testRuleAppliesToMethodWithGotoStatement.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/GotoStatement/testRuleNotAppliesToFunctionWithoutGotoStatement.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Design/GotoStatement/testRuleNotAppliesToMethodWithoutGotoStatement.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/BooleanGetMethodName/testRuleAppliesToMethodStartingWithGetAndReturningBool.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/BooleanGetMethodName/testRuleAppliesToMethodStartingWithGetAndReturningBoolean.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/BooleanGetMethodName/testRuleAppliesToPearPrivateMethodStartingWithGetAndReturningBoolean.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/BooleanGetMethodName/testRuleIgnoresParametersWhenNotExplicitConfigured.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/BooleanGetMethodName/testRuleNotAppliesToMethodStartingWithHas.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/BooleanGetMethodName/testRuleNotAppliesToMethodStartingWithIs.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/BooleanGetMethodName/testRuleNotAppliesToMethodWithReturnTypeNotBoolean.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/BooleanGetMethodName/testRuleNotAppliesWhenParametersAreExplicitEnabled.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ConstantNamingConventions/testRuleAppliesToClassConstantWithLowerCaseCharacters.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ConstantNamingConventions/testRuleAppliesToInterfaceConstantWithLowerCaseCharacters.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ConstantNamingConventions/testRuleNotAppliesToClassConstantWithUpperCaseCharacters.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ConstantNamingConventions/testRuleNotAppliesToInterfaceConstantWithUpperCaseCharacters.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ConstructorWithNameAsEnclosingClass/testRuleAppliesToConstructorMethodNamedAsEnclosingClass.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ConstructorWithNameAsEnclosingClass/testRuleAppliesToConstructorMethodNamedAsEnclosingClassCaseInsensitive.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ConstructorWithNameAsEnclosingClass/testRuleNotAppliesToMethodNamedSimilarToEnclosingClass.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleAppliesToFieldAndParameterWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleAppliesToFieldWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleAppliesToFunctionParameterWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleAppliesToIdenticalVariableOnlyOneTime.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleAppliesToIdenticalVariablesInDifferentContextsSeveralTimes.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleAppliesToLocalVariableInFunctionWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleAppliesToLocalVariableInMethodWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleAppliesToMethodParameterWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesForLongPrivateProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesForLongPrivateStaticProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToFieldWithNameEqualToThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToFieldWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToFunctionParameterWithNameSmallerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToLocalVariableInFunctionWithNameEqualToThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToLocalVariableInFunctionWithNameSmallerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToLocalVariableInMethodWithNameEqualToThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToLocalVariableInMethodWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToMethodParameterWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/LongVariable/testRuleNotAppliesToStaticMembersAccessedInMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortMethodName/testRuleAppliesToFunctionWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortMethodName/testRuleAppliesToMethodWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortMethodName/testRuleNotAppliesToFunctionWithNameEqualToThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortMethodName/testRuleNotAppliesToFunctionWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortMethodName/testRuleNotAppliesToMethodWithNameEqualToThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortMethodName/testRuleNotAppliesToMethodWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleAppliesToFieldAndParameterWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleAppliesToFieldWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleAppliesToFunctionParameterWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleAppliesToIdenticalVariableOnlyOneTime.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleAppliesToIdenticalVariablesInDifferentContextsSeveralTimes.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleAppliesToLocalVariableInFunctionWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleAppliesToLocalVariableInMethodWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleAppliesToMethodParameterWithNameShorterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToFieldWithNameEqualToThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToFieldWithNameGreaterThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToFunctionParameterWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToLocalVariableInFunctionWithNameEqualToThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToLocalVariableInFunctionWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToLocalVariableInMethodWithNameEqualToThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToLocalVariableInMethodWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToMethodParameterWithNameLongerThanThreshold.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToShortVariableNameAsForLoopIndex.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToShortVariableNameAsForeachLoopIndex.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToShortVariableNameInCatchStatement.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToStaticMembersAccessedInMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToVariablesFromExceptionsList.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleAppliesToFormalParameterWhenSimilarStaticMemberIsAccessed.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleAppliesToFunctionUnusedFormalParameter.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleAppliesToMethodUnusedFormalParameter.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleAppliesToMultipleFunctionUnusedFormalParameter.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleAppliesToMultipleMethodUnusedFormalParameter.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToAbstractMethodFormalParameter.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToFormalParameterUsedInCompoundExpression.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToImplementedAbstractMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToImplementedInterfaceMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToInheritMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToInnerFunctionDeclaration.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToInterfaceMethodFormalParameter.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToMethodArgument.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToMethodArgumentUsedAsArrayIndex.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToMethodWithFuncGetArgs.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToMethodWithInheritdocAnnotation.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToMethodWithInheritdocAnnotationCamelCase.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToParameterUsedAsArrayIndex.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToParameterUsedAsStringIndex.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleNotAppliesToFormalParameterUsedInMethodCompoundVariable.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleNotAppliesToFormalParameterUsedInPropertyCompoundVariable.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/test_compact_function_rule_does_not_apply.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/test_compact_function_rule_only_applies_to_used_parameters.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/test_compact_function_rule_works_case_insensitive.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/test_func_get_args_rule_works_case_insensitive.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/test_namespaced_compact_function_rule_does_not_apply.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/test_namespaced_compact_function_rule_only_applies_to_used_parameters.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/test_namespaced_compact_function_rule_works_case_insensitive.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testInnerFunctionParametersDoNotHideUnusedVariables.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleAppliesToLocalVariableWithSameNameAsStaticArrayProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleAppliesToLocalVariableWithSameNameAsStaticProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleAppliesToUnusedLocalVariable.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToArgcSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToArgvSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToCatchStatement.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToCompactFunction.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToCookieSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToDynamicProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToEnvSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToFilesSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToGetSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToGlobalsSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToHttpRawPostDataSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedAsArrayIndex.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedAsStringIndex.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedInCompoundVariable.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToMethodArgument.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToNamespacedCompactFunction.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToPostSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToRequestSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToServerSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToSessionSuperGlobal.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToStaticArrayProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToStaticObjectProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToStaticProperty.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToThisVariable.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToUnusedLocalVariableInFunction.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToUnusedLocalVariableInMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToUnusedParameters.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/test_compact_function_rule_works_case_insensitive.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/test_namespaced_compact_function_rule_works_case_insensitive.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesToUnusedPrivateField.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesToUnusedPrivateStaticField.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenFieldWithSameNameIsAccessedOnDifferentObject.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenLocalVariableIsUsedInStaticMemberPrefix.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnDifferentClass.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnParent.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToClassNameAccessedPrivateField.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateArrayFieldAccess.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateFieldInChainedMethodCall.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateStringIndexFieldAccess.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToSelfAccessedPrivateField.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToStaticAccessedPrivateField.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToThisAccessedPrivateField.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToUnusedProtectedField.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToUnusedPublicField.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotResultInFatalErrorByCallingNonObject.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesToParentReferencedUnusedPrivateMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesToUnusedPrivateMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesToUnusedStaticPrivateMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenMethodIsReferencedOnDifferentClass.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenMethodIsReferencedOnDifferentObject.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenMethodWithSimilarNameIsInInvocationChain.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenPropertyWithSimilarNameIsReferenced.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToClassNameReferencedMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToPrivateCloneMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToPrivateConstructor.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToPrivateMethodInChainedMethodCall.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToPrivatePhp4Constructor.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToSelfReferencedMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToStaticReferencedMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToThisReferencedMethod.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/RuleSet/testApplyInvokesRuleWhenStrictModeIsSet.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/RuleSet/testApplyNotInvokesRuleWhenSuppressAnnotationExists.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/TextUI/CommandLineOptions/inputfile.txt create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/pdepend.xml.dist create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/pmd/default-xml.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/pmd/single-directory.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/pmd/single-file.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/renderer/xml_renderer_expected1.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/renderer/xml_renderer_processing_errors.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/alternative-property-value-syntax.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/exclude-pattern.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/pmd-refset1.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset-exclude-all.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset-exclude-one.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset1.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset2.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset3.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset4.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-class-file-not-found.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-class-not-found.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-invalid-xml.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/set1.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/rulesets/set2.xml create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/source/ccn_function.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/source/npath_method.php4 create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/source/source_with_npath_violation.php create mode 100644 vendor/phpmd/phpmd/src/test/resources/files/source/source_without_violations.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/.gitignore create mode 100644 vendor/symfony/config/Symfony/Component/Config/CHANGELOG.md create mode 100644 vendor/symfony/config/Symfony/Component/Config/ConfigCache.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/ArrayNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/BaseNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/BooleanNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ExprBuilder.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/MergeBuilder.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeBuilder.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeParentInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/TreeBuilder.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/ConfigurationInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/EnumNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Exception/DuplicateKeyException.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Exception/Exception.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Exception/ForbiddenOverwriteException.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidDefinitionException.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidTypeException.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Exception/UnsetKeyException.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/FloatNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/IntegerNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/NodeInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/NumericNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/PrototypeNodeInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/PrototypedArrayNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/ReferenceDumper.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/ScalarNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Definition/VariableNode.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Exception/FileLoaderLoadException.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/FileLocator.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/FileLocatorInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/LICENSE create mode 100644 vendor/symfony/config/Symfony/Component/Config/Loader/DelegatingLoader.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Loader/FileLoader.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Loader/Loader.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Loader/LoaderInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Loader/LoaderResolver.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Loader/LoaderResolverInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/README.md create mode 100644 vendor/symfony/config/Symfony/Component/Config/Resource/DirectoryResource.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Resource/FileResource.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Resource/ResourceInterface.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/ConfigCacheTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FinalizationTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/MergeTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/NormalizationTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/FileLocatorTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Again/foo.xml create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/document_type.xml create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid.xml create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid_schema.xml create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/schema.xsd create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/valid.xml create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/foo.xml create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Resource/FileResourceTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/Util/XmlUtils.php create mode 100644 vendor/symfony/config/Symfony/Component/Config/composer.json create mode 100644 vendor/symfony/config/Symfony/Component/Config/phpunit.xml.dist create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/.gitignore create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Alias.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/Compiler.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PassConfig.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAware.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareTrait.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/Dumper.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/LogicException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/RuntimeException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ExpressionLanguage.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/Extension.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/InstantiatorInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/FileLoader.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Parameter.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/README.md create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Reference.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Scope.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container10.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container13.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container15.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container16.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container17.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container18.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces1.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces2.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services13.dot create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services14.dot create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services17.dot create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services18.dot create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtensionInPhar.phar create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/schema/project-1.0.xsd create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/nonvalid.ini create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters.ini create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters1.ini create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters2.ini create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/simple.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension1/services.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension2/services.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services1.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services2.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services3.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services4.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services5.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services6.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services7.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/namespaces.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/nonvalid.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services10.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services13.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services14.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services3.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4_bad_import.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services7.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/withdoctype.xml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_calls.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_import.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_imports.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_parameters.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_service.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_services.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag1.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag2.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag3.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag4.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid1.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid2.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services11.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services13.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services3.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4_bad_import.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services7.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Variable.php create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/composer.json create mode 100644 vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/phpunit.xml.dist create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/.gitignore create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/CHANGELOG.md create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/FileNotFoundException.php create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/IOException.php create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/Filesystem.php create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/LICENSE create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/README.md create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/ExceptionTest.php create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTest.php create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/composer.json create mode 100644 vendor/symfony/filesystem/Symfony/Component/Filesystem/phpunit.xml.dist diff --git a/.travis.yml b/.travis.yml index 92737d9..958b526 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,9 @@ php: # WP_VERSION = WordPress version number (use "master" for SVN trunk) # WP_MULTISITE = whether to test multisite (use either "0" or "1") env: - - WP_VERSION=master WP_MULTISITE=0 - - WP_VERSION=3.4.1 WP_MULTISITE=0 \ No newline at end of file + - WP_VERSION=master WP_MULTISITE=1 + - WP_VERSION=4.0.1 WP_MULTISITE=1 + - WP_VERSION=4.0.0 WP_MULTISITE=1 + +before_script: + - composer install \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..bcdc290 --- /dev/null +++ b/composer.json @@ -0,0 +1,27 @@ +{ + "name": "bueltge/wordpress-multisite-enhancements", + "description": "Enhance Multisite for Network Admins with different topics", + "keywords" : ["wordpress", "multisite", "plugin"], + "license": "GPL 2+", + "version": "1.0.7", + "type": "wordpress-plugin", + "homepage": "https://github.com/bueltge/wordpress-multisite-enhancements/", + "authors": [ + { + "name": "Frank Bültge", + "homepage": "http://bueltge.de", + "email": "frank@bueltge.de", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/bueltge/wordpress-multisite-enhancements/issues" + }, + "require": { + "php": ">=5.3", + "composer/installers": "~1.0" + }, + "require-dev": { + "phpmd/phpmd": "2.1.3" + } +} \ No newline at end of file diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..fb46f76 --- /dev/null +++ b/composer.lock @@ -0,0 +1,341 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "2dc3ace67f7170e2579277fcba497ad9", + "packages": [ + { + "name": "composer/installers", + "version": "v1.0.19", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "89d77bfbee79e16653f7162c86e602cc188471db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/89d77bfbee79e16653f7162c86e602cc188471db", + "reference": "89d77bfbee79e16653f7162c86e602cc188471db", + "shasum": "" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "4.1.*" + }, + "type": "composer-installer", + "extra": { + "class": "Composer\\Installers\\Installer", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "Composer\\Installers\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "http://composer.github.com/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Hurad", + "MODX Evo", + "OXID", + "Thelia", + "WolfCMS", + "agl", + "annotatecms", + "bitrix", + "cakephp", + "chef", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "elgg", + "fuelphp", + "grav", + "installer", + "joomla", + "kohana", + "laravel", + "lithium", + "magento", + "mako", + "mediawiki", + "modulework", + "moodle", + "phpbb", + "piwik", + "ppi", + "puppet", + "roundcube", + "shopware", + "silverstripe", + "symfony", + "typo3", + "wordpress", + "zend", + "zikula" + ], + "time": "2014-11-29 01:29:17" + } + ], + "packages-dev": [ + { + "name": "pdepend/pdepend", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/pdepend/pdepend.git", + "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/1b0acf162da4f30237987e61e177a57f78e3d87e", + "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e", + "shasum": "" + }, + "require": { + "symfony/config": ">=2.4", + "symfony/dependency-injection": ">=2.4", + "symfony/filesystem": ">=2.4" + }, + "require-dev": { + "phpunit/phpunit": "4.*@stable", + "squizlabs/php_codesniffer": "@stable" + }, + "bin": [ + "src/bin/pdepend" + ], + "type": "library", + "autoload": { + "psr-0": { + "PDepend\\": "src/main/php/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Official version of pdepend to be handled with Composer", + "time": "2014-12-04 12:38:39" + }, + { + "name": "phpmd/phpmd", + "version": "2.1.3", + "source": { + "type": "git", + "url": "https://github.com/phpmd/phpmd.git", + "reference": "1a485d9db869137af5e9678bd844568c92998b25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/1a485d9db869137af5e9678bd844568c92998b25", + "reference": "1a485d9db869137af5e9678bd844568c92998b25", + "shasum": "" + }, + "require": { + "pdepend/pdepend": "2.0.*", + "php": ">=5.3.0", + "symfony/config": "2.5.*", + "symfony/dependency-injection": "2.5.*", + "symfony/filesystem": "2.5.*" + }, + "bin": [ + "src/bin/phpmd" + ], + "type": "library", + "autoload": { + "psr-0": { + "PHPMD\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Official version of PHPMD handled with Composer.", + "time": "2014-09-25 15:56:22" + }, + { + "name": "symfony/config", + "version": "v2.5.8", + "target-dir": "Symfony/Component/Config", + "source": { + "type": "git", + "url": "https://github.com/symfony/Config.git", + "reference": "92f0b4c625b8c42d394b53f879d2795d84bb8c4f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Config/zipball/92f0b4c625b8c42d394b53f879d2795d84bb8c4f", + "reference": "92f0b4c625b8c42d394b53f879d2795d84bb8c4f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/filesystem": "~2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Config\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Config Component", + "homepage": "http://symfony.com", + "time": "2014-12-02 20:15:53" + }, + { + "name": "symfony/dependency-injection", + "version": "v2.5.8", + "target-dir": "Symfony/Component/DependencyInjection", + "source": { + "type": "git", + "url": "https://github.com/symfony/DependencyInjection.git", + "reference": "b4afda3c24867a17f93237ac1fcce917cc9d7695" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/b4afda3c24867a17f93237ac1fcce917cc9d7695", + "reference": "b4afda3c24867a17f93237ac1fcce917cc9d7695", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/config": "~2.2", + "symfony/expression-language": "~2.4", + "symfony/yaml": "~2.0" + }, + "suggest": { + "symfony/config": "", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\DependencyInjection\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "http://symfony.com", + "time": "2014-12-02 21:48:32" + }, + { + "name": "symfony/filesystem", + "version": "v2.5.8", + "target-dir": "Symfony/Component/Filesystem", + "source": { + "type": "git", + "url": "https://github.com/symfony/Filesystem.git", + "reference": "e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42", + "reference": "e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Filesystem\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "http://symfony.com", + "time": "2014-12-02 20:15:53" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "platform": { + "php": ">=5.3" + }, + "platform-dev": [] +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..c4cda91 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,15 @@ + + + + + ./tests/ + + + \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..30a3067 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,6 @@ +assertEquals( 'I will learn UnitTesting, now', $string ); + } +} \ No newline at end of file diff --git a/vendor/autoload.php b/vendor/autoload.php new file mode 100644 index 0000000..5fa3c6b --- /dev/null +++ b/vendor/autoload.php @@ -0,0 +1,7 @@ + + * 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 class loader + * + * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-0 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if ($file === null && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if ($file === null) { + // Remember that this class does not exist. + return $this->classMap[$class] = false; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { + if (0 === strpos($class, $prefix)) { + foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + 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; + } + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..7a91153 --- /dev/null +++ b/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ + array($vendorDir . '/symfony/filesystem'), + 'Symfony\\Component\\DependencyInjection\\' => array($vendorDir . '/symfony/dependency-injection'), + 'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'), + 'PHPMD\\' => array($vendorDir . '/phpmd/phpmd/src/main/php'), + 'PDepend\\' => array($vendorDir . '/pdepend/pdepend/src/main/php'), + 'Composer\\Installers\\' => array($vendorDir . '/composer/installers/src'), +); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php new file mode 100644 index 0000000..b265c64 --- /dev/null +++ b/vendor/composer/autoload_psr4.php @@ -0,0 +1,9 @@ + $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + + $loader->register(true); + + return $loader; + } +} + +function composerRequireac7d1ba83f62b9a9b45c4f38c1362b99($file) +{ + require $file; +} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json new file mode 100644 index 0000000..b4dc3d6 --- /dev/null +++ b/vendor/composer/installed.json @@ -0,0 +1,335 @@ +[ + { + "name": "composer/installers", + "version": "v1.0.19", + "version_normalized": "1.0.19.0", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "89d77bfbee79e16653f7162c86e602cc188471db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/89d77bfbee79e16653f7162c86e602cc188471db", + "reference": "89d77bfbee79e16653f7162c86e602cc188471db", + "shasum": "" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "4.1.*" + }, + "time": "2014-11-29 01:29:17", + "type": "composer-installer", + "extra": { + "class": "Composer\\Installers\\Installer", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Composer\\Installers\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "http://composer.github.com/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Hurad", + "MODX Evo", + "OXID", + "Thelia", + "WolfCMS", + "agl", + "annotatecms", + "bitrix", + "cakephp", + "chef", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "elgg", + "fuelphp", + "grav", + "installer", + "joomla", + "kohana", + "laravel", + "lithium", + "magento", + "mako", + "mediawiki", + "modulework", + "moodle", + "phpbb", + "piwik", + "ppi", + "puppet", + "roundcube", + "shopware", + "silverstripe", + "symfony", + "typo3", + "wordpress", + "zend", + "zikula" + ] + }, + { + "name": "symfony/filesystem", + "version": "v2.5.8", + "version_normalized": "2.5.8.0", + "target-dir": "Symfony/Component/Filesystem", + "source": { + "type": "git", + "url": "https://github.com/symfony/Filesystem.git", + "reference": "e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42", + "reference": "e5fc05a3a1dbb4ea0bed80fe7bd21ba3cab88c42", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2014-12-02 20:15:53", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\Filesystem\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "http://symfony.com" + }, + { + "name": "symfony/config", + "version": "v2.5.8", + "version_normalized": "2.5.8.0", + "target-dir": "Symfony/Component/Config", + "source": { + "type": "git", + "url": "https://github.com/symfony/Config.git", + "reference": "92f0b4c625b8c42d394b53f879d2795d84bb8c4f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Config/zipball/92f0b4c625b8c42d394b53f879d2795d84bb8c4f", + "reference": "92f0b4c625b8c42d394b53f879d2795d84bb8c4f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/filesystem": "~2.3" + }, + "time": "2014-12-02 20:15:53", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\Config\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Config Component", + "homepage": "http://symfony.com" + }, + { + "name": "symfony/dependency-injection", + "version": "v2.5.8", + "version_normalized": "2.5.8.0", + "target-dir": "Symfony/Component/DependencyInjection", + "source": { + "type": "git", + "url": "https://github.com/symfony/DependencyInjection.git", + "reference": "b4afda3c24867a17f93237ac1fcce917cc9d7695" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/b4afda3c24867a17f93237ac1fcce917cc9d7695", + "reference": "b4afda3c24867a17f93237ac1fcce917cc9d7695", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/config": "~2.2", + "symfony/expression-language": "~2.4", + "symfony/yaml": "~2.0" + }, + "suggest": { + "symfony/config": "", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "time": "2014-12-02 21:48:32", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\DependencyInjection\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "http://symfony.com" + }, + { + "name": "pdepend/pdepend", + "version": "2.0.4", + "version_normalized": "2.0.4.0", + "source": { + "type": "git", + "url": "https://github.com/pdepend/pdepend.git", + "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pdepend/pdepend/zipball/1b0acf162da4f30237987e61e177a57f78e3d87e", + "reference": "1b0acf162da4f30237987e61e177a57f78e3d87e", + "shasum": "" + }, + "require": { + "symfony/config": ">=2.4", + "symfony/dependency-injection": ">=2.4", + "symfony/filesystem": ">=2.4" + }, + "require-dev": { + "phpunit/phpunit": "4.*@stable", + "squizlabs/php_codesniffer": "@stable" + }, + "time": "2014-12-04 12:38:39", + "bin": [ + "src/bin/pdepend" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "PDepend\\": "src/main/php/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Official version of pdepend to be handled with Composer" + }, + { + "name": "phpmd/phpmd", + "version": "2.1.3", + "version_normalized": "2.1.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpmd/phpmd.git", + "reference": "1a485d9db869137af5e9678bd844568c92998b25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpmd/phpmd/zipball/1a485d9db869137af5e9678bd844568c92998b25", + "reference": "1a485d9db869137af5e9678bd844568c92998b25", + "shasum": "" + }, + "require": { + "pdepend/pdepend": "2.0.*", + "php": ">=5.3.0", + "symfony/config": "2.5.*", + "symfony/dependency-injection": "2.5.*", + "symfony/filesystem": "2.5.*" + }, + "time": "2014-09-25 15:56:22", + "bin": [ + "src/bin/phpmd" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "PHPMD\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Official version of PHPMD handled with Composer." + } +] diff --git a/vendor/composer/installers/.editorconfig b/vendor/composer/installers/.editorconfig new file mode 100644 index 0000000..153cf3e --- /dev/null +++ b/vendor/composer/installers/.editorconfig @@ -0,0 +1,10 @@ +; top-most EditorConfig file +root = true + +; Unix-style newlines +[*] +end_of_line = LF + +[*.php] +indent_style = space +indent_size = 4 diff --git a/vendor/composer/installers/.gitignore b/vendor/composer/installers/.gitignore new file mode 100644 index 0000000..ff7f293 --- /dev/null +++ b/vendor/composer/installers/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +.idea/ diff --git a/vendor/composer/installers/.travis.yml b/vendor/composer/installers/.travis.yml new file mode 100644 index 0000000..81ca8e1 --- /dev/null +++ b/vendor/composer/installers/.travis.yml @@ -0,0 +1,14 @@ +language: php + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - hhvm + +before_script: + - curl -s http://getcomposer.org/installer | php -- --quiet + - php composer.phar install --dev + +script: phpunit diff --git a/vendor/composer/installers/LICENSE b/vendor/composer/installers/LICENSE new file mode 100644 index 0000000..85f97fc --- /dev/null +++ b/vendor/composer/installers/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2012 Kyle Robinson Young + +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. \ No newline at end of file diff --git a/vendor/composer/installers/README.md b/vendor/composer/installers/README.md new file mode 100644 index 0000000..cd77d16 --- /dev/null +++ b/vendor/composer/installers/README.md @@ -0,0 +1,187 @@ +# A Multi-Framework [Composer](http://getcomposer.org) Library Installer + +[![Build Status](http://img.shields.io/travis/composer/installers.svg)](http://travis-ci.org/composer/installers) + +This is for PHP package authors to require in their `composer.json`. It will +install their package to the correct location based on the specified package +type. + +The goal of `installers` is to be a simple package type to install path map. +Users can also customize the install path per package and package authors can +modify the package name upon installing. + +`installers` isn't intended on replacing all custom installers. If your +package requires special installation handling then by all means, create a +custom installer to handle it. + +**Natively Supported Frameworks**: + +The following frameworks natively work with Composer and will be +installed to the default `vendor` directory. `composer/installers` +is not needed to install packages with these frameworks: + +* Aura +* Symfony2 +* Yii +* Yii2 + +**Current Supported Package Types**: + +> Stable types are marked as **bold**, this means that installation paths +> for those type will not be changed. Any adjustment for those types would +> require creation of brand new type that will cover required changes. + +| Framework | Types +| --------- | ----- +| Asgard | `asgard-module`
`asgard-theme` +| AGL | `agl-module` +| AnnotateCms | `annotatecms-module`
`annotatecms-component`
`annotatecms-service` +| Bitrix | `bitrix-module`
`bitrix-component`
`bitrix-theme` +| CakePHP 2+ | **`cakephp-plugin`** +| Chef | `chef-recipe`
`chef-role` +| CodeIgniter | `codeigniter-library`
`codeigniter-third-party`
`codeigniter-module` +| concrete5 | `concrete5-block`
`concrete5-package`
`concrete5-theme`
`concrete5-update` +| Craft | `craft-plugin` +| Croogo | `croogo-plugin`
`croogo-theme` +| DokuWiki | `dokuwiki-plugin`
`dokuwiki-template` +| Dolibarr | `dolibarr-module` +| Drupal | `drupal-module`
`drupal-theme`

`drupal-library`
`drupal-profile`
`drupal-drush` +| Elgg | `elgg-plugin` +| FuelPHP v1.x | `fuel-module`
`fuel-package`
`fuel-theme` +| FuelPHP v2.x | `fuelphp-component` +| Grav | `grav-plugin`
`grav-theme` +| Hurad | `hurad-plugin`
`hurad-theme` +| Joomla | `joomla-component`
`joomla-module`
`joomla-template`
`joomla-plugin`
`joomla-library` +| Kirby | **`kirby-plugin`** +| Kohana | **`kohana-module`** +| Laravel | `laravel-library` +| Lithium | **`lithium-library`
`lithium-source`** +| Magento | `magento-library`
`magento-skin`
`magento-theme` +| Mako | `mako-package` +| MODX Evo | `modxevo-snippet`
`modxevo-plugin`
`modxevo-module`
`modxevo-template`
`modxevo-lib` +| MediaWiki | `mediawiki-extension` +| October | **`october-module`
`october-plugin`
`october-theme`** +| OXID | `oxid-module`
`oxid-theme`
`oxid-out` +| MODULEWork | `modulework-module` +| Moodle | `moodle-*` (Please [check source](https://raw.githubusercontent.com/composer/installers/master/src/Composer/Installers/MoodleInstaller.php) for all supported types) +| Piwik | `piwik-plugin` +| phpBB | `phpbb-extension`
`phpbb-style`
`phpbb-language` +| Pimcore | `pimcore-plugin` +| PPI | **`ppi-module`** +| Puppet | `puppet-module` +| REDAXO | `redaxo-addon` +| Roundcube | `roundcube-plugin` +| shopware | `shopware-backend-plugin`
`shopware-core-plugin`
`shopware-frontend-plugin`
`shopware-theme` +| SilverStripe | `silverstripe-module`
`silverstripe-theme` +| symfony1 | **`symfony1-plugin`** +| Tusk | `tusk-task`
`tusk-command`
`tusk-asset` +| TYPO3 Flow | `typo3-flow-package`
`typo3-flow-framework`
`typo3-flow-plugin`
`typo3-flow-site`
`typo3-flow-boilerplate`
`typo3-flow-build` +| TYPO3 CMS | `typo3-cms-extension` +| Wolf CMS | `wolfcms-plugin` +| WordPress | `wordpress-plugin`
`wordpress-theme`

`wordpress-muplugin` +| Zend | `zend-library`
`zend-extra`
`zend-module` +| Zikula | `zikula-module`
`zikula-theme` + +## Example `composer.json` File + +This is an example for a CakePHP plugin. The only important parts to set in your +composer.json file are `"type": "cakephp-plugin"` which describes what your +package is and `"require": { "composer/installers": "~1.0" }` which tells composer +to load the custom installers. + +```json +{ + "name": "you/ftp", + "type": "cakephp-plugin", + "require": { + "composer/installers": "~1.0" + } +} +``` + +This would install your package to the `Plugin/Ftp/` folder of a CakePHP app +when a user runs `php composer.phar install`. + +So submit your packages to [packagist.org](http://packagist.org)! + +## Custom Install Paths + +If you are consuming a package that uses the `composer/installers` you can +override the install path with the following extra in your `composer.json`: + +```json +{ + "extra": { + "installer-paths": { + "your/custom/path/{$name}/": ["shama/ftp", "vendor/package"] + } + } +} +``` + +A package type can have a custom installation path with a `type:` prefix. + +``` json +{ + "extra": { + "installer-paths": { + "your/custom/path/{$name}/": ["type:wordpress-plugin"] + } + } +} +``` + +This would use your custom path for each of the listed packages. The available +variables to use in your paths are: `{$name}`, `{$vendor}`, `{$type}`. + +## Custom Install Names + +If you're a package author and need your package to be named differently when +installed consider using the `installer-name` extra. + +For example you have a package named `shama/cakephp-ftp` with the type +`cakephp-plugin`. Installing with `composer/installers` would install to the +path `Plugin/CakephpFtp`. Due to the strict naming conventions, you as a +package author actually need the package to be named and installed to +`Plugin/Ftp`. Using the following config within your **package** `composer.json` +will allow this: + +```json +{ + "name": "shama/cakephp-ftp", + "type": "cakephp-plugin", + "extra": { + "installer-name": "Ftp" + } +} +``` + +Please note the name entered into `installer-name` will be the final and will +not be inflected. + +## Contribute! + +* [Fork and clone](https://help.github.com/articles/fork-a-repo). +* Run the command `php composer.phar install --dev` to install the dev + dependencies. See [Composer](https://github.com/composer/composer#installation--usage). +* Use the command `phpunit` to run the tests. See [PHPUnit](http://phpunit.de). +* Create a branch, commit, push and send us a + [pull request](https://help.github.com/articles/using-pull-requests). + +To ensure a consistent code base, you should make sure the code follows the +[Coding Standards](http://symfony.com/doc/2.0/contributing/code/standards.html) +which we borrowed from Symfony. + +If you would like to help, please take a look at the list of +[issues](https://github.com/composer/installers/issues). + +### Should we allow dynamic package types or paths? No. +What are they? The ability for a package author to determine where a package +will be installed either through setting the path directly in their +`composer.json` or through a dynamic package type: `"type": +"framework-install-here"`. + +It has been proposed many times. Even implemented once early on and then +removed. `installers` won't do this because it would allow a single package +author to wipe out entire folders without the user's consent. That user would +then come here to yell at us. diff --git a/vendor/composer/installers/composer.json b/vendor/composer/installers/composer.json new file mode 100644 index 0000000..15fee6e --- /dev/null +++ b/vendor/composer/installers/composer.json @@ -0,0 +1,75 @@ +{ + "name": "composer/installers", + "type": "composer-installer", + "license": "MIT", + "description": "A multi-framework Composer library installer", + "keywords": [ + "installer", + "AGL", + "AnnotateCms", + "Bitrix", + "CakePHP", + "Chef", + "CodeIgniter", + "concrete5", + "Craft", + "Croogo", + "DokuWiki", + "Dolibarr", + "Drupal", + "Elgg", + "FuelPHP", + "Grav", + "Hurad", + "Joomla", + "Kohana", + "Laravel", + "Lithium", + "Magento", + "Mako", + "MODX Evo", + "MediaWiki", + "OXID", + "MODULEWork", + "Moodle", + "Piwik", + "phpBB", + "PPI", + "Puppet", + "Roundcube", + "shopware", + "SilverStripe", + "symfony", + "Thelia", + "TYPO3", + "WolfCMS", + "WordPress", + "Zend", + "Zikula" + ], + "homepage": "http://composer.github.com/installers/", + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "autoload": { + "psr-0": { "Composer\\Installers\\": "src/" } + }, + "extra": { + "class": "Composer\\Installers\\Installer", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "replace": { + "shama/baton": "*", + "roundcube/plugin-installer": "*" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "4.1.*" + } +} diff --git a/vendor/composer/installers/phpunit.xml.dist b/vendor/composer/installers/phpunit.xml.dist new file mode 100644 index 0000000..cc5cc99 --- /dev/null +++ b/vendor/composer/installers/phpunit.xml.dist @@ -0,0 +1,25 @@ + + + + + + tests/Composer/Installers + + + + + + src/Composer/Installers + + + \ No newline at end of file diff --git a/vendor/composer/installers/src/Composer/Installers/AglInstaller.php b/vendor/composer/installers/src/Composer/Installers/AglInstaller.php new file mode 100644 index 0000000..01b8a41 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/AglInstaller.php @@ -0,0 +1,21 @@ + 'More/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) { + return strtoupper($matches[1]); + }, $vars['name']); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php b/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php new file mode 100644 index 0000000..89d7ad9 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/AnnotateCmsInstaller.php @@ -0,0 +1,11 @@ + 'addons/modules/{$name}/', + 'component' => 'addons/components/{$name}/', + 'service' => 'addons/services/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php b/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php new file mode 100644 index 0000000..995ee2b --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/AsgardInstaller.php @@ -0,0 +1,45 @@ + 'Modules/{$name}/', + 'theme' => 'Themes/{$name}/' + ); + + /** + * Format package name. + * + * For package type asgard-module, cut off a trailing '-plugin' if present. + * + * For package type asgard-theme, cut off a trailing '-theme' if present. + * + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] === 'asgard-module') { + return $this->inflectPluginVars($vars); + } + + if ($vars['type'] === 'asgard-theme') { + return $this->inflectThemeVars($vars); + } + + return $vars; + } + + protected function inflectPluginVars($vars) + { + $vars['name'] = ucfirst(preg_replace('/-module/', '', $vars['name'])); + + return $vars; + } + + protected function inflectThemeVars($vars) + { + $vars['name'] = ucfirst(preg_replace('/-theme$/', '', $vars['name'])); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php b/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php new file mode 100644 index 0000000..cc27d3e --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/BaseInstaller.php @@ -0,0 +1,131 @@ +composer = $composer; + $this->package = $package; + } + + /** + * Return the install path based on package type. + * + * @param PackageInterface $package + * @param string $frameworkType + * @return string + */ + public function getInstallPath(PackageInterface $package, $frameworkType = '') + { + $type = $this->package->getType(); + + $prettyName = $this->package->getPrettyName(); + if (strpos($prettyName, '/') !== false) { + list($vendor, $name) = explode('/', $prettyName); + } else { + $vendor = ''; + $name = $prettyName; + } + + $availableVars = $this->inflectPackageVars(compact('name', 'vendor', 'type')); + + $extra = $package->getExtra(); + if (!empty($extra['installer-name'])) { + $availableVars['name'] = $extra['installer-name']; + } + + if ($this->composer->getPackage()) { + $extra = $this->composer->getPackage()->getExtra(); + if (!empty($extra['installer-paths'])) { + $customPath = $this->mapCustomInstallPaths($extra['installer-paths'], $prettyName, $type); + if ($customPath !== false) { + return $this->templatePath($customPath, $availableVars); + } + } + } + + $packageType = substr($type, strlen($frameworkType) + 1); + $locations = $this->getLocations(); + if (!isset($locations[$packageType])) { + throw new \InvalidArgumentException(sprintf('Package type "%s" is not supported', $type)); + } + + return $this->templatePath($locations[$packageType], $availableVars); + } + + /** + * For an installer to override to modify the vars per installer. + * + * @param array $vars + * @return array + */ + public function inflectPackageVars($vars) + { + return $vars; + } + + /** + * Gets the installer's locations + * + * @return array + */ + public function getLocations() + { + return $this->locations; + } + + /** + * Replace vars in a path + * + * @param string $path + * @param array $vars + * @return string + */ + protected function templatePath($path, array $vars = array()) + { + if (strpos($path, '{') !== false) { + extract($vars); + preg_match_all('@\{\$([A-Za-z0-9_]*)\}@i', $path, $matches); + if (!empty($matches[1])) { + foreach ($matches[1] as $var) { + $path = str_replace('{$' . $var . '}', $$var, $path); + } + } + } + + return $path; + } + + /** + * Search through a passed paths array for a custom install path. + * + * @param array $paths + * @param string $name + * @param string $type + * @return string + */ + protected function mapCustomInstallPaths(array $paths, $name, $type) + { + foreach ($paths as $path => $names) { + if (in_array($name, $names) || in_array('type:' . $type, $names)) { + return $path; + } + } + + return false; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php b/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php new file mode 100644 index 0000000..48a8367 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/BitrixInstaller.php @@ -0,0 +1,11 @@ + 'local/modules/{$name}/', + 'component' => 'local/components/{$name}/', + 'theme' => 'local/templates/{$name}/' + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php b/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php new file mode 100644 index 0000000..df91a12 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php @@ -0,0 +1,145 @@ + 'Plugin/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $nameParts = explode('/', $vars['name']); + foreach ($nameParts as &$value) { + $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value)); + $value = str_replace(array('-', '_'), ' ', $value); + $value = str_replace(' ', '', ucwords($value)); + } + $vars['name'] = implode('/', $nameParts); + + return $vars; + } + + /** + * Change the default plugin location when cakephp >= 3.0 + */ + public function getLocations() + { + if ($this->matchesCakeVersion('>=', '3.0.0')) { + $this->locations['plugin'] = 'plugins/{$name}/'; + } + return $this->locations; + } + + /** + * Add installer-name for CakePHP >= 3.0.0 + * + * @param PackageInterface $package + * @param string $frameworkType + * @return string + */ + public function getInstallPath(PackageInterface $package, $frameworkType = '') + { + $extra = $package->getExtra(); + if (empty($extra['installer-name']) && $this->matchesCakeVersion('>=', '3.0.0')) { + $this->setInstallerName($package); + } + return parent::getInstallPath($package, $frameworkType); + } + + /** + * Check if CakePHP version matches against a version + * + * @param string $matcher + * @param string $version + * @return bool + */ + protected function matchesCakeVersion($matcher, $version) + { + $repositoryManager = $this->composer->getRepositoryManager(); + if ($repositoryManager) { + $repos = $repositoryManager->getLocalRepository(); + if (!$repos) { + return false; + } + $cake3 = new MultiConstraint(array( + new VersionConstraint($matcher, $version), + new VersionConstraint('!=', '9999999-dev'), + )); + $pool = new Pool('dev'); + $pool->addRepository($repos); + $packages = $pool->whatProvides('cakephp/cakephp'); + foreach ($packages as $package) { + $installed = new VersionConstraint('=', $package->getVersion()); + if ($cake3->matches($installed)) { + return true; + break; + } + } + } + return false; + } + + /** + * Set installer-name based on namespace for the source path checking in + * following order: + * + * - With only one autoload path the namespace for that path will be used. + * - With multiple paths if path 'src' exists it's namespace will be used. + * - With two autoload paths provided, the namespace of path other than + * 'tests' will be used. + * + * No installer-name is set if PSR-4 autoload block is not found or if none + * of the above conditions are met. + * + * @param PackageInterface $package + */ + protected function setInstallerName(PackageInterface $package) + { + $primaryNS = null; + $autoLoad = $package->getAutoload(); + foreach ($autoLoad as $type => $typeConfig) { + if ($type !== 'psr-4') { + continue; + } + $count = count($typeConfig); + + if ($count === 1) { + $primaryNS = key($typeConfig); + break; + } + + $matches = preg_grep('#^(\./)?src/?$#', $typeConfig); + if ($matches) { + $primaryNS = key($matches); + break; + } + + if ($count === 2) { + reset($typeConfig); + if (preg_match('#^(\./)?tests/?$#', current($typeConfig))) { + next($typeConfig); + } + $primaryNS = key($typeConfig); + break; + } + + break; + } + + if ($primaryNS) { + $package->setExtra(array( + 'installer-name' => trim(str_replace('\\', '/', $primaryNS), '/') + )); + } + } + +} diff --git a/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php b/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php new file mode 100644 index 0000000..ab2f9aa --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/ChefInstaller.php @@ -0,0 +1,11 @@ + 'Chef/{$vendor}/{$name}/', + 'role' => 'Chef/roles/{$name}/', + ); +} + diff --git a/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php b/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php new file mode 100644 index 0000000..3b4a4ec --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/CodeIgniterInstaller.php @@ -0,0 +1,11 @@ + 'application/libraries/{$name}/', + 'third-party' => 'application/third_party/{$name}/', + 'module' => 'application/modules/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php b/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php new file mode 100644 index 0000000..4d398a4 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/Concrete5Installer.php @@ -0,0 +1,12 @@ + 'blocks/{$name}/', + 'package' => 'packages/{$name}/', + 'theme' => 'themes/{$name}/', + 'update' => 'updates/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php b/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php new file mode 100644 index 0000000..dc3be8d --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/CraftInstaller.php @@ -0,0 +1,9 @@ + 'craft/plugins/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php b/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php new file mode 100644 index 0000000..d94219d --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php @@ -0,0 +1,21 @@ + 'Plugin/{$name}/', + 'theme' => 'View/Themed/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(str_replace(array('-', '_'), ' ', $vars['name'])); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php b/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php new file mode 100644 index 0000000..cfd638d --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/DokuWikiInstaller.php @@ -0,0 +1,50 @@ + 'lib/plugins/{$name}/', + 'template' => 'lib/tpl/{$name}/', + ); + + /** + * Format package name. + * + * For package type dokuwiki-plugin, cut off a trailing '-plugin', + * or leading dokuwiki_ if present. + * + * For package type dokuwiki-template, cut off a trailing '-template' if present. + * + */ + public function inflectPackageVars($vars) + { + + if ($vars['type'] === 'dokuwiki-plugin') { + return $this->inflectPluginVars($vars); + } + + if ($vars['type'] === 'dokuwiki-template') { + return $this->inflectTemplateVars($vars); + } + + return $vars; + } + + protected function inflectPluginVars($vars) + { + $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']); + $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']); + + return $vars; + } + + protected function inflectTemplateVars($vars) + { + $vars['name'] = preg_replace('/-template$/', '', $vars['name']); + $vars['name'] = preg_replace('/^dokuwiki_?-?/', '', $vars['name']); + + return $vars; + } + +} diff --git a/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php b/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php new file mode 100644 index 0000000..21f7e8e --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/DolibarrInstaller.php @@ -0,0 +1,16 @@ + + */ +class DolibarrInstaller extends BaseInstaller +{ + //TODO: Add support for scripts and themes + protected $locations = array( + 'module' => 'htdocs/custom/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php b/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php new file mode 100644 index 0000000..522606a --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/DrupalInstaller.php @@ -0,0 +1,13 @@ + 'modules/{$name}/', + 'theme' => 'themes/{$name}/', + 'library' => 'libraries/{$name}/', + 'profile' => 'profiles/{$name}/', + 'drush' => 'drush/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php b/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php new file mode 100644 index 0000000..c0bb609 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/ElggInstaller.php @@ -0,0 +1,9 @@ + 'mod/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php b/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php new file mode 100644 index 0000000..6eba2e3 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php @@ -0,0 +1,11 @@ + 'fuel/app/modules/{$name}/', + 'package' => 'fuel/packages/{$name}/', + 'theme' => 'fuel/app/themes/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php b/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php new file mode 100644 index 0000000..29d980b --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/FuelphpInstaller.php @@ -0,0 +1,9 @@ + 'components/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/GravInstaller.php b/vendor/composer/installers/src/Composer/Installers/GravInstaller.php new file mode 100644 index 0000000..dbe63e0 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/GravInstaller.php @@ -0,0 +1,30 @@ + 'user/plugins/{$name}/', + 'theme' => 'user/themes/{$name}/', + ); + + /** + * Format package name + * + * @param array $vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + $restrictedWords = implode('|', array_keys($this->locations)); + + $vars['name'] = strtolower($vars['name']); + $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui', + '$1', + $vars['name'] + ); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php b/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php new file mode 100644 index 0000000..8fe017f --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php @@ -0,0 +1,25 @@ + 'plugins/{$name}/', + 'theme' => 'plugins/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $nameParts = explode('/', $vars['name']); + foreach ($nameParts as &$value) { + $value = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $value)); + $value = str_replace(array('-', '_'), ' ', $value); + $value = str_replace(' ', '', ucwords($value)); + } + $vars['name'] = implode('/', $nameParts); + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/Installer.php b/vendor/composer/installers/src/Composer/Installers/Installer.php new file mode 100644 index 0000000..084ff62 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/Installer.php @@ -0,0 +1,159 @@ + 'AsgardInstaller', + 'agl' => 'AglInstaller', + 'annotatecms' => 'AnnotateCmsInstaller', + 'bitrix' => 'BitrixInstaller', + 'cakephp' => 'CakePHPInstaller', + 'chef' => 'ChefInstaller', + 'codeigniter' => 'CodeIgniterInstaller', + 'concrete5' => 'Concrete5Installer', + 'craft' => 'CraftInstaller', + 'croogo' => 'CroogoInstaller', + 'dokuwiki' => 'DokuWikiInstaller', + 'dolibarr' => 'DolibarrInstaller', + 'drupal' => 'DrupalInstaller', + 'elgg' => 'ElggInstaller', + 'fuel' => 'FuelInstaller', + 'fuelphp' => 'FuelphpInstaller', + 'grav' => 'GravInstaller', + 'hurad' => 'HuradInstaller', + 'joomla' => 'JoomlaInstaller', + 'kirby' => 'KirbyInstaller', + 'kohana' => 'KohanaInstaller', + 'laravel' => 'LaravelInstaller', + 'lithium' => 'LithiumInstaller', + 'magento' => 'MagentoInstaller', + 'mako' => 'MakoInstaller', + 'mediawiki' => 'MediaWikiInstaller', + 'microweber' => 'MicroweberInstaller', + 'modulework' => 'MODULEWorkInstaller', + 'modxevo' => 'MODXEvoInstaller', + 'moodle' => 'MoodleInstaller', + 'october' => 'OctoberInstaller', + 'oxid' => 'OxidInstaller', + 'phpbb' => 'PhpBBInstaller', + 'pimcore' => 'PimcoreInstaller', + 'piwik' => 'PiwikInstaller', + 'ppi' => 'PPIInstaller', + 'puppet' => 'PuppetInstaller', + 'redaxo' => 'RedaxoInstaller', + 'roundcube' => 'RoundcubeInstaller', + 'shopware' => 'ShopwareInstaller', + 'silverstripe' => 'SilverStripeInstaller', + 'symfony1' => 'Symfony1Installer', + 'thelia' => 'TheliaInstaller', + 'tusk' => 'TuskInstaller', + 'typo3-cms' => 'TYPO3CmsInstaller', + 'typo3-flow' => 'TYPO3FlowInstaller', + 'whmcs' => 'WHMCSInstaller', + 'wolfcms' => 'WolfCMSInstaller', + 'wordpress' => 'WordPressInstaller', + 'zend' => 'ZendInstaller', + 'zikula' => 'ZikulaInstaller', + ); + + /** + * {@inheritDoc} + */ + public function getInstallPath(PackageInterface $package) + { + $type = $package->getType(); + $frameworkType = $this->findFrameworkType($type); + + if ($frameworkType === false) { + throw new \InvalidArgumentException( + 'Sorry the package type of this package is not yet supported.' + ); + } + + $class = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType]; + $installer = new $class($package, $this->composer); + + return $installer->getInstallPath($package, $frameworkType); + } + + public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) + { + if (!$repo->hasPackage($package)) { + throw new \InvalidArgumentException('Package is not installed: '.$package); + } + + $repo->removePackage($package); + + $installPath = $this->getInstallPath($package); + $this->io->write(sprintf('Deleting %s - %s', $installPath, $this->filesystem->removeDirectory($installPath) ? 'deleted' : 'not deleted')); + } + + /** + * {@inheritDoc} + */ + public function supports($packageType) + { + $frameworkType = $this->findFrameworkType($packageType); + + if ($frameworkType === false) { + return false; + } + + $locationPattern = $this->getLocationPattern($frameworkType); + + return preg_match('#' . $frameworkType . '-' . $locationPattern . '#', $packageType, $matches) === 1; + } + + /** + * Finds a supported framework type if it exists and returns it + * + * @param string $type + * @return string + */ + protected function findFrameworkType($type) + { + $frameworkType = false; + + krsort($this->supportedTypes); + + foreach ($this->supportedTypes as $key => $val) { + if ($key === substr($type, 0, strlen($key))) { + $frameworkType = substr($type, 0, strlen($key)); + break; + } + } + + return $frameworkType; + } + + /** + * Get the second part of the regular expression to check for support of a + * package type + * + * @param string $frameworkType + * @return string + */ + protected function getLocationPattern($frameworkType) + { + $pattern = false; + if (!empty($this->supportedTypes[$frameworkType])) { + $frameworkClass = 'Composer\\Installers\\' . $this->supportedTypes[$frameworkType]; + /** @var BaseInstaller $framework */ + $framework = new $frameworkClass(null, $this->composer); + $locations = array_keys($framework->getLocations()); + $pattern = $locations ? '(' . implode('|', $locations) . ')' : false; + } + + return $pattern ? : '(\w+)'; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php b/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php new file mode 100644 index 0000000..9ee7759 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/JoomlaInstaller.php @@ -0,0 +1,15 @@ + 'components/{$name}/', + 'module' => 'modules/{$name}/', + 'template' => 'templates/{$name}/', + 'plugin' => 'plugins/{$name}/', + 'library' => 'libraries/{$name}/', + ); + + // TODO: Add inflector for mod_ and com_ names +} diff --git a/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php b/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php new file mode 100644 index 0000000..ae7ba8a --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/KirbyInstaller.php @@ -0,0 +1,9 @@ + 'site/plugins/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php b/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php new file mode 100644 index 0000000..dcd6d26 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php @@ -0,0 +1,9 @@ + 'modules/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php b/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php new file mode 100644 index 0000000..be4d53a --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php @@ -0,0 +1,9 @@ + 'libraries/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php b/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php new file mode 100644 index 0000000..47bbd4c --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/LithiumInstaller.php @@ -0,0 +1,10 @@ + 'libraries/{$name}/', + 'source' => 'libraries/_source/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php b/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php new file mode 100644 index 0000000..9c2e9fb --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/MODULEWorkInstaller.php @@ -0,0 +1,9 @@ + 'modules/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php b/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php new file mode 100644 index 0000000..5a66460 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php @@ -0,0 +1,16 @@ + 'assets/snippets/{$name}/', + 'plugin' => 'assets/plugins/{$name}/', + 'module' => 'assets/modules/{$name}/', + 'template' => 'assets/templates/{$name}/', + 'lib' => 'assets/lib/{$name}/' + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php b/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php new file mode 100644 index 0000000..cf18e94 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php @@ -0,0 +1,11 @@ + 'app/design/frontend/{$name}/', + 'skin' => 'skin/frontend/default/{$name}/', + 'library' => 'lib/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php b/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php new file mode 100644 index 0000000..ca3cfac --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php @@ -0,0 +1,9 @@ + 'app/packages/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php b/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php new file mode 100644 index 0000000..01008c6 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/MediaWikiInstaller.php @@ -0,0 +1,50 @@ + 'extensions/{$name}/', + 'skin' => 'skins/{$name}/', + ); + + /** + * Format package name. + * + * For package type mediawiki-extension, cut off a trailing '-extension' if present and transform + * to CamelCase keeping existing uppercase chars. + * + * For package type mediawiki-skin, cut off a trailing '-skin' if present. + * + */ + public function inflectPackageVars($vars) + { + + if ($vars['type'] === 'mediawiki-extension') { + return $this->inflectExtensionVars($vars); + } + + if ($vars['type'] === 'mediawiki-skin') { + return $this->inflectSkinVars($vars); + } + + return $vars; + } + + protected function inflectExtensionVars($vars) + { + $vars['name'] = preg_replace('/-extension$/', '', $vars['name']); + $vars['name'] = str_replace('-', ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } + + protected function inflectSkinVars($vars) + { + $vars['name'] = preg_replace('/-skin$/', '', $vars['name']); + + return $vars; + } + +} diff --git a/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php b/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php new file mode 100644 index 0000000..4bbbec8 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php @@ -0,0 +1,111 @@ + 'userfiles/modules/{$name}/', + 'module-skin' => 'userfiles/modules/{$name}/templates/', + 'template' => 'userfiles/templates/{$name}/', + 'element' => 'userfiles/elements/{$name}/', + 'vendor' => 'vendor/{$name}/', + 'components' => 'components/{$name}/' + ); + + /** + * Format package name. + * + * For package type microweber-module, cut off a trailing '-module' if present + * + * For package type microweber-template, cut off a trailing '-template' if present. + * + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] === 'microweber-template') { + return $this->inflectTemplateVars($vars); + } + if ($vars['type'] === 'microweber-templates') { + return $this->inflectTemplatesVars($vars); + } + if ($vars['type'] === 'microweber-core') { + return $this->inflectCoreVars($vars); + } + if ($vars['type'] === 'microweber-adapter') { + return $this->inflectCoreVars($vars); + } + if ($vars['type'] === 'microweber-module') { + return $this->inflectModuleVars($vars); + } + if ($vars['type'] === 'microweber-modules') { + return $this->inflectModulesVars($vars); + } + if ($vars['type'] === 'microweber-skin') { + return $this->inflectSkinVars($vars); + } + if ($vars['type'] === 'microweber-element' or $vars['type'] === 'microweber-elements') { + return $this->inflectElementVars($vars); + } + + return $vars; + } + + protected function inflectTemplateVars($vars) + { + $vars['name'] = preg_replace('/-template$/', '', $vars['name']); + $vars['name'] = preg_replace('/template-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectTemplatesVars($vars) + { + $vars['name'] = preg_replace('/-templates$/', '', $vars['name']); + $vars['name'] = preg_replace('/templates-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectCoreVars($vars) + { + $vars['name'] = preg_replace('/-providers$/', '', $vars['name']); + $vars['name'] = preg_replace('/-provider$/', '', $vars['name']); + $vars['name'] = preg_replace('/-adapter$/', '', $vars['name']); + + return $vars; + } + + protected function inflectModuleVars($vars) + { + $vars['name'] = preg_replace('/-module$/', '', $vars['name']); + $vars['name'] = preg_replace('/module-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectModulesVars($vars) + { + $vars['name'] = preg_replace('/-modules$/', '', $vars['name']); + $vars['name'] = preg_replace('/modules-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectSkinVars($vars) + { + $vars['name'] = preg_replace('/-skin$/', '', $vars['name']); + $vars['name'] = preg_replace('/skin-$/', '', $vars['name']); + + return $vars; + } + + protected function inflectElementVars($vars) + { + $vars['name'] = preg_replace('/-elements$/', '', $vars['name']); + $vars['name'] = preg_replace('/elements-$/', '', $vars['name']); + $vars['name'] = preg_replace('/-element$/', '', $vars['name']); + $vars['name'] = preg_replace('/element-$/', '', $vars['name']); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php b/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php new file mode 100644 index 0000000..04be73c --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/MoodleInstaller.php @@ -0,0 +1,47 @@ + 'mod/{$name}/', + 'admin_report' => 'admin/report/{$name}/', + 'tool' => 'admin/tool/{$name}/', + 'assignment' => 'mod/assignment/type/{$name}/', + 'assignsubmission' => 'mod/assign/submission/{$name}/', + 'assignfeedback' => 'mod/assign/feedback/{$name}/', + 'auth' => 'auth/{$name}/', + 'availability' => 'availability/condition/{$name}/', + 'block' => 'blocks/{$name}/', + 'calendartype' => 'calendar/type/{$name}/', + 'format' => 'course/format/{$name}/', + 'coursereport' => 'course/report/{$name}/', + 'datafield' => 'mod/data/field/{$name}/', + 'datapreset' => 'mod/data/preset/{$name}/', + 'editor' => 'lib/editor/{$name}/', + 'enrol' => 'enrol/{$name}/', + 'filter' => 'filter/{$name}/', + 'gradeexport' => 'grade/export/{$name}/', + 'gradeimport' => 'grade/import/{$name}/', + 'gradereport' => 'grade/report/{$name}/', + 'gradingform' => 'grade/grading/form/{$name}/', + 'local' => 'local/{$name}/', + 'message' => 'message/output/{$name}/', + 'plagiarism' => 'plagiarism/{$name}/', + 'portfolio' => 'portfolio/{$name}/', + 'qbehaviour' => 'question/behaviour/{$name}/', + 'qformat' => 'question/format/{$name}/', + 'qtype' => 'question/type/{$name}/', + 'quizaccess' => 'mod/quiz/accessrule/{$name}/', + 'quiz' => 'mod/quiz/report/{$name}/', + 'report' => 'report/{$name}/', + 'repository' => 'repository/{$name}/', + 'scormreport' => 'mod/scorm/report/{$name}/', + 'theme' => 'theme/{$name}/', + 'profilefield' => 'user/profile/field/{$name}/', + 'webservice' => 'webservice/{$name}/', + 'workshopallocation' => 'mod/workshop/allocation/{$name}/', + 'workshopeval' => 'mod/workshop/eval/{$name}/', + 'workshopform' => 'mod/workshop/form/{$name}/' + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php b/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php new file mode 100644 index 0000000..6bf53fd --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/OctoberInstaller.php @@ -0,0 +1,46 @@ + 'modules/{$name}/', + 'plugin' => 'plugins/{$vendor}/{$name}/', + 'theme' => 'themes/{$name}/' + ); + + /** + * Format package name. + * + * For package type october-plugin, cut off a trailing '-plugin' if present. + * + * For package type october-theme, cut off a trailing '-theme' if present. + * + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] === 'october-plugin') { + return $this->inflectPluginVars($vars); + } + + if ($vars['type'] === 'october-theme') { + return $this->inflectThemeVars($vars); + } + + return $vars; + } + + protected function inflectPluginVars($vars) + { + $vars['name'] = preg_replace('/-plugin$/', '', $vars['name']); + + return $vars; + } + + protected function inflectThemeVars($vars) + { + $vars['name'] = preg_replace('/-theme$/', '', $vars['name']); + + return $vars; + } +} \ No newline at end of file diff --git a/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php b/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php new file mode 100644 index 0000000..22fb56a --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/OxidInstaller.php @@ -0,0 +1,11 @@ + 'modules/{$name}/', + 'theme' => 'application/views/{$name}/', + 'out' => 'out/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php b/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php new file mode 100644 index 0000000..170136f --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/PPIInstaller.php @@ -0,0 +1,9 @@ + 'modules/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php b/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php new file mode 100644 index 0000000..deb2b77 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/PhpBBInstaller.php @@ -0,0 +1,11 @@ + 'ext/{$vendor}/{$name}/', + 'language' => 'language/{$name}/', + 'style' => 'styles/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php b/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php new file mode 100644 index 0000000..4781fa6 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/PimcoreInstaller.php @@ -0,0 +1,21 @@ + 'plugins/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php b/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php new file mode 100644 index 0000000..c17f457 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/PiwikInstaller.php @@ -0,0 +1,32 @@ + 'plugins/{$name}/', + ); + + /** + * Format package name to CamelCase + * @param array $vars + * + * @return array + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php b/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php new file mode 100644 index 0000000..77cc3dd --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php @@ -0,0 +1,11 @@ + 'modules/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php b/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php new file mode 100644 index 0000000..0954457 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/RedaxoInstaller.php @@ -0,0 +1,10 @@ + 'redaxo/include/addons/{$name}/', + 'bestyle-plugin' => 'redaxo/include/addons/be_style/plugins/{$name}/' + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php b/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php new file mode 100644 index 0000000..d8d795b --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/RoundcubeInstaller.php @@ -0,0 +1,22 @@ + 'plugins/{$name}/', + ); + + /** + * Lowercase name and changes the name to a underscores + * + * @param array $vars + * @return array + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(str_replace('-', '_', $vars['name'])); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php b/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php new file mode 100644 index 0000000..673f1fc --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/ShopwareInstaller.php @@ -0,0 +1,58 @@ + 'engine/Shopware/Plugins/Local/Backend/{$name}/', + 'core-plugin' => 'engine/Shopware/Plugins/Local/Core/{$name}/', + 'frontend-plugin' => 'engine/Shopware/Plugins/Local/Frontend/{$name}/', + 'theme' => 'templates/{$name}/' + ); + + /** + * Transforms the names + * @param array $vars + * @return array + */ + public function inflectPackageVars($vars) + { + if ($vars['type'] === 'shopware-theme') { + return $this->correctThemeName($vars); + } else { + return $this->correctPluginName($vars); + } + } + + /** + * Changes the name to a camelcased combination of vendor and name + * @param array $vars + * @return array + */ + private function correctPluginName($vars) + { + $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) { + return strtoupper($matches[0][1]); + }, $vars['name']); + + $vars['name'] = ucfirst($vars['vendor']) . ucfirst($camelCasedName); + + return $vars; + } + + /** + * Changes the name to a underscore separated name + * @param array $vars + * @return array + */ + private function correctThemeName($vars) + { + $vars['name'] = str_replace('-', '_', $vars['name']); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php b/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php new file mode 100644 index 0000000..17ca543 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php @@ -0,0 +1,36 @@ + '{$name}/', + 'theme' => 'themes/{$name}/', + ); + + /** + * Return the install path based on package type. + * + * Relies on built-in BaseInstaller behaviour with one exception: silverstripe/framework + * must be installed to 'sapphire' and not 'framework' if the version is <3.0.0 + * + * @param PackageInterface $package + * @param string $frameworkType + * @return string + */ + public function getInstallPath(PackageInterface $package, $frameworkType = '') + { + if ( + $package->getName() == 'silverstripe/framework' + && preg_match('/^\d+\.\d+\.\d+/', $package->getVersion()) + && version_compare($package->getVersion(), '2.999.999') < 0 + ) { + return $this->templatePath($this->locations['module'], array('name' => 'sapphire')); + } else { + return parent::getInstallPath($package, $frameworkType); + } + + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php b/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php new file mode 100644 index 0000000..1675c4f --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/Symfony1Installer.php @@ -0,0 +1,26 @@ + + */ +class Symfony1Installer extends BaseInstaller +{ + protected $locations = array( + 'plugin' => 'plugins/{$name}/', + ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) { + return strtoupper($matches[0][1]); + }, $vars['name']); + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php b/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php new file mode 100644 index 0000000..8220b40 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/TYPO3CmsInstaller.php @@ -0,0 +1,14 @@ + + */ +class TYPO3CmsInstaller extends BaseInstaller +{ + protected $locations = array( + 'extension' => 'typo3conf/ext/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php b/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php new file mode 100644 index 0000000..42572f4 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php @@ -0,0 +1,38 @@ + 'Packages/Application/{$name}/', + 'framework' => 'Packages/Framework/{$name}/', + 'plugin' => 'Packages/Plugins/{$name}/', + 'site' => 'Packages/Sites/{$name}/', + 'boilerplate' => 'Packages/Boilerplates/{$name}/', + 'build' => 'Build/{$name}/', + ); + + /** + * Modify the package name to be a TYPO3 Flow style key. + * + * @param array $vars + * @return array + */ + public function inflectPackageVars($vars) + { + $autoload = $this->package->getAutoload(); + if (isset($autoload['psr-0']) && is_array($autoload['psr-0'])) { + $namespace = key($autoload['psr-0']); + $vars['name'] = str_replace('\\', '.', $namespace); + } + if (isset($autoload['psr-4']) && is_array($autoload['psr-4'])) { + $namespace = key($autoload['psr-4']); + $vars['name'] = rtrim(str_replace('\\', '.', $namespace), '.'); + } + + return $vars; + } +} diff --git a/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php b/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php new file mode 100644 index 0000000..158af52 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php @@ -0,0 +1,12 @@ + 'local/modules/{$name}/', + 'frontoffice-template' => 'templates/frontOffice/{$name}/', + 'backoffice-template' => 'templates/backOffice/{$name}/', + 'email-template' => 'templates/email/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php b/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php new file mode 100644 index 0000000..7c0113b --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/TuskInstaller.php @@ -0,0 +1,14 @@ + + */ + class TuskInstaller extends BaseInstaller + { + protected $locations = array( + 'task' => '.tusk/tasks/{$name}/', + 'command' => '.tusk/commands/{$name}/', + 'asset' => 'assets/tusk/{$name}/', + ); + } diff --git a/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php b/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php new file mode 100644 index 0000000..2cbb4a4 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/WHMCSInstaller.php @@ -0,0 +1,10 @@ + 'modules/gateways/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php b/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php new file mode 100644 index 0000000..cb38788 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php @@ -0,0 +1,9 @@ + 'wolf/plugins/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php b/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php new file mode 100644 index 0000000..b03219c --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php @@ -0,0 +1,11 @@ + 'wp-content/plugins/{$name}/', + 'theme' => 'wp-content/themes/{$name}/', + 'muplugin' => 'wp-content/mu-plugins/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php b/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php new file mode 100644 index 0000000..bde9bc8 --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php @@ -0,0 +1,11 @@ + 'library/{$name}/', + 'extra' => 'extras/library/{$name}/', + 'module' => 'module/{$name}/', + ); +} diff --git a/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php b/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php new file mode 100644 index 0000000..56cdf5d --- /dev/null +++ b/vendor/composer/installers/src/Composer/Installers/ZikulaInstaller.php @@ -0,0 +1,10 @@ + 'modules/{$vendor}-{$name}/', + 'theme' => 'themes/{$vendor}-{$name}/' + ); +} diff --git a/vendor/composer/installers/src/bootstrap.php b/vendor/composer/installers/src/bootstrap.php new file mode 100644 index 0000000..0de276e --- /dev/null +++ b/vendor/composer/installers/src/bootstrap.php @@ -0,0 +1,13 @@ +installer = new AsgardInstaller( + new Package('NyanCat', '4.2', '4.2'), + new Composer() + ); + } + + /** + * @dataProvider packageNameInflectionProvider + */ + public function testInflectPackageVars($type, $name, $expected) + { + $this->assertEquals( + $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)), + array('name' => $expected, 'type' => $type) + ); + } + + public function packageNameInflectionProvider() + { + return array( + array( + 'asgard-module', + 'asgard-module', + 'Asgard' + ), + array( + 'asgard-module', + 'blog', + 'Blog' + ), + // tests that exactly one '-theme' is cut off + array( + 'asgard-theme', + 'some-theme-theme', + 'Some-theme', + ), + // tests that names without '-theme' suffix stay valid + array( + 'asgard-theme', + 'someothertheme', + 'Someothertheme', + ), + ); + } +} diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php b/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php new file mode 100644 index 0000000..3b15ea4 --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/CakePHPInstallerTest.php @@ -0,0 +1,163 @@ +package = new Package('CamelCased', '1.0', '1.0'); + $this->io = $this->getMock('Composer\IO\PackageInterface'); + $this->composer = new Composer(); + } + + /** + * testInflectPackageVars + * + * @return void + */ + public function testInflectPackageVars() + { + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'CamelCased')); + $this->assertEquals($result, array('name' => 'CamelCased')); + + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'with-dash')); + $this->assertEquals($result, array('name' => 'WithDash')); + + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'with_underscore')); + $this->assertEquals($result, array('name' => 'WithUnderscore')); + + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'cake/acl')); + $this->assertEquals($result, array('name' => 'Cake/Acl')); + + $installer = new CakePHPInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'cake/debug-kit')); + $this->assertEquals($result, array('name' => 'Cake/DebugKit')); + } + + /** + * Test getLocations returning appropriate values based on CakePHP version + * + */ + public function testGetLocations() { + $package = new RootPackage('CamelCased', '1.0', '1.0'); + $composer = new Composer(); + $rm = new RepositoryManager( + $this->getMock('Composer\IO\IOInterface'), + $this->getMock('Composer\Config') + ); + $composer->setRepositoryManager($rm); + $installer = new CakePHPInstaller($package, $composer); + + // 2.0 < cakephp < 3.0 + $this->setCakephpVersion($rm, '2.0.0'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + $this->setCakephpVersion($rm, '2.5.9'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + $this->setCakephpVersion($rm, '~2.5'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + // special handling for 2.x versions when 3.x is still in development + $this->setCakephpVersion($rm, 'dev-master'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + $this->setCakephpVersion($rm, '>=2.5'); + $result = $installer->getLocations(); + $this->assertContains('Plugin/', $result['plugin']); + + // cakephp >= 3.0 + $this->setCakephpVersion($rm, '3.0.*-dev'); + $result = $installer->getLocations(); + $this->assertContains('plugins/', $result['plugin']); + + $this->setCakephpVersion($rm, '~8.8'); + $result = $installer->getLocations(); + $this->assertContains('plugins/', $result['plugin']); + } + + /** + * Test if installer-name was set + * + */ + public function testGetInstallPath() { + $autoload = array( + 'psr-4' => array( + 'FOC\\Authenticate' => '' + ) + ); + $this->package->setAutoload($autoload); + $this->package->setType('cakephp-plugin'); + $rm = new RepositoryManager( + $this->getMock('Composer\IO\IOInterface'), + $this->getMock('Composer\Config') + ); + $this->composer->setRepositoryManager($rm); + $installer = new CakePHPInstaller($this->package, $this->composer); + + $this->setCakephpVersion($rm, '3.0.0'); + $installer->getInstallPath($this->package, 'cakephp'); + $extra = $this->package->getExtra(); + $this->assertEquals('FOC/Authenticate', $extra['installer-name']); + + $autoload = array( + 'psr-4' => array( + 'FOC\Acl\Test' => './tests', + 'FOC\Acl' => '' + ) + ); + $this->package->setAutoload($autoload); + $this->package->setExtra(array()); + $installer->getInstallPath($this->package, 'cakephp'); + $extra = $this->package->getExtra(); + $this->assertEquals('FOC/Acl', $extra['installer-name']); + + $autoload = array( + 'psr-4' => array( + 'Foo\Bar' => 'foo', + 'Acme\Plugin\Test' => 'tests', + 'Acme\Plugin' => './src' + ) + ); + $this->package->setAutoload($autoload); + $this->package->setExtra(array()); + $installer->getInstallPath($this->package, 'cakephp'); + $extra = $this->package->getExtra(); + $this->assertEquals('Acme/Plugin', $extra['installer-name']); + } + + protected function setCakephpVersion($rm, $version) { + $parser = new VersionParser(); + list(, $version) = explode(' ', $parser->parseConstraints($version)); + $installed = new InstalledArrayRepository(); + $package = new Package('cakephp/cakephp', $version, $version); + $installed->addPackage($package); + $rm->setLocalRepository($installed); + } + +} diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php b/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php new file mode 100644 index 0000000..9e385e6 --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/DokuWikiInstallerTest.php @@ -0,0 +1,89 @@ +installer = new DokuWikiInstaller( + new Package('NyanCat', '4.2', '4.2'), + new Composer() + ); + } + + /** + * @dataProvider packageNameInflectionProvider + */ + public function testInflectPackageVars($type, $name, $expected) + { + $this->assertEquals( + $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)), + array('name' => $expected, 'type'=>$type) + ); + } + + public function packageNameInflectionProvider() + { + return array( + array( + 'dokuwiki-plugin', + 'dokuwiki-test-plugin', + 'test', + ), + array( + 'dokuwiki-plugin', + 'test-plugin', + 'test', + ), + array( + 'dokuwiki-plugin', + 'dokuwiki_test', + 'test', + ), + array( + 'dokuwiki-plugin', + 'test', + 'test', + ), + array( + 'dokuwiki-plugin', + 'test-template', + 'test-template', + ), + array( + 'dokuwiki-template', + 'dokuwiki-test-template', + 'test', + ), + array( + 'dokuwiki-template', + 'test-template', + 'test', + ), + array( + 'dokuwiki-template', + 'dokuwiki_test', + 'test', + ), + array( + 'dokuwiki-template', + 'test', + 'test', + ), + array( + 'dokuwiki-template', + 'test-plugin', + 'test-plugin', + ), + ); + } +} diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php b/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php new file mode 100644 index 0000000..b757799 --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/GravInstallerTest.php @@ -0,0 +1,63 @@ +composer = new Composer(); + } + + public function testInflectPackageVars() + { + $package = $this->getPackage('vendor/name', '0.0.0'); + $installer = new GravInstaller($package, $this->composer); + $packageVars = $this->getPackageVars($package); + + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => 'test'))); + $this->assertEquals('test', $result['name']); + + foreach ($installer->getLocations() as $name => $location) { + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test"))); + $this->assertEquals('test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-$name"))); + $this->assertEquals('test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "$name-test-test"))); + $this->assertEquals('test-test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "test-test-$name"))); + $this->assertEquals('test-test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test"))); + $this->assertEquals('test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-$name"))); + $this->assertEquals('test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-$name-test-test"))); + $this->assertEquals('test-test', $result['name']); + $result = $installer->inflectPackageVars(array_merge($packageVars, array('name' => "grav-test-test-$name"))); + $this->assertEquals('test-test', $result['name']); + } + } + + /** + * @param $package \Composer\Package\PackageInterface + */ + public function getPackageVars($package) + { + $type = $package->getType(); + + $prettyName = $package->getPrettyName(); + if (strpos($prettyName, '/') !== false) { + list($vendor, $name) = explode('/', $prettyName); + } else { + $vendor = ''; + $name = $prettyName; + } + + return compact('name', 'vendor', 'type'); + } +} diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php b/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php new file mode 100644 index 0000000..1a28a63 --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php @@ -0,0 +1,412 @@ +fs = new Filesystem; + + $this->composer = new Composer(); + $this->config = new Config(); + $this->composer->setConfig($this->config); + + $this->vendorDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-vendor'; + $this->ensureDirectoryExistsAndClear($this->vendorDir); + + $this->binDir = realpath(sys_get_temp_dir()) . DIRECTORY_SEPARATOR . 'baton-test-bin'; + $this->ensureDirectoryExistsAndClear($this->binDir); + + $this->config->merge(array( + 'config' => array( + 'vendor-dir' => $this->vendorDir, + 'bin-dir' => $this->binDir, + ), + )); + + $this->dm = $this->getMockBuilder('Composer\Downloader\DownloadManager') + ->disableOriginalConstructor() + ->getMock(); + $this->composer->setDownloadManager($this->dm); + + $this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface'); + $this->io = $this->getMock('Composer\IO\IOInterface'); + } + + /** + * tearDown + * + * @return void + */ + public function tearDown() + { + $this->fs->removeDirectory($this->vendorDir); + $this->fs->removeDirectory($this->binDir); + } + + /** + * testSupports + * + * @return void + * + * @dataProvider dataForTestSupport + */ + public function testSupports($type, $expected) + { + $installer = new Installer($this->io, $this->composer); + $this->assertSame($expected, $installer->supports($type), sprintf('Failed to show support for %s', $type)); + } + + /** + * dataForTestSupport + */ + public function dataForTestSupport() + { + return array( + array('agl-module', true), + array('annotatecms-module', true), + array('annotatecms-component', true), + array('annotatecms-service', true), + array('bitrix-module', true), + array('bitrix-component', true), + array('bitrix-theme', true), + array('cakephp', false), + array('cakephp-', false), + array('cakephp-app', false), + array('cakephp-plugin', true), + array('chef-cookbook', true), + array('chef-role', true), + array('codeigniter-app', false), + array('codeigniter-library', true), + array('codeigniter-third-party', true), + array('codeigniter-module', true), + array('concrete5-block', true), + array('concrete5-package', true), + array('concrete5-theme', true), + array('concrete5-update', true), + array('craft-plugin', true), + array('croogo-plugin', true), + array('croogo-theme', true), + array('dokuwiki-plugin', true), + array('dokuwiki-template', true), + array('drupal-module', true), + array('dolibarr-module', true), + array('elgg-plugin', true), + array('fuel-module', true), + array('fuel-package', true), + array('fuel-theme', true), + array('fuelphp-component', true), + array('hurad-plugin', true), + array('hurad-theme', true), + array('joomla-library', true), + array('kirby-plugin', true), + array('kohana-module', true), + array('laravel-library', true), + array('lithium-library', true), + array('magento-library', true), + array('mako-package', true), + array('modxevo-snippet', true), + array('modxevo-plugin', true), + array('modxevo-module', true), + array('modxevo-template', true), + array('modxevo-lib', true), + array('mediawiki-extension', true), + array('mediawiki-skin', true), + array('microweber-module', true), + array('modulework-module', true), + array('moodle-mod', true), + array('october-module', true), + array('october-plugin', true), + array('piwik-plugin', true), + array('phpbb-extension', true), + array('pimcore-plugin', true), + array('ppi-module', true), + array('puppet-module', true), + array('redaxo-addon', true), + array('redaxo-bestyle-plugin', true), + array('roundcube-plugin', true), + array('shopware-backend-plugin', true), + array('shopware-core-plugin', true), + array('shopware-frontend-plugin', true), + array('shopware-theme', true), + array('silverstripe-module', true), + array('silverstripe-theme', true), + array('symfony1-plugin', true), + array('thelia-module', true), + array('thelia-frontoffice-template', true), + array('thelia-backoffice-template', true), + array('thelia-email-template', true), + array('tusk-task', true), + array('tusk-asset', true), + array('typo3-flow-plugin', true), + array('typo3-cms-extension', true), + array('whmcs-gateway', true), + array('wolfcms-plugin', true), + array('wordpress-plugin', true), + array('wordpress-core', false), + array('zend-library', true), + array('zikula-module', true), + array('zikula-theme', true), + ); + } + + /** + * testInstallPath + * + * @dataProvider dataForTestInstallPath + */ + public function testInstallPath($type, $path, $name, $version = '1.0.0') + { + $installer = new Installer($this->io, $this->composer); + $package = new Package($name, $version, $version); + + $package->setType($type); + $result = $installer->getInstallPath($package); + $this->assertEquals($path, $result); + } + + /** + * dataFormTestInstallPath + */ + public function dataForTestInstallPath() + { + return array( + array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'), + array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'), + array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'), + array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'), + array('bitrix-module', 'local/modules/my_module/', 'author/my_module'), + array('bitrix-component', 'local/components/my_component/', 'author/my_component'), + array('bitrix-theme', 'local/templates/my_theme/', 'author/my_theme'), + array('cakephp-plugin', 'Plugin/Ftp/', 'shama/ftp'), + array('chef-cookbook', 'Chef/mre/my_cookbook/', 'mre/my_cookbook'), + array('chef-role', 'Chef/roles/my_role/', 'mre/my_role'), + array('codeigniter-library', 'application/libraries/my_package/', 'shama/my_package'), + array('codeigniter-module', 'application/modules/my_package/', 'shama/my_package'), + array('concrete5-block', 'blocks/concrete5_block/', 'remo/concrete5_block'), + array('concrete5-package', 'packages/concrete5_package/', 'remo/concrete5_package'), + array('concrete5-theme', 'themes/concrete5_theme/', 'remo/concrete5_theme'), + array('concrete5-update', 'updates/concrete5/', 'concrete5/concrete5'), + array('craft-plugin', 'craft/plugins/my_plugin/', 'mdcpepper/my_plugin'), + array('croogo-plugin', 'Plugin/Sitemaps/', 'fahad19/sitemaps'), + array('croogo-theme', 'View/Themed/Readable/', 'rchavik/readable'), + array('dokuwiki-plugin', 'lib/plugins/someplugin/', 'author/someplugin'), + array('dokuwiki-template', 'lib/tpl/sometemplate/', 'author/sometemplate'), + array('dolibarr-module', 'htdocs/custom/my_module/', 'shama/my_module'), + array('drupal-module', 'modules/my_module/', 'shama/my_module'), + array('drupal-theme', 'themes/my_module/', 'shama/my_module'), + array('drupal-profile', 'profiles/my_module/', 'shama/my_module'), + array('drupal-drush', 'drush/my_module/', 'shama/my_module'), + array('elgg-plugin', 'mod/sample_plugin/', 'test/sample_plugin'), + array('fuel-module', 'fuel/app/modules/module/', 'fuel/module'), + array('fuel-package', 'fuel/packages/orm/', 'fuel/orm'), + array('fuel-theme', 'fuel/app/themes/theme/', 'fuel/theme'), + array('fuelphp-component', 'components/demo/', 'fuelphp/demo'), + array('hurad-plugin', 'plugins/Akismet/', 'atkrad/akismet'), + array('hurad-theme', 'plugins/Hurad2013/', 'atkrad/Hurad2013'), + array('joomla-plugin', 'plugins/my_plugin/', 'shama/my_plugin'), + array('kirby-plugin', 'site/plugins/my_plugin/', 'shama/my_plugin'), + array('kohana-module', 'modules/my_package/', 'shama/my_package'), + array('laravel-library', 'libraries/my_package/', 'shama/my_package'), + array('lithium-library', 'libraries/li3_test/', 'user/li3_test'), + array('magento-library', 'lib/foo/', 'test/foo'), + array('modxevo-snippet', 'assets/snippets/my_snippet/', 'shama/my_snippet'), + array('modxevo-plugin', 'assets/plugins/my_plugin/', 'shama/my_plugin'), + array('modxevo-module', 'assets/modules/my_module/', 'shama/my_module'), + array('modxevo-template', 'assets/templates/my_template/', 'shama/my_template'), + array('modxevo-lib', 'assets/lib/my_lib/', 'shama/my_lib'), + array('mako-package', 'app/packages/my_package/', 'shama/my_package'), + array('mediawiki-extension', 'extensions/APC/', 'author/APC'), + array('mediawiki-extension', 'extensions/APC/', 'author/APC-extension'), + array('mediawiki-extension', 'extensions/UploadWizard/', 'author/upload-wizard'), + array('mediawiki-extension', 'extensions/SyntaxHighlight_GeSHi/', 'author/syntax-highlight_GeSHi'), + array('mediawiki-skin', 'skins/someskin/', 'author/someskin-skin'), + array('mediawiki-skin', 'skins/someskin/', 'author/someskin'), + array('microweber-module', 'userfiles/modules/my-thing/', 'author/my-thing-module'), + array('modulework-module', 'modules/my_package/', 'shama/my_package'), + array('moodle-mod', 'mod/my_package/', 'shama/my_package'), + array('october-module', 'modules/my_plugin/', 'shama/my_plugin'), + array('october-plugin', 'plugins/shama/my_plugin/', 'shama/my_plugin'), + array('october-theme', 'themes/my_theme/', 'shama/my_theme'), + array('piwik-plugin', 'plugins/VisitSummary/', 'shama/visit-summary'), + array('phpbb-extension', 'ext/test/foo/', 'test/foo'), + array('phpbb-style', 'styles/foo/', 'test/foo'), + array('phpbb-language', 'language/foo/', 'test/foo'), + array('pimcore-plugin', 'plugins/MyPlugin/', 'ubikz/my_plugin'), + array('ppi-module', 'modules/foo/', 'test/foo'), + array('puppet-module', 'modules/puppet-name/', 'puppet/puppet-name'), + array('redaxo-addon', 'redaxo/include/addons/my_plugin/', 'shama/my_plugin'), + array('redaxo-bestyle-plugin', 'redaxo/include/addons/be_style/plugins/my_plugin/', 'shama/my_plugin'), + array('roundcube-plugin', 'plugins/base/', 'test/base'), + array('roundcube-plugin', 'plugins/replace_dash/', 'test/replace-dash'), + array('shopware-backend-plugin', 'engine/Shopware/Plugins/Local/Backend/ShamaMyBackendPlugin/', 'shama/my-backend-plugin'), + array('shopware-core-plugin', 'engine/Shopware/Plugins/Local/Core/ShamaMyCorePlugin/', 'shama/my-core-plugin'), + array('shopware-frontend-plugin', 'engine/Shopware/Plugins/Local/Frontend/ShamaMyFrontendPlugin/', 'shama/my-frontend-plugin'), + array('shopware-theme', 'templates/my_theme/', 'shama/my-theme'), + array('silverstripe-module', 'my_module/', 'shama/my_module'), + array('silverstripe-module', 'sapphire/', 'silverstripe/framework', '2.4.0'), + array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0'), + array('silverstripe-module', 'framework/', 'silverstripe/framework', '3.0.0-rc1'), + array('silverstripe-module', 'framework/', 'silverstripe/framework', 'my/branch'), + array('silverstripe-theme', 'themes/my_theme/', 'shama/my_theme'), + array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sfShamaPlugin'), + array('symfony1-plugin', 'plugins/sfShamaPlugin/', 'shama/sf-shama-plugin'), + array('thelia-module', 'local/modules/my_module/', 'shama/my_module'), + array('thelia-frontoffice-template', 'templates/frontOffice/my_template_fo/', 'shama/my_template_fo'), + array('thelia-backoffice-template', 'templates/backOffice/my_template_bo/', 'shama/my_template_bo'), + array('thelia-email-template', 'templates/email/my_template_email/', 'shama/my_template_email'), + array('tusk-task', '.tusk/tasks/my_task/', 'shama/my_task'), + array('typo3-flow-package', 'Packages/Application/my_package/', 'shama/my_package'), + array('typo3-flow-build', 'Build/my_package/', 'shama/my_package'), + array('typo3-cms-extension', 'typo3conf/ext/my_extension/', 'shama/my_extension'), + array('whmcs-gateway', 'modules/gateways/gateway_name/', 'vendor/gateway_name'), + array('wolfcms-plugin', 'wolf/plugins/my_plugin/', 'shama/my_plugin'), + array('wordpress-plugin', 'wp-content/plugins/my_plugin/', 'shama/my_plugin'), + array('wordpress-muplugin', 'wp-content/mu-plugins/my_plugin/', 'shama/my_plugin'), + array('zend-extra', 'extras/library/zend_test/', 'shama/zend_test'), + array('zikula-module', 'modules/my-test_module/', 'my/test_module'), + array('zikula-theme', 'themes/my-test_theme/', 'my/test_theme'), + ); + } + + /** + * testGetCakePHPInstallPathException + * + * @return void + * + * @expectedException \InvalidArgumentException + */ + public function testGetCakePHPInstallPathException() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('shama/ftp', '1.0.0', '1.0.0'); + + $package->setType('cakephp-whoops'); + $result = $installer->getInstallPath($package); + } + + /** + * testCustomInstallPath + */ + public function testCustomInstallPath() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('shama/ftp', '1.0.0', '1.0.0'); + $package->setType('cakephp-plugin'); + $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0'); + $this->composer->setPackage($consumerPackage); + $consumerPackage->setExtra(array( + 'installer-paths' => array( + 'my/custom/path/{$name}/' => array( + 'shama/ftp', + 'foo/bar', + ), + ), + )); + $result = $installer->getInstallPath($package); + $this->assertEquals('my/custom/path/Ftp/', $result); + } + + /** + * testCustomInstallerName + */ + public function testCustomInstallerName() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('shama/cakephp-ftp-plugin', '1.0.0', '1.0.0'); + $package->setType('cakephp-plugin'); + $package->setExtra(array( + 'installer-name' => 'FTP', + )); + $result = $installer->getInstallPath($package); + $this->assertEquals('Plugin/FTP/', $result); + } + + /** + * testCustomTypePath + */ + public function testCustomTypePath() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('slbmeh/my_plugin', '1.0.0', '1.0.0'); + $package->setType('wordpress-plugin'); + $consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0'); + $this->composer->setPackage($consumerPackage); + $consumerPackage->setExtra(array( + 'installer-paths' => array( + 'my/custom/path/{$name}/' => array( + 'type:wordpress-plugin' + ), + ), + )); + $result = $installer->getInstallPath($package); + $this->assertEquals('my/custom/path/my_plugin/', $result); + } + + /** + * testNoVendorName + */ + public function testNoVendorName() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('sfPhpunitPlugin', '1.0.0', '1.0.0'); + + $package->setType('symfony1-plugin'); + $result = $installer->getInstallPath($package); + $this->assertEquals('plugins/sfPhpunitPlugin/', $result); + } + + /** + * testTypo3Inflection + */ + public function testTypo3Inflection() + { + $installer = new Installer($this->io, $this->composer); + $package = new Package('typo3/fluid', '1.0.0', '1.0.0'); + + $package->setAutoload(array( + 'psr-0' => array( + 'TYPO3\\Fluid' => 'Classes', + ), + )); + + $package->setType('typo3-flow-package'); + $result = $installer->getInstallPath($package); + $this->assertEquals('Packages/Application/TYPO3.Fluid/', $result); + } + + public function testUninstallAndDeletePackageFromLocalRepo() + { + $package = new Package('foo', '1.0.0', '1.0.0'); + + $installer = $this->getMock('Composer\Installers\Installer', array('getInstallPath'), array($this->io, $this->composer)); + $installer->expects($this->once())->method('getInstallPath')->with($package)->will($this->returnValue(sys_get_temp_dir().'/foo')); + + $repo = $this->getMock('Composer\Repository\InstalledRepositoryInterface'); + $repo->expects($this->once())->method('hasPackage')->with($package)->will($this->returnValue(true)); + $repo->expects($this->once())->method('removePackage')->with($package); + + $installer->uninstall($repo, $package); + } +} diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php b/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php new file mode 100644 index 0000000..3675e18 --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/MediaWikiInstallerTest.php @@ -0,0 +1,66 @@ +installer = new MediaWikiInstaller( + new Package('NyanCat', '4.2', '4.2'), + new Composer() + ); + } + + /** + * @dataProvider packageNameInflectionProvider + */ + public function testInflectPackageVars($type, $name, $expected) + { + $this->assertEquals( + $this->installer->inflectPackageVars(array('name' => $name, 'type'=>$type)), + array('name' => $expected, 'type'=>$type) + ); + } + + public function packageNameInflectionProvider() + { + return array( + array( + 'mediawiki-extension', + 'sub-page-list', + 'SubPageList', + ), + array( + 'mediawiki-extension', + 'sub-page-list-extension', + 'SubPageList', + ), + array( + 'mediawiki-extension', + 'semantic-mediawiki', + 'SemanticMediawiki', + ), + // tests that exactly one '-skin' is cut off, and that skins do not get ucwords treatment like extensions + array( + 'mediawiki-skin', + 'some-skin-skin', + 'some-skin', + ), + // tests that names without '-skin' suffix stay valid + array( + 'mediawiki-skin', + 'someotherskin', + 'someotherskin', + ), + ); + } +} diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php b/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php new file mode 100644 index 0000000..fd427cd --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/OctoberInstallerTest.php @@ -0,0 +1,66 @@ +installer = new OctoberInstaller( + new Package('NyanCat', '4.2', '4.2'), + new Composer() + ); + } + + /** + * @dataProvider packageNameInflectionProvider + */ + public function testInflectPackageVars($type, $name, $expected) + { + $this->assertEquals( + $this->installer->inflectPackageVars(array('name' => $name, 'type' => $type)), + array('name' => $expected, 'type' => $type) + ); + } + + public function packageNameInflectionProvider() + { + return array( + array( + 'october-plugin', + 'subpagelist', + 'subpagelist', + ), + array( + 'october-plugin', + 'subpagelist-plugin', + 'subpagelist', + ), + array( + 'october-plugin', + 'semanticoctober', + 'semanticoctober', + ), + // tests that exactly one '-theme' is cut off + array( + 'october-theme', + 'some-theme-theme', + 'some-theme', + ), + // tests that names without '-theme' suffix stay valid + array( + 'october-theme', + 'someothertheme', + 'someothertheme', + ), + ); + } +} \ No newline at end of file diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php b/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php new file mode 100644 index 0000000..ea79374 --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/PimcoreInstallerTest.php @@ -0,0 +1,44 @@ +package = new Package('CamelCased', '1.0', '1.0'); + $this->io = $this->getMock('Composer\IO\PackageInterface'); + $this->composer = new Composer(); + } + + /** + * testInflectPackageVars + * + * @return void + */ + public function testInflectPackageVars() + { + $installer = new PimcoreInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'CamelCased')); + $this->assertEquals($result, array('name' => 'CamelCased')); + + $installer = new PimcoreInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'with-dash')); + $this->assertEquals($result, array('name' => 'WithDash')); + + $installer = new PimcoreInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'with_underscore')); + $this->assertEquals($result, array('name' => 'WithUnderscore')); + } +} diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php b/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php new file mode 100644 index 0000000..8d9ff3f --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/PiwikInstallerTest.php @@ -0,0 +1,63 @@ +package = new Package('VisitSummary', '1.0', '1.0'); + $this->io = $this->getMock('Composer\IO\PackageInterface'); + $this->composer = new Composer(); + } + + /** + * testInflectPackageVars + * + * @return void + */ + public function testInflectPackageVars() + { + $installer = new PiwikInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'VisitSummary')); + $this->assertEquals($result, array('name' => 'VisitSummary')); + + $installer = new PiwikInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'visit-summary')); + $this->assertEquals($result, array('name' => 'VisitSummary')); + + $installer = new PiwikInstaller($this->package, $this->composer); + $result = $installer->inflectPackageVars(array('name' => 'visit_summary')); + $this->assertEquals($result, array('name' => 'VisitSummary')); + } + +} diff --git a/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php b/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php new file mode 100644 index 0000000..6418a03 --- /dev/null +++ b/vendor/composer/installers/tests/Composer/Installers/Test/TestCase.php @@ -0,0 +1,64 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Installers\Test; + +use Composer\Package\Version\VersionParser; +use Composer\Package\Package; +use Composer\Package\AliasPackage; +use Composer\Package\LinkConstraint\VersionConstraint; +use Composer\Util\Filesystem; + +abstract class TestCase extends \PHPUnit_Framework_TestCase +{ + private static $parser; + + protected static function getVersionParser() + { + if (!self::$parser) { + self::$parser = new VersionParser(); + } + + return self::$parser; + } + + protected function getVersionConstraint($operator, $version) + { + return new VersionConstraint( + $operator, + self::getVersionParser()->normalize($version) + ); + } + + protected function getPackage($name, $version) + { + $normVersion = self::getVersionParser()->normalize($version); + + return new Package($name, $normVersion, $version); + } + + protected function getAliasPackage($package, $version) + { + $normVersion = self::getVersionParser()->normalize($version); + + return new AliasPackage($package, $normVersion, $version); + } + + protected function ensureDirectoryExistsAndClear($directory) + { + $fs = new Filesystem(); + if (is_dir($directory)) { + $fs->removeDirectory($directory); + } + mkdir($directory, 0777, true); + } +} diff --git a/vendor/composer/installers/tests/bootstrap.php b/vendor/composer/installers/tests/bootstrap.php new file mode 100644 index 0000000..30c8fdc --- /dev/null +++ b/vendor/composer/installers/tests/bootstrap.php @@ -0,0 +1,4 @@ +add('Composer\Installers\Test', __DIR__); diff --git a/vendor/pdepend/pdepend/CHANGELOG b/vendor/pdepend/pdepend/CHANGELOG new file mode 100644 index 0000000..5ab6fbd --- /dev/null +++ b/vendor/pdepend/pdepend/CHANGELOG @@ -0,0 +1,416 @@ +PHP_Depend 0.11.0 +----------------- + +This release closes a critical bug that let PHP_Depend die with a E_FATAL when +the used PHP version was 5.4 or greater. + +- Fixed #18976391: PHP_Depend's file cache implementation does not work with + PHP 5.4. Fixed with commit #06ce51a. + +PHP_Depend 0.10.6 +----------------- + +This release closes a critical bug in PHP_Depend's parser that produced +false positiv error messages for classes named like 'True', 'False' or +'Null' + +- Fixed #5ac3e55: Unexpected token: True, line: 348, col: 49, file:... + +PHP_Depend 0.10.5 +----------------- + +This release closes two minor bugs in PHP_Depend. One incompatibility +with PHP 5.2.x versions and one bug related to PHP_Depend's log +behavior when PHP_Depend analyzes unstructured source code. This release +was published on May the 20th 2011. + +- Fixed #13255437: PHP 5.2 Compatibility Issues. Fixed with commit + #8d4a095. +- Fixed #13405179: PHP Depend report is not generated if all files do + not contain a class nor a function. Fixed with commit #554ade1. + +PHP_Depend 0.10.4 +----------------- + +This release contains an improvement in PHP_Depend's memory consumption. +We have optimized the internal data structures in such a way that the +memory footprint was reduced by ~30%. These values were measured for +currently popular frameworks with a medium to large sized code base. The +tests were run under ubuntu with PHP 5.2.17 and PHP 5.3.6. + +PHP_Depend 0.10.3 +----------------- + +This release closes a critial bug in PHP_Depend's analyzer locator code +that prevents PHP_Depend from running on windows. This release was +published on March the 02th 2011. + +- Fixed #10659085: Analyzer locator code does not work on windows. Fixed + with commit #0101798. + +PHP_Depend 0.10.2 +----------------- + +This release of PHP_Depend closes two bugs. One related to the start and +end line properties of object property nodes in the syntax tree. The +second fix closes a bug in PHP_Depend's implementation of the WMCi metric. +Beside these two fixes this release implements three minor features, one +design issue in the syntax tree api and the other two other features are +related to the new metrics CE, CA, CBO and NPM. + +Additionally we have restructured PHP_Depend's directory structure from a +custom, freestyle format to a directory layout that is similar to maven's +convention. With this change we have fixed several issues and workarounds +in PHP_Depend's build process. + +- Fixed #9936901: WMCi calculation is incorrect for overwritten methods. + Fixed with commit #69d079a. +- Fixed #8927377: Invalid Start/End Line/Column for object property access. + Fixed with commit #fc57264. +- Implemented #9069393: Replace optional NULL argument of setPackage() + with separate method. Implemented with commit #1282cdb. +- Implemented #9069871: Implement efferent- and afferent-coupling for + classes. Implemented with commit #07537c2. +- Implemented #9997915: Implement Number of Public Methods metric. + Implemented with commit #2dd3ebf. + +PHP_Depend 0.10.1 +----------------- + +- Fixed #9634613: Notice: Undefined property $___temp___. Fixed with + commit #5fb6900. + +PHP_Depend 0.10.0 +----------------- + +- Fixed #113: PHP fatal error when an unserialized object graph + none NodeI instances. Fixed with commit #c0f4384. +- Implemented #130: Simplify PHP_Depend's ASTCompoundVariable and skip + nested ASTCompoundExpression node instance. Implemented in svn revision + number #1344. +- Implemented #131: Add new method isThis() to PHP_Depend's ASTVariable + class. Implemented in svn revision #1291. +- Implemented #132: Housekeeping: Cleanup the PHP_Depend_Input package test + code. Done in svn revision #1366. +- Implemented #139: Implement Post-/Pre- Increment/Decrement. Implemented + in svn revision #1317. +- Implemented #143: Support PHP's alternative control structure syntax. + Done in svn revision #1375. +- Implemented #146: Implement PHP's declare-statement. Done in subversion + revision #1375. +- Implemented #148: Implement cast expressions. Implemented in svn + revision #1283. +- Fixed #163: Alternative syntax end tokens can terminate with closing + PHP-tag. Fixed in svn revision #1527. +- Fixed #164: Faulty implementation of the --ignore path filter fixed. + Now this filter only works on the local part of a file or directory + name and not on the complete path. Fixed with commit #f75275e. +- Implemented #170: Rename FunctionNameParserImpl into + FunctionNameParserAllVersions. Task scope changed and complete refactoring + done. Parser moved into a version specific parser class. Done in subversion + revision #. +- Fixed #176: Calculation of CIS metric is incorrect. Fixed with commit + #1193f4a. +- Implemented #178: Provide configuration option for the cache directory. + Implemented with git commit #00ed8ec. +- Fixed #181: No log generated when parsing Typo3 extension "t3extplorer" + (Unexpected token ASCII 39). Indirectly fixed in this release. +- Fixed #182: Clone is a valid function, method and type name in older + php versions. Fixed with git commit #b18bf37. +- Fixed #189: Invalid Start/End Line/Column for object method + invocation. Fixed in commit #c6cc9dd. +- Fixed #191: New implementation of --ignore only accepts relative paths. + Fixed in commit #38e6b52. +- Fixed #9623949: Also find analyzers in phar archives in the current + include_path. Fixed in commit #f53dca9. + +PHP_depend 0.9.20 +----------------- + +- Fixed #168: Node identifiers are case sensitive. Fixed in subversion + revision #1529. +- Fixed #169: Null, True and False are valid class or interface names. + Fixed in subversion revision #1538. + +PHP_Depend 0.9.19 +----------------- + +- Fixed #162: Parser does not recognize $ string literal in string. + Fixed in subversion revision #1379. + +PHP_Depend 0.9.18 +----------------- + +- Fixed #161: Unexpected token: -> in foreach statement. Fixed in + subversion revision #1347. + +PHP_Depend 0.9.17 +----------------- + +- Fixed #156: Temp Folder /tmp/pdpend_storage-1000 grows very large. + Fixed with Sebastian Marek's patch in svn revision #1335. + +PHP_Depend 0.9.16 +----------------- + +- Fixed #153: Only count those classes and interfaces that are flagged + as user defined types. Fixed in subversion revision #1327. +- Implemented #154: Make execution order of analyzers reproducable. + Implemented in svn revision #1331. + +PHP_Depend 0.9.15 +----------------- + +- Fixed #152: Endless loop bug for identical class and parent name. + Fixed in svn revision #1296. + +PHP_Depend 0.9.14 +----------------- + +- Fixed #149: Exception Message is empty. Fixed in svn revision #1277. +- Concurrency issue in PHP_Depend's file cache fixed. + +PHP_Depend 0.9.13 +----------------- + +- Fixed #145: Incorrect require_once statement in ASTSwitchStatement + source file. Fixed in svn revision #1262. +- Fixed #150: Invalid nowdoc substitution has produced broken code. + Fixed in svn revision #1266. + +PHP_Depend 0.9.12 +----------------- + +- Implemented #97: Replace current token approach in CCN- and NPath-Analyzer + with AST-Nodes. Implemented in svn revision #1248. +- Implemented #125: PHP_Depend silently parses list statements. Fixed in + svn revision #1223. Thanks to Joey Mazzarelli for providing this patch. +- Implemented #126: Generate reproducable node identifiers instead of + random numbers. Implemented in svn revision #1244. +- Fixed #128: Variable variables in foreach statement cause an exception. + Fixed in svn revision #1237. +- Fixed #133: Fatal error: Maximum function nesting level of '100' reached, + aborting! in /usr/share/pear/PHP/Depend/Util/Log.php on line 109. Fixed + in svn revision #1257. +- Fixed #134: ASTReturnStatement is not derived from ASTStatement. Fixed + in svn revision #1250. +- Fixed #135: Several Statement classes do not inherit ASTStatement. Fixed + in svn revision #1255. + +PHP_Depend 0.9.11 +----------------- + +- Fixed #118: Calculation of the Number Of Overwritten Methods is + wrong. Fixed in svn revision #1112. +- Implemented #121: Parse arguments of the ASTForeachStatement. Implemented + in svn revision #1115. +- Fixed #119: Three test cases fail for PHP lower 5.3. Fixed in svn + revision #1114. +- Critical issue in PHP_Depend's temporary data cache fixed. This bug + only occured when running several instances of PHP_Depend in + parallel. In this setup the used cache key spl_object_hash() has + caused a corrupted cache, because different php process instances + have written different data to the same cache file. + +PHP_Depend 0.9.10 +----------------- + +- Implemented #72: Add NOAM, NOOM and NOCC metrics. Implemented in svn + revision #1084. +- Implemented #74: Make CRAP-index available. Implemented in svn revision + #1063. +- Implemented #105: Support for deep search implement. Implemented in svn + revision #1078. +- Fixed #106: Filter algorithm is broken for namespaced internal classes. + Fixed in svn revision #1039. +- Fixed #110: Duplicate "coupling" directory in test code. Fixed in svn + revision #1032. +- Fixed #111: Dynamic Strings are treated as literal strings. Fixed in svn + revision #1037. +- Fixed #114: Parsing error caused by complex string expressions fixed. + Fixed in svn revision #1068. +- Fixed #115: Summary and PHPUnit Report lists unknown classes. Fixed in + svn revision #1101. +- Fixed #116: Returns reference results in parsing error. Fixed in svn + revision #1090. +- Performance intensive calculation result cached. +- Test code restructured and improved. +- Concurrency issue for parallel running pdepend instances fixed. + +PHP_Depend 0.9.9 +---------------- + +- Fixed #108: Parser doesn't set start/end line/column on variables, fixed in + svn revision #1015. +- Implemented #104: Add isStatic() method on ASTMemberPrimaryPrefix node, + implemented in svn revision #1013. + +PHP_Depend 0.9.8 +---------------- + +- Implemented #93: Implement an assignment expression, Implemented in svn + revision #992. +- Fixed #94: Parser throws exception for closures that return by reference, + fixed in svn revision #962. +- Fixed #98: Functions with an invalid signature result in an inconsistent + object graph, fixed in svn revision #986. +- Fixed #102: Namespace keyword in type-hint is broken, fixed in svn revision + #1010. +- Fixed #103: The parser does not handle all strings as parameter default value + correct, fixed in svn revision #1009. + +PHP_Depend 0.9.7 +---------------- + +- Fixed #95: NPath complexity bug fixed, fixed in svn revision #958. + +PHP_Depend 0.9.6 +---------------- + +- Closed #57: Display caption for abbreviations in overview pyramid, implemented + in svn revision #947. +- Closed #80: Store default value for class properties. +- Fixed #81: PHP_Depend does not support comma separated property declarations, + fixed in svn revision #916. +- Fixed #82: PHP_Depend does not support comma separated constant definitions, + fixed in svn revision #931. +- Closed #83: Make ClassOrInterfaceReference an ASTNode, implemented in svn + revision #917. +- Closed #85: Use soundex to detect typos in type annotations, implemented in + svn revision #937. +- Fixed #87: The parent keyword is not accepted as parameter type hint, fixed in + svn revision #925. +- Fixed #89: Coupling analyzer reports wrong results, fixed in svn revision #939 +- Fixed #90: Coupling analyzer does not handle PHP 5.3 function chains, fixed in + svn revision #943. +- Fixed #91: Parser throws an exception when __CLASS__ as default value of an + array property, fixed in svn revision #944. +- Closes #92: Use class constants as analyzer identifiers, implemented in svn + revision #950. + +PHP_Depend 0.9.5 +---------------- + +- Closed #2: Support PHP 5.3 namespace syntax, implemented since svn + revision #789. +- Closed #61: Catch parser errors and continue processing, implemented + in svn revision #880. +- Closed #63: Make ResultPrinter a configurable option, implemented in + svn revision #668. +- Fixed #64: The single cache directory causes permission denied on + UNIX systems, fixed in svn revision #667. +- Fixed #65: Endless loop for class and interface declarations without + body, fixed in svn revision #672. +- Closed #66: Dependency wiring should be done at the end of the + parsing process, implemented in svn revision #855. +- Fixed #69: Parser does not handle PHP 5.3 class names in function + and method bodies, fixed in svn revision #688. +- Fixed #70: Parser throws an unexpected token exception for closure, + fixed in svn revision #726. +- Fixed #71: Parser throws an unexpected token exception for signed + default values, fixed in svn revision #740. +- Fixed #73: Inconsistent state when an interface and a class with the + same name exists, fixed in svn revision #776. +- Fixed #76: Tokenizer keyword detection is broken, fixed in svn + revision #871. + + +PHP_Depend 0.9.4 +---------------- + +- #40 + Cli debug flag added. PHP_Depend will print additional debug information + to STDERR when this cli switch is set. (Closed) +- #87 + Support for type definitions within comments implemented. (Closed) +- #88 + Tokens provide information about the start and end column. (Closed) +- #90 + Support for single file parsing/analyzing implemented (Closed) +- #92 + Handling of types within instanceof-operator fixed. (Fixed) +- The ProjectAwareI and NodeAwareI interfaces extend the AnalyzerI interface, + which makes analyzer mocking easier. +- Switch from PHP_Depend specific constants for public, protected, private + methods&properties to modifiers compatible with PHP's reflection-extension. +- Support for static modifier for properties&methods and final for methods + added. +- Support for class final modifier added. +- Support for chained types like "false|Iterator" or "array(false|Iterator)" in + doc comments added. + +PHP_Depend 0.9.3 +---------------- + +- #89 + Source file is never set for methods, properties and constants. +- #83 + Storage layer for node tokens added, reduces memory consumption. +- #85 + TextUI displays the execution time and the memory usage(linux only). +- #82 + Tokenizer cache added, reduces runtime up to 25%. +- Code restructured, input filters and iterator moved to package "Input". +- Test suite restructured to reflect the actual project structure. + +PHP_Depend 0.9.2 +---------------- + +- #84 + Critical bug, a backslash could kill PHP_Depend with all PHP Versions lower 5.3.0alpha3 + +PHP_Depend 0.9.1 +---------------- + +- Performance improvements +- #21 + Support for the NPath Complexity metric. +- #78 + Parser fails for comment in function signature. +- #79 + Token objects instead of arrays. + +PHP_Depend 0.9.0 +---------------- + +- PHP_Depend works with PHP 5.2.0 +- #19 + Implement a phpunit compatible xml logger. +- #20 + Add support for class constants. +- #30 + Improve Lines Of Code. + +PHP_Depend 0.8.0 +---------------- + +- No more features or bug fixes, beta4 seems to be stable. + +PHP_Depend 0.8.0beta4 +--------------------- + +- #29 + Tooltip for the Overview Pyramid. +- #34 + Support for pattern based package filter. +- #37 + Remove Logger - XML Config dependency. +- #38 + The Logger interface should not force a default ctor-signature. + +PHP_Depend 0.8.0beta3 +--------------------- + +- #25 + PHP_Depend should print an error if no @package information is available. +- #26 + Handle class and interface names case insensitive. +- #27 + Handle internal classes and interfaces. +- #28 + Add option --bad-documentation. + +PHP_Depend 0.8.0beta2 +--------------------- + +- #18 + Introduce a CodeAware interface for loggers. +- #23 + Use an SVG-Template for the jdepend chart. +- #24 + There is an endless loop for inline html. + +PHP_Depend 0.8.0beta1 +--------------------- + +- New metrics implemented + - ClassLevel (wmc, vars, dit, csz, ...) + - CodeRank (cr, rcr - PageRank adaption for classes and packages) + - Coupling (Fanout, calls) + - CyclomaticComplexity (CCN, CCN2) + - Dependency (ac, cc, ce, ca, d, a, i) + - Hierarchy (clsa, clsc, roots, leafs, maxDIT) + - Inheritance (andc, ahh) + - NodeCount (nop, noc, nof, noi, nom) + - NodeLoc (loc, cloc, ncloc) +- Pluggable logger architecture. +- Pluggable metric analyzer architecture. + + +PHP_Depend 0.1.0 +---------------- + +- Initial proof-of-concept release. diff --git a/vendor/pdepend/pdepend/LICENSE b/vendor/pdepend/pdepend/LICENSE new file mode 100644 index 0000000..73a9442 --- /dev/null +++ b/vendor/pdepend/pdepend/LICENSE @@ -0,0 +1,31 @@ +Copyright (c) 2008-2013, Manuel Pichler . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Manuel Pichler nor the names of his + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/pdepend/pdepend/Vagrantfile b/vendor/pdepend/pdepend/Vagrantfile new file mode 100644 index 0000000..1795510 --- /dev/null +++ b/vendor/pdepend/pdepend/Vagrantfile @@ -0,0 +1,64 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +$build_script = < *} + + {wcv_get_config_value( 'title' )} + + +

+ {wcv_get_config_value( 'title' )} +

+
+ {raw $content->content->html} +
+ + + + {include wcv_get_template( 'html/footer.ezt' ) send $content} + {include wcv_get_template( 'html/formats.ezt' ) send $content} +{literal} + +{/literal} + + diff --git a/vendor/phpmd/phpmd/src/site/resources/override/html/navigation.ezt b/vendor/phpmd/phpmd/src/site/resources/override/html/navigation.ezt new file mode 100644 index 0000000..00a9f29 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/resources/override/html/navigation.ezt @@ -0,0 +1,5 @@ +{use $tree} +

Overview

+
    +{raw wcv_list_from_iterator( $tree )} +
diff --git a/vendor/phpmd/phpmd/src/site/resources/override/html/navigation/item.ezt b/vendor/phpmd/phpmd/src/site/resources/override/html/navigation/item.ezt new file mode 100644 index 0000000..b3015f9 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/resources/override/html/navigation/item.ezt @@ -0,0 +1,15 @@ +{use $item, $subtree, $depth} +
  • + + {if $item->requested}{/if} + {$item->displayName} + {if $item->requested}{/if} + + {if $item->requested} + {if $subtree} +
      + {raw $subtree} +
    + {/if} + {/if} +
  • diff --git a/vendor/phpmd/phpmd/src/site/resources/override/html/release.ezt b/vendor/phpmd/phpmd/src/site/resources/override/html/release.ezt new file mode 100644 index 0000000..eeab029 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/resources/override/html/release.ezt @@ -0,0 +1,6 @@ +

    Get your copy

    + + PHPMD software box image + +
    +Download PHPMD diff --git a/vendor/phpmd/phpmd/src/site/resources/web/css/print.css b/vendor/phpmd/phpmd/src/site/resources/web/css/print.css new file mode 100644 index 0000000..59538d7 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/resources/web/css/print.css @@ -0,0 +1,36 @@ +body { + font-size: 12px; + font-family: sans-serif; +} + +a { + color: inherit; +} + +p { + font-size: 12px; + font-family: sans-serif; + color: #000000; + margin-bottom: 1em; +} + +img { + border: none; +} + +code { + white-space: pre; + display: block; +} + +div.footer { + margin-top: 10px; + font-size: 10px; +} + +/* Hide unimportant stuff */ +fieldset, +div.changelog, +ul.navigation { + display: none; +} diff --git a/vendor/phpmd/phpmd/src/site/resources/web/css/screen.css b/vendor/phpmd/phpmd/src/site/resources/web/css/screen.css new file mode 100644 index 0000000..4d8382d --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/resources/web/css/screen.css @@ -0,0 +1,251 @@ +@charset "UTF-8"; + +* { + border: 0; + padding: 0; + margin: 0; + + text-decoration: none; + + list-style: none; + list-style-image: none; + list-style-position: outside; +} + +html { + background-color: #fff; + + font-size: 99.4%; +} + +body { + background-color: #fff; + + + font-size: 1.1em; + line-height: 1.4em; + font-family: Arial, Verdana, Helvetica, Geneva, sans-serif; + color: #2e3436; + + margin: 0 auto; + width: 55em; +} + +h1, h2, h3, h4 { + font-family: Verdana, Arial, Helvetica, Geneva, sans-serif; +} + +h1 { + background: #fff url(../images/logo.png) 1em 40px no-repeat; + + border-bottom: 1px solid #204a87; + + text-indent: -9999px; + + margin: 0; + height: 150px; +} + +h1 a { + display: block; + + margin-left: 1em; + + height: 120px; + width: 250px; +} + +h2 { + font-size: 1.5em; + font-weight: normal; + color: #204a87; + + margin-top: 1.5em; + margin-bottom: 0.5em; +} + +h3 { + font-size: 1.3em; + font-weight: normal; + font-style: italic; + color: #555753; + + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +a { + color: #204a87; +} + +p { + text-align: justify; + margin-bottom: 1.0em; +} + +blockquote p { + font-weight: 0.8em; + font-style: italic; + + padding-left: 2em; +} + +code { + font-size: 1.1em; + line-height: 1.4em; + + white-space: pre; + + margin-bottom: 1.0em; +} + +code.block { + background: #eeeeec; + + font-size: 1.05em; + + padding: 0.2em 0.5em; + display: block; +} + +code.inline { + font-style: italic; +} + +table { + border-collapse: separate; + + width: 100%; + + margin-bottom: 0.3em; +} + +table td, table th { + font-size: 0.9em; + padding-left: 0.3em; + padding-right: 1em; +} + +table th { + background-color: #babdb6; + + text-align: left; + color: #fff; + + white-space: nowrap; +} + +table td { + background-color: #eeeeec; +} + +#content { + padding-left: 2em; + + float: left; + width: 37em; +} + +#content a { + text-decoration: underline; +} + +#content ul, #content ol { + margin-left: 2em; + margin-bottom: 1.2em; +} + +#content li p { + margin-bottom: 0.5em; +} + +#content ul li { + list-style: circle; +} + +#content ol li { + list-style: decimal; +} + +#navigation { + margin-left: 3em; + + float: left; +} + +#navigation a { + font-style: italic; +} +#navigation a:hover { + text-decoration: underline; +} + +#navigation h2 { + color: #555753; +} + +#navigation ul ul { + padding-left: 1em; +} + +#footer { + border-top: 1px solid #204a87; + font-size: 0.8em; + + padding-left: 2.6em; + margin-bottom: 1em; + + clear: both; +} + +#footer .revision { + cursor: help; + display: inline; + position: relative; +} + +#footer .revision ul { + display: none; +} + +#footer .revision:hover ul { + display: block; + + position: absolute; + left: -300px; + bottom: 25px; + width: 400px; + + list-style-type: circle; + margin: 0px; + padding: 2px 2px 2px 15px; + + border: 1px solid #555753; + font-size: 0.8em; + + background-color: #fff; +} + +#footer .revision ul li { + margin: 1px 0px; + padding: 0px; +} + +#footer .revision ul li p { + margin: 1px 0px; + padding: 0px; +} + +#formats { + text-align: right; + color: #babdb6; + + position: absolute; + top: 128px; + + width: 55em; +} +#formats a { + font-size: 0.5em; + color: #babdb6; +} diff --git a/vendor/phpmd/phpmd/src/site/resources/web/favicon.ico b/vendor/phpmd/phpmd/src/site/resources/web/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..e193e7c61c4f2c0d66ea3ba091f6b726530427ea GIT binary patch literal 1150 zcma)+T})GF7{`y!i@7V3neD<0xEyg=`G~tPCgQ@N(QNZ-euUr$POFI|xEQ`f7z7wD zsqG3K7AQralKb2LP4Sp50kH3%}VbJ#zTFQ+qNq zQv6UXxeD9RV0wdP`!(<)%l$f09;-$*TkrcVNm@)lUF5}oCRmlKSNLs^$f zkLKdsw_l?0YXMFWMqP2iGN+cpsFlIMNTE}86Yp*4**+KyYB2I&A#1*Tzq_HNQcZZu zPBE@F{)Eb+LpVVgwHJ=Xc~%LYRbY^%!J7@>?Ze+$3F`yswk5(`WP;SWy0;~R%<*a)Le0e!y|TGB&bmpI|yGz@4q$Gjf+NL?^A z1taOVMcjzGOK1NY8)D%wYhg1ouy87v^)yU6IXHC>7)cux*K7Y_>8?k<$q9tQGnk2l zF+CRsqv%3gLnQ{tyu1!G+%^-O!yHC<7Q=&Dm^8hFAp?D_W`*r-AN^xGgoS7n^NS0Z zTeyemP!M!Kjkcz0OxziT-(!c@Wrf>0gfTn+dL~xhfZqBGEk=1q-QC$4JXl@DQfwLX zOAAFa!b^_ U?WQ36H6IX>dOJ~+h>VYV1r=WA9smFU literal 0 HcmV?d00001 diff --git a/vendor/phpmd/phpmd/src/site/resources/web/images/box.png b/vendor/phpmd/phpmd/src/site/resources/web/images/box.png new file mode 100644 index 0000000000000000000000000000000000000000..e0f2ad475b30eb662ad660b46f58d4e872b1dd1e GIT binary patch literal 23974 zcmV*$KsmpOP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2iXiA z6*dG4`myr>03ZNKL_t(|+U&jgvnJPh-}gD^bido(=gvNu8DIbqJ3xXY2rd$}P!hG+ z+GRyjNpe)Bq*9ft#EzB3c3kDZAeA3eNhMAtcB*13QR2vwEHO4IiUc%Q+`MoYUQ>`|Ud$NQi*(qAq6Uz3?P;J#M|A$s5Xyfffwd+zPr zx8J{;f8Odd7U#6EsNqlBW7D_q=(rM}hcHE|dnU;K=B4ymX&W5p1>wR+TxP^u9!Q?K)+j$ ze=ks8cS8|^JzyG9g62qB2$m^hAWF>B5BJ69jQ52E*P?6aYe4_UT2yXWRv;MK~ z{MC3XNt>|+a2#}m5D52)(FXEdljVjq*QB{7$uvo3NYk7&H>8;+%?-IWU^GH0x^cu} zFJ@)2%j#l>*Ca_!lI!xmG}mOACfAlMHyCTs+L9YXt}R*{GF|;W zFaK@Oxgj&Yv}i0^TTGch6d<->1qcxSI|+Xvtc61>F?$pD{s{j(>mH+&pc5(jUByDb z!(y+)!XRd`7qifd8T2BS`W==RI;<>oSsZj&=tcBm<*JskqT5jnx)J?u?B4qwIN#Ct z%5qq1(Z*t|Kf$I5mMys{O1ADG8e3Quf8vZG_W((AS24@9AiD8~10X4Vl&z z;7Snb>d)f-)V)rco9Z=8@i{HVgF@Tl^Wq+(9cXfG9hi(M9i}jNlvG!ZC@voV_v$if zJhpD^-D_HR0o{&w*w4Epsbreu4yY}U8;rfT_@_bn=7J)!1K@OdJU$UY2+pE-?xL zmgbrZ*LH~F31AV{`Xg&g3xsut(HgIHw78R8oNVLoD}hOQ;vFbJ7l73kU0508td90T zE)JCTfH640xc8_IrZx^(#dB--H~;P}8-S3G@+iQ81yfimZ@r8$6@ah^0aA*3XfJO8 zCM&R_H6&~^_})5-x8>35o@RfMbz!BOHzfs1wmjZIYI4Y7*7zz#1NW@mo<-HUVS8_ikO@+Nk`gK13kxBT{zO$;09#rLDM46) z5E7xSKYuqNNte;uw`k{Kv+p$a%)sS);KFx3j=J; z#TQEV@K@F!U5mTOipN?S+E-hggv!?4UWik;=g_3S!|{6n+M@>sC@IKtLy~HS(+p!R zQV5K3$JE$%;5!AC@Sd=YJZj!Th<3LTDMhanwO%NrY07Mxb12d`J)TkXxGE_T{)#Gq z>OfinwTO+V43M*;ScDZw=`C*U%eWv(SW%fUvA;L7jRRF0qtYyuka8CRcJA@jV~W=j zSWNJ^>J<>~GZR?7+B?~sdfe~(n*>fBUf|T>1(MV-p5=_D85eJiIeK8g#@>uUH{!<5 zj3m=64Px*5VQ-Qmh2Z3&MRH@faAWNJtc5hw^m`G;Skg>;U`jG=SX=BeNpdnDq6u20 znKty<8=VawMM!D|Y!k3re*Q`#zKvW*Khbl2r) z2tZl=S>f8+dJ<(rAU57Byf5@*mUdC{yW=Lfwl!mIu}iKEN(zpz4*)oMXpvJ#26Q6D z^_>~hM04WcfZ-%#ZL!Ns7q+>+GvmoKYwS%j?mxba0IqCJICo{lBd1p|7S3HAveb`R z=*J|f<^%Vvu(3De#?F+@y_89kF-sekQ{3LgKL=E2HJJyg66L=|5Pullj}W%ZKy8s? z3g`K6`l)Qqh|OCqD=N!p!6K?SnL3zk2=G?R*Z^+$#^wF{f4+BP(XKe++FCAej@ce1 z&cz$c%0h=E*KF-2q*@azS$fayVZv~lad5fI=3c_iDCL!lyIkFxa?ha!miiG%su2?#5 zIw}{x9|A?)jMZ>s1FL5Pi)e425!*T3)e{(7x5zfIlHqID)##OZeYaMZ3(e;w$=RJ` zEcGMeNb<(jA=X$fGDaIqCz3wdsThmPn-iC4V)@Sb9VRo)=I+dUT){NaoV~OMz%0$V zaD7Cq6xv#Zzd(*37?5hic$yPO^6dlFxmOt^Pj!$gDN5P}V=)MjU`=H~3AA4dEW}*fnPH5j*Kva7@hm5jjt#;%;C|?V1AOPL z9Y&L^91vykqkK~3K`MnnNcVw_ z1YvB$wKuXwTX(xbhE&M^oy#;fnH z__XkAk&+x(>~d(e$5KCLca(B)xyOn11%z}7)01Zo@cipreE7k2UcIo##@>uaPpvYZ zW%N2Romg`0z<@KymU!jjE`weK)=`BEy@;)0La(Fv)|=bpy6RR24LlU;AX9zceU1WvSFN81Bjgmh@CgIm1Pb%Us@? z^5F4hrio^I&=g-)b+?cy%E zHa-civglTj+S}vqqIM%(#Wv-S=TD_S*%piSWPF?D3PC_YrP|8HVw>)pvS?6R${;)_ zxy~Ros9V>7#4ahN>h;U#nP$ikgazUAt*M0wr8P&qt8f~!$s2nK8+$I9(#CRpz0aS2 z>l#~o2^VjSF~*{lsCk$_`^(EDnWooKq`A9%2i=GlUf;wTOD9%b-k30)<>a~H$bmj- z<|sfBBGc}3=;uuiUnaLG4^7Uk7m+ zHx{4`U#Iq-6|k7IzCo(i5|+$e00FaM?^svxHyxNZaUf8h6Sp`Id1Z4(ud7(-M@*&~ zS@4?Pn`&c8GF_IJu}&+nH%URbGU_zbZ0;q#awpgtCO*fht{71ex%Te0Ako|xv@OMB z3)(nKD1@y_q=ALBwsOBA;7sY3-7lO4o_}0fB??@4O^i`m#CeNtjBT~(1;C0VsrI;< zr3`>y1N?kh^4)d|lbT0PuW{eeMTV1%TwA1o(JW(@8der!u5L|P>^osfmK$DrYlow2 zefFjqN7wo+_F|S7W4`wC21%Opp$FE9BL!GqyST?fKjx8>Dz= zByU{VV{e?^6c^Dj%J$JgI*1ib&61Y& zq*~U`er~&IW$nBbuZINoOq%6}EH}(j&Gsne=?B-Dra9L0s$0X9 zX_7Nea*iDs@R5fOlB7xw ztyyDJPiWdKTN!QyAU35nclFO^JXy1@{&B_&X=*f76P&&zTUup%Cz{vqU&4PhO?myY z;o^piM-Q&__|Exl#O%f`-(=g)5N#C-=!&a~H27-N~GIUOaLnUU7X?7 zMaJ41AZ-ZDForeW0@uJ}OY2$vy&g`qS+}qu6Mh}^_ zushCJU34+(c$Tv_8M4reNPLangLLkrAjKO0Av8tLgZ^q%TEoA)pJYh zM+iDwbN_X#>z_*<^x^XghG3q4ns@uH$y4}x@Gh4J0sHu zB?SF$#GBWKJaTfCY3i)yrHu(E4=r-~$RZc6kGXhb!qOmOdz5nG;DGy%F7o`@Ewr&r zlblX0Il4ArYnYH`hQ)rw^_?kFNYX52$J&yE2i{(cDryxPXGf(!gQ8aNHl;?i5EvU1 z3XVf?f^G>3iWsv5?VPm@tZwmI*xF+V83P-*Yda6l&{Ec{bwGWYhUGT)-C5sn3#FxS zy;K%Bu+(97v4a$X69*UA86{lZp0YHEII`9+Gxu0Y4zKhv#`4g~RfMp7^VJR3eRb37NL6FLyB( z_Qn~PHYX?{SX=61jG^0!kwUOE=+KEI{cc1zc51BR7``2^G{>V_Yp_N-(UNhoYM_^L z*|)JZWxuVd{M|t@HETH!n4&GEmhhO+;!+ayCP?6_Sh5MmHekSn#lr6z z?(`PPlm)JCPr0@;E&Hd!ilnhlws&=FS{kC^B;)GVq~y9IDadon)-Z9JR4-sM#yXvH z8KzmJf=;BErg>|(z}t^et;-M#VZIPmJ4(eXidqFJbn~Wc7qKN9paYwv_(h&HTIuEShwYt-rJAmRG=AMq4_}(h*OP-NWfTXX> z=ced>u+D&aalG;BD12*=En0m1Rgh=+3f1je(mO1n8fy`z5I=hfKc*obHbLT1F#x42 z4_&+tV^a^byp663LFhvYU07e{xYwG+E@EYZkimrD_Mh9-V^!Ov%Zf0RO?mUmhy%-AFR<>jJxsZ>HRa%P zmsc+C^2B`y$c-UVl3W`iDLHp-$Y`2>PcCrTYEf$xlPMD=ZR$U{Z|8N*c|M`i?s>Vj zzW`ucrT5~ltQpO z&bYMUlBPjdaeZgXB+(o_Fko%D%Nv*XIB~F#l8(YUd2oRTjxRHu=G=c`nd9pN9yqa# z5Q2j%U1q7~-Xn`Vc6yB?Ydw|+omy%CZsY0ON~X$;yrp%-1SQ2L7plW}GGGD<*WP3V zO7|RO{PphDdJI~lpiF2vsmh?u-_stuhVNTe%BT{y_tN~WB1X-P>swfBdE@eselOzn%R_Q) z7*11$lbog$xo!0jA?0_sttf>>Y3o6+)yNzCWwQ!Z3j>OnG>B7m+44-CEwFWWUr(0m z7ek#Ts4Qp&`nIA%g8>LaiZDcZFIm%47n)gSR{MenW!};6Dw53jq$o!lOTVi)cXh~Q zmUA)H2r0O-H6>QAm;b_zG1F9+K$D(pmr~G)6=|kxoy*2sxuRdI(5BYA&!68rf?@dww))u?$j#C~uvCP@ado1)KCbOLN%KD2e zy>k76P@q`VzU>@0S+lAh3_2W0VfU+GHMm$?g$#Diss{0>sfQnhHPxk}%C?khn<0QH z6Q#{A`j+n91$sj)|M-qV-V1bRjHmDbfZ$3Z5n;>x6?b(y0q75$}u#} zf=X=Upm#gFDOfmN+sylx~&b2@<*J*;lV%nhq+0>O8)dZkVE1;4+n zXx1jpfy3IC$P<78b$r6HuH0(y$3$itQcv6>W6J%OSesaUySYFurNJCU!#kyf^Yuh+hTMJ1{tqN6j8QOivl~uOHh7Cq@Mauvs#x+A0jgEq1c$%#y z_}S(=+eT*GPCnMBxd^P*m|T~ZtFVOk9b4wUV@q^m#T%FR*cv80^Uxtivz%iG7D#i= z_3bH2NxHG(?BzYWvEq@_s|etY%R}xxy2$mNDeEgeZfsBKbs~1h8HW$_0O-bwongvC zKVmq|7*BFuxwy;6A3emN8}YSQZg6F5+8FP1YmRDe_Ef<=3f*=PXo#7cLJw*ofUT8J zZ7t5!b0U_287LAd6DC!*HI6M3wwik{ix$+AJ<}p3G|jkFlpqtfg3W$&hvtDAOaQco za1s`|@!$&pZmk=GWUE0KVULb2jc3)#E39=wcH2^d5`v^>$z~~Oo|nIflq63(WJ#A~ zW_k78b&jm{$^XL}d+sBH&n?RUWtTU}b$`utMuD^9wpdo}YKfu^`chmyluj8q?~ zVjKP3F8rxtpr$~ZMw^VV1!!&A3)aHqi!o>}eT$AUPSGIS#d}W(injw^Q^BOE%xwgr8mSc?NrP0X0mn1iaK{q1T zmVPfH_hEpwE<||Xo>dO5_W8mjr9Rc(p+&V-Yl)Th zgHQy-m2e|yj0;9GhAJr?cB&dv@u_Vf^#If@!jvX}tqItIwmvPxTta0U;_8}(rD{IJ z$GQ~=O;xS(zq1AKym+TR*0MeftF*^97#?TaZF5c06!g1`rpXYLS_~_iHGPW|mPlB% zC@MGZ6Kbs)j&(VQHIjnybml;#oePyxu(y}FU8G8q=B7O6>uUqH_9jRH$!va}=8G?n zuol*qd+hE^kwSPd3(}d3TZNx)A}CgwO03jaW$)ag7Ok=2R6GJ<2Mxeh6`)YY7g{#v zK-r8<_w5P@iUf6@)C9~ygWxX#YJvg3erj}X{Jd4|_~K$+Owq?53@Wf?&vg+)8V}4y zZ0XNcF&MZMoE59nt#!jXyql|(?xGg&-Yh37U#k%#H&Zwv9d8*aiSa_|0`3Qvd#o+@ z$#RX760Hs0PQ>nL#zH?P*M?rllm06`ERbZH>CBCa|HPB`@W20?Z}a4XhnY-sdR@gd z$t$ImHY_i6IkY<9(v2ZX3I6)*4WyEuhAQH6QBC6(5~P8SQ(E2Dq!bXf6HnlRn$t;a zBNlBAkudfqEh_~DX6uzI-K<^(ZQ9|K=~}fbkOGzytF=aJOP1?$M!s9`ZZQ7u*6Omh z@29<$l#3|48f-c3LlpP7O|P}}#Gou;i^59E#!(inT8dj$?W?kOIn2KnK_DzrDhJd^ zVvQ>4#7Id_9bMrAr`Cy;`#i&`Ya59p$${lQ+rt@J8=^?Dyx`RO2bTJblZ-Ug96Pv# z6!66TN4Ru-j|Wa3U~6wm94S9R+_2b>+1Q%e&$mPU_($gRrYl^O?#3Rf>gIxs|v8@;k^G`lV!PE+K{`JT&*?6 z1JqGhrq%@@gsn{-6eYhXDiV-t#JH&0rxqh9Dp2odAcF_)&n&e*UCgl#^Fe`&8I_Vm zN?{}IN7OjOmFF654Ck-xFr20&sb)M)S?qV{bQF_WhSr9~K?ejRiS`yY!&=L0Z*4K? z#(e$Tml#hohSQW-NhZ^b(KL1Q_>G%2)#)mhd_R8_sT!k!t@{QgZr$+LTA9+u*5=OJ z#=ItO1E|)tkn>?&YU^3OZuVI<%B?nk?7k>YL<^zbaNDAKzOW6#sb%DNG3GM_YLhr?y8bwlV5AQ@ z-0j--n7whz?l>uleG3dHssG#tgkXC(tL-kZ9!H&yVqwtX+V&VJ1m`dB`k}o!Nvbi{ zAf?-!B7n0Ox9P?au~I>@C|rAc1zQxdW*94lp1p;_zX8-TCk;Uw*38=gYfLS6ZK|Nm zzBE;3S#$5cvrLm_8A+OxW;uD5lV_UDFLyP?rjp>x3H<78k2+acMJqg6-H7`FZ9_QN zt6Tt4lIxb{8X#fA1V_w)w@!r0FysthvQ74M)1rcC;ZcQ>M1ETdS_Vm$;P}C1&YW1~ zmGhh2*cm&)vr-sq%i4Uw-*)2&tsQXFET`Xzc>ICG2q4jhH!tpR=EQ30IX`gkI-mdQ zn>_pEJ&eW)S2l;-cYKwacvw))?z zgCc}zU_s1nB@wdm?-oxinxGW4J)`y>hy>7%b$+^5SWR~PS{m3zd5Oh0=bC-Adu06LX~3SdI+)q zD0{JgQL*T0pIh$cbqdnOr?IjSt1=N*Ucod=bE3#mPorsuF_yKZ9*5RyMPn)e03ZNK zL_t&req>MVYW~{N@5G*&aplt&Ub)KIi`zVS@&ISw+UD4yMYe}C&R^YOb9c(Aqsv^| z8ne34;|HET&3E3oL9Y`brJS>-;hG<5=VwRU+M@b)5u~W8rR7V*i5G7Sxv?{4G)+-L zl533+kZD6Vc0|4qRSaF6zk=-;O*00)4i~Qv0oXk^L-FH;x(jYV)V zG!;d4VMr6`m3I&&9XKE3)`x%GoGp;TB~qET2qQ5KQT#N?h?VlK&I$xXk@AC@U2Gaj zNgPXu13$iJn&yngPE6hPv!n!qG}C@`Wry)JEsc=xXt4J(#6XFG_@qkKea(Ki2(FXDhg};XDk+M5Nw301;+LG);9P6vA+PT zS=JYAI=w;_C7n_!Rt6DOJgSg_ekY<6EBf82OoF>n#4OEN9CSE;b(gi}K2JVyh{-I+ zSW7Q<_52Ih_IT~BP2yPb=zWLEbAR#L9+8qf@xWn{OtUvmc=6S1jXe&2K7YZTs&Lty zPcAcYQz|uTx|1@QB3wWg&c7Eeot$CW)NO^Er5V#%=D;~kn9ZDP&%LV0ReeM`cD?S- zWo;9jC@UGFl$W*b8x^9mdad`(g#rQ^E?(@Dy*I6+sL@nmS)gh-6HQPDZv1wJFE?qj zX2GTwB-mmIv!|z&ss z2|ZPFqaLU_s;pI!Opd21o4ZqzEGJfqTx$@5y-~tsnjw4>-pl7V>2)Hu_NKo5-LNp| z5XX{Pnsf2mF4hXPF-#IyBzXPOHj#9rN|h2QB(^*j)wt5S83~q&q<2dA8y8awzppgp zQcZ(iaD!nr(L)~JJa&>#E}FcSm-$m z>$*(A;zZWP7ld_$E&}x(4Dyb7R8u5VwpQ|Ls`}I1FqtL}ph?0sNRG78mF_*sP+Jm`SWe8Avc?oR3VA_RiPK?h?kn>!PZt}l{n!_Fw- z`1&G~B%|Mr*c-c2?UD5XTYEFkU)go@1cF+X)v|rT$<26FTg0d$kiAin^trZ7rYWQG zl-VpP>7^{!KEX02c!am0vH`*pxS@sf?Ge?#>n?xa#Hb1KFsqk!GQJRqRBaTMC6z(@ z#eCM?2my-kVOvQ4P%qHp!UbZkQ^f95glZNeN-auIiVa<8F|;g_0vk#16@82MlI4co(TpeVKg^Atu`7+n zipw{KbYjOMC?z>@aH(w1*4omE6!#umAtzzPI1Sn@mnTpCGMnCaIobDj5e z;ca2lWG!hDqD9ptXdOD+7G|`C17Xj)XsM9hvQwxg_iQrzq9INR3bev2r?f=`u3t$> zCsxFH z!1*h?^g3=yg(c{^FqXHj?Sc@lXk#4RWrL0eYebEfyAAb}YqHbYFPHG*Rr6G6|pOX+eqC6NyvQ`SN#0%XpK*c73`vsy+fTdmCZ1sVZEKI$XnCUU5k1L zB@IhmcfrjvZ2diIac7Wx*(Q6@mfhc6f?EHF4U)8$WpqMHB3}uTs9IoqeS6I2&V; zSi|H;v}N+tD^vy5wYbnFQj)!q8zS3@BbF9=497{(22z1ih60s_^^_7D^d z8gXjjDQE#|@tv%(4Z2HUZ6K`-P~Q}5w8&BBYUIU+MH#F(4y#)Z$b}blR@cq!Z(Kye z0nncnthL0k3id6FeS{{}tJt82-_{-;tZ71!-?8gAmNauxxzTvaY?_c}8MB$IItZ-a zI!y&U!CWm}Ac90H43a}DR_$JGi%IJ-XtCM4N?qnSRb1)t6HndClMf!}fBnO6aQWH} zAAjmze)3a~^56aQFEAP>2r0_?ccr#+*1q703($Ath^HU92WZd-Z*M7@t*l!&ZX!2-H1RHRixrONt-@8L?`qGX8#EvrRKxu5S27U~YOehX=) z*&R*EW(jGUFiV{76YnC5Bt-`FQDvDLF{PN#=u2=G)su}{ zSX&-ojpfG9h$Pj-kwRHlL+^HC4y-JIwQTK;$#P4t6VdCs_^j8B8BY>2t;>Ti1^n$# zKf$53MP_Nnm5oFE@t0mIbrFk$F2DGhr@V&}?2V@UzhC@TIcRME0M^dYt3nEw3`sD; zHVLqn>X&V8S1#|h^Snc7O&c;;sF2W=U)WiN1uI|V~3Wxd}9}-B+Cmuw)Unx_u`uzKCsBo z|L9YE^;_q-dSlP^8#S8#tY~TYD`P@8VnGT733UGfXIA$%28C#h{& z_E=bJDXMt3b=9Z)pSB_>dE5%9o^)O4N)(1!l9x0?4WNNF3thGh_)i&vSI%ee75FNb zK4*R9e3`VKG!>7V=UAt+ls7JI^4OVU{Ln`pU_42!;W)08+?$bw@FM_$+qyt4qCOAT<2_OOYva80T(r(S}M^?*asC# zLIaS8`sFbEkXHF5`!;2MLP9JlyDyb&Si}IJ)z)dstJ~8Vwh(?(m_9?%|`4o#OM)z2e*`POX0N`VReG#K!iBqwCA;45w`E zjM3Ke#c!TvWueExwM8Di{}>mq@0KE+wdDb6mUHg%COg9^pLzCSj;t?nV`s={lJM&J z8yI7`@1AwKapb1q2{0IhSKSvSTqy)f3crZKve@hK!_Rzxm8Bk^|LQAbxuz3ERlUC! z2)5L#3YkG*1WeIXcvB&_ttCax1=_`Qd{2+pvLajROMC()L^WWeboGJtG!Q z3HKgfciTrsGk*LNkFdVF$QS?eHL_eY=*F%mevU#FwW3xy55R5Qb3IE2OX9sE4bIoL zG+NgLNTDpTnCl?xf||lQ&PA}+*2K{^9I_#8IkvR4z!q1WxYH7UqF{2*Ez{^I$wT)MW6lCnXiiiU8dKAfuGjX1E}W0Gigy->Y+ za-Acs5niJ1vcpnu8B>OXWQ474JPa?Kusy0SW)i5d6kq&Kh?9gH3D;rD=BIgHj+*hF-vl<<`G_)kuaVm zF4R!c(LkOGilks?IAw1pKV_R+6oq5ntUNdFh-YRt~_|Hus36WMg~8=Jp6I z#E~l1@o!z-;{4UE(()@Q`P#SMEa|MPo4d|~NtdzDl8kN~wbcJbbHGo%&L1h?E^Ub; z<+?R!Z=NeHTVSOtB0h{c>J(Ew9<9?=l|>DbC|f7_ofg*3qqIn@P50sLEK{sZ3 zv5Sgi)gd56O`ezMmMqV!Ar#WJSHv!WpVO}vac4+%R^6SAFtHp#FUWJ_-cRfD_!Zlk z>!NKDIO|X};Qk)@_m7kdKV)c;+f-OB1)pY}tTr3BIgljyU(p6_gM_P6^V?F=S6Wox zN~MLoX~y3I)FLi*bW}0Ux=AxNV@O%Xr6M5vD*!sn*^G0WF22h0=K;!mtn1&SjjQc- zV?Oio2l(U%@7?!{=h|@b+Ac4?dWknLZj$MoUab6V&jPTPB$a&nBM*4djibKKp1($C zQI&4FC_K#4oXy>omBj^=5@?HS&qxza9$hYDx+K%w*q*w{c7dmoQda-=fa}DvCi<9@ z2?hlSfpu*qN}{9_MhBfe`{z6OgJI9pPtZHa|jkR^a`l^-#W2j*kwcWKY4!-rw zn0AXAY_lk1!#2RmdGN_Vo+X>fQ3>XGno8~`Vrfan>Tzm4WGKRfuvA*tfBG-3B=;U) z;%S3hq?a6Dd5Y@AyLMlESj2S?|9Q z0=D-iZ0=5c6PsjhxzF-Kue_js^kWaAl;nk%-(uNYFoAHfRB%f?7aB!Ao(wMTV#j@w z<_vnVdwiNZ>78<87K@7{&2?4wl#*Uo((A@^XXCyT2YB|0Q|yjreEEepxpHHh!)twn zkoCqy|2ZP%EVGh^SV@eyiRxwU&VqWH=R<48*90v|!94U@OFh++IYMjdmn%CfT)dvV zdy87|nT2pg{3UA`OwN5|NV>7t}Ir1N^$3U)Ut$0!%8v_ z2-;%R{Xi<4t~_{5tF;c81R022#5{c^11?s|#-c5M+uobdiv@A)EWwo<+idKNSnPMX z|Kxf(8vUVr4|DeX6}tTxD+DHQKR(J2dMJh0jU=jG@sp*sMYx`#=I5KtQvU3@mpQaD zD1|q@UWX?iJi$>fMixTwgCD-1^Ov{Cb4|As)yRJ#+|)kh>(wrqf}4k@p`@vj|J7Aa zVy-+Iu7@w?#Fj#nk|Ql*(c&@gKIu23SU-7M3UQ~&RKQ!-z!-q0%|(m(OkB3cnDuy5 z2JXBSr27>bMBNe-JYGprEIe*lK~V~)l@zQk^_XRv^H;XG|KxfZSFbGfeUjtI*t}(8 zpOQ|T9QlN^sGdbiI%QUK*t*2GhY0`t`O}hQnlwpS>@St`oQA^@fBDi|eDXv0v$EJL z!TR_E$9egUi<~~T>SoynV(&PTWs(^yiLPl+#GE$3Z^5W_71rH-#g{rgNTqzD97G~Y z4^iLiQ0*b8{ZQb^5J(ZRVS4(f!p1m8lEiyV|EIY#~TDu;3RkSC^(vKW6jZE5>k1@uU>ZZ2r zp%X{+yD`=pgpl-mF&n!xu5AukS?rZ3b9u3cHV`X?7B2j zo9mkW@UjuJhQlEQP13&!(t_A;vIUKvt3b3;v$#T(v*PP5Hhz@32hYwhC5mDmd+=!G zzJy?wW-cKSe&tTXI<7AFdG@I@%u?4TocSz0%biwfW!d%3*EOOAlVJA`5sL6ZNiSA* z#vziToVOLeo-5Z1q^{yq%4Dh-$s-$KP{X3yWt-UD*$@fx^wU?0oefo~RF;n`K92Muk+I^o7SOf2{$`3; zYfhtXEk%n~fH}33s10yvZ7Hb@ZJ2Lo7LBI6X6d!G&D1qiJNt3PbM zgk4xv*WD!i2({{<$)YT7@4}+iE6cau0Nfm{QwM!xG)*vlPXv=0!f>Hd_1oHGswTUN zm!;XI8iWYp#Z!{bL90?Rz9`Eze|`1}&%bn@qX(T5s*;`6Nyyw7Hg_iVkR<30>qZg% zUfk%t^6t3M_saR{%8UIjzxUfeLXzcVnVXiqw9qYgG8M0PeQU(Ut6Tiw2k-GaYlHS4 ziZzi2B^6eg8Vx3zCC?gxPi=mKv7+2_Wy=iReFxV*;@;bh(-)<($^@ld;lmaYoP%;8 zoCw-q#9iz{ZRu6Gjhj16rWgicK?;K<^8Gymg>8LR(Gqa9PZ(*G4Mk&&Bq6}(KjHZ+ zJM0Xnr94qeNtSCiwnv=5vdwgwaO~hhxgN39eKuZfYj?uG_}AZ{6FCwe-{7c(B*`@Q z99iSXKk=}mj)JUT`f)deJaLOR>UCmzo%#EdG-qRH%oo3LmJdIC6d@!*|&QUY=} z(L@qV^Ml41QBkv&){4O8+cJ)HeNash`r$C10g%FCj3|fOh1SxF$`6U4AFVJN!rmUn zqIn}4WQHPGUe)qsZ50NIFp5V8-(n{}z^*;WqrJZ(!t&S2M_3ly2qaTheGA1rMIxF4 zUc|no&wc!?uhcO2`o-=4``T+4S3NKA)= zJJ&f8y~R$x#=o8YEID02T{x~bxQVK-M(l&k^6qk;*!*0^+6C3J2yW2paPr8C=NV;H z#q!2e8(SY^S@sjn9}i>PE-oWX(F@}jj=3GOVn6>RM6I2=PWWg1yRW~>$s;R)*1~d10p73s|kzELy6oxV~WI!XE#^W$(Y#xUFs5 zmV%f$nxVKTEVsQVIohv3ChVjYfrtQLYP$4f%BR-9&O@u`$V|kc#WDAYZ644Ukpc!f z;j`U8Ly@yL8xX6Uo}KYh@)WO#k5lvFrJ%fSNsB9Ah(KT)Xd%n-qoveb+~gV!x3d^b zAoLDL@Ytd!>E>-j{#p=oeegG9P;RzKIn##aLCl%s%brws7AjKC>KB_)jNgP;tIko$ zC#8TqtOOQQ8KtPL)2x6e=Db<6&#As=%$);6Fgwb&tRHO*eh$a!o1*(Pq_yq{sD4&u z6H=m$xxQ7#opVg^1h`Um*=bO0~e*U5rvbjtS=48{xMwgOs+UKnOc1gDkajHO|%9diQyIcVtax8SKInK^$fG zul3vDwF(DUo*dEM*=%91kEqRa7@xqXQdBO;a#K#2k-;h-<2S#QE5*zDdJuQk$adS9 zZ9Bgmyx6l)t>dizZc3Uez=)ZDoDH^t+mf^A^i4lY&CqtfTyTD&+I3LYi$FI=gx^K7Y^^UbISN@O}p8Fb|ULPSN zq>9|Q?I_~VqT=L(2@8Eq6bp=$P%7O;o$JsNYjoL-TEv4Lp*g88lTJYnB|`O(G7A*; zRkev=SZ{M_L-_Xsq!x=2Zphp9tr1r?h8W{UDUOrW?``#DxNnD$4X|2U3~Ovp1C&oJ ziW6J#w$lGwwOR6DiLemuU@hsgqPfz4XN#wTM3CeO8%*DJYdDK3g-QvGHGbKe*QI0ClmPl8V038lVL_t)DvYKUtKo}Qv zHYdxtV`_Zn?Z!Gv;kJ1fgV1V9CR6n;+0c4gTS@U6ait3*ob@XQ{Fd5McW&b-0wKur zoB`k*ALH3{%49lWHk&b<%@~h{?Cx%}y}iY7cbDO4kKx`fd%N2tvk4!#?_QpG{IS~u zYSHFfg;1tUW)dxV{kq`HNkJkc2<1SkBvwg;l=WVqT)TbjUTT)a$G8yv9QTa=4`ME% zu>8WK7kK9ITl~kLTj$N)4v`E72p3nU)#X7eE>G8=rI0d0DTRt+R1~3<^8k@jL~%?M zb%;A1y4@b#ZkMRjqu1>bcl&fZT{<22`#3Hh=Ps5`r%R{Xr4z>-JJ4lod)tlU%ng|~ ztSofUIxk&TLE^_saCLKsfA$AoaWt5eWVuU{+yXa?l}_yP`db@JW*Oa%a#Nqv+)dT< zP4uP3B-Bf|@TXXBE?f3u*@D5)Zl`TI#y|jCPYfzS=KMT#yJrOu-#ktP@;oEY^K$sG4LGV2@R-uQ)t583t!k`Xvr-DBBH}16 zLEq^*AiE2||2uZS8w`331_S!N9=%?ley>ZWJG}JL72-H1iXv2`h%H>XxaG$;I*)K< zeTm)OU4J57?^?0{Dr}mpgzK^#w^V5zTqstqd^g6gPs-7`8_`s-H(G0wBw;ifF&d8; z4abbfBlh-o+1c42el<|t{E^R zn`BHTquNf`+5!$6bi4YWg5Gh}DdjytL=;8DQADI-ROCE>lFHrR>Clb4bbDR8y&k>d zqUaSCKc*9RN{`U--k}qB==HkvdmSc|DZ|m2(Rjq(-X42*SMmD<&CX~KmMzjU;RN- zE>xnlt)kZz$6H3xaVNb z?|x#;rESR<&iCm=+}*9wn_e8J0xaQ`Ubr;3+eB>3%KT;YjvtJ)Jt zt8BdBdtF>u4Ui}{C5pLKDRmvGF@|HujXYb3h7iaMm?em?hk&7%)Q zT)HvfuU<9$>QDE$@8|~4y>Nw?9e(qNxB00@z71qW;}J;7@dNPqu`HO!`8K|=5Ex_V zce{M@1=7sN$ai3gn%h5`n^f);K;agV{eUF|Z_5b$P2O(Vry48x!W%vQr!RGhg>j^v zwR8qY`PTL)`A7e3h0lHc!ys3v0i?4t4o4o$!n{JDBmX*&Nja|knJk63MN%`7Il5*nsaUOa2VSehfpXKlT$}jQQ zV~_Hizy50+KYpwPYw=o6^^{^-80|I?H!qgAbFseHZt~_Q-BVM!;Qj*{MjNo2?d%l) z^0lAg+|E&c<;U;i55I7ox2_p}>1UqifBTou@zU85UwrN&(kAqyEuJ{>9S#jHV6;YC zS(aN|Wkv9%*E{@+Z}!pVyK{i!IOhH{XZ#9w!-b2NSQrdAcI+5WJ^3W#(TF$Coo8)j zgr`De1 z=RUp4|MG_!KmXA;_)mZ1AutiY`Pm_-R-Y%&B5Xbd8*I!dh<~q0k0O}n(o;rn{{$Fg z_}72*$9(C_U*^!kb;FNS%nb$ue(JM7!3UpulIe8H!eGEtPd>?@ z*JC`H@K68oKVs1Dm+`OG8l@Du2XvNYBuPT)UbtN?0z9I{fNCKg4sdNMbOD;l(#&e)c2V?Cox_G5r9~9{*ST+>?LAkQiV}?)O zm*OUgzx_nYTFbTT*Ew|XAa9&I$MY|~$nXA#f0zH~5C4c~KlTh?`RZ3WaNqzx_L(2y zjdSPt)6ajN%a<;3`kqt#^3VSQ(*KmT(+_kaBXCr_PZ zV{?nm%`Jow96fS`&8;oYoVkyWeE7q>aqdlKvl&1BnI9$BhNnODK^B)5`K{mh4emK{ zf)9V_X-=Iy$q)a~r}^oh{48q+*7*3xKE_i|KE;C%K1i?E<-~~-{N```I{)M!{?~l^ z2R_9QeCm_@C;!p!@(=&Zf50a`{&B}zya!$UZ3DGMcTV*Gw|8c-ah=xz{_Zw+nSF+f zBvRJC*xD>vwqnU{7Nkv@v_XqD1)89F=}S}eB?bD>qG*BktuIB8rUsh!A!u4OFF~Ee zsba-V+9Y=4$Z=q6wp1zW;qZ&qGyJo_qEr-+bx6IDGgJrE-xoXI|m0a~DvR45!bW;l*!#n-j;6vt#=< z#>U6_#)~iV@sIr)tyY`A{+qvLeEbH6uJhBgXL;wHcgW}R{QmEKn*V(9TU>ePD%&61 z#=bqf*}Q2Jr(Zt9r7KtBk)8J~s6h_Q9o6GF!PMmnHm+lHyXN6L;4I$aw~v~9WPc06 z6Od+qfY6youwAfSJlnyy9el?@a2$jLtkGH&e3~Yl9anI?C`#PFZ;3iTKhIbH^=tgg zSHH^q!UAudJJ0Et&!A}+&v5JJO}_Kp@1m+IuIFJG2EX;G-$WDy>h(HL9XrbNr%v+f|Gmbmuf0ZAH@JA= zBBfH1O#}Vx*}WT8$#CevLH6z4%hi!<{NR6o#MYr9`YIJ1$EI4TpePFa_wVKWg$r~{ zlOsnC(`+^|EfYnNId|a#*=&xNPM_wjx6d&@KY!O;p^s8a#;mT@+aV`kEGr7TckSZD z)5ie;%eJsBI|lae-x}ih^a6kS>=?zONU8ZcW$Sf3S;Ld%z`5$%;D%%W;_{Im!SezW zzzfWQ$ytwD!>2#zaD7&ZFJG$@Jv{=F^eH-_YK%+)DI6O9?wRj}1tuhJ-TLof!n90= zFMjFE2m)lYS^n)mz7F9Sv=m162;r=F7cX7r(v>TCj?2tUou9q=Chc|y!!Y>i**7?H z_z;%uP@kLQ+=UAWz;tbzx6hsDxs%Uw^4SwiOiZx2w8ViYp1`s!-adDpd@heH${aj! z07KI$mrCs2vzzf7H<-9Rfu?E9%*=#CrQ$;kVXx=5tkQHi`JU)FK@Hh1ll8{W)^%Oq z^E}$^Hmz2RY&J_Klfg7CY$q__9mk>5F=@6tbY@1_KJu63l^Mt=h>8q~97j_5vVb5; zVd2k2q(mH4;(_bpS}yw?{@Mkbh6U(yD4Fg4%1J{)6l2KKB&%@AlOv}P?U5bSQ zhG8%}JBwvmY~QvG+qStiF+qP{AJ3mU#l_2)xODjn0|WhR+xi$6E?%T#nmvDy=Xnec z3{an&!*$&U4&h4obJ>)U;b>rVuOjV?AfT!$xonnPE{mpWXqtwh>*NicojbO(XU`sX z?AXEJ;2?!UflMY745}nSZ8n?a^Let_9%H#~i_Vpoa2G~k;w5Br6fzl*m1O}cek4(o z5mmk)PTZ>Ec1$kh|AMx*6US^}Sth0#E|!HAF42C+H0iWEn4JzCD*(c_1E@P4lTN2Y zyOTI?TG);g+^ocm&&gT!mPZ~%=^Wy!&hxc^A4!d6(f8cRM{>QO{7)pYBbSvVNkP3- z%R*6Z$04SLZ`COKAxk9;AB5N2F z3I!_V5`{v6Y&J`=P@q&Qk{{8#Af-0}wKNqHcNCw*DpT@N< z+Kn;Hv1L4w;c!D3M8>MTCFHXvQ5XdLdZL`TfzBut3|8Rrqc-~ zC$?-W4sQ$oV18U0C@EPZz=QhxVk~8aL_MsuB_@d?$x?g4n0t6mlF&mpRrLNrl+uH7 z=ywA>X*YUa5N&1I!F?1(0aeq`HH~aGOD>zGTrM*>&`+sUBA3lksgxP$??X3?Ktks7 zb|Q_#95Fj(7IY@LN;3+GbR_ zfhQ?=wuPjKcuEnk@=5&GEriljD8s*+3Lp_yy_s?tanw`V_h@%IhM`H}x?u>Mi{rR) z7@XqGlX}3GH!*!tIO*$QmR=Y*3*`(2I(QGzpwwknBZQ7l70J~*j zS!Q6;guYP6cEWhpuwJSZ#Mera6jrj9mPz)cg!k_uE+GkGGP27GHInCgsJcd_Sfbij zrCKgiDwo-`X^^4Kn<*BG7+IZCu|%m@B$H84RTV=w$fy})Nk&yO%l=I3ipy}_Re#sI z-Z{QmA+~b=K?Fe{11#0fAy@aH4jiWWgU=&+E##;E9Q)R3e9uQe@C8IA7dZPPHQ1x) z`kR09m(y zm*vZyWWZ!hYhb5(p`>@QtU#JKn@tuLm%^CSB^H;K@O>9WRwxwm3=Ivjb?amFRV(p? z7DCt=6~d&=^+tfDqqfq(z2{+my~bAW$_kb;@k0@{3K^{u3>_-QyZ$2{iDB$@cp>ih zK1Cg|Zg%KuuA{X;m-eVE_ldIZ7~OXd)HTKyq`&C<5z=3THb|?{mB2|K?*&?5&IFQP z6vf!1&@oMFwHosa3y6Y1KA*?+JofC`^$2smk~sf`S}HOO+}JqrlzME= zsVTAquBri^7$OsM@N~NnZfgX+U+*Fu3=d=jb@X>hYoV~ zjW=kw+my>CcJ0`KVdyL@E>f*lkwlTn$tkvO9o_(SqpiQ$j>FZF5w4GpG0@k??943n z`FTpkBArf~sp%S(a+&`AK5kD=Q7M-xmr6`cPgBU}sZ=ZYp3m^`5am({%d)6et7xi* zVd$8q8O)cZY4_Fp-vIUf-h3ZX5K$BvNtWrD9q@gM#RAo8g@uJh_V3$^@B0i74U@}e zDV0hrE-jMJ=YtWV5U6sgbl2M(hVia?UN%5|pEOC5*tK&f2M-*;^#b3jV>=8C4$y2g zsgz6X+_CeH1h#BMNuPB1D3m{1nn>TN|>zru? z!ACQ*bxg}<-<~~O9T{O^agoD^4pOVlFgL%z_>CJpf9e$f^TQt^%QDZMJb6#wqnH16 z1JsSq6rSfXK7NC@&!4AUE(1Q#96!#FUwxHEqsf*noB7F4e#+36Elf|>7`c9(!GQrD z+d9mZt5?~-Zy&DfGBY#F{KEX2KwT*eGumE{zjy=G_eryCn_CmNux*=0V~NXGt}t@# z8ng8|1_uV1nVID`KKTg@U8h>DGB-cZ?a3)d$HusL=`x0{GdDlaiKm~YTrS~x-m)Rp zZqP-4klM@)j^i-2WeaED_!*N^Q+)IzA70k++5mN<1<(Mt?U2joICwM#z-(qOX7M_0U z7(e{+kLjycal)|6vGH-5?KY~au3w@)%Bc+-ZEfm*XlM(CFy8pYiD$@VvwZ54pICOC zC<+t{g}Bg06sYdH9)c)fTUJn|(6;HACZ6juzp#L5S^VVn*E#m&F+@?|(18O?*J?ou zk8V(_&G7iX{TPP9@bEDDIw0*TQQwOIgN^pyccwC#47jb2xpsY&Z-3`Bs;V;3Uj=*?7Z*`7 z8TRhpLq4Bl$hPr458H9rv}uq^xlAdnb07!;!$WswOw46-U0F$HSgZ;v1mnE*dYyK= zO}pKW$9fe-2}&DgGI4BYw6AFznM`H_?uWQJj>FsM&vW78C5DEEn3|g6z~hf|?fNMB zLY}R|!wmHG2UVj1S&|tY8>dpKaI8>3*EJMb;jMG$_|UIBPazCG$>+LfXyo&E1DReY zYp5oimy^;|k|Y)u7Px);HWL#QOixdyD!Q)6%l*K8udjVSwkUOG*UlXrJ#vIM-uyW`c5KIXY;;{`|K7cn zN+qsczmDhmzX9R5BIz&E~U)Qr)Y29cvf;fXl13?ht#L{$z1Av^Q zT2U0T*(`m1eTbq+E|+6zX(^5>k5V~Y*Ntj%jGZ(W8Hzi8!dRgyLav+o6S;K zQ&qIEHde2Y!1S}J*XzvA&eCW!n4FwsW+tdU(`+`eEGx(;kY!4x5{6+cgEck_JkRqZ zSA%WabUGbctuX(m*`(9y#EEo~dm&11=(X;(cyX?hvn+}|lGN!Oq3Brpd?u5@Fbwkf zddY^RrYyB${zN#`-Gq>fZoC7aDsC=}w<@W{rFpf47S(rx_m~XLfcr?i8;DKv|Z%0vR2TfR2tuaHkp#uIn;BKF-C97pd3lOifL3^X5&O z&1S5E(;l2|P_85yBLI`@B#6mflWE$8O%6m4Hlkf|FjGZY7kG+p&G^uYo}S9%l`? z-|Kow`jsU6dLZw0d?mnFvcG#t?Dg2=y*ird>myi`P$!E{B)uk?jEbseVmPBE0<)W% z?j{-2OE(y!&Qu!6UT&0Yl} z$#m%k^h(lvCD?myug6@8V2Geg+LTE!SCWiLTQMya*9v2=b8Aij^dIs1+V3UYYkA#T z0Ph9$YH)Y+xUA$=NrD=I*3E|OHs@70DY+VS_u~%xr3dv4*b`Pxa00JH~cqCI#qi;`OE`PfYU*@ zn+Fy;U3A2#4^amJU)yQ3arm`Hn{O zeqrnn?kX`Lq0TQ@E(W+cqqJaj#J7t2qXBJC#e8AXfQiD1`P_RSGD#oq-*;+2G;lOG zbnZb;43jusJkKFqRR-Ei9c(DkPtb$z+WE#8e-b+T5-1%+wg6*EHjdQ79W%$XQ-rnn zZ^;5I0R;L<^L*G3KR^OF>63MZx=Tz4l8i)WdApiB$Ry0gUZlcuTYu>|$V|40S9i8L z#EQw9>qz_&;OD}0W)FD6TK$3SO^eoGDbJwZ6Znnt4kKb)USfQ)L129G+5vsy`VDZ5 za`Fk;UxdK%(8`$(sRVnZGMCeB97Uf=qM`n3$*s%Xbw%FJI-QQwyy<+rAT3gaGO|gA zjiV1%Kop8k5wgWgWQ)pRqk0NzU8Zy@6GeVOV}ey1zzOxl87Vw3*s#ntP$sD52Kj+_ zjHxIAuy03|9wVN5k=AJ!j2xIkUgN1K(2jCq^WRv&|BT6nHv92_h;8_|tm{S};6u@| zguKK#p?j9q$vhqM?$OZY;Z#T=lmza+1S|wfXWQRw99y1u)T1mSjimLdVxKQ~1`{b@ z2gMM3)f(CP<%@$`YEJ5jO^g7f%(uWJ>MA$#^nvM&HRf-8q*~R1Yo34wq|ELAT7sz0 z{;#Dq@!}9OR`V-9&%^&Nfz_do;tr&!&L}rW))v2Bhy$1AS=MtO0M4gU~^`$`wmCxuj_*60K+d84GFiwu<_#VbkC5 zf&;<@+vWpv%}x~o4q|kpMcmbNS=ape47``=RNBa~Edk4ztN1d@!Ed&aXtH`X5*>?# z1-Hy<^BoenlT&xP2P;5k^KorPXP`6~G82!~>kE_!LNw<-@i6hWwd}hZh%R$FRSt$T zSpWy}>X%#ei&28JGNOt9xha;j#`T5W-Mc>zfEr$HqagYZe6K({bb`*=U$(S9b%bc1 z-EWQv<&c-e4~PXC?45k;kU)?^ckNu^S*w~v`r3bnL<_+G?#MlQj6sy)LP4XCgr+;% zHCF)Pp$vouV82q2{vq*$#!F@~N-}iW;2%SU)#&P2m)LCm&NA9}bBQU-d1zDol^43J z=M|aL&#%{Sx`tg>&{TEK+!+;PtLi;v#Cm3kFZ*2myKM|7lUk@d+6q$5?mQns1O%5C zjjrf8N6SR1<(p-)-!z;}5IF-LpZ}Vf;2ZdG6)J1%37IQTQ zP3zM5Ys8B#PmusD_p8-!6{vxB8j79P&wCCwJ0x>3I=I=`M0jd5SyJ6M<%o{wDdY_g z@rwb_u|wuTHqy-+?j=n&qJwyZHjIGsxvUK=%v*5K{U`w{sw*&sx04K`>o>@v0smD= zNla{Y?CU`47KxtMKwB_f@BZ>S2%Y2A@G6m1YW`h4(Dn>-u7v>;^HvBos0rW%&eRE8 zbR9t>5BHW%%cyjb-<_fY1KZ+eI0B3Cy}Au${n1ahkdDfTw6g&*x))N8BvKE|0V^nf zWqDp+JtroqC)&`Q!K6F#tGOuk{NwlWv6KNTkdzFVl~J$Nixu@2vH&t8XO-zZucZcH_xiMd;>le#Mr z0#dIht%b2fuh115^!>>mKon!u9iT-z&(Y+(B2uMpz`fu^$boH``iua-@8)wqa_nqx zwjj6cBQ$42y2DTp?}>`Ly?`?VsC%J1DtyqvKTds%lzOm-+?X1!=zP2E9G6!$gUTmSfa zIESF;;ecCp2D?N|`tQO6W`Lau9{D)P*i{$&(osARYH~9tu~J>pv}v1BLP*p2eN~oC z7(GXEarId;e_G?(ReB>ckA-BI^8xYH0h&{qza0{ryLPVL-d|@hyoi6=Ga@67?Zc1E zPGiQftO%;sn=3oDrLk%6Tkn-mx;OEA*Qe6h&hWlME~popk${w2_V5}bnO3eh-D~+( zyip<1DjWBMufInQ4`~Rz{_}5N+zw%E_&lFy7CrTTlUELQK)=(muixD9(`A<>ZM)6Q zkB#I+YDVq5Sc9%fe{|9f z@mtE2n3)P=$Z6Ys^bor=ypuZ?v))}QqA~K*_!9@?LqVY7WQ;0eVh-9Oa`!-+{h1zG z*GrY?AmRoH4|S@MM##r{6nH=xo_@(-jlSdH|(z&~cBM!$)?vZP$lx`v?U z{H3BHk)jgu_r5Rm61=}X9VI4eJ#An9l3+2Xo=7^+`>hTHbA@@k_H{~nO$d%!@(-Zm z1Le?8Fq$*L3&)hX5!1PD)ev=tP>mqz60gBtcn8d0(%@iHy zd?c6Ox?TgzgsW3zQH%h^!Tn-AsttO@D-0^#t8A#fn8Ae_eIF2;-`U(6&BhMiyoaVB7O_~Ae+`tIX7MsxMpEXdg7`u2#E zzb>PK#UC?a;7TWjESlI|^=uoYnMifG{R}KpSg?>pim>nnSE1Rtrs8q$?{Y$6Xmkwe zAI^gaZ6%ID#xoT}*yK2pkG@9hf8<>Am^ned!+L4wIGG6@8}h}!UNRo+HJ|ZGeZ$mP zJ$@YmD{9?)ujcaO)xoNHSPNfjd4FMj98hpMnIcq&onI&f#+%xH=VsNo3Q~mx+YI-K zv}FzVjB8PDg}U1~ym;x%o-jh@m6!LUZQ1I*+S@mtsddxa6fG{qnAVEuo6oPr+HNv? zUGqXg2`p5bcb*a7WiHZ)qkGK`O8>^BKl&qEfFE}$D)-P$As}>+OJ{zw)$2G9 z&gadpbciCfEjw*p$bRbcm1tW(Z=O`++sx|xj4q>S2rRD85n?;4r_%Gsbx>QVf_qy^ zO81{BiOlUcw~F9kp+m6)aK4U()NzTN82;+Tnh=PUWi*9-ZL`1?)9j2gKS-C|Z~~DT zrm$N7BiJK~owwPihNnl1=~gy?;`!*hC1r&k!y_lTZ%1>olMs7lqaFl?ZHJ>X2fTpI zf4YsqzJCq)n~ta`jB>kf*xQG_0~f(uP+j4V^3ZaQIpudUOwE30bw#C@*zr z|4A9n8&lr+na;~;AWnFy3lbeIeoL3BB$Fo_UROSzGcg{>293`rTa3L%K$3q3{QM#iqK6o$YHan|~h_GSO zTcY)58{`z{9E|F22=9oB%1HDke&TO~*9}L>FDpHb$7j7{0SZPngAZgdEp#TP`(pOap$D`YPRB@kAd z!B92;5LR60BsY`ueB6}KT`9D}W?XutfNNc8pVD-jmO4VS!4 zD1VZ?fSBkH_MPo>$6ad7E39|=`Y@Y67(K6&NjVKaym)}kni3)OBvk3m?0ga#8^r^BU(K{>c^m;-O!CQ8t zs)P3C&4yIIq6jWBz|zqEuA!wBqR2$4TjL?s@=HnVkpcXaE#kQD=K%7teD`6~{Ct`T z^DEz98rA%2iO@qaHXh8D-PFjOX#t;yha0yXjSOoZuG1YX6Cvo_ zv-tG4zv^P*#07gYIg7z3o96}<=HkKhsM55*r$Kfm_I;d6o|lDYHTbnbu2kvRZ4)O+ zfxPI2AfK|_=bbZ{%Ddk)E9~X_`AS32BV9kb8fVs;f}}BH%BSo+Rx55Wh%#kxF$aW0 zEK+qSQqI}s+oMeNz`%b#{SQ5zKw z8unwYiZnbAns8zUs=Kf-l^227DPhDI@)EjQjY=_@%U}~k@nLt;qX(0Ml1+&+r9uo4 zb7~i0+HUhmU;fUKe(GIa(0VB1b!=-c799JC#| zVgCqLg(SmSUS_#s?XV4PkS)9L0HcocfpXQTGS96!Q{VQ0vz3@Ce;RJg7UH?AM^Yvx zCt@bhvJg3uWBz(aHOuVvGTOUu2!s&!vc-7eRZdmJ{X0_#ole@#G7&|HpyQ+IfBtJ5 z?)v+FYB60e&Ia)}M2SXR5HVu;g_`OrJu4!R8s!Wf0)QDr&&?T5=C*rz?Vu<3VO&2s zIeHG}lERygz)~K(T5s2yN1|$&JrVwXC8-zZ>TvYJ ziU~PDnq)17(JCg|1fei&(O3YcD@jezu{p{_X}y!G?PYH-e0t@^?bw|uO&BK2GmT*? z)K_-|VrZh$u1@}5&;YJ;K=Yb#KZ~+pck@;MW5EzKjcKb+zrkivg{h&io?9fMK~mrC zOGz5&dO1vuHd&rn;=PTfgMKCLC0j6nj$=kDl07W z9L}d0WMf|!_nZHP&!!h=#%Om6K+AYi&5dtr{HtSe&Xp*Z97d6u$O|4}wGgFEE0t!a zvY*rottt98^0AW)@4yYnR||{PpewOTim%!fn_(luzZN7m*V1;frL-t(mM?h!h_#;ZqlI_IQY>u%B73q#=FIdJ>PqL7DKgIb+{dw1 zFz_n#wZEpMqO)2LF|p}?N(*C+F~D=DRG>tKqFaHmL19=EDS^R!Xy#CXorpNC8{u6r zPyFEOK#|~TNbd)_-o8PUBZHY><|I(x3{C7tGHtN1t5v7lrlW$=VYx;m3v2_z?B#mr z!NQ%(^Kk^_e}fNp-}*QtKNcrki4$9oKi4FM0@FEwB4pr~v87(Z$=8J!Hl2`jJ=3yn z%tdFgN;yhkfnKS5d5&yhmSh*lgZuWF6 zZL7;2@MS*pt3%f4rsDhGh7Pt0?U;7`S6Ny&&c6G&Pjrm;Ujn9ILB7*U(P4DwymU1s zz+W~Sb*_e4VM$vqg2|SKp~}C9KCUjDpFqLLXuYvv%!A1QyYbb_{uPPxcaN$|(t~Qy zN)Mb7(t)44-Qe#lv6rH={v1uZXa6wgN7ecn^0kbYwUj{tZ*} zM6sx%RG1=_r}b)knlOsHvYUPQSC()p0W@8mWa=n$OaDGuXk&=-HGthwVUyvmtXxX~ zeMei3gn*|f_vnLI0OQr!qBpU{pKcy7xdB#9fsH_7RtX8d z3>)at+8;s!cL=guP1KY1 z$s1%$OSs;%R49%#rvibbak1&?x;FQukePZ)$g7mwBs5V)>96m6w_#}540!@h`+ZGC zFJ#P^`n`L*Hr?iV?(aLrNh>JW`h( z3v<5l$a&aqgLz%a=~oRbOqJ+V-`?I`$iX&#c~Kev(;iv9bce&=z^#Ef)u%qi#sPDLENq+=mnebnz&nLyf?q z7x6)A7Xj;Wf&Sw4`KuLXbV>M%!lIN!E;fJgaKMf-5p2u~Qh%hSdT{H;17H{$c!i+^ z+d93{=KA4ssGr`%AAZUd(Fj6QcQ{ZOe(qK55uhcH*0Gu$e>KI#T;Bfp#n5BP?WUQ< zW5Q>>s@87itf}eE2NRRg`T2R>w{P*0n|DS=Z-L>xsghr9ZOf)#o_UsX{nszq|Ec6d znK@ALX-j!f#7defl!EfdhA#~%tiTPkb1wiYMbWt#JjOeG{z*Etn49pSw((v#(4FSz zl7E9W7dxYj*%vBgV)HrO>@Z41a+m%y$FR})qPu>*SIBd+23FWSYq&mZ%mQ+1m5~~j z7B$bMW7i<6B#uJg?>PLWF*vsA+bJya4E$_pG}ysKu~XS2rA0((aNusb+$ah;hBq59 zzOD~hbdZ-Ry~tBTQIV0J+S<>L_x9GMv5j?g`)}{=h-3Sd>>Pl<-x?%WmogmDm)VMx z6$dLXh4+5u&rTGo;LKW5ZH0@lVRTcG@0PxhS6nuQf#E#C-8_7dw70M7pIfi8%#xgT zkc@zj{22lpmQmLGsrE6gpC050H80R&@D?I0tdkUaw2vjmD>?0Aqcueu{oK3rR1*-L z1$LY8rGzzIYCP*cgkRF^w&CL3h5b~qw$H`h6m@`&gF}*og9Ayx)cCj=O2zhY8nm{) z-r(ZmBCoJej!u;>jO~r5ib~Yal9Fdpguuf zPEO=pTwJ0$v0?{UShygd`SEt&^&uQ>b5UQC|gawhpLYX34PU zkB_HxhLtgTuJ@uWUTG0(>iG_HP?WN$=n({XeEy8h#+;&wix9S^4-d!0!eV<7YqxUc z_9kok_3PJ^xjlxpADzl)1C z0r+57XOi0c;s;48tdE{fPQQtyPXI=0R&<__)wcDpa78=JpF~Q6_>wW zvqq$64IWdPH~2feETF*guESW5L!7Ib2<*4+y!x7WrpfF=48XmhD{&n+b7jh?8gO=t&ug5SjmE#?C{X5d?cck_2s1tOn&Bhjz<};lX*Do%T zT3TD*Y3YbCkVN#WvOpnlCSn{!HA8~guv^6XX@fg;UyA0fG-=!;P+lm!+C*p@XfT_3SLc5dK6x~AmW(jn*$ zC&9!D1pF>3*)TFP>Z-z(W1o5z6%~cCLy$o%E4szS&plb+PO6 zD|54PK=iWh+&5Eq(m}u*j*Gkj7wW&W;v3iqbsr3Q=^V=iWKE?>o%X4f?Vt?ixVFu9 zXKGr$li6LX&SYraFEGD~fnc5}!e3>AVlaCwK&&u5))?fU3TZDFX)jYT2Lo#i*4>fu zWb{>*u*aal?H!-*z6XPoBFu2({Pyw;p+T~PwL?d(@J^lPAj_xFefA?S z*>P5%viI4V3>!jfVXg?Ii=YG~B_&lVGBF@w$+d7vvtnHifm_1nU=S1{zA%{P1bG)D zq7bt~Xs5Kb)weX$(Ax7g>Q3?x&)4x-TXceLvs0DNjIEF|L@A@skYYH8NXqvkk+zg$ zAXZ_sWW&gCRRl6whr&5!WHAHk942IAJ}9S2c8?8KCGH&`U!}a_(x`LTA)7|LJed{Z zI$rkBmcRrqE@rk8o+RTvyP_EXRD3JxbDJ?rnQU_Jv+Dp%yG_cEZn~n|mv6T%Eze)l znhtvgVCFAUFP>N+PVR?%XHUAS-;)R)qFj}ZqNXh?wG)9?FaHrwyTo|I!Ycn=)PdI}1g1#z_XvlPM?#M#neMC=NA*R!L(;?exI0^}z|b9PAC3 zTJpaJ@I@$$(B`a*G&3mROpcO^lA2Zyqt!HJwH$>m!X8=n0{fp3TtnuIR}mpZFLp%B z5|trv`RY0Qc^B%@E8h`e>tsu%p(^S^`8<6CVyJ3}tK;vLn%2Jx^<~I%VO`rKZr){- z$8y7&fpP@QQjcQgs#S}9>nn*N+V?SiZ%JkxynMG$5C0oow+53+YiqT8%pqoa$rYR` zxbzk*36%wj$(n=2(ju9784yR?5%g6V>|ee)HAK?HahTr{I*|37g2ZgiLDx)J%7Bou zV`|06DfYqrfA2r=)sOr-E-NduKV9!d#_Z4?ubR)h6TkkPJ}etHU(B#%UT`{BB?A)3ZnlAy};B148nW#+scV#Lab~x8q^-rLHeu+hYbN- zC`o3u7_V|`y!}nL%);rik>c{`lTSBI0`swMx6X$T+r%?fVzGv7wL@UJkZ;7J=lRK& zjW7xA3KpPZg%q3&DLR7QZITU%Ry zrl#cDjx&(qfF@b0Q6Rf`kq;rn_-*#$!tPb;c9Fl&N}B7k-GEMA$t6p*=Sjqe;RqJu zw4jE3z14Czwt_DvsL;Ul*W&I3b%xmBvb#ixtDW`pywZLtrNH2LX}n$tRwmY4UcI-= zwwW2ft&U~24rG^G0^8Kb6V515!f? ziAJL9(GTAFn}v;x5^hoGt`&SXT$7!R8UM=*d>6!I`F`=|H(Z=UpI{IdHp}~Ikr|rv zU~P5ZTDoofr`_7)>%Hm>k*uB=DVHs8HN!q(+6!Nagb^#T88_du+Ed>Z)ut75k4*F~ngTG<~)`QUp}anMt>5 z@njmzjd&ZU5LQM8%9eP<)k0TX@Q|bd8wKo*Pp=l;sNR(LeO_ofkNL@_;&ayevTP&M zhvCQt;S0#Kz5bv;uSnHhomo~mp-kYe(DMh@bBy=Ta(x5V*2u#;c#TkO zU(ynRlshsRdKfAX-|Dowm2b?Neavz}n_LDL{$O!_H>$&Uq^Q4fMd;X9`Sp3O|E!G3 zgv`pj@9ED_mV%d)2R1D`J`((i%Fcc<3E-Oc*Fj3P#saahu(UbJCS_#{3k&}&EZ{NZMMmOIE-$N1 zO-S;e8o5Hwm zbL!$f*M5sx6Iou4y4zHaBpFb>WX6zBi6jD0)wY&aiN|K|9D`HyysK+OTikOrnY6;N z{;C3SgizIJrCg4kL91o&(UA2tm*II}Jx!~&G7HQsC|nWytj5X~eou^mFj$IC&CKk` zi_Kb8cI zMuBgdRq5%J(^FHu!aL9h;R?S|0c7y5L6V}6wzi!}%0E6m4Y&KqgjTGlqcbym3J0f) zc?*2`@}(hBQ!%ZwN^fXAQw1SR$hAM{mUMiFWZK!qNP3BcA39LyP~98Fy#E)wpq5C9 zATh>mbz(vjEkLdH-*%Ms^Yddw2`mxLNWz#;VZmohI>(j>|8aCL+cD480k3n^wc1P? z=n^(1Pb-dJKjJp@+vZ%TI>WB>_pNVSiD#qrRigEk(ffyg^OqJEdtPEa7)1Xf39M$D z>Ffy^jO0utpJ(N$($F-8b|;%HdM*snW_=gfX?EotiqGth*A&rL*^$Y48e$%GJbHAJ zu~7GsL4OvD3q=q?haq7;@P_VG7oQwzhKXd$8YDGLBt3mlz2D2Ay_SAc!p=4D{^=6& zoC?*|Z1wGcm6^~>G{CIS0+{VreCcXr>Y2)#rn;xgX@%5M4GwQyZgFJwqhF`*3VCmD zul?QSVd?kpbUcTc%U9H_z;t*QF#hJ_@8 zr;h^fqh(fBJ_sES0ZHGdtlxSdR;_;ncp`qh~fDo+( z@L5BH7z(TG?35yokQIXFQ-?z>EYQbow9p=!e*WzL?B=EcHthQNaoxxHU1VIGJ2Ke} zUt2SimnDtud&}FH=-WNFWaK8Lh6aqan&eIv6uEGdfUhJ!Ymu5N+c=)w){0FMwHhRL=0nnF(7q?-e|CrI@ zFPW=(!g3oV^EjC-yy8OV^?Luq5@kIdx(uAJ!TPP>vdhOQwOZdc2QYwq#4771%H*D* z`KW1sY<_+anOBGGH%**R)Fsv}ojmz@I4F$v%T;r%6KW;F>ypUi!$eKUFPJCKO*|WS z3;{6ZNHV~LCWCKJpE@Eu7t@`z<3bW-0KXm|$~d}_9F_ct0dS@o-P?1TCrk$rA!m6w zXK9+MylyhH=;%hKYiH_E0Lay7hPAL}S|7=kEnyHCesv5%XDFS9u`yzDmp@jPK~K2>h5RrXG& zOR+9*8fnZ158^#TLLexdmN+16zo{T`VrgmPFkO|U6AaC4?y8zVW`x*GutvF;1%F)%Ict#*rZox`9Zl;bd+)Qe6{Hn9_O}_06%|^!$QiO{U8a$ z3(mZ%$38rTL z$5g%gNY{YqT3_Rr&a0H`a>qmgnZktgDI^T(h7a`TQBQoL+d4sC;`RQ8Eo66c-p0T9 z^0kT%Es;zgSxJ9qy!pMfAKs-m9*~Ja#_}5#@_hcydtLsQZ?>G;c-fIl*zB%OX^R{- zr{)8gm<9b7yzz>qepK)@hD zkXO;;0y|v@i_bCNE=Qkkhaq+*2iML==0&ec{3x-*@xE1Z4qdkqB7{e+s@?eqg`tMG zeq-YRmaGNxy!33_@!g=CQI>M!u#0GCBbU5_0y7l$jM!%dmrOt)TLAvohF`gS|Ll7= zhuK0MnC3!=IL={V@LY7|ibmcdZUd0UMjN&ou+UV-VGF4ebWkGmTc`5yZ{$uB-{PYc zzewO175`))$qqLl5ex0kpQ8kX^6Ks}=)c1tZJNW?4#`Gs1wQ}a>RBGW+JcJ@8{;+g zo6CJBx3YRJJ$Jvaa;gaEaLdNoGnk+0Rx9zz51)gqVJ;nL#C*zngQ+kSU?I#DbhH%f znB_lYGVO~UaDQIE{NM}i=Yv<+Xi=8=lAx+$zk4&%KvZ7i;0S>iXtLqVes`9#S*UCM zZWK*mav+*;&=6IQ0OQ&Hf3z4PVitFcu~TL3&XbpuF?oUogmEox|asIOkCKs;(m3hu(6`B}ua_kpvEA z?D;9cLPDwig<^+bCsSqR<^I`^=JI0-#nub1mwyDxM7?(j$~q&$3(y_Cox8_L_e^)P zs!oI%j;Lf_>~NO69wNE9ZD6#z$f@{@;QsL2;f@jzJ-xq70M0p~6JRJceTX@X0ty4& zFT)JT8Z>)Qq6(NCR6ppE*^Z*Y;u!X=^KzcXW!fj_Wmnwy@-iY=paB_7^&xl=2U=T28zYd88gdSM{JfuZhu;?Vb*h@Mh)0UGIA1}Jr^fWZ_L#F?%GsSYS`7KX3b zb<=~W{5rT6da78y!Oy;@Iw&lrH$I=fturh1#mujIr`(+^E=qes^s_XOTgVy9)Z29DTJFnUaEAajOie0e!>_2(Q%yn1mXL)j{DRMa zi>Vy%{HL@-M`M3Hume9?W9qb%)gO z5{Vdwgsn5}*1Tk4kXMC?`gV8$iZQGjM76$b16V??)D`w0lmHl(f zB$VhxR2`4r=leIvbT>OY8R}naSo9}Eg#YTfN7(@qL}ffy^*-kb*5af!=|PDEDCw;y zpN@Hf@TL#QW#nx);u~dbPZ&gH}QCFU8*%tJf#wsY_dA{(@ zSUM@OqVkCrJcYQAp)g!DHjxM}D9=hy3WJ;pdbB$yPP5YXuM@O#+VQEo?W3%zKS;iqtL}PWztd=1xBtg5*tX;K< zfoO7eW++`t)2}~s0$NBXlruD=>NeF=wH-OI|G-8ss{29JvRcndFWD5PR91`6YCyH7 zn_Phc}Sa&zmQ@g;ug6w<-`!=wh)|Q zWinrpCxa~)fDTRf_n+cZxE}1`7T@ph`?R?<0nq~Ss97)(+rv}4g{^b$)_jXDKn2MU zw?oG*mtr%Em%f0mP`xMPjv>`EMWdm33($tXok+z?oI8Fu9d$bQXzx?+p6ls1ZvX!z%KW<><_}%G{jc`z% z`4YSs<|Wp*yEAD2a&Uc@t>|NF%36&I+OF^_Y=2nNS$U9X{8_q+udOOc2%zMFEn7JC z>o5ID0cBi9s_+m@Y-wywWhv!%3dj8rfTu|GkyUuHr zs9+6$UoC3VC+N7#Vc1sisRIlpc99`1-8gNeeSD~S&9yLksPZF)tZ!-Ltxons?X%eI zrH#7)A}NxW@S2N%aKxfY{?#UQn;GqwLxCkuZf#wVt`7se=G#PF+uedfZ2NJ9Y`IbM z(?wRF?@sUz*MbeqOd1<5{H%?ziW4p1bkxV`!Zuc7<}o`iv3~QX-1GYT%1$UZ0F7S1PV+osQAQhs|HvneZSzKRaD4R@96nL*Zp!Gp7dc}M7KBexey-^~~ zcum**?<}L0*h%Bi^8GtYr9WsP^qQD}!~C0fCx<3tUpk{4#GL%@aFV*tLB>b?vlBy7 z&K0GDSSchE?yEcm@YgRjmKs7EIDXn1$3F*ENnjZ-VaIl$M( zdlZwMYmR=*I{@Z{rk?+GHDEvTz2D-H@N-!bq}6M8Xwzgt1^Q?p){Fp+vhl`UBr(o_ zFf^0u&ZPZQAJ)Q~_#)2C_h`xX8faVhTkPtorDLC?nyna9XIy}SMS)CyfP*o(2hmLU>4#yZ7-MIaw+F9dk%^Gx%J zOpy!d_xg4S;b(OtoQ0qneO=nSJ(?6IcTl#WNYQ3vg%SB;+n4T8+Ant+g3fC3kZ%yC z5Fp#LE&qC+w)AmWaXusE!YvfCDZVoQa6B;nhgJm-@AHXtKm{i}+v)HX^;@rVl+{Gb zsSGgM&;_)xgXSv^gTq~$DU8Bz@_2@`-S;9)9fC>YT4r4MHgMv{YR-PW(Jc~zVNOPF zM`-$X_R9i9chhCDSy%RUGf2);-_S9aeKz|8%S3U?yUh%EM}~*W{b>`jb_<=wXX{5H z+6eEdH_kv57q|QE#B-DOaK5>VG@+dlNqsX>yXE}73I~k{ z3_TdCzu)MYvRf#3xQ(rr@S8q;jRwqay&WOX_PW1UK!_FoSOJq!dV`-<$sOD6y+=*G|I$#`J#83VwH>R_N}MNq%7%?*gtIEi61aW-Ja#a*2qJ+0OOENpXuLE9 zDIwg#An+t}YPy>uEdAurkOI6>-KuO?P2fiMo$Oeh0~K92Fkt+VHrz^78wX&5H_$wJbbGfEV!KW#I0{edG|}zNcT0b}6kRF(V%oiEaQtPP zmzQN)B2kY3$ns^3TK1bdmXPcGjxg}LoXGM27i7u((V_J6XzhB-r2TGB3!Zb4LiNE| zhcq^|`uFuk9mbQnIzL@_efGZ}e0c9iy0kXY1JVG$fMKdOf{uodmInTt_4yKh6kC zq#GF@py>nhEq8qNCR5XKK7AsiLibH}61Us0VYZji2DB2pu~)S|6u`9OUr)a8wD+6! z$8D==BSucIBAc_6smK9&O~1K4>!xJx%;$%s!#S;m98nB9o#&*YCf!%B69qbT1$~U0 zT{E$`pGs}ohb3G0y8&-ybms*!;VxUJkg3ewIQAWw+a0G4SG@UN1fBqMf={KUF z*8GNyxC@LnI->yyJ@)IVV@nN!CuA*d<8AM_O9YKf^hv$8GZV-zC^kfZ*(ZL1#m>e7 z9xEI;?49yB;Ri9dp0K)Qe}l?`J#uCYVjio~i7xQNB?tLakZS@)xC=pnW`HFHE*cSN z43S9kh5ss%>8Qa5LVa(p5J9Co|6S^0JcNn0K*G-_2&GfF9If! zu3>dC-vg;uhH~werca4|dxHUdpceOb6J<~+B+cg_DEV^Q#TR3P5e|X(`1@Wx`mZeW z`P|mhij`H;QEtI)j!F!h5qkNFP9a20%(F&MKDI~4Pt#|;o_`#l)~pfjQQ@;&2Ikuf+Us zHeA_ps{+WBA#GKsm+G}{Ab~$KQ;Yu^hty17qJ!!FRzH23PhX&&PyLtl3Tb6a*)f&v zlv>}5$ofS+aP>bW+MBu9B!Q!#Il2Azn+QI?o7k7xW#07Tu6oEq)@PRB(w*+B=ZVu} z`d>*r+4=ak8iRwh!7$~(LFFi6G#LFqkX1##L^J}4y}OCP^b&si0S&!%WJrzjN+SNl z#U^W;+dBHJ;ypz)jc=MW;)vCL;ABRjnaB-eJF!uysg8*I`0ubgfdx79(Z@ycz?K`2 zWVIqT%INf}u7>0JJTG^zPMLb&^PoE)lLbv>&ulAyzmwhsl+-AM=)EmMNsd|=8$j!x zBMBL~xT-a<{%yQ)S+4H?_s@^KhWutM&A8>jKjy&CtoJRDzZJvS^r}MdLnKbSE+gw= zI_rBGKI{xu$IhC85+rWV->ZC;uf|J$ReC*H#4Wa^1cl+EN|-v{FFkWp&RCC26kO41 ztKsU5Hlu!rWb5!63m6BR)RX6zAz?uG*tAK0-&9FUG8pm-a4rPD%yVYZq^C$AU@R>j zxDu&hz9B=*)eXkaa_N|Sna?Ts^J1rqm07aD@~Y!+B~W4GIFKJGPoGGn?DaxWR(6gP zn#uQyc_X8qfOGiu^?h+(3fk^)FYS@HqmuPX{~D5Cl;s!@p9ApUH;=*A3G_F~&px(! z&qt;cKw;#uJQtIrtq<;HjcyksS6S`0cC>~Dmn;8%xgMdL!XSExCx17S7c@F92M_y4 z-qzy+lwR`ERmg?TRXO7d%Z%As)9R1_2n*(UKpz<@IyTPTnKX%rV^h z$ifWLj8D)UN^Wn~GMHRCZo@QUbLs8mF>|+p=&vHiFX?FuvDd-Atl_8fbNzGCj@(3&A;0D?e%?%#JX(5Hr$=_}r)0!9h13i|yr5hK^m~J* zy9rnJA>YGHzMVVk5koA%PXCHp)6h#@#A>l*&2(3ib#-A|F)dLUtKjqVnK%+ncGfcb zrB-$N8)K=G2mN7B;))oVRO8e(<(E*6?Ull00 zX^p%eVK{ETx%GH*Y3M}HzbtsZWdcm63*rotCQMbo?U!xQ@m`~i`m|`-oly%E??KB3 z8g_OGi=K8bxX9HViyzOSLu%eVE;Z|h?`3`D0pz#i|NC8lpXR*Uh$@vu#6bG{-w%_7 zFCN!^5&j7sa=7vg#(}5i*7BmD=$*jbFPX><&nC&g(B6#a?Ff@^vU5Uz>~_U8ENFbM zt4jt*WzeV6UcNYm51&p=#(;JDB6%wvSVHLZC+CfmMnv*aOxG4Gk4dDS38zDTh`nGa zL@xO){ZTkUWN*p>Ct&l{vq|fgZs7!gFZ+wzkTj6`+GX<#yu-2K>f+gS`HJ`LjCE}5 zQ&9?Sv$EYGb}kJy>9DD6+j`N2Wh`U zp9uYG&APh6#VibS5$rB=8~vXELmRy07yvK?&wX>jgslcw`TFY0_PnF}^0o@(a(U$Q zc{q*(sT4>T6pL{%&cPrc%tG$((84&F>4$*YyZGp_V_GKGKom^pFC72;6Q|SxN}84E zDky1x!K`Kg%1Q+4M))ylOa-dS%`bfKwRJI^IKzcKPi7@LV>zsNYhS8oz$bc4hVDU5Cwz&|BcSKXZfwVPa%*fyhB9few?em&_t}@ArY~E2fKk(+) zwI+7gH7ER)b5a0kU0b9XaQC}Q7L4C11ShSFsjFZ;@uYWqNB<%KnBUT{;o{q0Jm<6B zy|d3auK71Np8vJAjJXfdBE6K1Uv%p9*7r7b_S%jLb@!!P&c5Z@+i$vH?mZ_T)z~Qn z7!ebkYeOku!HhAh|M23*#YAMR|GazYDc7uMy!X0qJkT_%GA|{OX_{nNZm4HvB~fQ* zC+h3#DVNKkt*s5$o;xqy+uLgrk?Hr7PNjg-QZJNJ{4Z~BJrV#b@tJ#<96PZSAg#43 zYylZ7poD-i#@BAx72Fp~Ed+pR<7=KAbx0sVq|H~}+gY=(CpncfrWVW`vu(+Z&tBG- z$ktwS&XKpC^Npz+l~M`?2cK<|_IMl)2=peh;{jlFZRK`AKx@UcX3R7VNJ+eJAnpBp zPv1gUuA?_zbn6Rex9y6}K7GN2hiUlh7K1 zF(u$WfH>e~wrz3u7)kR#ytuJRYw|LHPMz1Z6Hp8gU`(^ZIPiO){$Nhdl85*_M&H%v z%-Wk=5_&=B#akt4!WnyNTs2YH$QNkTy~D-kIuY2Sba za{Xo~D=|$G968>=;UsxwA7q8vq*WD&JEIg;PosfMSm0 z2*!-U3dHzbPkwZ+*5vn^BJ$HK=0EQSWH7mQ!=6I{z~?pMH{SdDwPQwBZu#9U3x8cz z;TwP(eWG0W977Y?1TZ8smPlpoCIFZ=u4ad;G(h2$loDJ2OZh%sP$NB=wk2vz!b16pX!i7_o0W5RVrI)Za8d_JGH zZJRp|;~Td1OaOqg5>Lm->T;{thQd5&N`Y_K)_oKJR0aHdOv7Y=5<+mLHE{s!gUx#? zbCxqwaF)IBlqrAbTw9!Trj!z$J;_N0`K~9@HegtxU?_X${Lwf5{;%=tNR*taAx(n% zhsQ$u3l+>}10^1wnS5BdUKG*}5AZY>lsA#Gv9C9WNWX>Ngk8Ajj8IWxqAuh`b3-}8 zl_UP)-j@jIOIe8YT2Q*U76XO=;%SMNah1?c-s^^(!GfwgBI-@FMR#h5{@Tla;M8LJ)uYDSc{yJjV6B1M3U`L%gRY|xuKtGRB? z9p626E!_BeVvLaxj2s6{2ypipgbCAB;>53wiPeSzS6_e6t3T))$W2z7ynlUrd&9N= z9$p7`rGmR!05@MSx3#`HaKo>k{rHD@TUN)D`NKQ96R58VSX$>D#=O$+SE{#{Q7Cjk zS|AL=V4QQ7&1Qwi;}MSIm_+2sJJQ#i$j$VcqW7{TGhW7!^fq_J^>WTFK}7W4rf7Lb zGt#$S5B3$d0o7Hd+W?^f#guZd7?M&! z2tm<)*C!AP_`8ZSRcb%{@^7B~1NdUHq?j*0+)Glo#WgNY60NM$YRj>ctYcRb$} z9muBRU6EHi_jFp>aEglkLtW%dAd$Jp5jxdr&w4U472%2LUAA0o3eIuWcE;LSs~QU>6ZN zoO4GhNXDRqAl1>690dS@GT*M-FF)=zB5f2Vf+S*!G18a+?B&JRpF8K3K$%ay`oXr* z7oIY8j}Qh;X{t^<|9}7OmgB$s$0w8`|4DNiKP4iIi0JK4_JmA>(b3aK_XCp7J!#^0 zfR^9=)CUiim3X$**OVqW=Q+;(dB<@a#{4oA3MinB05{jQt*wm(gF)B+b&CLCa8Abc z_q@4?h>YvcpZ$ZmM;zKmBq6066jFHDFaXTs@#vrYZq0Q>WKKQ2=Eh%Mb=*rzad6H! zW7>?xv#!Zl9r*BjXU+UrYbH1+B_&D2fJ`K_?9w|{{rhu2KmB3LA|f)?y3Zox0idkJ z+g@Ge&oD+pO47D;^rL^{XpT$qG$m0>IdjmAeXiVeJORxYH$*x5a%c-ktb^Z_WMGwgIJV>QCk;0Kn+l zz-OG3qZDUEB;ViE6^N&DIO>SeJ+`9)08rxdB#1}?1b6QaowF@$-P5~}bC$dE%vq0f z&T@_en5JSYUTvEU0H(qFmn<0nxz@JBIm>hI%a0gQk`Gr_XlhTcBjFtfX#=d_MJ~oH z7sDY7iydPeOc)RzKe$n1D>B3z8~Y(XO=CobiQ144&0{JsztRKuj;}9&5V(<0)&Yv{ z>Vv?jupf=J0$s7B?&okKE-r#7q;A5@O4)*yQ5p;~Pe7C1N=u?YO29Y^}M| zH;}CdfSl!2GRAURGeZbXfaz@C+h=_L7prdZdPIEX8=IS6es{+W)xpyB7c87|pHd(I zD(~0;m@}f%w{gOlL!wG)T=BD)7k%=15KKxyYsv#aLtWry&OI3^ zWnKu!avWxl7(o(f*R8ENYH0x#ll&u*2;7+OQYK}FGiI_+wni#8Z0kPjTc=LFWyyl^ z?LrVqN!m@YCv6y{i9q{eDRI%QFW(eT=I0+bv*DayTz%3f#lc{VF~?z^RK^+&0LhG1 zp|#Fx%?!p!Ge-8R_x4oY@%wjfsSTCCN@Pl{^F%~?Uo15N0F=@~YnGGBF_t~__Pn(l zI?kLlHvAmtd|mOOkh7eCS&v z>FP~Qx#|45H^0AecPR>X;_gWNFwS+(Rd6ne$o|$(UOX>v$@=jPpK60s-CF zbf{jra%I8#|MI8Du&2m@K!Cn^{fd(_d1p$A&&+B~fp{uELn$QA${b!DS&W zPlqbYIsw2Ce9xWVJK;gwCJBIX&Y0H=(VNH)UYcb&Dgz*;6jNF=n}}J4p`{^suRF

    F>r<`DP;GXMKIrva8OXv6+Y|A$Y7H*F$c8;LVnweQ*BS z?*5E<&(j~xe0M{~`Qt~2o_OTPi&wg)xlR?wY0K{3IUjF{teQ2ccHj>$ZmM7T#+Flh z6WK`%S{jxwzvSqT-Bla--Cx#^C4vBe*3Y`m`R4U2Mt1ZhPaYXAU-j6s(=KWnH6oSH z+DwSG14`*YZ#+AB{nj2f<*=GGV@fT1=utX|< zBmh(gOV@JFGx>WB^{%?>niFrFF`+J{l#)a9Y1<ve3$@!G*)&;cOf2E-SkS{MM{+1Y7ac-zZIwnq}bQA#%f5R5?@ zLc|1T7I$kN1mta5FO?p_IZIXtOaE}e!pXm1diw^#e_Ljwu1j{L>l<5>xEU&-&<#DgPzw_-Pe?#!zdDBKO z|K-*5-_hETrfEt5H2>1y-x*KkPX_?OS-QTu;?Mob+(e~Gd}m3^wHKT+aj({$NS*a#E?3y#M}HShMEI5cB(vrO?!0 z8io-jnFq831}b=v0Rn@92W0qA7Yg9Klbg|#RLI+UP(N9#46GNN;+!ZYl}HnFGCm;dI8H7*a-P za$2)yjmAG&P5)oYFyWE&_0~PT=Lx}EJ*L=I=J#wJSzW&MiQ7;4Ae#jlhM|PWC@D*% zWm#G&r4I@E@WidBoiuA|kox;=ZWyV;=}3@u^`>pcSdxe;gy21fV4bO~ZIqXK;$!Lp zTTYobZm-r_Uw7V-t3TP={bn}r9LE?O!FgotsEWrgK5gpDCw^^wKM^U%(R$95Q4hWP z!OkYjmNR0B%n3Qm@s6ynSb5c1UweI4b6wiDZRPiqwrz%ny2?9t?Ti0dD&4TVE3q_C z=3O(XsrskCx^dy#g2S;aC4D~Av27+TD=&vC?m-BZbj8nKs@@YBxPbw^9#ixcyivqC zlbkWhIV5Au=A7li!IHl=j;w0EbjkG1jdhiIpU)@V_A6CcX{l&bX|LByE}}$)_4b-- ze#^+GpI^OWi6ix7##qh}d{=X0^>1&!aNeuUjp4ME(lO0)M+mKoX^^4Hl1Dmwk~921 z^PL$J>V9+o4JWq}5v5W&?eTb2NeT2-XU%$R{pXQ4vU%tDqFkFs1s=a>@${GGPpj{D z9PV%qW!tu{tSCiYsQmUwZ|XXwDeU!#&DFuuw@yE<`ETbh9M`3k>6oT;gz(6CJg!aC zq@R8N#LaK5duXkcdU933|M-<>9{Jd5^T)^Cy|PxeZEFD3GNJZYYg+eAmr9Qzz)9t7 z&*Y|>`<7ii@BMIk;TnWT~sWU-m@%t&=mRhy1f{@P#<0x{ zQ6?*dum{cF#>V|-@5YV)Es8o^8M^Wo|MH>mrfz;LV~nL3ktVIBma<%h!(r9l-cAh- z4Y~l{h8;V0umV03T&!imfLfkNv>QT<5S-_XT#k#95&&?4$Wy75E-fw9KoaRRFFJ%c z+rLp6gtBqzfOI;|%FD}HHk;+8r9dVFl$4YV0-6_}Y{_JjRaRCq#u(3Lvz#%;N=k@` zO7y_MfG#a9Rl#6T0vHbP9KaxYA_KtN+uKEHX{lkF86%hT8Wj~4qKL+k%P|JzptV=~ z{r-YCJ*BmF!PSF7sUng67*PdSRzktU@Avyf0hQ9o<#Gn+Zn~Y{?=M2cszTA>a9Bs9 z(E@%|T4XY&5JK>>vN8}6C6h@iD=Qn61LvG)vsqDIUe0s594{#WG8tD`Qc6|C2?GWp zf&^n(!5HVc+~6%1+VA(f5GGP8tu@uu)KDxI<3b27gb;<_U;vOxrKq&DvaOJK<(HaaO#T0|1I(gaw$Qp?G5$vtWU@ z*0M$>MZ;yx>6(Fx!{?a(GPBGi2F6Ii#086{G6vGU{Rt-)i|4yzy~)VFj-Gg|YY#}r zG*J&{tOtx@O7l1;B*9f0oM&Jd8H=%8t!X;3SWJh*VZA0CCj5(L?|-!%06;fnq83eP z9*KAdLCT6?Zuxv(H#IeV+0`Qqz)*BX26S?up7;0ni(=RZ6-q(ZNNY{SK^i((fGd=$ zDy56yYq8jVx*|=HPdFUb0BE?u=bW>lbe)}@l+Wk&5JbbF{n>vQcfht{=#?)i!C2K7 z+FC41DXq1pBCuUsTiX{SczTV`3;PJS7!%mUU!QgPk?{#)|a?>>V!Lk?v zyaxcRsAR>q7G+*+qf&1CU{Pj;D_aJ~sz^Hoq>q3$?AWm%M6R}$vslb+M>rfNAVNTG zG2jKo3*`>xTNsZai@^bNY7mQh$hZuL15J!E*3i)4tq6q9R73z0fS?dVA5M34P!?4#m@qt2A+*k&I+5rBYipfoG%7ngI|rY7L+B59-O|#cCQh8F z)~s2hT3e$MfKydfWd(ylE1gbT!C=rzCX;p|k+8$zuw7GA^LAk`^aXBzB-~@w>Ryv)w0)aq2o6TB*Kp;P~ zZvz7ZPG4W26OBeC05x&qMAg#LQoQ-_V3{eGuEqgE_Q1e^6$}mx@~N$@bpRA)KUkyD zs4VueSci@k&?*5q;c(cls;aVFzWZfgQ&TfYJ5*+gggXuc18y5ap@dyiv%fEHov50c znq+aF0Q=kFjzg`}+S)1$-;qVW#df%SLq&So(9lo>o7V*=js~ELeO|L>jVgYAu;K!) zR<*acTP9H_m|DXr_e8Gi!{6-w{L|m5boT@4?zUTVsl=U}_=7^wqlOmGI8ZNnnR=_- zG(RLev&jSOoY2tFwe_Qq;+r;Y%5LAj-CDP9owIuNYUx^2|2q^Hz!0>6{go9eCnEmL zGtUSj5=0~luX&-euUL!pV)g3P1`!RZtBoS>q4i+8!uw(AiuFs{$cLjJ@;|*4tx+>Wm-BmTwTC5D3KcyI;4r%ahr+T7A|=#&{VCN&><Muj&^iq71L+P@u!Hz5 z|I*J7rY+Y0!M=QjzI~+!#NdSeDt-H^b(l7PMf(4~HVo5_FO^Y2ss5$82RGbTw6wIC mEiEnPQddd&|F4QVT>VeYDOgJx*6_&y0000 + + + About + about.rst + + + Documentation + documentation/ + + + Rules + rules/ + + + Download + download/ + + + People behind + people-behind.rst + + + Support & Contact + support/ + + + + robots.txt + + + diff --git a/vendor/phpmd/phpmd/src/site/rst/about.rst b/vendor/phpmd/phpmd/src/site/rst/about.rst new file mode 100644 index 0000000..f286920 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/about.rst @@ -0,0 +1,32 @@ +========================= +PHPMD - PHP Mess Detector +========================= + +This is the project site of *PHPMD*. It is a spin-off project of +`PHP Depend`__ and aims to be a PHP equivalent of the well known +Java tool `PMD`__. PHPMD can be seen as an user friendly and easy +to configure frontend for the raw metrics measured by PHP Depend. + +__ http://pdepend.org +__ http://pmd.sourceforge.net + +What PHPMD does is: It takes a given PHP source code base and look +for several potential problems within that source. These problems +can be things like: + +- Possible bugs +- Suboptimal code +- Overcomplicated expressions +- Unused parameters, methods, properties + +PHPMD is a young project and so it only provides a limited set of +pre defined rules, compared with it's brother PMD, that detect code +smells and possible errors within the analyzed source code. Checkout +the `rules section`__ to learn more about all implemented rules. + +__ /rules/index.html + +Recent Releases +=============== + +.. include:: download/release/parts/latest.rst diff --git a/vendor/phpmd/phpmd/src/site/rst/documentation/.index.xml b/vendor/phpmd/phpmd/src/site/rst/documentation/.index.xml new file mode 100644 index 0000000..f797382 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/documentation/.index.xml @@ -0,0 +1,23 @@ + + + + index.rst + + + Suppress warnings + suppress-warnings.rst + + + Writing a PHPMD Rule + writing-a-phpmd-rule.rst + + + Creating a rule set + creating-a-ruleset.rst + + + Ant task usage + ant-task.rst + + + diff --git a/vendor/phpmd/phpmd/src/site/rst/documentation/ant-task.rst b/vendor/phpmd/phpmd/src/site/rst/documentation/ant-task.rst new file mode 100644 index 0000000..108d031 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/documentation/ant-task.rst @@ -0,0 +1,115 @@ +==================== +PHPMD ant task usage +==================== + +To ease the usage of PHPMD in your build process we provide an `ant task`__ +that integrates PHPMD into the `ant`__ build tool. The ant task jar file can +be found in the `download`__ section of the PHPMD homepage. + +__ http://ant.apache.org/manual/targets.html +__ http://ant.apache.org/ +__ /download/extensions#ant-task + +To make the task available in your ant build file you have two options. +The first option is to copy or link the ``*.jar`` file into the ``lib`` +directory of your ant installation. :: + + mapi@arwen ~ $ wget \ + http://phpmd.org/download/extensions/ant-phpmd-0.1.0.jar + ... + mapi@arwen ~ $ ln -s ~/ant-phpmd-0.1.0.jar /opt/ant/lib/ant-phpmd.jar + +The second option is to call ant with the command line switch ``-lib`` :: + + mapi@arwen ~ $ ant -lib ant-phpmd-0.1.0.jar + + +Now we can start using PHPMD in our ant ``build.xml`` file by adding +a task definition that informs ant about the new task and registers +it with a custom identifier. :: + + + + + + + + +Now the PHPMD task can be called through an xml element named ```` +in this build: :: + + + + + + + + + + + + + + + + + +Parameters +========== + +The following attributes can be defined on the PHPMD task xml-element. + +===================== ========================================================================================================================= ================================================ + Attribute Description Required +===================== ========================================================================================================================= ================================================ + rulesetfiles A comma delimited list of ruleset files ('rulesets/basic.xml,rulesets/design.xml') or identifiers of build-in rulesets. Yes, unless the ruleset nested element is used + failonerror Whether or not to fail the build if any errors occur while processing the files No + failOnRuleViolation Whether or not to fail the build if PHPMD finds any problems No + minimumPriority The rule priority threshold; rules with lower priority than they will not be used No +===================== ========================================================================================================================= ================================================ + +Nested xml elements +=================== + +The ```` specifies the format of and the output file to +which the report is written. + +**Parameters** + +=========== =================================================================== ========== + Attribute Description Required +=========== =================================================================== ========== + format The report output format. Supported formats are xml,html and text. Yes + toFile A filename into which the report is written Yes +=========== =================================================================== ========== + +The ```` xml element is another way to specify rulesets. Here +is a modified version of the previous example: :: + + + + + unusedcode + codesize + + + + + +Postprocessing the report file with XSLT +======================================== + +There are several XSLT scripts which can be used to transform the XML +report into some nice html pages. To do this, make sure you use the +XML formatter in the PHPMD task invocation, i.e.: :: + + + +Then, after the end of the PHPMD task, do this: :: + + + + diff --git a/vendor/phpmd/phpmd/src/site/rst/documentation/creating-a-ruleset.rst b/vendor/phpmd/phpmd/src/site/rst/documentation/creating-a-ruleset.rst new file mode 100755 index 0000000..c4bd7aa --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/documentation/creating-a-ruleset.rst @@ -0,0 +1,197 @@ +============================== +Howto create a custom rule set +============================== + +If you would like to only pick some of the rules that come with PHPMD and +you want to customize some of the pre defined thresholds, you can do this +by creating your own rule set file that references a custom collection of +rules with an individual configuration. + +Starting with an empty ruleset.xml file +======================================= + +The simpliest way to start with a new rule set is to copy one of the +existing files and remove all the rule-tags from the document body. +Otherwise you can use the following example as a template for your own +rule set file. You should change the content of the ``@name`` attribute +and ```` element to something that describes the purpose +of this set. :: + + + + + My custom rule set that checks my code... + + + +Adding rule references to the new ruleset.xml file +================================================== + +The first thing we would like to do is to add all `unused code`__ rules +to the new rule set file. This can simply be done with a ```` +element that references the entire `unused code`__ rule set that comes +with PHPMD. + +__ /rules/unusedcode.html +__ /rules/unusedcode.html + +:: + + + + + My custom rule set that checks my code... + + + + + + +That's it. Now the custom rule set applies all `unused code`__ rules +against the analyzed source code. + +__ /rules/unusedcode.html + +We would also like to use the `cyclomatic complexity`__ rule from the +existing `codesize`__ set in our custom rule set. To achieve this we can +reuse the same syntax with a ```` element and a ``@ref`` attribute. + +__ /rules/codesize.html#cyclomaticcomplexity +__ /rules/codesize.html + +:: + + + + + My custom rule set that checks my code... + + + + + + + + + +Now that the new rule set uses the `cyclomatic complexity`__ rule we would +also like to customize some of the rule's properties. First we will +increase the rule's priority to the highest possible priority value ``1`` +and we also decrease the threshold when the rule reports a violation. This +customization can be done with same xml elements that are used to configure +the original rule, so that you can take a look at one of the original rule +set file. + +__ /rules/codesize.html#cyclomaticcomplexity + +:: + + + + + My custom rule set that checks my code... + + + + + + + + 1 + + + + + + +You should know that PHPMD handles all custom settings additive. This +means that PHPMD keeps the original configuration for every setting that +isn't customized in a rule reference. + +Excluding rules from a rule set +=============================== + +Finally we would like to reuse the `naming`__ rule set of PHPMD. But we +don't like the two variable naming rules, so that we must exclude them +from out rule set file. This exclusion can be achieved by declaring an +```` element within the rule reference. This element has an +attribute ``@name`` which specifies the name of the excluded rule. + +__ /rules/naming.html + + +:: + + + + + My custom rule set that checks my code... + + + + + + + + 1 + + + + + + + + + + + + +Conclusion +========== + +With PHPMD's rule set syntax it is possible to customize all aspects of +rules for your own needs and you can reuse every existing rule set xml file +in your own set. You should take a look at PHPMD's rule `documentation`__ +if it happens that you don't know what rules exist or you don't know +exactly, which settings are available for one rule, while you create your +own set of rules. Another good source of information are the rule set +`files`__ that are shipped with PHPMD. + +__ /rules/ +__ http://tracker.phpmd.org/php_mess_detector/browse_code/view/rulesets/ diff --git a/vendor/phpmd/phpmd/src/site/rst/documentation/index.rst b/vendor/phpmd/phpmd/src/site/rst/documentation/index.rst new file mode 100644 index 0000000..a654f48 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/documentation/index.rst @@ -0,0 +1,109 @@ +================== +Command line usage +================== + +Type phpmd [filename|directory] [report format] [ruleset file], i.e: :: + + mapi@arwen ~ $ phpmd PHP/Depend/DbusUI/ xml rulesets/codesize.xml + + + + + This class has too many methods, consider refactoring it. + + + + +You can pass a file name or a directory name containing PHP source +code to PHPMD. + +The PHPMD Phar distribution includes the rule set files inside +its archive, even if the "rulesets/codesize.xml" parameter above looks +like a filesystem reference. + +Command line options +==================== + +- Notice that the default output is in XML, so you can redirect it to + a file and XSLT it or whatever + +- You can also use shortened names to refer to the built-in rule sets, + like this: :: + + phpmd PHP/Depend/DbusUI/ xml codesize + +- The command line interface also accepts the following optional arguments: + + - ``--minimumpriority`` - The rule priority threshold; rules with lower + priority than they will not be used. + + - ``--reportfile`` - Sends the report output to the specified file, + instead of the default output target ``STDOUT``. + + - ``--suffixes`` - Comma-separated string of valid source code filename + extensions. + + - ``--exclude`` - Comma-separated string of patterns that are used to ignore + directories. + + - ``--strict`` - Also report those nodes with a @SuppressWarnings annotation. + + An example command line: :: + + phpmd PHP/Depend/DbusUI xml codesize --reportfile phpmd.xml --suffixes .php + + +Using multiple rule sets +```````````````````````` + +PHPMD uses so called rule sets that configure/define a set of rules which will +be applied against the source under test. The default distribution of PHPMD is +already shipped with a few default sets, that can be used out-of-box. You can +call PHPMD's cli tool with a set's name to apply this configuration: :: + + ~ $ phpmd /path/to/source text codesize + +But what if you would like to apply more than one rule set against your source? +You can also pass a list of rule set names, separated by comma to PHPMD's cli +tool: :: + + ~ $ phpmd /path/to/source text codesize,unusedcode,naming + +You can also mix custom `rule set files`__ with build-in rule sets: :: + + ~ $ phpmd /path/to/source text codesize,/my/rules.xml + +__ /documentation/creating-a-ruleset.html + +That's it. With this behavior you can specify you own combination of rule sets +that will check the source code. + +Exit codes +========== + +PHPMD's command line tool currently defines three different exit codes. + +- *0*, This exit code indicates that everything worked as expected. This means + there was no error/exception and PHPMD hasn't detected any rule violation + in the code under test. +- *1*, This exit code indicates that an error/exception occured which has + interrupted PHPMD during execution. +- *2*, This exit code means that PHPMD has processed the code under test + without the occurence of an error/exception, but it has detected rule + violations in the analyzed source code. + +Renderers +========= + +At the moment PHPMD comes with the following three renderers: + +- *xml*, which formats the report as XML. +- *text*, simple textual format. +- *html*, single HTML file with possible problems. + diff --git a/vendor/phpmd/phpmd/src/site/rst/documentation/suppress-warnings.rst b/vendor/phpmd/phpmd/src/site/rst/documentation/suppress-warnings.rst new file mode 100644 index 0000000..84f3465 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/documentation/suppress-warnings.rst @@ -0,0 +1,71 @@ +========================== +PHPMD Suppressing Warnings +========================== + +You can use doc comment annotations to exclude methods or classes +from PHPMD or to suppress special rules for some software artifacts. :: + + /** + * This will suppress all the PMD warnings in + * this class. + * + * @SuppressWarnings(PHPMD) + */ + class Bar { + function foo() { + $baz = 23; + } + } + +Or you can suppress one rule with an annotation like this: :: + + /** + * + */ + class Bar { + /** + * This will suppress UnusedLocalVariable + * warnings in this method + * + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + public function foo() { + $baz = 42; + } + } + +The ``@SuppressWarnings`` annotation of PHPMD also supports some +wildcard exclusion, so that you can suppress several warnings with +a single annotation. :: + + /** + * Suppress all rules containing "unused" in this + * class + * + * @SuppressWarnings("unused") + */ + class Bar { + private $unusedPrivateField = 42; + public function foo($unusedFormalParameter = 23) + { + $unusedLocalVariable = 17; + } + private function unusedPrivateMethod() { + } + } + +A doc comment can contain multiple ``@SuppressWarnings`` annotations, +so that you can exclude multiple rules by name. :: + + /** + * Suppress all warnings from these two rules. + * + * @SuppressWarnings(PHPMD.LongVariable) + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + */ + class Bar { + public function foo($thisIsALongAndUnusedVariable) + { + + } + } diff --git a/vendor/phpmd/phpmd/src/site/rst/documentation/writing-a-phpmd-rule.rst b/vendor/phpmd/phpmd/src/site/rst/documentation/writing-a-phpmd-rule.rst new file mode 100644 index 0000000..e762fa8 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/documentation/writing-a-phpmd-rule.rst @@ -0,0 +1,418 @@ +============================ +Howto write a Rule for PHPMD +============================ + +:Author: Manuel Pichler +:Copyright: All rights reserved +:Description: This article describes the how to develop custom rule classes + for PHPMD (PHP Mess Detector). You will learn how to develop + different rule types and how to configure them in a custom rule + set file, so that PHPMD can use those rules for its analysis + runs. Additionally you will learn several other aspects about + PHPMD, like the violation message template engine and how to + write customizable rule classes. +:Keywords: NPM, Number of Public Methods, Software Metrics, PHPMD, PMD, rule set, rule, xml, violation, AST, Abstract Syntax Tree + +This article describes how you can extend PHPMD with custom rule classes that +can be used to detect design issues or errors in the analyzed source code. + +Let us start with some architecture basics behind PHPMD. All rules in PHPMD +must at least implement the `PHPMD\Rule`__ interface. You can also extend +the abstract rule base class `\PHPMD\AbstractRule`__ which already provides +an implementation of all required infrastructure methods and application logic, +so that the only task which is left to you is the implementation of the +concrete validation code of your rule. To implement this validation-code the +PHPMD rule interface declares the ``apply()`` method which will be invoked by +the application during the source analysis phase. :: + + require_once 'PHPMD/AbstractRule.php'; + + class Com_Example_Rule_NoFunctions extends \PHPMD\AbstractRule + { + public function apply(\PHPMD\AbstractNode $node) + { + // Check constraints against the given node instance + } + } + +The ``apply()`` method gets an instance of `\PHPMD\AbstractNode`__ as +argument. This node instance represents the different high level code artifacts +found in the analyzed source code. In this context high level artifact means +*interfaces*, *classes*, *methods* and *functions*. But how do we tell PHPMD +which of these artifacts are interesting for our rule, because we do not want +duplicate implementations of the descision code in every rule? To solve this +problem PHPMD uses so-called marker interfaces. The only purpose of these +interfaces is to label a rule class, which says: Hey I'm interessted in nodes +of type class and interface, or I am interessted in function artifacts. The +following list shows the available marker interfaces: + +- `\PHPMD\Rule\ClassAware`__ +- `\PHPMD\Rule\FunctionAware`__ +- `\PHPMD\Rule\InterfaceAware`__ +- `\PHPMD\Rule\MethodAware`__ + +With this marker interfaces we can now extend the previous example, so that +the rule will be called for functions found in the analyzed source code. :: + + class Com_Example_Rule_NoFunctions + extends \PHPMD\AbstractRule + implements \PHPMD\Rule\FunctionAware + { + public function apply(\PHPMD\AbstractNode $node) + { + // Check constraints against the given node instance + } + } + +And because our coding guideline forbids functions every call to the ``apply()`` +method will result in a rule violation. Such a violation can be reported to +PHPMD through the ``addViolation()`` method. The rule inherits this helper +method from it's parent class `\PHPMD\AbstractRule`__. :: + + class Com_Example_Rule_NoFunctions // ... + { + public function apply(\PHPMD\AbstractNode $node) + { + $this->addViolation($node); + } + } + +That's it. The only thing left to do is adding a configuration entry for this +rule to a rule set file. This ruleset file is an XML document where all settings +of one or more rules can be configured, so that everyone can customize an +existing rule without any changes the rule's source. The syntax of the rule set +file is completly adapted from PHPMD's inspiring example `PMD`__. To get +started with a custom rule set you should take a look at one of the existing +`XML files`__ and then adapt one of the rule configurations for a newly created +rule. The most important elements of a rule configuration are: + +- *@name*: Human readable name for the rule. +- *@message*: The error/violation message that will shown in the report. +- *@class*: The full qualified class name of the rule. +- *priority*: The priority for the rule. This can be a value in the range 1-5, + where 1 is the highest priority and 5 the lowest priority. + +:: + + + + + + 1 + + + +The previous listing shows a basic rule set file that configures all required +settings for the created example rule. For more details on PHPMD's rule set +file format you should take a look a the `Create a custom rule set`__ tutorial. + +Finally the real world test. Let's assume we have saved the rule class in a +file ``Com/Example/Rule/NoFunction.php`` that is somewhere in the PHP +``include_path`` and we have saved the rule set in a file named +``example-rule.xml``. No we can test the rule from the command line with the +following command: :: + + ~ $ phpmd /my/source/example.com text /my/rules/example-rule.xml + + /my/source/example.com/functions.php:2 Please do not use functions. + +That's it. Now we have a first custom rule class that can be used with PHPMD. + +Writing a rule based on an existing Software Metric +=================================================== + +Since the root goal for the development of PHPMD was the implementation of a +simple and user friendly interface for PHP_Depend, we will show you in this +section how to develop a rule class, that uses a software metric measured by +`PHP_Depend`__ as input data. + +In this section you will learn how to access software metrics for a given +`\PHPMD\AbstractNode`__ instance. And you will learn how to use PHPMD's +configuration backend in such a way, that thresholds and other settings can +be customized without changing any PHP code. Additionally you will see how +the information content of an error message can be improved. + +The first thing we need now is a software metric that we want to use as basis +for the new rule. A complete and up2date list of available software metrics +can be found PHP_Depend's `metric catalog`__. For this article we choose the +`Number of Public Methods (npm)`__ metric and we define an upper and a lower +threshold for our rule. The upper threshold is ``10``, because we think a class +with more public methods exposes to much of its privates and should be +refactored into two or more classes. For the lower threshold we choose ``1``, +because a class without any public method does not expose any service to +surrounding application. + +The following code listing shows the entire rule class skeleton. As you can +see, this class implements the `\PHPMD\Rule\ClassAware`__ interface, so that +PHPMD knows that this rule will only be called for classes. :: + + class Com_Example_Rule_NumberOfPublicMethods + extends \PHPMD\AbstractRule + implements \PHPMD\Rule\ClassAware + { + const MINIMUM = 1, + MAXIMUM = 10; + + public function apply(\PHPMD\AbstractNode $node) + { + // Check constraints against the given node instance + } + } + +Now that we have the rule skeleton we must access the ``npm`` metric which +is associated with the given node instance. All software metrics calculated for +a node object can directly be accessed through the ``getMetric()`` method of the +node instance. This method takes a single parameter, the abbreviation/acronym +of the metric as documented in PHP_Depends `metric catalog`__. :: + + class Com_Example_Rule_NumberOfPublicMethods + extends \PHPMD\AbstractRule + implements \PHPMD\Rule\ClassAware + { + const MINIMUM = 1, + MAXIMUM = 10; + + public function apply(\PHPMD\AbstractNode $node) + { + $npm = $node->getMetric('npm'); + if ($npm < self::MINIMUM || $npm > self::MAXIMUM) { + $this->addViolation($node); + } + } + } + +That's the coding part for the metric based rule. Now we must add this class +to a rule set file. + +:: + + + + + + + + 3 + + + +Now we can run PHPMD with this rule set file and it will report us all classes +that do not fulfill our requirement for the NPM metric. But as promised, we +will make this rule more customizable, so that it can be adjusted for different +project requirements. Therefore we will replace the two constants ``MINIMUM`` +and ``MAXIMUM`` with properties that can be configured in the rule set file. +So let us start with the modified rule set file. :: + + + + + + + + 3 + + + + + + + +In PMD rule set files you can define as many properties for a rule as you like. +All of them will be injected into a rule instance by PHPMD's runtime +environment and then can be accessed through the ``getProperty()`` +methods. Currently PHPMD supports the following getter methods. + +- ``getBooleanProperty()`` +- ``getIntProperty()`` + +So now let's modify the rule class and replace the hard coded constants with +the configurable properties. :: + + class Com_Example_Rule_NumberOfPublicMethods + extends \PHPMD\AbstractRule + implements \PHPMD\Rule\ClassAware + { + public function apply(\PHPMD\AbstractNode $node) + { + $npm = $node->getMetric('npm'); + if ($npm < $this->getIntProperty('minimum') || + $npm > $this->getIntProperty('maximum') + ) { + $this->addViolation($node); + } + } + } + +Now we are nearly done, but one issue is still left out. When we execute this +rule, the user will get the message *"The context class violates the NPM +metric."* which isn't really informative, because he must manually check if the +upper or lower threshold was exceeded and what the actual thresholds are. To +provide more information about a rule violation you can use PHPMD's minimalistic +template/placeholder engine for violation messages. With this engine you can +define violation messages with placeholders, that will be replaced with actual +values. The format for such placeholders is ``'{' + \d+ '}'``. :: + + + + + + + + 3 + + + + + + + +Now we can adjust the rule class in such a manner, that it will set the correct +values for the placeholders ``{0}``, ``{1}`` and ``{2}`` :: + + class Com_Example_Rule_NumberOfPublicMethods + extends \PHPMD\AbstractRule + implements \PHPMD\Rule\ClassAware + { + public function apply(\PHPMD\AbstractNode $node) + { + $min = $this->getIntProperty('minimum'); + $max = $this->getIntProperty('maximum'); + $npm = $node->getMetric('npm'); + + if ($npm < $min) { + $this->addViolation($node, array(get_class($node), $npm, $min)); + } else if ($npm > $max) { + $this->addViolation($node, array(get_class($node), $npm, $max)); + } + } + } + +If we run this version of the rule we will get an error message like the one +shown in the following figure. :: + + The class FooBar has 42 public method, the threshold is 10. + +Writing a rule based on the Abstract Syntax Tree +================================================ + +Now we will learn how to develop a PHPMD rule that utilizes PHP_Depend's +abstract syntax tree to detect violations or possible error in the analyzed +source code. The ability to access PHP_Depend's abstract syntax tree gives you +the most powerful way to write rules for PHPMD, because you can analyze nearly +all apects of the software under test. The syntax tree can be accessed through +the ``getFirstChildOfType()`` and ``findChildrenOfType()`` methods of the +`\PHPMD\AbstractNode`__ class. + +In this example we will implement a rule that detects the usage of the new and +controversial PHP feature ``goto``. Because we all know and agree that ``goto`` +was already bad in Basic, we would like to prevent our developers from using +the bad feature. Therefore we implement a PHPMD rule, that searches through +PHP_Depend's for the ``goto`` language construct. + +Because the ``goto`` statement cannot be found in classes and interfaces, but +in methods and functions, the new rule class must implement the two marker +interfaces `\PHPMD\Rule\FunctionAware`__ and `\PHPMD\Rule\MethodAware`__. + +:: + + namespace PHPMD\Rule\Design; + + use PHPMD\AbstractNode; + use PHPMD\AbstractRule; + use PHPMD\Rule\MethodAware; + use PHPMD\Rule\FunctionAware; + + class GotoStatement extends AbstractRule implements MethodAware, FunctionAware + { + public function apply(AbstractNode $node) + { + foreach ($node->findChildrenOfType('GotoStatement') as $goto) { + $this->addViolation($goto, array($node->getType(), $node->getName())); + } + } + } + +As you can see, we are searching for the string ``GotoStatement`` in the +previous example. This is a shortcut notation used by PHPMD to address concrete +PHP_Depend syntax tree nodes. All abstract syntax tree classes in PDepend +have the following format: :: + + \PDepend\Source\AST\ASTGotoStatement + +where :: + + \PDepend\Source\AST\AST + +is fixed and everything else depends on the node type. And this fixed part of +the class name can be ommitted in PHPMD when searching for an abstract syntax +tree node. To implement additional rules you should take a look at PHP_Depend's +`Code package`__ where you can find all currently supported code nodes. + +Conclusion +========== + +In this article we have shown you several ways to implement custom rules for +PHPMD. If you think one of your rules could be reusable for other projects and +user, don't hesitate to propose your custom rules on the project's issue tracker +at `GitHub`__ or open a pull request. + +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/Rule.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/AbstractRule.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/AbstractNode.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/Rule/ClassAware.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/Rule/FunctionAware.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/Rule/InterfaceAware.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/Rule/MethodAware.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/AbstractRule.php +__ http://pmd.sf.net/ +__ https://github.com/phpmd/phpmd/tree/master/src/main/resources/rulesets +__ http://phpmd.org/documentation/creating-a-ruleset.html + +__ http://pdepend.org +__ http://pdepend.org/documentation/software-metrics.html +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/AbstractNode.php +__ http://pdepend.org/documentation/software-metrics/number-of-public-methods.html +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/Rule/IClassAware.php +__ http://pdepend.org/documentation/software-metrics.html + +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/AbstractNode.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/Rule/FunctionAware.php +__ https://github.com/phpmd/phpmd/blob/master/src/main/php/PHPMD/Rule/MethodAware.php +__ https://github.com/pdepend/pdepend/tree/master/src/main/phpHP/Depend/Source/AST +__ https://github.com/phpmd/phpmd diff --git a/vendor/phpmd/phpmd/src/site/rst/download/.index.xml b/vendor/phpmd/phpmd/src/site/rst/download/.index.xml new file mode 100644 index 0000000..5549ff2 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/.index.xml @@ -0,0 +1,18 @@ + + + + Index + index.rst + + + Releases + releases/ + + + release/ + + + Extensions + extensions/ + + diff --git a/vendor/phpmd/phpmd/src/site/rst/download/extensions/.index.xml b/vendor/phpmd/phpmd/src/site/rst/download/extensions/.index.xml new file mode 100644 index 0000000..ae012a1 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/extensions/.index.xml @@ -0,0 +1,6 @@ + + + + index.rst + + diff --git a/vendor/phpmd/phpmd/src/site/rst/download/extensions/index.rst b/vendor/phpmd/phpmd/src/site/rst/download/extensions/index.rst new file mode 100644 index 0000000..54f9329 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/extensions/index.rst @@ -0,0 +1,63 @@ +================ +PHPMD Extensions +================ + +On this page you can find extensions available for the PHP Mess Detector +project. + +Ant Task +======== + +Simple task that allows a seamless integration of PHPMD into the +`ant`__ build tool. + +__ http://ant.apache.org/ + +2010/08/10 - ant-phpmd-0.1.2 (`api`__, `src`__) +``````````````````````````````````````````````` + +- `ant-phpmd-0.1.2.jar`__ + +__ http://static.phpmd.org/ant-phpmd/0.1.2/api +__ http://static.phpmd.org/ant-phpmd/0.1.2/src +__ http://static.phpmd.org/ant-phpmd/0.1.2/ant-phpmd.jar + +2010/04/07 - ant-phpmd-0.1.1 (`api`__, `src`__) +``````````````````````````````````````````````` + +- `ant-phpmd-0.1.1.jar`__ + +__ http://static.phpmd.org/ant-phpmd/0.1.1/api +__ http://static.phpmd.org/ant-phpmd/0.1.1/src +__ http://static.phpmd.org/ant-phpmd/0.1.1/ant-phpmd.jar + +2010/01/20 - ant-phpmd-0.1.0 +```````````````````````````` + +- `ant-phpmd-0.1.0.jar`__ + +__ http://static.phpmd.org/ant-phpmd/0.1.0/ant-phpmd.jar + +Java Binding +============ + +JAR file that provides a Java binding for PHPMD. This library can be used +to develop Java applications that utilize PHPMD's features. + +2010/08/10 - java-phpmd-0.1.1 (`api`__, `src`__) +```````````````````````````````````````````````` + +- `java-phpmd-0.1.1.jar`__ + +__ http://static.phpmd.org/java-phpmd/0.1.1/api +__ http://static.phpmd.org/java-phpmd/0.1.1/src +__ http://static.phpmd.org/java-phpmd/0.1.1/java-phpmd.jar + +2010/04/07 - java-phpmd-0.1.0 (`api`__, `src`__) +```````````````````````````````````````````````` + +- `java-phpmd-0.1.0.jar`__ + +__ http://static.phpmd.org/java-phpmd/0.1.0/api +__ http://static.phpmd.org/java-phpmd/0.1.0/src +__ http://static.phpmd.org/java-phpmd/0.1.0/java-phpmd.jar diff --git a/vendor/phpmd/phpmd/src/site/rst/download/index.rst b/vendor/phpmd/phpmd/src/site/rst/download/index.rst new file mode 100644 index 0000000..536a190 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/index.rst @@ -0,0 +1,62 @@ +========= +Downloads +========= + +Installing via Composer +======================= + +Create a ``composer.json`` file in your project directory and add *PHPMD* +as a required dependency: :: + + { + "require-dev": { + "phpmd/phpmd" : "@stable" + } + } + +Then install Composer in your project (or `download the composer.phar`__ +directly): :: + + ~ $ curl -s http://getcomposer.org/installer | php + +And finally let Composer install the project dependencies: :: + + ~ $ php composer.phar install + +__ http://getcomposer.org/composer.phar + +From the github repository +========================== + +If you like to participate on the social coding plattform `GitHub`__, +you can use PHPMD's mirror to fork and contribute to PHPMD. :: + + ~ $ git clone git://github.com/phpmd/phpmd.git + +Then ``cd`` into the checkout directory initialize the referenced sub modules: :: + + ~ $ cd phpmd + ~/phpmd $ git submodule update --init + +Then install Composer in your project (or `download the composer.phar`__ +directly): :: + + ~ $ curl -s http://getcomposer.org/installer | php + +And finally let Composer install the project dependencies: :: + + ~ $ php composer.phar install + +Requirements +============ + +PHPMD itself is considered as an early development version at its +current state. It relies on the following software products: + +- `PHP_Depend >= 2.0.0`__ +- `PHP >= 5.3.0`__ + +__ https://github.com/phpmd/phpmd +__ http://getcomposer.org/composer.phar +__ http://pdepend.org +__ http://php.net/downloads.php diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/.index.xml b/vendor/phpmd/phpmd/src/site/rst/download/releases/.index.xml new file mode 100644 index 0000000..6da2ccd --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/.index.xml @@ -0,0 +1,24 @@ + + + + PHPMD Releases + index.rst + + + + 1.1.1 + 1.1.1/ + + + 1.1.0 + 1.1.0/ + + + 1.0.1 + 1.0.1/ + + + 1.0.0 + 1.0.0/ + + diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.0/.index.xml b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.0/.index.xml new file mode 100644 index 0000000..d327b8f --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.0/.index.xml @@ -0,0 +1,7 @@ + + + + Release 1.0.0 + changelog.rst + + diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.0/changelog.rst b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.0/changelog.rst new file mode 100644 index 0000000..7dddeef --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.0/changelog.rst @@ -0,0 +1,30 @@ +============= +Release 1.0.0 +============= + +:Author: Manuel Pichler +:Copyright: All rights reserved +:Description: This document describes the news features and bugfixes of the + next feature release 1.0.0 of PHPMD. +:Keywords: Release, Version, Features, Bugfixes + +Version 1.0.0 of PHPMD was released on Februrary the 05th 2011. This release +closes a bug in PHPMD and introduces a completly new directory layout and +build process for PHPMD. + +Bugfixes +-------- + +- Fixed `#9626017`__: Clear temporary resources after a test has finished. Fixed + with commit `#b385f15`__. + +Download +-------- + +You can download release 1.0.1 through PHPMD's `PEAR Channel Server`__ or you +can download the release as a `Phar archive`__ + +__ https://www.pivotaltracker.com/story/show/9626017 +__ https://github.com/phpmd/phpmd/commit/b385f15 +__ http://pear.phpmd.org +__ http://static.phpmd.org/php/1.0.1/phpmd.phar \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.1/.index.xml b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.1/.index.xml new file mode 100644 index 0000000..3b23dd6 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.1/.index.xml @@ -0,0 +1,7 @@ + + + + Release 1.0.1 + changelog.rst + + diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.1/changelog.rst b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.1/changelog.rst new file mode 100644 index 0000000..b6a38f0 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.0.1/changelog.rst @@ -0,0 +1,33 @@ +============= +Release 1.0.1 +============= + +:Author: Manuel Pichler +:Copyright: All rights reserved +:Description: This document describes the news features and bugfixes of the + next feature release 1.0.1 of PHPMD. +:Keywords: Release, Version, Features, Bugfixes + +Version 1.0.1 of PHPMD was released on Februrary the 12th 2011. This release +closes two bugs in PHPMD. + +Bugfixes +-------- + +- Fixed `#9930643`__: The include_path does not match with PHP_Depend's new + directory layout. Fixed with commit `#531be78`__. +- Fixed `#9626017`__: Clear temporary resources after a test has finished. + Fixed with commit `#b385f15`__. + +Download +-------- + +You can download release 1.0.1 through PHPMD's `PEAR Channel Server`__ or you +can download the release as a `Phar archive`__ + +__ https://www.pivotaltracker.com/story/show/9930643 +__ https://github.com/phpmd/phpmd/commit/531be78 +__ https://www.pivotaltracker.com/story/show/9626017 +__ https://github.com/phpmd/phpmd/commit/b385f15 +__ http://pear.phpmd.org +__ http://static.phpmd.org/php/1.0.1/phpmd.phar \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.0/.index.xml b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.0/.index.xml new file mode 100644 index 0000000..e4ac834 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.0/.index.xml @@ -0,0 +1,7 @@ + + + + Release 1.1.0 + changelog.rst + + diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.0/changelog.rst b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.0/changelog.rst new file mode 100644 index 0000000..d7cee15 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.0/changelog.rst @@ -0,0 +1,56 @@ +============= +Release 1.1.0 +============= + +:Author: Manuel Pichler +:Copyright: All rights reserved +:Description: This document describes the news features and bugfixes of the + next feature release 1.1.0 of PHPMD. This version provides two + new rules, one that utilizes the CBO metric to detect strong + coupled classes and a second on that detects the usage of PHP's + goto statement. Additionally this release closes a minor bug + in the LongVariable rule. +:Keywords: Release, Version, Features, Bugfixes, Coupling Between Objects, CBO, Goto Statement, PHPUnit + +Version 1.1.0 of PHPMD was released on March the 20th 2011. The key features +for this release were two new rules. The first one utilizes the `Coupling +Between Objects (CBO)`__ metric to detect strongly coupled classes. The second +one detects the usage of PHP's questionable ``goto`` statement. Beside that +we have closed a minor bug in the LongVariable rule, where also private +properties with descriptive names were reported. And finally we have replaced +deprecated PHPUnit features in the PHPMD's test suite, so that PHPMD's tests +should now work with PHPUnit 3.4.x and 3.5.x without deprecated warnings. + +Features +-------- + +- Implemented `#10474873`__: Add rule for PHP's goto statement. Implemented + with commit `#2745a20`__. +- Implemented `#10474987`__: Implement rule for CBO metric. Implemented with + commit `#14277b4`__. +- Implemented `#11012465`__: Replace deprecated PHPUnit features in test suite. + Implemented with commit `#4adb88d`__. + +Bugfixes +-------- + +- Fixed `#10096717`__: LongVariable rule should not apply on private + properties. Fixed with commit `#f063bc9`__. + +Download +-------- + +You can download release 1.1.0 through PHPMD's `PEAR Channel Server`__ or you +can download the release as a `Phar archive`__ + +__ http://pdepend.org/documentation/software-metrics/coupling-between-objects.html +__ https://www.pivotaltracker.com/story/show/10474873 +__ https://github.com/phpmd/phpmd/commit/2745a20 +__ https://www.pivotaltracker.com/story/show/10474987 +__ https://github.com/phpmd/phpmd/commit/14277b4 +__ https://www.pivotaltracker.com/story/show/11012465 +__ https://github.com/phpmd/phpmd/commit/4adb88d +__ https://www.pivotaltracker.com/story/show/10096717 +__ https://github.com/phpmd/phpmd/commit/f063bc9 +__ http://pear.phpmd.org +__ http://static.phpmd.org/php/1.1.0/phpmd.phar \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.1/.index.xml b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.1/.index.xml new file mode 100644 index 0000000..aed1460 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.1/.index.xml @@ -0,0 +1,7 @@ + + + + Release 1.1.1 + changelog.rst + + diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.1/changelog.rst b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.1/changelog.rst new file mode 100644 index 0000000..1685344 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/1.1.1/changelog.rst @@ -0,0 +1,28 @@ +============= +Release 1.1.1 +============= + +:Author: Manuel Pichler +:Copyright: All rights reserved +:Description: This document describes the news features and bugfixes of the + next release 1.1.1 of PHPMD. This version fixes a critical bug + in PHPMD's package file that causes the Pyrus installer to fail. +:Keywords: Release, Version, Features, Bugfixes, Pyrus + +Version 1.1.1 of PHPMD is a pure Bugfix release that fixes an issue in PHPMD's +package manifest. This bug prevents Pyrus the PEAR2 installer from installing +PHPMD. Version 1.1.1 was released on June the 30th 2011. + +Bugfixes +-------- + +- Fixed: Bug in PHPMD's package manifest file. + +Download +-------- + +You can download release 1.1.0 through PHPMD's `PEAR Channel Server`__ or you +can download the release as a `Phar archive`__ + +__ http://pear.phpmd.org +__ http://static.phpmd.org/php/1.1.0/phpmd.phar diff --git a/vendor/phpmd/phpmd/src/site/rst/download/releases/index.rst b/vendor/phpmd/phpmd/src/site/rst/download/releases/index.rst new file mode 100644 index 0000000..6581abd --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/download/releases/index.rst @@ -0,0 +1,8 @@ +======== +Releases +======== + +The following releases of PHPMD are available for download + +.. include:: ../release/parts/latest.rst + diff --git a/vendor/phpmd/phpmd/src/site/rst/people-behind.rst b/vendor/phpmd/phpmd/src/site/rst/people-behind.rst new file mode 100644 index 0000000..ce9058d --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/people-behind.rst @@ -0,0 +1,85 @@ +=================== +People behind PHPMD +=================== + +Contributors +============ + +- `Volker Dusch`__ (Since 2010) / `https://github.com/edorian`__ +- `timmartin`__ (Since 2010) / `https://github.com/timmartin`__ +- `Sebastian Bergmann`__ (Since 2011) / `https://github.com/sebastianbergmann`__ +- `Zsolt Takacs`__ (Since 2011) / `https://github.com/zstakacs`__ +- `Che Hodgins`__ (Since 2011) / `https://github.com/chehodgins`__ +- `Gennadiy Litvinyuk`__ (Since 2011) / `https://github.com/gennadiylitvinyuk`__ +- `Francis Besset`__ (Since 2011) / `https://github.com/francisbesset`__ +- `zerkalica`__ (Since 2012) / `https://github.com/zerkalica`__ +- `palbertin`__ (Since 2012) / `https://github.com/palbertini`__ +- `bahulneel`__ (Since 2012) / `https://github.com/bahulneel`__ +- `Willem Stuursma`__ (Since 2012) / `https://github.com/willemstuursma`__ +- `Nimlhug`__ (Since 2012) / `https://github.com/Nimlhug`__ +- `A. Martin Llano`__ (Since 2012) / `https://github.com/amllano`__ +- `Juan Basso`__ (Since 2012) / `https://github.com/jrbasso`__ +- `Brian Ridley`__ (Since 2013) / `https://github.com/ptlis`__ +- `Radosław Mejer`__ (Since 2014) / `https://github.com/radmen`__ +- `Tobias Nyholm`__ (Since 2014) / `https://github.com/Nyholm`__ +- `Gasillo`__ (Since 2014) / `https://github.com/Gasillo`__ +- `Marc Würth`__ (Since 2014) / `https://github.com/ravage84`__ + +... and many others. +See the full list on GitHub: +https://github.com/phpmd/phpmd/graphs/contributors + +__ https://github.com/edorian +__ https://github.com/edorian +__ https://github.com/timmartin +__ https://github.com/timmartin +__ https://github.com/sebastianbergmann +__ https://github.com/sebastianbergmann +__ https://github.com/zstakacs +__ https://github.com/zstakacs +__ https://github.com/chehodgins +__ https://github.com/chehodgins +__ https://github.com/gennadiylitvinyuk +__ https://github.com/gennadiylitvinyuk +__ https://github.com/francisbesset +__ https://github.com/francisbesset +__ https://github.com/zerkalica +__ https://github.com/zerkalica +__ https://github.com/palbertini +__ https://github.com/palbertini +__ https://github.com/bahulneel +__ https://github.com/bahulneel +__ https://github.com/willemstuursma +__ https://github.com/willemstuursma +__ https://github.com/Nimlhug +__ https://github.com/Nimlhug +__ https://github.com/amllano +__ https://github.com/amllano +__ https://github.com/jrbasso +__ https://github.com/jrbasso +__ https://github.com/ptlis +__ https://github.com/ptlis +__ https://github.com/radmen +__ https://github.com/radmen +__ https://github.com/Nyholm +__ https://github.com/Nyholm +__ https://github.com/Gasillo +__ https://github.com/Gasillo +__ https://github.com/ravage84 +__ https://github.com/ravage84 + +Project founder +=============== + +- `Manuel Pichler`__ / `https://github.com/manuelpichler`__ / (Since 2009) + +__ https://github.com/manuelpichler +__ https://github.com/manuelpichler + + +.. + Local Variables: + mode: rst + fill-column: 79 + End: + vim: et syn=rst tw=79 diff --git a/vendor/phpmd/phpmd/src/site/rst/robots.txt b/vendor/phpmd/phpmd/src/site/rst/robots.txt new file mode 100644 index 0000000..17a3cf4 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/robots.txt @@ -0,0 +1,35 @@ +# +# robots.txt for http://kore-nordmann.de +# +# Please note: There are a lot of pages on this site, and there are +# some misbehaved spiders out there that go _way_ too fast. If you're +# irresponsible, your access to the site may be blocked. + +Sitemap: http://pdepend.org/.sitemap + +# advertising-related bots: +User-agent: Mediapartners-Google* +Disallow: / + +# A capture bot, downloads gazillions of pages with no public benefit +# http://www.webreaper.net/ +User-agent: WebReaper +Disallow: / + +# +# Friendly, low-speed bots are welcome viewing article pages, but not +# dynamically-generated pages please. +# + +# Only googles bots now '$' +# User-agent: Googlebot +# Disallow: /relation/find$ + +User-agent: * +Disallow: /styles/ +Disallow: /images/ + +# +# *at least* 1 second please. preferably more :D +# +Crawl-delay: 1 diff --git a/vendor/phpmd/phpmd/src/site/rst/rules/.index.xml b/vendor/phpmd/phpmd/src/site/rst/rules/.index.xml new file mode 100644 index 0000000..266f2c9 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/rules/.index.xml @@ -0,0 +1,27 @@ + + + + Index + index.rst + + + Code Size Rules + codesize.rst + + + Controversial Rules + controversial.rst + + + Design Rules + design.rst + + + Naming Rules + naming.rst + + + Unused Code Rules + unusedcode.rst + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/site/rst/rules/cleancode.rst b/vendor/phpmd/phpmd/src/site/rst/rules/cleancode.rst new file mode 100644 index 0000000..8e8b3c7 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/rules/cleancode.rst @@ -0,0 +1,72 @@ +================ +Clean Code Rules +================ + +The Clean Code ruleset contains a collection of rules that enforce +software design principles such as the SOLID Principles and Object +Callisthenics. + +They are very strict and cannot easily be followed without any violations. +If you use this ruleset you should: + +1. Select important packages that should follow this ruleset and others that + don't +2. Set a treshold for failures and not fail at the first occurance. + +ElseExpression +============== + +Since: PHPMD 1.5 + +An if expression with an else branch is never necessary. You can rewrite the +conditions in a way that the else is not necessary and the code becomes simpler +to read. To achieve this use early return statements. To achieve this you may +need to split the code it several smaller methods. For very simple assignments +you could also use the ternary operations. + +Example: :: + + class Foo + { + public function bar($flag) + { + if ($flag) { + // one branch + } else { + // another branch + } + } + } + +BooleanArgumentFlag +=================== + +A boolean flag argument is a reliable indicator for a violation of +the Single Responsibility Principle (SRP). You can fix this problem +by extracting the logic in the boolean flag into its own class +or method. + +Example: :: + + class Foo { + public function bar($flag = true) { + } + } + +StaticAccess +============ + +Static acccess causes inexchangable dependencies to other classes and leads to +hard to test code. Avoid using static access at all costs and instead inject +dependencies through the constructor. The only case when static access is +acceptable is when used for factory methods. + +Example: :: + + class Foo + { + public function bar() + { + Bar::baz(); + } + } diff --git a/vendor/phpmd/phpmd/src/site/rst/rules/codesize.rst b/vendor/phpmd/phpmd/src/site/rst/rules/codesize.rst new file mode 100644 index 0000000..d48f45f --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/rules/codesize.rst @@ -0,0 +1,283 @@ +=============== +Code Size Rules +=============== + +The Code Size Ruleset contains a collection of rules that find code size related problems. + +CyclomaticComplexity +==================== + +Since: PHPMD 0.1 + +Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity. + + +Example: :: + + // Cyclomatic Complexity = 12 + class Foo { + 1 public function example() { + 2 if ($a == $b) { + 3 if ($a1 == $b1) { + fiddle(); + 4 } else if ($a2 == $b2) { + fiddle(); + } else { + fiddle(); + } + 5 } else if ($c == $d) { + 6 while ($c == $d) { + fiddle(); + } + 7 } else if ($e == $f) { + 8 for ($n = 0; $n < $h; $n++) { + fiddle(); + } + } else{ + switch ($z) { + 9 case 1: + fiddle(); + break; + 10 case 2: + fiddle(); + break; + 11 case 3: + fiddle(); + break; + 12 default: + fiddle(); + break; + } + } + } + } + +This rule has the following properties: + +=================================== =============== =================================================================== + Name Default Value Description +=================================== =============== =================================================================== + reportLevel 10 The Cyclomatic Complexity reporting threshold + showClassesComplexity true Indicate if class average violation should be added to the report + showMethodsComplexity true Indicate if class average violation should be added to the report +=================================== =============== =================================================================== + +NPathComplexity +=============== + +Since: PHPMD 0.1 + +The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity. + + +Example: :: + + class Foo { + function bar() { + // lots of complicated code + } + } + +This rule has the following properties: + +=================================== =============== =============================== + Name Default Value Description +=================================== =============== =============================== + minimum 200 The npath reporting threshold +=================================== =============== =============================== + +ExcessiveMethodLength +===================== + +Since: PHPMD 0.1 + +Violations of this rule usually indicate that the method is doing too much. Try to reduce the method size by creating helper methods and removing any copy/pasted code. + + +Example: :: + + class Foo { + public function doSomething() { + print("Hello world!" . PHP_EOL); + print("Hello world!" . PHP_EOL); + // 98 copies omitted for brevity. + } + } + +This rule has the following properties: + +=================================== =============== ===================================== + Name Default Value Description +=================================== =============== ===================================== + minimum 100 The method size reporting threshold +=================================== =============== ===================================== + +ExcessiveClassLength +==================== + +Since: PHPMD 0.1 + +Long Class files are indications that the class may be trying to do too much. Try to break it down, and reduce the size to something manageable. + + +Example: :: + + class Foo { + public function bar() { + // 1000 lines of code + } + } + +This rule has the following properties: + +=================================== =============== ==================================== + Name Default Value Description +=================================== =============== ==================================== + minimum 1000 The class size reporting threshold +=================================== =============== ==================================== + +ExcessiveParameterList +====================== + +Since: PHPMD 0.1 + +Long parameter lists can indicate that a new object should be created to wrap the numerous parameters. Basically, try to group the parameters together. + + +Example: :: + + class Foo { + public function addData( + $p0, $p1, $p2, $p3, $p4, $p5, + $p5, $p6, $p7, $p8, $p9, $p10) { + } + } + +This rule has the following properties: + +=================================== =============== ========================================= + Name Default Value Description +=================================== =============== ========================================= + minimum 10 The parameter count reporting threshold +=================================== =============== ========================================= + +ExcessivePublicCount +==================== + +Since: PHPMD 0.1 + +A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it. + + +Example: :: + + public class Foo { + public $value; + public $something; + public $var; + // [... more more public attributes ...] + + public function doWork() {} + public function doMoreWork() {} + public function doWorkAgain() {} + // [... more more public methods ...] + } + +This rule has the following properties: + +=================================== =============== ===================================== + Name Default Value Description +=================================== =============== ===================================== + minimum 45 The public item reporting threshold +=================================== =============== ===================================== + +TooManyFields +============= + +Since: PHPMD 0.1 + +Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field. + + +Example: :: + + class Person { + protected $one; + private $two; + private $three; + [... many more fields ...] + } + +This rule has the following properties: + +=================================== =============== ====================================== + Name Default Value Description +=================================== =============== ====================================== + maxfields 15 The field count reporting threshold +=================================== =============== ====================================== + +TooManyMethods +============== + +Since: PHPMD 0.1 + +A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. + +This rule has the following properties: + +=================================== =============== ======================================= + Name Default Value Description +=================================== =============== ======================================= + maxmethods 10 The method count reporting threshold +=================================== =============== ======================================= + +ExcessiveClassComplexity +======================== + +Since: PHPMD 0.2.5 + +The WMC of a class is a good indicator of how much time and effort is required to modify and maintain this class. A large number of methods also means that this class has a greater potential impact on derived classes. + + +Example: :: + + class Foo { + public function bar() { + if ($a == $b) { + if ($a1 == $b1) { + fiddle(); + } else if ($a2 == $b2) { + fiddle(); + } else { + } + } + } + public function baz() { + if ($a == $b) { + if ($a1 == $b1) { + fiddle(); + } else if ($a2 == $b2) { + fiddle(); + } else { + } + } + } + // Several other complex methods + } + +This rule has the following properties: + +=================================== =============== ======================================== + Name Default Value Description +=================================== =============== ======================================== + maximum 50 The maximum WMC tolerable for a class. +=================================== =============== ======================================== + + +Remark +====== + + This document is based on a ruleset xml-file, that was taken from the original source of the `PMD`__ project. This means that most parts of the content on this page are the intellectual work of the PMD community and its contributors and not of the PHPMD project. + +__ http://pmd.sourceforge.net/ + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/site/rst/rules/controversial.rst b/vendor/phpmd/phpmd/src/site/rst/rules/controversial.rst new file mode 100644 index 0000000..d57ba87 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/rules/controversial.rst @@ -0,0 +1,103 @@ +=================== +Controversial Rules +=================== + +This ruleset contains a collection of controversial rules. + +Superglobals +============ + +Since: PHPMD 0.2 + +Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance. + + +Example: :: + + class Foo { + public function bar() { + $name = $_POST['foo']; + } + } + +CamelCaseClassName +================== + +Since: PHPMD 0.2 + +It is considered best practice to use the CamelCase notation to name classes. + + +Example: :: + + class class_name { + } + +CamelCasePropertyName +===================== + +Since: PHPMD 0.2 + +It is considered best practice to use the camelCase notation to name attributes. + + +Example: :: + + class ClassName { + protected $property_name; + } + +CamelCaseMethodName +=================== + +Since: PHPMD 0.2 + +It is considered best practice to use the CamelCase notation to name methods. + + +Example: :: + + class ClassName { + public function get_name() { + } + } + +CamelCaseParameterName +====================== + +Since: PHPMD 0.2 + +It is considered best practice to use the camelCase notation to name parameters. + + +Example: :: + + class ClassName { + public function doSomething($user_name) { + } + } + +CamelCaseVariableName +===================== + +Since: PHPMD 0.2 + +It is considered best practice to use the camelCase notation to name variables. + + +Example: :: + + class ClassName { + public function doSomething() { + $data_module = new DataModule(); + } + } + + +Remark +====== + + This document is based on a ruleset xml-file, that was taken from the original source of the `PMD`__ project. This means that most parts of the content on this page are the intellectual work of the PMD community and its contributors and not of the PHPMD project. + +__ http://pmd.sourceforge.net/ + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/site/rst/rules/design.rst b/vendor/phpmd/phpmd/src/site/rst/rules/design.rst new file mode 100644 index 0000000..0ed55da --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/rules/design.rst @@ -0,0 +1,161 @@ +============ +Design Rules +============ + +The Design Ruleset contains a collection of rules that find software design related problems. + +ExitExpression +============== + +Since: PHPMD 0.2 + +An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment. + + +Example: :: + + class Foo { + public function bar($param) { + if ($param === 42) { + exit(23); + } + } + } + +EvalExpression +============== + +Since: PHPMD 0.2 + +An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code. + + +Example: :: + + class Foo { + public function bar($param) { + if ($param === 42) { + eval('$param = 23;'); + } + } + } + +GotoStatement +============= + +Since: PHPMD 1.1.0 + +Goto makes code harder to read and it is nearly impossible to understand the control flow of an application that uses this language construct. Therefore it should be avoided. Consider to replace Goto with regular control structures and separate methods/function, which are easier to read. + + +Example: :: + + class Foo { + public function bar($param) { + A: + if ($param === 42) { + goto X; + } + Y: + if (time() % 42 === 23) { + goto Z; + } + X: + if (time() % 23 === 42) { + goto Y; + } + Z: + return 42; + } + } + +NumberOfChildren +================ + +Since: PHPMD 0.2 + +A class with an excessive number of children is an indicator for an unbalanced class hierarchy. You should consider to refactor this class hierarchy. + + + +This rule has the following properties: + +=================================== =============== ============================================= + Name Default Value Description +=================================== =============== ============================================= + minimum 15 Maximum number of acceptable child classes. +=================================== =============== ============================================= + +DepthOfInheritance +================== + +Since: PHPMD 0.2 + +A class with many parents is an indicator for an unbalanced and wrong class hierarchy. You should consider to refactor this class hierarchy. + + + +This rule has the following properties: + +=================================== =============== ============================================== + Name Default Value Description +=================================== =============== ============================================== + minimum 6 Maximum number of acceptable parent classes. +=================================== =============== ============================================== + +CouplingBetweenObjects +====================== + +Since: PHPMD 1.1.0 + +A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability + + +Example: :: + + class Foo { + /** + * @var \foo\bar\X + */ + private $x = null; + + /** + * @var \foo\bar\Y + */ + private $y = null; + + /** + * @var \foo\bar\Z + */ + private $z = null; + + public function setFoo(\Foo $foo) {} + public function setBar(\Bar $bar) {} + public function setBaz(\Baz $baz) {} + + /** + * @return \SplObjectStorage + * @throws \OutOfRangeException + * @throws \InvalidArgumentException + * @throws \ErrorException + */ + public function process(\Iterator $it) {} + + // ... + } + +This rule has the following properties: + +=================================== =============== ============================================ + Name Default Value Description +=================================== =============== ============================================ + minimum 13 Maximum number of acceptable dependencies. +=================================== =============== ============================================ + + +Remark +====== + + This document is based on a ruleset xml-file, that was taken from the original source of the `PMD`__ project. This means that most parts of the content on this page are the intellectual work of the PMD community and its contributors and not of the PHPMD project. + +__ http://pmd.sourceforge.net/ diff --git a/vendor/phpmd/phpmd/src/site/rst/rules/index.rst b/vendor/phpmd/phpmd/src/site/rst/rules/index.rst new file mode 100644 index 0000000..59ff953 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/rules/index.rst @@ -0,0 +1,112 @@ +================ +Current Rulesets +================ + +List of rulesets and rules contained in each ruleset. + +- `Code Size Rules`__: The Code Size Ruleset contains a collection of rules that find code size related problems. +- `Controversial Rules`__: This ruleset contains a collection of controversial rules. +- `Design Rules`__: The Code Size Ruleset contains a collection of rules that find software design related problems. +- `Naming Rules`__: The Naming Ruleset contains a collection of rules about names - too long, too short, and so forth. +- `Unused Code Rules`__: The Unused Code Ruleset contains a collection of rules that find unused code. + +__ index.html#code-size-rules +__ index.html#controversial-rules +__ index.html#design-rules +__ index.html#naming-rules +__ index.html#unused-code-rules + +Code Size Rules +=============== + +- `CyclomaticComplexity`__: Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity. +- `NPathComplexity`__: The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity. +- `ExcessiveMethodLength`__: Violations of this rule usually indicate that the method is doing too much. Try to reduce the method size by creating helper methods and removing any copy/pasted code. +- `ExcessiveClassLength`__: Long Class files are indications that the class may be trying to do too much. Try to break it down, and reduce the size to something manageable. +- `ExcessiveParameterList`__: Long parameter lists can indicate that a new object should be created to wrap the numerous parameters. Basically, try to group the parameters together. +- `ExcessivePublicCount`__: A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it. +- `TooManyFields`__: Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field. +- `TooManyMethods`__: A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects. +- `ExcessiveClassComplexity`__: The WMC of a class is a good indicator of how much time and effort is required to modify and maintain this class. A large number of methods also means that this class has a greater potential impact on derived classes. + +__ codesize.html#cyclomaticcomplexity +__ codesize.html#npathcomplexity +__ codesize.html#excessivemethodlength +__ codesize.html#excessiveclasslength +__ codesize.html#excessiveparameterlist +__ codesize.html#excessivepubliccount +__ codesize.html#toomanyfields +__ codesize.html#toomanymethods +__ codesize.html#excessiveclasscomplexity + +Controversial Rules +=================== + +- `Superglobals`__: Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance. +- `CamelCaseClassName`__: It is considered best practice to use the CamelCase notation to name classes. +- `CamelCasePropertyName`__: It is considered best practice to use the camelCase notation to name attributes. +- `CamelCaseMethodName`__: It is considered best practice to use the CamelCase notation to name methods. +- `CamelCaseParameterName`__: It is considered best practice to use the camelCase notation to name parameters. +- `CamelCaseVariableName`__: It is considered best practice to use the camelCase notation to name variables. + +__ controversial.html#superglobals +__ controversial.html#camelcaseclassname +__ controversial.html#camelcasepropertyname +__ controversial.html#camelcasemethodname +__ controversial.html#camelcaseparametername +__ controversial.html#camelcasevariablename + +Design Rules +============ + +- `ExitExpression`__: An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment. +- `EvalExpression`__: An eval-expression is untestable, a security risk and bad practice. Therefore it should be avoided. Consider to replace the eval-expression with regular code. +- `GotoStatement`__: Goto makes code harder to read and it is nearly impossible to understand the control flow of an application that uses this language construct. Therefore it should be avoided. Consider to replace Goto with regular control structures and separate methods/function, which are easier to read. +- `NumberOfChildren`__: A class with an excessive number of children is an indicator for an unbalanced class hierarchy. You should consider to refactor this class hierarchy. +- `DepthOfInheritance`__: A class with many parents is an indicator for an unbalanced and wrong class hierarchy. You should consider to refactor this class hierarchy. +- `CouplingBetweenObjects`__: A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability + +__ design.html#exitexpression +__ design.html#evalexpression +__ design.html#gotostatement +__ design.html#numberofchildren +__ design.html#depthofinheritance +__ design.html#couplingbetweenobjects + +Naming Rules +============ + +- `ShortVariable`__: Detects when a field, local, or parameter has a very short name. +- `LongVariable`__: Detects when a field, formal or local variable is declared with a long name. +- `ShortMethodName`__: Detects when very short method names are used. +- `ConstructorWithNameAsEnclosingClass`__: A constructor method should not have the same name as the enclosing class, consider to use the PHP 5 __construct method. +- `ConstantNamingConventions`__: Class/Interface constant nanmes should always be defined in uppercase. +- `BooleanGetMethodName`__: Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'. + +__ naming.html#shortvariable +__ naming.html#longvariable +__ naming.html#shortmethodname +__ naming.html#constructorwithnameasenclosingclass +__ naming.html#constantnamingconventions +__ naming.html#booleangetmethodname + +Unused Code Rules +================= + +- `UnusedPrivateField`__: Detects when a private field is declared and/or assigned a value, but not used. +- `UnusedLocalVariable`__: Detects when a local variable is declared and/or assigned, but not used. +- `UnusedPrivateMethod`__: Unused Private Method detects when a private method is declared but is unused. +- `UnusedFormalParameter`__: Avoid passing parameters to methods or constructors and then not using those parameters. + +__ unusedcode.html#unusedprivatefield +__ unusedcode.html#unusedlocalvariable +__ unusedcode.html#unusedprivatemethod +__ unusedcode.html#unusedformalparameter + + +Remark +====== + + This document is based on a ruleset xml-file, that was taken from the original source of the `PMD`__ project. This means that most parts of the content on this page are the intellectual work of the PMD community and its contributors and not of the PHPMD project. + +__ http://pmd.sourceforge.net/ diff --git a/vendor/phpmd/phpmd/src/site/rst/rules/naming.rst b/vendor/phpmd/phpmd/src/site/rst/rules/naming.rst new file mode 100644 index 0000000..ca15357 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/rules/naming.rst @@ -0,0 +1,161 @@ +============ +Naming Rules +============ + +The Naming Ruleset contains a collection of rules about names - too long, too short, and so forth. + +ShortVariable +============= + +Since: PHPMD 0.2 + +Detects when a field, local, or parameter has a very short name. + + +Example: :: + + class Something { + private $q = 15; // VIOLATION - Field + public static function main( array $as ) { // VIOLATION - Formal + $r = 20 + $this->q; // VIOLATION - Local + for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR) + $r += $this->q; + } + } + } + +This rule has the following properties: + +=================================== =============== =========================================================== + Name Default Value Description +=================================== =============== =========================================================== + minimum 3 Minimum length for a variable, property or parameter name +=================================== =============== =========================================================== + exceptions empty Comma-separated list of names that should be allowed +=================================== =============== =========================================================== + +LongVariable +============ + +Since: PHPMD 0.2 + +Detects when a field, formal or local variable is declared with a long name. + + +Example: :: + + class Something { + protected $reallyLongIntName = -3; // VIOLATION - Field + public static function main( array $argumentsList[] ) { // VIOLATION - Formal + $otherReallyLongName = -5; // VIOLATION - Local + for ($interestingIntIndex = 0; // VIOLATION - For + $interestingIntIndex < 10; + $interestingIntIndex++ ) { + } + } + } + +This rule has the following properties: + +=================================== =============== ========================================= + Name Default Value Description +=================================== =============== ========================================= + maximum 20 The variable length reporting threshold +=================================== =============== ========================================= + +ShortMethodName +=============== + +Since: PHPMD 0.2 + +Detects when very short method names are used. + + +Example: :: + + class ShortMethod { + public function a( $index ) { // Violation + } + } + +This rule has the following properties: + +=================================== =============== ============================================== + Name Default Value Description +=================================== =============== ============================================== + minimum 3 Minimum length for a method or function name +=================================== =============== ============================================== + +ConstructorWithNameAsEnclosingClass +=================================== + +Since: PHPMD 0.2 + +A constructor method should not have the same name as the enclosing class, consider to use the PHP 5 __construct method. + + +Example: :: + + class MyClass { + // this is bad because it is PHP 4 style + public function MyClass() {} + // this is good because it is a PHP 5 constructor + public function __construct() {} + } + +ConstantNamingConventions +========================= + +Since: PHPMD 0.2 + +Class/Interface constant nanmes should always be defined in uppercase. + + +Example: :: + + class Foo { + const MY_NUM = 0; // ok + const myTest = ""; // fail + } + +BooleanGetMethodName +==================== + +Since: PHPMD 0.2 + +Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'. + + +Example: :: + + class Foo { + /** + * @return boolean + */ + public function getFoo() {} // bad + /** + * @return bool + */ + public function isFoo(); // ok + /** + * @return boolean + */ + public function getFoo($bar); // ok, unless checkParameterizedMethods=true + } + +This rule has the following properties: + +=================================== =============== ============================================================ + Name Default Value Description +=================================== =============== ============================================================ + checkParameterizedMethods false Applies only to methods without parameter when set to true +=================================== =============== ============================================================ + + +Remark +====== + + This document is based on a ruleset xml-file, that was taken from the original source of the `PMD`__ project. This means that most parts of the content on this page are the intellectual work of the PMD community and its contributors and not of the PHPMD project. + +__ http://pmd.sourceforge.net/ + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/site/rst/rules/unusedcode.rst b/vendor/phpmd/phpmd/src/site/rst/rules/unusedcode.rst new file mode 100644 index 0000000..1ff67ce --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/rules/unusedcode.rst @@ -0,0 +1,85 @@ +================= +Unused Code Rules +================= + +The Unused Code Ruleset contains a collection of rules that find unused code. + +UnusedPrivateField +================== + +Since: PHPMD 0.2 + +Detects when a private field is declared and/or assigned a value, but not used. + + +Example: :: + + class Something + { + private static $FOO = 2; // Unused + private $i = 5; // Unused + private $j = 6; + public function addOne() + { + return $this->j++; + } + } + +UnusedLocalVariable +=================== + +Since: PHPMD 0.2 + +Detects when a local variable is declared and/or assigned, but not used. + + +Example: :: + + class Foo { + public function doSomething() + { + $i = 5; // Unused + } + } + +UnusedPrivateMethod +=================== + +Since: PHPMD 0.2 + +Unused Private Method detects when a private method is declared but is unused. + + +Example: :: + + class Something + { + private function foo() {} // unused + } + +UnusedFormalParameter +===================== + +Since: PHPMD 0.2 + +Avoid passing parameters to methods or constructors and then not using those parameters. + + +Example: :: + + class Foo + { + private function bar($howdy) + { + // $howdy is not used + } + } + + +Remark +====== + + This document is based on a ruleset xml-file, that was taken from the original source of the `PMD`__ project. This means that most parts of the content on this page are the intellectual work of the PMD community and its contributors and not of the PHPMD project. + +__ http://pmd.sourceforge.net/ + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/site/rst/support/.index.xml b/vendor/phpmd/phpmd/src/site/rst/support/.index.xml new file mode 100644 index 0000000..e311dcf --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/support/.index.xml @@ -0,0 +1,7 @@ + + + + index.rst + + + diff --git a/vendor/phpmd/phpmd/src/site/rst/support/index.rst b/vendor/phpmd/phpmd/src/site/rst/support/index.rst new file mode 100644 index 0000000..b62b3f1 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/rst/support/index.rst @@ -0,0 +1,40 @@ +================= +Support & Contact +================= + +If you think you found an error or you have an improvment for +PHPMD, you can send questions and suggestions to our mailinglist. +Or if you are interested in helping to improve this software, +by writing patches, extensions or just providing new ideas, you +should feel free to join PHPMD's `IRC channel`__ or send a +message to the phpmd-users@phpmd.org mailinglist. + +IRC +=== + +- You will always find help on PHPMD related topics in the + `#phpmd`__ channel on the `Freenode`__ network. + +Issue-Tracker +============= + +- You can file a ticket in PHPMD's `Issue tracker`__ when you + think you found a bug or you have a feature request for future + versions of PHPMD. + +Commercial support +================== + +There are also companies providing commercial support for PHPMD: + +- `Qafoo GmbH - passion for software quality`__ + + Founded by me, the lead developer of PHPMD, and two friends, Qafoo + provides support for PHPMD and general consulting and training on + software quality tools and processes. + +__ irc://irc.freenode.net/#phpmd +__ irc://irc.freenode.net/#phpmd +__ http://freenode.net +__ https://github.com/phpmd/phpmd/issues +__ http://qafoo.com diff --git a/vendor/phpmd/phpmd/src/site/scripts/pmd.xsl b/vendor/phpmd/phpmd/src/site/scripts/pmd.xsl new file mode 100644 index 0000000..29ab46d --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/scripts/pmd.xsl @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Remark +====== + + This document is based on a ruleset xml-file, that was taken from the original source of the `PMD`__ project. This means that most parts of the content on this page are the intellectual work of the PMD community and its contributors and not of the PHPMD project. + +__ http://pmd.sourceforge.net/ + + + + + + + + + + + + + + + + + Since: PHPMD + + + + + + + + + + + + + Example: :: + + + + + + + + + + + + + + + + + + + + + This rule has the following properties: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/phpmd/phpmd/src/site/scripts/update-rules.php b/vendor/phpmd/phpmd/src/site/scripts/update-rules.php new file mode 100755 index 0000000..7fbfb88 --- /dev/null +++ b/vendor/phpmd/phpmd/src/site/scripts/update-rules.php @@ -0,0 +1,143 @@ +#!/usr/bin/env php +' . PHP_EOL . + '' . PHP_EOL . + ' ' . PHP_EOL . + ' Index' . PHP_EOL . + ' index.rst' . PHP_EOL . + ' ' . PHP_EOL; + +foreach ( $files as $file ) +{ + echo 'Processing: ', $file, PHP_EOL; + + $name = pathinfo( $file, PATHINFO_FILENAME ); + $path = $output . '/' . $name . '.rst'; + + $cmd = sprintf( + 'xsltproc %s/pmd.xsl %s > %s', + escapeshellarg( dirname( __FILE__ ) ), + escapeshellarg( $file ), + escapeshellarg( $path ) + ); + shell_exec( $cmd ); + + $sxml = simplexml_load_file( $file ); + $index .= ' ' . PHP_EOL . + ' ' . $sxml['name'] . '' . PHP_EOL . + ' ' . $name . '.rst' . PHP_EOL . + ' ' . PHP_EOL; + + $rules = array(); + foreach ( $sxml->rule as $rule ) + { + $rules[] = array( + 'name' => normalize( $rule['name'] ), + 'desc' => normalize( $rule->description ), + 'href' => $name . '.html#' . strtolower( $rule['name'] ), + ); + } + + $sets[] = array( + 'name' => normalize( $sxml['name'] ), + 'desc' => normalize( $sxml->description ), + 'rules' => $rules, + ); +} + +$index .= ''; + +file_put_contents( $output . '/index.rst', generate_index( $sets ) ); +file_put_contents( $output . '/.index.xml', $index ); + + +exit( 0 ); + +function normalize( $elem ) +{ + return preg_replace( '(\s+)s', ' ', trim( (string) $elem ) ); +} + +function generate_index( array $sets ) +{ + $content = '================' . PHP_EOL + . 'Current Rulesets' . PHP_EOL + . '================' + . PHP_EOL . PHP_EOL + . 'List of rulesets and rules contained in each ruleset.' + . PHP_EOL . PHP_EOL; + + foreach ( $sets as $set ) + { + $content .= sprintf( + '- `%s`__: %s%s', + $set['name'], + $set['desc'], + PHP_EOL + ); + } + + $content .= PHP_EOL; + foreach ( $sets as $set ) + { + $anchor = preg_replace( '([^a-z0-9]+)i', '-', $set['name'] ); + $anchor = strtolower( $anchor ); + + $content .= '__ index.html#' . $anchor . PHP_EOL; + } + $content .= PHP_EOL; + + foreach ( $sets as $set ) + { + $content .= $set['name'] . PHP_EOL; + $content .= str_repeat( '=', strlen( $set['name' ] ) ); + $content .= PHP_EOL . PHP_EOL; + + foreach ( $set['rules'] as $rule ) + { + $content .= sprintf( + '- `%s`__: %s%s', + $rule['name'], + $rule['desc'], + PHP_EOL + ); + } + + $content .= PHP_EOL; + foreach ( $set['rules'] as $rule ) + { + $content .= '__ ' . $rule['href'] . PHP_EOL; + } + $content .= PHP_EOL; + } + $content .= PHP_EOL; + $content .= 'Remark' . PHP_EOL . + '======' . PHP_EOL . PHP_EOL . + ' This document is based on a ruleset xml-file, that ' . + 'was taken from the original source of the `PMD`__ ' . + 'project. This means that most parts of the content ' . + 'on this page are the intellectual work of the PMD ' . + 'community and its contributors and not of the PHPMD ' . + 'project.' . + PHP_EOL . PHP_EOL . + '__ http://pmd.sourceforge.net/' . + PHP_EOL; + + return $content; +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/AbstractTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/AbstractTest.php new file mode 100644 index 0000000..63bba75 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/AbstractTest.php @@ -0,0 +1,562 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD; + +use PHPMD\Node\ClassNode; +use PHPMD\Node\FunctionNode; +use PHPMD\Node\InterfaceNode; +use PHPMD\Node\MethodNode; +use PHPMD\Stubs\RuleStub; + +/** + * Abstract base class for PHPMD test cases. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ +abstract class AbstractTest extends \PHPUnit_Framework_TestCase +{ + /** + * Directory with test files. + * + * @var string $_filesDirectory + */ + private static $filesDirectory = null; + + /** + * Original directory is used to reset a changed working directory. + * + * @return void + */ + private static $originalWorkingDirectory = null; + + /** + * Temporary files created by a test. + * + * @var array(string) + */ + private static $tempFiles = array(); + + /** + * Resets a changed working directory. + * + * @return void + */ + protected function tearDown() + { + if (self::$originalWorkingDirectory !== null) { + chdir(self::$originalWorkingDirectory); + } + self::$originalWorkingDirectory = null; + + foreach (self::$tempFiles as $tempFile) { + unlink($tempFile); + } + self::$tempFiles = array(); + + parent::tearDown(); + } + + /** + * Returns the first class found in a source file related to the calling + * test method. + * + * @return \PHPMD\Node\ClassNode + */ + protected function getClass() + { + return new ClassNode( + $this->getNodeForCallingTestCase( + $this->parseTestCaseSource()->getClasses() + ) + ); + } + + /** + * Returns the first interface found in a source file related to the calling + * test method. + * + * @return \PHPMD\Node\InterfaceNode + */ + protected function getInterface() + { + return new InterfaceNode( + $this->getNodeForCallingTestCase( + $this->parseTestCaseSource()->getInterfaces() + ) + ); + } + + /** + * Returns the first method found in a source file related to the calling + * test method. + * + * @return \PHPMD\Node\MethodNode + */ + protected function getMethod() + { + return new MethodNode( + $this->getNodeForCallingTestCase( + $this->parseTestCaseSource() + ->getTypes() + ->current() + ->getMethods() + ) + ); + } + + /** + * Returns the first function found in a source files related to the calling + * test method. + * + * @return \PHPMD\Node\FunctionNode + */ + protected function getFunction() + { + return new FunctionNode( + $this->getNodeForCallingTestCase( + $this->parseTestCaseSource()->getFunctions() + ) + ); + } + + /** + * Returns the absolute path for a test resource for the current test. + * + * @return string + * @since 1.1.0 + */ + protected static function createCodeResourceUriForTest() + { + $frame = self::getCallingTestCase(); + return self::createResourceUriForTest($frame['function'] . '.php'); + } + + /** + * Returns the absolute path for a test resource for the current test. + * + * @param string $localPath The local/relative file location + * + * @return string + * @since 1.1.0 + */ + protected static function createResourceUriForTest($localPath) + { + $frame = self::getCallingTestCase(); + + $regexp = '([a-z]([0-9]+)Test$)i'; + if (preg_match($regexp, $frame['class'], $match)) { + $parts = explode('\\', $frame['class']); + $testPath = $parts[count($parts) - 2] . '/' . $match[1]; + } else { + $testPath = strtr(substr($frame['class'], 6, -4), '\\', '/'); + } + + return sprintf( + '%s/../../resources/files/%s/%s', + dirname(__FILE__), + $testPath, + $localPath + ); + } + + /** + * Parses the source code for the calling test method and returns the first + * package node found in the parsed file. + * + * @return PHP_Depend_Code_Package + */ + private function parseTestCaseSource() + { + return $this->parseSource($this->createCodeResourceUriForTest()); + } + + /** + * Returns the trace frame of the calling test case. + * + * @return array + */ + private static function getCallingTestCase() + { + foreach (debug_backtrace() as $frame) { + if (strpos($frame['function'], 'test') === 0) { + return $frame; + } + } + throw new \ErrorException('Cannot locate calling test case.'); + } + + /** + * Returns the PHP_Depend node for the calling test case. + * + * @param \Iterator $nodes + * @return PHP_Depend_Code_AbstractItem + */ + private function getNodeForCallingTestCase(\Iterator $nodes) + { + $frame = $this->getCallingTestCase(); + foreach ($nodes as $node) { + if ($node->getName() === $frame['function']) { + return $node; + } + } + throw new \ErrorException('Cannot locate node for test case.'); + } + + /** + * Parses the source of the given file and returns the first package found + * in that file. + * + * @param string $sourceFile + * @return PHP_Depend_Code_Package + */ + private function parseSource($sourceFile) + { + if (file_exists($sourceFile) === false) { + throw new \ErrorException('Cannot locate source file: ' . $sourceFile); + } + + $tokenizer = new \PDepend\Source\Language\PHP\PHPTokenizerInternal(); + $tokenizer->setSourceFile($sourceFile); + + $builder = new \PDepend\Source\Language\PHP\PHPBuilder(); + + $parser = new \PDepend\Source\Language\PHP\PHPParserGeneric( + $tokenizer, + $builder, + new \PDepend\Util\Cache\Driver\MemoryCacheDriver() + ); + $parser->parse(); + + return $builder->getNamespaces()->current(); + } + + /** + * Creates a mocked class node instance. + * + * @param string $metric + * @param mixed $value + * @return \PHPMD\Node\ClassNode + */ + protected function getClassMock($metric = null, $value = null) + { + $class = $this->getMock( + 'PHPMD\\Node\\ClassNode', + array(), + array(null), + '', + false + ); + + if ($metric !== null) { + $class->expects($this->atLeastOnce()) + ->method('getMetric') + ->with($this->equalTo($metric)) + ->will($this->returnValue($value)); + } + return $class; + } + + /** + * Creates a mocked method node instance. + * + * @param string $metric + * @param mixed $value + * @return \PHPMD\Node\MethodNode + */ + protected function getMethodMock($metric = null, $value = null) + { + return $this->initFunctionOrMethod( + $this->getMock('PHPMD\\Node\\MethodNode', array(), array(null), '', false), + $metric, + $value + ); + } + + /** + * Creates a mocked function node instance. + * + * @param string $metric The metric acronym used by PHP_Depend. + * @param mixed $value The expected metric return value. + * + * @return \PHPMD\Node\FunctionNode + */ + protected function createFunctionMock($metric = null, $value = null) + { + return $this->initFunctionOrMethod( + $this->getMock('PHPMD\\Node\\FunctionNode', array(), array(null), '', false), + $metric, + $value + ); + } + + /** + * Initializes the getMetric() method of the given function or method node. + * + * @param \PHPMD\Node\FunctionNode|\PHPMD\Node\MethodNode $mock + * @param string $metric + * @param mixed $value + * @return \PHPMD\Node\FunctionNode|\PHPMD\Node\MethodNode + */ + protected function initFunctionOrMethod($mock, $metric, $value) + { + if ($metric === null) { + return $mock; + } + + $mock->expects($this->atLeastOnce()) + ->method('getMetric') + ->with($this->equalTo($metric)) + ->will($this->returnValue($value)); + + return $mock; + } + + /** + * Creates a mocked report instance. + * + * @param integer $expectedInvokes Number of expected invokes. + * + * @return \PHPMD\Report + */ + protected function getReportMock($expectedInvokes = -1) + { + $expects = null; + if ($expectedInvokes < 0) { + $expects = $this->atLeastOnce(); + } elseif ($expectedInvokes === 0) { + $expects = $this->never(); + } elseif ($expectedInvokes === 1) { + $expects = $this->once(); + } else { + $expects = $this->exactly($expectedInvokes); + } + + $report = $this->getMock('PHPMD\\Report'); + $report->expects($expects) + ->method('addRuleViolation'); + + return $report; + } + + /** + * Creates a mocked {@link \PHPMD\AbstractRule} instance. + * + * @return \PHPMD\AbstractRule + */ + protected function getRuleMock() + { + return $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + } + + /** + * Creates a mocked rule-set instance. + * + * @param string $expectedClass Optional class name for apply() expected at least once. + * @param mixed $count How often should apply() be called? + * @return \PHPMD\RuleSet + */ + protected function getRuleSetMock($expectedClass = null, $count = '*') + { + $ruleSet = $this->getMock('PHPMD\RuleSet'); + if ($expectedClass === null) { + $ruleSet->expects($this->never())->method('apply'); + } else { + $ruleSet->expects( + $count === '*' ? $this->atLeastOnce() : $this->exactly($count) + ) + ->method('apply') + ->with($this->isInstanceOf($expectedClass)); + } + return $ruleSet; + } + + /** + * Creates a mocked rul violation instance. + * + * @param string $fileName + * @param integer $beginLine + * @param integer $endLine + * @param object $rule + * @return \PHPMD\RuleViolation + */ + protected function getRuleViolationMock( + $fileName = '/foo/bar.php', + $beginLine = 23, + $endLine = 42, + $rule = null + ) { + $ruleViolation = $this->getMock( + 'PHPMD\\RuleViolation', + array(), + array(null, null, null), + '', + false + ); + + if ($rule === null) { + $rule = new RuleStub(); + } + + $ruleViolation->expects($this->any()) + ->method('getRule') + ->will($this->returnValue($rule)); + $ruleViolation->expects($this->any()) + ->method('getFileName') + ->will($this->returnValue($fileName)); + $ruleViolation->expects($this->any()) + ->method('getBeginLine') + ->will($this->returnValue($beginLine)); + $ruleViolation->expects($this->any()) + ->method('getEndLine') + ->will($this->returnValue($endLine)); + $ruleViolation->expects($this->any()) + ->method('getNamespaceName') + ->will($this->returnValue('TestStubPackage')); + $ruleViolation->expects($this->any()) + ->method('getDescription') + ->will($this->returnValue('Test description')); + + return $ruleViolation; + } + + /** + * Asserts the actual xml output matches against the expected file. + * + * @param string $actualOutput Generated xml output. + * @param string $expectedFileName File with expected xml result. + * + * @return void + */ + public static function assertXmlEquals($actualOutput, $expectedFileName) + { + $actual = simplexml_load_string($actualOutput); + // Remove dynamic timestamp and duration attribute + if (isset($actual['timestamp'])) { + $actual['timestamp'] = ''; + } + if (isset($actual['duration'])) { + $actual['duration'] = ''; + } + if (isset($actual['version'])) { + $actual['version'] = '@package_version@'; + } + + $expected = str_replace( + '#{rootDirectory}', + self::$filesDirectory, + file_get_contents(self::createFileUri($expectedFileName)) + ); + + self::assertXmlStringEqualsXmlString($expected, $actual->saveXML()); + } + + /** + * This method initializes the test environment, it configures the files + * directory and sets the include_path for svn versions. + * + * @return void + */ + public static function setUpBeforeClass() + { + self::$filesDirectory = realpath(__DIR__ . '/../../resources/files'); + + if (false === strpos(get_include_path(), self::$filesDirectory)) { + set_include_path( + sprintf( + '%s%s%s%s%s', + get_include_path(), + PATH_SEPARATOR, + self::$filesDirectory, + PATH_SEPARATOR, + realpath(__DIR__ . '/../') + ) + ); + } + + // Prevent timezone warnings if no default TZ is set (PHP > 5.1.0) + date_default_timezone_set('UTC'); + } + + /** + * Changes the working directory for a single test. + * + * @param string $localPath The temporary working directory. + * + * @return void + */ + protected static function changeWorkingDirectory($localPath = '') + { + self::$originalWorkingDirectory = getcwd(); + + if (0 === preg_match('(^([A-Z]:|/))', $localPath)) { + $localPath = self::createFileUri($localPath); + } + chdir($localPath); + } + + /** + * Creates a full filename for a test content in the _files directory. + * + * @param string $localPath + * @return string + */ + protected static function createFileUri($localPath = '') + { + return self::$filesDirectory . '/' . $localPath; + } + + /** + * Creates a file uri for a temporary test file. + * + * @return string + */ + protected static function createTempFileUri() + { + return (self::$tempFiles[] = tempnam(sys_get_temp_dir(), 'phpmd.')); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/CommandLineInputFileOptionTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/CommandLineInputFileOptionTest.php new file mode 100644 index 0000000..b079c41 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/CommandLineInputFileOptionTest.php @@ -0,0 +1,119 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 1.1.0 + */ + +namespace PHPMD\Integration; + +use PHPMD\AbstractTest; +use PHPMD\TextUI\Command; + +/** + * Integration tests for the command line option --inputfile. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 1.1.0 + * + * @group phpmd + * @group phpmd::integration + * @group integrationtest + */ +class CommandLineInputFileOptionTest extends AbstractTest +{ + /** + * testReportContainsExpectedRuleViolationWarning + * + * @return void + * @outputBuffering enabled + */ + public function testReportContainsExpectedRuleViolationWarning() + { + self::assertContains( + "Avoid unused local variables such as '\$foo'.", + self::runCommandLine() + ); + } + + /** + * testReportNotContainsRuleViolationWarningForFileNotInList + * + * @return void + * @outputBuffering enabled + */ + public function testReportNotContainsRuleViolationWarningForFileNotInList() + { + self::assertNotContains( + "Avoid unused local variables such as '\$bar'.", + self::runCommandLine() + ); + } + + /** + * Runs the PHPMD command line interface and returns the report content. + * + * @return string + */ + protected static function runCommandLine() + { + $inputfile = self::createResourceUriForTest('inputfile.txt'); + $reportfile = self::createTempFileUri(); + + self::changeWorkingDirectory(dirname($inputfile)); + + Command::main( + array( + __FILE__, + 'text', + 'unusedcode', + '--reportfile', + $reportfile, + '--inputfile', + $inputfile + ) + ); + return file_get_contents($reportfile); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/CouplingBetweenObjectsIntegrationTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/CouplingBetweenObjectsIntegrationTest.php new file mode 100644 index 0000000..6e2b245 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/CouplingBetweenObjectsIntegrationTest.php @@ -0,0 +1,93 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 1.1.0 + */ + +namespace PHPMD\Integration; + +use PHPMD\AbstractTest; +use PHPMD\TextUI\Command; + +/** + * Integration tests for the coupling between objects rule class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 1.1.0 + * + * @group phpmd + * @group phpmd::integration + * @group integrationtest + */ +class CouplingBetweenObjectsIntegrationTest extends AbstractTest +{ + /** + * testReportContainsCouplingBetweenObjectsWarning + * + * @return void + * @outputBuffering enabled + */ + public function testReportContainsCouplingBetweenObjectsWarning() + { + $file = self::createTempFileUri(); + + Command::main( + array( + __FILE__, + $this->createCodeResourceUriForTest(), + 'text', + 'design', + '--reportfile', + $file + ) + ); + + self::assertContains( + 'has a coupling between objects value of 14. ' . + 'Consider to reduce the number of dependencies under 13.', + file_get_contents($file) + ); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/GotoStatementIntegrationTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/GotoStatementIntegrationTest.php new file mode 100644 index 0000000..d52f64e --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Integration/GotoStatementIntegrationTest.php @@ -0,0 +1,89 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 1.1.0 + */ + +namespace PHPMD\Integration; + +use PHPMD\AbstractTest; +use PHPMD\TextUI\Command; + +/** + * Test case for the goto statement GotoStatementIntegrationTest. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 1.1.0 + * + * @group phpmd + * @group phpmd::integration + * @group integrationtest + */ +class GotoStatementIntegrationTest extends AbstractTest +{ + /** + * testReportContainsGotoStatementWarning + * + * @return void + * @outputBuffering enabled + */ + public function testReportContainsGotoStatementWarning() + { + $file = self::createTempFileUri(); + + Command::main( + array( + __FILE__, + $this->createCodeResourceUriForTest(), + 'text', + 'design', + '--reportfile', + $file + ) + ); + + self::assertContains('utilizes a goto statement.', file_get_contents($file)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/ASTNodeTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/ASTNodeTest.php new file mode 100644 index 0000000..7845779 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/ASTNodeTest.php @@ -0,0 +1,134 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Node; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Node\ASTNode} class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Node\ASTNode + * @group phpmd + * @group phpmd::node + * @group unittest + */ +class ASTNodeTest extends AbstractTest +{ + /** + * testGetImageDelegatesToGetImageMethodOfWrappedNode + * + * @return void + */ + public function testGetImageDelegatesToGetImageMethodOfWrappedNode() + { + $mock = $this->getMock('PDepend\Source\AST\ASTNode'); + $mock->expects($this->once()) + ->method('getImage'); + + $node = new ASTNode($mock, __FILE__); + $node->getImage(); + } + + /** + * testGetNameDelegatesToGetImageMethodOfWrappedNode + * + * @return void + */ + public function testGetNameDelegatesToGetImageMethodOfWrappedNode() + { + $mock = $this->getMock('PDepend\Source\AST\ASTNode'); + $mock->expects($this->once()) + ->method('getImage'); + + $node = new ASTNode($mock, __FILE__); + $node->getName(); + } + + /** + * testHasSuppressWarningsAnnotationForAlwaysReturnsFalse + * + * @return void + */ + public function testHasSuppressWarningsAnnotationForAlwaysReturnsFalse() + { + $mock = $this->getMock('PDepend\Source\AST\ASTNode'); + + $node = new ASTNode($mock, __FILE__); + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + + $this->assertFalse($node->hasSuppressWarningsAnnotationFor($rule)); + } + + /** + * testGetParentNameReturnsNull + * + * @return void + */ + public function testGetParentNameReturnsNull() + { + $mock = $this->getMock('PDepend\Source\AST\ASTNode'); + $node = new ASTNode($mock, __FILE__); + + $this->assertNull($node->getParentName()); + } + + /** + * testGetNamespaceNameReturnsNull + * + * @return void + */ + public function testGetNamespaceNameReturnsNull() + { + $mock = $this->getMock('PDepend\Source\AST\ASTNode'); + $node = new ASTNode($mock, __FILE__); + + $this->assertNull($node->getNamespaceName()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/AnnotationTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/AnnotationTest.php new file mode 100644 index 0000000..0c8506b --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/AnnotationTest.php @@ -0,0 +1,149 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Node; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Node\Annotation} class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Node\Annotation + * @group phpmd + * @group phpmd::node + * @group unittest + */ +class AnnotationTest extends AbstractTest +{ + /** + * testAnnotationReturnsFalseWhenNoSuppressWarningAnnotationExists + * + * @return void + */ + public function testAnnotationReturnsFalseWhenNoSuppressWarningAnnotationExists() + { + $annotation = new Annotation('NoSuppressWarning', 'PMD'); + $this->assertFalse($annotation->suppresses($this->getRuleMock())); + } + + /** + * testAnnotationReturnsFalseWhenSuppressWarningContainsInvalidValue + * + * @return void + */ + public function testAnnotationReturnsFalseWhenSuppressWarningContainsInvalidValue() + { + $annotation = new Annotation('SuppressWarnings', 'PHP'); + $this->assertFalse($annotation->suppresses($this->getRuleMock())); + } + + /** + * testAnnotationReturnsTrueWhenSuppressWarningContainsWithPMD + * + * @return void + */ + public function testAnnotationReturnsTrueWhenSuppressWarningContainsWithPMD() + { + $annotation = new Annotation('SuppressWarnings', 'PMD'); + $this->assertTrue($annotation->suppresses($this->getRuleMock())); + } + + /** + * testAnnotationReturnsTrueWhenSuppressWarningContainsWithPHPMD + * + * @return void + */ + public function testAnnotationReturnsTrueWhenSuppressWarningContainsWithPHPMD() + { + $annotation = new Annotation('SuppressWarnings', 'PHPMD'); + $this->assertTrue($annotation->suppresses($this->getRuleMock())); + } + + /** + * testAnnotationReturnsTrueWhenSuppressWarningContainsPMDPlusRuleName + * + * @return void + */ + public function testAnnotationReturnsTrueWhenSuppressWarningContainsPMDPlusRuleName() + { + $rule = $this->getRuleMock(); + $rule->setName('UnusedCodeRule'); + + $annotation = new Annotation('SuppressWarnings', 'PMD.UnusedCodeRule'); + $this->assertTrue($annotation->suppresses($rule)); + } + + /** + * testAnnotationReturnsTrueWhenSuppressWarningContainsPHPMDPlusRuleName + * + * @return void + */ + public function testAnnotationReturnsTrueWhenSuppressWarningContainsPHPMDPlusRuleName() + { + $rule = $this->getRuleMock(); + $rule->setName('UnusedCodeRule'); + + $annotation = new Annotation('SuppressWarnings', 'PHPMD.UnusedCodeRule'); + $this->assertTrue($annotation->suppresses($rule)); + } + + /** + * testAnnotationReturnsTrueWhenSuppressWarningContainsPartialRuleName + * + * @return void + */ + public function testAnnotationReturnsTrueWhenSuppressWarningContainsPartialRuleName() + { + $rule = $this->getRuleMock(); + $rule->setName('UnusedCodeRule'); + + $annotation = new Annotation('SuppressWarnings', 'unused'); + $this->assertTrue($annotation->suppresses($rule)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/AnnotationsTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/AnnotationsTest.php new file mode 100644 index 0000000..a0e169a --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/AnnotationsTest.php @@ -0,0 +1,140 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Node; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Node\Annotations} class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Node\Annotations + * @group phpmd + * @group phpmd::node + * @group unittest + */ +class AnnotationsTest extends AbstractTest +{ + /** + * testCollectionReturnsFalseWhenNoAnnotationExists + * + * @return void + */ + public function testCollectionReturnsFalseWhenNoAnnotationExists() + { + $annotations = new Annotations($this->getClassMock()); + $this->assertFalse($annotations->suppresses($this->getRuleMock())); + } + + /** + * testCollectionReturnsFalseWhenNoMatchingAnnotationExists + * + * @return void + */ + public function testCollectionReturnsFalseWhenNoMatchingAnnotationExists() + { + $class = $this->getClassMock(); + $class->expects($this->once()) + ->method('__call') + ->with($this->equalTo('getDocComment')) + ->will( + $this->returnValue( + '/** + * @SuppressWarnings("Foo") + * @SuppressWarnings("Bar") + * @SuppressWarnings("Baz") + */' + ) + ); + + $annotations = new Annotations($class); + $this->assertFalse($annotations->suppresses($this->getRuleMock())); + } + + /** + * testCollectionReturnsTrueWhenMatchingAnnotationExists + * + * @return void + */ + public function testCollectionReturnsTrueWhenMatchingAnnotationExists() + { + $class = $this->getClassMock(); + $class->expects($this->once()) + ->method('__call') + ->with($this->equalTo('getDocComment')) + ->will($this->returnValue('/** @SuppressWarnings("PMD") */')); + + $annotations = new Annotations($class); + $this->assertTrue($annotations->suppresses($this->getRuleMock())); + } + + /** + * testCollectionReturnsTrueWhenOneMatchingAnnotationExists + * + * @return void + */ + public function testCollectionReturnsTrueWhenOneMatchingAnnotationExists() + { + $class = $this->getClassMock(); + $class->expects($this->once()) + ->method('__call') + ->with($this->equalTo('getDocComment')) + ->will( + $this->returnValue( + '/** + * @SuppressWarnings("FooBar") + * @SuppressWarnings("PMD") + */' + ) + ); + + $annotations = new Annotations($class); + $this->assertTrue($annotations->suppresses($this->getRuleMock())); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/ClassNodeTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/ClassNodeTest.php new file mode 100644 index 0000000..1be170e --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/ClassNodeTest.php @@ -0,0 +1,96 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Node; + +use PHPMD\AbstractTest; + +/** + * Test case for the class node implementation. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Node\ClassNode + * @covers \PHPMD\Node\AbstractTypeNode + * @group phpmd + * @group phpmd::node + * @group unittest + */ +class ClassNodeTest extends AbstractTest +{ + /** + * testGetMethodNamesReturnsExpectedResult + * + * @return void + */ + public function testGetMethodNamesReturnsExpectedResult() + { + $class = new \PDepend\Source\AST\ASTClass(null); + $class->addMethod(new \PDepend\Source\AST\ASTMethod(__CLASS__)); + $class->addMethod(new \PDepend\Source\AST\ASTMethod(__FUNCTION__)); + + $node = new ClassNode($class); + $this->assertEquals(array(__CLASS__, __FUNCTION__), $node->getMethodNames()); + } + + /** + * testHasSuppressWarningsAnnotationForReturnsTrue + * + * @return void + */ + public function testHasSuppressWarningsAnnotationForReturnsTrue() + { + $class = new \PDepend\Source\AST\ASTClass(null); + $class->setDocComment('/** @SuppressWarnings("PMD") */'); + + $rule = $this->getMock('PHPMD\\AbstractRule'); + + $node = new ClassNode($class); + + $this->assertTrue($node->hasSuppressWarningsAnnotationFor($rule)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/FunctionTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/FunctionTest.php new file mode 100644 index 0000000..a766d16 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/FunctionTest.php @@ -0,0 +1,92 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Node; + +use PDepend\Source\AST\ASTFunction; +use PHPMD\AbstractTest; + +/** + * Test case for the function node implementation. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Node\FunctionNode + * @covers \PHPMD\Node\AbstractCallableNode + * @group phpmd + * @group phpmd::node + * @group unittest + */ +class FunctionNodeTest extends AbstractTest +{ + /** + * testMagicCallDelegatesToWrappedPHPDependFunction + * + * @return void + */ + public function testMagicCallDelegatesToWrappedPHPDependFunction() + { + $function = $this->getMock('PDepend\\Source\\AST\\ASTFunction', array(), array(null)); + $function->expects($this->once()) + ->method('getStartLine'); + + $node = new FunctionNode($function); + $node->getStartLine(); + } + + /** + * testMagicCallThrowsExceptionWhenNoMatchingMethodExists + * + * @return void + * @expectedException BadMethodCallException + */ + public function testMagicCallThrowsExceptionWhenNoMatchingMethodExists() + { + $node = new FunctionNode(new ASTFunction(null)); + $node->getFooBar(); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/MethodNodeTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/MethodNodeTest.php new file mode 100644 index 0000000..b098ee3 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Node/MethodNodeTest.php @@ -0,0 +1,219 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Node; + +use PHPMD\AbstractTest; + +/** + * Test case for the method node implementation. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Node\MethodNode + * @covers \PHPMD\Node\AbstractCallableNode + * @group phpmd + * @group phpmd::node + * @group unittest + */ +class MethodNodeTest extends AbstractTest +{ + /** + * testMagicCallDelegatesToWrappedPHPDependMethod + * + * @return void + */ + public function testMagicCallDelegatesToWrappedPHPDependMethod() + { + $method = $this->getMock('PDepend\\Source\\AST\\ASTMethod', array(), array(null)); + $method->expects($this->once()) + ->method('getStartLine'); + + $node = new MethodNode($method); + $node->getStartLine(); + } + + /** + * testMagicCallThrowsExceptionWhenNoMatchingMethodExists + * + * @return void + * @expectedException \BadMethodCallException + */ + public function testMagicCallThrowsExceptionWhenNoMatchingMethodExists() + { + $node = new MethodNode(new \PDepend\Source\AST\ASTMethod(null)); + $node->getFooBar(); + } + + /** + * testGetParentTypeReturnsInterfaceForInterfaceMethod + * + * @return void + */ + public function testGetParentTypeReturnsInterfaceForInterfaceMethod() + { + $this->assertInstanceOf( + 'PHPMD\\Node\\InterfaceNode', + $this->getMethod()->getParentType() + ); + } + + /** + * testGetParentTypeReturnsClassForClassMethod + * + * @return void + */ + public function testGetParentTypeReturnsClassForClassMethod() + { + $this->assertInstanceOf( + 'PHPMD\\Node\\ClassNode', + $this->getMethod()->getParentType() + ); + } + + /** + * testHasSuppressWarningsExecutesDefaultImplementation + * + * @return void + */ + public function testHasSuppressWarningsExecutesDefaultImplementation() + { + $rule = $this->getRuleMock(); + $rule->setName('FooBar'); + + $method = $this->getMethod(); + $this->assertTrue($method->hasSuppressWarningsAnnotationFor($rule)); + } + + /** + * testHasSuppressWarningsDelegatesToParentClassMethod + * + * @return void + */ + public function testHasSuppressWarningsDelegatesToParentClassMethod() + { + $rule = $this->getRuleMock(); + $rule->setName('FooBar'); + + $method = $this->getMethod(); + $this->assertTrue($method->hasSuppressWarningsAnnotationFor($rule)); + } + + /** + * testHasSuppressWarningsDelegatesToParentInterfaceMethod + * + * @return void + */ + public function testHasSuppressWarningsDelegatesToParentInterfaceMethod() + { + $rule = $this->getRuleMock(); + $rule->setName('FooBar'); + + $method = $this->getMethod(); + $this->assertTrue($method->hasSuppressWarningsAnnotationFor($rule)); + } + + /** + * testIsDeclarationReturnsTrueForMethodDeclaration + * + * @return void + * @since 1.2.1 + */ + public function testIsDeclarationReturnsTrueForMethodDeclaration() + { + $method = $this->getMethod(); + $this->assertTrue($method->isDeclaration()); + } + + /** + * testIsDeclarationReturnsTrueForMethodDeclarationWithParent + * + * @return void + * @since 1.2.1 + */ + public function testIsDeclarationReturnsTrueForMethodDeclarationWithParent() + { + $method = $this->getMethod(); + $this->assertTrue($method->isDeclaration()); + } + + /** + * testIsDeclarationReturnsFalseForInheritMethodDeclaration + * + * @return void + * @since 1.2.1 + */ + public function testIsDeclarationReturnsFalseForInheritMethodDeclaration() + { + $method = $this->getMethod(); + $this->assertFalse($method->isDeclaration()); + } + + /** + * testIsDeclarationReturnsFalseForImplementedAbstractMethod + * + * @return void + * @since 1.2.1 + */ + public function testIsDeclarationReturnsFalseForImplementedAbstractMethod() + { + $method = $this->getMethod(); + $this->assertFalse($method->isDeclaration()); + } + + /** + * testIsDeclarationReturnsFalseForImplementedInterfaceMethod + * + * @return void + * @since 1.2.1 + */ + public function testIsDeclarationReturnsFalseForImplementedInterfaceMethod() + { + $method = $this->getMethod(); + $this->assertFalse($method->isDeclaration()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/PMDTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/PMDTest.php new file mode 100644 index 0000000..1c2068b --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/PMDTest.php @@ -0,0 +1,195 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD; + +use PHPMD\Renderer\XMLRenderer; +use PHPMD\Stubs\WriterStub; + +/** + * Test case for the main PHPMD class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\PHPMD + * @group phpmd + * @group unittest + */ +class PHPMDTest extends AbstractTest +{ + /** + * Tests the main PHPMD interface with default settings an a xml-renderer. + * + * @return void + */ + public function testRunWithDefaultSettingsAndXmlRenderer() + { + self::changeWorkingDirectory(); + + $writer = new WriterStub(); + + $renderer = new XMLRenderer(); + $renderer->setWriter($writer); + + $phpmd = new PHPMD(); + $phpmd->processFiles( + self::createFileUri('source/ccn_function.php'), + 'pmd-refset1', + array($renderer), + new RuleSetFactory() + ); + + $this->assertXmlEquals($writer->getData(), 'pmd/default-xml.xml'); + } + + /** + * testRunWithDefaultSettingsAndXmlRendererAgainstSingleFile + * + * @return void + */ + public function testRunWithDefaultSettingsAndXmlRendererAgainstDirectory() + { + self::changeWorkingDirectory(); + + $writer = new WriterStub(); + + $renderer = new XMLRenderer(); + $renderer->setWriter($writer); + + $phpmd = new PHPMD(); + $phpmd->processFiles( + self::createFileUri('source'), + 'pmd-refset1', + array($renderer), + new RuleSetFactory() + ); + + $this->assertXmlEquals($writer->getData(), 'pmd/single-directory.xml'); + } + + /** + * testRunWithDefaultSettingsAndXmlRendererAgainstSingleFile + * + * @return void + */ + public function testRunWithDefaultSettingsAndXmlRendererAgainstSingleFile() + { + self::changeWorkingDirectory(); + + $writer = new WriterStub(); + + $renderer = new XMLRenderer(); + $renderer->setWriter($writer); + + $phpmd = new PHPMD(); + $phpmd->processFiles( + self::createFileUri('source/ccn_function.php'), + 'pmd-refset1', + array($renderer), + new RuleSetFactory() + ); + + $this->assertXmlEquals($writer->getData(), 'pmd/single-file.xml'); + } + + /** + * testHasViolationsReturnsFalseByDefault + * + * @return void + */ + public function testHasViolationsReturnsFalseByDefault() + { + $phpmd = new PHPMD(); + $this->assertFalse($phpmd->hasViolations()); + } + + /** + * testHasViolationsReturnsFalseForSourceWithoutViolations + * + * @return void + */ + public function testHasViolationsReturnsFalseForSourceWithoutViolations() + { + self::changeWorkingDirectory(); + + $renderer = new XMLRenderer(); + $renderer->setWriter(new WriterStub()); + + $phpmd = new PHPMD(); + $phpmd->processFiles( + self::createFileUri('source/source_without_violations.php'), + 'pmd-refset1', + array($renderer), + new RuleSetFactory() + ); + + $this->assertFalse($phpmd->hasViolations()); + } + + /** + * testHasViolationsReturnsTrueForSourceWithViolation + * + * @return void + */ + public function testHasViolationsReturnsTrueForSourceWithViolation() + { + self::changeWorkingDirectory(); + + $renderer = new XMLRenderer(); + $renderer->setWriter(new WriterStub()); + + $phpmd = new PHPMD(); + $phpmd->processFiles( + self::createFileUri('source/source_with_npath_violation.php'), + 'pmd-refset1', + array($renderer), + new RuleSetFactory() + ); + + $this->assertTrue($phpmd->hasViolations()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/ParserFactoryTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/ParserFactoryTest.php new file mode 100644 index 0000000..5bc3fd5 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/ParserFactoryTest.php @@ -0,0 +1,198 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD; + +/** + * Test case for the parser factory class. + * + * @author Manuel Pichler + * @copyright 2009 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\ParserFactory + * @group phpmd + * @group unittest + */ +class ParserFactoryTest extends AbstractTest +{ + /** + * testFactoryConfiguresInputDirectory + * + * @return void + */ + public function testFactoryConfiguresInputDirectory() + { + $factory = new ParserFactory(); + + $uri = $this->createFileUri('ParserFactory/Directory'); + + $phpmd = $this->getMock('PHPMD\\PHPMD', array('getInput')); + $phpmd->expects($this->once()) + ->method('getInput') + ->will($this->returnValue($uri)); + + $ruleSet = $this->getRuleSetMock('PHPMD\\Node\\ClassNode'); + + $parser = $factory->create($phpmd); + $parser->addRuleSet($ruleSet); + $parser->parse($this->getReportMock(0)); + } + + /** + * testFactoryConfiguresInputFile + * + * @return void + */ + public function testFactoryConfiguresInputFile() + { + $factory = new ParserFactory(); + + $uri = $this->createFileUri('ParserFactory/File/Test.php'); + + $phpmd = $this->getMock('PHPMD\\PHPMD', array('getInput')); + $phpmd->expects($this->once()) + ->method('getInput') + ->will($this->returnValue($uri)); + + $ruleSet = $this->getRuleSetMock('PHPMD\\Node\\ClassNode'); + + $parser = $factory->create($phpmd); + $parser->addRuleSet($ruleSet); + $parser->parse($this->getReportMock(0)); + } + + /** + * testFactoryConfiguresMultipleInputDirectories + * + * @return void + */ + public function testFactoryConfiguresMultipleInputDirectories() + { + $factory = new ParserFactory(); + + $uri1 = $this->createFileUri('ParserFactory/File'); + $uri2 = $this->createFileUri('ParserFactory/Directory'); + + $phpmd = $this->getMock('PHPMD\\PHPMD', array('getInput')); + $phpmd->expects($this->once()) + ->method('getInput') + ->will($this->returnValue($uri1 . ',' . $uri2)); + + $ruleSet = $this->getRuleSetMock('PHPMD\\Node\\ClassNode', 2); + + $parser = $factory->create($phpmd); + $parser->addRuleSet($ruleSet); + $parser->parse($this->getReportMock(0)); + } + + /** + * testFactoryConfiguresMultipleInputFilesAndDirectories + * + * @return void + */ + public function testFactoryConfiguresMultipleInputFilesAndDirectories() + { + $factory = new ParserFactory(); + + $uri1 = $this->createFileUri('ParserFactory/File/Test.php'); + $uri2 = $this->createFileUri('ParserFactory/Directory'); + + $phpmd = $this->getMock('PHPMD\\PHPMD', array('getInput')); + $phpmd->expects($this->once()) + ->method('getInput') + ->will($this->returnValue($uri1 . ',' . $uri2)); + + $ruleSet = $this->getRuleSetMock('PHPMD\\Node\\ClassNode', 2); + + $parser = $factory->create($phpmd); + $parser->addRuleSet($ruleSet); + $parser->parse($this->getReportMock(0)); + } + + /** + * testFactoryConfiguresIgnorePattern + * + * @return void + */ + public function testFactoryConfiguresIgnorePattern() + { + $factory = new ParserFactory(); + + $uri = $this->createFileUri('ParserFactory/File/Test.php'); + + $phpmd = $this->getMock('PHPMD\\PHPMD', array('getIgnorePattern', 'getInput')); + $phpmd->expects($this->exactly(2)) + ->method('getIgnorePattern') + ->will($this->returnValue(array('Test'))); + $phpmd->expects($this->once()) + ->method('getInput') + ->will($this->returnValue($uri)); + + $factory->create($phpmd); + } + + /** + * testFactoryConfiguresFileExtensions + * + * @return void + */ + public function testFactoryConfiguresFileExtensions() + { + $factory = new ParserFactory(); + + $uri = $this->createFileUri('ParserFactory/File/Test.php'); + + $phpmd = $this->getMock('PHPMD\\PHPMD', array('getFileExtensions', 'getInput')); + $phpmd->expects($this->exactly(2)) + ->method('getFileExtensions') + ->will($this->returnValue(array('.php'))); + $phpmd->expects($this->once()) + ->method('getInput') + ->will($this->returnValue($uri)); + + $factory->create($phpmd); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/ParserTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/ParserTest.php new file mode 100644 index 0000000..1e6969f --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/ParserTest.php @@ -0,0 +1,259 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD; + +/** + * Test case for the PHP_Depend backend adapter class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Parser + * @group phpmd + * @group unittest + */ +class ParserTest extends AbstractTest +{ + /** + * Tests that the metrics adapter delegates a node to a registered rule-set. + * + * @return void + */ + public function testAdapterDelegatesClassNodeToRuleSet() + { + $mock = $this->getPHPDependClassMock(); + $mock->expects($this->once()) + ->method('isUserDefined') + ->will($this->returnValue(true)); + + $adapter = new \PHPMD\Parser($this->getPHPDependMock()); + $adapter->addRuleSet($this->getRuleSetMock('PHPMD\\Node\\ClassNode')); + $adapter->setReport($this->getReportMock(0)); + $adapter->visitClass($mock); + } + + /** + * Tests that the metrics adapter does not delegate a node without source + * code file to a registered rule-set. + * + * @return void + */ + public function testAdapterDoesNotDelegateNonSourceClassNodeToRuleSet() + { + $mock = $this->getPHPDependClassMock(); + $mock->expects($this->once()) + ->method('isUserDefined') + ->will($this->returnValue(false)); + + $adapter = new \PHPMD\Parser($this->getPHPDependMock()); + $adapter->addRuleSet($this->getRuleSetMock()); + $adapter->setReport($this->getReportMock(0)); + $adapter->visitClass($mock); + } + + /** + * Tests that the metrics adapter delegates a node to a registered rule-set. + * + * @return void + */ + public function testAdapterDelegatesMethodNodeToRuleSet() + { + $adapter = new \PHPMD\Parser($this->getPHPDependMock()); + $adapter->addRuleSet($this->getRuleSetMock('PHPMD\\Node\\MethodNode')); + $adapter->setReport($this->getReportMock(0)); + $adapter->visitMethod($this->getPHPDependMethodMock()); + } + + /** + * Tests that the metrics adapter does not delegate a node without source + * code file to a registered rule-set. + * + * @return void + */ + public function testAdapterDoesNotDelegateNonSourceMethodNodeToRuleSet() + { + $adapter = new \PHPMD\Parser($this->getPHPDependMock()); + $adapter->addRuleSet($this->getRuleSetMock()); + $adapter->setReport($this->getReportMock(0)); + $adapter->visitMethod($this->getPHPDependMethodMock(null)); + } + + /** + * Tests that the metrics adapter delegates a node to a registered rule-set. + * + * @return void + */ + public function testAdapterDelegatesFunctionNodeToRuleSet() + { + $adapter = new \PHPMD\Parser($this->getPHPDependMock()); + $adapter->addRuleSet($this->getRuleSetMock('PHPMD\\Node\\FunctionNode')); + $adapter->setReport($this->getReportMock(0)); + $adapter->visitFunction($this->getPHPDependFunctionMock()); + } + + /** + * Tests that the metrics adapter does not delegate a node without source + * code file to a registered rule-set. + * + * @return void + */ + public function testAdapterDoesNotDelegateNonSourceFunctionNodeToRuleSet() + { + $adapter = new \PHPMD\Parser($this->getPHPDependMock()); + $adapter->addRuleSet($this->getRuleSetMock()); + $adapter->setReport($this->getReportMock(0)); + $adapter->visitFunction($this->getPHPDependFunctionMock(null)); + } + + /** + * testParserStoreParsingExceptionsInReport + * + * @return void + * @since 1.2.1 + */ + public function testParserStoreParsingExceptionsInReport() + { + $report = $this->getReportMock(0); + $report->expects($this->once()) + ->method('addError'); + + $pdepend = $this->getPHPDependMock(); + $pdepend->expects($this->once()) + ->method('getExceptions') + ->will($this->returnValue(array( + new \PDepend\Source\Parser\InvalidStateException(42, __FILE__, 'foo') + ))); + + $parser = new \PHPMD\Parser($pdepend); + $parser->parse($report); + } + + /** + * Creates a mocked PDepend instance. + * + * @return \PDepend\Engine + */ + private function getPHPDependMock() + { + return $this->getMock('PDepend\Engine', array(), array(null), '', false); + } + + /** + * Creates a mocked PDepend class instance. + * + * @return PDepend\Source\AST\ASTClass + */ + protected function getPHPDependClassMock() + { + $class = $this->getMock('PDepend\\Source\\AST\\ASTClass', array(), array(null)); + $class->expects($this->any()) + ->method('getCompilationUnit') + ->will($this->returnValue($this->getPHPDependFileMock('foo.php'))); + $class->expects($this->any()) + ->method('getConstants') + ->will($this->returnValue(new \ArrayIterator(array()))); + $class->expects($this->any()) + ->method('getProperties') + ->will($this->returnValue(new \ArrayIterator(array()))); + $class->expects($this->any()) + ->method('getMethods') + ->will($this->returnValue(new \ArrayIterator(array()))); + + return $class; + } + + /** + * Creates a mocked PHP_Depend function instance. + * + * @param string $fileName Optional file name for the source file. + * + * @return PHP_Depend_Code_Function + */ + protected function getPHPDependFunctionMock($fileName = '/foo/bar.php') + { + $function = $this->getMock('PDepend\Source\AST\ASTFunction', array(), array(null)); + $function->expects($this->atLeastOnce()) + ->method('getCompilationUnit') + ->will($this->returnValue($this->getPHPDependFileMock($fileName))); + + return $function; + } + + /** + * Creates a mocked PHP_Depend method instance. + * + * @param string $fileName Optional file name for the source file. + * + * @return PHP_Depend_Code_CodeMethod + */ + protected function getPHPDependMethodMock($fileName = '/foo/bar.php') + { + $method = $this->getMock('PDepend\Source\AST\ASTMethod', array(), array(null)); + $method->expects($this->atLeastOnce()) + ->method('getCompilationUnit') + ->will($this->returnValue($this->getPHPDependFileMock($fileName))); + + return $method; + } + + /** + * Creates a mocked PHP_Depend file instance. + * + * @param string $fileName The temporary file name. + * + * @return PHP_Depend_Code_File + */ + protected function getPHPDependFileMock($fileName) + { + $file = $this->getMock('PDepend\Source\AST\ASTCompilationUnit', array(), array(null)); + $file->expects($this->any()) + ->method('getFileName') + ->will($this->returnValue($fileName)); + + return $file; + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/ProcessingErrorTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/ProcessingErrorTest.php new file mode 100644 index 0000000..645a514 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/ProcessingErrorTest.php @@ -0,0 +1,113 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 1.2.1 + */ + +namespace PHPMD; + +/** + * Test case for the processing error class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 1.2.1 + * + * @covers \PHPMD\ProcessingError + * @group phpmd + * @group unittest + */ +class ProcessingErrorTest extends AbstractTest +{ + /** + * testGetMessageReturnsTheExpectedValue + * + * @return void + */ + public function testGetMessageReturnsTheExpectedValue() + { + $processingError = new ProcessingError('Hello World.'); + $this->assertEquals('Hello World.', $processingError->getMessage()); + } + + /** + * Tests that the processing error class extracts the source filename from + * a given exception message, + * + * @param string $message The original exception message + * + * @return void + * @dataProvider getParserExceptionMessages + */ + public function testGetFileReturnsExpectedFileName($message) + { + $processingError = new ProcessingError($message); + $this->assertEquals('/tmp/foo.php', $processingError->getFile()); + } + + /** + * Data provider that returns common exception messages used by PHP_Depend's + * parser. + * + * @return array + */ + public function getParserExceptionMessages() + { + return array( + array( + 'The parser has reached an invalid state near line "42" in file ' . + '"/tmp/foo.php". Please check the following conditions: message' + ), + array( + 'Unexpected token: >, line: 42, col: 23, file: /tmp/foo.php.' + ), + array( + 'Unexpected end of token stream in file: /tmp/foo.php.' + ), + array( + 'Missing default value on line: 42, col: 23, file: /tmp/foo.php.' + ) + ); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/AbstractTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/AbstractTest.php new file mode 100644 index 0000000..f036058 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/AbstractTest.php @@ -0,0 +1,78 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Regression; + +/** + * Regression test for issue 001. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ +abstract class AbstractTest extends \PHPMD\AbstractTest +{ + /** + * Creates a full filename for a test content in the _files directory. + * + * @param string $localPath The local path within the _files dir. + * + * @return string + */ + protected static function createFileUri($localPath = '') + { + $trace = debug_backtrace(); + + $ticket = ''; + if (preg_match('(\D(\d+)Test$)', $trace[1]['class'], $match)) { + $ticket = $match[1]; + } + + if ($localPath === '') { + $localPath = $trace[1]['function'] . '.php'; + } + return parent::createFileUri('Regression/' . $ticket . '/' . $localPath); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/AcceptsFilesAndDirectoriesAsInputTicket001Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/AcceptsFilesAndDirectoriesAsInputTicket001Test.php new file mode 100644 index 0000000..5bda847 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/AcceptsFilesAndDirectoriesAsInputTicket001Test.php @@ -0,0 +1,107 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Regression; + +use PHPMD\PHPMD; +use PHPMD\Renderer\XMLRenderer; +use PHPMD\RuleSetFactory; +use PHPMD\Stubs\WriterStub; + +/** + * Regression test for issue 001. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \stdClass + * @group phpmd + * @group regression + */ +class AcceptsFilesAndDirectoriesAsInputTicket001Test extends AbstractTest +{ + /** + * testCliAcceptsDirectoryAsInput + * + * @return void + */ + public function testCliAcceptsDirectoryAsInput() + { + self::changeWorkingDirectory(); + + $renderer = new XMLRenderer(); + $renderer->setWriter(new WriterStub()); + + $phpmd = new PHPMD(); + $phpmd->processFiles( + self::createFileUri('source'), + 'pmd-refset1', + array($renderer), + new RuleSetFactory() + ); + } + + /** + * testCliAcceptsSingleFileAsInput + * + * @return void + */ + public function testCliAcceptsSingleFileAsInput() + { + self::changeWorkingDirectory(); + + $renderer = new XMLRenderer(); + $renderer->setWriter(new WriterStub()); + + $phpmd = new PHPMD(); + $phpmd->processFiles( + self::createFileUri('source/FooBar.php'), + 'pmd-refset1', + array($renderer), + new RuleSetFactory() + ); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/ExcessivePublicCountRuleNeverExecutedTicket015Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/ExcessivePublicCountRuleNeverExecutedTicket015Test.php new file mode 100644 index 0000000..cc56b51 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/ExcessivePublicCountRuleNeverExecutedTicket015Test.php @@ -0,0 +1,83 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Regression; + +use PHPMD\Rule\ExcessivePublicCount; +use PHPMD\RuleSet; + +/** + * Regression test for issue 015. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers stdClass + * @group phpmd + * @group regression + */ +class ExcessivePublicCountRuleNeverExecutedTicket015Test extends AbstractTest +{ + /** + * testRuleSetInvokesRuleForClassInstance + * + * @return void + */ + public function testRuleSetInvokesRuleForClassInstance() + { + $rule = new ExcessivePublicCount(); + $rule->addProperty('minimum', 3); + + $class = $this->getClass(); + $class->setMetrics(array('cis' => 4)); + + $ruleSet = new RuleSet(); + $ruleSet->addRule($rule); + $ruleSet->setReport($this->getReportMock(1)); + + $ruleSet->apply($class); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/InvalidUnusedLocalVariableAndFormalParameterTicket007Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/InvalidUnusedLocalVariableAndFormalParameterTicket007Test.php new file mode 100644 index 0000000..999cde1 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/InvalidUnusedLocalVariableAndFormalParameterTicket007Test.php @@ -0,0 +1,87 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Regression; + +use PHPMD\Rule\UnusedFormalParameter; +use PHPMD\Rule\UnusedLocalVariable; + +/** + * Regression test for issue 007. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers stdClass + * @group phpmd + * @group regression + */ +class InvalidUnusedLocalVariableAndFormalParameterTicket007Test extends AbstractTest +{ + /** + * testLocalVariableUsedInDoubleQuoteStringGetsNotReported + * + * @return void + */ + public function testLocalVariableUsedInDoubleQuoteStringGetsNotReported() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testFormalParameterUsedInDoubleQuoteStringGetsNotReported + * + * @return void + */ + public function testFormalParameterUsedInDoubleQuoteStringGetsNotReported() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/LongVariablePrivatePropertiesTicket010096717Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/LongVariablePrivatePropertiesTicket010096717Test.php new file mode 100644 index 0000000..2de7827 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/LongVariablePrivatePropertiesTicket010096717Test.php @@ -0,0 +1,93 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @link https://www.pivotaltracker.com/story/show/10096717 + */ + +namespace PHPMD\Regression; + +use PHPMD\Rule\Naming\LongVariable; + +/** + * Regression test for issue 10096717. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @link https://www.pivotaltracker.com/story/show/10096717 + * @since 1.1.0 + * + * @ticket 10096717 + * @covers stdClass + * @group phpmd + * @group phpmd::integration + * @group integrationtest + */ +class LongVariablePrivatePropertiesTicket010096717Test extends AbstractTest +{ + /** + * testRuleNotAppliesForLongPrivateProperty + * + * @return void + */ + public function testRuleNotAppliesForLongPrivateProperty() + { + $rule = new LongVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maximum', 17); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesForLongPrivateStaticProperty + * + * @return void + */ + public function testRuleNotAppliesForLongPrivateStaticProperty() + { + $rule = new LongVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maximum', 17); + $rule->apply($this->getClass()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/MaximumNestingLevelTicket24975295Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/MaximumNestingLevelTicket24975295Test.php new file mode 100644 index 0000000..bdbd14a --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/MaximumNestingLevelTicket24975295Test.php @@ -0,0 +1,91 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @link https://www.pivotaltracker.com/story/show/24975295 + * @since 1.3.1 + */ + +namespace PHPMD\Regression; + +use PHPMD\PHPMD; +use PHPMD\Renderer\TextRenderer; +use PHPMD\RuleSetFactory; +use PHPMD\Writer\StreamWriter; + +/** + * Regression test for issue 14990109. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @link https://www.pivotaltracker.com/story/show/24975295 + * @since 1.3.1 + * + * @ticket 24975295 + * @covers \stdClass + * @group phpmd + * @group phpmd::regression + * @group regressiontest + */ +class MaximumNestingLevelTicket24975295Test extends AbstractTest +{ + /** + * testLocalVariableUsedInDoubleQuoteStringGetsNotReported + * + * @return void + * @outputBuffering enabled + */ + public function testLocalVariableUsedInDoubleQuoteStringGetsNotReported() + { + $renderer = new TextRenderer(); + $renderer->setWriter(new StreamWriter(self::createTempFileUri())); + + $inputs = self::createCodeResourceUriForTest(); + $rules = 'unusedcode'; + $renderes = array($renderer); + $factory = new RuleSetFactory(); + + $phpmd = new PHPMD(); + $phpmd->processFiles($inputs, $rules, $renderes, $factory); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/StaticVariablesFlaggedAsUnusedTicket020Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/StaticVariablesFlaggedAsUnusedTicket020Test.php new file mode 100644 index 0000000..567c215 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/StaticVariablesFlaggedAsUnusedTicket020Test.php @@ -0,0 +1,74 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Regression; + +use PHPMD\Rule\UnusedLocalVariable; + +/** + * Regression test for issue 020. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \stdClass + * @group phpmd + * @group regression + */ +class StaticVariablesFlaggedAsUnusedTicket020Test extends AbstractTest +{ + /** + * testRuleDoesNotApplyToAnySuperGlobalVariable + * + * @return void + */ + public function testRuleDoesNotApplyToAnyStaticLocalVariable() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/SuperGlobalsFlaggedAsUnusedTicket019Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/SuperGlobalsFlaggedAsUnusedTicket019Test.php new file mode 100644 index 0000000..56eed72 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/SuperGlobalsFlaggedAsUnusedTicket019Test.php @@ -0,0 +1,74 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Regression; + +use PHPMD\Rule\UnusedLocalVariable; + +/** + * Regression test for issue 019. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \stdClass + * @group phpmd + * @group regression + */ +class SuperGlobalsFlaggedAsUnusedTicket019Test extends AbstractTest +{ + /** + * testRuleDoesNotApplyToAnySuperGlobalVariable + * + * @return void + */ + public function testRuleDoesNotApplyToAnySuperGlobalVariable() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/SuppressWarningsNotAppliesToUnusedPrivateMethod036Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/SuppressWarningsNotAppliesToUnusedPrivateMethod036Test.php new file mode 100644 index 0000000..95b4903 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/SuppressWarningsNotAppliesToUnusedPrivateMethod036Test.php @@ -0,0 +1,77 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Regression; + +use PHPMD\Rule\UnusedPrivateMethod; +use PHPMD\RuleSet; + +/** + * Regression test for issue 036. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers stdClass + * @group phpmd + * @group regression + */ +class SuppressWarningsNotAppliesToUnusedPrivateMethod036Test extends AbstractTest +{ + /** + * testRuleDoesNotApplyToPrivateMethodWithSuppressWarningsAnnotation + * + * @return void + */ + public function testRuleDoesNotApplyToPrivateMethodWithSuppressWarningsAnnotation() + { + $ruleSet = new RuleSet(); + $ruleSet->addRule(new UnusedPrivateMethod()); + $ruleSet->setReport($this->getReportMock(0)); + + $ruleSet->apply($this->getClass()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/UnusedParameterArgvTicket14990109Test.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/UnusedParameterArgvTicket14990109Test.php new file mode 100644 index 0000000..049f840 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Regression/UnusedParameterArgvTicket14990109Test.php @@ -0,0 +1,96 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @link https://www.pivotaltracker.com/story/show/14990109 + */ + +namespace PHPMD\Regression; + +use PHPMD\Rule\UnusedFormalParameter; +use PHPMD\RuleSet; + +/** + * Regression test for issue 14990109. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @link https://www.pivotaltracker.com/story/show/14990109 + * @since 1.1.0 + * + * @ticket 14990109 + * @covers \stdClass + * @group phpmd + * @group phpmd::regression + * @group regressiontest + */ +class UnusedParameterArgvTicket14990109Test extends AbstractTest +{ + /** + * testRuleDoesNotApplyToFunctionParameterNamedArgv + * + * @return void + */ + public function testRuleDoesNotApplyToFunctionParameterNamedArgv() + { + $ruleSet = new RuleSet(); + $ruleSet->addRule(new UnusedFormalParameter()); + $ruleSet->setReport($this->getReportMock(0)); + + $ruleSet->apply($this->getFunction()); + } + + /** + * testRuleDoesNotApplyToMethodParameterNamedArgv + * + * @return void + */ + public function testRuleDoesNotApplyToMethodParameterNamedArgv() + { + $ruleSet = new RuleSet(); + $ruleSet->addRule(new UnusedFormalParameter()); + $ruleSet->setReport($this->getReportMock(0)); + + $ruleSet->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/HTMLRendererTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/HTMLRendererTest.php new file mode 100644 index 0000000..0d979cf --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/HTMLRendererTest.php @@ -0,0 +1,147 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Renderer; + +use PHPMD\AbstractTest; +use PHPMD\ProcessingError; +use PHPMD\Stubs\WriterStub; + +/** + * Test case for the html renderer implementation. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Renderer\HTMLRenderer + * @group phpmd + * @group phpmd::renderer + * @group unittest + */ +class HTMLRendererTest extends AbstractTest +{ + /** + * testRendererCreatesExpectedNumberOfTextEntries + * + * @return void + */ + public function testRendererCreatesExpectedHtmlTableRow() + { + // Create a writer instance. + $writer = new WriterStub(); + + $violations = array( + $this->getRuleViolationMock('/bar.php', 1), + $this->getRuleViolationMock('/foo.php', 2), + $this->getRuleViolationMock('/foo.php', 3), + ); + + $report = $this->getReportMock(0); + $report->expects($this->once()) + ->method('getRuleViolations') + ->will($this->returnValue(new \ArrayIterator($violations))); + $report->expects($this->once()) + ->method('getErrors') + ->will($this->returnValue(new \ArrayIterator(array()))); + + $renderer = new HTMLRenderer(); + $renderer->setWriter($writer); + + $renderer->start(); + $renderer->renderReport($report); + $renderer->end(); + + $this->assertContains( + '' . PHP_EOL . + '2' . PHP_EOL . + '/foo.php' . PHP_EOL . + '2' . PHP_EOL . + 'Test description' . PHP_EOL . + '', + $writer->getData() + ); + } + + /** + * testRendererAddsProcessingErrorsToHtmlReport + * + * @return void + */ + public function testRendererAddsProcessingErrorsToHtmlReport() + { + // Create a writer instance. + $writer = new WriterStub(); + + $errors = array( + new ProcessingError('Failed for file "/tmp/foo.php".'), + new ProcessingError('Failed for file "/tmp/bar.php".'), + new ProcessingError('Failed for file "/tmp/baz.php".'), + ); + + $report = $this->getReportMock(0); + $report->expects($this->once()) + ->method('getRuleViolations') + ->will($this->returnValue(new \ArrayIterator(array()))); + $report->expects($this->once()) + ->method('getErrors') + ->will($this->returnValue(new \ArrayIterator($errors))); + + $renderer = new HTMLRenderer(); + $renderer->setWriter($writer); + + $renderer->start(); + $renderer->renderReport($report); + $renderer->end(); + + $this->assertContains( + '' . + '/tmp/bar.php' . + 'Failed for file "/tmp/bar.php".' . + '', + $writer->getData() + ); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/TextRendererTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/TextRendererTest.php new file mode 100644 index 0000000..f46b587 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/TextRendererTest.php @@ -0,0 +1,145 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Renderer; + +use PHPMD\AbstractTest; +use PHPMD\ProcessingError; +use PHPMD\Stubs\WriterStub; + +/** + * Test case for the text renderer implementation. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Renderer\TextRenderer + * @group phpmd + * @group phpmd::renderer + * @group unittest + */ +class TextRendererTest extends AbstractTest +{ + /** + * testRendererCreatesExpectedNumberOfTextEntries + * + * @return void + */ + public function testRendererCreatesExpectedNumberOfTextEntries() + { + // Create a writer instance. + $writer = new WriterStub(); + + $violations = array( + $this->getRuleViolationMock('/bar.php', 1), + $this->getRuleViolationMock('/foo.php', 2), + $this->getRuleViolationMock('/foo.php', 3), + ); + + $report = $this->getReportMock(0); + $report->expects($this->once()) + ->method('getRuleViolations') + ->will($this->returnValue(new \ArrayIterator($violations))); + $report->expects($this->once()) + ->method('getErrors') + ->will($this->returnValue(new \ArrayIterator(array()))); + + $renderer = new TextRenderer(); + $renderer->setWriter($writer); + + $renderer->start(); + $renderer->renderReport($report); + $renderer->end(); + + $this->assertEquals( + PHP_EOL . + "/bar.php:1\tTest description" . PHP_EOL . + "/foo.php:2\tTest description" . PHP_EOL . + "/foo.php:3\tTest description" . PHP_EOL, + $writer->getData() + ); + } + + /** + * testRendererAddsProcessingErrorsToTextReport + * + * @return void + */ + public function testRendererAddsProcessingErrorsToTextReport() + { + // Create a writer instance. + $writer = new WriterStub(); + + $errors = array( + new ProcessingError('Failed for file "/tmp/foo.php".'), + new ProcessingError('Failed for file "/tmp/bar.php".'), + new ProcessingError('Failed for file "/tmp/baz.php".'), + ); + + $report = $this->getReportMock(0); + $report->expects($this->once()) + ->method('getRuleViolations') + ->will($this->returnValue(new \ArrayIterator(array()))); + $report->expects($this->once()) + ->method('getErrors') + ->will($this->returnValue(new \ArrayIterator($errors))); + + $renderer = new TextRenderer(); + $renderer->setWriter($writer); + + $renderer->start(); + $renderer->renderReport($report); + $renderer->end(); + + $this->assertEquals( + PHP_EOL . + "/tmp/foo.php\t-\tFailed for file \"/tmp/foo.php\"." . PHP_EOL . + "/tmp/bar.php\t-\tFailed for file \"/tmp/bar.php\"." . PHP_EOL . + "/tmp/baz.php\t-\tFailed for file \"/tmp/baz.php\"." . PHP_EOL, + $writer->getData() + ); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/XMLRendererTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/XMLRendererTest.php new file mode 100644 index 0000000..1030017 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Renderer/XMLRendererTest.php @@ -0,0 +1,140 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Renderer; + +use PHPMD\AbstractTest; +use PHPMD\ProcessingError; +use PHPMD\Stubs\WriterStub; + +/** + * Test case for the xml renderer implementation. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Renderer\XMLRenderer + * @group phpmd + * @group phpmd::renderer + * @group unittest + */ +class XMLRendererTest extends AbstractTest +{ + /** + * testRendererCreatesExpectedNumberOfXmlElements + * + * @return void + */ + public function testRendererCreatesExpectedNumberOfXmlElements() + { + // Create a writer instance. + $writer = new WriterStub(); + + $violations = array( + $this->getRuleViolationMock('/bar.php'), + $this->getRuleViolationMock('/foo.php'), + $this->getRuleViolationMock('/foo.php'), + ); + + $report = $this->getReportMock(0); + $report->expects($this->once()) + ->method('getRuleViolations') + ->will($this->returnValue(new \ArrayIterator($violations))); + $report->expects($this->once()) + ->method('getErrors') + ->will($this->returnValue(new \ArrayIterator(array()))); + + $renderer = new XMLRenderer(); + $renderer->setWriter($writer); + + $renderer->start(); + $renderer->renderReport($report); + $renderer->end(); + + $this->assertXmlEquals( + $writer->getData(), + 'renderer/xml_renderer_expected1.xml' + ); + } + + /** + * testRendererAddsProcessingErrorsToXmlReport + * + * @return void + * @since 1.2.1 + */ + public function testRendererAddsProcessingErrorsToXmlReport() + { + // Create a writer instance. + $writer = new WriterStub(); + + $processingErrors = array( + new ProcessingError('Failed for file "/tmp/foo.php".'), + new ProcessingError('Failed for file "/tmp/bar.php".'), + new ProcessingError('Failed for file "/tmp/baz.php".'), + ); + + $report = $this->getReportMock(0); + $report->expects($this->once()) + ->method('getRuleViolations') + ->will($this->returnValue(new \ArrayIterator(array()))); + $report->expects($this->once()) + ->method('getErrors') + ->will($this->returnValue(new \ArrayIterator($processingErrors))); + + $renderer = new XMLRenderer(); + $renderer->setWriter($writer); + + $renderer->start(); + $renderer->renderReport($report); + $renderer->end(); + + $this->assertXmlEquals( + $writer->getData(), + 'renderer/xml_renderer_processing_errors.xml' + ); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/ReportTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/ReportTest.php new file mode 100644 index 0000000..785c7e3 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/ReportTest.php @@ -0,0 +1,217 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD; + +/** + * Test case for the report class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Report + * @group phpmd + * @group unittest + */ +class ReportTest extends AbstractTest +{ + /** + * Tests that the report returns a linear/sorted list of all rule violation + * files. + * + * @return void + */ + public function testReportReturnsAListWithAllRuleViolations() + { + $report = new Report(); + + $report->addRuleViolation($this->getRuleViolationMock('foo.txt')); + $report->addRuleViolation($this->getRuleViolationMock('bar.txt')); + $report->addRuleViolation($this->getRuleViolationMock('foo.txt')); + $report->addRuleViolation($this->getRuleViolationMock('foo.txt')); + $report->addRuleViolation($this->getRuleViolationMock('bar.txt')); + + $actual = array(); + foreach ($report->getRuleViolations() as $violation) { + $actual[] = $violation->getFileName(); + } + + $expected = array('bar.txt', 'bar.txt', 'foo.txt', 'foo.txt', 'foo.txt'); + + $this->assertSame($expected, $actual); + } + + /** + * Tests that the report returns the result by the violation line number. + * + * @return void + */ + public function testReportSortsResultByLineNumber() + { + $report = new Report(); + + $report->addRuleViolation($this->getRuleViolationMock('foo.txt', 4, 5)); + $report->addRuleViolation($this->getRuleViolationMock('foo.txt', 1, 2)); + $report->addRuleViolation($this->getRuleViolationMock('foo.txt', 3, 6)); + $report->addRuleViolation($this->getRuleViolationMock('foo.txt', 2, 3)); + $report->addRuleViolation($this->getRuleViolationMock('bar.txt', 2, 3)); + $report->addRuleViolation($this->getRuleViolationMock('bar.txt', 1, 2)); + + $actual = array(); + foreach ($report->getRuleViolations() as $violation) { + $actual[] = array($violation->getFileName(), + $violation->getBeginLine(), + $violation->getEndLine()); + } + + $expected = array( + array('bar.txt', 1, 2), + array('bar.txt', 2, 3), + array('foo.txt', 1, 2), + array('foo.txt', 2, 3), + array('foo.txt', 3, 6), + array('foo.txt', 4, 5), + ); + + $this->assertSame($expected, $actual); + } + + /** + * Tests that the timer method returns the expected result. + * + * @return void + */ + public function testReportTimerReturnsMilliSeconds() + { + $start = microtime(true); + + $report = new Report(); + $report->start(); + usleep(50000); // 50 Milli Seconds + $report->end(); + + $time = ceil((microtime(true) - $start) * 1000.0); + + $this->assertGreaterThanOrEqual(50.0, $report->getElapsedTimeInMillis()); + $this->assertLessThanOrEqual($time, $report->getElapsedTimeInMillis()); + } + + /** + * testIsEmptyReturnsTrueByDefault + * + * @return void + */ + public function testIsEmptyReturnsTrueByDefault() + { + $report = new Report(); + $this->assertTrue($report->isEmpty()); + } + + /** + * testIsEmptyReturnsFalseWhenAtLeastOneViolationExists + * + * @return void + */ + public function testIsEmptyReturnsFalseWhenAtLeastOneViolationExists() + { + $report = new Report(); + $report->addRuleViolation($this->getRuleViolationMock('foo.txt', 4, 5)); + + $this->assertFalse($report->isEmpty()); + } + + /** + * testHasErrorsReturnsFalseByDefault + * + * @return void + * @since 1.2.1 + */ + public function testHasErrorsReturnsFalseByDefault() + { + $report = new Report(); + $this->assertFalse($report->hasErrors()); + } + + /** + * testHasErrorsReturnsTrueWhenReportContainsAtLeastOneError + * + * @return void + * @since 1.2.1 + */ + public function testHasErrorsReturnsTrueWhenReportContainsAtLeastOneError() + { + $report = new Report(); + $report->addError(new ProcessingError('Failing file "/foo.php".')); + + $this->assertTrue($report->hasErrors()); + } + + /** + * testGetErrorsReturnsEmptyIteratorByDefault + * + * @return void + * @since 1.2.1 + */ + public function testGetErrorsReturnsEmptyIteratorByDefault() + { + $report = new Report(); + $this->assertSame(0, iterator_count($report->getErrors())); + } + + /** + * testGetErrorsReturnsPreviousAddedProcessingError + * + * @return void + * @since 1.2.1 + */ + public function testGetErrorsReturnsPreviousAddedProcessingError() + { + $report = new Report(); + $report->addError(new ProcessingError('Failing file "/foo.php".')); + + $this->assertSame(1, iterator_count($report->getErrors())); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CleanCode/ElseExpressionTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CleanCode/ElseExpressionTest.php new file mode 100644 index 0000000..8783615 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CleanCode/ElseExpressionTest.php @@ -0,0 +1,29 @@ +setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + public function testRuleAppliesToMethodWithElseExpression() + { + $rule = new ElseExpression(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + public function testRuleAppliesMultipleTimesToMethodWithMultipleElseExpressions() + { + $rule = new ElseExpression(); + $rule->setReport($this->getReportMock(3)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CleanCode/StaticAccessTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CleanCode/StaticAccessTest.php new file mode 100644 index 0000000..54861d9 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CleanCode/StaticAccessTest.php @@ -0,0 +1,43 @@ +setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + public function testRuleNotAppliesToSelfStaticCall() + { + $rule = new StaticAccess(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + public function testRuleNotAppliesToDynamicMethodCall() + { + $rule = new StaticAccess(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + public function testRuleAppliesToStaticMethodAccess() + { + $rule = new StaticAccess(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + public function testRuleNotAppliesToConstantAccess() + { + $rule = new StaticAccess(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Controversial/CamelCaseMethodNameTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Controversial/CamelCaseMethodNameTest.php new file mode 100644 index 0000000..4e44ab7 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Controversial/CamelCaseMethodNameTest.php @@ -0,0 +1,163 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Controversial; + +use PHPMD\AbstractTest; + +/** + * Test case for the camel case method name rule. + *_Design + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Controversial\CamelCaseMethodName + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::controversial + * @group unittest + */ +class CamelCaseMethodNameTest extends AbstractTest +{ + /** + * Tests that the rule does not apply for a valid method name. + * + * @return void + */ + public function testRuleDoesNotApplyForValidMethodName() + { + //$method = $this->getMethod(); + $report = $this->getReportMock(0); + + $rule = new CamelCaseMethodName(); + $rule->setReport($report); + $rule->addProperty('allow-underscore', 'false'); + $rule->apply($this->getMethod()); + } + + /** + * Tests that the rule does apply for an method name + * starting with a capital. + * + * @return void + */ + public function testRuleDoesApplyForMethodNameWithCapital() + { + // Test method name with capital at the beginning + $method = $this->getMethod(); + $report = $this->getReportMock(1); + + $rule = new CamelCaseMethodName(); + $rule->setReport($report); + $rule->addProperty('allow-underscore', 'false'); + $rule->apply($method); + } + + /** + * Tests that the rule does apply for a method name + * with underscores. + * + * @return void + */ + public function testRuleDoesApplyForMethodNameWithUnderscores() + { + // Test method name with underscores + $method = $this->getMethod(); + $report = $this->getReportMock(1); + + $rule = new CamelCaseMethodName(); + $rule->setReport($report); + $rule->addProperty('allow-underscore', 'false'); + $rule->apply($method); + } + + /** + * Tests that the rule does apply for a valid method name + * with an underscore at the beginning when it is allowed. + * + * @return void + */ + public function testRuleDoesApplyForValidMethodNameWithUnderscoreWhenNotAllowed() + { + $method = $this->getMethod(); + $report = $this->getReportMock(1); + + $rule = new CamelCaseMethodName(); + $rule->setReport($report); + $rule->addProperty('allow-underscore', 'false'); + $rule->apply($method); + } + + /** + * Tests that the rule does not apply for a valid method name + * with an underscore at the beginning when it is not allowed. + * + * @return void + */ + public function testRuleDoesNotApplyForValidMethodNameWithUnderscoreWhenAllowed() + { + $method = $this->getMethod(); + $report = $this->getReportMock(0); + + $rule = new CamelCaseMethodName(); + $rule->setReport($report); + $rule->addProperty('allow-underscore', 'true'); + $rule->apply($method); + } + + /** + * Returns the first method found in a source file related to the calling + * test method. + * + * @return \PHPMD\Node\MethodNode + */ + protected function getMethod() + { + $methods = $this->getClass()->getMethods(); + return reset($methods); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CyclomaticComplexityTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CyclomaticComplexityTest.php new file mode 100644 index 0000000..64df903 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/CyclomaticComplexityTest.php @@ -0,0 +1,114 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule; + +use PHPMD\AbstractTest; + +/** + * Test case for the cyclomatic complexity violation rule. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\CyclomaticComplexity + * @group phpmd + * @group phpmd::rule + * @group unittest + */ +class CyclomaticComplexityTest extends AbstractTest +{ + /** + * Tests that the rule applies for a value greater than the configured + * threshold. + * + * @return void + */ + public function testRuleAppliesForValueGreaterThanThreshold() + { + $method = $this->getMethodMock('ccn2', 42); + $report = $this->getReportMock(1); + + $rule = new CyclomaticComplexity(); + $rule->setReport($report); + $rule->addProperty('reportLevel', '10'); + $rule->apply($method); + } + + /** + * Test that the rule applies for a value that is equal with the configured + * threshold. + * + * @return void + */ + public function testRuleAppliesForValueEqualToThreshold() + { + $method = $this->getMethodMock('ccn2', 42); + $report = $this->getReportMock(1); + + $rule = new CyclomaticComplexity(); + $rule->setReport($report); + $rule->addProperty('reportLevel', '42'); + $rule->apply($method); + } + + /** + * Tests that the rule does not apply when the value is at least one lower + * than the threshold. + * + * @return void + */ + public function testRuleDoesNotApplyForValueLowerThanThreshold() + { + $method = $this->getMethodMock('ccn2', 22); + $report = $this->getReportMock(0); + + $rule = new CyclomaticComplexity(); + $rule->setReport($report); + $rule->addProperty('reportLevel', '23'); + $rule->apply($method); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/CouplingBetweenObjectsTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/CouplingBetweenObjectsTest.php new file mode 100644 index 0000000..d023356 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/CouplingBetweenObjectsTest.php @@ -0,0 +1,103 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Rule\Design\CouplingBetweenObjects} class. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @ticket 10474987 + * @covers \PHPMD\Rule\Design\CouplingBetweenObjects + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + */ +class CouplingBetweenObjectsTest extends AbstractTest +{ + /** + * testRuleNotAppliesToClassWithCboLessThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToClassWithCboLessThanThreshold() + { + $rule = new CouplingBetweenObjects(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('cbo', 41)); + } + + /** + * testRuleAppliesToClassWithCboEqualToThreshold + * + * @return void + */ + public function testRuleAppliesToClassWithCboEqualToThreshold() + { + $rule = new CouplingBetweenObjects(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('cbo', 42)); + } + + /** + * testRuleAppliesToClassWithCboGreaterThanThreshold + * + * @return void + */ + public function testRuleAppliesToClassWithCboGreaterThanThreshold() + { + $rule = new CouplingBetweenObjects(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '41'); + $rule->apply($this->getClassMock('cbo', 42)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/DepthOfInheritanceTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/DepthOfInheritanceTest.php new file mode 100644 index 0000000..3e2edc3 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/DepthOfInheritanceTest.php @@ -0,0 +1,103 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Rule\Design\DepthOfInheritance} class. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\DepthOfInheritance + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class DepthOfInheritanceTest extends AbstractTest +{ + /** + * testRuleNotAppliesToClassWithNumberOfParentLessThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToClassWithNumberOfParentLessThanThreshold() + { + $rule = new DepthOfInheritance(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('dit', 41)); + } + + /** + * testRuleAppliesToClassWithNumberOfParentIdenticalToThreshold + * + * @return void + */ + public function testRuleAppliesToClassWithNumberOfParentIdenticalToThreshold() + { + $rule = new DepthOfInheritance(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('dit', 42)); + } + + /** + * testRuleAppliesToClassWithNumberOfParentGreaterThanThreshold + * + * @return void + */ + public function testRuleAppliesToClassWithNumberOfParentGreaterThanThreshold() + { + $rule = new DepthOfInheritance(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('dit', 43)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/EvalExpressionTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/EvalExpressionTest.php new file mode 100644 index 0000000..a484d40 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/EvalExpressionTest.php @@ -0,0 +1,136 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Rule\Design\EvalExpression} class. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\EvalExpression + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class EvalExpressionTest extends AbstractTest +{ + /** + * testRuleNotAppliesToMethodWithoutEvalExpression + * + * @return void + */ + public function testRuleNotAppliesToMethodWithoutEvalExpression() + { + $rule = new EvalExpression(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToMethodWithEvalExpression + * + * @return void + */ + public function testRuleAppliesToMethodWithEvalExpression() + { + $rule = new EvalExpression(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesMultipleTimesToMethodWithEvalExpression + * + * @return void + */ + public function testRuleAppliesMultipleTimesToMethodWithEvalExpression() + { + $rule = new EvalExpression(); + $rule->setReport($this->getReportMock(3)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToFunctionWithoutEvalExpression + * + * @return void + */ + public function testRuleNotAppliesToFunctionWithoutEvalExpression() + { + $rule = new EvalExpression(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToFunctionWithEvalExpression + * + * @return void + */ + public function testRuleAppliesToFunctionWithEvalExpression() + { + $rule = new EvalExpression(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesMultipleTimesToFunctionWithEvalExpression + * + * @return void + */ + public function testRuleAppliesMultipleTimesToFunctionWithEvalExpression() + { + $rule = new EvalExpression(); + $rule->setReport($this->getReportMock(3)); + $rule->apply($this->getFunction()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/ExitExpressionTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/ExitExpressionTest.php new file mode 100644 index 0000000..652481d --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/ExitExpressionTest.php @@ -0,0 +1,136 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Rule\Design\ExitExpression} class. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\ExitExpression + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class ExitExpressionTest extends AbstractTest +{ + /** + * testRuleNotAppliesToMethodWithoutExitExpression + * + * @return void + */ + public function testRuleNotAppliesToMethodWithoutExitExpression() + { + $rule = new ExitExpression(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToMethodWithExitExpression + * + * @return void + */ + public function testRuleAppliesToMethodWithExitExpression() + { + $rule = new ExitExpression(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesMultipleTimesToMethodWithExitExpression + * + * @return void + */ + public function testRuleAppliesMultipleTimesToMethodWithExitExpression() + { + $rule = new ExitExpression(); + $rule->setReport($this->getReportMock(3)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToFunctionWithoutExitExpression + * + * @return void + */ + public function testRuleNotAppliesToFunctionWithoutExitExpression() + { + $rule = new ExitExpression(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToFunctionWithExitExpression + * + * @return void + */ + public function testRuleAppliesToFunctionWithExitExpression() + { + $rule = new ExitExpression(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesMultipleTimesToFunctionWithExitExpression + * + * @return void + */ + public function testRuleAppliesMultipleTimesToFunctionWithExitExpression() + { + $rule = new ExitExpression(); + $rule->setReport($this->getReportMock(3)); + $rule->apply($this->getFunction()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/GotoStatementTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/GotoStatementTest.php new file mode 100644 index 0000000..c454842 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/GotoStatementTest.php @@ -0,0 +1,116 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @link https://www.pivotaltracker.com/story/show/10474873 + * @ticket 10474873 + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Rule\Design\GotoStatement} class. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @link https://www.pivotaltracker.com/story/show/10474873 + * @ticket 10474873 + * + * @covers \PHPMD\Rule\Design\GotoStatement + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class GotoStatementTest extends AbstractTest +{ + /** + * testRuleNotAppliesToMethodWithoutGotoStatement + * + * @return void + */ + public function testRuleNotAppliesToMethodWithoutGotoStatement() + { + $rule = new GotoStatement(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToMethodWithGotoStatement + * + * @return void + */ + public function testRuleAppliesToMethodWithGotoStatement() + { + $rule = new GotoStatement(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToFunctionWithoutGotoStatement + * + * @return void + */ + public function testRuleNotAppliesToFunctionWithoutGotoStatement() + { + $rule = new GotoStatement(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToFunctionWithGotoStatement + * + * @return void + */ + public function testRuleAppliesToFunctionWithGotoStatement() + { + $rule = new GotoStatement(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongClassTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongClassTest.php new file mode 100644 index 0000000..ab9a959 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongClassTest.php @@ -0,0 +1,135 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the excessive long class rule. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\LongClass + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class LongClassTest extends AbstractTest +{ + /** + * Tests that the rule applies for a value greater than the configured + * threshold. + * + * @return void + */ + public function testRuleAppliesForValueGreaterThanThreshold() + { + $class = $this->getClassMock('loc', 42); + $report = $this->getReportMock(1); + + $rule = new LongClass(); + $rule->setReport($report); + $rule->addProperty('minimum', '41'); + $rule->addProperty('ignore-whitespace', false); + $rule->apply($class); + } + + /** + * Test that the rule applies for a value that is equal with the configured + * threshold. + * + * @return void + */ + public function testRuleAppliesForValueEqualToThreshold() + { + $class = $this->getClassMock('loc', 42); + $report = $this->getReportMock(1); + + $rule = new LongClass(); + $rule->setReport($report); + $rule->addProperty('minimum', '42'); + $rule->addProperty('ignore-whitespace', false); + $rule->apply($class); + } + + /** + * Tests that the rule does not apply when the value is at least one lower + * than the threshold. + * + * @return void + */ + public function testRuleDoesNotApplyForValueLowerThanThreshold() + { + $class = $this->getClassMock('loc', 22); + $report = $this->getReportMock(0); + + $rule = new LongClass(); + $rule->setReport($report); + $rule->addProperty('minimum', '23'); + $rule->addProperty('ignore-whitespace', false); + $rule->apply($class); + } + + /** + * Tests that the rule uses eloc when ignore whitespace is set + * + * @return void + */ + public function testRuleUsesElocWhenIgnoreWhitespaceSet() + { + $class = $this->getClassMock('eloc', 22); + $report = $this->getReportMock(0); + + $rule = new LongClass(); + $rule->setReport($report); + $rule->addProperty('minimum', '23'); + $rule->addProperty('ignore-whitespace', true); + $rule->apply($class); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongMethodTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongMethodTest.php new file mode 100644 index 0000000..e72cfe7 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongMethodTest.php @@ -0,0 +1,135 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the excessive long method rule. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\LongMethod + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class LongMethodTest extends AbstractTest +{ + /** + * Tests that the rule applies for a value greater than the configured + * threshold. + * + * @return void + */ + public function testRuleAppliesForValueGreaterThanThreshold() + { + $method = $this->getMethodMock('loc', 42); + $report = $this->getReportMock(1); + + $rule = new LongMethod(); + $rule->setReport($report); + $rule->addProperty('minimum', '41'); + $rule->addProperty('ignore-whitespace', false); + $rule->apply($method); + } + + /** + * Test that the rule applies for a value that is equal with the configured + * threshold. + * + * @return void + */ + public function testRuleAppliesForValueEqualToThreshold() + { + $method = $this->getMethodMock('loc', 42); + $report = $this->getReportMock(1); + + $rule = new LongMethod(); + $rule->setReport($report); + $rule->addProperty('minimum', '42'); + $rule->addProperty('ignore-whitespace', false); + $rule->apply($method); + } + + /** + * Tests that the rule does not apply when the value is at least one lower + * than the threshold. + * + * @return void + */ + public function testRuleDoesNotApplyForValueLowerThanThreshold() + { + $method = $this->getMethodMock('loc', 22); + $report = $this->getReportMock(0); + + $rule = new LongMethod(); + $rule->setReport($report); + $rule->addProperty('minimum', '23'); + $rule->addProperty('ignore-whitespace', false); + $rule->apply($method); + } + + /** + * Tests that the rule uses eloc when ignore whitespace is set + * + * @return void + */ + public function testRuleUsesElocWhenIgnoreWhitespaceSet() + { + $class = $this->getClassMock('eloc', 22); + $report = $this->getReportMock(0); + + $rule = new LongMethod(); + $rule->setReport($report); + $rule->addProperty('minimum', '23'); + $rule->addProperty('ignore-whitespace', true); + $rule->apply($class); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongParameterListTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongParameterListTest.php new file mode 100644 index 0000000..f8505c0 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/LongParameterListTest.php @@ -0,0 +1,181 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the excessive long parameter list rule. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\LongParameterList + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class LongParameterListTest extends AbstractTest +{ + /** + * testApplyIgnoresMethodsWithLessParametersThanMinimum + * + * @return void + */ + public function testApplyIgnoresMethodsWithLessParametersThanMinimum() + { + $rule = new LongParameterList(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('minimum', '4'); + $rule->apply($this->createMethod(3)); + } + + /** + * testApplyReportsMethodsWithIdenticalParametersAndMinimum + * + * @return void + */ + public function testApplyReportsMethodsWithIdenticalParametersAndMinimum() + { + $rule = new LongParameterList(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '3'); + $rule->apply($this->createMethod(3)); + } + + /** + * testApplyReportsMethodsWithMoreParametersThanMinimum + * + * @return void + */ + public function testApplyReportsMethodsWithMoreParametersThanMinimum() + { + $rule = new LongParameterList(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '3'); + $rule->apply($this->createMethod(42)); + } + + /** + * testApplyIgnoresFunctionsWithLessParametersThanMinimum + * + * @return void + */ + public function testApplyIgnoresFunctionsWithLessParametersThanMinimum() + { + $rule = new LongParameterList(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('minimum', '4'); + $rule->apply($this->createFunction(3)); + } + + /** + * testApplyReportsFunctionsWithIdenticalParametersAndMinimum + * + * @return void + */ + public function testApplyReportsFunctionsWithIdenticalParametersAndMinimum() + { + $rule = new LongParameterList(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '3'); + $rule->apply($this->createFunction(3)); + } + + /** + * testApplyReportsFunctionsWithMoreParametersThanMinimum + * + * @return void + */ + public function testApplyReportsFunctionsWithMoreParametersThanMinimum() + { + $rule = new LongParameterList(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '3'); + $rule->apply($this->createFunction(42)); + } + + /** + * Returns a mocked method instance. + * + * @param integer $parameterCount + * @return \PHPMD\Node\MethodNode + */ + private function createMethod($parameterCount) + { + return $this->initFunctionOrMethodMock($this->getMethodMock(), $parameterCount); + } + + /** + * Creates a mocked function node instance. + * + * @param integer $parameterCount Number of function parameters. + * + * @return \PHPMD\Node\FunctionNode + */ + private function createFunction($parameterCount) + { + return $this->initFunctionOrMethodMock($this->createFunctionMock(), $parameterCount); + } + + /** + * Initializes the getParameterCount() method of the given callable. + * + * @param \PHPMD\Node\FunctionNode|\PHPMD\Node\MethodNode $mock + * @param integer $parameterCount + * @return \PHPMD\Node\FunctionNode|\PHPMD\Node\MethodNode + */ + private function initFunctionOrMethodMock($mock, $parameterCount) + { + $mock->expects($this->once()) + ->method('getParameterCount') + ->will($this->returnValue($parameterCount)); + + return $mock; + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/NpathComplexityTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/NpathComplexityTest.php new file mode 100644 index 0000000..bff1d6e --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/NpathComplexityTest.php @@ -0,0 +1,115 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * This is a test case for the NPath complexity rule. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\NpathComplexity + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class NpathComplexityTest extends AbstractTest +{ + /** + * Tests that the rule applies for a value greater than the configured + * threshold. + * + * @return void + */ + public function testRuleAppliesForValueGreaterThanThreshold() + { + $method = $this->getMethodMock('npath', 42); + $report = $this->getReportMock(1); + + $rule = new NpathComplexity(); + $rule->setReport($report); + $rule->addProperty('minimum', '41'); + $rule->apply($method); + } + + /** + * Test that the rule applies for a value that is equal with the configured + * threshold. + * + * @return void + */ + public function testRuleAppliesForValueEqualToThreshold() + { + $method = $this->getMethodMock('npath', 42); + $report = $this->getReportMock(1); + + $rule = new NpathComplexity(); + $rule->setReport($report); + $rule->addProperty('minimum', '42'); + $rule->apply($method); + } + + /** + * Tests that the rule does not apply when the value is at least one lower + * than the threshold. + * + * @return void + */ + public function testRuleDoesNotApplyForValueLowerThanThreshold() + { + $method = $this->getMethodMock('npath', 22); + $report = $this->getReportMock(0); + + $rule = new NpathComplexity(); + $rule->setReport($report); + $rule->addProperty('minimum', '23'); + $rule->apply($method); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/NumberOfChildrenTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/NumberOfChildrenTest.php new file mode 100644 index 0000000..81f8e67 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/NumberOfChildrenTest.php @@ -0,0 +1,103 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Rule\Design\NumberOfChildren} class. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\NumberOfChildren + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class NumberOfChildrenTest extends AbstractTest +{ + /** + * testRuleNotAppliesToClassWithChildrenLessThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToClassWithChildrenLessThanThreshold() + { + $rule = new NumberOfChildren(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('nocc', 41)); + } + + /** + * testRuleAppliesToClassWithChildrenIdenticalToThreshold + * + * @return void + */ + public function testRuleAppliesToClassWithChildrenIdenticalToThreshold() + { + $rule = new NumberOfChildren(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('nocc', 42)); + } + + /** + * testRuleAppliesToClassWithChildrenGreaterThanThreshold + * + * @return void + */ + public function testRuleAppliesToClassWithChildrenGreaterThanThreshold() + { + $rule = new NumberOfChildren(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('nocc', 43)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/TooManyFieldsTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/TooManyFieldsTest.php new file mode 100644 index 0000000..ae2ff10 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/TooManyFieldsTest.php @@ -0,0 +1,103 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the too many methods rule. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\TooManyFields + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class TooManyFieldsTest extends AbstractTest +{ + /** + * testRuleDoesNotApplyToClassesWithLessFieldsThanThreshold + * + * @return void + */ + public function testRuleDoesNotApplyToClassesWithLessFieldsThanThreshold() + { + $rule = new TooManyFields(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maxfields', '42'); + $rule->apply($this->getClassMock('vars', 23)); + } + + /** + * testRuleDoesNotApplyToClassesWithSameNumberOfFieldsAsThreshold + * + * @return void + */ + public function testRuleDoesNotApplyToClassesWithSameNumberOfFieldsAsThreshold() + { + $rule = new TooManyFields(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maxfields', '42'); + $rule->apply($this->getClassMock('vars', 42)); + } + + /** + * testRuleAppliesToClassesWithMoreFieldsThanThreshold + * + * @return void + */ + public function testRuleAppliesToClassesWithMoreFieldsThanThreshold() + { + $rule = new TooManyFields(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('maxfields', '23'); + $rule->apply($this->getClassMock('vars', 42)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/TooManyMethodsTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/TooManyMethodsTest.php new file mode 100644 index 0000000..8cce2b1 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/TooManyMethodsTest.php @@ -0,0 +1,175 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the too many methods rule. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\Design\TooManyMethods + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::design + * @group unittest + */ +class TooManyMethodsTest extends AbstractTest +{ + /** + * testRuleDoesNotApplyToClassesWithLessMethodsThanThreshold + * + * @return void + */ + public function testRuleDoesNotApplyToClassesWithLessMethodsThanThreshold() + { + $rule = new TooManyMethods(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maxmethods', '42'); + $rule->apply($this->createClassMock(23)); + } + + /** + * testRuleDoesNotApplyToClassesWithSameNumberOfMethodsAsThreshold + * + * @return void + */ + public function testRuleDoesNotApplyToClassesWithSameNumberOfMethodsAsThreshold() + { + $rule = new TooManyMethods(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maxmethods', '42'); + $rule->apply($this->createClassMock(42)); + } + + /** + * testRuleAppliesToClassesWithMoreMethodsThanThreshold + * + * @return void + */ + public function testRuleAppliesToClassesWithMoreMethodsThanThreshold() + { + $rule = new TooManyMethods(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('maxmethods', '23'); + $rule->apply($this->createClassMock(42, array_fill(0, 42, __FUNCTION__))); + } + + /** + * testRuleIgnoresGetterMethodsInTest + * + * @return void + */ + public function testRuleIgnoresGetterMethodsInTest() + { + $rule = new TooManyMethods(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maxmethods', '1'); + $rule->apply($this->createClassMock(2, array('invoke', 'getClass'))); + } + + /** + * testRuleIgnoresSetterMethodsInTest + * + * @return void + */ + public function testRuleIgnoresSetterMethodsInTest() + { + $rule = new TooManyMethods(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maxmethods', '1'); + $rule->apply($this->createClassMock(2, array('invoke', 'setClass'))); + } + + /** + * testRuleIgnoresCustomMethodsWhenRegexPropertyIsGiven + * + * @return void + */ + public function testRuleIgnoresCustomMethodsWhenRegexPropertyIsGiven() + { + $rule = new TooManyMethods(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maxmethods', '1'); + $rule->addProperty('ignorepattern', '(^(set|get|inject))i'); + $rule->apply($this->createClassMock(2, array('invoke', 'injectClass'))); + } + + /** + * testRuleIgnoresGetterAndSetterMethodsInTest + * + * @return void + */ + public function testRuleIgnoresGetterAndSetterMethodsInTest() + { + $rule = new TooManyMethods(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('maxmethods', '2'); + $rule->apply($this->createClassMock(3, array('invoke', 'getClass', 'setClass'))); + } + + /** + * Creates a prepared class node mock + * + * @param integer $numberOfMethods + * @param array$methodNames + * @return \PHPMD\Node\ClassNode + */ + private function createClassMock($numberOfMethods, array $methodNames = null) + { + $class = $this->getClassMock('nom', $numberOfMethods); + + if (is_array($methodNames)) { + $class->expects($this->once()) + ->method('getMethodNames') + ->will($this->returnValue($methodNames)); + } + return $class; + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/WeightedMethodCountTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/WeightedMethodCountTest.php new file mode 100644 index 0000000..3d8b714 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Design/WeightedMethodCountTest.php @@ -0,0 +1,113 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 0.2.5 + */ + +namespace PHPMD\Rule\Design; + +use PHPMD\AbstractTest; + +/** + * Test case for the weighted method count rule. + *_Design + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 0.2.5 + * + * @covers \PHPMD\Rule\Design\WeightedMethodCount + * @group phpmd + * @group phpmd::rule + * @group unittest + */ +class WeightedMethodCountTest extends AbstractTest +{ + /** + * testRuleAppliesForValueGreaterThanThreshold + * + * @return void + */ + public function testRuleAppliesForValueGreaterThanThreshold() + { + $class = $this->getClassMock('wmc', 42); + $report = $this->getReportMock(1); + + $rule = new WeightedMethodCount(); + $rule->setReport($report); + $rule->addProperty('maximum', '10'); + $rule->apply($class); + } + + /** + * testRuleAppliesForValueEqualToThreshold + * + * @return void + */ + public function testRuleAppliesForValueEqualToThreshold() + { + $class = $this->getClassMock('wmc', 42); + $report = $this->getReportMock(1); + + $rule = new WeightedMethodCount(); + $rule->setReport($report); + $rule->addProperty('maximum', '42'); + $rule->apply($class); + } + + /** + * testRuleNotAppliesForValueLowerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesForValueLowerThanThreshold() + { + $class = $this->getClassMock('wmc', 42); + $report = $this->getReportMock(0); + + $rule = new WeightedMethodCount(); + $rule->setReport($report); + $rule->addProperty('maximum', '43'); + $rule->apply($class); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/ExcessivePublicCountTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/ExcessivePublicCountTest.php new file mode 100644 index 0000000..2cef099 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/ExcessivePublicCountTest.php @@ -0,0 +1,102 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule; + +use PHPMD\AbstractTest; + +/** + * Test case for the excessive use of public members rule. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\ExcessivePublicCount + * @group phpmd + * @group phpmd::rule + * @group unittest + */ +class ExcessivePublicCountTest extends AbstractTest +{ + /** + * testRuleDoesNotApplyToClassesWithLessPublicMembersThanThreshold + * + * @return void + */ + public function testRuleDoesNotApplyToClassesWithLessPublicMembersThanThreshold() + { + $rule = new ExcessivePublicCount(); + $rule->setReport($this->getReportMock(0)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('cis', 23)); + } + + /** + * testRuleAppliesToClassesWithSameNumberOfPublicMembersAsThreshold + * + * @return void + */ + public function testRuleAppliesToClassesWithSameNumberOfPublicMembersAsThreshold() + { + $rule = new ExcessivePublicCount(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '42'); + $rule->apply($this->getClassMock('cis', 42)); + } + + /** + * testRuleAppliesToClassesWithMorePublicMembersThanThreshold + * + * @return void + */ + public function testRuleAppliesToClassesWithMorePublicMembersThanThreshold() + { + $rule = new ExcessivePublicCount(); + $rule->setReport($this->getReportMock(1)); + $rule->addProperty('minimum', '23'); + $rule->apply($this->getClassMock('cis', 42)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/BooleanGetMethodNameTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/BooleanGetMethodNameTest.php new file mode 100644 index 0000000..211cd62 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/BooleanGetMethodNameTest.php @@ -0,0 +1,184 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Naming; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\Rule\Naming\BooleanGetMethodName} rule class. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers PHPMD\Rule\Naming\BooleanGetMethodName + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::naming + * @group unittest + */ +class BooleanGetMethodNameTest extends AbstractTest +{ + /** + * testRuleAppliesToMethodStartingWithGetAndReturningBoolean + * + * @return void + */ + public function testRuleAppliesToMethodStartingWithGetAndReturningBoolean() + { + $rule = new BooleanGetMethodName(); + $rule->addProperty('checkParameterizedMethods', 'false'); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToMethodStartingWithGetAndReturningBool + * + * @return void + */ + public function testRuleAppliesToMethodStartingWithGetAndReturningBool() + { + $rule = new BooleanGetMethodName(); + $rule->addProperty('checkParameterizedMethods', 'false'); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToPearPrivateMethodStartingWithGetAndReturningBoolean + * + * @return void + */ + public function testRuleAppliesToPearPrivateMethodStartingWithGetAndReturningBoolean() + { + $rule = new BooleanGetMethodName(); + $rule->addProperty('checkParameterizedMethods', 'false'); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleIgnoresParametersWhenNotExplicitConfigured + * + * @return void + */ + public function testRuleIgnoresParametersWhenNotExplicitConfigured() + { + $rule = new BooleanGetMethodName(); + $rule->addProperty('checkParameterizedMethods', 'false'); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesWhenParametersAreExplicitEnabled + * + * @return void + */ + public function testRuleNotAppliesWhenParametersAreExplicitEnabled() + { + $rule = new BooleanGetMethodName(); + $rule->addProperty('checkParameterizedMethods', 'true'); + $rule->setReport($this->getReportMock(0)); + + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToMethodStartingWithIs + * + * @return void + */ + public function testRuleNotAppliesToMethodStartingWithIs() + { + $rule = new BooleanGetMethodName(); + $rule->addProperty('checkParameterizedMethods', 'false'); + $rule->setReport($this->getReportMock(0)); + + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToMethodStartingWithHas + * + * @return void + */ + public function testRuleNotAppliesToMethodStartingWithHas() + { + $rule = new BooleanGetMethodName(); + $rule->addProperty('checkParameterizedMethods', 'false'); + $rule->setReport($this->getReportMock(0)); + + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToMethodWithReturnTypeNotBoolean + * + * @return void + */ + public function testRuleNotAppliesToMethodWithReturnTypeNotBoolean() + { + $rule = new BooleanGetMethodName(); + $rule->addProperty('checkParameterizedMethods', 'false'); + $rule->setReport($this->getReportMock(0)); + + $rule->apply($this->getMethod()); + } + + /** + * Returns the first method found in a source file related to the calling + * test method. + * + * @return \PHPMD\Node\MethodNode + */ + protected function getMethod() + { + $methods = $this->getClass()->getMethods(); + return reset($methods); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ConstantNamingConventionsTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ConstantNamingConventionsTest.php new file mode 100644 index 0000000..f6ad608 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ConstantNamingConventionsTest.php @@ -0,0 +1,112 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Naming; + +use PHPMD\AbstractTest; + +/** + * Test case for the constructor name rule. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers PHPMD\Rule\Naming\ConstantNamingConventions + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::naming + * @group unittest + */ +class ConstantNamingConventionsTest extends AbstractTest +{ + /** + * testRuleAppliesToClassConstantWithLowerCaseCharacters + * + * @return void + */ + public function testRuleAppliesToClassConstantWithLowerCaseCharacters() + { + $rule = new ConstantNamingConventions(); + $rule->setReport($this->getReportMock(2)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToInterfaceConstantWithLowerCaseCharacters + * + * @return void + */ + public function testRuleAppliesToInterfaceConstantWithLowerCaseCharacters() + { + $rule = new ConstantNamingConventions(); + $rule->setReport($this->getReportMock(3)); + $rule->apply($this->getInterface()); + } + + /** + * testRuleNotAppliesToClassConstantWithUpperCaseCharacters + * + * @return void + */ + public function testRuleNotAppliesToClassConstantWithUpperCaseCharacters() + { + $rule = new ConstantNamingConventions(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesToInterfaceConstantWithUpperCaseCharacters + * + * @return void + */ + public function testRuleNotAppliesToInterfaceConstantWithUpperCaseCharacters() + { + $rule = new ConstantNamingConventions(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getInterface()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ConstructorWithNameAsEnclosingClassTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ConstructorWithNameAsEnclosingClassTest.php new file mode 100644 index 0000000..a6c9daf --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ConstructorWithNameAsEnclosingClassTest.php @@ -0,0 +1,100 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Naming; + +use PHPMD\AbstractTest; + +/** + * Test case for the constructor name rule. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers PHPMD\Rule\Naming\ConstructorWithNameAsEnclosingClass + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::naming + * @group unittest + */ +class ConstructorWithNameAsEnclosingClassTest extends AbstractTest +{ + /** + * testRuleAppliesToConstructorMethodNamedAsEnclosingClass + * + * @return void + */ + public function testRuleAppliesToConstructorMethodNamedAsEnclosingClass() + { + $rule = new ConstructorWithNameAsEnclosingClass(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToConstructorMethodNamedAsEnclosingClassCaseInsensitive + * + * @return void + */ + public function testRuleAppliesToConstructorMethodNamedAsEnclosingClassCaseInsensitive() + { + $rule = new ConstructorWithNameAsEnclosingClass(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToMethodNamedSimilarToEnclosingClass + * + * @return void + */ + public function testRuleNotAppliesToMethodNamedSimilarToEnclosingClass() + { + $rule = new ConstructorWithNameAsEnclosingClass(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/LongVariableTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/LongVariableTest.php new file mode 100644 index 0000000..2299825 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/LongVariableTest.php @@ -0,0 +1,336 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Naming; + +use PHPMD\AbstractTest; + +/** + * Test case for the really long variable, parameter and property name rule. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers PHPMD\Rule\Naming\LongVariable + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::naming + * @group unittest + */ +class LongVariableTest extends AbstractTest +{ + /** + * testRuleAppliesToLocalVariableInFunctionWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleAppliesToLocalVariableInFunctionWithNameLongerThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToLocalVariableInFunctionWithNameSmallerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToLocalVariableInFunctionWithNameSmallerThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToLocalVariableInFunctionWithNameEqualToThreshold + * + * @return void + */ + public function testRuleNotAppliesToLocalVariableInFunctionWithNameEqualToThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 6); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToFunctionParameterWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleAppliesToFunctionParameterWithNameLongerThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToFunctionParameterWithNameSmallerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToFunctionParameterWithNameSmallerThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToLocalVariableInMethodWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleAppliesToLocalVariableInMethodWithNameLongerThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(1)); + + $class = $this->getClass(); + $rule->apply($class); + + foreach ($class->getMethods() as $method) { + $rule->apply($method); + } + } + + /** + * testRuleNotAppliesToLocalVariableInMethodWithNameEqualToThreshold + * + * @return void + */ + public function testRuleNotAppliesToLocalVariableInMethodWithNameEqualToThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 6); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesToLocalVariableInMethodWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToLocalVariableInMethodWithNameShorterThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToMethodParameterWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleAppliesToMethodParameterWithNameLongerThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 3); + $rule->setReport($this->getReportMock(1)); + + $class = $this->getClass(); + $rule->apply($class); + + foreach ($class->getMethods() as $method) { + $rule->apply($method); + } + } + + /** + * testRuleNotAppliesToMethodParameterWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToMethodParameterWithNameShorterThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToFieldWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleAppliesToFieldWithNameLongerThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesToFieldWithNameEqualToThreshold + * + * @return void + */ + public function testRuleNotAppliesToFieldWithNameEqualToThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 6); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesToFieldWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToFieldWithNameShorterThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 8); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToFieldAndParameterWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleAppliesToFieldAndParameterWithNameLongerThanThreshold() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 3); + $rule->setReport($this->getReportMock(2)); + + $class = $this->getClass(); + $rule->apply($class); + + foreach ($class->getMethods() as $method) { + $rule->apply($method); + } + } + + /** + * testRuleNotAppliesToStaticMembersAccessedInMethod + * + * @return void + */ + public function testRuleNotAppliesToStaticMembersAccessedInMethod() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 3); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToIdenticalVariableOnlyOneTime + * + * @return void + */ + public function testRuleAppliesToIdenticalVariableOnlyOneTime() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(2)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToIdenticalVariablesInDifferentContextsSeveralTimes + * + * @return void + */ + public function testRuleAppliesToIdenticalVariablesInDifferentContextsSeveralTimes() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(2)); + + $class = $this->getClass(); + $rule->apply($class); + + foreach ($class->getMethods() as $method) { + $rule->apply($method); + } + } + /** + * testRuleNotAppliesForLongPrivateProperty + * + * @return void + * @since 1.1.0 + */ + public function testRuleNotAppliesForLongPrivateProperty() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesForLongPrivateStaticProperty + * + * @return void + * @since 1.1.0 + */ + public function testRuleNotAppliesForLongPrivateStaticProperty() + { + $rule = new LongVariable(); + $rule->addProperty('maximum', 17); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ShortMethodNameTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ShortMethodNameTest.php new file mode 100644 index 0000000..5c13d6b --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ShortMethodNameTest.php @@ -0,0 +1,141 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Naming; + +use PHPMD\AbstractTest; + +/** + * Test case for the very short method and function name rule. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers PHPMD\Rule\Naming\ShortMethodName + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::naming + * @group unittest + */ +class ShortMethodNameTest extends AbstractTest +{ + /** + * testRuleAppliesToFunctionWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleAppliesToFunctionWithNameShorterThanThreshold() + { + $rule = new ShortMethodName(); + $rule->addProperty('minimum', 54); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToFunctionWithNameEqualToThreshold + * + * @return void + */ + public function testRuleNotAppliesToFunctionWithNameEqualToThreshold() + { + $rule = new ShortMethodName(); + $rule->addProperty('minimum', 52); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToFunctionWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToFunctionWithNameLongerThanThreshold() + { + $rule = new ShortMethodName(); + $rule->addProperty('minimum', 54); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + /** + * testRuleAppliesToFunctionWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleAppliesToMethodWithNameShorterThanThreshold() + { + $rule = new ShortMethodName(); + $rule->addProperty('minimum', 52); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToMethodWithNameEqualToThreshold + * + * @return void + */ + public function testRuleNotAppliesToMethodWithNameEqualToThreshold() + { + $rule = new ShortMethodName(); + $rule->addProperty('minimum', 50); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToMethodWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToMethodWithNameLongerThanThreshold() + { + $rule = new ShortMethodName(); + $rule->addProperty('minimum', 52); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ShortVariableTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ShortVariableTest.php new file mode 100644 index 0000000..b06e555 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/Naming/ShortVariableTest.php @@ -0,0 +1,384 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule\Naming; + +use PHPMD\AbstractTest; + +/** + * Test case for the really short variable, parameter and property name rule. + *_Naming + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers PHPMD\Rule\Naming\ShortVariable + * @group phpmd + * @group phpmd::rule + * @group phpmd::rule::naming + * @group unittest + */ +class ShortVariableTest extends AbstractTest +{ + + /** + * testRuleAppliesToLocalVariableInFunctionWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleAppliesToLocalVariableInFunctionWithNameShorterThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToLocalVariableInFunctionWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToLocalVariableInFunctionWithNameLongerThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 2); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToLocalVariableInFunctionWithNameEqualToThreshold + * + * @return void + */ + public function testRuleNotAppliesToLocalVariableInFunctionWithNameEqualToThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToFunctionParameterWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleAppliesToFunctionParameterWithNameShorterThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToFunctionParameterWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToFunctionParameterWithNameLongerThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToLocalVariableInMethodWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleAppliesToLocalVariableInMethodWithNameShorterThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(1)); + + $class = $this->getClass(); + $rule->apply($class); + + foreach ($class->getMethods() as $method) { + $rule->apply($method); + } + } + + /** + * testRuleNotAppliesToLocalVariableInMethodWithNameEqualToThreshold + * + * @return void + */ + public function testRuleNotAppliesToLocalVariableInMethodWithNameEqualToThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesToLocalVariableInMethodWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToLocalVariableInMethodWithNameLongerThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 2); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToMethodParameterWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleAppliesToMethodParameterWithNameShorterThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(1)); + + $class = $this->getClass(); + $rule->apply($class); + + foreach ($class->getMethods() as $method) { + $rule->apply($method); + } + } + + /** + * testRuleNotAppliesToMethodParameterWithNameLongerThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToMethodParameterWithNameLongerThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 2); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToFieldWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleAppliesToFieldWithNameShorterThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesToFieldWithNameEqualToThreshold + * + * @return void + */ + public function testRuleNotAppliesToFieldWithNameEqualToThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleNotAppliesToFieldWithNameGreaterThanThreshold + * + * @return void + */ + public function testRuleNotAppliesToFieldWithNameGreaterThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 2); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToFieldAndParameterWithNameShorterThanThreshold + * + * @return void + */ + public function testRuleAppliesToFieldAndParameterWithNameShorterThanThreshold() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(2)); + + $class = $this->getClass(); + $rule->apply($class); + + foreach ($class->getMethods() as $method) { + $rule->apply($method); + } + } + + /** + * testRuleNotAppliesToShortVariableNameAsForLoopIndex + * + * @return void + */ + public function testRuleNotAppliesToShortVariableNameAsForLoopIndex() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToShortVariableNameAsForeachLoopIndex + * + * @return void + */ + public function testRuleNotAppliesToShortVariableNameAsForeachLoopIndex() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToShortVariableNameInCatchStatement + * + * @return void + */ + public function testRuleNotAppliesToShortVariableNameInCatchStatement() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleNotAppliesToStaticMembersAccessedInMethod + * + * @return void + */ + public function testRuleNotAppliesToStaticMembersAccessedInMethod() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToIdenticalVariableOnlyOneTime + * + * @return void + */ + public function testRuleAppliesToIdenticalVariableOnlyOneTime() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(2)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToIdenticalVariablesInDifferentContextsSeveralTimes + * + * @return void + */ + public function testRuleAppliesToIdenticalVariablesInDifferentContextsSeveralTimes() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', ''); + $rule->setReport($this->getReportMock(2)); + + $class = $this->getClass(); + $rule->apply($class); + + foreach ($class->getMethods() as $method) { + $rule->apply($method); + } + } + + /** + * testRuleNotAppliesToVariablesFromExceptionsList + * + * @return void + */ + public function testRuleNotAppliesToVariablesFromExceptionsList() + { + $rule = new ShortVariable(); + $rule->addProperty('minimum', 3); + $rule->addProperty('exceptions', 'id'); + $rule->setReport($this->getReportMock(0)); + + $rule->apply($this->getClass()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedFormalParameterTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedFormalParameterTest.php new file mode 100644 index 0000000..9274282 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedFormalParameterTest.php @@ -0,0 +1,469 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule; + +use PHPMD\AbstractTest; + +/** + * Test case for the unused formal parameter rule. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\UnusedFormalParameter + * @covers \PHPMD\Rule\AbstractLocalVariable + * @group phpmd + * @group phpmd::rule + * @group unittest + */ +class UnusedFormalParameterTest extends AbstractTest +{ + /** + * testRuleAppliesToFunctionUnusedFormalParameter + * + * @return void + */ + public function testRuleAppliesToFunctionUnusedFormalParameter() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToMultipleFunctionUnusedFormalParameter + * + * @return void + */ + public function testRuleAppliesToMultipleFunctionUnusedFormalParameter() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(3)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToMethodUnusedFormalParameter + * + * @return void + */ + public function testRuleAppliesToMethodUnusedFormalParameter() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToMultipleMethodUnusedFormalParameter + * + * @return void + */ + public function testRuleAppliesToMultipleMethodUnusedFormalParameter() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(2)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToFormalParameterWhenSimilarStaticMemberIsAccessed + * + * + * class Foo { + * public static $bar = null; + * public function baz($bar) { + * self::$bar = 'fooBar'; + * } + * } + * + * + * @return void + */ + public function testRuleAppliesToFormalParameterWhenSimilarStaticMemberIsAccessed() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToFormalParameterUsedInPropertyCompoundVariable + * + * + * class Foo { + * public function baz($bar) { + * self::${$bar} = 'fooBar'; + * } + * } + * + * + * @return void + */ + public function testRuleNotAppliesToFormalParameterUsedInPropertyCompoundVariable() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleNotAppliesToFormalParameterUsedInMethodCompoundVariable + * + * + * class Foo { + * public function baz($bar) { + * self::${$bar}(); + * } + * } + * + * + * @return void + */ + public function testRuleNotAppliesToFormalParameterUsedInMethodCompoundVariable() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToAbstractMethodFormalParameter + * + * @return void + */ + public function testRuleDoesNotApplyToAbstractMethodFormalParameter() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToInterfaceMethodFormalParameter + * + * @return void + */ + public function testRuleDoesNotApplyToInterfaceMethodFormalParameter() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToInnerFunctionDeclaration + * + * @return void + */ + public function testRuleDoesNotApplyToInnerFunctionDeclaration() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleDoesNotApplyToFormalParameterUsedInCompoundExpression + * + * + * class Foo { + * public static $bar; + * public function baz($bar) { + * self::${$bar} = 42; + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToFormalParameterUsedInCompoundExpression() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToMethodArgument + * + * + * class Foo { + * function bar($baz) { + * $this->foo($baz); + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToMethodArgument() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToMethodArgumentUsedAsArrayIndex + * + * @return void + */ + public function testRuleDoesNotApplyToMethodArgumentUsedAsArrayIndex() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToParameterUsedAsArrayIndex + * + * + * class Foo { + * function bar($baz) { + * self::$values[$baz]; + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToParameterUsedAsArrayIndex() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToParameterUsedAsStringIndex + * + * + * class Foo { + * function bar($baz) { + * self::$string{$baz}; + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToParameterUsedAsStringIndex() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToMethodWithFuncGetArgs + * + * If func_get_args() is called then all parameters are + * automatically referenced without needing them to be referenced + * explicitly + * + * + * class Foo { + * function bar($baz) { + * print_r(func_get_args()); + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToMethodWithFuncGetArgs() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.0 + */ + public function test_func_get_args_rule_works_case_insensitive() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToInheritMethod + * + * @return void + * @since 1.2.1 + */ + public function testRuleDoesNotApplyToInheritMethod() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToImplementedAbstractMethod + * + * @return void + * @since 1.2.1 + */ + public function testRuleDoesNotApplyToImplementedAbstractMethod() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToImplementedInterfaceMethod + * + * @return void + * @since 1.2.1 + */ + public function testRuleDoesNotApplyToImplementedInterfaceMethod() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToMethodWithInheritdocAnnotation + */ + public function testRuleDoesNotApplyToMethodWithInheritdocAnnotation() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToMethodWithInheritdocAnnotationCamelCase + */ + public function testRuleDoesNotApplyToMethodWithInheritdocAnnotationCamelCase() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.0 + */ + public function test_compact_function_rule_does_not_apply() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.0 + */ + public function test_compact_function_rule_only_applies_to_used_parameters() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(2)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.0 + */ + public function test_compact_function_rule_works_case_insensitive() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.1 + */ + public function test_namespaced_compact_function_rule_does_not_apply() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.1 + */ + public function test_namespaced_compact_function_rule_only_applies_to_used_parameters() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(2)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.1 + */ + public function test_namespaced_compact_function_rule_works_case_insensitive() + { + $rule = new UnusedFormalParameter(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedLocalVariableTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedLocalVariableTest.php new file mode 100644 index 0000000..e0fb616 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedLocalVariableTest.php @@ -0,0 +1,550 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule; + +use PHPMD\AbstractTest; + +/** + * Test case for the unused local variable rule. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\UnusedLocalVariable + * @covers \PHPMD\Rule\AbstractLocalVariable + * @group phpmd + * @group phpmd::rule + * @group unittest + */ +class UnusedLocalVariableTest extends AbstractTest +{ + /** + * testRuleAppliesToUnusedLocalVariable + * + * @return void + */ + public function testRuleAppliesToUnusedLocalVariable() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testInnerFunctionParametersDoNotHideUnusedVariables + * + * @return void + */ + public function testInnerFunctionParametersDoNotHideUnusedVariables() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleAppliesToLocalVariableWithSameNameAsStaticProperty + * + * + * class Foo + * protected $baz = 42; + * function bar() { + * $baz = 23; + * return self::$baz; + * } + * } + * + * + * @return void + */ + public function testRuleAppliesToLocalVariableWithSameNameAsStaticProperty() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleAppliesToLocalVariableWithSameNameAsStaticArrayProperty + * + * + * class Foo + * protected $baz = array(array(1=>42)); + * function bar() { + * $baz = 23; + * return self::$baz[0][1]; + * } + * } + * + * + * @return void + */ + public function testRuleAppliesToLocalVariableWithSameNameAsStaticArrayProperty() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToLocalVariableUsedInCompoundVariable + * + * + * class Foo { + * protected static $bar = 42; + * public function baz() + * { + * $name = 'bar'; + * return self::${$name}; + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToLocalVariableUsedInCompoundVariable() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToThisVariable + * + * @return void + */ + public function testRuleDoesNotApplyToThisVariable() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToStaticProperty + * + * @return void + */ + public function testRuleDoesNotApplyToStaticProperty() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToStaticArrayProperty + * + * @return void + */ + public function testRuleDoesNotApplyToStaticArrayProperty() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToMethodArgument + * + * + * class Foo { + * function bar() { + * $baz = 42; + * $this->foo($baz); + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToMethodArgument() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToStaticObjectProperty + * + * @return void + */ + public function testRuleDoesNotApplyToStaticObjectProperty() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToDynamicProperty + * + * @return void + */ + public function testRuleDoesNotApplyToDynamicProperty() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToUnusedParameters + * + * @return void + */ + public function testRuleDoesNotApplyToUnusedParameters() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToArgcSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToArgcSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToArgvSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToArgvSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToGlobalsSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToGlobalsSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToCookieSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToCookieSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToEnvSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToEnvSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToFilesSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToFilesSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToGetSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToGetSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToPostSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToPostSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToRequestSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToRequestSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToSessionSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToSessionSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToServerSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToServerSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToHttpRawPostDataSuperGlobal + * + * @return void + */ + public function testRuleDoesNotApplyToHttpRawPostDataSuperGlobal() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToUnusedLocalVariableInFunction + * + * @return void + */ + public function testRuleDoesNotApplyToUnusedLocalVariableInFunction() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getFunction()); + } + + /** + * testRuleDoesNotApplyToUnusedLocalVariableInMethod + * + * @return void + */ + public function testRuleDoesNotApplyToUnusedLocalVariableInMethod() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToLocalVariableUsedAsArrayIndex + * + * + * class Foo { + * public function bar() { + * foreach ($baz as $key) { + * self::$values[$key] = 42; + * } + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToLocalVariableUsedAsArrayIndex() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToLocalVariableUsedAsStringIndex + * + * + * class Foo { + * public function bar() { + * foreach ($baz as $key) { + * self::$string{$key} = 'a'; + * } + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToLocalVariableUsedAsStringIndex() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToCatchStatement + * + * + * class Foo { + * public function bar() { + * try { + * } catch (Exception $e) { + * } + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToCatchStatement() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToCompactFunction + * + * + * class Foo { + * public function bar() { + * $key = 'ok'; + * return compact('key'); + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToCompactFunction() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.0 + */ + public function test_compact_function_rule_works_case_insensitive() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * testRuleDoesNotApplyToNamespacedCompactFunction + * + * + * namespace Baz; + * + * class Foo { + * public function bar() { + * $key = 'ok'; + * return compact('key'); + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToNamespacedCompactFunction() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } + + /** + * @test + * @return void + * @since 2.0.1 + */ + public function test_namespaced_compact_function_rule_works_case_insensitive() + { + $rule = new UnusedLocalVariable(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getMethod()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedPrivateFieldTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedPrivateFieldTest.php new file mode 100644 index 0000000..5ec93ee --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedPrivateFieldTest.php @@ -0,0 +1,305 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule; + +use PHPMD\AbstractTest; + +/** + * Test case for the unused private field rule. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\UnusedPrivateField + * @group phpmd + * @group phpmd::rule + * @group unittest + */ +class UnusedPrivateFieldTest extends AbstractTest +{ + /** + * testRuleAppliesToUnusedPrivateField + * + * @return void + */ + public function testRuleAppliesToUnusedPrivateField() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToUnusedPrivateStaticField + * + * @return void + */ + public function testRuleAppliesWhenFieldWithSameNameIsAccessedOnDifferentObject() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToUnusedPrivateStaticField + * + * @return void + */ + public function testRuleAppliesToUnusedPrivateStaticField() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnDifferentClass + * + * @return void + */ + public function testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnDifferentClass() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnParent + * + * @return void + */ + public function testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnParent() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesWhenLocalVariableIsUsedInStaticMemberPrefix + * + * + * class Foo { + * private static $_bar = null; + * + * public function baz() { + * self::${$_bar = '_bar'} = 42; + * } + * } + * + * + * @return void + */ + public function testRuleAppliesWhenLocalVariableIsUsedInStaticMemberPrefix() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesWhenLocalVariableIsUsedInStaticMemberPrefix + * + * + * class Foo { + * private static $_bar = null; + * + * public function baz() { + * self::${'_bar'} = 42; + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotResultInFatalErrorByCallingNonObject() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToUnusedPublicField + * + * @return void + */ + public function testRuleDoesNotApplyToUnusedPublicField() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToUnusedProtectedField + * + * @return void + */ + public function testRuleDoesNotApplyToUnusedProtectedField() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToThisAccessedPrivateField + * + * @return void + */ + public function testRuleDoesNotApplyToThisAccessedPrivateField() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToSelfAccessedPrivateField + * + * @return void + */ + public function testRuleDoesNotApplyToSelfAccessedPrivateField() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToStaticAccessedPrivateField + * + * @return void + */ + public function testRuleDoesNotApplyToStaticAccessedPrivateField() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToClassNameAccessedPrivateField + * + * @return void + */ + public function testRuleDoesNotApplyToClassNameAccessedPrivateField() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToPrivateFieldInChainedMethodCall + * + * + * class Foo { + * private $bar = null; + * // ... + * public function baz() { + * $this->bar->foobar(); + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToPrivateFieldInChainedMethodCall() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToPrivateArrayFieldAccess + * + * + * class Foo { + * private $bar = array(); + * // ... + * public function baz() { + * return $this->bar[42]; + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToPrivateArrayFieldAccess() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToPrivateStringIndexFieldAccess + * + * + * class Foo { + * private $bar = "Manuel"; + * // ... + * public function baz() { + * return $this->bar{3}; + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToPrivateStringIndexFieldAccess() + { + $rule = new UnusedPrivateField(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedPrivateMethodTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedPrivateMethodTest.php new file mode 100644 index 0000000..8d8c2c8 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Rule/UnusedPrivateMethodTest.php @@ -0,0 +1,264 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Rule; + +use PHPMD\AbstractTest; + +/** + * Test case for the unused private method rule. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\Rule\UnusedPrivateMethod + * @group phpmd + * @group phpmd::rule + * @group unittest + */ +class UnusedPrivateMethodTest extends AbstractTest +{ + /** + * testRuleAppliesToUnusedPrivateMethod + * + * @return void + */ + public function testRuleAppliesToUnusedPrivateMethod() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToUnusedStaticPrivateMethod + * + * @return void + */ + public function testRuleAppliesToUnusedStaticPrivateMethod() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesToParentReferencedUnusedPrivateMethod + * + * @return void + */ + public function testRuleAppliesToParentReferencedUnusedPrivateMethod() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesWhenMethodIsReferencedOnDifferentObject + * + * @return void + */ + public function testRuleAppliesWhenMethodIsReferencedOnDifferentObject() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesWhenMethodIsReferencedOnDifferentClass + * + * @return void + */ + public function testRuleAppliesWhenMethodIsReferencedOnDifferentClass() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesWhenPropertyWithSimilarNameIsReferenced + * + * @return void + */ + public function testRuleAppliesWhenPropertyWithSimilarNameIsReferenced() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleAppliesWhenMethodWithSimilarNameIsInInvocationChain + * + * + * class Foo { + * protected $bar; + * private function baz(); + * public function doIt() { + * $this->bar->baz(); + * } + * } + * + * + * @return void + */ + public function testRuleAppliesWhenMethodWithSimilarNameIsInInvocationChain() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(1)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToPrivateConstructor + * + * @return void + */ + public function testRuleDoesNotApplyToPrivateConstructor() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToPrivatePhp4Constructor + * + * @return void + */ + public function testRuleDoesNotApplyToPrivatePhp4Constructor() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToPrivateCloneMethod + * + * @return void + */ + public function testRuleDoesNotApplyToPrivateCloneMethod() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToThisReferencedMethod + * + * @return void + */ + public function testRuleDoesNotApplyToThisReferencedMethod() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToSelfReferencedMethod + * + * @return void + */ + public function testRuleDoesNotApplyToSelfReferencedMethod() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToStaticReferencedMethod + * + * @return void + */ + public function testRuleDoesNotApplyToStaticReferencedMethod() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToClassNameReferencedMethod + * + * @return void + */ + public function testRuleDoesNotApplyToClassNameReferencedMethod() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } + + /** + * testRuleDoesNotApplyToPrivateMethodInChainedMethodCall + * + * + * class Foo { + * private function bar() { + * return new \SplObjectStorage(); + * } + * public function add($object) { + * $this->bar()->attach($object); + * } + * } + * + * + * @return void + */ + public function testRuleDoesNotApplyToPrivateMethodInChainedMethodCall() + { + $rule = new UnusedPrivateMethod(); + $rule->setReport($this->getReportMock(0)); + $rule->apply($this->getClass()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleSetFactoryTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleSetFactoryTest.php new file mode 100644 index 0000000..b309cbd --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleSetFactoryTest.php @@ -0,0 +1,669 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD; + +/** + * Test case for the rule set factory class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\RuleSetFactory + * @group phpmd + * @group unittest + */ +class RuleSetFactoryTest extends AbstractTest +{ + /** + * testCreateRuleSetFileNameFindsXmlFileInBundledRuleSets + * + * @return void + */ + public function testCreateRuleSetFileNameFindsXmlFileInBundledRuleSets() + { + $factory = new RuleSetFactory(); + $ruleSet = $factory->createSingleRuleSet('codesize'); + + $this->assertContains('The Code Size Ruleset', $ruleSet->getDescription()); + } + + /** + * testCreateRuleSetFileNameFindsXmlFileInCurrentWorkingDirectory + * + * @return void + */ + public function testCreateRuleSetFileNameFindsXmlFileInCurrentWorkingDirectory() + { + self::changeWorkingDirectory('rulesets'); + + $factory = new RuleSetFactory(); + $ruleSet = $factory->createSingleRuleSet('set1.xml'); + + $this->assertEquals('First description...', $ruleSet->getDescription()); + } + + /** + * testCreateRuleSetsReturnsArray + * + * @return void + */ + public function testCreateRuleSetsReturnsArray() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/set1.xml'); + $this->assertInternalType('array', $ruleSets); + } + + /** + * testCreateRuleSetsForSingleFileReturnsArrayWithOneElement + * + * @return void + */ + public function testCreateRuleSetsForSingleFileReturnsArrayWithOneElement() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/set1.xml'); + $this->assertEquals(1, count($ruleSets)); + } + + /** + * testCreateRuleSetsForSingleFileReturnsOneRuleSetInstance + * + * @return void + */ + public function testCreateRuleSetsForSingleFileReturnsOneRuleSetInstance() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/set1.xml'); + $this->assertInstanceOf('PHPMD\\RuleSet', $ruleSets[0]); + } + + /** + * testCreateRuleSetsConfiguresExpectedRuleSetName + * + * @return void + */ + public function testCreateRuleSetsConfiguresExpectedRuleSetName() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/set1.xml'); + $this->assertEquals('First Test RuleSet', $ruleSets[0]->getName()); + } + + /** + * testCreateRuleSetsConfiguresExpectedRuleSetName + * + * @return void + */ + public function testCreateRuleSetsConfiguresExpectedRuleSetDescription() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/set1.xml'); + $this->assertEquals('First description...', $ruleSets[0]->getDescription()); + } + + /** + * testCreateRuleSetsForTwoFilesReturnsArrayWithTwoElements + * + * @return void + */ + public function testCreateRuleSetsForTwoFilesReturnsArrayWithTwoElements() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles( + 'rulesets/set1.xml', + 'rulesets/set2.xml' + ); + $this->assertEquals(2, count($ruleSets)); + } + + /** + * testCreateRuleSetsForTwoFilesReturnsExpectedRuleSetInstances + * + * @return void + */ + public function testCreateRuleSetsForTwoFilesReturnsExpectedRuleSetInstances() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles( + 'rulesets/set1.xml', + 'rulesets/set2.xml' + ); + $this->assertInstanceOf('PHPMD\\RuleSet', $ruleSets[0]); + $this->assertInstanceOf('PHPMD\\RuleSet', $ruleSets[1]); + } + + /** + * testCreateRuleSetsForTwoConfiguresExpectedRuleSetNames + * + * @return void + */ + public function testCreateRuleSetsForTwoConfiguresExpectedRuleSetNames() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles( + 'rulesets/set1.xml', + 'rulesets/set2.xml' + ); + $this->assertEquals('First Test RuleSet', $ruleSets[0]->getName()); + $this->assertEquals('Second Test RuleSet', $ruleSets[1]->getName()); + } + + /** + * testCreateRuleSetsForTwoConfiguresExpectedRuleSetDescriptions + * + * @return void + */ + public function testCreateRuleSetsForTwoConfiguresExpectedRuleSetDescriptions() + { + $ruleSets = $this->createRuleSetsFromAbsoluteFiles( + 'rulesets/set1.xml', + 'rulesets/set2.xml' + ); + $this->assertSame('First description...', $ruleSets[0]->getDescription()); + $this->assertSame('Second description...', $ruleSets[1]->getDescription()); + } + + /** + * testCreateRuleSetsForSingleLocalFileNameReturnsArray + * + * @return void + */ + public function testCreateRuleSetsForLocalFileNameReturnsArray() + { + self::changeWorkingDirectory(); + + $ruleSets = $this->createRuleSetsFromFiles('rulesets/set1.xml'); + $this->assertInternalType('array', $ruleSets); + } + + /** + * testCreateRuleSetsForSingleLocalFileNameReturnsArrayWithOneElement + * + * @return void + */ + public function testCreateRuleSetsForLocalFileNameReturnsArrayWithOneElement() + { + self::changeWorkingDirectory(); + + $ruleSets = $this->createRuleSetsFromFiles('rulesets/set1.xml'); + $this->assertEquals(1, count($ruleSets)); + } + + /** + * testCreateRuleSetsForSingleLocalFileNameConfiguresExpectedRuleSetName + * + * @return void + */ + public function testCreateRuleSetsForLocalFileNameConfiguresExpectedRuleSetName() + { + self::changeWorkingDirectory(); + + $ruleSets = $this->createRuleSetsFromFiles('rulesets/set1.xml'); + $this->assertEquals('First Test RuleSet', $ruleSets[0]->getName()); + } + + /** + * testCreateRuleSetsWithReferenceContainsExpectedRuleSet + * + * @return void + */ + public function testCreateRuleSetsWithReferenceContainsExpectedRuleSet() + { + self::changeWorkingDirectory(); + + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/refset1.xml'); + $this->assertEquals('First Test RuleSet', $ruleSets[0]->getName()); + } + + /** + * testCreateRuleSetsWithReferenceContainsExpectedNumberOfRules + * + * @return void + */ + public function testCreateRuleSetsWithReferenceContainsExpectedNumberOfRules() + { + self::changeWorkingDirectory(); + + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/refset1.xml'); + $this->assertEquals(4, iterator_count($ruleSets[0])); + } + + /** + * testCreateRuleSetsForLocalFileWithRuleSetReferenceNodes + * + * @return void + */ + public function testCreateRuleSetsWithReferenceContainsRuleInstances() + { + self::changeWorkingDirectory(); + + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/refset1.xml'); + $this->assertInstanceOf('PHPMD\\AbstractRule', $ruleSets[0]->getRules()->current()); + } + + /** + * testCreateRuleSetsWithReferenceContainsExpectedRules + * + * @return void + */ + public function testCreateRuleSetsWithReferenceContainsExpectedRules() + { + self::changeWorkingDirectory(); + + $ruleSets = $this->createRuleSetsFromAbsoluteFiles('rulesets/refset2.xml'); + + $actual = array(); + $expected = array('RuleTwoInFirstRuleSet', 'RuleOneInSecondRuleSet'); + + foreach ($ruleSets[0]->getRules() as $rule) { + $actual[] = $rule->getName(); + } + + $this->assertEquals($expected, $actual); + } + + /** + * testCreateSingleRuleSetReturnsRuleSetInstance + * + * @return void + */ + public function testCreateSingleRuleSetReturnsRuleSetInstance() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSet = $factory->createSingleRuleSet('set1'); + + $this->assertInstanceOf('PHPMD\\RuleSet', $ruleSet); + } + + /** + * Tests that the rule-set factory applies a set priority filter correct. + * + * @return void + */ + public function testCreateRuleSetWithSpecifiedPriorityOnlyContainsMatchingRules() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $factory->setMinimumPriority(2); + + $ruleSet = $factory->createSingleRuleSet('set1'); + $this->assertSame(1, iterator_count($ruleSet->getRules())); + } + + /** + * testCreateRuleWithExcludePattern + * + * @return void + */ + public function testCreateRuleWithExcludePattern() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $excludes = $factory->getIgnorePattern('exclude-pattern'); + + $expected = array( + 'some/excluded/files' + ); + + $this->assertEquals($expected, $excludes); + } + + /** + * testCreateRuleSetsWithRuleReferenceThatOverwritesPrioritySetting + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceThatOverwritesPrioritySetting() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset3'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertSame(-42, $rule->getPriority()); + } + + /** + * testCreateRuleWithExpectedExample + * + * @return void + */ + public function testCreateRuleWithExpectedExample() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('set1'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertEquals(array(__FUNCTION__), $rule->getExamples()); + } + + /** + * testCreateRuleWithExpectedMultipleExamples + * + * @return void + */ + public function testCreateRuleWithExpectedMultipleExamples() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('set2'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertEquals(array(__FUNCTION__ . 'One', __FUNCTION__ . 'Two'), $rule->getExamples()); + } + + /** + * testCreateRuleSetsWithRuleReferenceThatOverwritesDescriptionSetting + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceThatOverwritesDescriptionSetting() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset3'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertSame('description 42', $rule->getDescription()); + } + + /** + * testCreateRuleSetsWithRuleReferenceThatOverwritesPropertySetting + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceThatOverwritesPropertySetting() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset3'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertSame(42, $rule->getIntProperty('foo')); + } + + /** + * testFactorySupportsAlternativeSyntaxForPropertyValue + * + * @return void + */ + public function testFactorySupportsAlternativeSyntaxForPropertyValue() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('alternative-property-value-syntax'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertSame(42, $rule->getIntProperty('foo')); + } + + /** + * testCreateRuleSetsWithRuleReferenceThatOverwritesExamplesSetting + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceThatOverwritesExamplesSetting() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset3'); + + $rule = $ruleSets[0]->getRules()->current(); + + $examples = $rule->getExamples(); + $this->assertEquals('foreach ($foo as $bar) { echo $bar; }', $examples[0]); + } + + /** + * testCreateRuleSetsWithRuleReferenceThatOverwritesExamplesSetting + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceThatOverwritesNameSetting() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset4'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertEquals('Name overwritten', $rule->getName()); + } + + /** + * testCreateRuleSetsWithRuleReferenceThatOverwritesMessageSetting + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceThatOverwritesMessageSetting() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset4'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertEquals('Message overwritten', $rule->getMessage()); + } + + /** + * testCreateRuleSetsWithRuleReferenceThatOverwritesExtInfoUrlSetting + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceThatOverwritesExtInfoUrlSetting() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset4'); + + $rule = $ruleSets[0]->getRules()->current(); + $this->assertEquals('http://example.com/overwritten', $rule->getExternalInfoUrl()); + } + + /** + * testCreateRuleSetsWithRuleReferenceNotContainsExcludedRule + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceNotContainsExcludedRule() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset-exclude-one'); + + $rules = $ruleSets[0]->getRules(); + $this->assertEquals(1, iterator_count($rules)); + } + + /** + * testCreateRuleSetsWithRuleReferenceNotContainsExcludedRules + * + * @return void + */ + public function testCreateRuleSetsWithRuleReferenceNotContainsExcludedRules() + { + self::changeWorkingDirectory(); + + $factory = new RuleSetFactory(); + $ruleSets = $factory->createRuleSets('refset-exclude-all'); + + $rules = $ruleSets[0]->getRules(); + $this->assertEquals(0, iterator_count($rules)); + } + + /** + * Tests that the factory throws the expected exception for an invalid ruleset + * identifier. + * + * @return void + * @covers \PHPMD\RuleSetNotFoundException + */ + public function testCreateRuleSetsThrowsExceptionForInvalidIdentifier() + { + $factory = new RuleSetFactory(); + + $this->setExpectedException( + 'PHPMD\\RuleSetNotFoundException', + 'Cannot find specified rule-set "foo-bar-ruleset-23".' + ); + + $factory->createRuleSets('foo-bar-ruleset-23'); + } + + /** + * Tests that the factory throws an exception when the source code filename + * for the configured rule does not exist. + * + * @return void + * @covers \PHPMD\RuleClassFileNotFoundException + */ + public function testCreateRuleSetsThrowsExceptionWhenClassFileNotInIncludePath() + { + $fileName = self::createFileUri('rulesets/set-class-file-not-found.xml'); + $factory = new RuleSetFactory(); + + $this->setExpectedException( + 'PHPMD\\RuleClassFileNotFoundException', + 'Cannot load source file for class: PHPMD\\Stubs\\ClassFileNotFoundRule' + ); + + $factory->createRuleSets($fileName); + } + + /** + * Tests that the factory throws the expected exception when a rule class + * cannot be found. + * + * @return void + * @covers \PHPMD\RuleClassNotFoundException + */ + public function testCreateRuleSetThrowsExceptionWhenFileNotContainsClass() + { + $fileName = self::createFileUri('rulesets/set-class-not-found.xml'); + $factory = new RuleSetFactory(); + + $this->setExpectedException( + 'PHPMD\\RuleClassNotFoundException', + 'Cannot find rule class: PHPMD\\Stubs\\ClassNotFoundRule' + ); + + $factory->createRuleSets($fileName); + } + + /** + * Tests that the factory throws the expected exception when a rule class + * cannot be found. + * + * @return void + * @covers \PHPMD\RuleClassNotFoundException + * @expectedException \RuntimeException + */ + public function testCreateRuleSetsThrowsExpectedExceptionForInvalidXmlFile() + { + $fileName = self::createFileUri('rulesets/set-invalid-xml.xml'); + + $factory = new RuleSetFactory(); + $factory->createRuleSets($fileName); + } + + /** + * testCreateRuleSetsActivatesStrictModeOnRuleSet + * + * @return void + */ + public function testCreateRuleSetsActivatesStrictModeOnRuleSet() + { + $fileName = self::createFileUri('rulesets/set1.xml'); + + $factory = new RuleSetFactory(); + $factory->setStrict(); + + $ruleSets = $factory->createRuleSets($fileName); + + $this->assertAttributeEquals(true, 'strict', $ruleSets[0]); + } + + /** + * Invokes the createRuleSets() of the {@link RuleSetFactory} + * class. + * + * @param string $file At least one rule configuration file name. You can + * also pass multiple parameters with ruleset configuration files. + * @return \PHPMD\RuleSet[] + */ + private function createRuleSetsFromAbsoluteFiles($file) + { + $files = func_get_args(); + $files = array_map(array(__CLASS__, 'createFileUri'), $files); + + return call_user_func_array(array($this, 'createRuleSetsFromFiles'), $files); + } + + /** + * Invokes the createRuleSets() of the {@link RuleSetFactory} + * class. + * + * @param string $file At least one rule configuration file name. You can + * also pass multiple parameters with ruleset configuration files. + * @return \PHPMD\RuleSet[] + */ + private function createRuleSetsFromFiles($file) + { + $args = func_get_args(); + + $factory = new RuleSetFactory(); + return $factory->createRuleSets(join(',', $args)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleSetTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleSetTest.php new file mode 100644 index 0000000..c0c43b7 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleSetTest.php @@ -0,0 +1,135 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD; + +use PHPMD\Stubs\RuleStub; + +/** + * Test case for the {@link \PHPMD\RuleSet} class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\RuleSet + * @group phpmd + * @group unittest + */ +class RuleSetTest extends AbstractTest +{ + /** + * testGetRuleByNameReturnsNullWhenNoMatchingRuleExists + * + * @return void + */ + public function testGetRuleByNameReturnsNullWhenNoMatchingRuleExists() + { + $ruleSet = $this->createRuleSetFixture(); + $this->assertNull($ruleSet->getRuleByName(__FUNCTION__)); + } + + /** + * testGetRuleByNameReturnsMatchingRuleInstance + * + * @return void + */ + public function testGetRuleByNameReturnsMatchingRuleInstance() + { + $ruleSet = $this->createRuleSetFixture(__FUNCTION__, __CLASS__, __METHOD__); + $rule = $ruleSet->getRuleByName(__CLASS__); + + $this->assertEquals(__CLASS__, $rule->getName()); + } + + /** + * testApplyNotInvokesRuleWhenSuppressAnnotationExists + * + * @return void + */ + public function testApplyNotInvokesRuleWhenSuppressAnnotationExists() + { + $ruleSet = $this->createRuleSetFixture(__FUNCTION__); + $ruleSet->setReport($this->getReportMock(0)); + $ruleSet->apply($this->getClass()); + + $this->assertNull($ruleSet->getRuleByName(__FUNCTION__)->node); + } + + /** + * testApplyInvokesRuleWhenStrictModeIsSet + * + * @return void + */ + public function testApplyInvokesRuleWhenStrictModeIsSet() + { + $ruleSet = $this->createRuleSetFixture(__FUNCTION__); + $ruleSet->setReport($this->getReportMock(0)); + $ruleSet->setStrict(); + + $class = $this->getClass(); + $ruleSet->apply($class); + + $this->assertSame($class, $ruleSet->getRuleByName(__FUNCTION__)->node); + } + + /** + * Creates a rule set instance with a variable amount of appended rule + * objects. + * + * @param string $name + * @return \PHPMD\AbstractRule + */ + private function createRuleSetFixture($name = null) + { + $ruleSet = new RuleSet(); + for ($i = 0; $i < func_num_args(); ++$i) { + $rule = new RuleStub(func_get_arg($i)); + + $ruleSet->addRule($rule); + } + return $ruleSet; + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleTest.php new file mode 100644 index 0000000..659d81f --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleTest.php @@ -0,0 +1,174 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD; + +/** + * Test case for the {@link \PHPMD\AbstractRule} class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\AbstractRule + * @group phpmd + * @group unittest + */ +class RuleTest extends AbstractTest +{ + /** + * testGetIntPropertyReturnsValueOfTypeInteger + * + * @return void + */ + public function testGetIntPropertyReturnsValueOfTypeInteger() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->addProperty(__FUNCTION__, '42.3'); + + $this->assertSame(42, $rule->getIntProperty(__FUNCTION__)); + } + + /** + * testGetBooleanPropertyReturnsTrueForStringValue1 + * + * @return void + */ + public function testGetBooleanPropertyReturnsTrueForStringValue1() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->addProperty(__FUNCTION__, '1'); + + $this->assertTrue($rule->getBooleanProperty(__FUNCTION__)); + } + + /** + * testGetBooleanPropertyReturnsTrueForStringValueOn + * + * @return void + */ + public function testGetBooleanPropertyReturnsTrueForStringValueOn() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->addProperty(__FUNCTION__, 'on'); + + $this->assertTrue($rule->getBooleanProperty(__FUNCTION__)); + } + + /** + * testGetBooleanPropertyReturnsTrueForStringValueTrue + * + * @return void + */ + public function testGetBooleanPropertyReturnsTrueForStringValueTrue() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->addProperty(__FUNCTION__, 'true'); + + $this->assertTrue($rule->getBooleanProperty(__FUNCTION__)); + } + + /** + * testGetBooleanPropertyReturnsTrueForDifferentStringValue + * + * @return void + */ + public function testGetBooleanPropertyReturnsTrueForDifferentStringValue() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->addProperty(__FUNCTION__, 'True'); + + $this->assertFalse($rule->getBooleanProperty(__FUNCTION__)); + } + + /** + * testGetIntPropertyThrowsExceptionWhenNoPropertyForNameExists + * + * @return void + * @expectedException \OutOfBoundsException + */ + public function testGetIntPropertyThrowsExceptionWhenNoPropertyForNameExists() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->getIntProperty(__FUNCTION__); + } + + /** + * testGetBooleanPropertyThrowsExceptionWhenNoPropertyForNameExists + * + * @return void + * @expectedException \OutOfBoundsException + */ + public function testGetBooleanPropertyThrowsExceptionWhenNoPropertyForNameExists() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->getBooleanProperty(__FUNCTION__); + } + + /** + * testStringPropertyThrowsExceptionWhenNoPropertyForNameExists + * + * @return void + * @expectedException \OutOfBoundsException + */ + public function testGetStringPropertyThrowsExceptionWhenNoPropertyForNameExists() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->getStringProperty(__FUNCTION__); + } + + /** + * testGetStringPropertyReturnsStringValue + * + * @return void + */ + public function testGetStringPropertyReturnsString() + { + $rule = $this->getMockForAbstractClass('PHPMD\\AbstractRule'); + $rule->addProperty(__FUNCTION__, 'Fourty Two'); + + $this->assertSame('Fourty Two', $rule->getStringProperty(__FUNCTION__)); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleViolationTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleViolationTest.php new file mode 100644 index 0000000..49bc761 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/RuleViolationTest.php @@ -0,0 +1,110 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 0.2.5 + */ + +namespace PHPMD; + +/** + * Test case for the {@link \PHPMD\RuleViolation} class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * @since 0.2.5 + * + * @covers \PHPMD\RuleViolation + * @group phpmd + * @group unittest + */ +class RuleViolationTest extends AbstractTest +{ + /** + * testConstructorExtractsClassNameFromGivenType + * + * @return void + */ + public function testConstructorExtractsClassNameFromGivenType() + { + $rule = $this->getRuleMock(); + + $node = $this->getClassMock(); + $node->expects($this->once()) + ->method('getName'); + + new RuleViolation($rule, $node, 'foo'); + } + + /** + * testConstructorExtractsClassNameFromGivenMethod + * + * @return void + */ + public function testConstructorExtractsClassNameFromGivenMethod() + { + $rule = $this->getRuleMock(); + + $node = $this->getMethodMock(); + $node->expects($this->once()) + ->method('getParentName'); + + new RuleViolation($rule, $node, 'foo'); + } + + /** + * testConstructorExtractsMethodNameFromGivenMethod + * + * @return void + */ + public function testConstructorExtractsMethodNameFromGivenMethod() + { + $rule = $this->getRuleMock(); + + $node = $this->getMethodMock(); + $node->expects($this->once()) + ->method('getName'); + + new RuleViolation($rule, $node, 'foo'); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/ClassNotFoundRule.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/ClassNotFoundRule.php new file mode 100644 index 0000000..44f4c6b --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/ClassNotFoundRule.php @@ -0,0 +1,2 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Stubs; + +use PHPMD\AbstractNode; +use PHPMD\AbstractRule; +use PHPMD\Rule\ClassAware; + +/** + * Simple rule stub implementation + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ +class RuleStub extends AbstractRule implements ClassAware +{ + public $node = null; + + /** + * Constructs a new rule stub instance. + * + * @param string $ruleName The rule name. + * @param string $ruleSetName The rule-set name. + */ + public function __construct($ruleName = 'RuleStub', $ruleSetName = 'TestRuleSet') + { + $this->setName($ruleName); + $this->setExternalInfoUrl('http://phpmd.org/rules/index.html'); + $this->setRuleSetName($ruleSetName); + $this->setSince('42.23'); + $this->setDescription('Simple rule stub'); + } + + /** + * This method should implement the violation analysis algorithm of concrete + * rule implementations. All extending classes must implement this method. + * + * @param \PHPMD\AbstractNode $node + * @return void + */ + public function apply(AbstractNode $node) + { + $this->node = $node; + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/WriterStub.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/WriterStub.php new file mode 100644 index 0000000..4762151 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/Stubs/WriterStub.php @@ -0,0 +1,97 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\Stubs; + +use PHPMD\AbstractWriter; + +/** + * Simple test implementation of PHPMD's writer. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ +class WriterStub extends AbstractWriter +{ + /** + * The written data chunks. + * + * @var array + */ + public $chunks = array(); + + /** + * Writes a data string to the concrete output. + * + * @param string $data The data to write. + * + * @return void + */ + public function write($data) + { + $this->chunks[] = $data; + } + + /** + * Returns a concated string of all data chunks. + * + * @return string + */ + public function getData() + { + return join('', $this->chunks); + } + + /** + * Returns the written data chunks. + * + * @return array + */ + public function getChunks() + { + return $this->chunks; + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/TextUI/CommandLineOptionsTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/TextUI/CommandLineOptionsTest.php new file mode 100644 index 0000000..ddcf8b6 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/TextUI/CommandLineOptionsTest.php @@ -0,0 +1,246 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\TextUI; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\TextUI\CommandLineOptions} class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + * + * @covers \PHPMD\TextUI\CommandLineOptions + * @group phpmd + * @group phpmd::textui + * @group unittest + */ +class CommandLineOptionsTest extends AbstractTest +{ + /** + * testAssignsInputArgumentToInputProperty + * + * @return void + * @since 1.1.0 + */ + public function testAssignsInputArgumentToInputProperty() + { + $args = array('foo.php', __FILE__, 'text', 'design'); + $opts = new CommandLineOptions($args); + + self::assertEquals(__FILE__, $opts->getInputPath()); + } + + /** + * testAssignsFormatArgumentToReportFormatProperty + * + * @return void + * @since 1.1.0 + */ + public function testAssignsFormatArgumentToReportFormatProperty() + { + $args = array('foo.php', __FILE__, 'text', 'design'); + $opts = new CommandLineOptions($args); + + self::assertEquals('text', $opts->getReportFormat()); + } + + /** + * testAssignsRuleSetsArgumentToRuleSetProperty + * + * @return void + * @since 1.1.0 + */ + public function testAssignsRuleSetsArgumentToRuleSetProperty() + { + $args = array('foo.php', __FILE__, 'text', 'design'); + $opts = new CommandLineOptions($args); + + self::assertEquals('design', $opts->getRuleSets()); + } + + /** + * testThrowsExpectedExceptionWhenRequiredArgumentsNotSet + * + * @return void + * @since 1.1.0 + * @expectedException \InvalidArgumentException + */ + public function testThrowsExpectedExceptionWhenRequiredArgumentsNotSet() + { + $args = array(__FILE__, 'text', 'design'); + new CommandLineOptions($args); + } + + /** + * testAssignsInputFileOptionToInputPathProperty + * + * @return void + * @since 1.1.0 + */ + public function testAssignsInputFileOptionToInputPathProperty() + { + $uri = self::createResourceUriForTest('inputfile.txt'); + + $args = array('foo.php', 'text', 'design', '--inputfile', $uri); + $opts = new CommandLineOptions($args); + + self::assertEquals('Dir1/Class1.php,Dir2/Class2.php', $opts->getInputPath()); + } + + /** + * testAssignsFormatArgumentCorrectWhenCalledWithInputFile + * + * @return void + * @since 1.1.0 + */ + public function testAssignsFormatArgumentCorrectWhenCalledWithInputFile() + { + $uri = self::createResourceUriForTest('inputfile.txt'); + + $args = array('foo.php', 'text', 'design', '--inputfile', $uri); + $opts = new CommandLineOptions($args); + + self::assertEquals('text', $opts->getReportFormat()); + } + + /** + * testAssignsRuleSetsArgumentCorrectWhenCalledWithInputFile + * + * @return void + * @since 1.1.0 + */ + public function testAssignsRuleSetsArgumentCorrectWhenCalledWithInputFile() + { + $uri = self::createResourceUriForTest('inputfile.txt'); + + $args = array('foo.php', 'text', 'design', '--inputfile', $uri); + $opts = new CommandLineOptions($args); + + self::assertEquals('design', $opts->getRuleSets()); + } + + /** + * testThrowsExpectedExceptionWhenInputFileNotExists + * + * @return void + * @since 1.1.0 + * @expectedException \InvalidArgumentException + */ + public function testThrowsExpectedExceptionWhenInputFileNotExists() + { + $args = array('foo.php', 'text', 'design', '--inputfile', 'inputfail.txt'); + new CommandLineOptions($args); + } + + /** + * testCliOptionsAcceptsVersionArgument + * + * @return void + */ + public function testHasVersionReturnsFalseByDefault() + { + $args = array(__FILE__, __FILE__, 'text', 'unusedcode'); + $opts = new CommandLineOptions($args); + + self::assertFalse($opts->hasVersion()); + } + + /** + * testCliOptionsAcceptsVersionArgument + * + * @return void + */ + public function testCliOptionsAcceptsVersionArgument() + { + $args = array(__FILE__, '--version'); + $opts = new CommandLineOptions($args); + + self::assertTrue($opts->hasVersion()); + } + + /** + * testCliUsageContainsStrictOption + * + * @return void + */ + public function testCliUsageContainsStrictOption() + { + $args = array(__FILE__, __FILE__, 'text', 'codesize'); + $opts = new CommandLineOptions($args); + + $this->assertContains('--strict:', $opts->usage()); + } + + /** + * testCliOptionsIsStrictReturnsFalseByDefault + * + * @return void + * @since 1.2.0 + */ + public function testCliOptionsIsStrictReturnsFalseByDefault() + { + $args = array(__FILE__, __FILE__, 'text', 'codesize'); + $opts = new CommandLineOptions($args); + + self::assertFalse($opts->hasStrict()); + } + + /** + * testCliOptionsAcceptsStrictArgument + * + * @return void + * @since 1.2.0 + */ + public function testCliOptionsAcceptsStrictArgument() + { + $args = array(__FILE__, '--strict', __FILE__, 'text', 'codesize'); + $opts = new CommandLineOptions($args); + + self::assertTrue($opts->hasStrict()); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/PHPMD/TextUI/CommandTest.php b/vendor/phpmd/phpmd/src/test/php/PHPMD/TextUI/CommandTest.php new file mode 100644 index 0000000..7c0c829 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/PHPMD/TextUI/CommandTest.php @@ -0,0 +1,106 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +namespace PHPMD\TextUI; + +use PHPMD\AbstractTest; + +/** + * Test case for the {@link \PHPMD\TextUI\Command} class. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ +class CommandTest extends AbstractTest +{ + /** + * testMainReturnsSuccessExitCodeForSourceWithoutViolations + * + * @return void + * @covers \PHPMD\TextUI\Command + * @group phpmd + * @group phpmd::textui + * @group unittest + */ + public function testMainReturnsSuccessExitCodeForSourceWithoutViolations() + { + $exitCode = Command::main( + array( + __FILE__, + self::createFileUri('source/source_without_violations.php'), + 'text', + 'codesize', + '--reportfile', + self::createTempFileUri() + ) + ); + $this->assertEquals(Command::EXIT_SUCCESS, $exitCode); + } + + /** + * testMainReturnsViolationExitCodeForSourceWithNPathViolation + * + * @return void + * @covers \PHPMD\TextUI\Command + * @group phpmd + * @group phpmd::textui + * @group unittest + */ + public function testMainReturnsViolationExitCodeForSourceWithNPathViolation() + { + $exitCode = Command::main( + array( + __FILE__, + self::createFileUri('source/source_with_npath_violation.php'), + 'text', + 'codesize', + '--reportfile', + self::createTempFileUri() + ) + ); + $this->assertEquals(Command::EXIT_VIOLATION, $exitCode); + } +} diff --git a/vendor/phpmd/phpmd/src/test/php/bootstrap.php b/vendor/phpmd/phpmd/src/test/php/bootstrap.php new file mode 100644 index 0000000..f9e54aa --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/php/bootstrap.php @@ -0,0 +1,54 @@ +. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * * Neither the name of Manuel Pichler nor the names of his + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * @author Manuel Pichler + * @copyright 2008-2014 Manuel Pichler. All rights reserved. + * @license http://www.opensource.org/licenses/bsd-license.php BSD License + * @version @project.version@ + */ + +require_once __DIR__ . '/../../../vendor/autoload.php'; + +spl_autoload_register( + function ($class) { + $file = __DIR__ . '/' . strtr($class, '\\', '/') . '.php'; + if (file_exists($file)) { + include $file; + } + } +); diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Integration/CommandLineInputFileOption/Class1.php b/vendor/phpmd/phpmd/src/test/resources/files/Integration/CommandLineInputFileOption/Class1.php new file mode 100644 index 0000000..b822e33 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Integration/CommandLineInputFileOption/Class1.php @@ -0,0 +1,7 @@ +query(''); + } + + public function fail() + { + throw new \ErrorException(); + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Integration/GotoStatementIntegration/testReportContainsGotoStatementWarning.php b/vendor/phpmd/phpmd/src/test/resources/files/Integration/GotoStatementIntegration/testReportContainsGotoStatementWarning.php new file mode 100644 index 0000000..bbc29e8 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Integration/GotoStatementIntegration/testReportContainsGotoStatementWarning.php @@ -0,0 +1,10 @@ +bootstrap('frontController'); + $front = $this->getResource('frontController'); + $router = $front->getRouter(); + + $route = new Hostname24975295('foo', array('module' => 'default' )); + $router + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ->addRoute('default', $route->chain(new Route('x', array('controller' => 'index')))) + ; + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/ElseExpression/testRuleAppliesMultipleTimesToMethodWithMultipleElseExpressions.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/ElseExpression/testRuleAppliesMultipleTimesToMethodWithMultipleElseExpressions.php new file mode 100644 index 0000000..8274a84 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/ElseExpression/testRuleAppliesMultipleTimesToMethodWithMultipleElseExpressions.php @@ -0,0 +1,17 @@ +bar(); + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/StaticAccess/testRuleNotAppliesToParentStaticCall.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/StaticAccess/testRuleNotAppliesToParentStaticCall.php new file mode 100644 index 0000000..e90061e --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/CleanCode/StaticAccess/testRuleNotAppliesToParentStaticCall.php @@ -0,0 +1,9 @@ + $value) { + + } +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToShortVariableNameInCatchStatement.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToShortVariableNameInCatchStatement.php new file mode 100644 index 0000000..b1e3fd3 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/Naming/ShortVariable/testRuleNotAppliesToShortVariableNameInCatchStatement.php @@ -0,0 +1,7 @@ +id = $id; + } + +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleAppliesToFormalParameterWhenSimilarStaticMemberIsAccessed.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleAppliesToFormalParameterWhenSimilarStaticMemberIsAccessed.php new file mode 100644 index 0000000..e56bd25 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleAppliesToFormalParameterWhenSimilarStaticMemberIsAccessed.php @@ -0,0 +1,10 @@ +bar($foo); + } +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToMethodArgumentUsedAsArrayIndex.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToMethodArgumentUsedAsArrayIndex.php new file mode 100644 index 0000000..3443785 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedFormalParameter/testRuleDoesNotApplyToMethodArgumentUsedAsArrayIndex.php @@ -0,0 +1,10 @@ +42)); + + public function testRuleAppliesToLocalVariableWithSameNameAsStaticArrayProperty() + { + $foo = 23; + return self::$foo[0][1]; + } +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleAppliesToLocalVariableWithSameNameAsStaticProperty.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleAppliesToLocalVariableWithSameNameAsStaticProperty.php new file mode 100644 index 0000000..d39eb91 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleAppliesToLocalVariableWithSameNameAsStaticProperty.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToCompactFunction.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToCompactFunction.php new file mode 100644 index 0000000..aa55565 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToCompactFunction.php @@ -0,0 +1,9 @@ +$x = 42; + } +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToEnvSuperGlobal.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToEnvSuperGlobal.php new file mode 100644 index 0000000..d98bc26 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToEnvSuperGlobal.php @@ -0,0 +1,8 @@ +keys as $key) { + self::$values[$key] = 42; + } + } +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedAsStringIndex.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedAsStringIndex.php new file mode 100644 index 0000000..e6c741b --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedAsStringIndex.php @@ -0,0 +1,10 @@ +index as $idx) { + self::$string{$idx} = 'a'; + } + } +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedInCompoundVariable.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedInCompoundVariable.php new file mode 100644 index 0000000..96b671a --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToLocalVariableUsedInCompoundVariable.php @@ -0,0 +1,11 @@ +bar($foo); + } +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToNamespacedCompactFunction.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToNamespacedCompactFunction.php new file mode 100644 index 0000000..91142ff --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToNamespacedCompactFunction.php @@ -0,0 +1,12 @@ +getValue(); + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToStaticProperty.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToStaticProperty.php new file mode 100644 index 0000000..e603cee --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToStaticProperty.php @@ -0,0 +1,10 @@ +foo; + } +} \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToUnusedLocalVariableInFunction.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToUnusedLocalVariableInFunction.php new file mode 100644 index 0000000..b9d778c --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedLocalVariable/testRuleDoesNotApplyToUnusedLocalVariableInFunction.php @@ -0,0 +1,7 @@ +foo = 23; + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenLocalVariableIsUsedInStaticMemberPrefix.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenLocalVariableIsUsedInStaticMemberPrefix.php new file mode 100644 index 0000000..6af893c --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenLocalVariableIsUsedInStaticMemberPrefix.php @@ -0,0 +1,15 @@ +bar(); +var_dump($o::$foo); \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnDifferentClass.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnDifferentClass.php new file mode 100644 index 0000000..e89c912 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleAppliesWhenStaticFieldWithSameNameIsAccessedOnDifferentClass.php @@ -0,0 +1,10 @@ +foo[42]; + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateFieldInChainedMethodCall.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateFieldInChainedMethodCall.php new file mode 100644 index 0000000..589f073 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateFieldInChainedMethodCall.php @@ -0,0 +1,13 @@ +foo->attach($object); + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateStringIndexFieldAccess.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateStringIndexFieldAccess.php new file mode 100644 index 0000000..1df5992 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToPrivateStringIndexFieldAccess.php @@ -0,0 +1,10 @@ +foo{3}; + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToSelfAccessedPrivateField.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToSelfAccessedPrivateField.php new file mode 100644 index 0000000..bd65d61 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToSelfAccessedPrivateField.php @@ -0,0 +1,10 @@ +foo = 23; + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToUnusedProtectedField.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToUnusedProtectedField.php new file mode 100644 index 0000000..d07da44 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateField/testRuleDoesNotApplyToUnusedProtectedField.php @@ -0,0 +1,5 @@ +foo(); + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenMethodWithSimilarNameIsInInvocationChain.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenMethodWithSimilarNameIsInInvocationChain.php new file mode 100644 index 0000000..092f98c --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenMethodWithSimilarNameIsInInvocationChain.php @@ -0,0 +1,18 @@ +storage->attach($object); + } + + private function attach($object) + { + + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenPropertyWithSimilarNameIsReferenced.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenPropertyWithSimilarNameIsReferenced.php new file mode 100644 index 0000000..8d8231d --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleAppliesWhenPropertyWithSimilarNameIsReferenced.php @@ -0,0 +1,13 @@ +foo = 42; + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToClassNameReferencedMethod.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToClassNameReferencedMethod.php new file mode 100644 index 0000000..bdfb32a --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToClassNameReferencedMethod.php @@ -0,0 +1,13 @@ +bar()->attach($object); + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToPrivatePhp4Constructor.php b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToPrivatePhp4Constructor.php new file mode 100644 index 0000000..ac7d968 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/Rule/UnusedPrivateMethod/testRuleDoesNotApplyToPrivatePhp4Constructor.php @@ -0,0 +1,8 @@ +foo(); + } +} diff --git a/vendor/phpmd/phpmd/src/test/resources/files/RuleSet/testApplyInvokesRuleWhenStrictModeIsSet.php b/vendor/phpmd/phpmd/src/test/resources/files/RuleSet/testApplyInvokesRuleWhenStrictModeIsSet.php new file mode 100644 index 0000000..ed64b66 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/RuleSet/testApplyInvokesRuleWhenStrictModeIsSet.php @@ -0,0 +1,8 @@ + + + + + Arial + 12 + + + + memory + + + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/pmd/default-xml.xml b/vendor/phpmd/phpmd/src/test/resources/files/pmd/default-xml.xml new file mode 100644 index 0000000..6dd385c --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/pmd/default-xml.xml @@ -0,0 +1,8 @@ + + + + + The function ccn_function() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/pmd/single-directory.xml b/vendor/phpmd/phpmd/src/test/resources/files/pmd/single-directory.xml new file mode 100644 index 0000000..1b419d4 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/pmd/single-directory.xml @@ -0,0 +1,21 @@ + + + + + The function ccn_function() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. + + + + + The method doSomething() has an NPath complexity of 80. The configured NPath complexity threshold is 50. + + + + + The method doSomething() has a Cyclomatic Complexity of 25. The configured cyclomatic complexity threshold is 10. + + + The method doSomething() has an NPath complexity of 50000. The configured NPath complexity threshold is 50. + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/pmd/single-file.xml b/vendor/phpmd/phpmd/src/test/resources/files/pmd/single-file.xml new file mode 100644 index 0000000..6dd385c --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/pmd/single-file.xml @@ -0,0 +1,8 @@ + + + + + The function ccn_function() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/renderer/xml_renderer_expected1.xml b/vendor/phpmd/phpmd/src/test/resources/files/renderer/xml_renderer_expected1.xml new file mode 100644 index 0000000..0add154 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/renderer/xml_renderer_expected1.xml @@ -0,0 +1,16 @@ + + + + + Test description + + + + + Test description + + + Test description + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/renderer/xml_renderer_processing_errors.xml b/vendor/phpmd/phpmd/src/test/resources/files/renderer/xml_renderer_processing_errors.xml new file mode 100644 index 0000000..964cee3 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/renderer/xml_renderer_processing_errors.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/alternative-property-value-syntax.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/alternative-property-value-syntax.xml new file mode 100644 index 0000000..3a972e7 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/alternative-property-value-syntax.xml @@ -0,0 +1,23 @@ + + + + + First description... + + ... + 3 + + + 42 + + + + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/exclude-pattern.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/exclude-pattern.xml new file mode 100644 index 0000000..b84dd18 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/exclude-pattern.xml @@ -0,0 +1,22 @@ + + + + + Test exclude-pattern + + ... + 3 + + testCreateRuleWithExcludePattern + + + some/excluded/files + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/pmd-refset1.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/pmd-refset1.xml new file mode 100644 index 0000000..0662d41 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/pmd-refset1.xml @@ -0,0 +1,16 @@ + + + + First description... + + + + + + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset-exclude-all.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset-exclude-all.xml new file mode 100644 index 0000000..ee6993b --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset-exclude-all.xml @@ -0,0 +1,18 @@ + + + + + First description... + + + + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset-exclude-one.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset-exclude-one.xml new file mode 100644 index 0000000..71d7baf --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset-exclude-one.xml @@ -0,0 +1,17 @@ + + + + + First description... + + + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset1.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset1.xml new file mode 100644 index 0000000..87ed872 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset1.xml @@ -0,0 +1,13 @@ + + + + + First description... + + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset2.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset2.xml new file mode 100644 index 0000000..8c1866c --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset2.xml @@ -0,0 +1,13 @@ + + + + + First description... + + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset3.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset3.xml new file mode 100644 index 0000000..b5b7373 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset3.xml @@ -0,0 +1,19 @@ + + + + + First description... + + + -42 + description 42 + + + + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset4.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset4.xml new file mode 100644 index 0000000..6e63322 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/refset4.xml @@ -0,0 +1,16 @@ + + + + + First description... + + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-class-file-not-found.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-class-file-not-found.xml new file mode 100644 index 0000000..93e9951 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-class-file-not-found.xml @@ -0,0 +1,15 @@ + + + + First description... + + + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-class-not-found.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-class-not-found.xml new file mode 100644 index 0000000..0039d83 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-class-not-found.xml @@ -0,0 +1,15 @@ + + + + First description... + + + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-invalid-xml.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-invalid-xml.xml new file mode 100644 index 0000000..b3be901 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set-invalid-xml.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set1.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set1.xml new file mode 100644 index 0000000..7f26bfd --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set1.xml @@ -0,0 +1,29 @@ + + + + + First description... + + ... + 3 + + testCreateRuleWithExpectedExample + + + ... + 1 + + + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set2.xml b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set2.xml new file mode 100644 index 0000000..0218671 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/rulesets/set2.xml @@ -0,0 +1,31 @@ + + + + + Second description... + + + ... + 1 + + testCreateRuleWithExpectedMultipleExamplesOne + testCreateRuleWithExpectedMultipleExamplesTwo + + + ... + 5 + + + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/source/ccn_function.php b/vendor/phpmd/phpmd/src/test/resources/files/source/ccn_function.php new file mode 100644 index 0000000..c1a5758 --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/source/ccn_function.php @@ -0,0 +1,35 @@ + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/source/npath_method.php4 b/vendor/phpmd/phpmd/src/test/resources/files/source/npath_method.php4 new file mode 100644 index 0000000..12389fb --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/source/npath_method.php4 @@ -0,0 +1,15 @@ + diff --git a/vendor/phpmd/phpmd/src/test/resources/files/source/source_with_npath_violation.php b/vendor/phpmd/phpmd/src/test/resources/files/source/source_with_npath_violation.php new file mode 100644 index 0000000..6bb7e2f --- /dev/null +++ b/vendor/phpmd/phpmd/src/test/resources/files/source/source_with_npath_violation.php @@ -0,0 +1,19 @@ + + * + * 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; + +/** + * ConfigCache manages PHP cache files. + * + * When debug is enabled, it knows when to flush the cache + * thanks to an array of ResourceInterface instances. + * + * @author Fabien Potencier + */ +class ConfigCache +{ + private $debug; + private $file; + + /** + * Constructor. + * + * @param string $file The absolute cache path + * @param bool $debug Whether debugging is enabled or not + */ + public function __construct($file, $debug) + { + $this->file = $file; + $this->debug = (bool) $debug; + } + + /** + * Gets the cache file path. + * + * @return string The cache file path + */ + public function __toString() + { + return $this->file; + } + + /** + * Checks if the cache is still fresh. + * + * This method always returns true when debug is off and the + * cache file exists. + * + * @return bool true if the cache is fresh, false otherwise + */ + public function isFresh() + { + if (!is_file($this->file)) { + return false; + } + + if (!$this->debug) { + return true; + } + + $metadata = $this->getMetaFile(); + if (!is_file($metadata)) { + return false; + } + + $time = filemtime($this->file); + $meta = unserialize(file_get_contents($metadata)); + foreach ($meta as $resource) { + if (!$resource->isFresh($time)) { + return false; + } + } + + return true; + } + + /** + * Writes cache. + * + * @param string $content The content to write in the cache + * @param ResourceInterface[] $metadata An array of ResourceInterface instances + * + * @throws \RuntimeException When cache file can't be written + */ + public function write($content, array $metadata = null) + { + $mode = 0666; + $umask = umask(); + $filesystem = new Filesystem(); + $filesystem->dumpFile($this->file, $content, null); + try { + $filesystem->chmod($this->file, $mode, $umask); + } catch (IOException $e) { + // discard chmod failure (some filesystem may not support it) + } + + if (null !== $metadata && true === $this->debug) { + $filesystem->dumpFile($this->getMetaFile(), serialize($metadata), null); + try { + $filesystem->chmod($this->getMetaFile(), $mode, $umask); + } catch (IOException $e) { + // discard chmod failure (some filesystem may not support it) + } + } + } + + /** + * Gets the meta file path. + * + * @return string The meta file path + */ + private function getMetaFile() + { + return $this->file.'.meta'; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/ArrayNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/ArrayNode.php new file mode 100644 index 0000000..58d7d9b --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/ArrayNode.php @@ -0,0 +1,390 @@ + + * + * 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 = array(); + protected $children = array(); + protected $allowFalse = false; + protected $allowNewKeys = true; + protected $addIfNotSet = false; + protected $performDeepMerging = true; + protected $ignoreExtraKeys = false; + protected $normalizeKeys = true; + + public function setNormalizeKeys($normalizeKeys) + { + $this->normalizeKeys = (bool) $normalizeKeys; + } + + /** + * Normalizes keys between the different configuration formats. + * + * 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. + * + * @param mixed $value + * + * @return array The value with normalized keys + */ + protected function preNormalize($value) + { + if (!$this->normalizeKeys || !is_array($value)) { + return $value; + } + + foreach ($value as $k => $v) { + if (false !== strpos($k, '-') && false === strpos($k, '_') && !array_key_exists($normalizedKey = str_replace('-', '_', $k), $value)) { + $value[$normalizedKey] = $v; + unset($value[$k]); + } + } + + return $value; + } + + /** + * Retrieves the children of this node. + * + * @return array The children + */ + public function getChildren() + { + return $this->children; + } + + /** + * Sets the xml remappings that should be performed. + * + * @param array $remappings an array of the form array(array(string, string)) + */ + public function setXmlRemappings(array $remappings) + { + $this->xmlRemappings = $remappings; + } + + /** + * Gets the xml remappings that should be performed. + * + * @return array $remappings an array of the form array(array(string, string)) + */ + public function getXmlRemappings() + { + return $this->xmlRemappings; + } + + /** + * Sets whether to add default values for this array if it has not been + * defined in any of the configuration files. + * + * @param bool $boolean + */ + public function setAddIfNotSet($boolean) + { + $this->addIfNotSet = (bool) $boolean; + } + + /** + * Sets whether false is allowed as value indicating that the array should be unset. + * + * @param bool $allow + */ + public function setAllowFalse($allow) + { + $this->allowFalse = (bool) $allow; + } + + /** + * Sets whether new keys can be defined in subsequent configurations. + * + * @param bool $allow + */ + public function setAllowNewKeys($allow) + { + $this->allowNewKeys = (bool) $allow; + } + + /** + * Sets if deep merging should occur. + * + * @param bool $boolean + */ + public function setPerformDeepMerging($boolean) + { + $this->performDeepMerging = (bool) $boolean; + } + + /** + * Whether extra keys should just be ignore without an exception. + * + * @param bool $boolean To allow extra keys + */ + public function setIgnoreExtraKeys($boolean) + { + $this->ignoreExtraKeys = (bool) $boolean; + } + + /** + * Sets the node Name. + * + * @param string $name The node's name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Checks if the node has a default value. + * + * @return bool + */ + public function hasDefaultValue() + { + return $this->addIfNotSet; + } + + /** + * Retrieves the default value. + * + * @return array The default value + * + * @throws \RuntimeException if the node has no default value + */ + public function getDefaultValue() + { + if (!$this->hasDefaultValue()) { + throw new \RuntimeException(sprintf('The node at path "%s" has no default value.', $this->getPath())); + } + + $defaults = array(); + foreach ($this->children as $name => $child) { + if ($child->hasDefaultValue()) { + $defaults[$name] = $child->getDefaultValue(); + } + } + + return $defaults; + } + + /** + * Adds a child node. + * + * @param NodeInterface $node The child node to add + * + * @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 (!strlen($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; + } + + /** + * Finalizes the value of this node. + * + * @param mixed $value + * + * @return mixed The finalised value + * + * @throws UnsetKeyException + * @throws InvalidConfigurationException if the node doesn't have enough children + */ + protected function finalizeValue($value) + { + if (false === $value) { + $msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)); + throw new UnsetKeyException($msg); + } + + foreach ($this->children as $name => $child) { + if (!array_key_exists($name, $value)) { + if ($child->isRequired()) { + $msg = sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath()); + $ex = new InvalidConfigurationException($msg); + $ex->setPath($this->getPath()); + + throw $ex; + } + + if ($child->hasDefaultValue()) { + $value[$name] = $child->getDefaultValue(); + } + + continue; + } + + try { + $value[$name] = $child->finalize($value[$name]); + } catch (UnsetKeyException $unset) { + unset($value[$name]); + } + } + + return $value; + } + + /** + * Validates the type of the value. + * + * @param mixed $value + * + * @throws InvalidTypeException + */ + protected function validateType($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(), + gettype($value) + )); + $ex->setPath($this->getPath()); + + throw $ex; + } + } + + /** + * Normalizes the value. + * + * @param mixed $value The value to normalize + * + * @return mixed The normalized value + * + * @throws InvalidConfigurationException + */ + protected function normalizeValue($value) + { + if (false === $value) { + return $value; + } + + $value = $this->remapXml($value); + + $normalized = array(); + foreach ($value as $name => $val) { + if (isset($this->children[$name])) { + $normalized[$name] = $this->children[$name]->normalize($val); + unset($value[$name]); + } + } + + // if extra fields are present, throw exception + if (count($value) && !$this->ignoreExtraKeys) { + $msg = sprintf('Unrecognized options "%s" under "%s"', implode(', ', array_keys($value)), $this->getPath()); + $ex = new InvalidConfigurationException($msg); + $ex->setPath($this->getPath()); + + throw $ex; + } + + return $normalized; + } + + /** + * Remaps multiple singular values to a single plural value. + * + * @param array $value The source values + * + * @return array The remapped values + */ + protected function remapXml($value) + { + foreach ($this->xmlRemappings as $transformation) { + list($singular, $plural) = $transformation; + + if (!isset($value[$singular])) { + continue; + } + + $value[$plural] = Processor::normalizeConfig($value, $singular, $plural); + unset($value[$singular]); + } + + return $value; + } + + /** + * Merges values together. + * + * @param mixed $leftSide The left side to merge. + * @param mixed $rightSide The right side to merge. + * + * @return mixed The merged values + * + * @throws InvalidConfigurationException + * @throws \RuntimeException + */ + protected function mergeValues($leftSide, $rightSide) + { + 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])) { + throw new \RuntimeException('merge() expects a normalized config array.'); + } + + $leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v); + } + + return $leftSide; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/BaseNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/BaseNode.php new file mode 100644 index 0000000..1874ec3 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/BaseNode.php @@ -0,0 +1,359 @@ + + * + * 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; + +/** + * The base node class + * + * @author Johannes M. Schmitt + */ +abstract class BaseNode implements NodeInterface +{ + protected $name; + protected $parent; + protected $normalizationClosures = array(); + protected $finalValidationClosures = array(); + protected $allowOverwrite = true; + protected $required = false; + protected $equivalentValues = array(); + protected $attributes = array(); + + /** + * Constructor. + * + * @param string $name The name of the node + * @param NodeInterface $parent The parent of this node + * + * @throws \InvalidArgumentException if the name contains a period. + */ + public function __construct($name, NodeInterface $parent = null) + { + if (false !== strpos($name, '.')) { + throw new \InvalidArgumentException('The name must not contain ".".'); + } + + $this->name = $name; + $this->parent = $parent; + } + + public function setAttribute($key, $value) + { + $this->attributes[$key] = $value; + } + + public function getAttribute($key, $default = null) + { + return isset($this->attributes[$key]) ? $this->attributes[$key] : $default; + } + + public function hasAttribute($key) + { + return isset($this->attributes[$key]); + } + + public function getAttributes() + { + return $this->attributes; + } + + public function setAttributes(array $attributes) + { + $this->attributes = $attributes; + } + + public function removeAttribute($key) + { + unset($this->attributes[$key]); + } + + /** + * Sets an info message. + * + * @param string $info + */ + public function setInfo($info) + { + $this->setAttribute('info', $info); + } + + /** + * Returns info message. + * + * @return string The info text + */ + public function getInfo() + { + return $this->getAttribute('info'); + } + + /** + * Sets the example configuration for this node. + * + * @param string|array $example + */ + public function setExample($example) + { + $this->setAttribute('example', $example); + } + + /** + * Retrieves the example configuration for this node. + * + * @return string|array The example + */ + public function getExample() + { + return $this->getAttribute('example'); + } + + /** + * Adds an equivalent value. + * + * @param mixed $originalValue + * @param mixed $equivalentValue + */ + public function addEquivalentValue($originalValue, $equivalentValue) + { + $this->equivalentValues[] = array($originalValue, $equivalentValue); + } + + /** + * Set this node as required. + * + * @param bool $boolean Required node + */ + public function setRequired($boolean) + { + $this->required = (bool) $boolean; + } + + /** + * Sets if this node can be overridden. + * + * @param bool $allow + */ + public function setAllowOverwrite($allow) + { + $this->allowOverwrite = (bool) $allow; + } + + /** + * Sets the closures used for normalization. + * + * @param \Closure[] $closures An array of Closures used for normalization + */ + public function setNormalizationClosures(array $closures) + { + $this->normalizationClosures = $closures; + } + + /** + * Sets the closures used for final validation. + * + * @param \Closure[] $closures An array of Closures used for final validation + */ + public function setFinalValidationClosures(array $closures) + { + $this->finalValidationClosures = $closures; + } + + /** + * Checks if this node is required. + * + * @return bool + */ + public function isRequired() + { + return $this->required; + } + + /** + * Returns the name of this node + * + * @return string The Node's name. + */ + public function getName() + { + return $this->name; + } + + /** + * Retrieves the path of this node. + * + * @return string The Node's path + */ + public function getPath() + { + $path = $this->name; + + if (null !== $this->parent) { + $path = $this->parent->getPath().'.'.$path; + } + + return $path; + } + + /** + * Merges two values together. + * + * @param mixed $leftSide + * @param mixed $rightSide + * + * @return mixed The merged value + * + * @throws ForbiddenOverwriteException + */ + final public function merge($leftSide, $rightSide) + { + 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() + )); + } + + $this->validateType($leftSide); + $this->validateType($rightSide); + + return $this->mergeValues($leftSide, $rightSide); + } + + /** + * Normalizes a value, applying all normalization closures. + * + * @param mixed $value Value to normalize. + * + * @return mixed The normalized value. + */ + final public function normalize($value) + { + $value = $this->preNormalize($value); + + // run custom normalization closures + foreach ($this->normalizationClosures as $closure) { + $value = $closure($value); + } + + // replace value with their equivalent + foreach ($this->equivalentValues as $data) { + if ($data[0] === $value) { + $value = $data[1]; + } + } + + // validate type + $this->validateType($value); + + // normalize value + return $this->normalizeValue($value); + } + + /** + * Normalizes the value before any other normalization is applied. + * + * @param $value + * + * @return $value The normalized array value + */ + protected function preNormalize($value) + { + return $value; + } + + /** + * Returns parent node for this node. + * + * @return NodeInterface|null + */ + public function getParent() + { + return $this->parent; + } + + /** + * Finalizes a value, applying all finalization closures. + * + * @param mixed $value The value to finalize + * + * @return mixed The finalized value + * + * @throws Exception + * @throws InvalidConfigurationException + */ + final public function finalize($value) + { + $this->validateType($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 $correctEx) { + throw $correctEx; + } catch (\Exception $invalid) { + throw new InvalidConfigurationException(sprintf( + 'Invalid configuration for path "%s": %s', + $this->getPath(), + $invalid->getMessage() + ), $invalid->getCode(), $invalid); + } + } + + return $value; + } + + /** + * Validates the type of a Node. + * + * @param mixed $value The value to validate + * + * @throws InvalidTypeException when the value is invalid + */ + abstract protected function validateType($value); + + /** + * Normalizes the value. + * + * @param mixed $value The value to normalize. + * + * @return mixed The normalized value + */ + abstract protected function normalizeValue($value); + + /** + * Merges two values together. + * + * @param mixed $leftSide + * @param mixed $rightSide + * + * @return mixed The merged value + */ + abstract protected function mergeValues($leftSide, $rightSide); + + /** + * Finalizes a value. + * + * @param mixed $value The value to finalize + * + * @return mixed The finalized value + */ + abstract protected function finalizeValue($value); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/BooleanNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/BooleanNode.php new file mode 100644 index 0000000..939e86f --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/BooleanNode.php @@ -0,0 +1,39 @@ + + * + * 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 +{ + /** + * {@inheritdoc} + */ + protected function validateType($value) + { + if (!is_bool($value)) { + $ex = new InvalidTypeException(sprintf( + 'Invalid type for path "%s". Expected boolean, but got %s.', + $this->getPath(), + gettype($value) + )); + $ex->setPath($this->getPath()); + + throw $ex; + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php new file mode 100644 index 0000000..2aef41d --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -0,0 +1,488 @@ + + * + * 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\PrototypedArrayNode; +use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; + +/** + * 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 $children = array(); + protected $prototype; + protected $atLeastOne = false; + protected $allowNewKeys = true; + protected $key; + protected $removeKeyItem; + protected $addDefaults = false; + protected $addDefaultChildren = false; + protected $nodeBuilder; + protected $normalizeKeys = true; + + /** + * {@inheritdoc} + */ + public function __construct($name, NodeParentInterface $parent = null) + { + parent::__construct($name, $parent); + + $this->nullEquivalent = array(); + $this->trueEquivalent = array(); + } + + /** + * Sets a custom children builder. + * + * @param NodeBuilder $builder A custom NodeBuilder + */ + public function setBuilder(NodeBuilder $builder) + { + $this->nodeBuilder = $builder; + } + + /** + * Returns a builder to add children nodes. + * + * @return NodeBuilder + */ + public function children() + { + return $this->getNodeBuilder(); + } + + /** + * Sets a prototype for child nodes. + * + * @param string $type the type of node + * + * @return NodeDefinition + */ + public function prototype($type) + { + return $this->prototype = $this->getNodeBuilder()->node(null, $type)->setParent($this); + } + + /** + * 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 ArrayNodeDefinition + */ + public function addDefaultsIfNotSet() + { + $this->addDefaults = true; + + return $this; + } + + /** + * Adds children with a default value when none are defined. + * + * @param int|string|array|null $children The number of children|The child name|The children names to be added + * + * This method is applicable to prototype nodes only. + * + * @return ArrayNodeDefinition + */ + public function addDefaultChildrenIfNoneSet($children = null) + { + $this->addDefaultChildren = $children; + + return $this; + } + + /** + * Requires the node to have at least one element. + * + * This method is applicable to prototype nodes only. + * + * @return ArrayNodeDefinition + */ + public function requiresAtLeastOneElement() + { + $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 ArrayNodeDefinition + */ + public function disallowNewKeysInSubsequentConfigs() + { + $this->allowNewKeys = false; + + return $this; + } + + /** + * Sets a normalization rule for XML configurations. + * + * @param string $singular The key to remap + * @param string $plural The plural of the key for irregular plurals + * + * @return ArrayNodeDefinition + */ + public function fixXmlConfig($singular, $plural = null) + { + $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: + * + * array( + * array('id' => 'my_name', 'foo' => 'bar'), + * ); + * + * becomes + * + * array( + * 'my_name' => array('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 ArrayNodeDefinition + */ + public function useAttributeAsKey($name, $removeKeyItem = true) + { + $this->key = $name; + $this->removeKeyItem = $removeKeyItem; + + return $this; + } + + /** + * Sets whether the node can be unset. + * + * @param bool $allow + * + * @return ArrayNodeDefinition + */ + public function canBeUnset($allow = true) + { + $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 ArrayNodeDefinition + */ + public function canBeEnabled() + { + $this + ->addDefaultsIfNotSet() + ->treatFalseLike(array('enabled' => false)) + ->treatTrueLike(array('enabled' => true)) + ->treatNullLike(array('enabled' => true)) + ->beforeNormalization() + ->ifArray() + ->then(function ($v) { + $v['enabled'] = isset($v['enabled']) ? $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 ArrayNodeDefinition + */ + public function canBeDisabled() + { + $this + ->addDefaultsIfNotSet() + ->treatFalseLike(array('enabled' => false)) + ->treatTrueLike(array('enabled' => true)) + ->treatNullLike(array('enabled' => true)) + ->children() + ->booleanNode('enabled') + ->defaultTrue() + ; + + return $this; + } + + /** + * Disables the deep merging of the node. + * + * @return ArrayNodeDefinition + */ + public function performNoDeepMerging() + { + $this->performDeepMerging = false; + + return $this; + } + + /** + * Allows extra config keys to be specified under an array without + * throwing an exception. + * + * Those config values are simply ignored. 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. + * + * @return ArrayNodeDefinition + */ + public function ignoreExtraKeys() + { + $this->ignoreExtraKeys = true; + + return $this; + } + + /** + * Sets key normalization. + * + * @param bool $bool Whether to enable key normalization + * + * @return ArrayNodeDefinition + */ + public function normalizeKeys($bool) + { + $this->normalizeKeys = (bool) $bool; + + return $this; + } + + /** + * Appends a node definition. + * + * $node = new ArrayNodeDefinition() + * ->children() + * ->scalarNode('foo')->end() + * ->scalarNode('baz')->end() + * ->end() + * ->append($this->getBarNodeDefinition()) + * ; + * + * @param NodeDefinition $node A NodeDefinition instance + * + * @return ArrayNodeDefinition This node + */ + public function append(NodeDefinition $node) + { + $this->children[$node->name] = $node->setParent($this); + + return $this; + } + + /** + * Returns a node builder to be used to add children and prototype + * + * @return NodeBuilder The node builder + */ + protected function getNodeBuilder() + { + if (null === $this->nodeBuilder) { + $this->nodeBuilder = new NodeBuilder(); + } + + return $this->nodeBuilder->setParent($this); + } + + /** + * {@inheritdoc} + */ + protected function createNode() + { + if (null === $this->prototype) { + $node = new ArrayNode($this->name, $this->parent); + + $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->validatePrototypeNode($node); + + if (null !== $this->key) { + $node->setKeyAttribute($this->key, $this->removeKeyItem); + } + + if (true === $this->atLeastOne) { + $node->setMinNumberOfElements(1); + } + + if ($this->default) { + $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); + $node->setNormalizeKeys($this->normalizeKeys); + + if (null !== $this->normalization) { + $node->setNormalizationClosures($this->normalization->before); + $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. + * + * @param ArrayNode $node The related node + * + * @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 (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. + * + * @param PrototypedArrayNode $node The related node + * + * @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_integer($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) + ); + } + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php new file mode 100644 index 0000000..979f9ba --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php @@ -0,0 +1,42 @@ + + * + * 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; + +/** + * This class provides a fluent interface for defining a node. + * + * @author Johannes M. Schmitt + */ +class BooleanNodeDefinition extends ScalarNodeDefinition +{ + /** + * {@inheritdoc} + */ + public function __construct($name, NodeParentInterface $parent = null) + { + parent::__construct($name, $parent); + + $this->nullEquivalent = true; + } + + /** + * Instantiate a Node + * + * @return BooleanNode The node + */ + protected function instantiateNode() + { + return new BooleanNode($this->name, $this->parent); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php new file mode 100644 index 0000000..d3ef35b --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php @@ -0,0 +1,53 @@ + + * + * 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 $values; + + public function values(array $values) + { + $values = array_unique($values); + + if (count($values) <= 1) { + throw new \InvalidArgumentException('->values() must be called with at least two distinct values.'); + } + + $this->values = $values; + + return $this; + } + + /** + * Instantiate a Node + * + * @return EnumNode The node + * + * @throws \RuntimeException + */ + protected function instantiateNode() + { + if (null === $this->values) { + throw new \RuntimeException('You must call ->values() on enum nodes.'); + } + + return new EnumNode($this->name, $this->parent, $this->values); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ExprBuilder.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ExprBuilder.php new file mode 100644 index 0000000..7cbddc6 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ExprBuilder.php @@ -0,0 +1,236 @@ + + * + * 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 +{ + protected $node; + public $ifPart; + public $thenPart; + + /** + * Constructor + * + * @param NodeDefinition $node The related node + */ + public function __construct(NodeDefinition $node) + { + $this->node = $node; + } + + /** + * Marks the expression as being always used. + * + * @param \Closure $then + * + * @return ExprBuilder + */ + public function always(\Closure $then = null) + { + $this->ifPart = function ($v) { return true; }; + + if (null !== $then) { + $this->thenPart = $then; + } + + return $this; + } + + /** + * Sets a closure to use as tests. + * + * The default one tests if the value is true. + * + * @param \Closure $closure + * + * @return ExprBuilder + */ + public function ifTrue(\Closure $closure = null) + { + if (null === $closure) { + $closure = function ($v) { return true === $v; }; + } + + $this->ifPart = $closure; + + return $this; + } + + /** + * Tests if the value is a string. + * + * @return ExprBuilder + */ + public function ifString() + { + $this->ifPart = function ($v) { return is_string($v); }; + + return $this; + } + + /** + * Tests if the value is null. + * + * @return ExprBuilder + */ + public function ifNull() + { + $this->ifPart = function ($v) { return null === $v; }; + + return $this; + } + + /** + * Tests if the value is an array. + * + * @return ExprBuilder + */ + public function ifArray() + { + $this->ifPart = function ($v) { return is_array($v); }; + + return $this; + } + + /** + * Tests if the value is in an array. + * + * @param array $array + * + * @return ExprBuilder + */ + public function ifInArray(array $array) + { + $this->ifPart = function ($v) use ($array) { return in_array($v, $array, true); }; + + return $this; + } + + /** + * Tests if the value is not in an array. + * + * @param array $array + * + * @return ExprBuilder + */ + public function ifNotInArray(array $array) + { + $this->ifPart = function ($v) use ($array) { return !in_array($v, $array, true); }; + + return $this; + } + + /** + * Sets the closure to run if the test pass. + * + * @param \Closure $closure + * + * @return ExprBuilder + */ + public function then(\Closure $closure) + { + $this->thenPart = $closure; + + return $this; + } + + /** + * Sets a closure returning an empty array. + * + * @return ExprBuilder + */ + public function thenEmptyArray() + { + $this->thenPart = function ($v) { return array(); }; + + return $this; + } + + /** + * Sets a closure marking the value as invalid at validation time. + * + * if you want to add the value of the node in your message just use a %s placeholder. + * + * @param string $message + * + * @return ExprBuilder + * + * @throws \InvalidArgumentException + */ + public function thenInvalid($message) + { + $this->thenPart = function ($v) use ($message) {throw new \InvalidArgumentException(sprintf($message, json_encode($v))); }; + + return $this; + } + + /** + * Sets a closure unsetting this key of the array at validation time. + * + * @return ExprBuilder + * + * @throws UnsetKeyException + */ + public function thenUnset() + { + $this->thenPart = function ($v) { throw new UnsetKeyException('Unsetting key'); }; + + return $this; + } + + /** + * Returns the related node + * + * @return NodeDefinition + * + * @throws \RuntimeException + */ + public function end() + { + 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 + * + * @return array + */ + public static function buildExpressions(array $expressions) + { + foreach ($expressions as $k => $expr) { + if ($expr instanceof ExprBuilder) { + $expressions[$k] = function ($v) use ($expr) { + return call_user_func($expr->ifPart, $v) ? call_user_func($expr->thenPart, $v) : $v; + }; + } + } + + return $expressions; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php new file mode 100644 index 0000000..c0bed46 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/FloatNodeDefinition.php @@ -0,0 +1,32 @@ + + * + * 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. + * + * @return FloatNode The node + */ + protected function instantiateNode() + { + return new FloatNode($this->name, $this->parent, $this->min, $this->max); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php new file mode 100644 index 0000000..f6c3c14 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/IntegerNodeDefinition.php @@ -0,0 +1,32 @@ + + * + * 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. + * + * @return IntegerNode The node + */ + protected function instantiateNode() + { + return new IntegerNode($this->name, $this->parent, $this->min, $this->max); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/MergeBuilder.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/MergeBuilder.php new file mode 100644 index 0000000..be06288 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/MergeBuilder.php @@ -0,0 +1,72 @@ + + * + * 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; + + /** + * Constructor + * + * @param NodeDefinition $node The related node + */ + public function __construct(NodeDefinition $node) + { + $this->node = $node; + } + + /** + * Sets whether the node can be unset. + * + * @param bool $allow + * + * @return MergeBuilder + */ + public function allowUnset($allow = true) + { + $this->allowFalse = $allow; + + return $this; + } + + /** + * Sets whether the node can be overwritten. + * + * @param bool $deny Whether the overwriting is forbidden or not + * + * @return MergeBuilder + */ + public function denyOverwrite($deny = true) + { + $this->allowOverwrite = !$deny; + + return $this; + } + + /** + * Returns the related node. + * + * @return NodeDefinition + */ + public function end() + { + return $this->node; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeBuilder.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeBuilder.php new file mode 100644 index 0000000..29914cb --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeBuilder.php @@ -0,0 +1,246 @@ + + * + * 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; + + /** + * Constructor + * + */ + public function __construct() + { + $this->nodeMapping = array( + 'variable' => __NAMESPACE__.'\\VariableNodeDefinition', + 'scalar' => __NAMESPACE__.'\\ScalarNodeDefinition', + 'boolean' => __NAMESPACE__.'\\BooleanNodeDefinition', + 'integer' => __NAMESPACE__.'\\IntegerNodeDefinition', + 'float' => __NAMESPACE__.'\\FloatNodeDefinition', + 'array' => __NAMESPACE__.'\\ArrayNodeDefinition', + 'enum' => __NAMESPACE__.'\\EnumNodeDefinition', + ); + } + + /** + * Set the parent node. + * + * @param ParentNodeDefinitionInterface $parent The parent node + * + * @return NodeBuilder This node builder + */ + public function setParent(ParentNodeDefinitionInterface $parent = null) + { + $this->parent = $parent; + + return $this; + } + + /** + * Creates a child array node. + * + * @param string $name The name of the node + * + * @return ArrayNodeDefinition The child node + */ + public function arrayNode($name) + { + return $this->node($name, 'array'); + } + + /** + * Creates a child scalar node. + * + * @param string $name the name of the node + * + * @return ScalarNodeDefinition The child node + */ + public function scalarNode($name) + { + return $this->node($name, 'scalar'); + } + + /** + * Creates a child Boolean node. + * + * @param string $name The name of the node + * + * @return BooleanNodeDefinition The child node + */ + public function booleanNode($name) + { + return $this->node($name, 'boolean'); + } + + /** + * Creates a child integer node. + * + * @param string $name the name of the node + * + * @return IntegerNodeDefinition The child node + */ + public function integerNode($name) + { + return $this->node($name, 'integer'); + } + + /** + * Creates a child float node. + * + * @param string $name the name of the node + * + * @return FloatNodeDefinition The child node + */ + public function floatNode($name) + { + return $this->node($name, 'float'); + } + + /** + * Creates a child EnumNode. + * + * @param string $name + * + * @return EnumNodeDefinition + */ + public function enumNode($name) + { + return $this->node($name, 'enum'); + } + + /** + * Creates a child variable node. + * + * @param string $name The name of the node + * + * @return VariableNodeDefinition The builder of the child node + */ + public function variableNode($name) + { + return $this->node($name, 'variable'); + } + + /** + * Returns the parent node. + * + * @return ParentNodeDefinitionInterface The parent node + */ + public function end() + { + return $this->parent; + } + + /** + * Creates a child node. + * + * @param string $name The name of the node + * @param string $type The type of the node + * + * @return NodeDefinition The child node + * + * @throws \RuntimeException When the node type is not registered + * @throws \RuntimeException When the node class is not found + */ + public function node($name, $type) + { + $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() + * ; + * + * @param NodeDefinition $node + * + * @return NodeBuilder This node builder + */ + public function append(NodeDefinition $node) + { + if ($node instanceof ParentNodeDefinitionInterface) { + $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 NodeBuilder This node builder + */ + public function setNodeClass($type, $class) + { + $this->nodeMapping[strtolower($type)] = $class; + + return $this; + } + + /** + * Returns the class name of the node definition. + * + * @param string $type The node type + * + * @return string The node definition class name + * + * @throws \RuntimeException When the node type is not registered + * @throws \RuntimeException When the node class is not found + */ + protected function getNodeClass($type) + { + $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/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeDefinition.php new file mode 100644 index 0000000..6b1e67d --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeDefinition.php @@ -0,0 +1,343 @@ + + * + * 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\Exception\InvalidDefinitionException; + +/** + * 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 $merge; + protected $allowEmptyValue = true; + protected $nullEquivalent; + protected $trueEquivalent = true; + protected $falseEquivalent = false; + + /** + * @var NodeParentInterface|null + */ + protected $parent; + protected $attributes = array(); + + /** + * Constructor + * + * @param string $name The name of the node + * @param NodeParentInterface|null $parent The parent + */ + public function __construct($name, NodeParentInterface $parent = null) + { + $this->parent = $parent; + $this->name = $name; + } + + /** + * Sets the parent node. + * + * @param NodeParentInterface $parent The parent + * + * @return NodeDefinition + */ + public function setParent(NodeParentInterface $parent) + { + $this->parent = $parent; + + return $this; + } + + /** + * Sets info message. + * + * @param string $info The info text + * + * @return NodeDefinition + */ + public function info($info) + { + return $this->attribute('info', $info); + } + + /** + * Sets example configuration. + * + * @param string|array $example + * + * @return NodeDefinition + */ + public function example($example) + { + return $this->attribute('example', $example); + } + + /** + * Sets an attribute on the node. + * + * @param string $key + * @param mixed $value + * + * @return NodeDefinition + */ + public function attribute($key, $value) + { + $this->attributes[$key] = $value; + + return $this; + } + + /** + * Returns the parent node. + * + * @return NodeParentInterface|null The builder of the parent node + */ + public function end() + { + return $this->parent; + } + + /** + * Creates the node. + * + * @param bool $forceRootNode Whether to force this node as the root node + * + * @return NodeInterface + */ + public function getNode($forceRootNode = false) + { + if ($forceRootNode) { + $this->parent = null; + } + + if (null !== $this->normalization) { + $this->normalization->before = ExprBuilder::buildExpressions($this->normalization->before); + } + + if (null !== $this->validation) { + $this->validation->rules = ExprBuilder::buildExpressions($this->validation->rules); + } + + $node = $this->createNode(); + $node->setAttributes($this->attributes); + + return $node; + } + + /** + * Sets the default value. + * + * @param mixed $value The default value + * + * @return NodeDefinition + */ + public function defaultValue($value) + { + $this->default = true; + $this->defaultValue = $value; + + return $this; + } + + /** + * Sets the node as required. + * + * @return NodeDefinition + */ + public function isRequired() + { + $this->required = true; + + return $this; + } + + /** + * Sets the equivalent value used when the node contains null. + * + * @param mixed $value + * + * @return NodeDefinition + */ + public function treatNullLike($value) + { + $this->nullEquivalent = $value; + + return $this; + } + + /** + * Sets the equivalent value used when the node contains true. + * + * @param mixed $value + * + * @return NodeDefinition + */ + public function treatTrueLike($value) + { + $this->trueEquivalent = $value; + + return $this; + } + + /** + * Sets the equivalent value used when the node contains false. + * + * @param mixed $value + * + * @return NodeDefinition + */ + public function treatFalseLike($value) + { + $this->falseEquivalent = $value; + + return $this; + } + + /** + * Sets null as the default value. + * + * @return NodeDefinition + */ + public function defaultNull() + { + return $this->defaultValue(null); + } + + /** + * Sets true as the default value. + * + * @return NodeDefinition + */ + public function defaultTrue() + { + return $this->defaultValue(true); + } + + /** + * Sets false as the default value. + * + * @return NodeDefinition + */ + public function defaultFalse() + { + return $this->defaultValue(false); + } + + /** + * Sets an expression to run before the normalization. + * + * @return ExprBuilder + */ + public function beforeNormalization() + { + return $this->normalization()->before(); + } + + /** + * Denies the node value being empty. + * + * @return NodeDefinition + */ + public function cannotBeEmpty() + { + $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. + * + * @return ExprBuilder + */ + public function validate() + { + return $this->validation()->rule(); + } + + /** + * Sets whether the node can be overwritten. + * + * @param bool $deny Whether the overwriting is forbidden or not + * + * @return NodeDefinition + */ + public function cannotBeOverwritten($deny = true) + { + $this->merge()->denyOverwrite($deny); + + return $this; + } + + /** + * Gets the builder for validation rules. + * + * @return ValidationBuilder + */ + protected function validation() + { + if (null === $this->validation) { + $this->validation = new ValidationBuilder($this); + } + + return $this->validation; + } + + /** + * Gets the builder for merging rules. + * + * @return MergeBuilder + */ + protected function merge() + { + if (null === $this->merge) { + $this->merge = new MergeBuilder($this); + } + + return $this->merge; + } + + /** + * Gets the builder for normalization rules. + * + * @return NormalizationBuilder + */ + protected function normalization() + { + if (null === $this->normalization) { + $this->normalization = new NormalizationBuilder($this); + } + + return $this->normalization; + } + + /** + * Instantiate and configure the node according to this definition + * + * @return NodeInterface $node The node instance + * + * @throws InvalidDefinitionException When the definition is invalid + */ + abstract protected function createNode(); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeParentInterface.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeParentInterface.php new file mode 100644 index 0000000..24f3971 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NodeParentInterface.php @@ -0,0 +1,21 @@ + + * + * 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/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php new file mode 100644 index 0000000..4020f60 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php @@ -0,0 +1,67 @@ + + * + * 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 = array(); + public $remappings = array(); + + /** + * Constructor + * + * @param NodeDefinition $node The related node + */ + 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 $plural The plural of the key in case of irregular plural + * + * @return NormalizationBuilder + */ + public function remap($key, $plural = null) + { + $this->remappings[] = array($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. + * + * @param \Closure $closure + * + * @return ExprBuilder|NormalizationBuilder + */ + public function before(\Closure $closure = null) + { + if (null !== $closure) { + $this->before[] = $closure; + + return $this; + } + + return $this->before[] = new ExprBuilder($this->node); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php new file mode 100644 index 0000000..ddd716d --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php @@ -0,0 +1,61 @@ + + * + * 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; + +/** + * 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. + * + * @param mixed $max + * + * @return NumericNodeDefinition + * + * @throws \InvalidArgumentException when the constraint is inconsistent + */ + public function max($max) + { + 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. + * + * @param mixed $min + * + * @return NumericNodeDefinition + * + * @throws \InvalidArgumentException when the constraint is inconsistent + */ + public function min($min) + { + 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; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php new file mode 100644 index 0000000..005c26b --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php @@ -0,0 +1,26 @@ + + * + * 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 +{ + public function children(); + + public function append(NodeDefinition $node); + + public function setBuilder(NodeBuilder $builder); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php new file mode 100644 index 0000000..6a115fe --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ScalarNodeDefinition.php @@ -0,0 +1,32 @@ + + * + * 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 + * + * @return ScalarNode The node + */ + protected function instantiateNode() + { + return new ScalarNode($this->name, $this->parent); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/TreeBuilder.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/TreeBuilder.php new file mode 100644 index 0000000..5d02848 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/TreeBuilder.php @@ -0,0 +1,63 @@ + + * + * 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; + protected $builder; + + /** + * Creates the root node. + * + * @param string $name The name of the root node + * @param string $type The type of the root node + * @param NodeBuilder $builder A custom node builder instance + * + * @return ArrayNodeDefinition|NodeDefinition The root node (as an ArrayNodeDefinition when the type is 'array') + * + * @throws \RuntimeException When the node type is not supported + */ + public function root($name, $type = 'array', NodeBuilder $builder = null) + { + $builder = $builder ?: new NodeBuilder(); + + return $this->root = $builder->node($name, $type)->setParent($this); + } + + /** + * Builds the tree. + * + * @return NodeInterface + * + * @throws \RuntimeException + */ + public function buildTree() + { + if (null === $this->root) { + throw new \RuntimeException('The configuration tree has no root node.'); + } + if (null !== $this->tree) { + return $this->tree; + } + + return $this->tree = $this->root->getNode(true); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php new file mode 100644 index 0000000..56d6ddc --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php @@ -0,0 +1,51 @@ + + * + * 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 = array(); + + /** + * Constructor + * + * @param NodeDefinition $node The related node + */ + 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. + * + * @param \Closure $closure + * + * @return ExprBuilder|ValidationBuilder + */ + public function rule(\Closure $closure = null) + { + if (null !== $closure) { + $this->rules[] = $closure; + + return $this; + } + + return $this->rules[] = new ExprBuilder($this->node); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php new file mode 100644 index 0000000..cd1b3cf --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Builder/VariableNodeDefinition.php @@ -0,0 +1,64 @@ + + * + * 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\VariableNode; + +/** + * This class provides a fluent interface for defining a node. + * + * @author Johannes M. Schmitt + */ +class VariableNodeDefinition extends NodeDefinition +{ + /** + * Instantiate a Node + * + * @return VariableNode The node + */ + protected function instantiateNode() + { + return new VariableNode($this->name, $this->parent); + } + + /** + * {@inheritdoc} + */ + protected function createNode() + { + $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 (null !== $this->validation) { + $node->setFinalValidationClosures($this->validation->rules); + } + + return $node; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/ConfigurationInterface.php b/vendor/symfony/config/Symfony/Component/Config/Definition/ConfigurationInterface.php new file mode 100644 index 0000000..336cb00 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/ConfigurationInterface.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Definition; + +/** + * Configuration interface + * + * @author Victor Berchet + */ +interface ConfigurationInterface +{ + /** + * Generates the configuration tree builder. + * + * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + */ + public function getConfigTreeBuilder(); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php new file mode 100644 index 0000000..10c4dd4 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php @@ -0,0 +1,300 @@ + + * + * 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\ConfigurationInterface; +use Symfony\Component\Config\Definition\NodeInterface; +use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\EnumNode; +use Symfony\Component\Config\Definition\PrototypedArrayNode; + +/** + * Dumps a XML reference configuration for the given configuration/node instance. + * + * @author Wouter J + */ +class XmlReferenceDumper +{ + private $reference; + + public function dump(ConfigurationInterface $configuration, $namespace = null) + { + return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace); + } + + public function dumpNode(NodeInterface $node, $namespace = null) + { + $this->reference = ''; + $this->writeNode($node, 0, true, $namespace); + $ref = $this->reference; + $this->reference = null; + + return $ref; + } + + /** + * @param NodeInterface $node + * @param int $depth + * @param bool $root If the node is the root node + * @param string $namespace The namespace of the node + */ + private function writeNode(NodeInterface $node, $depth = 0, $root = false, $namespace = null) + { + $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(), function ($mapping) use ($rootName) { + return $rootName === $mapping[1]; + }); + + if (count($remapping)) { + list($singular, $plural) = current($remapping); + $rootName = $singular; + } + } + $rootName = str_replace('_', '-', $rootName); + + $rootAttributes = array(); + $rootAttributeComments = array(); + $rootChildren = array(); + $rootComments = array(); + + 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) { + array_unshift($rootComments, 'prototype'); + + if ($key = $node->getKeyAttribute()) { + $rootAttributes[$key] = str_replace('-', ' ', $rootName).' '.$key; + } + + $prototype = $node->getPrototype(); + + if ($prototype instanceof ArrayNode) { + $children = $prototype->getChildren(); + } else { + if ($prototype->hasDefaultValue()) { + $prototypeValue = $prototype->getDefaultValue(); + } else { + switch (get_class($prototype)) { + case 'Symfony\Component\Config\Definition\ScalarNode': + $prototypeValue = 'scalar value'; + break; + + case 'Symfony\Component\Config\Definition\FloatNode': + case 'Symfony\Component\Config\Definition\IntegerNode': + $prototypeValue = 'numeric value'; + break; + + case 'Symfony\Component\Config\Definition\BooleanNode': + $prototypeValue = 'true|false'; + break; + + case 'Symfony\Component\Config\Definition\EnumNode': + $prototypeValue = implode('|', array_map('json_encode', $prototype->getValues())); + break; + + default: + $prototypeValue = 'value'; + } + } + } + } + + // get attributes and elements + foreach ($children as $child) { + if (!$child instanceof ArrayNode) { + // get attributes + + // metadata + $name = str_replace('_', '-', $child->getName()); + $value = '%%%%not_defined%%%%'; // use a string which isn't used in the normal world + + // comments + $comments = array(); + if ($info = $child->getInfo()) { + $comments[] = $info; + } + + if ($example = $child->getExample()) { + $comments[] = 'Example: '.$example; + } + + if ($child->isRequired()) { + $comments[] = 'Required'; + } + + if ($child instanceof EnumNode) { + $comments[] = 'One of '.implode('; ', array_map('json_encode', $child->getValues())); + } + + if (count($comments)) { + $rootAttributeComments[$name] = implode(";\n", $comments); + } + + // default values + if ($child->hasDefaultValue()) { + $value = $child->getDefaultValue(); + } + + // append attribute + $rootAttributes[$name] = $value; + } else { + // get elements + $rootChildren[] = $child; + } + } + } + + // 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 + * + * @param string $text + * @param int $indent + */ + private function writeLine($text, $indent = 0) + { + $indent = strlen($text) + $indent; + $format = '%'.$indent.'s'; + + $this->reference .= sprintf($format, $text)."\n"; + } + + /** + * Renders the string conversion of the value. + * + * @param mixed $value + * + * @return string + */ + private function writeValue($value) + { + 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); + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php new file mode 100644 index 0000000..a722955 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php @@ -0,0 +1,199 @@ + + * + * 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\ConfigurationInterface; +use Symfony\Component\Config\Definition\NodeInterface; +use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\ScalarNode; +use Symfony\Component\Config\Definition\EnumNode; +use Symfony\Component\Config\Definition\PrototypedArrayNode; +use Symfony\Component\Yaml\Inline; + +/** + * Dumps a Yaml reference configuration for the given configuration/node instance. + * + * @author Kevin Bond + */ +class YamlReferenceDumper +{ + private $reference; + + public function dump(ConfigurationInterface $configuration) + { + return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree()); + } + + public function dumpNode(NodeInterface $node) + { + $this->reference = ''; + $this->writeNode($node); + $ref = $this->reference; + $this->reference = null; + + return $ref; + } + + /** + * @param NodeInterface $node + * @param int $depth + */ + private function writeNode(NodeInterface $node, $depth = 0) + { + $comments = array(); + $default = ''; + $defaultArray = null; + $children = null; + $example = $node->getExample(); + + // defaults + if ($node instanceof ArrayNode) { + $children = $node->getChildren(); + + if ($node instanceof PrototypedArrayNode) { + $prototype = $node->getPrototype(); + + if ($prototype instanceof ArrayNode) { + $children = $prototype->getChildren(); + } + + // check for attribute as key + if ($key = $node->getKeyAttribute()) { + $keyNodeClass = 'Symfony\Component\Config\Definition\\'.($prototype instanceof ArrayNode ? 'ArrayNode' : 'ScalarNode'); + $keyNode = new $keyNodeClass($key, $node); + $keyNode->setInfo('Prototype'); + + // add children + foreach ($children as $childNode) { + $keyNode->addChild($childNode); + } + $children = array($key => $keyNode); + } + } + + if (!$children) { + if ($node->hasDefaultValue() && count($defaultArray = $node->getDefaultValue())) { + $default = ''; + } elseif (!is_array($example)) { + $default = '[]'; + } + } + } elseif ($node instanceof EnumNode) { + $comments[] = 'One of '.implode('; ', array_map('json_encode', $node->getValues())); + $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'; + } + + // example + if ($example && !is_array($example)) { + $comments[] = 'Example: '.$example; + } + + $default = (string) $default != '' ? ' '.$default : ''; + $comments = count($comments) ? '# '.implode(', ', $comments) : ''; + + $text = rtrim(sprintf('%-20s %s %s', $node->getName().':', $default, $comments), ' '); + + if ($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($example, $depth + 1); + } + + if ($children) { + foreach ($children as $childNode) { + $this->writeNode($childNode, $depth + 1); + } + } + } + + /** + * Outputs a single config reference line + * + * @param string $text + * @param int $indent + */ + private function writeLine($text, $indent = 0) + { + $indent = strlen($text) + $indent; + $format = '%'.$indent.'s'; + + $this->reference .= sprintf($format, $text)."\n"; + } + + private function writeArray(array $array, $depth) + { + $isIndexed = array_values($array) === $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); + } + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/EnumNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/EnumNode.php new file mode 100644 index 0000000..224871a --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/EnumNode.php @@ -0,0 +1,58 @@ + + * + * 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 $values; + + public function __construct($name, NodeInterface $parent = null, array $values = array()) + { + $values = array_unique($values); + if (count($values) <= 1) { + throw new \InvalidArgumentException('$values must contain at least two distinct elements.'); + } + + parent::__construct($name, $parent); + $this->values = $values; + } + + public function getValues() + { + return $this->values; + } + + protected function finalizeValue($value) + { + $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(), + implode(', ', array_map('json_encode', $this->values)))); + $ex->setPath($this->getPath()); + + throw $ex; + } + + return $value; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/DuplicateKeyException.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/DuplicateKeyException.php new file mode 100644 index 0000000..48dd932 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/DuplicateKeyException.php @@ -0,0 +1,22 @@ + + * + * 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/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/Exception.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/Exception.php new file mode 100644 index 0000000..1fda6c2 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/Exception.php @@ -0,0 +1,21 @@ + + * + * 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/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/ForbiddenOverwriteException.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/ForbiddenOverwriteException.php new file mode 100644 index 0000000..726c07f --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/ForbiddenOverwriteException.php @@ -0,0 +1,22 @@ + + * + * 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/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php new file mode 100644 index 0000000..840e3f3 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidConfigurationException.php @@ -0,0 +1,33 @@ + + * + * 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 $path; + + public function setPath($path) + { + $this->path = $path; + } + + public function getPath() + { + return $this->path; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidDefinitionException.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidDefinitionException.php new file mode 100644 index 0000000..98310da --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidDefinitionException.php @@ -0,0 +1,21 @@ + + * + * 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/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidTypeException.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidTypeException.php new file mode 100644 index 0000000..d7ca8c9 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/InvalidTypeException.php @@ -0,0 +1,21 @@ + + * + * 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/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/UnsetKeyException.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/UnsetKeyException.php new file mode 100644 index 0000000..863181a --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Exception/UnsetKeyException.php @@ -0,0 +1,22 @@ + + * + * 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/vendor/symfony/config/Symfony/Component/Config/Definition/FloatNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/FloatNode.php new file mode 100644 index 0000000..0fe0e34 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/FloatNode.php @@ -0,0 +1,40 @@ + + * + * 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 +{ + /** + * {@inheritdoc} + */ + protected function validateType($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(), gettype($value))); + $ex->setPath($this->getPath()); + + throw $ex; + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/IntegerNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/IntegerNode.php new file mode 100644 index 0000000..f76efe6 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/IntegerNode.php @@ -0,0 +1,35 @@ + + * + * 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 +{ + /** + * {@inheritdoc} + */ + protected function validateType($value) + { + if (!is_int($value)) { + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected int, but got %s.', $this->getPath(), gettype($value))); + $ex->setPath($this->getPath()); + + throw $ex; + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/NodeInterface.php b/vendor/symfony/config/Symfony/Component/Config/Definition/NodeInterface.php new file mode 100644 index 0000000..7387264 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/NodeInterface.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Definition; + +/** + * 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. + * + * @return string The name of the node + */ + public function getName(); + + /** + * Returns the path of the node. + * + * @return string The node path + */ + public function getPath(); + + /** + * Returns true when the node is required. + * + * @return bool If the node is required + */ + public function isRequired(); + + /** + * Returns true when the node has a default value. + * + * @return bool If the node has a default value + */ + public function hasDefaultValue(); + + /** + * Returns the default value of the node. + * + * @return mixed The default value + * @throws \RuntimeException if the node has no default value + */ + public function getDefaultValue(); + + /** + * Normalizes the supplied value. + * + * @param mixed $value The value to normalize + * + * @return mixed The normalized value + */ + public function normalize($value); + + /** + * Merges two values together. + * + * @param mixed $leftSide + * @param mixed $rightSide + * + * @return mixed The merged values + */ + public function merge($leftSide, $rightSide); + + /** + * Finalizes a value. + * + * @param mixed $value The value to finalize + * + * @return mixed The finalized value + */ + public function finalize($value); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/NumericNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/NumericNode.php new file mode 100644 index 0000000..39b96d6 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/NumericNode.php @@ -0,0 +1,55 @@ + + * + * 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($name, NodeInterface $parent = null, $min = null, $max = null) + { + parent::__construct($name, $parent); + $this->min = $min; + $this->max = $max; + } + + /** + * {@inheritdoc} + */ + protected function finalizeValue($value) + { + $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; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php b/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php new file mode 100644 index 0000000..025e693 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php @@ -0,0 +1,97 @@ + + * + * 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 + */ +class Processor +{ + /** + * Processes an array of configurations. + * + * @param NodeInterface $configTree The node tree describing the configuration + * @param array $configs An array of configuration items to process + * + * @return array The processed configuration + */ + public function process(NodeInterface $configTree, array $configs) + { + $currentConfig = array(); + foreach ($configs as $config) { + $config = $configTree->normalize($config); + $currentConfig = $configTree->merge($currentConfig, $config); + } + + return $configTree->finalize($currentConfig); + } + + /** + * Processes an array of configurations. + * + * @param ConfigurationInterface $configuration The configuration class + * @param array $configs An array of configuration items to process + * + * @return array The processed configuration + */ + public function processConfiguration(ConfigurationInterface $configuration, array $configs) + { + 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 $plural The plural form of the key if it is irregular + * + * @return array + */ + public static function normalizeConfig($config, $key, $plural = null) + { + if (null === $plural) { + $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 array($config[$key]); + } + + return $config[$key]; + } + + return array(); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/PrototypeNodeInterface.php b/vendor/symfony/config/Symfony/Component/Config/Definition/PrototypeNodeInterface.php new file mode 100644 index 0000000..8bbb84d --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/PrototypeNodeInterface.php @@ -0,0 +1,27 @@ + + * + * 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. + * + * @param string $name The name of the node + */ + public function setName($name); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/PrototypedArrayNode.php new file mode 100644 index 0000000..3dc64d0 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/PrototypedArrayNode.php @@ -0,0 +1,331 @@ + + * + * 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\DuplicateKeyException; +use Symfony\Component\Config\Definition\Exception\UnsetKeyException; +use Symfony\Component\Config\Definition\Exception\Exception; + +/** + * 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 = array(); + protected $defaultChildren; + + /** + * Sets the minimum number of elements that a prototype based node must + * contain. By default this is zero, meaning no elements. + * + * @param int $number + */ + public function setMinNumberOfElements($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: + * + * array( + * array('id' => 'my_name', 'foo' => 'bar'), + * ); + * + * becomes + * + * array( + * 'my_name' => array('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 + */ + public function setKeyAttribute($attribute, $remove = true) + { + $this->keyAttribute = $attribute; + $this->removeKeyAttribute = $remove; + } + + /** + * Retrieves the name of the attribute which value should be used as key. + * + * @return string The name of the attribute + */ + public function getKeyAttribute() + { + return $this->keyAttribute; + } + + /** + * Sets the default value of this node. + * + * @param string $value + * + * @throws \InvalidArgumentException if the default value is not an array + */ + public function setDefaultValue($value) + { + if (!is_array($value)) { + throw new \InvalidArgumentException($this->getPath().': the default value of an array node has to be an array.'); + } + + $this->defaultValue = $value; + } + + /** + * Checks if the node has a default value. + * + * @return bool + */ + public function hasDefaultValue() + { + 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 + */ + public function setAddChildrenIfNoneSet($children = array('defaults')) + { + if (null === $children) { + $this->defaultChildren = array('defaults'); + } else { + $this->defaultChildren = is_integer($children) && $children > 0 ? range(1, $children) : (array) $children; + } + } + + /** + * Retrieves the default value. + * + * The default value could be either explicited or derived from the prototype + * default value. + * + * @return array The default value + */ + public function getDefaultValue() + { + if (null !== $this->defaultChildren) { + $default = $this->prototype->hasDefaultValue() ? $this->prototype->getDefaultValue() : array(); + $defaults = array(); + foreach (array_values($this->defaultChildren) as $i => $name) { + $defaults[null === $this->keyAttribute ? $i : $name] = $default; + } + + return $defaults; + } + + return $this->defaultValue; + } + + /** + * Sets the node prototype. + * + * @param PrototypeNodeInterface $node + */ + public function setPrototype(PrototypeNodeInterface $node) + { + $this->prototype = $node; + } + + /** + * Retrieves the prototype + * + * @return PrototypeNodeInterface The prototype + */ + public function getPrototype() + { + return $this->prototype; + } + + /** + * Disable adding concrete children for prototyped nodes. + * + * @param NodeInterface $node The child node to add + * + * @throws Exception + */ + public function addChild(NodeInterface $node) + { + throw new Exception('A prototyped array node can not have concrete children.'); + } + + /** + * Finalizes the value of this node. + * + * @param mixed $value + * + * @return mixed The finalized value + * + * @throws UnsetKeyException + * @throws InvalidConfigurationException if the node doesn't have enough children + */ + protected function finalizeValue($value) + { + if (false === $value) { + $msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)); + throw new UnsetKeyException($msg); + } + + foreach ($value as $k => $v) { + $this->prototype->setName($k); + try { + $value[$k] = $this->prototype->finalize($v); + } catch (UnsetKeyException $unset) { + unset($value[$k]); + } + } + + if (count($value) < $this->minNumberOfElements) { + $msg = sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements); + $ex = new InvalidConfigurationException($msg); + $ex->setPath($this->getPath()); + + throw $ex; + } + + return $value; + } + + /** + * Normalizes the value. + * + * @param mixed $value The value to normalize + * + * @return mixed The normalized value + * + * @throws InvalidConfigurationException + * @throws DuplicateKeyException + */ + protected function normalizeValue($value) + { + if (false === $value) { + return $value; + } + + $value = $this->remapXml($value); + + $isAssoc = array_keys($value) !== range(0, count($value) -1); + $normalized = array(); + foreach ($value as $k => $v) { + if (null !== $this->keyAttribute && is_array($v)) { + if (!isset($v[$this->keyAttribute]) && is_int($k) && !$isAssoc) { + $msg = sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath()); + $ex = new InvalidConfigurationException($msg); + $ex->setPath($this->getPath()); + + throw $ex; + } elseif (isset($v[$this->keyAttribute])) { + $k = $v[$this->keyAttribute]; + + // remove the key attribute when required + if ($this->removeKeyAttribute) { + unset($v[$this->keyAttribute]); + } + + // if only "value" is left + if (1 == count($v) && isset($v['value'])) { + $v = $v['value']; + } + } + + if (array_key_exists($k, $normalized)) { + $msg = sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath()); + $ex = new DuplicateKeyException($msg); + $ex->setPath($this->getPath()); + + throw $ex; + } + } + + $this->prototype->setName($k); + if (null !== $this->keyAttribute || $isAssoc) { + $normalized[$k] = $this->prototype->normalize($v); + } else { + $normalized[] = $this->prototype->normalize($v); + } + } + + return $normalized; + } + + /** + * Merges values together. + * + * @param mixed $leftSide The left side to merge. + * @param mixed $rightSide The right side to merge. + * + * @return mixed The merged values + * + * @throws InvalidConfigurationException + * @throws \RuntimeException + */ + protected function mergeValues($leftSide, $rightSide) + { + 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) { + // prototype, and key is irrelevant, so simply append the element + if (null === $this->keyAttribute) { + $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; + } + + $this->prototype->setName($k); + $leftSide[$k] = $this->prototype->merge($leftSide[$k], $v); + } + + return $leftSide; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/ReferenceDumper.php b/vendor/symfony/config/Symfony/Component/Config/Definition/ReferenceDumper.php new file mode 100644 index 0000000..7fe336d --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/ReferenceDumper.php @@ -0,0 +1,21 @@ + + * + * 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\Dumper\YamlReferenceDumper; + +/** + * @deprecated Deprecated since version 2.4, to be removed in 3.0. Use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper instead. + */ +class ReferenceDumper extends YamlReferenceDumper +{ +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/ScalarNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/ScalarNode.php new file mode 100644 index 0000000..44ccfc5 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/ScalarNode.php @@ -0,0 +1,46 @@ + + * + * 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 +{ + /** + * {@inheritdoc} + */ + protected function validateType($value) + { + if (!is_scalar($value) && null !== $value) { + $ex = new InvalidTypeException(sprintf( + 'Invalid type for path "%s". Expected scalar, but got %s.', + $this->getPath(), + gettype($value) + )); + $ex->setPath($this->getPath()); + + throw $ex; + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Definition/VariableNode.php b/vendor/symfony/config/Symfony/Component/Config/Definition/VariableNode.php new file mode 100644 index 0000000..61acc18 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Definition/VariableNode.php @@ -0,0 +1,114 @@ + + * + * 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; + + /** + * {@inheritdoc} + */ + public function setDefaultValue($value) + { + $this->defaultValueSet = true; + $this->defaultValue = $value; + } + + /** + * {@inheritdoc} + */ + public function hasDefaultValue() + { + return $this->defaultValueSet; + } + + /** + * {@inheritdoc} + */ + public function getDefaultValue() + { + return $this->defaultValue instanceof \Closure ? call_user_func($this->defaultValue) : $this->defaultValue; + } + + /** + * Sets if this node is allowed to have an empty value. + * + * @param bool $boolean True if this entity will accept empty values. + */ + public function setAllowEmptyValue($boolean) + { + $this->allowEmptyValue = (bool) $boolean; + } + + /** + * {@inheritdoc} + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * {@inheritdoc} + */ + protected function validateType($value) + { + } + + /** + * {@inheritdoc} + */ + protected function finalizeValue($value) + { + if (!$this->allowEmptyValue && empty($value)) { + $ex = new InvalidConfigurationException(sprintf( + 'The path "%s" cannot contain an empty value, but got %s.', + $this->getPath(), + json_encode($value) + )); + $ex->setPath($this->getPath()); + + throw $ex; + } + + return $value; + } + + /** + * {@inheritdoc} + */ + protected function normalizeValue($value) + { + return $value; + } + + /** + * {@inheritdoc} + */ + protected function mergeValues($leftSide, $rightSide) + { + return $rightSide; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php b/vendor/symfony/config/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php new file mode 100644 index 0000000..b1ad442 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php @@ -0,0 +1,27 @@ + + * + * 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 FileLoaderLoadException +{ + public function __construct(array $resources, $code = null, $previous = null) + { + $message = sprintf('Circular reference detected in "%s" ("%s" > "%s").', $this->varToString($resources[0]), implode('" > "', $resources), $resources[0]); + + call_user_func('Exception::__construct', $message, $code, $previous); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Exception/FileLoaderLoadException.php b/vendor/symfony/config/Symfony/Component/Config/Exception/FileLoaderLoadException.php new file mode 100644 index 0000000..d05cf8f --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Exception/FileLoaderLoadException.php @@ -0,0 +1,81 @@ + + * + * 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 resource cannot be loaded or imported. + * + * @author Ryan Weaver + */ +class FileLoaderLoadException extends \Exception +{ + /** + * @param string $resource The resource that could not be imported + * @param string $sourceResource The original resource importing the new resource + * @param int $code The error code + * @param \Exception $previous A previous exception + */ + public function __construct($resource, $sourceResource = null, $code = null, $previous = null) + { + if (null === $sourceResource) { + $message = sprintf('Cannot load resource "%s".', $this->varToString($resource)); + } else { + $message = sprintf('Cannot import resource "%s" from "%s".', $this->varToString($resource), $this->varToString($sourceResource)); + } + + // Is the resource located inside a bundle? + if ('@' === $resource[0]) { + $parts = explode(DIRECTORY_SEPARATOR, $resource); + $bundle = substr($parts[0], 1); + $message .= ' '.sprintf('Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle); + } elseif ($previous) { + // include the previous exception, to help the user see what might be the underlying cause + $message .= ' '.sprintf('(%s)', $previous->getMessage()); + } + + parent::__construct($message, $code, $previous); + } + + protected function varToString($var) + { + if (is_object($var)) { + return sprintf('Object(%s)', get_class($var)); + } + + if (is_array($var)) { + $a = array(); + foreach ($var as $k => $v) { + $a[] = sprintf('%s => %s', $k, $this->varToString($v)); + } + + return sprintf("Array(%s)", implode(', ', $a)); + } + + if (is_resource($var)) { + return sprintf('Resource(%s)', get_resource_type($var)); + } + + if (null === $var) { + return 'null'; + } + + if (false === $var) { + return 'false'; + } + + if (true === $var) { + return 'true'; + } + + return (string) $var; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/FileLocator.php b/vendor/symfony/config/Symfony/Component/Config/FileLocator.php new file mode 100644 index 0000000..71bb5ab --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/FileLocator.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config; + +/** + * FileLocator uses an array of pre-defined paths to find files. + * + * @author Fabien Potencier + */ +class FileLocator implements FileLocatorInterface +{ + protected $paths; + + /** + * Constructor. + * + * @param string|array $paths A path or an array of paths where to look for resources + */ + public function __construct($paths = array()) + { + $this->paths = (array) $paths; + } + + /** + * {@inheritdoc} + */ + public function locate($name, $currentPath = null, $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 \InvalidArgumentException(sprintf('The file "%s" does not exist.', $name)); + } + + return $name; + } + + $filepaths = array(); + if (null !== $currentPath && file_exists($file = $currentPath.DIRECTORY_SEPARATOR.$name)) { + if (true === $first) { + return $file; + } + $filepaths[] = $file; + } + + foreach ($this->paths as $path) { + if (file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) { + if (true === $first) { + return $file; + } + $filepaths[] = $file; + } + } + + if (!$filepaths) { + throw new \InvalidArgumentException(sprintf('The file "%s" does not exist (in: %s%s).', $name, null !== $currentPath ? $currentPath.', ' : '', implode(', ', $this->paths))); + } + + return array_values(array_unique($filepaths)); + } + + /** + * 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/vendor/symfony/config/Symfony/Component/Config/FileLocatorInterface.php b/vendor/symfony/config/Symfony/Component/Config/FileLocatorInterface.php new file mode 100644 index 0000000..6605798 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/FileLocatorInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config; + +/** + * @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 When file is not found + */ + public function locate($name, $currentPath = null, $first = true); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/LICENSE b/vendor/symfony/config/Symfony/Component/Config/LICENSE new file mode 100644 index 0000000..0b3292c --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2014 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/vendor/symfony/config/Symfony/Component/Config/Loader/DelegatingLoader.php b/vendor/symfony/config/Symfony/Component/Config/Loader/DelegatingLoader.php new file mode 100644 index 0000000..3097878 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Loader/DelegatingLoader.php @@ -0,0 +1,55 @@ + + * + * 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\FileLoaderLoadException; + +/** + * 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 +{ + /** + * Constructor. + * + * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance + */ + public function __construct(LoaderResolverInterface $resolver) + { + $this->resolver = $resolver; + } + + /** + * {@inheritdoc} + */ + public function load($resource, $type = null) + { + if (false === $loader = $this->resolver->resolve($resource, $type)) { + throw new FileLoaderLoadException($resource); + } + + return $loader->load($resource, $type); + } + + /** + * {@inheritdoc} + */ + public function supports($resource, $type = null) + { + return false !== $this->resolver->resolve($resource, $type); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Loader/FileLoader.php b/vendor/symfony/config/Symfony/Component/Config/Loader/FileLoader.php new file mode 100644 index 0000000..8e8cb0b --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Loader/FileLoader.php @@ -0,0 +1,124 @@ + + * + * 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\FileLocatorInterface; +use Symfony\Component\Config\Exception\FileLoaderLoadException; +use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException; + +/** + * FileLoader is the abstract class used by all built-in loaders that are file based. + * + * @author Fabien Potencier + */ +abstract class FileLoader extends Loader +{ + /** + * @var array + */ + protected static $loading = array(); + + /** + * @var FileLocatorInterface + */ + protected $locator; + + private $currentDir; + + /** + * Constructor. + * + * @param FileLocatorInterface $locator A FileLocatorInterface instance + */ + public function __construct(FileLocatorInterface $locator) + { + $this->locator = $locator; + } + + /** + * Sets the current directory. + * + * @param string $dir + */ + public function setCurrentDir($dir) + { + $this->currentDir = $dir; + } + + /** + * Returns the file locator used by this loader. + * + * @return FileLocatorInterface + */ + public function getLocator() + { + 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 + * + * @return mixed + * + * @throws FileLoaderLoadException + * @throws FileLoaderImportCircularReferenceException + */ + public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null) + { + try { + $loader = $this->resolve($resource, $type); + + if ($loader instanceof FileLoader && null !== $this->currentDir) { + // we fallback to the current locator to keep BC + // as some some loaders do not call the parent __construct() + // @deprecated should be removed in 3.0 + $locator = $loader->getLocator() ?: $this->locator; + $resource = $locator->locate($resource, $this->currentDir, false); + } + + $resources = is_array($resource) ? $resource : array($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; + + $ret = $loader->load($resource, $type); + + 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 FileLoaderLoadException) { + throw $e; + } + + throw new FileLoaderLoadException($resource, $sourceResource, null, $e); + } + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Loader/Loader.php b/vendor/symfony/config/Symfony/Component/Config/Loader/Loader.php new file mode 100644 index 0000000..de4e127 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Loader/Loader.php @@ -0,0 +1,78 @@ + + * + * 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\FileLoaderLoadException; + +/** + * Loader is the abstract class used by all built-in loaders. + * + * @author Fabien Potencier + */ +abstract class Loader implements LoaderInterface +{ + protected $resolver; + + /** + * {@inheritdoc} + */ + public function getResolver() + { + return $this->resolver; + } + + /** + * {@inheritdoc} + */ + public function setResolver(LoaderResolverInterface $resolver) + { + $this->resolver = $resolver; + } + + /** + * Imports a resource. + * + * @param mixed $resource A resource + * @param string|null $type The resource type or null if unknown + * + * @return mixed + */ + public function import($resource, $type = null) + { + return $this->resolve($resource, $type)->load($resource, $type); + } + + /** + * Finds a loader able to load an imported resource. + * + * @param mixed $resource A resource + * @param string|null $type The resource type or null if unknown + * + * @return LoaderInterface A LoaderInterface instance + * + * @throws FileLoaderLoadException If no loader is found + */ + public function resolve($resource, $type = null) + { + if ($this->supports($resource, $type)) { + return $this; + } + + $loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type); + + if (false === $loader) { + throw new FileLoaderLoadException($resource); + } + + return $loader; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderInterface.php b/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderInterface.php new file mode 100644 index 0000000..dd0a85a --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderInterface.php @@ -0,0 +1,54 @@ + + * + * 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. + * + * @param mixed $resource The resource + * @param string|null $type The resource type or null if unknown + * + * @throws \Exception If something went wrong + */ + public function load($resource, $type = null); + + /** + * Returns whether this class supports the given resource. + * + * @param mixed $resource A resource + * @param string|null $type The resource type or null if unknown + * + * @return bool True if this class supports the given resource, false otherwise + */ + public function supports($resource, $type = null); + + /** + * Gets the loader resolver. + * + * @return LoaderResolverInterface A LoaderResolverInterface instance + */ + public function getResolver(); + + /** + * Sets the loader resolver. + * + * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance + */ + public function setResolver(LoaderResolverInterface $resolver); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderResolver.php b/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderResolver.php new file mode 100644 index 0000000..dc6846d --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderResolver.php @@ -0,0 +1,75 @@ + + * + * 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 $loaders = array(); + + /** + * Constructor. + * + * @param LoaderInterface[] $loaders An array of loaders + */ + public function __construct(array $loaders = array()) + { + foreach ($loaders as $loader) { + $this->addLoader($loader); + } + } + + /** + * {@inheritdoc} + */ + public function resolve($resource, $type = null) + { + foreach ($this->loaders as $loader) { + if ($loader->supports($resource, $type)) { + return $loader; + } + } + + return false; + } + + /** + * Adds a loader. + * + * @param LoaderInterface $loader A LoaderInterface instance + */ + public function addLoader(LoaderInterface $loader) + { + $this->loaders[] = $loader; + $loader->setResolver($this); + } + + /** + * Returns the registered loaders. + * + * @return LoaderInterface[] An array of LoaderInterface instances + */ + public function getLoaders() + { + return $this->loaders; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderResolverInterface.php b/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderResolverInterface.php new file mode 100644 index 0000000..40f1a1a --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Loader/LoaderResolverInterface.php @@ -0,0 +1,30 @@ + + * + * 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 mixed $resource A resource + * @param string|null $type The resource type or null if unknown + * + * @return LoaderInterface|false The loader or false if none is able to load the resource + */ + public function resolve($resource, $type = null); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/README.md b/vendor/symfony/config/Symfony/Component/Config/README.md new file mode 100644 index 0000000..1b12e89 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/README.md @@ -0,0 +1,17 @@ +Config Component +================ + +Config provides the infrastructure for loading configurations from different +data sources and optionally monitoring these data sources for changes. There +are additional tools for validating, normalizing and handling of defaults that +can optionally be used to convert from different formats to arrays. + +Resources +--------- + +You can run the unit tests with the following command: + + $ cd path/to/Symfony/Component/Config/ + $ composer.phar install + $ phpunit + diff --git a/vendor/symfony/config/Symfony/Component/Config/Resource/DirectoryResource.php b/vendor/symfony/config/Symfony/Component/Config/Resource/DirectoryResource.php new file mode 100644 index 0000000..f15b81a --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Resource/DirectoryResource.php @@ -0,0 +1,99 @@ + + * + * 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 + */ +class DirectoryResource implements ResourceInterface, \Serializable +{ + private $resource; + private $pattern; + + /** + * Constructor. + * + * @param string $resource The file path to the resource + * @param string|null $pattern A pattern to restrict monitored files + */ + public function __construct($resource, $pattern = null) + { + $this->resource = $resource; + $this->pattern = $pattern; + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return (string) $this->resource; + } + + /** + * {@inheritdoc} + */ + public function getResource() + { + return $this->resource; + } + + /** + * Returns the pattern to restrict monitored files + * + * @return string|null + */ + public function getPattern() + { + return $this->pattern; + } + + /** + * {@inheritdoc} + */ + public function isFresh($timestamp) + { + if (!is_dir($this->resource)) { + return false; + } + + $newestMTime = filemtime($this->resource); + 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() && '/..' === substr($file, -3)) { + continue; + } + + $newestMTime = max($file->getMTime(), $newestMTime); + } + + return $newestMTime < $timestamp; + } + + public function serialize() + { + return serialize(array($this->resource, $this->pattern)); + } + + public function unserialize($serialized) + { + list($this->resource, $this->pattern) = unserialize($serialized); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Resource/FileResource.php b/vendor/symfony/config/Symfony/Component/Config/Resource/FileResource.php new file mode 100644 index 0000000..b828e7d --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Resource/FileResource.php @@ -0,0 +1,75 @@ + + * + * 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 + */ +class FileResource implements ResourceInterface, \Serializable +{ + /** + * @var string|false + */ + private $resource; + + /** + * Constructor. + * + * @param string $resource The file path to the resource + */ + public function __construct($resource) + { + $this->resource = realpath($resource); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return (string) $this->resource; + } + + /** + * {@inheritdoc} + */ + public function getResource() + { + return $this->resource; + } + + /** + * {@inheritdoc} + */ + public function isFresh($timestamp) + { + if (false === $this->resource || !file_exists($this->resource)) { + return false; + } + + return filemtime($this->resource) < $timestamp; + } + + public function serialize() + { + return serialize($this->resource); + } + + public function unserialize($serialized) + { + $this->resource = unserialize($serialized); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Resource/ResourceInterface.php b/vendor/symfony/config/Symfony/Component/Config/Resource/ResourceInterface.php new file mode 100644 index 0000000..db03d12 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Resource/ResourceInterface.php @@ -0,0 +1,43 @@ + + * + * 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. + * + * @return string A string representation of the Resource + */ + public function __toString(); + + /** + * Returns true if the resource has not been updated since the given timestamp. + * + * @param int $timestamp The last time the resource was loaded + * + * @return bool True if the resource has not been updated, false otherwise + */ + public function isFresh($timestamp); + + /** + * Returns the tied resource. + * + * @return mixed The resource + */ + public function getResource(); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/ConfigCacheTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/ConfigCacheTest.php new file mode 100644 index 0000000..27434f1 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/ConfigCacheTest.php @@ -0,0 +1,138 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests; + +use Symfony\Component\Config\ConfigCache; +use Symfony\Component\Config\Resource\FileResource; + +class ConfigCacheTest extends \PHPUnit_Framework_TestCase +{ + private $resourceFile = null; + + private $cacheFile = null; + + private $metaFile = null; + + public function setUp() + { + $this->resourceFile = tempnam(sys_get_temp_dir(), '_resource'); + $this->cacheFile = tempnam(sys_get_temp_dir(), 'config_'); + $this->metaFile = $this->cacheFile.'.meta'; + + $this->makeCacheFresh(); + $this->generateMetaFile(); + } + + public function tearDown() + { + $files = array($this->cacheFile, $this->metaFile, $this->resourceFile); + + foreach ($files as $file) { + if (file_exists($file)) { + unlink($file); + } + } + } + + public function testToString() + { + $cache = new ConfigCache($this->cacheFile, true); + + $this->assertSame($this->cacheFile, (string) $cache); + } + + public function testCacheIsNotFreshIfFileDoesNotExist() + { + unlink($this->cacheFile); + + $cache = new ConfigCache($this->cacheFile, false); + + $this->assertFalse($cache->isFresh()); + } + + public function testCacheIsAlwaysFreshIfFileExistsWithDebugDisabled() + { + $this->makeCacheStale(); + + $cache = new ConfigCache($this->cacheFile, false); + + $this->assertTrue($cache->isFresh()); + } + + public function testCacheIsNotFreshWithoutMetaFile() + { + unlink($this->metaFile); + + $cache = new ConfigCache($this->cacheFile, true); + + $this->assertFalse($cache->isFresh()); + } + + public function testCacheIsFreshIfResourceIsFresh() + { + $cache = new ConfigCache($this->cacheFile, true); + + $this->assertTrue($cache->isFresh()); + } + + public function testCacheIsNotFreshIfOneOfTheResourcesIsNotFresh() + { + $this->makeCacheStale(); + + $cache = new ConfigCache($this->cacheFile, true); + + $this->assertFalse($cache->isFresh()); + } + + public function testWriteDumpsFile() + { + unlink($this->cacheFile); + unlink($this->metaFile); + + $cache = new ConfigCache($this->cacheFile, false); + $cache->write('FOOBAR'); + + $this->assertFileExists($this->cacheFile, 'Cache file is created'); + $this->assertSame('FOOBAR', file_get_contents($this->cacheFile)); + $this->assertFileNotExists($this->metaFile, 'Meta file is not created'); + } + + public function testWriteDumpsMetaFileWithDebugEnabled() + { + unlink($this->cacheFile); + unlink($this->metaFile); + + $metadata = array(new FileResource($this->resourceFile)); + + $cache = new ConfigCache($this->cacheFile, true); + $cache->write('FOOBAR', $metadata); + + $this->assertFileExists($this->cacheFile, 'Cache file is created'); + $this->assertFileExists($this->metaFile, 'Meta file is created'); + $this->assertSame(serialize($metadata), file_get_contents($this->metaFile)); + } + + private function makeCacheFresh() + { + touch($this->resourceFile, filemtime($this->cacheFile) - 3600); + } + + private function makeCacheStale() + { + touch($this->cacheFile, time() - 3600); + } + + private function generateMetaFile() + { + file_put_contents($this->metaFile, serialize(array(new FileResource($this->resourceFile)))); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php new file mode 100644 index 0000000..e363936 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ArrayNodeTest.php @@ -0,0 +1,160 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\ScalarNode; + +class ArrayNodeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException + */ + public function testNormalizeThrowsExceptionWhenFalseIsNotAllowed() + { + $node = new ArrayNode('root'); + $node->normalize(false); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + * @expectedExceptionMessage Unrecognized options "foo" under "root" + */ + public function testExceptionThrownOnUnrecognizedChild() + { + $node = new ArrayNode('root'); + $node->normalize(array('foo' => 'bar')); + } + + /** + * Tests that no exception is thrown for an unrecognized child if the + * ignoreExtraKeys option is set to true. + * + * Related to testExceptionThrownOnUnrecognizedChild + */ + public function testIgnoreExtraKeysNoException() + { + $node = new ArrayNode('roo'); + $node->setIgnoreExtraKeys(true); + + $node->normalize(array('foo' => 'bar')); + $this->assertTrue(true, 'No exception was thrown when setIgnoreExtraKeys is true'); + } + + /** + * @dataProvider getPreNormalizationTests + */ + public function testPreNormalize($denormalized, $normalized) + { + $node = new ArrayNode('foo'); + + $r = new \ReflectionMethod($node, 'preNormalize'); + $r->setAccessible(true); + + $this->assertSame($normalized, $r->invoke($node, $denormalized)); + } + + public function getPreNormalizationTests() + { + return array( + array( + array('foo-bar' => 'foo'), + array('foo_bar' => 'foo'), + ), + array( + array('foo-bar_moo' => 'foo'), + array('foo-bar_moo' => 'foo'), + ), + array( + array('foo-bar' => null, 'foo_bar' => 'foo'), + array('foo-bar' => null, 'foo_bar' => 'foo'), + ), + ); + } + + /** + * @dataProvider getZeroNamedNodeExamplesData + */ + public function testNodeNameCanBeZero($denormalized, $normalized) + { + $zeroNode = new ArrayNode(0); + $zeroNode->addChild(new ScalarNode('name')); + $fiveNode = new ArrayNode(5); + $fiveNode->addChild(new ScalarNode(0)); + $fiveNode->addChild(new ScalarNode('new_key')); + $rootNode = new ArrayNode('root'); + $rootNode->addChild($zeroNode); + $rootNode->addChild($fiveNode); + $rootNode->addChild(new ScalarNode('string_key')); + $r = new \ReflectionMethod($rootNode, 'normalizeValue'); + $r->setAccessible(true); + + $this->assertSame($normalized, $r->invoke($rootNode, $denormalized)); + } + + public function getZeroNamedNodeExamplesData() + { + return array( + array( + array( + 0 => array( + 'name' => 'something', + ), + 5 => array( + 0 => 'this won\'t work too', + 'new_key' => 'some other value', + ), + 'string_key' => 'just value', + ), + array( + 0 => array( + 'name' => 'something', + ), + 5 => array( + 0 => 'this won\'t work too', + 'new_key' => 'some other value', + ), + 'string_key' => 'just value', + ), + ), + ); + } + + /** + * @dataProvider getPreNormalizedNormalizedOrderedData + */ + public function testChildrenOrderIsMaintainedOnNormalizeValue($prenormalized, $normalized) + { + $scalar1 = new ScalarNode('1'); + $scalar2 = new ScalarNode('2'); + $scalar3 = new ScalarNode('3'); + $node = new ArrayNode('foo'); + $node->addChild($scalar1); + $node->addChild($scalar3); + $node->addChild($scalar2); + + $r = new \ReflectionMethod($node, 'normalizeValue'); + $r->setAccessible(true); + + $this->assertSame($normalized, $r->invoke($node, $prenormalized)); + } + + public function getPreNormalizedNormalizedOrderedData() + { + return array( + array( + array('2' => 'two', '1' => 'one', '3' => 'three'), + array('2' => 'two', '1' => 'one', '3' => 'three'), + ), + ); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php new file mode 100644 index 0000000..0753d64 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\BooleanNode; + +class BooleanNodeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getValidValues + */ + public function testNormalize($value) + { + $node = new BooleanNode('test'); + $this->assertSame($value, $node->normalize($value)); + } + + public function getValidValues() + { + return array( + array(false), + array(true), + ); + } + + /** + * @dataProvider getInvalidValues + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException + */ + public function testNormalizeThrowsExceptionOnInvalidValues($value) + { + $node = new BooleanNode('test'); + $node->normalize($value); + } + + public function getInvalidValues() + { + return array( + array(null), + array(''), + array('foo'), + array(0), + array(1), + array(0.0), + array(0.1), + array(array()), + array(array('foo' => 'bar')), + array(new \stdClass()), + ); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php new file mode 100644 index 0000000..e75ed34 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -0,0 +1,207 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition; +use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; + +class ArrayNodeDefinitionTest extends \PHPUnit_Framework_TestCase +{ + public function testAppendingSomeNode() + { + $parent = new ArrayNodeDefinition('root'); + $child = new ScalarNodeDefinition('child'); + + $parent + ->children() + ->scalarNode('foo')->end() + ->scalarNode('bar')->end() + ->end() + ->append($child); + + $this->assertCount(3, $this->getField($parent, 'children')); + $this->assertTrue(in_array($child, $this->getField($parent, 'children'))); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException + * @dataProvider providePrototypeNodeSpecificCalls + */ + public function testPrototypeNodeSpecificOption($method, $args) + { + $node = new ArrayNodeDefinition('root'); + + call_user_func_array(array($node, $method), $args); + + $node->getNode(); + } + + public function providePrototypeNodeSpecificCalls() + { + return array( + array('defaultValue', array(array())), + array('addDefaultChildrenIfNoneSet', array()), + array('requiresAtLeastOneElement', array()), + array('useAttributeAsKey', array('foo')), + ); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException + */ + public function testConcreteNodeSpecificOption() + { + $node = new ArrayNodeDefinition('root'); + $node + ->addDefaultsIfNotSet() + ->prototype('array') + ; + $node->getNode(); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidDefinitionException + */ + public function testPrototypeNodesCantHaveADefaultValueWhenUsingDefaultChildren() + { + $node = new ArrayNodeDefinition('root'); + $node + ->defaultValue(array()) + ->addDefaultChildrenIfNoneSet('foo') + ->prototype('array') + ; + $node->getNode(); + } + + public function testPrototypedArrayNodeDefaultWhenUsingDefaultChildren() + { + $node = new ArrayNodeDefinition('root'); + $node + ->addDefaultChildrenIfNoneSet() + ->prototype('array') + ; + $tree = $node->getNode(); + $this->assertEquals(array(array()), $tree->getDefaultValue()); + } + + /** + * @dataProvider providePrototypedArrayNodeDefaults + */ + public function testPrototypedArrayNodeDefault($args, $shouldThrowWhenUsingAttrAsKey, $shouldThrowWhenNotUsingAttrAsKey, $defaults) + { + $node = new ArrayNodeDefinition('root'); + $node + ->addDefaultChildrenIfNoneSet($args) + ->prototype('array') + ; + + try { + $tree = $node->getNode(); + $this->assertFalse($shouldThrowWhenNotUsingAttrAsKey); + $this->assertEquals($defaults, $tree->getDefaultValue()); + } catch (InvalidDefinitionException $e) { + $this->assertTrue($shouldThrowWhenNotUsingAttrAsKey); + } + + $node = new ArrayNodeDefinition('root'); + $node + ->useAttributeAsKey('attr') + ->addDefaultChildrenIfNoneSet($args) + ->prototype('array') + ; + + try { + $tree = $node->getNode(); + $this->assertFalse($shouldThrowWhenUsingAttrAsKey); + $this->assertEquals($defaults, $tree->getDefaultValue()); + } catch (InvalidDefinitionException $e) { + $this->assertTrue($shouldThrowWhenUsingAttrAsKey); + } + } + + public function providePrototypedArrayNodeDefaults() + { + return array( + array(null, true, false, array(array())), + array(2, true, false, array(array(), array())), + array('2', false, true, array('2' => array())), + array('foo', false, true, array('foo' => array())), + array(array('foo'), false, true, array('foo' => array())), + array(array('foo', 'bar'), false, true, array('foo' => array(), 'bar' => array())), + ); + } + + public function testNestedPrototypedArrayNodes() + { + $node = new ArrayNodeDefinition('root'); + $node + ->addDefaultChildrenIfNoneSet() + ->prototype('array') + ->prototype('array') + ; + $node->getNode(); + } + + public function testEnabledNodeDefaults() + { + $node = new ArrayNodeDefinition('root'); + $node + ->canBeEnabled() + ->children() + ->scalarNode('foo')->defaultValue('bar')->end() + ; + + $this->assertEquals(array('enabled' => false, 'foo' => 'bar'), $node->getNode()->getDefaultValue()); + } + + /** + * @dataProvider getEnableableNodeFixtures + */ + public function testTrueEnableEnabledNode($expected, $config, $message) + { + $processor = new Processor(); + $node = new ArrayNodeDefinition('root'); + $node + ->canBeEnabled() + ->children() + ->scalarNode('foo')->defaultValue('bar')->end() + ; + + $this->assertEquals( + $expected, + $processor->process($node->getNode(), $config), + $message + ); + } + + public function getEnableableNodeFixtures() + { + return array( + array(array('enabled' => true, 'foo' => 'bar'), array(true), 'true enables an enableable node'), + array(array('enabled' => true, 'foo' => 'bar'), array(null), 'null enables an enableable node'), + array(array('enabled' => true, 'foo' => 'bar'), array(array('enabled' => true)), 'An enableable node can be enabled'), + array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'), + array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'), + array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'), + ); + } + + protected function getField($object, $field) + { + $reflection = new \ReflectionProperty($object, $field); + $reflection->setAccessible(true); + + return $reflection->getValue($object); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php new file mode 100644 index 0000000..69f7fcf --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\EnumNodeDefinition; + +class EnumNodeDefinitionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage ->values() must be called with at least two distinct values. + */ + public function testNoDistinctValues() + { + $def = new EnumNodeDefinition('foo'); + $def->values(array('foo', 'foo')); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage You must call ->values() on enum nodes. + */ + public function testNoValuesPassed() + { + $def = new EnumNodeDefinition('foo'); + $def->getNode(); + } + + public function testGetNode() + { + $def = new EnumNodeDefinition('foo'); + $def->values(array('foo', 'bar')); + + $node = $def->getNode(); + $this->assertEquals(array('foo', 'bar'), $node->getValues()); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php new file mode 100644 index 0000000..cde19e0 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php @@ -0,0 +1,216 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; + +class ExprBuilderTest extends \PHPUnit_Framework_TestCase +{ + public function testAlwaysExpression() + { + $test = $this->getTestBuilder() + ->always($this->returnClosure('new_value')) + ->end(); + + $this->assertFinalizedValueIs('new_value', $test); + } + + public function testIfTrueExpression() + { + $test = $this->getTestBuilder() + ->ifTrue() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test, array('key' => true)); + + $test = $this->getTestBuilder() + ->ifTrue(function ($v) { return true; }) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + + $test = $this->getTestBuilder() + ->ifTrue(function ($v) { return false; }) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value', $test); + } + + public function testIfStringExpression() + { + $test = $this->getTestBuilder() + ->ifString() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + + $test = $this->getTestBuilder() + ->ifString() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs(45, $test, array('key' => 45)); + } + + public function testIfNullExpression() + { + $test = $this->getTestBuilder() + ->ifNull() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test, array('key' => null)); + + $test = $this->getTestBuilder() + ->ifNull() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value', $test); + } + + public function testIfArrayExpression() + { + $test = $this->getTestBuilder() + ->ifArray() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test, array('key' => array())); + + $test = $this->getTestBuilder() + ->ifArray() + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value', $test); + } + + public function testIfInArrayExpression() + { + $test = $this->getTestBuilder() + ->ifInArray(array('foo', 'bar', 'value')) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + + $test = $this->getTestBuilder() + ->ifInArray(array('foo', 'bar')) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('value', $test); + } + + public function testIfNotInArrayExpression() + { + $test = $this->getTestBuilder() + ->ifNotInArray(array('foo', 'bar')) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + + $test = $this->getTestBuilder() + ->ifNotInArray(array('foo', 'bar', 'value_from_config' )) + ->then($this->returnClosure('new_value')) + ->end(); + $this->assertFinalizedValueIs('new_value', $test); + } + + public function testThenEmptyArrayExpression() + { + $test = $this->getTestBuilder() + ->ifString() + ->thenEmptyArray() + ->end(); + $this->assertFinalizedValueIs(array(), $test); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testThenInvalid() + { + $test = $this->getTestBuilder() + ->ifString() + ->thenInvalid('Invalid value') + ->end(); + $this->finalizeTestBuilder($test); + } + + public function testThenUnsetExpression() + { + $test = $this->getTestBuilder() + ->ifString() + ->thenUnset() + ->end(); + $this->assertEquals(array(), $this->finalizeTestBuilder($test)); + } + + /** + * Create a test treebuilder with a variable node, and init the validation. + * + * @return TreeBuilder + */ + protected function getTestBuilder() + { + $builder = new TreeBuilder(); + + return $builder + ->root('test') + ->children() + ->variableNode('key') + ->validate() + ; + } + + /** + * Close the validation process and finalize with the given config. + * + * @param TreeBuilder $testBuilder The tree builder to finalize + * @param array $config The config you want to use for the finalization, if nothing provided + * a simple array('key'=>'value') will be used + * + * @return array The finalized config values + */ + protected function finalizeTestBuilder($testBuilder, $config = null) + { + return $testBuilder + ->end() + ->end() + ->end() + ->buildTree() + ->finalize(null === $config ? array('key' => 'value') : $config) + ; + } + + /** + * Return a closure that will return the given value. + * + * @param mixed $val The value that the closure must return + * + * @return Closure + */ + protected function returnClosure($val) + { + return function ($v) use ($val) { + return $val; + }; + } + + /** + * Assert that the given test builder, will return the given value + * + * @param mixed $value The value to test + * @param TreeBuilder $treeBuilder The tree builder to finalize + * + * @param mixed $config The config values that new to be finalized + */ + protected function assertFinalizedValueIs($value, $treeBuilder, $config = null) + { + $this->assertEquals(array('key' => $value), $this->finalizeTestBuilder($treeBuilder, $config)); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php new file mode 100644 index 0000000..22c399c --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NodeBuilderTest.php @@ -0,0 +1,94 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder; +use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition; + +class NodeBuilderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \RuntimeException + */ + public function testThrowsAnExceptionWhenTryingToCreateANonRegisteredNodeType() + { + $builder = new BaseNodeBuilder(); + $builder->node('', 'foobar'); + } + + /** + * @expectedException \RuntimeException + */ + public function testThrowsAnExceptionWhenTheNodeClassIsNotFound() + { + $builder = new BaseNodeBuilder(); + $builder + ->setNodeClass('noclasstype', '\\foo\\bar\\noclass') + ->node('', 'noclasstype'); + } + + public function testAddingANewNodeType() + { + $class = __NAMESPACE__.'\\SomeNodeDefinition'; + + $builder = new BaseNodeBuilder(); + $node = $builder + ->setNodeClass('newtype', $class) + ->node('', 'newtype'); + + $this->assertInstanceOf($class, $node); + } + + public function testOverridingAnExistingNodeType() + { + $class = __NAMESPACE__.'\\SomeNodeDefinition'; + + $builder = new BaseNodeBuilder(); + $node = $builder + ->setNodeClass('variable', $class) + ->node('', 'variable'); + + $this->assertInstanceOf($class, $node); + } + + public function testNodeTypesAreNotCaseSensitive() + { + $builder = new BaseNodeBuilder(); + + $node1 = $builder->node('', 'VaRiAbLe'); + $node2 = $builder->node('', 'variable'); + + $this->assertInstanceOf(get_class($node1), $node2); + + $builder->setNodeClass('CuStOm', __NAMESPACE__.'\\SomeNodeDefinition'); + + $node1 = $builder->node('', 'CUSTOM'); + $node2 = $builder->node('', 'custom'); + + $this->assertInstanceOf(get_class($node1), $node2); + } + + public function testNumericNodeCreation() + { + $builder = new BaseNodeBuilder(); + + $node = $builder->integerNode('foo')->min(3)->max(5); + $this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition', $node); + + $node = $builder->floatNode('bar')->min(3.0)->max(5.0); + $this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\FloatNodeDefinition', $node); + } +} + +class SomeNodeDefinition extends BaseVariableNodeDefinition +{ +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php new file mode 100644 index 0000000..cf0813a --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/NumericNodeDefinitionTest.php @@ -0,0 +1,93 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition as NumericNodeDefinition; +use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition; +use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition; + +class NumericNodeDefinitionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage You cannot define a min(4) as you already have a max(3) + */ + public function testIncoherentMinAssertion() + { + $def = new NumericNodeDefinition('foo'); + $def->max(3)->min(4); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage You cannot define a max(2) as you already have a min(3) + */ + public function testIncoherentMaxAssertion() + { + $node = new NumericNodeDefinition('foo'); + $node->min(3)->max(2); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + * @expectedExceptionMessage The value 4 is too small for path "foo". Should be greater than or equal to 5 + */ + public function testIntegerMinAssertion() + { + $def = new IntegerNodeDefinition('foo'); + $def->min(5)->getNode()->finalize(4); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + * @expectedExceptionMessage The value 4 is too big for path "foo". Should be less than or equal to 3 + */ + public function testIntegerMaxAssertion() + { + $def = new IntegerNodeDefinition('foo'); + $def->max(3)->getNode()->finalize(4); + } + + public function testIntegerValidMinMaxAssertion() + { + $def = new IntegerNodeDefinition('foo'); + $node = $def->min(3)->max(7)->getNode(); + $this->assertEquals(4, $node->finalize(4)); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + * @expectedExceptionMessage The value 400 is too small for path "foo". Should be greater than or equal to 500 + */ + public function testFloatMinAssertion() + { + $def = new FloatNodeDefinition('foo'); + $def->min(5E2)->getNode()->finalize(4e2); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + * @expectedExceptionMessage The value 4.3 is too big for path "foo". Should be less than or equal to 0.3 + */ + public function testFloatMaxAssertion() + { + $def = new FloatNodeDefinition('foo'); + $def->max(0.3)->getNode()->finalize(4.3); + } + + public function testFloatValidMinMaxAssertion() + { + $def = new FloatNodeDefinition('foo'); + $node = $def->min(3.0)->max(7e2)->getNode(); + $this->assertEquals(4.5, $node->finalize(4.5)); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php new file mode 100644 index 0000000..4501976 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php @@ -0,0 +1,127 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder as CustomNodeBuilder; +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\Builder\NodeBuilder; + +require __DIR__.'/../../Fixtures/Builder/NodeBuilder.php'; +require __DIR__.'/../../Fixtures/Builder/BarNodeDefinition.php'; +require __DIR__.'/../../Fixtures/Builder/VariableNodeDefinition.php'; + +class TreeBuilderTest extends \PHPUnit_Framework_TestCase +{ + public function testUsingACustomNodeBuilder() + { + $builder = new TreeBuilder(); + $root = $builder->root('custom', 'array', new CustomNodeBuilder()); + + $nodeBuilder = $root->children(); + + $this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder); + + $nodeBuilder = $nodeBuilder->arrayNode('deeper')->children(); + + $this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\NodeBuilder', $nodeBuilder); + } + + public function testOverrideABuiltInNodeType() + { + $builder = new TreeBuilder(); + $root = $builder->root('override', 'array', new CustomNodeBuilder()); + + $definition = $root->children()->variableNode('variable'); + + $this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition', $definition); + } + + public function testAddANodeType() + { + $builder = new TreeBuilder(); + $root = $builder->root('override', 'array', new CustomNodeBuilder()); + + $definition = $root->children()->barNode('variable'); + + $this->assertInstanceOf('Symfony\Component\Config\Tests\Definition\Builder\BarNodeDefinition', $definition); + } + + public function testCreateABuiltInNodeTypeWithACustomNodeBuilder() + { + $builder = new TreeBuilder(); + $root = $builder->root('builtin', 'array', new CustomNodeBuilder()); + + $definition = $root->children()->booleanNode('boolean'); + + $this->assertInstanceOf('Symfony\Component\Config\Definition\Builder\BooleanNodeDefinition', $definition); + } + + public function testPrototypedArrayNodeUseTheCustomNodeBuilder() + { + $builder = new TreeBuilder(); + $root = $builder->root('override', 'array', new CustomNodeBuilder()); + + $root->prototype('bar')->end(); + } + + public function testAnExtendedNodeBuilderGetsPropagatedToTheChildren() + { + $builder = new TreeBuilder(); + + $builder->root('propagation') + ->children() + ->setNodeClass('extended', 'Symfony\Component\Config\Tests\Definition\Builder\VariableNodeDefinition') + ->node('foo', 'extended')->end() + ->arrayNode('child') + ->children() + ->node('foo', 'extended') + ->end() + ->end() + ->end() + ->end(); + } + + public function testDefinitionInfoGetsTransferredToNode() + { + $builder = new TreeBuilder(); + + $builder->root('test')->info('root info') + ->children() + ->node('child', 'variable')->info('child info')->defaultValue('default') + ->end() + ->end(); + + $tree = $builder->buildTree(); + $children = $tree->getChildren(); + + $this->assertEquals('root info', $tree->getInfo()); + $this->assertEquals('child info', $children['child']->getInfo()); + } + + public function testDefinitionExampleGetsTransferredToNode() + { + $builder = new TreeBuilder(); + + $builder->root('test') + ->example(array('key' => 'value')) + ->children() + ->node('child', 'variable')->info('child info')->defaultValue('default')->example('example') + ->end() + ->end(); + + $tree = $builder->buildTree(); + $children = $tree->getChildren(); + + $this->assertTrue(is_array($tree->getExample())); + $this->assertEquals('example', $children['child']->getExample()); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php new file mode 100644 index 0000000..ab6bdaa --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/XmlReferenceDumperTest.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Dumper; + +use Symfony\Component\Config\Definition\Dumper\XmlReferenceDumper; +use Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration; + +class XmlReferenceDumperTest extends \PHPUnit_Framework_TestCase +{ + public function testDumper() + { + $configuration = new ExampleConfiguration(); + + $dumper = new XmlReferenceDumper(); + $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration)); + } + + public function testNamespaceDumper() + { + $configuration = new ExampleConfiguration(); + + $dumper = new XmlReferenceDumper(); + $this->assertEquals(str_replace('http://example.org/schema/dic/acme_root', 'http://symfony.com/schema/dic/symfony', $this->getConfigurationAsString()), $dumper->dump($configuration, 'http://symfony.com/schema/dic/symfony')); + } + + private function getConfigurationAsString() + { + return << + + + + + + + + + + scalar value + + + + + + +EOL; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php new file mode 100644 index 0000000..4775235 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/Dumper/YamlReferenceDumperTest.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Dumper; + +use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper; +use Symfony\Component\Config\Tests\Fixtures\Configuration\ExampleConfiguration; + +class YamlReferenceDumperTest extends \PHPUnit_Framework_TestCase +{ + public function testDumper() + { + $configuration = new ExampleConfiguration(); + + $dumper = new YamlReferenceDumper(); + + $this->markTestIncomplete('The Yaml Dumper currently does not support prototyped arrays'); + $this->assertEquals($this->getConfigurationAsString(), $dumper->dump($configuration)); + } + + private function getConfigurationAsString() + { + return << + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\EnumNode; + +class EnumNodeTest extends \PHPUnit_Framework_TestCase +{ + public function testFinalizeValue() + { + $node = new EnumNode('foo', null, array('foo', 'bar')); + $this->assertSame('foo', $node->finalize('foo')); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testConstructionWithOneValue() + { + new EnumNode('foo', null, array('foo', 'foo')); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + * @expectedExceptionMessage The value "foobar" is not allowed for path "foo". Permissible values: "foo", "bar" + */ + public function testFinalizeWithInvalidValue() + { + $node = new EnumNode('foo', null, array('foo', 'bar')); + $node->finalize('foobar'); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FinalizationTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FinalizationTest.php new file mode 100644 index 0000000..19fc347 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FinalizationTest.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Config\Definition\NodeInterface; + +class FinalizationTest extends \PHPUnit_Framework_TestCase +{ + public function testUnsetKeyWithDeepHierarchy() + { + $tb = new TreeBuilder(); + $tree = $tb + ->root('config', 'array') + ->children() + ->node('level1', 'array') + ->canBeUnset() + ->children() + ->node('level2', 'array') + ->canBeUnset() + ->children() + ->node('somevalue', 'scalar')->end() + ->node('anothervalue', 'scalar')->end() + ->end() + ->end() + ->node('level1_scalar', 'scalar')->end() + ->end() + ->end() + ->end() + ->end() + ->buildTree() + ; + + $a = array( + 'level1' => array( + 'level2' => array( + 'somevalue' => 'foo', + 'anothervalue' => 'bar', + ), + 'level1_scalar' => 'foo', + ), + ); + + $b = array( + 'level1' => array( + 'level2' => false, + ), + ); + + $this->assertEquals(array( + 'level1' => array( + 'level1_scalar' => 'foo', + ), + ), $this->process($tree, array($a, $b))); + } + + protected function process(NodeInterface $tree, array $configs) + { + $processor = new Processor(); + + return $processor->process($tree, $configs); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php new file mode 100644 index 0000000..4f308ca --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\FloatNode; + +class FloatNodeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getValidValues + */ + public function testNormalize($value) + { + $node = new FloatNode('test'); + $this->assertSame($value, $node->normalize($value)); + } + + public function getValidValues() + { + return array( + array(1798.0), + array(-678.987), + array(12.56E45), + array(0.0), + // Integer are accepted too, they will be cast + array(17), + array(-10), + array(0), + ); + } + + /** + * @dataProvider getInvalidValues + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException + */ + public function testNormalizeThrowsExceptionOnInvalidValues($value) + { + $node = new FloatNode('test'); + $node->normalize($value); + } + + public function getInvalidValues() + { + return array( + array(null), + array(''), + array('foo'), + array(true), + array(false), + array(array()), + array(array('foo' => 'bar')), + array(new \stdClass()), + ); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php new file mode 100644 index 0000000..1527db7 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\IntegerNode; + +class IntegerNodeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getValidValues + */ + public function testNormalize($value) + { + $node = new IntegerNode('test'); + $this->assertSame($value, $node->normalize($value)); + } + + public function getValidValues() + { + return array( + array(1798), + array(-678), + array(0), + ); + } + + /** + * @dataProvider getInvalidValues + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException + */ + public function testNormalizeThrowsExceptionOnInvalidValues($value) + { + $node = new IntegerNode('test'); + $node->normalize($value); + } + + public function getInvalidValues() + { + return array( + array(null), + array(''), + array('foo'), + array(true), + array(false), + array(0.0), + array(0.1), + array(array()), + array(array('foo' => 'bar')), + array(new \stdClass()), + ); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/MergeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/MergeTest.php new file mode 100644 index 0000000..08ddc32 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/MergeTest.php @@ -0,0 +1,195 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; + +class MergeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\ForbiddenOverwriteException + */ + public function testForbiddenOverwrite() + { + $tb = new TreeBuilder(); + $tree = $tb + ->root('root', 'array') + ->children() + ->node('foo', 'scalar') + ->cannotBeOverwritten() + ->end() + ->end() + ->end() + ->buildTree() + ; + + $a = array( + 'foo' => 'bar', + ); + + $b = array( + 'foo' => 'moo', + ); + + $tree->merge($a, $b); + } + + public function testUnsetKey() + { + $tb = new TreeBuilder(); + $tree = $tb + ->root('root', 'array') + ->children() + ->node('foo', 'scalar')->end() + ->node('bar', 'scalar')->end() + ->node('unsettable', 'array') + ->canBeUnset() + ->children() + ->node('foo', 'scalar')->end() + ->node('bar', 'scalar')->end() + ->end() + ->end() + ->node('unsetted', 'array') + ->canBeUnset() + ->prototype('scalar')->end() + ->end() + ->end() + ->end() + ->buildTree() + ; + + $a = array( + 'foo' => 'bar', + 'unsettable' => array( + 'foo' => 'a', + 'bar' => 'b', + ), + 'unsetted' => false, + ); + + $b = array( + 'foo' => 'moo', + 'bar' => 'b', + 'unsettable' => false, + 'unsetted' => array('a', 'b'), + ); + + $this->assertEquals(array( + 'foo' => 'moo', + 'bar' => 'b', + 'unsettable' => false, + 'unsetted' => array('a', 'b'), + ), $tree->merge($a, $b)); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testDoesNotAllowNewKeysInSubsequentConfigs() + { + $tb = new TreeBuilder(); + $tree = $tb + ->root('config', 'array') + ->children() + ->node('test', 'array') + ->disallowNewKeysInSubsequentConfigs() + ->useAttributeAsKey('key') + ->prototype('array') + ->children() + ->node('value', 'scalar')->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->buildTree(); + + $a = array( + 'test' => array( + 'a' => array('value' => 'foo'), + ), + ); + + $b = array( + 'test' => array( + 'b' => array('value' => 'foo'), + ), + ); + + $tree->merge($a, $b); + } + + public function testPerformsNoDeepMerging() + { + $tb = new TreeBuilder(); + + $tree = $tb + ->root('config', 'array') + ->children() + ->node('no_deep_merging', 'array') + ->performNoDeepMerging() + ->children() + ->node('foo', 'scalar')->end() + ->node('bar', 'scalar')->end() + ->end() + ->end() + ->end() + ->end() + ->buildTree() + ; + + $a = array( + 'no_deep_merging' => array( + 'foo' => 'a', + 'bar' => 'b', + ), + ); + + $b = array( + 'no_deep_merging' => array( + 'c' => 'd', + ), + ); + + $this->assertEquals(array( + 'no_deep_merging' => array( + 'c' => 'd', + ), + ), $tree->merge($a, $b)); + } + + public function testPrototypeWithoutAKeyAttribute() + { + $tb = new TreeBuilder(); + + $tree = $tb + ->root('config', 'array') + ->children() + ->arrayNode('append_elements') + ->prototype('scalar')->end() + ->end() + ->end() + ->end() + ->buildTree() + ; + + $a = array( + 'append_elements' => array('a', 'b'), + ); + + $b = array( + 'append_elements' => array('c', 'd'), + ); + + $this->assertEquals(array('append_elements' => array('a', 'b', 'c', 'd')), $tree->merge($a, $b)); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/NormalizationTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/NormalizationTest.php new file mode 100644 index 0000000..a896f96 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/NormalizationTest.php @@ -0,0 +1,229 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\NodeInterface; +use Symfony\Component\Config\Definition\Builder\TreeBuilder; + +class NormalizationTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getEncoderTests + */ + public function testNormalizeEncoders($denormalized) + { + $tb = new TreeBuilder(); + $tree = $tb + ->root('root_name', 'array') + ->fixXmlConfig('encoder') + ->children() + ->node('encoders', 'array') + ->useAttributeAsKey('class') + ->prototype('array') + ->beforeNormalization()->ifString()->then(function ($v) { return array('algorithm' => $v); })->end() + ->children() + ->node('algorithm', 'scalar')->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->buildTree() + ; + + $normalized = array( + 'encoders' => array( + 'foo' => array('algorithm' => 'plaintext'), + ), + ); + + $this->assertNormalized($tree, $denormalized, $normalized); + } + + public function getEncoderTests() + { + $configs = array(); + + // XML + $configs[] = array( + 'encoder' => array( + array('class' => 'foo', 'algorithm' => 'plaintext'), + ), + ); + + // XML when only one element of this type + $configs[] = array( + 'encoder' => array('class' => 'foo', 'algorithm' => 'plaintext'), + ); + + // YAML/PHP + $configs[] = array( + 'encoders' => array( + array('class' => 'foo', 'algorithm' => 'plaintext'), + ), + ); + + // YAML/PHP + $configs[] = array( + 'encoders' => array( + 'foo' => 'plaintext', + ), + ); + + // YAML/PHP + $configs[] = array( + 'encoders' => array( + 'foo' => array('algorithm' => 'plaintext'), + ), + ); + + return array_map(function ($v) { + return array($v); + }, $configs); + } + + /** + * @dataProvider getAnonymousKeysTests + */ + public function testAnonymousKeysArray($denormalized) + { + $tb = new TreeBuilder(); + $tree = $tb + ->root('root', 'array') + ->children() + ->node('logout', 'array') + ->fixXmlConfig('handler') + ->children() + ->node('handlers', 'array') + ->prototype('scalar')->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->buildTree() + ; + + $normalized = array('logout' => array('handlers' => array('a', 'b', 'c'))); + + $this->assertNormalized($tree, $denormalized, $normalized); + } + + public function getAnonymousKeysTests() + { + $configs = array(); + + $configs[] = array( + 'logout' => array( + 'handlers' => array('a', 'b', 'c'), + ), + ); + + $configs[] = array( + 'logout' => array( + 'handler' => array('a', 'b', 'c'), + ), + ); + + return array_map(function ($v) { return array($v); }, $configs); + } + + /** + * @dataProvider getNumericKeysTests + */ + public function testNumericKeysAsAttributes($denormalized) + { + $normalized = array( + 'thing' => array(42 => array('foo', 'bar'), 1337 => array('baz', 'qux')), + ); + + $this->assertNormalized($this->getNumericKeysTestTree(), $denormalized, $normalized); + } + + public function getNumericKeysTests() + { + $configs = array(); + + $configs[] = array( + 'thing' => array( + 42 => array('foo', 'bar'), 1337 => array('baz', 'qux'), + ), + ); + + $configs[] = array( + 'thing' => array( + array('foo', 'bar', 'id' => 42), array('baz', 'qux', 'id' => 1337), + ), + ); + + return array_map(function ($v) { return array($v); }, $configs); + } + + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + * @expectedExceptionMessage The attribute "id" must be set for path "root.thing". + */ + public function testNonAssociativeArrayThrowsExceptionIfAttributeNotSet() + { + $denormalized = array( + 'thing' => array( + array('foo', 'bar'), array('baz', 'qux'), + ), + ); + + $this->assertNormalized($this->getNumericKeysTestTree(), $denormalized, array()); + } + + public function testAssociativeArrayPreserveKeys() + { + $tb = new TreeBuilder(); + $tree = $tb + ->root('root', 'array') + ->prototype('array') + ->children() + ->node('foo', 'scalar')->end() + ->end() + ->end() + ->end() + ->buildTree() + ; + + $data = array('first' => array('foo' => 'bar')); + + $this->assertNormalized($tree, $data, $data); + } + + public static function assertNormalized(NodeInterface $tree, $denormalized, $normalized) + { + self::assertSame($normalized, $tree->normalize($denormalized)); + } + + private function getNumericKeysTestTree() + { + $tb = new TreeBuilder(); + $tree = $tb + ->root('root', 'array') + ->children() + ->node('thing', 'array') + ->useAttributeAsKey('id') + ->prototype('array') + ->prototype('scalar')->end() + ->end() + ->end() + ->end() + ->end() + ->buildTree() + ; + + return $tree; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php new file mode 100644 index 0000000..d200574 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php @@ -0,0 +1,180 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\PrototypedArrayNode; +use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\ScalarNode; + +class PrototypedArrayNodeTest extends \PHPUnit_Framework_TestCase +{ + public function testGetDefaultValueReturnsAnEmptyArrayForPrototypes() + { + $node = new PrototypedArrayNode('root'); + $prototype = new ArrayNode(null, $node); + $node->setPrototype($prototype); + $this->assertEmpty($node->getDefaultValue()); + } + + public function testGetDefaultValueReturnsDefaultValueForPrototypes() + { + $node = new PrototypedArrayNode('root'); + $prototype = new ArrayNode(null, $node); + $node->setPrototype($prototype); + $node->setDefaultValue(array('test')); + $this->assertEquals(array('test'), $node->getDefaultValue()); + } + + // a remapped key (e.g. "mapping" -> "mappings") should be unset after being used + public function testRemappedKeysAreUnset() + { + $node = new ArrayNode('root'); + $mappingsNode = new PrototypedArrayNode('mappings'); + $node->addChild($mappingsNode); + + // each item under mappings is just a scalar + $prototype = new ScalarNode(null, $mappingsNode); + $mappingsNode->setPrototype($prototype); + + $remappings = array(); + $remappings[] = array('mapping', 'mappings'); + $node->setXmlRemappings($remappings); + + $normalized = $node->normalize(array('mapping' => array('foo', 'bar'))); + $this->assertEquals(array('mappings' => array('foo', 'bar')), $normalized); + } + + /** + * Tests that when a key attribute is mapped, that key is removed from the array: + * + * + * + * + * The above should finally be mapped to an array that looks like this + * (because "id" is the key attribute). + * + * array( + * 'things' => array( + * 'option1' => 'foo', + * 'option2' => 'bar', + * ) + * ) + */ + public function testMappedAttributeKeyIsRemoved() + { + $node = new PrototypedArrayNode('root'); + $node->setKeyAttribute('id', true); + + // each item under the root is an array, with one scalar item + $prototype = new ArrayNode(null, $node); + $prototype->addChild(new ScalarNode('foo')); + $node->setPrototype($prototype); + + $children = array(); + $children[] = array('id' => 'item_name', 'foo' => 'bar'); + $normalized = $node->normalize($children); + + $expected = array(); + $expected['item_name'] = array('foo' => 'bar'); + $this->assertEquals($expected, $normalized); + } + + /** + * Tests the opposite of the testMappedAttributeKeyIsRemoved because + * the removal can be toggled with an option. + */ + public function testMappedAttributeKeyNotRemoved() + { + $node = new PrototypedArrayNode('root'); + $node->setKeyAttribute('id', false); + + // each item under the root is an array, with two scalar items + $prototype = new ArrayNode(null, $node); + $prototype->addChild(new ScalarNode('foo')); + $prototype->addChild(new ScalarNode('id')); // the key attribute will remain + $node->setPrototype($prototype); + + $children = array(); + $children[] = array('id' => 'item_name', 'foo' => 'bar'); + $normalized = $node->normalize($children); + + $expected = array(); + $expected['item_name'] = array('id' => 'item_name', 'foo' => 'bar'); + $this->assertEquals($expected, $normalized); + } + + public function testAddDefaultChildren() + { + $node = $this->getPrototypeNodeWithDefaultChildren(); + $node->setAddChildrenIfNoneSet(); + $this->assertTrue($node->hasDefaultValue()); + $this->assertEquals(array(array('foo' => 'bar')), $node->getDefaultValue()); + + $node = $this->getPrototypeNodeWithDefaultChildren(); + $node->setKeyAttribute('foobar'); + $node->setAddChildrenIfNoneSet(); + $this->assertTrue($node->hasDefaultValue()); + $this->assertEquals(array('defaults' => array('foo' => 'bar')), $node->getDefaultValue()); + + $node = $this->getPrototypeNodeWithDefaultChildren(); + $node->setKeyAttribute('foobar'); + $node->setAddChildrenIfNoneSet('defaultkey'); + $this->assertTrue($node->hasDefaultValue()); + $this->assertEquals(array('defaultkey' => array('foo' => 'bar')), $node->getDefaultValue()); + + $node = $this->getPrototypeNodeWithDefaultChildren(); + $node->setKeyAttribute('foobar'); + $node->setAddChildrenIfNoneSet(array('defaultkey')); + $this->assertTrue($node->hasDefaultValue()); + $this->assertEquals(array('defaultkey' => array('foo' => 'bar')), $node->getDefaultValue()); + + $node = $this->getPrototypeNodeWithDefaultChildren(); + $node->setKeyAttribute('foobar'); + $node->setAddChildrenIfNoneSet(array('dk1', 'dk2')); + $this->assertTrue($node->hasDefaultValue()); + $this->assertEquals(array('dk1' => array('foo' => 'bar'), 'dk2' => array('foo' => 'bar')), $node->getDefaultValue()); + + $node = $this->getPrototypeNodeWithDefaultChildren(); + $node->setAddChildrenIfNoneSet(array(5, 6)); + $this->assertTrue($node->hasDefaultValue()); + $this->assertEquals(array(0 => array('foo' => 'bar'), 1 => array('foo' => 'bar')), $node->getDefaultValue()); + + $node = $this->getPrototypeNodeWithDefaultChildren(); + $node->setAddChildrenIfNoneSet(2); + $this->assertTrue($node->hasDefaultValue()); + $this->assertEquals(array(array('foo' => 'bar'), array('foo' => 'bar')), $node->getDefaultValue()); + } + + public function testDefaultChildrenWinsOverDefaultValue() + { + $node = $this->getPrototypeNodeWithDefaultChildren(); + $node->setAddChildrenIfNoneSet(); + $node->setDefaultValue(array('bar' => 'foo')); + $this->assertTrue($node->hasDefaultValue()); + $this->assertEquals(array(array('foo' => 'bar')), $node->getDefaultValue()); + } + + protected function getPrototypeNodeWithDefaultChildren() + { + $node = new PrototypedArrayNode('root'); + $prototype = new ArrayNode(null, $node); + $child = new ScalarNode('foo'); + $child->setDefaultValue('bar'); + $prototype->addChild($child); + $prototype->setAddIfNotSet(true); + $node->setPrototype($prototype); + + return $node; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php new file mode 100644 index 0000000..056dd73 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition; + +use Symfony\Component\Config\Definition\ScalarNode; + +class ScalarNodeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getValidValues + */ + public function testNormalize($value) + { + $node = new ScalarNode('test'); + $this->assertSame($value, $node->normalize($value)); + } + + public function getValidValues() + { + return array( + array(false), + array(true), + array(null), + array(''), + array('foo'), + array(0), + array(1), + array(0.0), + array(0.1), + ); + } + + /** + * @dataProvider getInvalidValues + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidTypeException + */ + public function testNormalizeThrowsExceptionOnInvalidValues($value) + { + $node = new ScalarNode('test'); + $node->normalize($value); + } + + public function getInvalidValues() + { + return array( + array(array()), + array(array('foo' => 'bar')), + array(new \stdClass()), + ); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/FileLocatorTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/FileLocatorTest.php new file mode 100644 index 0000000..d479f25 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/FileLocatorTest.php @@ -0,0 +1,119 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests; + +use Symfony\Component\Config\FileLocator; + +class FileLocatorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getIsAbsolutePathTests + */ + public function testIsAbsolutePath($path) + { + $loader = new FileLocator(array()); + $r = new \ReflectionObject($loader); + $m = $r->getMethod('isAbsolutePath'); + $m->setAccessible(true); + + $this->assertTrue($m->invoke($loader, $path), '->isAbsolutePath() returns true for an absolute path'); + } + + public function getIsAbsolutePathTests() + { + return array( + array('/foo.xml'), + array('c:\\\\foo.xml'), + array('c:/foo.xml'), + array('\\server\\foo.xml'), + array('https://server/foo.xml'), + array('phar://server/foo.xml'), + ); + } + + public function testLocate() + { + $loader = new FileLocator(__DIR__.'/Fixtures'); + + $this->assertEquals( + __DIR__.DIRECTORY_SEPARATOR.'FileLocatorTest.php', + $loader->locate('FileLocatorTest.php', __DIR__), + '->locate() returns the absolute filename if the file exists in the given path' + ); + + $this->assertEquals( + __DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', + $loader->locate('foo.xml', __DIR__), + '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor' + ); + + $this->assertEquals( + __DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', + $loader->locate(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__), + '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor' + ); + + $loader = new FileLocator(array(__DIR__.'/Fixtures', __DIR__.'/Fixtures/Again')); + + $this->assertEquals( + array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), + $loader->locate('foo.xml', __DIR__, false), + '->locate() returns an array of absolute filenames' + ); + + $this->assertEquals( + array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), + $loader->locate('foo.xml', __DIR__.'/Fixtures', false), + '->locate() returns an array of absolute filenames' + ); + + $loader = new FileLocator(__DIR__.'/Fixtures/Again'); + + $this->assertEquals( + array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), + $loader->locate('foo.xml', __DIR__.'/Fixtures', false), + '->locate() returns an array of absolute filenames' + ); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The file "foobar.xml" does not exist + */ + public function testLocateThrowsAnExceptionIfTheFileDoesNotExists() + { + $loader = new FileLocator(array(__DIR__.'/Fixtures')); + + $loader->locate('foobar.xml', __DIR__); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testLocateThrowsAnExceptionIfTheFileDoesNotExistsInAbsolutePath() + { + $loader = new FileLocator(array(__DIR__.'/Fixtures')); + + $loader->locate(__DIR__.'/Fixtures/foobar.xml', __DIR__); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage An empty file name is not valid to be located. + */ + public function testLocateEmpty() + { + $loader = new FileLocator(array(__DIR__.'/Fixtures')); + + $loader->locate(null, __DIR__); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Again/foo.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Again/foo.xml new file mode 100644 index 0000000..e69de29 diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php new file mode 100644 index 0000000..47701c1 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/BarNodeDefinition.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\NodeDefinition; + +class BarNodeDefinition extends NodeDefinition +{ + protected function createNode() + { + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php new file mode 100644 index 0000000..aa59863 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/NodeBuilder.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\NodeBuilder as BaseNodeBuilder; + +class NodeBuilder extends BaseNodeBuilder +{ + public function barNode($name) + { + return $this->node($name, 'bar'); + } + + protected function getNodeClass($type) + { + switch ($type) { + case 'variable': + return __NAMESPACE__.'\\'.ucfirst($type).'NodeDefinition'; + case 'bar': + return __NAMESPACE__.'\\'.ucfirst($type).'NodeDefinition'; + default: + return parent::getNodeClass($type); + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php new file mode 100644 index 0000000..1017880 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Builder/VariableNodeDefinition.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Definition\Builder; + +use Symfony\Component\Config\Definition\Builder\VariableNodeDefinition as BaseVariableNodeDefinition; + +class VariableNodeDefinition extends BaseVariableNodeDefinition +{ +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php new file mode 100644 index 0000000..1c510ae --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Configuration/ExampleConfiguration.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Fixtures\Configuration; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +class ExampleConfiguration implements ConfigurationInterface +{ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('acme_root'); + + $rootNode + ->fixXmlConfig('parameter') + ->fixXmlConfig('connection') + ->children() + ->booleanNode('boolean')->defaultTrue()->end() + ->scalarNode('scalar_empty')->end() + ->scalarNode('scalar_null')->defaultNull()->end() + ->scalarNode('scalar_true')->defaultTrue()->end() + ->scalarNode('scalar_false')->defaultFalse()->end() + ->scalarNode('scalar_default')->defaultValue('default')->end() + ->scalarNode('scalar_array_empty')->defaultValue(array())->end() + ->scalarNode('scalar_array_defaults')->defaultValue(array('elem1', 'elem2'))->end() + ->scalarNode('scalar_required')->isRequired()->end() + ->enumNode('enum')->values(array('this', 'that'))->end() + ->arrayNode('array') + ->info('some info') + ->canBeUnset() + ->children() + ->scalarNode('child1')->end() + ->scalarNode('child2')->end() + ->scalarNode('child3') + ->info( + "this is a long\n". + "multi-line info text\n". + "which should be indented" + ) + ->example('example setting') + ->end() + ->end() + ->end() + ->arrayNode('parameters') + ->useAttributeAsKey('name') + ->prototype('scalar')->end() + ->end() + ->arrayNode('connections') + ->prototype('array') + ->children() + ->scalarNode('user')->end() + ->scalarNode('pass')->end() + ->end() + ->end() + ->end() + ->end() + ; + + return $treeBuilder; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/document_type.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/document_type.xml new file mode 100644 index 0000000..4c25228 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/document_type.xml @@ -0,0 +1,3 @@ + +]> + diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid.xml new file mode 100644 index 0000000..a07af9f --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid.xml @@ -0,0 +1,2 @@ + + diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid_schema.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid_schema.xml new file mode 100644 index 0000000..e2725a2 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/invalid_schema.xml @@ -0,0 +1,2 @@ + + diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/schema.xsd b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/schema.xsd new file mode 100644 index 0000000..e56820f --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/schema.xsd @@ -0,0 +1,9 @@ + + + + + + diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/valid.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/valid.xml new file mode 100644 index 0000000..a96bb38 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/Util/valid.xml @@ -0,0 +1,3 @@ + + + diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/foo.xml b/vendor/symfony/config/Symfony/Component/Config/Tests/Fixtures/foo.xml new file mode 100644 index 0000000..e69de29 diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php new file mode 100644 index 0000000..7641e24 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/DelegatingLoaderTest.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Loader; + +use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\Loader\DelegatingLoader; + +class DelegatingLoaderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\Config\Loader\DelegatingLoader::__construct + */ + public function testConstructor() + { + $loader = new DelegatingLoader($resolver = new LoaderResolver()); + $this->assertTrue(true, '__construct() takes a loader resolver as its first argument'); + } + + /** + * @covers Symfony\Component\Config\Loader\DelegatingLoader::getResolver + * @covers Symfony\Component\Config\Loader\DelegatingLoader::setResolver + */ + public function testGetSetResolver() + { + $resolver = new LoaderResolver(); + $loader = new DelegatingLoader($resolver); + $this->assertSame($resolver, $loader->getResolver(), '->getResolver() gets the resolver loader'); + $loader->setResolver($resolver = new LoaderResolver()); + $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader'); + } + + /** + * @covers Symfony\Component\Config\Loader\DelegatingLoader::supports + */ + public function testSupports() + { + $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $loader1->expects($this->once())->method('supports')->will($this->returnValue(true)); + $loader = new DelegatingLoader(new LoaderResolver(array($loader1))); + $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); + + $loader1 = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $loader1->expects($this->once())->method('supports')->will($this->returnValue(false)); + $loader = new DelegatingLoader(new LoaderResolver(array($loader1))); + $this->assertFalse($loader->supports('foo.foo'), '->supports() returns false if the resource is not loadable'); + } + + /** + * @covers Symfony\Component\Config\Loader\DelegatingLoader::load + */ + public function testLoad() + { + $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $loader->expects($this->once())->method('supports')->will($this->returnValue(true)); + $loader->expects($this->once())->method('load'); + $resolver = new LoaderResolver(array($loader)); + $loader = new DelegatingLoader($resolver); + + $loader->load('foo'); + } + + /** + * @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException + */ + public function testLoadThrowsAnExceptionIfTheResourceCannotBeLoaded() + { + $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $loader->expects($this->once())->method('supports')->will($this->returnValue(false)); + $resolver = new LoaderResolver(array($loader)); + $loader = new DelegatingLoader($resolver); + + $loader->load('foo'); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php new file mode 100644 index 0000000..280b218 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Loader; + +use Symfony\Component\Config\Loader\FileLoader; +use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException; + +class FileLoaderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\Config\Loader\FileLoader + */ + public function testImportWithFileLocatorDelegation() + { + $locatorMock = $this->getMock('Symfony\Component\Config\FileLocatorInterface'); + + $locatorMockForAdditionalLoader = $this->getMock('Symfony\Component\Config\FileLocatorInterface'); + $locatorMockForAdditionalLoader->expects($this->any())->method('locate')->will($this->onConsecutiveCalls( + array('path/to/file1'), // Default + array('path/to/file1', 'path/to/file2'), // First is imported + array('path/to/file1', 'path/to/file2'), // Second is imported + array('path/to/file1'), // Exception + array('path/to/file1', 'path/to/file2') // Exception + )); + + $fileLoader = new TestFileLoader($locatorMock); + $fileLoader->setSupports(false); + $fileLoader->setCurrentDir('.'); + + $additionalLoader = new TestFileLoader($locatorMockForAdditionalLoader); + $additionalLoader->setCurrentDir('.'); + + $fileLoader->setResolver($loaderResolver = new LoaderResolver(array($fileLoader, $additionalLoader))); + + // Default case + $this->assertSame('path/to/file1', $fileLoader->import('my_resource')); + + // Check first file is imported if not already loading + $this->assertSame('path/to/file1', $fileLoader->import('my_resource')); + + // Check second file is imported if first is already loading + $fileLoader->addLoading('path/to/file1'); + $this->assertSame('path/to/file2', $fileLoader->import('my_resource')); + + // Check exception throws if first (and only available) file is already loading + try { + $fileLoader->import('my_resource'); + $this->fail('->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException', $e, '->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); + } + + // Check exception throws if all files are already loading + try { + $fileLoader->addLoading('path/to/file2'); + $fileLoader->import('my_resource'); + $this->fail('->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException', $e, '->import() throws a FileLoaderImportCircularReferenceException if the resource is already loading'); + } + } +} + +class TestFileLoader extends FileLoader +{ + private $supports = true; + + public function load($resource, $type = null) + { + return $resource; + } + + public function supports($resource, $type = null) + { + return $this->supports; + } + + public function addLoading($resource) + { + self::$loading[$resource] = true; + } + + public function removeLoading($resource) + { + unset(self::$loading[$resource]); + } + + public function clearLoading() + { + self::$loading = array(); + } + + public function setSupports($supports) + { + $this->supports = $supports; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php new file mode 100644 index 0000000..8ee276b --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderResolverTest.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Loader; + +use Symfony\Component\Config\Loader\LoaderResolver; + +class LoaderResolverTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\Config\Loader\LoaderResolver::__construct + */ + public function testConstructor() + { + $resolver = new LoaderResolver(array( + $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'), + )); + + $this->assertEquals(array($loader), $resolver->getLoaders(), '__construct() takes an array of loaders as its first argument'); + } + + /** + * @covers Symfony\Component\Config\Loader\LoaderResolver::resolve + */ + public function testResolve() + { + $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $resolver = new LoaderResolver(array($loader)); + $this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource'); + + $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $loader->expects($this->once())->method('supports')->will($this->returnValue(true)); + $resolver = new LoaderResolver(array($loader)); + $this->assertEquals($loader, $resolver->resolve(function () {}), '->resolve() returns the loader for the given resource'); + } + + /** + * @covers Symfony\Component\Config\Loader\LoaderResolver::getLoaders + * @covers Symfony\Component\Config\Loader\LoaderResolver::addLoader + */ + public function testLoaders() + { + $resolver = new LoaderResolver(); + $resolver->addLoader($loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface')); + + $this->assertEquals(array($loader), $resolver->getLoaders(), 'addLoader() adds a loader'); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderTest.php new file mode 100644 index 0000000..e938a4b --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Loader/LoaderTest.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Loader; + +use Symfony\Component\Config\Loader\Loader; + +class LoaderTest extends \PHPUnit_Framework_TestCase +{ + public function testGetSetResolver() + { + $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); + + $loader = new ProjectLoader1(); + $loader->setResolver($resolver); + + $this->assertSame($resolver, $loader->getResolver(), '->setResolver() sets the resolver loader'); + } + + public function testResolve() + { + $resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + + $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); + $resolver->expects($this->once()) + ->method('resolve') + ->with('foo.xml') + ->will($this->returnValue($resolvedLoader)); + + $loader = new ProjectLoader1(); + $loader->setResolver($resolver); + + $this->assertSame($loader, $loader->resolve('foo.foo'), '->resolve() finds a loader'); + $this->assertSame($resolvedLoader, $loader->resolve('foo.xml'), '->resolve() finds a loader'); + } + + /** + * @expectedException \Symfony\Component\Config\Exception\FileLoaderLoadException + */ + public function testResolveWhenResolverCannotFindLoader() + { + $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); + $resolver->expects($this->once()) + ->method('resolve') + ->with('FOOBAR') + ->will($this->returnValue(false)); + + $loader = new ProjectLoader1(); + $loader->setResolver($resolver); + + $loader->resolve('FOOBAR'); + } + + public function testImport() + { + $resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $resolvedLoader->expects($this->once()) + ->method('load') + ->with('foo') + ->will($this->returnValue('yes')); + + $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); + $resolver->expects($this->once()) + ->method('resolve') + ->with('foo') + ->will($this->returnValue($resolvedLoader)); + + $loader = new ProjectLoader1(); + $loader->setResolver($resolver); + + $this->assertEquals('yes', $loader->import('foo')); + } + + public function testImportWithType() + { + $resolvedLoader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); + $resolvedLoader->expects($this->once()) + ->method('load') + ->with('foo', 'bar') + ->will($this->returnValue('yes')); + + $resolver = $this->getMock('Symfony\Component\Config\Loader\LoaderResolverInterface'); + $resolver->expects($this->once()) + ->method('resolve') + ->with('foo', 'bar') + ->will($this->returnValue($resolvedLoader)); + + $loader = new ProjectLoader1(); + $loader->setResolver($resolver); + + $this->assertEquals('yes', $loader->import('foo', 'bar')); + } +} + +class ProjectLoader1 extends Loader +{ + public function load($resource, $type = null) + { + } + + public function supports($resource, $type = null) + { + return is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION); + } + + public function getType() + { + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php new file mode 100644 index 0000000..d78e0cf --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/DirectoryResourceTest.php @@ -0,0 +1,152 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Resource; + +use Symfony\Component\Config\Resource\DirectoryResource; + +class DirectoryResourceTest extends \PHPUnit_Framework_TestCase +{ + protected $directory; + + protected function setUp() + { + $this->directory = sys_get_temp_dir().'/symfonyDirectoryIterator'; + if (!file_exists($this->directory)) { + mkdir($this->directory); + } + touch($this->directory.'/tmp.xml'); + } + + protected function tearDown() + { + if (!is_dir($this->directory)) { + return; + } + $this->removeDirectory($this->directory); + } + + protected function removeDirectory($directory) + { + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory), \RecursiveIteratorIterator::CHILD_FIRST); + foreach ($iterator as $path) { + if (preg_match('#[/\\\\]\.\.?$#', $path->__toString())) { + continue; + } + if ($path->isDir()) { + rmdir($path->__toString()); + } else { + unlink($path->__toString()); + } + } + rmdir($directory); + } + + public function testGetResource() + { + $resource = new DirectoryResource($this->directory); + $this->assertSame($this->directory, $resource->getResource(), '->getResource() returns the path to the resource'); + $this->assertSame($this->directory, (string) $resource, '->__toString() returns the path to the resource'); + } + + public function testGetPattern() + { + $resource = new DirectoryResource('foo', 'bar'); + $this->assertEquals('bar', $resource->getPattern()); + } + + public function testIsFresh() + { + $resource = new DirectoryResource($this->directory); + $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if the resource has not changed'); + $this->assertFalse($resource->isFresh(time() - 86400), '->isFresh() returns false if the resource has been updated'); + + $resource = new DirectoryResource('/____foo/foobar'.rand(1, 999999)); + $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the resource does not exist'); + } + + public function testIsFreshUpdateFile() + { + $resource = new DirectoryResource($this->directory); + touch($this->directory.'/tmp.xml', time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if an existing file is modified'); + } + + public function testIsFreshNewFile() + { + $resource = new DirectoryResource($this->directory); + touch($this->directory.'/new.xml', time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a new file is added'); + } + + public function testIsFreshDeleteFile() + { + $resource = new DirectoryResource($this->directory); + unlink($this->directory.'/tmp.xml'); + $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if an existing file is removed'); + } + + public function testIsFreshDeleteDirectory() + { + $resource = new DirectoryResource($this->directory); + $this->removeDirectory($this->directory); + $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the whole resource is removed'); + } + + public function testIsFreshCreateFileInSubdirectory() + { + $subdirectory = $this->directory.'/subdirectory'; + mkdir($subdirectory); + + $resource = new DirectoryResource($this->directory); + $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if an unmodified subdirectory exists'); + + touch($subdirectory.'/newfile.xml', time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a new file in a subdirectory is added'); + } + + public function testIsFreshModifySubdirectory() + { + $resource = new DirectoryResource($this->directory); + + $subdirectory = $this->directory.'/subdirectory'; + mkdir($subdirectory); + touch($subdirectory, time() + 20); + + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if a subdirectory is modified (e.g. a file gets deleted)'); + } + + public function testFilterRegexListNoMatch() + { + $resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/'); + + touch($this->directory.'/new.bar', time() + 20); + $this->assertTrue($resource->isFresh(time() + 10), '->isFresh() returns true if a new file not matching the filter regex is created'); + } + + public function testFilterRegexListMatch() + { + $resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/'); + + touch($this->directory.'/new.xml', time() + 20); + $this->assertFalse($resource->isFresh(time() + 10), '->isFresh() returns false if an new file matching the filter regex is created '); + } + + public function testSerializeUnserialize() + { + $resource = new DirectoryResource($this->directory, '/\.(foo|xml)$/'); + + $unserialized = unserialize(serialize($resource)); + + $this->assertSame($this->directory, $resource->getResource()); + $this->assertSame('/\.(foo|xml)$/', $resource->getPattern()); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/FileResourceTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/FileResourceTest.php new file mode 100644 index 0000000..1f1ddee --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Resource/FileResourceTest.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Resource; + +use Symfony\Component\Config\Resource\FileResource; + +class FileResourceTest extends \PHPUnit_Framework_TestCase +{ + protected $resource; + protected $file; + + protected function setUp() + { + $this->file = realpath(sys_get_temp_dir()).'/tmp.xml'; + touch($this->file); + $this->resource = new FileResource($this->file); + } + + protected function tearDown() + { + unlink($this->file); + } + + public function testGetResource() + { + $this->assertSame(realpath($this->file), $this->resource->getResource(), '->getResource() returns the path to the resource'); + } + + public function testToString() + { + $this->assertSame(realpath($this->file), (string) $this->resource); + } + + public function testIsFresh() + { + $this->assertTrue($this->resource->isFresh(time() + 10), '->isFresh() returns true if the resource has not changed'); + $this->assertFalse($this->resource->isFresh(time() - 86400), '->isFresh() returns false if the resource has been updated'); + + $resource = new FileResource('/____foo/foobar'.rand(1, 999999)); + $this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the resource does not exist'); + } + + public function testSerializeUnserialize() + { + $unserialized = unserialize(serialize($this->resource)); + + $this->assertSame(realpath($this->file), $this->resource->getResource()); + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/vendor/symfony/config/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php new file mode 100644 index 0000000..e3efc8c --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -0,0 +1,190 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Tests\Loader; + +use Symfony\Component\Config\Util\XmlUtils; + +class XmlUtilsTest extends \PHPUnit_Framework_TestCase +{ + public function testLoadFile() + { + $fixtures = __DIR__.'/../Fixtures/Util/'; + + try { + XmlUtils::loadFile($fixtures.'invalid.xml'); + $this->fail(); + } catch (\InvalidArgumentException $e) { + $this->assertContains('ERROR 77', $e->getMessage()); + } + + try { + XmlUtils::loadFile($fixtures.'document_type.xml'); + $this->fail(); + } catch (\InvalidArgumentException $e) { + $this->assertContains('Document types are not allowed', $e->getMessage()); + } + + try { + XmlUtils::loadFile($fixtures.'invalid_schema.xml', $fixtures.'schema.xsd'); + $this->fail(); + } catch (\InvalidArgumentException $e) { + $this->assertContains('ERROR 1845', $e->getMessage()); + } + + try { + XmlUtils::loadFile($fixtures.'invalid_schema.xml', 'invalid_callback_or_file'); + $this->fail(); + } catch (\InvalidArgumentException $e) { + $this->assertContains('XSD file or callable', $e->getMessage()); + } + + $mock = $this->getMock(__NAMESPACE__.'\Validator'); + $mock->expects($this->exactly(2))->method('validate')->will($this->onConsecutiveCalls(false, true)); + + try { + XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate')); + $this->fail(); + } catch (\InvalidArgumentException $e) { + $this->assertContains('is not valid', $e->getMessage()); + } + + $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate'))); + $this->assertSame(array(), libxml_get_errors()); + } + + public function testLoadFileWithInternalErrorsEnabled() + { + libxml_use_internal_errors(true); + + $this->assertSame(array(), libxml_get_errors()); + $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile(__DIR__.'/../Fixtures/Util/invalid_schema.xml')); + $this->assertSame(array(), libxml_get_errors()); + } + + /** + * @dataProvider getDataForConvertDomToArray + */ + public function testConvertDomToArray($expected, $xml, $root = false, $checkPrefix = true) + { + $dom = new \DOMDocument(); + $dom->loadXML($root ? $xml : ''.$xml.''); + + $this->assertSame($expected, XmlUtils::convertDomElementToArray($dom->documentElement, $checkPrefix)); + } + + public function getDataForConvertDomToArray() + { + return array( + array(null, ''), + array('bar', 'bar'), + array(array('bar' => 'foobar'), '', true), + array(array('foo' => null), ''), + array(array('foo' => 'bar'), 'bar'), + array(array('foo' => array('foo' => 'bar')), ''), + array(array('foo' => array('foo' => 0)), '0'), + array(array('foo' => array('foo' => 'bar')), 'bar'), + array(array('foo' => array('foo' => 'bar', 'value' => 'text')), 'text'), + array(array('foo' => array('attr' => 'bar', 'foo' => 'text')), 'text'), + array(array('foo' => array('bar', 'text')), 'bartext'), + array(array('foo' => array(array('foo' => 'bar'), array('foo' => 'text'))), ''), + array(array('foo' => array('foo' => array('bar', 'text'))), 'text'), + array(array('foo' => 'bar'), 'bar'), + array(array('foo' => 'text'), 'text'), + array(array('foo' => array('bar' => 'bar', 'value' => 'text')), 'text', false, false), + array(array('attr' => 1, 'b' => 'hello'), 'hello2', true), + ); + } + + /** + * @dataProvider getDataForPhpize + */ + public function testPhpize($expected, $value) + { + $this->assertSame($expected, XmlUtils::phpize($value)); + } + + public function getDataForPhpize() + { + return array( + array('', ''), + array(null, 'null'), + array(true, 'true'), + array(false, 'false'), + array(null, 'Null'), + array(true, 'True'), + array(false, 'False'), + array(0, '0'), + array(1, '1'), + array(-1, '-1'), + array(0777, '0777'), + array(255, '0xFF'), + array(100.0, '1e2'), + array(-120.0, '-1.2E2'), + array(-10100.1, '-10100.1'), + array('-10,100.1', '-10,100.1'), + array('1234 5678 9101 1121 3141', '1234 5678 9101 1121 3141'), + array('1,2,3,4', '1,2,3,4'), + array('11,22,33,44', '11,22,33,44'), + array('11,222,333,4', '11,222,333,4'), + array('1,222,333,444', '1,222,333,444'), + array('11,222,333,444', '11,222,333,444'), + array('111,222,333,444', '111,222,333,444'), + array('1111,2222,3333,4444,5555', '1111,2222,3333,4444,5555'), + array('foo', 'foo'), + array(6, '0b0110'), + ); + } + + public function testLoadEmptyXmlFile() + { + $file = __DIR__.'/../Fixtures/foo.xml'; + $this->setExpectedException('InvalidArgumentException', 'File '.$file.' does not contain valid XML, it is empty.'); + XmlUtils::loadFile($file); + } + + // test for issue https://github.com/symfony/symfony/issues/9731 + public function testLoadWrongEmptyXMLWithErrorHandler() + { + $originalDisableEntities = libxml_disable_entity_loader(false); + $errorReporting = error_reporting(-1); + + set_error_handler(function ($errno, $errstr) { + throw new \Exception($errstr, $errno); + }); + + $file = __DIR__.'/../Fixtures/foo.xml'; + try { + XmlUtils::loadFile($file); + $this->fail('An exception should have been raised'); + } catch (\InvalidArgumentException $e) { + $this->assertEquals(sprintf('File %s does not contain valid XML, it is empty.', $file), $e->getMessage()); + } + + restore_error_handler(); + error_reporting($errorReporting); + + $disableEntities = libxml_disable_entity_loader(true); + libxml_disable_entity_loader($disableEntities); + + libxml_disable_entity_loader($originalDisableEntities); + + $this->assertFalse($disableEntities); + + // should not throw an exception + XmlUtils::loadFile(__DIR__.'/../Fixtures/Util/valid.xml', __DIR__.'/../Fixtures/Util/schema.xsd'); + } +} + +interface Validator +{ + public function validate(); +} diff --git a/vendor/symfony/config/Symfony/Component/Config/Util/XmlUtils.php b/vendor/symfony/config/Symfony/Component/Config/Util/XmlUtils.php new file mode 100644 index 0000000..8473919 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/Util/XmlUtils.php @@ -0,0 +1,236 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Config\Util; + +/** + * 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ň + */ +class XmlUtils +{ + /** + * This class should not be instantiated + */ + private function __construct() + { + } + + /** + * 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 + * + * @return \DOMDocument + * + * @throws \InvalidArgumentException When loading of XML file returns error + */ + public static function loadFile($file, $schemaOrCallable = null) + { + $content = @file_get_contents($file); + if ('' === trim($content)) { + throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file)); + } + + $internalErrors = libxml_use_internal_errors(true); + $disableEntities = libxml_disable_entity_loader(true); + libxml_clear_errors(); + + $dom = new \DOMDocument(); + $dom->validateOnParse = true; + if (!$dom->loadXML($content, LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { + libxml_disable_entity_loader($disableEntities); + + throw new \InvalidArgumentException(implode("\n", static::getXmlErrors($internalErrors))); + } + + $dom->normalizeDocument(); + + libxml_use_internal_errors($internalErrors); + libxml_disable_entity_loader($disableEntities); + + foreach ($dom->childNodes as $child) { + if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) { + throw new \InvalidArgumentException('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 = call_user_func($schemaOrCallable, $dom, $internalErrors); + } catch (\Exception $e) { + $valid = false; + } + } elseif (!is_array($schemaOrCallable) && is_file((string) $schemaOrCallable)) { + $schemaSource = file_get_contents((string) $schemaOrCallable); + $valid = @$dom->schemaValidateSource($schemaSource); + } else { + libxml_use_internal_errors($internalErrors); + + throw new \InvalidArgumentException('The schemaOrCallable argument has to be a valid path to XSD file or callable.'); + } + + if (!$valid) { + $messages = static::getXmlErrors($internalErrors); + if (empty($messages)) { + $messages = array(sprintf('The XML file "%s" is not valid.', $file)); + } + throw new \InvalidArgumentException(implode("\n", $messages), 0, $e); + } + } + + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); + + return $dom; + } + + /** + * 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 + * + * @return array A PHP array + */ + public static function convertDomElementToArray(\DomElement $element, $checkPrefix = true) + { + $prefix = (string) $element->prefix; + $empty = true; + $config = array(); + foreach ($element->attributes as $name => $node) { + if ($checkPrefix && !in_array((string) $node->prefix, array('', $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] = array($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. + * + * @param mixed $value + * + * @return mixed + */ + public static function phpize($value) + { + $value = (string) $value; + $lowercaseValue = strtolower($value); + + switch (true) { + case 'null' === $lowercaseValue: + return; + case ctype_digit($value): + $raw = $value; + $cast = intval($value); + + return '0' == $value[0] ? octdec($value) : (((string) $raw == (string) $cast) ? $cast : $raw); + case isset($value[1]) && '-' === $value[0] && ctype_digit(substr($value, 1)): + $raw = $value; + $cast = intval($value); + + return '0' == $value[1] ? octdec($value) : (((string) $raw == (string) $cast) ? $cast : $raw); + case 'true' === $lowercaseValue: + return true; + case 'false' === $lowercaseValue: + return false; + case isset($value[1]) && '0b' == $value[0].$value[1]: + return bindec($value); + case is_numeric($value): + return '0x' == $value[0].$value[1] ? hexdec($value) : floatval($value); + case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value): + return floatval($value); + default: + return $value; + } + } + + protected static function getXmlErrors($internalErrors) + { + $errors = array(); + 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 ? $error->file : 'n/a', + $error->line, + $error->column + ); + } + + libxml_clear_errors(); + libxml_use_internal_errors($internalErrors); + + return $errors; + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/composer.json b/vendor/symfony/config/Symfony/Component/Config/composer.json new file mode 100644 index 0000000..dce426b --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/composer.json @@ -0,0 +1,32 @@ +{ + "name": "symfony/config", + "type": "library", + "description": "Symfony Config Component", + "keywords": [], + "homepage": "http://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.3", + "symfony/filesystem": "~2.3" + }, + "autoload": { + "psr-0": { "Symfony\\Component\\Config\\": "" } + }, + "target-dir": "Symfony/Component/Config", + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + } +} diff --git a/vendor/symfony/config/Symfony/Component/Config/phpunit.xml.dist b/vendor/symfony/config/Symfony/Component/Config/phpunit.xml.dist new file mode 100644 index 0000000..9b13467 --- /dev/null +++ b/vendor/symfony/config/Symfony/Component/Config/phpunit.xml.dist @@ -0,0 +1,25 @@ + + + + + + ./Tests/ + + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/.gitignore b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/.gitignore new file mode 100644 index 0000000..c49a5d8 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Alias.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Alias.php new file mode 100644 index 0000000..025a2d6 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Alias.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection; + +/** + * @api + */ +class Alias +{ + private $id; + private $public; + + /** + * Constructor. + * + * @param string $id Alias identifier + * @param bool $public If this alias is public + * + * @api + */ + public function __construct($id, $public = true) + { + $this->id = strtolower($id); + $this->public = $public; + } + + /** + * Checks if this DI Alias should be public or not. + * + * @return bool + * + * @api + */ + public function isPublic() + { + return $this->public; + } + + /** + * Sets if this Alias is public. + * + * @param bool $boolean If this Alias should be public + * + * @api + */ + public function setPublic($boolean) + { + $this->public = (bool) $boolean; + } + + /** + * Returns the Id of this alias. + * + * @return string The alias id + * + * @api + */ + public function __toString() + { + return $this->id; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md new file mode 100644 index 0000000..5a88e34 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -0,0 +1,35 @@ +CHANGELOG +========= + +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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php new file mode 100644 index 0000000..a84b932 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php @@ -0,0 +1,148 @@ + + * + * 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\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * 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 + */ +class AnalyzeServiceReferencesPass implements RepeatablePassInterface +{ + private $graph; + private $container; + private $currentId; + private $currentDefinition; + private $repeatedPass; + private $onlyConstructorArguments; + + /** + * Constructor. + * + * @param bool $onlyConstructorArguments Sets this Service Reference pass to ignore method calls + */ + public function __construct($onlyConstructorArguments = false) + { + $this->onlyConstructorArguments = (bool) $onlyConstructorArguments; + } + + /** + * {@inheritdoc} + */ + public function setRepeatedPass(RepeatedPass $repeatedPass) + { + $this->repeatedPass = $repeatedPass; + } + + /** + * Processes a ContainerBuilder object to populate the service reference graph. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $this->container = $container; + $this->graph = $container->getCompiler()->getServiceReferenceGraph(); + $this->graph->clear(); + + foreach ($container->getDefinitions() as $id => $definition) { + if ($definition->isSynthetic() || $definition->isAbstract()) { + continue; + } + + $this->currentId = $id; + $this->currentDefinition = $definition; + + $this->processArguments($definition->getArguments()); + if ($definition->getFactoryService()) { + $this->processArguments(array(new Reference($definition->getFactoryService()))); + } + + if (!$this->onlyConstructorArguments) { + $this->processArguments($definition->getMethodCalls()); + $this->processArguments($definition->getProperties()); + if ($definition->getConfigurator()) { + $this->processArguments(array($definition->getConfigurator())); + } + } + } + + foreach ($container->getAliases() as $id => $alias) { + $this->graph->connect($id, $alias, (string) $alias, $this->getDefinition((string) $alias), null); + } + } + + /** + * Processes service definitions for arguments to find relationships for the service graph. + * + * @param array $arguments An array of Reference or Definition objects relating to service definitions + */ + private function processArguments(array $arguments) + { + foreach ($arguments as $argument) { + if (is_array($argument)) { + $this->processArguments($argument); + } elseif ($argument instanceof Reference) { + $this->graph->connect( + $this->currentId, + $this->currentDefinition, + $this->getDefinitionId((string) $argument), + $this->getDefinition((string) $argument), + $argument + ); + } elseif ($argument instanceof Definition) { + $this->processArguments($argument->getArguments()); + $this->processArguments($argument->getMethodCalls()); + $this->processArguments($argument->getProperties()); + + if ($argument->getFactoryService()) { + $this->processArguments(array(new Reference($argument->getFactoryService()))); + } + } + } + } + + /** + * Returns a service definition given the full name or an alias. + * + * @param string $id A full id or alias for a service definition. + * + * @return Definition|null The definition related to the supplied id + */ + private function getDefinition($id) + { + $id = $this->getDefinitionId($id); + + return null === $id ? null : $this->container->getDefinition($id); + } + + private function getDefinitionId($id) + { + while ($this->container->hasAlias($id)) { + $id = (string) $this->container->getAlias($id); + } + + if (!$this->container->hasDefinition($id)) { + return; + } + + return $id; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php new file mode 100644 index 0000000..ca2c62a --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php @@ -0,0 +1,79 @@ + + * + * 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\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * 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 $currentId; + private $currentPath; + private $checkedNodes; + + /** + * Checks the ContainerBuilder object for circular references. + * + * @param ContainerBuilder $container The ContainerBuilder instances + */ + public function process(ContainerBuilder $container) + { + $graph = $container->getCompiler()->getServiceReferenceGraph(); + + $this->checkedNodes = array(); + foreach ($graph->getNodes() as $id => $node) { + $this->currentId = $id; + $this->currentPath = array($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) + { + foreach ($edges as $edge) { + $node = $edge->getDestNode(); + $id = $node->getId(); + + if (empty($this->checkedNodes[$id])) { + $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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php new file mode 100644 index 0000000..c8978f3 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php @@ -0,0 +1,90 @@ + + * + * 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\ContainerInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; + +/** + * 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 + * - synthetic services are always of non-prototype scope + * + * @author Johannes M. Schmitt + */ +class CheckDefinitionValidityPass implements CompilerPassInterface +{ + /** + * Processes the ContainerBuilder to validate the Definition. + * + * @param ContainerBuilder $container + * + * @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 + )); + } + + // synthetic service has non-prototype scope + if ($definition->isSynthetic() && ContainerInterface::SCOPE_PROTOTYPE === $definition->getScope()) { + throw new RuntimeException(sprintf( + 'A synthetic service ("%s") cannot be of scope "prototype".', + $id + )); + } + + // non-synthetic, non-abstract service has class + if (!$definition->isAbstract() && !$definition->isSynthetic() && !$definition->getClass()) { + if ($definition->getFactoryClass() || $definition->getFactoryService()) { + 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 + )); + } + + 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) { + foreach ($attributes as $attribute => $value) { + if (!is_scalar($value) && null !== $value) { + throw new RuntimeException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s".', $id, $name, $attribute)); + } + } + } + } + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php new file mode 100644 index 0000000..2cd5480 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php @@ -0,0 +1,64 @@ + + * + * 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\ServiceNotFoundException; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Checks that all references are pointing to a valid service. + * + * @author Johannes M. Schmitt + */ +class CheckExceptionOnInvalidReferenceBehaviorPass implements CompilerPassInterface +{ + private $container; + private $sourceId; + + public function process(ContainerBuilder $container) + { + $this->container = $container; + + foreach ($container->getDefinitions() as $id => $definition) { + $this->sourceId = $id; + $this->processDefinition($definition); + } + } + + private function processDefinition(Definition $definition) + { + $this->processReferences($definition->getArguments()); + $this->processReferences($definition->getMethodCalls()); + $this->processReferences($definition->getProperties()); + } + + private function processReferences(array $arguments) + { + foreach ($arguments as $argument) { + if (is_array($argument)) { + $this->processReferences($argument); + } elseif ($argument instanceof Definition) { + $this->processDefinition($argument); + } elseif ($argument instanceof Reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $argument->getInvalidBehavior()) { + $destId = (string) $argument; + + if (!$this->container->has($destId)) { + throw new ServiceNotFoundException($destId, $this->sourceId); + } + } + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php new file mode 100644 index 0000000..aa11d38 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php @@ -0,0 +1,167 @@ + + * + * 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\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Exception\ScopeCrossingInjectionException; +use Symfony\Component\DependencyInjection\Exception\ScopeWideningInjectionException; + +/** + * Checks the validity of references + * + * The following checks are performed by this pass: + * - target definitions are not abstract + * - target definitions are of equal or wider scope + * - target definitions are in the same scope hierarchy + * + * @author Johannes M. Schmitt + */ +class CheckReferenceValidityPass implements CompilerPassInterface +{ + private $container; + private $currentId; + private $currentDefinition; + private $currentScope; + private $currentScopeAncestors; + private $currentScopeChildren; + + /** + * Processes the ContainerBuilder to validate References. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $this->container = $container; + + $children = $this->container->getScopeChildren(); + $ancestors = array(); + + $scopes = $this->container->getScopes(); + foreach ($scopes as $name => $parent) { + $ancestors[$name] = array($parent); + + while (isset($scopes[$parent])) { + $ancestors[$name][] = $parent = $scopes[$parent]; + } + } + + foreach ($container->getDefinitions() as $id => $definition) { + if ($definition->isSynthetic() || $definition->isAbstract()) { + continue; + } + + $this->currentId = $id; + $this->currentDefinition = $definition; + $this->currentScope = $scope = $definition->getScope(); + + if (ContainerInterface::SCOPE_CONTAINER === $scope) { + $this->currentScopeChildren = array_keys($scopes); + $this->currentScopeAncestors = array(); + } elseif (ContainerInterface::SCOPE_PROTOTYPE !== $scope) { + $this->currentScopeChildren = isset($children[$scope]) ? $children[$scope] : array(); + $this->currentScopeAncestors = isset($ancestors[$scope]) ? $ancestors[$scope] : array(); + } + + $this->validateReferences($definition->getArguments()); + $this->validateReferences($definition->getMethodCalls()); + $this->validateReferences($definition->getProperties()); + } + } + + /** + * Validates an array of References. + * + * @param array $arguments An array of Reference objects + * + * @throws RuntimeException when there is a reference to an abstract definition. + */ + private function validateReferences(array $arguments) + { + foreach ($arguments as $argument) { + if (is_array($argument)) { + $this->validateReferences($argument); + } elseif ($argument instanceof Reference) { + $targetDefinition = $this->getDefinition((string) $argument); + + if (null !== $targetDefinition && $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, + $argument + )); + } + + $this->validateScope($argument, $targetDefinition); + } + } + } + + /** + * Validates the scope of a single Reference. + * + * @param Reference $reference + * @param Definition $definition + * + * @throws ScopeWideningInjectionException when the definition references a service of a narrower scope + * @throws ScopeCrossingInjectionException when the definition references a service of another scope hierarchy + */ + private function validateScope(Reference $reference, Definition $definition = null) + { + if (ContainerInterface::SCOPE_PROTOTYPE === $this->currentScope) { + return; + } + + if (!$reference->isStrict()) { + return; + } + + if (null === $definition) { + return; + } + + if ($this->currentScope === $scope = $definition->getScope()) { + return; + } + + $id = (string) $reference; + + if (in_array($scope, $this->currentScopeChildren, true)) { + throw new ScopeWideningInjectionException($this->currentId, $this->currentScope, $id, $scope); + } + + if (!in_array($scope, $this->currentScopeAncestors, true)) { + throw new ScopeCrossingInjectionException($this->currentId, $this->currentScope, $id, $scope); + } + } + + /** + * Returns the Definition given an id. + * + * @param string $id Definition identifier + * + * @return Definition + */ + private function getDefinition($id) + { + if (!$this->container->hasDefinition($id)) { + return; + } + + return $this->container->getDefinition($id); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/Compiler.php new file mode 100644 index 0000000..4dfa9cf --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/Compiler.php @@ -0,0 +1,120 @@ + + * + * 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; + +/** + * This class is used to remove circular dependencies between individual passes. + * + * @author Johannes M. Schmitt + * + * @api + */ +class Compiler +{ + private $passConfig; + private $log = array(); + private $loggingFormatter; + private $serviceReferenceGraph; + + /** + * Constructor. + */ + public function __construct() + { + $this->passConfig = new PassConfig(); + $this->serviceReferenceGraph = new ServiceReferenceGraph(); + $this->loggingFormatter = new LoggingFormatter(); + } + + /** + * Returns the PassConfig. + * + * @return PassConfig The PassConfig instance + * + * @api + */ + public function getPassConfig() + { + return $this->passConfig; + } + + /** + * Returns the ServiceReferenceGraph. + * + * @return ServiceReferenceGraph The ServiceReferenceGraph instance + * + * @api + */ + public function getServiceReferenceGraph() + { + return $this->serviceReferenceGraph; + } + + /** + * Returns the logging formatter which can be used by compilation passes. + * + * @return LoggingFormatter + */ + public function getLoggingFormatter() + { + return $this->loggingFormatter; + } + + /** + * Adds a pass to the PassConfig. + * + * @param CompilerPassInterface $pass A compiler pass + * @param string $type The type of the pass + * + * @api + */ + public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION) + { + $this->passConfig->addPass($pass, $type); + } + + /** + * Adds a log message. + * + * @param string $string The log message + */ + public function addLogMessage($string) + { + $this->log[] = $string; + } + + /** + * Returns the log. + * + * @return array Log array + */ + public function getLog() + { + return $this->log; + } + + /** + * Run the Compiler and process all Passes. + * + * @param ContainerBuilder $container + * + * @api + */ + public function compile(ContainerBuilder $container) + { + foreach ($this->passConfig->getPasses() as $pass) { + $pass->process($container); + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php new file mode 100644 index 0000000..beacda9 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php @@ -0,0 +1,33 @@ + + * + * 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 + * + * @api + */ +interface CompilerPassInterface +{ + /** + * You can modify the container here before it is dumped to PHP code. + * + * @param ContainerBuilder $container + * + * @api + */ + public function process(ContainerBuilder $container); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php new file mode 100644 index 0000000..dea9f03 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/DecoratorServicePass.php @@ -0,0 +1,54 @@ + + * + * 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\Alias; + +/** + * Overwrites a service but keeps the overridden one. + * + * @author Christophe Coevoet + * @author Fabien Potencier + */ +class DecoratorServicePass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + foreach ($container->getDefinitions() as $id => $definition) { + if (!$decorated = $definition->getDecoratedService()) { + continue; + } + $definition->setDecoratedService(null); + + list ($inner, $renamedId) = $decorated; + if (!$renamedId) { + $renamedId = $id.'.inner'; + } + + // 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)); + } else { + $definition = $container->getDefinition($inner); + $public = $definition->isPublic(); + $definition->setPublic(false); + $container->setDefinition($renamedId, $definition); + } + + $container->setAlias($inner, new Alias($id, $public)); + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php new file mode 100644 index 0000000..c17577e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php @@ -0,0 +1,152 @@ + + * + * 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\ContainerInterface; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Inline service definitions where this is possible. + * + * @author Johannes M. Schmitt + */ +class InlineServiceDefinitionsPass implements RepeatablePassInterface +{ + private $repeatedPass; + private $graph; + private $compiler; + private $formatter; + private $currentId; + + /** + * {@inheritdoc} + */ + public function setRepeatedPass(RepeatedPass $repeatedPass) + { + $this->repeatedPass = $repeatedPass; + } + + /** + * Processes the ContainerBuilder for inline service definitions. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $this->compiler = $container->getCompiler(); + $this->formatter = $this->compiler->getLoggingFormatter(); + $this->graph = $this->compiler->getServiceReferenceGraph(); + + foreach ($container->getDefinitions() as $id => $definition) { + $this->currentId = $id; + + $definition->setArguments( + $this->inlineArguments($container, $definition->getArguments()) + ); + + $definition->setMethodCalls( + $this->inlineArguments($container, $definition->getMethodCalls()) + ); + + $definition->setProperties( + $this->inlineArguments($container, $definition->getProperties()) + ); + + $configurator = $this->inlineArguments($container, array($definition->getConfigurator())); + $definition->setConfigurator( + $configurator[0] + ); + } + } + + /** + * Processes inline arguments. + * + * @param ContainerBuilder $container The ContainerBuilder + * @param array $arguments An array of arguments + * + * @return array + */ + private function inlineArguments(ContainerBuilder $container, array $arguments) + { + foreach ($arguments as $k => $argument) { + if (is_array($argument)) { + $arguments[$k] = $this->inlineArguments($container, $argument); + } elseif ($argument instanceof Reference) { + if (!$container->hasDefinition($id = (string) $argument)) { + continue; + } + + if ($this->isInlineableDefinition($container, $id, $definition = $container->getDefinition($id))) { + $this->compiler->addLogMessage($this->formatter->formatInlineService($this, $id, $this->currentId)); + + if (ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope()) { + $arguments[$k] = $definition; + } else { + $arguments[$k] = clone $definition; + } + } + } elseif ($argument instanceof Definition) { + $argument->setArguments($this->inlineArguments($container, $argument->getArguments())); + $argument->setMethodCalls($this->inlineArguments($container, $argument->getMethodCalls())); + $argument->setProperties($this->inlineArguments($container, $argument->getProperties())); + } + } + + return $arguments; + } + + /** + * Checks if the definition is inlineable. + * + * @param ContainerBuilder $container + * @param string $id + * @param Definition $definition + * + * @return bool If the definition is inlineable + */ + private function isInlineableDefinition(ContainerBuilder $container, $id, Definition $definition) + { + if (ContainerInterface::SCOPE_PROTOTYPE === $definition->getScope()) { + return true; + } + + if ($definition->isPublic() || $definition->isLazy()) { + return false; + } + + if (!$this->graph->hasNode($id)) { + return true; + } + + if ($this->currentId == $id) { + return false; + } + + $ids = array(); + foreach ($this->graph->getNode($id)->getInEdges() as $edge) { + $ids[] = $edge->getSourceNode()->getId(); + } + + if (count(array_unique($ids)) > 1) { + return false; + } + + if (count($ids) > 1 && $definition->getFactoryService()) { + return false; + } + + return $container->getDefinition(reset($ids))->getScope() === $definition->getScope(); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php new file mode 100644 index 0000000..6bd6161 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Compiler; + +/** + * Used to format logging messages during the compilation. + * + * @author Johannes M. Schmitt + */ +class LoggingFormatter +{ + public function formatRemoveService(CompilerPassInterface $pass, $id, $reason) + { + return $this->format($pass, sprintf('Removed service "%s"; reason: %s', $id, $reason)); + } + + public function formatInlineService(CompilerPassInterface $pass, $id, $target) + { + return $this->format($pass, sprintf('Inlined service "%s" to "%s".', $id, $target)); + } + + public function formatUpdateReference(CompilerPassInterface $pass, $serviceId, $oldDestId, $newDestId) + { + return $this->format($pass, sprintf('Changed reference of service "%s" previously pointing to "%s" to "%s".', $serviceId, $oldDestId, $newDestId)); + } + + public function formatResolveInheritance(CompilerPassInterface $pass, $childId, $parentId) + { + return $this->format($pass, sprintf('Resolving inheritance for "%s" (parent: %s).', $childId, $parentId)); + } + + public function format(CompilerPassInterface $pass, $message) + { + return sprintf('%s: %s', get_class($pass), $message); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php new file mode 100644 index 0000000..92a9887 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php @@ -0,0 +1,59 @@ + + * + * 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\Extension\PrependExtensionInterface; + +/** + * Merges extension configs into the container builder + * + * @author Fabien Potencier + */ +class MergeExtensionConfigurationPass implements CompilerPassInterface +{ + /** + * {@inheritdoc} + */ + public function process(ContainerBuilder $container) + { + $parameters = $container->getParameterBag()->all(); + $definitions = $container->getDefinitions(); + $aliases = $container->getAliases(); + + 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; + } + $config = $container->getParameterBag()->resolveValue($config); + + $tmpContainer = new ContainerBuilder($container->getParameterBag()); + $tmpContainer->setResourceTracking($container->isTrackingResources()); + $tmpContainer->addObjectResource($extension); + + $extension->load($config, $tmpContainer); + + $container->merge($tmpContainer); + } + + $container->addDefinitions($definitions); + $container->addAliases($aliases); + $container->getParameterBag()->add($parameters); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PassConfig.php new file mode 100644 index 0000000..bcef410 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -0,0 +1,256 @@ + + * + * 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 + * + * @api + */ +class PassConfig +{ + const TYPE_AFTER_REMOVING = 'afterRemoving'; + const TYPE_BEFORE_OPTIMIZATION = 'beforeOptimization'; + const TYPE_BEFORE_REMOVING = 'beforeRemoving'; + const TYPE_OPTIMIZE = 'optimization'; + const TYPE_REMOVE = 'removing'; + + private $mergePass; + private $afterRemovingPasses = array(); + private $beforeOptimizationPasses = array(); + private $beforeRemovingPasses = array(); + private $optimizationPasses; + private $removingPasses; + + /** + * Constructor. + */ + public function __construct() + { + $this->mergePass = new MergeExtensionConfigurationPass(); + + $this->optimizationPasses = array( + new ResolveDefinitionTemplatesPass(), + new DecoratorServicePass(), + new ResolveParameterPlaceHoldersPass(), + new CheckDefinitionValidityPass(), + new ResolveReferencesToAliasesPass(), + new ResolveInvalidReferencesPass(), + new AnalyzeServiceReferencesPass(true), + new CheckCircularReferencesPass(), + new CheckReferenceValidityPass(), + ); + + $this->removingPasses = array( + new RemovePrivateAliasesPass(), + new RemoveAbstractDefinitionsPass(), + new ReplaceAliasByActualDefinitionPass(), + new RepeatedPass(array( + new AnalyzeServiceReferencesPass(), + new InlineServiceDefinitionsPass(), + new AnalyzeServiceReferencesPass(), + new RemoveUnusedDefinitionsPass(), + )), + new CheckExceptionOnInvalidReferenceBehaviorPass(), + ); + } + + /** + * Returns all passes in order to be processed. + * + * @return array An array of all passes to process + * + * @api + */ + public function getPasses() + { + return array_merge( + array($this->mergePass), + $this->beforeOptimizationPasses, + $this->optimizationPasses, + $this->beforeRemovingPasses, + $this->removingPasses, + $this->afterRemovingPasses + ); + } + + /** + * Adds a pass. + * + * @param CompilerPassInterface $pass A Compiler pass + * @param string $type The pass type + * + * @throws InvalidArgumentException when a pass type doesn't exist + * + * @api + */ + public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION) + { + $property = $type.'Passes'; + if (!isset($this->$property)) { + throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type)); + } + + $passes = &$this->$property; + $passes[] = $pass; + } + + /** + * Gets all passes for the AfterRemoving pass. + * + * @return array An array of passes + * + * @api + */ + public function getAfterRemovingPasses() + { + return $this->afterRemovingPasses; + } + + /** + * Gets all passes for the BeforeOptimization pass. + * + * @return array An array of passes + * + * @api + */ + public function getBeforeOptimizationPasses() + { + return $this->beforeOptimizationPasses; + } + + /** + * Gets all passes for the BeforeRemoving pass. + * + * @return array An array of passes + * + * @api + */ + public function getBeforeRemovingPasses() + { + return $this->beforeRemovingPasses; + } + + /** + * Gets all passes for the Optimization pass. + * + * @return array An array of passes + * + * @api + */ + public function getOptimizationPasses() + { + return $this->optimizationPasses; + } + + /** + * Gets all passes for the Removing pass. + * + * @return array An array of passes + * + * @api + */ + public function getRemovingPasses() + { + return $this->removingPasses; + } + + /** + * Gets all passes for the Merge pass. + * + * @return array An array of passes + * + * @api + */ + public function getMergePass() + { + return $this->mergePass; + } + + /** + * Sets the Merge Pass. + * + * @param CompilerPassInterface $pass The merge pass + * + * @api + */ + public function setMergePass(CompilerPassInterface $pass) + { + $this->mergePass = $pass; + } + + /** + * Sets the AfterRemoving passes. + * + * @param array $passes An array of passes + * + * @api + */ + public function setAfterRemovingPasses(array $passes) + { + $this->afterRemovingPasses = $passes; + } + + /** + * Sets the BeforeOptimization passes. + * + * @param array $passes An array of passes + * + * @api + */ + public function setBeforeOptimizationPasses(array $passes) + { + $this->beforeOptimizationPasses = $passes; + } + + /** + * Sets the BeforeRemoving passes. + * + * @param array $passes An array of passes + * + * @api + */ + public function setBeforeRemovingPasses(array $passes) + { + $this->beforeRemovingPasses = $passes; + } + + /** + * Sets the Optimization passes. + * + * @param array $passes An array of passes + * + * @api + */ + public function setOptimizationPasses(array $passes) + { + $this->optimizationPasses = $passes; + } + + /** + * Sets the Removing passes. + * + * @param array $passes An array of passes + * + * @api + */ + public function setRemovingPasses(array $passes) + { + $this->removingPasses = $passes; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php new file mode 100644 index 0000000..d97d923 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php @@ -0,0 +1,39 @@ + + * + * 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 + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $compiler = $container->getCompiler(); + $formatter = $compiler->getLoggingFormatter(); + + foreach ($container->getDefinitions() as $id => $definition) { + if ($definition->isAbstract()) { + $container->removeDefinition($id); + $compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'abstract')); + } + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php new file mode 100644 index 0000000..4842337 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php @@ -0,0 +1,44 @@ + + * + * 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 + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $compiler = $container->getCompiler(); + $formatter = $compiler->getLoggingFormatter(); + + foreach ($container->getAliases() as $id => $alias) { + if ($alias->isPublic()) { + continue; + } + + $container->removeAlias($id); + $compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'private alias')); + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php new file mode 100644 index 0000000..9e18a9e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php @@ -0,0 +1,84 @@ + + * + * 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 unused service definitions from the container. + * + * @author Johannes M. Schmitt + */ +class RemoveUnusedDefinitionsPass implements RepeatablePassInterface +{ + private $repeatedPass; + + /** + * {@inheritdoc} + */ + public function setRepeatedPass(RepeatedPass $repeatedPass) + { + $this->repeatedPass = $repeatedPass; + } + + /** + * Processes the ContainerBuilder to remove unused definitions. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $compiler = $container->getCompiler(); + $formatter = $compiler->getLoggingFormatter(); + $graph = $compiler->getServiceReferenceGraph(); + + $hasChanged = false; + foreach ($container->getDefinitions() as $id => $definition) { + if ($definition->isPublic()) { + continue; + } + + if ($graph->hasNode($id)) { + $edges = $graph->getNode($id)->getInEdges(); + $referencingAliases = array(); + $sourceIds = array(); + foreach ($edges as $edge) { + $node = $edge->getSourceNode(); + $sourceIds[] = $node->getId(); + + if ($node->isAlias()) { + $referencingAliases[] = $node->getValue(); + } + } + $isReferenced = (count(array_unique($sourceIds)) - count($referencingAliases)) > 0; + } else { + $referencingAliases = array(); + $isReferenced = false; + } + + if (1 === count($referencingAliases) && false === $isReferenced) { + $container->setDefinition((string) reset($referencingAliases), $definition); + $definition->setPublic(true); + $container->removeDefinition($id); + $compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'replaces alias '.reset($referencingAliases))); + } elseif (0 === count($referencingAliases) && false === $isReferenced) { + $container->removeDefinition($id); + $compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'unused')); + $hasChanged = true; + } + } + + if ($hasChanged) { + $this->repeatedPass->setRepeat(); + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php new file mode 100644 index 0000000..d60ae35 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Compiler; + +/** + * Interface that must be implemented by passes that are run as part of an + * RepeatedPass. + * + * @author Johannes M. Schmitt + */ +interface RepeatablePassInterface extends CompilerPassInterface +{ + /** + * Sets the RepeatedPass interface. + * + * @param RepeatedPass $repeatedPass + */ + public function setRepeatedPass(RepeatedPass $repeatedPass); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php new file mode 100644 index 0000000..9b7db40 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php @@ -0,0 +1,88 @@ + + * + * 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; + +/** + * A pass that might be run repeatedly. + * + * @author Johannes M. Schmitt + */ +class RepeatedPass implements CompilerPassInterface +{ + /** + * @var bool + */ + private $repeat = false; + + /** + * @var RepeatablePassInterface[] + */ + private $passes; + + /** + * Constructor. + * + * @param RepeatablePassInterface[] $passes An array of RepeatablePassInterface objects + * + * @throws InvalidArgumentException when the passes don't implement RepeatablePassInterface + */ + public function __construct(array $passes) + { + foreach ($passes as $pass) { + if (!$pass instanceof RepeatablePassInterface) { + throw new InvalidArgumentException('$passes must be an array of RepeatablePassInterface.'); + } + + $pass->setRepeatedPass($this); + } + + $this->passes = $passes; + } + + /** + * Process the repeatable passes that run more than once. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $this->repeat = false; + foreach ($this->passes as $pass) { + $pass->process($container); + } + + if ($this->repeat) { + $this->process($container); + } + } + + /** + * Sets if the pass should repeat + */ + public function setRepeat() + { + $this->repeat = true; + } + + /** + * Returns the passes + * + * @return RepeatablePassInterface[] An array of RepeatablePassInterface objects + */ + public function getPasses() + { + return $this->passes; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php new file mode 100644 index 0000000..972d708 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -0,0 +1,125 @@ + + * + * 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\Reference; + +/** + * Replaces aliases with actual service definitions, effectively removing these + * aliases. + * + * @author Johannes M. Schmitt + */ +class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface +{ + private $compiler; + private $formatter; + private $sourceId; + + /** + * Process the Container to replace aliases with service definitions. + * + * @param ContainerBuilder $container + * + * @throws InvalidArgumentException if the service definition does not exist + */ + public function process(ContainerBuilder $container) + { + $this->compiler = $container->getCompiler(); + $this->formatter = $this->compiler->getLoggingFormatter(); + + foreach ($container->getAliases() as $id => $alias) { + $aliasId = (string) $alias; + + try { + $definition = $container->getDefinition($aliasId); + } catch (InvalidArgumentException $e) { + throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with "%s".', $alias, $id), null, $e); + } + + if ($definition->isPublic()) { + continue; + } + + $definition->setPublic(true); + $container->setDefinition($id, $definition); + $container->removeDefinition($aliasId); + + $this->updateReferences($container, $aliasId, $id); + + // we have to restart the process due to concurrent modification of + // the container + $this->process($container); + + break; + } + } + + /** + * Updates references to remove aliases. + * + * @param ContainerBuilder $container The container + * @param string $currentId The alias identifier being replaced + * @param string $newId The id of the service the alias points to + */ + private function updateReferences($container, $currentId, $newId) + { + foreach ($container->getAliases() as $id => $alias) { + if ($currentId === (string) $alias) { + $container->setAlias($id, $newId); + } + } + + foreach ($container->getDefinitions() as $id => $definition) { + $this->sourceId = $id; + + $definition->setArguments( + $this->updateArgumentReferences($definition->getArguments(), $currentId, $newId) + ); + + $definition->setMethodCalls( + $this->updateArgumentReferences($definition->getMethodCalls(), $currentId, $newId) + ); + + $definition->setProperties( + $this->updateArgumentReferences($definition->getProperties(), $currentId, $newId) + ); + } + } + + /** + * Updates argument references. + * + * @param array $arguments An array of Arguments + * @param string $currentId The alias identifier + * @param string $newId The identifier the alias points to + * + * @return array + */ + private function updateArgumentReferences(array $arguments, $currentId, $newId) + { + foreach ($arguments as $k => $argument) { + if (is_array($argument)) { + $arguments[$k] = $this->updateArgumentReferences($argument, $currentId, $newId); + } elseif ($argument instanceof Reference) { + if ($currentId === (string) $argument) { + $arguments[$k] = new Reference($newId, $argument->getInvalidBehavior()); + $this->compiler->addLogMessage($this->formatter->formatUpdateReference($this, $this->sourceId, $currentId, $newId)); + } + } + } + + return $arguments; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php new file mode 100644 index 0000000..4527840 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php @@ -0,0 +1,154 @@ + + * + * 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\DefinitionDecorator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; + +/** + * This replaces all DefinitionDecorator instances with their equivalent fully + * merged Definition instance. + * + * @author Johannes M. Schmitt + */ +class ResolveDefinitionTemplatesPass implements CompilerPassInterface +{ + private $container; + private $compiler; + private $formatter; + + /** + * Process the ContainerBuilder to replace DefinitionDecorator instances with their real Definition instances. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $this->container = $container; + $this->compiler = $container->getCompiler(); + $this->formatter = $this->compiler->getLoggingFormatter(); + + foreach (array_keys($container->getDefinitions()) as $id) { + // yes, we are specifically fetching the definition from the + // container to ensure we are not operating on stale data + $definition = $container->getDefinition($id); + if (!$definition instanceof DefinitionDecorator || $definition->isAbstract()) { + continue; + } + + $this->resolveDefinition($id, $definition); + } + } + + /** + * Resolves the definition + * + * @param string $id The definition identifier + * @param DefinitionDecorator $definition + * + * @return Definition + * + * @throws \RuntimeException When the definition is invalid + */ + private function resolveDefinition($id, DefinitionDecorator $definition) + { + if (!$this->container->hasDefinition($parent = $definition->getParent())) { + throw new RuntimeException(sprintf('The parent definition "%s" defined for definition "%s" does not exist.', $parent, $id)); + } + + $parentDef = $this->container->getDefinition($parent); + if ($parentDef instanceof DefinitionDecorator) { + $parentDef = $this->resolveDefinition($parent, $parentDef); + } + + $this->compiler->addLogMessage($this->formatter->formatResolveInheritance($this, $id, $parent)); + $def = new Definition(); + + // merge in parent definition + // purposely ignored attributes: scope, abstract, tags + $def->setClass($parentDef->getClass()); + $def->setArguments($parentDef->getArguments()); + $def->setMethodCalls($parentDef->getMethodCalls()); + $def->setProperties($parentDef->getProperties()); + $def->setFactoryClass($parentDef->getFactoryClass()); + $def->setFactoryMethod($parentDef->getFactoryMethod()); + $def->setFactoryService($parentDef->getFactoryService()); + $def->setConfigurator($parentDef->getConfigurator()); + $def->setFile($parentDef->getFile()); + $def->setPublic($parentDef->isPublic()); + $def->setLazy($parentDef->isLazy()); + + // overwrite with values specified in the decorator + $changes = $definition->getChanges(); + if (isset($changes['class'])) { + $def->setClass($definition->getClass()); + } + if (isset($changes['factory_class'])) { + $def->setFactoryClass($definition->getFactoryClass()); + } + if (isset($changes['factory_method'])) { + $def->setFactoryMethod($definition->getFactoryMethod()); + } + if (isset($changes['factory_service'])) { + $def->setFactoryService($definition->getFactoryService()); + } + if (isset($changes['configurator'])) { + $def->setConfigurator($definition->getConfigurator()); + } + if (isset($changes['file'])) { + $def->setFile($definition->getFile()); + } + if (isset($changes['public'])) { + $def->setPublic($definition->isPublic()); + } + if (isset($changes['lazy'])) { + $def->setLazy($definition->isLazy()); + } + + // merge arguments + foreach ($definition->getArguments() as $k => $v) { + if (is_numeric($k)) { + $def->addArgument($v); + continue; + } + + if (0 !== strpos($k, 'index_')) { + throw new RuntimeException(sprintf('Invalid argument key "%s" found.', $k)); + } + + $index = (int) substr($k, strlen('index_')); + $def->replaceArgument($index, $v); + } + + // merge properties + foreach ($definition->getProperties() as $k => $v) { + $def->setProperty($k, $v); + } + + // append method calls + if (count($calls = $definition->getMethodCalls()) > 0) { + $def->setMethodCalls(array_merge($def->getMethodCalls(), $calls)); + } + + // these attributes are always taken from the child + $def->setAbstract($definition->isAbstract()); + $def->setScope($definition->getScope()); + $def->setTags($definition->getTags()); + + // set new definition on container + $this->container->setDefinition($id, $def); + + return $def; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php new file mode 100644 index 0000000..000bf08 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php @@ -0,0 +1,105 @@ + + * + * 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\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; + +/** + * Emulates the invalid behavior if the reference is not found within the + * container. + * + * @author Johannes M. Schmitt + */ +class ResolveInvalidReferencesPass implements CompilerPassInterface +{ + private $container; + + /** + * Process the ContainerBuilder to resolve invalid references. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $this->container = $container; + foreach ($container->getDefinitions() as $definition) { + if ($definition->isSynthetic() || $definition->isAbstract()) { + continue; + } + + $definition->setArguments( + $this->processArguments($definition->getArguments()) + ); + + $calls = array(); + foreach ($definition->getMethodCalls() as $call) { + try { + $calls[] = array($call[0], $this->processArguments($call[1], true)); + } catch (RuntimeException $ignore) { + // this call is simply removed + } + } + $definition->setMethodCalls($calls); + + $properties = array(); + foreach ($definition->getProperties() as $name => $value) { + try { + $value = $this->processArguments(array($value), true); + $properties[$name] = reset($value); + } catch (RuntimeException $ignore) { + // ignore property + } + } + $definition->setProperties($properties); + } + } + + /** + * Processes arguments to determine invalid references. + * + * @param array $arguments An array of Reference objects + * @param bool $inMethodCall + * + * @return array + * + * @throws RuntimeException When the config is invalid + */ + private function processArguments(array $arguments, $inMethodCall = false) + { + foreach ($arguments as $k => $argument) { + if (is_array($argument)) { + $arguments[$k] = $this->processArguments($argument, $inMethodCall); + } elseif ($argument instanceof Reference) { + $id = (string) $argument; + + $invalidBehavior = $argument->getInvalidBehavior(); + $exists = $this->container->has($id); + + // resolve invalid behavior + if (!$exists && ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) { + $arguments[$k] = null; + } elseif (!$exists && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) { + if ($inMethodCall) { + throw new RuntimeException('Method shouldn\'t be called.'); + } + + $arguments[$k] = null; + } + } + } + + return $arguments; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php new file mode 100644 index 0000000..6fc0a87 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php @@ -0,0 +1,63 @@ + + * + * 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\ParameterNotFoundException; + +/** + * Resolves all parameter placeholders "%somevalue%" to their real values. + * + * @author Johannes M. Schmitt + */ +class ResolveParameterPlaceHoldersPass implements CompilerPassInterface +{ + /** + * Processes the ContainerBuilder to resolve parameter placeholders. + * + * @param ContainerBuilder $container + * + * @throws ParameterNotFoundException + */ + public function process(ContainerBuilder $container) + { + $parameterBag = $container->getParameterBag(); + + foreach ($container->getDefinitions() as $id => $definition) { + try { + $definition->setClass($parameterBag->resolveValue($definition->getClass())); + $definition->setFile($parameterBag->resolveValue($definition->getFile())); + $definition->setArguments($parameterBag->resolveValue($definition->getArguments())); + + $calls = array(); + foreach ($definition->getMethodCalls() as $name => $arguments) { + $calls[$parameterBag->resolveValue($name)] = $parameterBag->resolveValue($arguments); + } + $definition->setMethodCalls($calls); + + $definition->setProperties($parameterBag->resolveValue($definition->getProperties())); + } catch (ParameterNotFoundException $e) { + $e->setSourceId($id); + + throw $e; + } + } + + $aliases = array(); + foreach ($container->getAliases() as $name => $target) { + $aliases[$parameterBag->resolveValue($name)] = $parameterBag->resolveValue($target); + } + $container->setAliases($aliases); + + $parameterBag->resolve(); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php new file mode 100644 index 0000000..c90d76f --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php @@ -0,0 +1,99 @@ + + * + * 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\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Replaces all references to aliases with references to the actual service. + * + * @author Johannes M. Schmitt + */ +class ResolveReferencesToAliasesPass implements CompilerPassInterface +{ + private $container; + + /** + * Processes the ContainerBuilder to replace references to aliases with actual service references. + * + * @param ContainerBuilder $container + */ + public function process(ContainerBuilder $container) + { + $this->container = $container; + + foreach ($container->getDefinitions() as $definition) { + if ($definition->isSynthetic() || $definition->isAbstract()) { + continue; + } + + $definition->setArguments($this->processArguments($definition->getArguments())); + $definition->setMethodCalls($this->processArguments($definition->getMethodCalls())); + $definition->setProperties($this->processArguments($definition->getProperties())); + } + + foreach ($container->getAliases() as $id => $alias) { + $aliasId = (string) $alias; + if ($aliasId !== $defId = $this->getDefinitionId($aliasId)) { + $container->setAlias($id, new Alias($defId, $alias->isPublic())); + } + } + } + + /** + * Processes the arguments to replace aliases. + * + * @param array $arguments An array of References + * + * @return array An array of References + */ + private function processArguments(array $arguments) + { + foreach ($arguments as $k => $argument) { + if (is_array($argument)) { + $arguments[$k] = $this->processArguments($argument); + } elseif ($argument instanceof Reference) { + $defId = $this->getDefinitionId($id = (string) $argument); + + if ($defId !== $id) { + $arguments[$k] = new Reference($defId, $argument->getInvalidBehavior(), $argument->isStrict()); + } + } + } + + return $arguments; + } + + /** + * Resolves an alias into a definition id. + * + * @param string $id The definition or alias id to resolve + * + * @return string The definition id with aliases resolved + */ + private function getDefinitionId($id) + { + $seen = array(); + while ($this->container->hasAlias($id)) { + if (isset($seen[$id])) { + throw new ServiceCircularReferenceException($id, array_keys($seen)); + } + $seen[$id] = true; + $id = (string) $this->container->getAlias($id); + } + + return $id; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php new file mode 100644 index 0000000..dc9a1a0 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php @@ -0,0 +1,114 @@ + + * + * 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; + +/** + * 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 + */ +class ServiceReferenceGraph +{ + /** + * @var ServiceReferenceGraphNode[] + */ + private $nodes = array(); + + /** + * Checks if the graph has a specific node. + * + * @param string $id Id to check + * + * @return bool + */ + public function hasNode($id) + { + return isset($this->nodes[$id]); + } + + /** + * Gets a node by identifier. + * + * @param string $id The id to retrieve + * + * @return ServiceReferenceGraphNode The node matching the supplied identifier + * + * @throws InvalidArgumentException if no node matches the supplied identifier + */ + public function getNode($id) + { + 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[] An array of all ServiceReferenceGraphNode objects + */ + public function getNodes() + { + return $this->nodes; + } + + /** + * Clears all nodes. + */ + public function clear() + { + $this->nodes = array(); + } + + /** + * Connects 2 nodes together in the Graph. + * + * @param string $sourceId + * @param string $sourceValue + * @param string $destId + * @param string $destValue + * @param string $reference + */ + public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null) + { + $sourceNode = $this->createNode($sourceId, $sourceValue); + $destNode = $this->createNode($destId, $destValue); + $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference); + + $sourceNode->addOutEdge($edge); + $destNode->addInEdge($edge); + } + + /** + * Creates a graph node. + * + * @param string $id + * @param string $value + * + * @return ServiceReferenceGraphNode + */ + private function createNode($id, $value) + { + 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php new file mode 100644 index 0000000..19da234 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php @@ -0,0 +1,70 @@ + + * + * 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 $sourceNode; + private $destNode; + private $value; + + /** + * Constructor. + * + * @param ServiceReferenceGraphNode $sourceNode + * @param ServiceReferenceGraphNode $destNode + * @param string $value + */ + public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null) + { + $this->sourceNode = $sourceNode; + $this->destNode = $destNode; + $this->value = $value; + } + + /** + * Returns the value of the edge + * + * @return ServiceReferenceGraphNode + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns the source node + * + * @return ServiceReferenceGraphNode + */ + public function getSourceNode() + { + return $this->sourceNode; + } + + /** + * Returns the destination node + * + * @return ServiceReferenceGraphNode + */ + public function getDestNode() + { + return $this->destNode; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php new file mode 100644 index 0000000..5664413 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php @@ -0,0 +1,122 @@ + + * + * 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\Alias; + +/** + * Represents a node in your service graph. + * + * Value is typically a definition, or an alias. + * + * @author Johannes M. Schmitt + */ +class ServiceReferenceGraphNode +{ + private $id; + private $inEdges = array(); + private $outEdges = array(); + private $value; + + /** + * Constructor. + * + * @param string $id The node identifier + * @param mixed $value The node value + */ + public function __construct($id, $value) + { + $this->id = $id; + $this->value = $value; + } + + /** + * Adds an in edge to this node. + * + * @param ServiceReferenceGraphEdge $edge + */ + public function addInEdge(ServiceReferenceGraphEdge $edge) + { + $this->inEdges[] = $edge; + } + + /** + * Adds an out edge to this node. + * + * @param ServiceReferenceGraphEdge $edge + */ + public function addOutEdge(ServiceReferenceGraphEdge $edge) + { + $this->outEdges[] = $edge; + } + + /** + * Checks if the value of this node is an Alias. + * + * @return bool True if the value is an Alias instance + */ + public function isAlias() + { + return $this->value instanceof Alias; + } + + /** + * Checks if the value of this node is a Definition. + * + * @return bool True if the value is a Definition instance + */ + public function isDefinition() + { + return $this->value instanceof Definition; + } + + /** + * Returns the identifier. + * + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Returns the in edges. + * + * @return array The in ServiceReferenceGraphEdge array + */ + public function getInEdges() + { + return $this->inEdges; + } + + /** + * Returns the out edges. + * + * @return array The out ServiceReferenceGraphEdge array + */ + public function getOutEdges() + { + return $this->outEdges; + } + + /** + * Returns the value of this Node + * + * @return mixed The value + */ + public function getValue() + { + return $this->value; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php new file mode 100644 index 0000000..094c965 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php @@ -0,0 +1,567 @@ + + * + * 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\InactiveScopeException; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; + +/** + * Container is a dependency injection container. + * + * It gives access to object instances (services). + * + * Services and parameters are simple key/pair stores. + * + * Parameter and service keys are case insensitive. + * + * A service id can contain lowercased letters, digits, underscores, and dots. + * Underscores are used to separate words, and dots to group services + * under namespaces: + * + *

      + *
    • request
    • + *
    • mysql_session_storage
    • + *
    • symfony.mysql_session_storage
    • + *
    + * + * A service can also be defined by creating a method named + * getXXXService(), where XXX is the camelized version of the id: + * + *
      + *
    • request -> getRequestService()
    • + *
    • mysql_session_storage -> getMysqlSessionStorageService()
    • + *
    • symfony.mysql_session_storage -> getSymfony_MysqlSessionStorageService()
    • + *
    + * + * The container can have three possible behaviors when a service does not exist: + * + * * EXCEPTION_ON_INVALID_REFERENCE: Throws an exception (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) + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * + * @api + */ +class Container implements IntrospectableContainerInterface +{ + /** + * @var ParameterBagInterface + */ + protected $parameterBag; + + protected $services = array(); + protected $methodMap = array(); + protected $aliases = array(); + protected $scopes = array(); + protected $scopeChildren = array(); + protected $scopedServices = array(); + protected $scopeStacks = array(); + protected $loading = array(); + + /** + * Constructor. + * + * @param ParameterBagInterface $parameterBag A ParameterBagInterface instance + * + * @api + */ + public function __construct(ParameterBagInterface $parameterBag = null) + { + $this->parameterBag = $parameterBag ?: new ParameterBag(); + + $this->set('service_container', $this); + } + + /** + * Compiles the container. + * + * This method does two things: + * + * * Parameter values are resolved; + * * The parameter bag is frozen. + * + * @api + */ + public function compile() + { + $this->parameterBag->resolve(); + + $this->parameterBag = new FrozenParameterBag($this->parameterBag->all()); + } + + /** + * Returns true if the container parameter bag are frozen. + * + * @return bool true if the container parameter bag are frozen, false otherwise + * + * @api + */ + public function isFrozen() + { + return $this->parameterBag instanceof FrozenParameterBag; + } + + /** + * Gets the service container parameter bag. + * + * @return ParameterBagInterface A ParameterBagInterface instance + * + * @api + */ + public function getParameterBag() + { + return $this->parameterBag; + } + + /** + * Gets a parameter. + * + * @param string $name The parameter name + * + * @return mixed The parameter value + * + * @throws InvalidArgumentException if the parameter is not defined + * + * @api + */ + public function getParameter($name) + { + return $this->parameterBag->get($name); + } + + /** + * Checks if a parameter exists. + * + * @param string $name The parameter name + * + * @return bool The presence of parameter in container + * + * @api + */ + public function hasParameter($name) + { + return $this->parameterBag->has($name); + } + + /** + * Sets a parameter. + * + * @param string $name The parameter name + * @param mixed $value The parameter value + * + * @api + */ + public function setParameter($name, $value) + { + $this->parameterBag->set($name, $value); + } + + /** + * Sets a service. + * + * Setting a service to null resets the service: has() returns false and get() + * behaves in the same way as if the service was never created. + * + * @param string $id The service identifier + * @param object $service The service instance + * @param string $scope The scope of the service + * + * @throws RuntimeException When trying to set a service in an inactive scope + * @throws InvalidArgumentException When trying to set a service in the prototype scope + * + * @api + */ + public function set($id, $service, $scope = self::SCOPE_CONTAINER) + { + if (self::SCOPE_PROTOTYPE === $scope) { + throw new InvalidArgumentException(sprintf('You cannot set service "%s" of scope "prototype".', $id)); + } + + $id = strtolower($id); + + if ('service_container' === $id) { + // BC: 'service_container' is no longer a self-reference but always + // $this, so ignore this call. + // @todo Throw InvalidArgumentException in next major release. + return; + } + if (self::SCOPE_CONTAINER !== $scope) { + if (!isset($this->scopedServices[$scope])) { + throw new RuntimeException(sprintf('You cannot set service "%s" of inactive scope.', $id)); + } + + $this->scopedServices[$scope][$id] = $service; + } + + $this->services[$id] = $service; + + if (method_exists($this, $method = 'synchronize'.strtr($id, array('_' => '', '.' => '_', '\\' => '_')).'Service')) { + $this->$method(); + } + + if (self::SCOPE_CONTAINER !== $scope && null === $service) { + unset($this->scopedServices[$scope][$id]); + } + + if (null === $service) { + unset($this->services[$id]); + } + } + + /** + * Returns true if the given service is defined. + * + * @param string $id The service identifier + * + * @return bool true if the service is defined, false otherwise + * + * @api + */ + public function has($id) + { + $id = strtolower($id); + + if ('service_container' === $id) { + return true; + } + + return isset($this->services[$id]) + || array_key_exists($id, $this->services) + || isset($this->aliases[$id]) + || method_exists($this, 'get'.strtr($id, array('_' => '', '.' => '_', '\\' => '_')).'Service') + ; + } + + /** + * Gets a service. + * + * If a service is defined both through a set() method and + * with a get{$id}Service() method, the former has always precedence. + * + * @param string $id The service identifier + * @param int $invalidBehavior The behavior when the service does not exist + * + * @return object The associated service + * + * @throws InvalidArgumentException if the service is not defined + * @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 + * + * @api + */ + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) + { + // Attempt to retrieve the service by checking first aliases then + // available services. Service IDs are case insensitive, however since + // this method can be called thousands of times during a request, avoid + // calling strtolower() unless necessary. + foreach (array(false, true) as $strtolower) { + if ($strtolower) { + $id = strtolower($id); + } + if ('service_container' === $id) { + return $this; + } + if (isset($this->aliases[$id])) { + $id = $this->aliases[$id]; + } + // Re-use shared service instance if it exists. + if (isset($this->services[$id]) || array_key_exists($id, $this->services)) { + return $this->services[$id]; + } + } + + if (isset($this->loading[$id])) { + throw new ServiceCircularReferenceException($id, array_keys($this->loading)); + } + + if (isset($this->methodMap[$id])) { + $method = $this->methodMap[$id]; + } elseif (method_exists($this, $method = 'get'.strtr($id, array('_' => '', '.' => '_', '\\' => '_')).'Service')) { + // $method is set to the right value, proceed + } else { + if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { + if (!$id) { + throw new ServiceNotFoundException($id); + } + + $alternatives = array(); + foreach (array_keys($this->services) as $key) { + $lev = levenshtein($id, $key); + if ($lev <= strlen($id) / 3 || false !== strpos($key, $id)) { + $alternatives[] = $key; + } + } + + throw new ServiceNotFoundException($id, null, null, $alternatives); + } + + return; + } + + $this->loading[$id] = true; + + try { + $service = $this->$method(); + } catch (\Exception $e) { + unset($this->loading[$id]); + + if (array_key_exists($id, $this->services)) { + unset($this->services[$id]); + } + + if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { + return; + } + + throw $e; + } + + unset($this->loading[$id]); + + return $service; + } + + /** + * Returns true if the given service has actually been initialized + * + * @param string $id The service identifier + * + * @return bool true if service has already been initialized, false otherwise + */ + public function initialized($id) + { + $id = strtolower($id); + + if ('service_container' === $id) { + // BC: 'service_container' was a synthetic service previously. + // @todo Change to false in next major release. + return true; + } + + if (isset($this->aliases[$id])) { + $id = $this->aliases[$id]; + } + + return isset($this->services[$id]) || array_key_exists($id, $this->services); + } + + /** + * Gets all service ids. + * + * @return array An array of all defined service ids + */ + public function getServiceIds() + { + $ids = array(); + $r = new \ReflectionClass($this); + foreach ($r->getMethods() as $method) { + if (preg_match('/^get(.+)Service$/', $method->name, $match)) { + $ids[] = self::underscore($match[1]); + } + } + $ids[] = 'service_container'; + + return array_unique(array_merge($ids, array_keys($this->services))); + } + + /** + * This is called when you enter a scope + * + * @param string $name + * + * @throws RuntimeException When the parent scope is inactive + * @throws InvalidArgumentException When the scope does not exist + * + * @api + */ + public function enterScope($name) + { + if (!isset($this->scopes[$name])) { + throw new InvalidArgumentException(sprintf('The scope "%s" does not exist.', $name)); + } + + if (self::SCOPE_CONTAINER !== $this->scopes[$name] && !isset($this->scopedServices[$this->scopes[$name]])) { + throw new RuntimeException(sprintf('The parent scope "%s" must be active when entering this scope.', $this->scopes[$name])); + } + + // check if a scope of this name is already active, if so we need to + // remove all services of this scope, and those of any of its child + // scopes from the global services map + if (isset($this->scopedServices[$name])) { + $services = array($this->services, $name => $this->scopedServices[$name]); + unset($this->scopedServices[$name]); + + foreach ($this->scopeChildren[$name] as $child) { + if (isset($this->scopedServices[$child])) { + $services[$child] = $this->scopedServices[$child]; + unset($this->scopedServices[$child]); + } + } + + // update global map + $this->services = call_user_func_array('array_diff_key', $services); + array_shift($services); + + // add stack entry for this scope so we can restore the removed services later + if (!isset($this->scopeStacks[$name])) { + $this->scopeStacks[$name] = new \SplStack(); + } + $this->scopeStacks[$name]->push($services); + } + + $this->scopedServices[$name] = array(); + } + + /** + * This is called to leave the current scope, and move back to the parent + * scope. + * + * @param string $name The name of the scope to leave + * + * @throws InvalidArgumentException if the scope is not active + * + * @api + */ + public function leaveScope($name) + { + if (!isset($this->scopedServices[$name])) { + throw new InvalidArgumentException(sprintf('The scope "%s" is not active.', $name)); + } + + // remove all services of this scope, or any of its child scopes from + // the global service map + $services = array($this->services, $this->scopedServices[$name]); + unset($this->scopedServices[$name]); + foreach ($this->scopeChildren[$name] as $child) { + if (!isset($this->scopedServices[$child])) { + continue; + } + + $services[] = $this->scopedServices[$child]; + unset($this->scopedServices[$child]); + } + $this->services = call_user_func_array('array_diff_key', $services); + + // check if we need to restore services of a previous scope of this type + if (isset($this->scopeStacks[$name]) && count($this->scopeStacks[$name]) > 0) { + $services = $this->scopeStacks[$name]->pop(); + $this->scopedServices += $services; + + foreach ($services as $array) { + foreach ($array as $id => $service) { + $this->set($id, $service, $name); + } + } + } + } + + /** + * Adds a scope to the container. + * + * @param ScopeInterface $scope + * + * @throws InvalidArgumentException + * + * @api + */ + public function addScope(ScopeInterface $scope) + { + $name = $scope->getName(); + $parentScope = $scope->getParentName(); + + if (self::SCOPE_CONTAINER === $name || self::SCOPE_PROTOTYPE === $name) { + throw new InvalidArgumentException(sprintf('The scope "%s" is reserved.', $name)); + } + if (isset($this->scopes[$name])) { + throw new InvalidArgumentException(sprintf('A scope with name "%s" already exists.', $name)); + } + if (self::SCOPE_CONTAINER !== $parentScope && !isset($this->scopes[$parentScope])) { + throw new InvalidArgumentException(sprintf('The parent scope "%s" does not exist, or is invalid.', $parentScope)); + } + + $this->scopes[$name] = $parentScope; + $this->scopeChildren[$name] = array(); + + // normalize the child relations + while ($parentScope !== self::SCOPE_CONTAINER) { + $this->scopeChildren[$parentScope][] = $name; + $parentScope = $this->scopes[$parentScope]; + } + } + + /** + * Returns whether this container has a certain scope + * + * @param string $name The name of the scope + * + * @return bool + * + * @api + */ + public function hasScope($name) + { + return isset($this->scopes[$name]); + } + + /** + * Returns whether this scope is currently active + * + * This does not actually check if the passed scope actually exists. + * + * @param string $name + * + * @return bool + * + * @api + */ + public function isScopeActive($name) + { + return isset($this->scopedServices[$name]); + } + + /** + * Camelizes a string. + * + * @param string $id A string to camelize + * + * @return string The camelized string + */ + public static function camelize($id) + { + return strtr(ucwords(strtr($id, array('_' => ' ', '.' => '_ ', '\\' => '_ '))), array(' ' => '')); + } + + /** + * A string to underscore. + * + * @param string $id The string to underscore + * + * @return string The underscored string + */ + public static function underscore($id) + { + return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.'))); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAware.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAware.php new file mode 100644 index 0000000..4096915 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAware.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection; + +/** + * A simple implementation of ContainerAwareInterface. + * + * @author Fabien Potencier + * + * @api + */ +abstract class ContainerAware implements ContainerAwareInterface +{ + /** + * @var ContainerInterface + * + * @api + */ + protected $container; + + /** + * Sets the Container associated with this Controller. + * + * @param ContainerInterface $container A ContainerInterface instance + * + * @api + */ + public function setContainer(ContainerInterface $container = null) + { + $this->container = $container; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php new file mode 100644 index 0000000..e85bb53 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php @@ -0,0 +1,31 @@ + + * + * 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 + * + * @api + */ +interface ContainerAwareInterface +{ + /** + * Sets the Container. + * + * @param ContainerInterface|null $container A ContainerInterface instance or null + * + * @api + */ + public function setContainer(ContainerInterface $container = null); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareTrait.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareTrait.php new file mode 100644 index 0000000..57280aa --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareTrait.php @@ -0,0 +1,35 @@ + + * + * 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 + */ + protected $container; + + /** + * Sets the Container associated with this Controller. + * + * @param ContainerInterface $container A ContainerInterface instance + */ + public function setContainer(ContainerInterface $container = null) + { + $this->container = $container; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php new file mode 100644 index 0000000..23cb364 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -0,0 +1,1169 @@ + + * + * 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\Compiler\Compiler; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; +use Symfony\Component\DependencyInjection\Exception\BadMethodCallException; +use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; +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\Config\Resource\FileResource; +use Symfony\Component\Config\Resource\ResourceInterface; +use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface; +use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator; +use Symfony\Component\ExpressionLanguage\Expression; + +/** + * ContainerBuilder is a DI container that provides an API to easily describe services. + * + * @author Fabien Potencier + * + * @api + */ +class ContainerBuilder extends Container implements TaggedContainerInterface +{ + /** + * @var ExtensionInterface[] + */ + private $extensions = array(); + + /** + * @var ExtensionInterface[] + */ + private $extensionsByNs = array(); + + /** + * @var Definition[] + */ + private $definitions = array(); + + /** + * @var Definition[] + */ + private $obsoleteDefinitions = array(); + + /** + * @var Alias[] + */ + private $aliasDefinitions = array(); + + /** + * @var ResourceInterface[] + */ + private $resources = array(); + + private $extensionConfigs = array(); + + /** + * @var Compiler + */ + private $compiler; + + private $trackResources = true; + + /** + * @var InstantiatorInterface|null + */ + private $proxyInstantiator; + + /** + * @var ExpressionLanguage|null + */ + private $expressionLanguage; + + /** + * 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. + * + * @param bool $track true if you want to track resources, false otherwise + */ + public function setResourceTracking($track) + { + $this->trackResources = (bool) $track; + } + + /** + * Checks if resources are tracked. + * + * @return bool true if resources are tracked, false otherwise + */ + public function isTrackingResources() + { + return $this->trackResources; + } + + /** + * Sets the instantiator to be used when fetching proxies. + * + * @param InstantiatorInterface $proxyInstantiator + */ + public function setProxyInstantiator(InstantiatorInterface $proxyInstantiator) + { + $this->proxyInstantiator = $proxyInstantiator; + } + + /** + * Registers an extension. + * + * @param ExtensionInterface $extension An extension instance + * + * @api + */ + 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. + * + * @param string $name An alias or a namespace + * + * @return ExtensionInterface An extension instance + * + * @throws LogicException if the extension is not registered + * + * @api + */ + public function getExtension($name) + { + 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 ExtensionInterface[] An array of ExtensionInterface + * + * @api + */ + public function getExtensions() + { + return $this->extensions; + } + + /** + * Checks if we have an extension. + * + * @param string $name The name of the extension + * + * @return bool If the extension exists + * + * @api + */ + public function hasExtension($name) + { + return isset($this->extensions[$name]) || isset($this->extensionsByNs[$name]); + } + + /** + * Returns an array of resources loaded to build this configuration. + * + * @return ResourceInterface[] An array of resources + * + * @api + */ + public function getResources() + { + return array_unique($this->resources); + } + + /** + * Adds a resource for this configuration. + * + * @param ResourceInterface $resource A resource instance + * + * @return ContainerBuilder The current instance + * + * @api + */ + public function addResource(ResourceInterface $resource) + { + if (!$this->trackResources) { + return $this; + } + + $this->resources[] = $resource; + + return $this; + } + + /** + * Sets the resources for this configuration. + * + * @param ResourceInterface[] $resources An array of resources + * + * @return ContainerBuilder The current instance + * + * @api + */ + public function setResources(array $resources) + { + if (!$this->trackResources) { + return $this; + } + + $this->resources = $resources; + + return $this; + } + + /** + * Adds the object class hierarchy as resources. + * + * @param object $object An object instance + * + * @return ContainerBuilder The current instance + * + * @api + */ + public function addObjectResource($object) + { + if ($this->trackResources) { + $this->addClassResource(new \ReflectionClass($object)); + } + + return $this; + } + + /** + * Adds the given class hierarchy as resources. + * + * @param \ReflectionClass $class + * + * @return ContainerBuilder The current instance + */ + public function addClassResource(\ReflectionClass $class) + { + if (!$this->trackResources) { + return $this; + } + + do { + $this->addResource(new FileResource($class->getFileName())); + } while ($class = $class->getParentClass()); + + return $this; + } + + /** + * Loads the configuration for an extension. + * + * @param string $extension The extension alias or namespace + * @param array $values An array of values that customizes the extension + * + * @return ContainerBuilder The current instance + * @throws BadMethodCallException When this ContainerBuilder is frozen + * + * @throws \LogicException if the container is frozen + * + * @api + */ + public function loadFromExtension($extension, array $values = array()) + { + if ($this->isFrozen()) { + throw new BadMethodCallException('Cannot load from an extension on a frozen container.'); + } + + $namespace = $this->getExtension($extension)->getAlias(); + + $this->extensionConfigs[$namespace][] = $values; + + return $this; + } + + /** + * Adds a compiler pass. + * + * @param CompilerPassInterface $pass A compiler pass + * @param string $type The type of compiler pass + * + * @return ContainerBuilder The current instance + * + * @api + */ + public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION) + { + $this->getCompiler()->addPass($pass, $type); + + $this->addObjectResource($pass); + + return $this; + } + + /** + * Returns the compiler pass config which can then be modified. + * + * @return PassConfig The compiler pass config + * + * @api + */ + public function getCompilerPassConfig() + { + return $this->getCompiler()->getPassConfig(); + } + + /** + * Returns the compiler. + * + * @return Compiler The compiler + * + * @api + */ + public function getCompiler() + { + if (null === $this->compiler) { + $this->compiler = new Compiler(); + } + + return $this->compiler; + } + + /** + * Returns all Scopes. + * + * @return array An array of scopes + * + * @api + */ + public function getScopes() + { + return $this->scopes; + } + + /** + * Returns all Scope children. + * + * @return array An array of scope children. + * + * @api + */ + public function getScopeChildren() + { + return $this->scopeChildren; + } + + /** + * Sets a service. + * + * @param string $id The service identifier + * @param object $service The service instance + * @param string $scope The scope + * + * @throws BadMethodCallException When this ContainerBuilder is frozen + * + * @api + */ + public function set($id, $service, $scope = self::SCOPE_CONTAINER) + { + $id = strtolower($id); + + if ($this->isFrozen()) { + // setting a synthetic service on a frozen container is alright + if ( + (!isset($this->definitions[$id]) && !isset($this->obsoleteDefinitions[$id])) + || + (isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic()) + || + (isset($this->obsoleteDefinitions[$id]) && !$this->obsoleteDefinitions[$id]->isSynthetic()) + ) { + throw new BadMethodCallException(sprintf('Setting service "%s" on a frozen container is not allowed.', $id)); + } + } + + if (isset($this->definitions[$id])) { + $this->obsoleteDefinitions[$id] = $this->definitions[$id]; + } + + unset($this->definitions[$id], $this->aliasDefinitions[$id]); + + parent::set($id, $service, $scope); + + if (isset($this->obsoleteDefinitions[$id]) && $this->obsoleteDefinitions[$id]->isSynchronized()) { + $this->synchronize($id); + } + } + + /** + * Removes a service definition. + * + * @param string $id The service identifier + * + * @api + */ + public function removeDefinition($id) + { + unset($this->definitions[strtolower($id)]); + } + + /** + * Returns true if the given service is defined. + * + * @param string $id The service identifier + * + * @return bool true if the service is defined, false otherwise + * + * @api + */ + public function has($id) + { + $id = strtolower($id); + + return isset($this->definitions[$id]) || isset($this->aliasDefinitions[$id]) || parent::has($id); + } + + /** + * Gets a service. + * + * @param string $id The service identifier + * @param int $invalidBehavior The behavior when the service does not exist + * + * @return object The associated service + * + * @throws InvalidArgumentException when no definitions are available + * @throws InactiveScopeException when the current scope is not active + * @throws LogicException when a circular dependency is detected + * @throws \Exception + * + * @see Reference + * + * @api + */ + public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE) + { + $id = strtolower($id); + + if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) { + return $service; + } + + if (isset($this->loading[$id])) { + throw new LogicException(sprintf('The service "%s" has a circular reference to itself.', $id), 0, $e); + } + + if (!$this->hasDefinition($id) && isset($this->aliasDefinitions[$id])) { + return $this->get($this->aliasDefinitions[$id]); + } + + try { + $definition = $this->getDefinition($id); + } catch (InvalidArgumentException $e) { + if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { + return; + } + + throw $e; + } + + $this->loading[$id] = true; + + try { + $service = $this->createService($definition, $id); + } catch (\Exception $e) { + unset($this->loading[$id]); + + if ($e instanceof InactiveScopeException && self::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { + return; + } + + throw $e; + } + + unset($this->loading[$id]); + + return $service; + } + + /** + * 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(array('foo' => 'bar')); + * $loader = new LoaderXXX($container); + * $loader->load('resource_name'); + * $container->register('foo', new 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. + * + * @param ContainerBuilder $container The ContainerBuilder instance to merge. + * + * + * @throws BadMethodCallException When this ContainerBuilder is frozen + * + * @api + */ + public function merge(ContainerBuilder $container) + { + if ($this->isFrozen()) { + throw new BadMethodCallException('Cannot merge on a frozen container.'); + } + + $this->addDefinitions($container->getDefinitions()); + $this->addAliases($container->getAliases()); + $this->getParameterBag()->add($container->getParameterBag()->all()); + + 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] = array(); + } + + $this->extensionConfigs[$name] = array_merge($this->extensionConfigs[$name], $container->getExtensionConfig($name)); + } + } + + /** + * Returns the configuration array for the given extension. + * + * @param string $name The name of the extension + * + * @return array An array of configuration + * + * @api + */ + public function getExtensionConfig($name) + { + if (!isset($this->extensionConfigs[$name])) { + $this->extensionConfigs[$name] = array(); + } + + return $this->extensionConfigs[$name]; + } + + /** + * Prepends a config array to the configs of the given extension. + * + * @param string $name The name of the extension + * @param array $config The config to set + */ + public function prependExtensionConfig($name, array $config) + { + if (!isset($this->extensionConfigs[$name])) { + $this->extensionConfigs[$name] = array(); + } + + array_unshift($this->extensionConfigs[$name], $config); + } + + /** + * 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. + * + * @api + */ + public function compile() + { + $compiler = $this->getCompiler(); + + if ($this->trackResources) { + foreach ($compiler->getPassConfig()->getPasses() as $pass) { + $this->addObjectResource($pass); + } + } + + $compiler->compile($this); + + if ($this->trackResources) { + foreach ($this->definitions as $definition) { + if ($definition->isLazy() && ($class = $definition->getClass()) && class_exists($class)) { + $this->addClassResource(new \ReflectionClass($class)); + } + } + } + + $this->extensionConfigs = array(); + + parent::compile(); + } + + /** + * Gets all service ids. + * + * @return array An array of all defined service ids + */ + public function getServiceIds() + { + return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliasDefinitions), parent::getServiceIds())); + } + + /** + * Adds the service aliases. + * + * @param array $aliases An array of aliases + * + * @api + */ + public function addAliases(array $aliases) + { + foreach ($aliases as $alias => $id) { + $this->setAlias($alias, $id); + } + } + + /** + * Sets the service aliases. + * + * @param array $aliases An array of aliases + * + * @api + */ + public function setAliases(array $aliases) + { + $this->aliasDefinitions = array(); + $this->addAliases($aliases); + } + + /** + * Sets an alias for an existing service. + * + * @param string $alias The alias to create + * @param string|Alias $id The service to alias + * + * @throws InvalidArgumentException if the id is not a string or an Alias + * @throws InvalidArgumentException if the alias is for itself + * + * @api + */ + public function setAlias($alias, $id) + { + $alias = strtolower($alias); + + if (is_string($id)) { + $id = new Alias($id); + } elseif (!$id instanceof Alias) { + throw new InvalidArgumentException('$id must be a string, or an Alias object.'); + } + + if ($alias === strtolower($id)) { + throw new InvalidArgumentException(sprintf('An alias can not reference itself, got a circular reference on "%s".', $alias)); + } + + unset($this->definitions[$alias]); + + $this->aliasDefinitions[$alias] = $id; + } + + /** + * Removes an alias. + * + * @param string $alias The alias to remove + * + * @api + */ + public function removeAlias($alias) + { + unset($this->aliasDefinitions[strtolower($alias)]); + } + + /** + * Returns true if an alias exists under the given identifier. + * + * @param string $id The service identifier + * + * @return bool true if the alias exists, false otherwise + * + * @api + */ + public function hasAlias($id) + { + return isset($this->aliasDefinitions[strtolower($id)]); + } + + /** + * Gets all defined aliases. + * + * @return Alias[] An array of aliases + * + * @api + */ + public function getAliases() + { + return $this->aliasDefinitions; + } + + /** + * Gets an alias. + * + * @param string $id The service identifier + * + * @return Alias An Alias instance + * + * @throws InvalidArgumentException if the alias does not exist + * + * @api + */ + public function getAlias($id) + { + $id = strtolower($id); + + if (!$this->hasAlias($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. + * + * @param string $id The service identifier + * @param string $class The service class + * + * @return Definition A Definition instance + * + * @api + */ + public function register($id, $class = null) + { + return $this->setDefinition(strtolower($id), new Definition($class)); + } + + /** + * Adds the service definitions. + * + * @param Definition[] $definitions An array of service definitions + * + * @api + */ + public function addDefinitions(array $definitions) + { + foreach ($definitions as $id => $definition) { + $this->setDefinition($id, $definition); + } + } + + /** + * Sets the service definitions. + * + * @param Definition[] $definitions An array of service definitions + * + * @api + */ + public function setDefinitions(array $definitions) + { + $this->definitions = array(); + $this->addDefinitions($definitions); + } + + /** + * Gets all service definitions. + * + * @return Definition[] An array of Definition instances + * + * @api + */ + public function getDefinitions() + { + return $this->definitions; + } + + /** + * Sets a service definition. + * + * @param string $id The service identifier + * @param Definition $definition A Definition instance + * + * @return Definition the service definition + * + * @throws BadMethodCallException When this ContainerBuilder is frozen + * + * @api + */ + public function setDefinition($id, Definition $definition) + { + if ($this->isFrozen()) { + throw new BadMethodCallException('Adding definition to a frozen container is not allowed'); + } + + $id = strtolower($id); + + unset($this->aliasDefinitions[$id]); + + return $this->definitions[$id] = $definition; + } + + /** + * Returns true if a service definition exists under the given identifier. + * + * @param string $id The service identifier + * + * @return bool true if the service definition exists, false otherwise + * + * @api + */ + public function hasDefinition($id) + { + return array_key_exists(strtolower($id), $this->definitions); + } + + /** + * Gets a service definition. + * + * @param string $id The service identifier + * + * @return Definition A Definition instance + * + * @throws InvalidArgumentException if the service definition does not exist + * + * @api + */ + public function getDefinition($id) + { + $id = strtolower($id); + + if (!$this->hasDefinition($id)) { + throw new InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id)); + } + + return $this->definitions[$id]; + } + + /** + * Gets a service definition by id or alias. + * + * The method "unaliases" recursively to return a Definition instance. + * + * @param string $id The service identifier or alias + * + * @return Definition A Definition instance + * + * @throws InvalidArgumentException if the service definition does not exist + * + * @api + */ + public function findDefinition($id) + { + while ($this->hasAlias($id)) { + $id = (string) $this->getAlias($id); + } + + return $this->getDefinition($id); + } + + /** + * Creates a service for a service definition. + * + * @param Definition $definition A service definition instance + * @param string $id The service identifier + * @param bool $tryProxy Whether to try proxying the service with a lazy proxy + * + * @return object The service described by the service definition + * + * @throws RuntimeException When the scope is inactive + * @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 + * + * @internal this method is public because of PHP 5.3 limitations, do not use it explicitly in your code + */ + public function createService(Definition $definition, $id, $tryProxy = true) + { + 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 ($tryProxy && $definition->isLazy()) { + $container = $this; + + $proxy = $this + ->getProxyInstantiator() + ->instantiateProxy( + $container, + $definition, + $id, function () use ($definition, $id, $container) { + return $container->createService($definition, $id, false); + } + ); + $this->shareService($definition, $proxy, $id); + + return $proxy; + } + + $parameterBag = $this->getParameterBag(); + + if (null !== $definition->getFile()) { + require_once $parameterBag->resolveValue($definition->getFile()); + } + + $arguments = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments()))); + + if (null !== $definition->getFactoryMethod()) { + if (null !== $definition->getFactoryClass()) { + $factory = $parameterBag->resolveValue($definition->getFactoryClass()); + } elseif (null !== $definition->getFactoryService()) { + $factory = $this->get($parameterBag->resolveValue($definition->getFactoryService())); + } else { + throw new RuntimeException(sprintf('Cannot create service "%s" from factory method without a factory service or factory class.', $id)); + } + + $service = call_user_func_array(array($factory, $definition->getFactoryMethod()), $arguments); + } else { + $r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass())); + + $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); + } + + if ($tryProxy || !$definition->isLazy()) { + // share only if proxying failed, or if not a proxy + $this->shareService($definition, $service, $id); + } + + foreach ($definition->getMethodCalls() as $call) { + $this->callMethod($service, $call); + } + + $properties = $this->resolveServices($parameterBag->resolveValue($definition->getProperties())); + foreach ($properties as $name => $value) { + $service->$name = $value; + } + + if ($callable = $definition->getConfigurator()) { + if (is_array($callable)) { + $callable[0] = $callable[0] instanceof Reference ? $this->get((string) $callable[0]) : $parameterBag->resolveValue($callable[0]); + } + + if (!is_callable($callable)) { + throw new InvalidArgumentException(sprintf('The configure callable for class "%s" is not a callable.', get_class($service))); + } + + call_user_func($callable, $service); + } + + return $service; + } + + /** + * Replaces service references by the real service instance and evaluates expressions. + * + * @param mixed $value A value + * + * @return mixed The same value with all service references replaced by + * the real service instances and all expressions evaluated + */ + public function resolveServices($value) + { + if (is_array($value)) { + foreach ($value as &$v) { + $v = $this->resolveServices($v); + } + } elseif ($value instanceof Reference) { + $value = $this->get((string) $value, $value->getInvalidBehavior()); + } elseif ($value instanceof Definition) { + $value = $this->createService($value, null); + } elseif ($value instanceof Expression) { + $value = $this->getExpressionLanguage()->evaluate($value, array('container' => $this)); + } + + return $value; + } + + /** + * Returns service ids for a given tag. + * + * Example: + * + * $container->register('foo')->addTag('my.tag', array('hello' => 'world')); + * + * $serviceIds = $container->findTaggedServiceIds('my.tag'); + * foreach ($serviceIds as $serviceId => $tags) { + * foreach ($tags as $tag) { + * echo $tag['hello']; + * } + * } + * + * @param string $name The tag name + * + * @return array An array of tags with the tagged service as key, holding a list of attribute arrays. + * + * @api + */ + public function findTaggedServiceIds($name) + { + $tags = array(); + foreach ($this->getDefinitions() as $id => $definition) { + if ($definition->hasTag($name)) { + $tags[$id] = $definition->getTag($name); + } + } + + return $tags; + } + + /** + * Returns all tags the defined services use. + * + * @return array An array of tags + */ + public function findTags() + { + $tags = array(); + foreach ($this->getDefinitions() as $id => $definition) { + $tags = array_merge(array_keys($definition->getTags()), $tags); + } + + return array_unique($tags); + } + + /** + * Returns the Service Conditionals. + * + * @param mixed $value An array of conditionals to return. + * + * @return array An array of Service conditionals + */ + public static function getServiceConditionals($value) + { + $services = array(); + + if (is_array($value)) { + foreach ($value as $v) { + $services = array_unique(array_merge($services, self::getServiceConditionals($v))); + } + } elseif ($value instanceof Reference && $value->getInvalidBehavior() === ContainerInterface::IGNORE_ON_INVALID_REFERENCE) { + $services[] = (string) $value; + } + + return $services; + } + + /** + * Retrieves the currently set proxy instantiator or instantiates one. + * + * @return InstantiatorInterface + */ + private function getProxyInstantiator() + { + if (!$this->proxyInstantiator) { + $this->proxyInstantiator = new RealServiceInstantiator(); + } + + return $this->proxyInstantiator; + } + + /** + * Synchronizes a service change. + * + * This method updates all services that depend on the given + * service by calling all methods referencing it. + * + * @param string $id A service id + */ + private function synchronize($id) + { + foreach ($this->definitions as $definitionId => $definition) { + // only check initialized services + if (!$this->initialized($definitionId)) { + continue; + } + + foreach ($definition->getMethodCalls() as $call) { + foreach ($call[1] as $argument) { + if ($argument instanceof Reference && $id == (string) $argument) { + $this->callMethod($this->get($definitionId), $call); + } + } + } + } + } + + private function callMethod($service, $call) + { + $services = self::getServiceConditionals($call[1]); + + foreach ($services as $s) { + if (!$this->has($s)) { + return; + } + } + + call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->resolveValue($call[1]))); + } + + /** + * Shares a given service in the container + * + * @param Definition $definition + * @param mixed $service + * @param string $id + * + * @throws InactiveScopeException + */ + private function shareService(Definition $definition, $service, $id) + { + if (self::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) { + if (self::SCOPE_CONTAINER !== $scope && !isset($this->scopedServices[$scope])) { + throw new InactiveScopeException($id, $scope); + } + + $this->services[$lowerId = strtolower($id)] = $service; + + if (self::SCOPE_CONTAINER !== $scope) { + $this->scopedServices[$scope][$lowerId] = $service; + } + } + } + + private function getExpressionLanguage() + { + if (null === $this->expressionLanguage) { + if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { + throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); + } + $this->expressionLanguage = new ExpressionLanguage(); + } + + return $this->expressionLanguage; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php new file mode 100644 index 0000000..906a9f2 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -0,0 +1,158 @@ + + * + * 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\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; + +/** + * ContainerInterface is the interface implemented by service container classes. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * + * @api + */ +interface ContainerInterface +{ + const EXCEPTION_ON_INVALID_REFERENCE = 1; + const NULL_ON_INVALID_REFERENCE = 2; + const IGNORE_ON_INVALID_REFERENCE = 3; + const SCOPE_CONTAINER = 'container'; + const SCOPE_PROTOTYPE = 'prototype'; + + /** + * Sets a service. + * + * @param string $id The service identifier + * @param object $service The service instance + * @param string $scope The scope of the service + * + * @api + */ + public function set($id, $service, $scope = self::SCOPE_CONTAINER); + + /** + * Gets a service. + * + * @param string $id The service identifier + * @param int $invalidBehavior The behavior when the service does not exist + * + * @return object The associated service + * + * @throws InvalidArgumentException if the service is not defined + * @throws ServiceCircularReferenceException When a circular reference is detected + * @throws ServiceNotFoundException When the service is not defined + * + * @see Reference + * + * @api + */ + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); + + /** + * Returns true if the given service is defined. + * + * @param string $id The service identifier + * + * @return bool true if the service is defined, false otherwise + * + * @api + */ + public function has($id); + + /** + * Gets a parameter. + * + * @param string $name The parameter name + * + * @return mixed The parameter value + * + * @throws InvalidArgumentException if the parameter is not defined + * + * @api + */ + public function getParameter($name); + + /** + * Checks if a parameter exists. + * + * @param string $name The parameter name + * + * @return bool The presence of parameter in container + * + * @api + */ + public function hasParameter($name); + + /** + * Sets a parameter. + * + * @param string $name The parameter name + * @param mixed $value The parameter value + * + * @api + */ + public function setParameter($name, $value); + + /** + * Enters the given scope + * + * @param string $name + * + * @api + */ + public function enterScope($name); + + /** + * Leaves the current scope, and re-enters the parent scope + * + * @param string $name + * + * @api + */ + public function leaveScope($name); + + /** + * Adds a scope to the container + * + * @param ScopeInterface $scope + * + * @api + */ + public function addScope(ScopeInterface $scope); + + /** + * Whether this container has the given scope + * + * @param string $name + * + * @return bool + * + * @api + */ + public function hasScope($name); + + /** + * Determines whether the given scope is currently active. + * + * It does however not check if the scope actually exists. + * + * @param string $name + * + * @return bool + * + * @api + */ + public function isScopeActive($name); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php new file mode 100644 index 0000000..efe9b79 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php @@ -0,0 +1,742 @@ + + * + * 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; + +/** + * Definition represents a service definition. + * + * @author Fabien Potencier + * + * @api + */ +class Definition +{ + private $class; + private $file; + private $factoryClass; + private $factoryMethod; + private $factoryService; + private $scope = ContainerInterface::SCOPE_CONTAINER; + private $properties = array(); + private $calls = array(); + private $configurator; + private $tags = array(); + private $public = true; + private $synthetic = false; + private $abstract = false; + private $synchronized = false; + private $lazy = false; + private $decoratedService; + + protected $arguments; + + /** + * Constructor. + * + * @param string|null $class The service class + * @param array $arguments An array of arguments to pass to the service constructor + * + * @api + */ + public function __construct($class = null, array $arguments = array()) + { + $this->class = $class; + $this->arguments = $arguments; + } + + /** + * Sets the name of the class that acts as a factory using the factory method, + * which will be invoked statically. + * + * @param string $factoryClass The factory class name + * + * @return Definition The current instance + * + * @api + */ + public function setFactoryClass($factoryClass) + { + $this->factoryClass = $factoryClass; + + return $this; + } + + /** + * Gets the factory class. + * + * @return string|null The factory class name + * + * @api + */ + public function getFactoryClass() + { + return $this->factoryClass; + } + + /** + * Sets the factory method able to create an instance of this class. + * + * @param string $factoryMethod The factory method name + * + * @return Definition The current instance + * + * @api + */ + public function setFactoryMethod($factoryMethod) + { + $this->factoryMethod = $factoryMethod; + + return $this; + } + + /** + * Sets the service that this service is decorating. + * + * @param null|string $id The decorated service id, use null to remove decoration + * @param null|string $renamedId The new decorated service id + * + * @return Definition The current instance + * + * @throws InvalidArgumentException In case the decorated service id and the new decorated service id are equals. + */ + public function setDecoratedService($id, $renamedId = null) + { + if ($renamedId && $id == $renamedId) { + throw new \InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id)); + } + + if (null === $id) { + $this->decoratedService = null; + } else { + $this->decoratedService = array($id, $renamedId); + } + + return $this; + } + + /** + * Gets the service that decorates this service. + * + * @return null|array An array composed of the decorated service id and the new id for it, null if no service is decorated + */ + public function getDecoratedService() + { + return $this->decoratedService; + } + + /** + * Gets the factory method. + * + * @return string|null The factory method name + * + * @api + */ + public function getFactoryMethod() + { + return $this->factoryMethod; + } + + /** + * Sets the name of the service that acts as a factory using the factory method. + * + * @param string $factoryService The factory service id + * + * @return Definition The current instance + * + * @api + */ + public function setFactoryService($factoryService) + { + $this->factoryService = $factoryService; + + return $this; + } + + /** + * Gets the factory service id. + * + * @return string|null The factory service id + * + * @api + */ + public function getFactoryService() + { + return $this->factoryService; + } + + /** + * Sets the service class. + * + * @param string $class The service class + * + * @return Definition The current instance + * + * @api + */ + public function setClass($class) + { + $this->class = $class; + + return $this; + } + + /** + * Gets the service class. + * + * @return string|null The service class + * + * @api + */ + public function getClass() + { + return $this->class; + } + + /** + * Sets the arguments to pass to the service constructor/factory method. + * + * @param array $arguments An array of arguments + * + * @return Definition The current instance + * + * @api + */ + public function setArguments(array $arguments) + { + $this->arguments = $arguments; + + return $this; + } + + /** + * @api + */ + public function setProperties(array $properties) + { + $this->properties = $properties; + + return $this; + } + + /** + * @api + */ + public function getProperties() + { + return $this->properties; + } + + /** + * @api + */ + public function setProperty($name, $value) + { + $this->properties[$name] = $value; + + return $this; + } + + /** + * Adds an argument to pass to the service constructor/factory method. + * + * @param mixed $argument An argument + * + * @return Definition The current instance + * + * @api + */ + public function addArgument($argument) + { + $this->arguments[] = $argument; + + return $this; + } + + /** + * Sets a specific argument + * + * @param int $index + * @param mixed $argument + * + * @return Definition The current instance + * + * @throws OutOfBoundsException When the replaced argument does not exist + * + * @api + */ + public function replaceArgument($index, $argument) + { + if ($index < 0 || $index > count($this->arguments) - 1) { + throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1)); + } + + $this->arguments[$index] = $argument; + + return $this; + } + + /** + * Gets the arguments to pass to the service constructor/factory method. + * + * @return array The array of arguments + * + * @api + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * Gets an argument to pass to the service constructor/factory method. + * + * @param int $index + * + * @return mixed The argument value + * + * @throws OutOfBoundsException When the argument does not exist + * + * @api + */ + public function getArgument($index) + { + if ($index < 0 || $index > count($this->arguments) - 1) { + throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1)); + } + + return $this->arguments[$index]; + } + + /** + * Sets the methods to call after service initialization. + * + * @param array $calls An array of method calls + * + * @return Definition The current instance + * + * @api + */ + public function setMethodCalls(array $calls = array()) + { + $this->calls = array(); + foreach ($calls as $call) { + $this->addMethodCall($call[0], $call[1]); + } + + 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 + * + * @return Definition The current instance + * + * @throws InvalidArgumentException on empty $method param + * + * @api + */ + public function addMethodCall($method, array $arguments = array()) + { + if (empty($method)) { + throw new InvalidArgumentException(sprintf('Method name cannot be empty.')); + } + $this->calls[] = array($method, $arguments); + + return $this; + } + + /** + * Removes a method to call after service initialization. + * + * @param string $method The method name to remove + * + * @return Definition The current instance + * + * @api + */ + public function removeMethodCall($method) + { + foreach ($this->calls as $i => $call) { + if ($call[0] === $method) { + unset($this->calls[$i]); + break; + } + } + + return $this; + } + + /** + * Check if the current definition has a given method to call after service initialization. + * + * @param string $method The method name to search for + * + * @return bool + * + * @api + */ + public function hasMethodCall($method) + { + foreach ($this->calls as $call) { + if ($call[0] === $method) { + return true; + } + } + + return false; + } + + /** + * Gets the methods to call after service initialization. + * + * @return array An array of method calls + * + * @api + */ + public function getMethodCalls() + { + return $this->calls; + } + + /** + * Sets tags for this definition + * + * @param array $tags + * + * @return Definition the current instance + * + * @api + */ + public function setTags(array $tags) + { + $this->tags = $tags; + + return $this; + } + + /** + * Returns all tags. + * + * @return array An array of tags + * + * @api + */ + public function getTags() + { + return $this->tags; + } + + /** + * Gets a tag by name. + * + * @param string $name The tag name + * + * @return array An array of attributes + * + * @api + */ + public function getTag($name) + { + return isset($this->tags[$name]) ? $this->tags[$name] : array(); + } + + /** + * Adds a tag for this definition. + * + * @param string $name The tag name + * @param array $attributes An array of attributes + * + * @return Definition The current instance + * + * @api + */ + public function addTag($name, array $attributes = array()) + { + $this->tags[$name][] = $attributes; + + return $this; + } + + /** + * Whether this definition has a tag with the given name + * + * @param string $name + * + * @return bool + * + * @api + */ + public function hasTag($name) + { + return isset($this->tags[$name]); + } + + /** + * Clears all tags for a given name. + * + * @param string $name The tag name + * + * @return Definition + */ + public function clearTag($name) + { + if (isset($this->tags[$name])) { + unset($this->tags[$name]); + } + + return $this; + } + + /** + * Clears the tags for this definition. + * + * @return Definition The current instance + * + * @api + */ + public function clearTags() + { + $this->tags = array(); + + return $this; + } + + /** + * Sets a file to require before creating the service. + * + * @param string $file A full pathname to include + * + * @return Definition The current instance + * + * @api + */ + public function setFile($file) + { + $this->file = $file; + + return $this; + } + + /** + * Gets the file to require before creating the service. + * + * @return string|null The full pathname to include + * + * @api + */ + public function getFile() + { + return $this->file; + } + + /** + * Sets the scope of the service + * + * @param string $scope Whether the service must be shared or not + * + * @return Definition The current instance + * + * @api + */ + public function setScope($scope) + { + $this->scope = $scope; + + return $this; + } + + /** + * Returns the scope of the service + * + * @return string + * + * @api + */ + public function getScope() + { + return $this->scope; + } + + /** + * Sets the visibility of this service. + * + * @param bool $boolean + * + * @return Definition The current instance + * + * @api + */ + public function setPublic($boolean) + { + $this->public = (bool) $boolean; + + return $this; + } + + /** + * Whether this service is public facing + * + * @return bool + * + * @api + */ + public function isPublic() + { + return $this->public; + } + + /** + * Sets the synchronized flag of this service. + * + * @param bool $boolean + * + * @return Definition The current instance + * + * @api + */ + public function setSynchronized($boolean) + { + $this->synchronized = (bool) $boolean; + + return $this; + } + + /** + * Whether this service is synchronized. + * + * @return bool + * + * @api + */ + public function isSynchronized() + { + return $this->synchronized; + } + + /** + * Sets the lazy flag of this service. + * + * @param bool $lazy + * + * @return Definition The current instance + */ + public function setLazy($lazy) + { + $this->lazy = (bool) $lazy; + + return $this; + } + + /** + * Whether this service is lazy. + * + * @return bool + */ + public function isLazy() + { + return $this->lazy; + } + + /** + * Sets whether this definition is synthetic, that is not constructed by the + * container, but dynamically injected. + * + * @param bool $boolean + * + * @return Definition the current instance + * + * @api + */ + public function setSynthetic($boolean) + { + $this->synthetic = (bool) $boolean; + + return $this; + } + + /** + * Whether this definition is synthetic, that is not constructed by the + * container, but dynamically injected. + * + * @return bool + * + * @api + */ + public function isSynthetic() + { + return $this->synthetic; + } + + /** + * Whether this definition is abstract, that means it merely serves as a + * template for other definitions. + * + * @param bool $boolean + * + * @return Definition the current instance + * + * @api + */ + public function setAbstract($boolean) + { + $this->abstract = (bool) $boolean; + + return $this; + } + + /** + * Whether this definition is abstract, that means it merely serves as a + * template for other definitions. + * + * @return bool + * + * @api + */ + public function isAbstract() + { + return $this->abstract; + } + + /** + * Sets a configurator to call after the service is fully initialized. + * + * @param callable $callable A PHP callable + * + * @return Definition The current instance + * + * @api + */ + public function setConfigurator($callable) + { + $this->configurator = $callable; + + return $this; + } + + /** + * Gets the configurator to call after the service is fully initialized. + * + * @return callable|null The PHP callable to call + * + * @api + */ + public function getConfigurator() + { + return $this->configurator; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php new file mode 100644 index 0000000..5a87f47 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php @@ -0,0 +1,218 @@ + + * + * 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 decorates another definition. + * + * @author Johannes M. Schmitt + * + * @api + */ +class DefinitionDecorator extends Definition +{ + private $parent; + private $changes = array(); + + /** + * Constructor. + * + * @param string $parent The id of Definition instance to decorate. + * + * @api + */ + public function __construct($parent) + { + parent::__construct(); + + $this->parent = $parent; + } + + /** + * Returns the Definition being decorated. + * + * @return string + * + * @api + */ + public function getParent() + { + return $this->parent; + } + + /** + * Returns all changes tracked for the Definition object. + * + * @return array An array of changes for this Definition + * + * @api + */ + public function getChanges() + { + return $this->changes; + } + + /** + * {@inheritdoc} + * + * @api + */ + public function setClass($class) + { + $this->changes['class'] = true; + + return parent::setClass($class); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function setFactoryClass($class) + { + $this->changes['factory_class'] = true; + + return parent::setFactoryClass($class); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function setFactoryMethod($method) + { + $this->changes['factory_method'] = true; + + return parent::setFactoryMethod($method); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function setFactoryService($service) + { + $this->changes['factory_service'] = true; + + return parent::setFactoryService($service); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function setConfigurator($callable) + { + $this->changes['configurator'] = true; + + return parent::setConfigurator($callable); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function setFile($file) + { + $this->changes['file'] = true; + + return parent::setFile($file); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function setPublic($boolean) + { + $this->changes['public'] = true; + + return parent::setPublic($boolean); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function setLazy($boolean) + { + $this->changes['lazy'] = true; + + return parent::setLazy($boolean); + } + + /** + * 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. + * + * @param int $index + * + * @return mixed The argument value + * + * @throws OutOfBoundsException When the argument does not exist + * + * @api + */ + public function getArgument($index) + { + if (array_key_exists('index_'.$index, $this->arguments)) { + return $this->arguments['index_'.$index]; + } + + $lastIndex = count(array_filter(array_keys($this->arguments), 'is_int')) - 1; + + if ($index < 0 || $index > $lastIndex) { + throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, $lastIndex)); + } + + return $this->arguments[$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. + * + * @param int $index + * @param mixed $value + * + * @return DefinitionDecorator the current instance + * @throws InvalidArgumentException when $index isn't an integer + * + * @api + */ + public function replaceArgument($index, $value) + { + if (!is_int($index)) { + throw new InvalidArgumentException('$index must be an integer.'); + } + + $this->arguments['index_'.$index] = $value; + + return $this; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/Dumper.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/Dumper.php new file mode 100644 index 0000000..9892401 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/Dumper.php @@ -0,0 +1,38 @@ + + * + * 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 + * + * @api + */ +abstract class Dumper implements DumperInterface +{ + protected $container; + + /** + * Constructor. + * + * @param ContainerBuilder $container The service container to dump + * + * @api + */ + public function __construct(ContainerBuilder $container) + { + $this->container = $container; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php new file mode 100644 index 0000000..ba146f6 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php @@ -0,0 +1,33 @@ + + * + * 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 + * + * @api + */ +interface DumperInterface +{ + /** + * Dumps the service container. + * + * @param array $options An array of options + * + * @return string The representation of the service container + * + * @api + */ + public function dump(array $options = array()); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php new file mode 100644 index 0000000..33bfe0c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php @@ -0,0 +1,302 @@ + + * + * 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\Definition; +use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\Scope; + +/** + * 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 $nodes; + private $edges; + private $options = array( + 'graph' => array('ratio' => 'compress'), + 'node' => array('fontsize' => 11, 'fontname' => 'Arial', 'shape' => 'record'), + 'edge' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => 'grey', 'arrowhead' => 'open', 'arrowsize' => 0.5), + 'node.instance' => array('fillcolor' => '#9999ff', 'style' => 'filled'), + 'node.definition' => array('fillcolor' => '#eeeeee'), + 'node.missing' => array('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 + * + * @param array $options An array of options + * + * @return string The dot representation of the service container + */ + public function dump(array $options = array()) + { + foreach (array('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 = array(); + 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->startDot().$this->addNodes().$this->addEdges().$this->endDot(); + } + + /** + * Returns all nodes. + * + * @return string A string representation of all nodes + */ + private function addNodes() + { + $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; + } + + /** + * Returns all edges. + * + * @return string A string representation of all edges + */ + private function addEdges() + { + $code = ''; + foreach ($this->edges as $id => $edges) { + foreach ($edges as $edge) { + $code .= sprintf(" node_%s -> node_%s [label=\"%s\" style=\"%s\"];\n", $this->dotize($id), $this->dotize($edge['to']), $edge['name'], $edge['required'] ? 'filled' : 'dashed'); + } + } + + return $code; + } + + /** + * Finds all edges belonging to a specific service id. + * + * @param string $id The service id used to find edges + * @param array $arguments An array of arguments + * @param bool $required + * @param string $name + * + * @return array An array of edges + */ + private function findEdges($id, $arguments, $required, $name) + { + $edges = array(); + 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) { + if (!$this->container->has((string) $argument)) { + $this->nodes[(string) $argument] = array('name' => $name, 'required' => $required, 'class' => '', 'attributes' => $this->options['node.missing']); + } + + $edges[] = array('name' => $name, 'required' => $required, 'to' => $argument); + } elseif (is_array($argument)) { + $edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name)); + } + } + + return $edges; + } + + /** + * Finds all nodes. + * + * @return array An array of all nodes + */ + private function findNodes() + { + $nodes = array(); + + $container = $this->cloneContainer(); + + foreach ($container->getDefinitions() as $id => $definition) { + $className = $definition->getClass(); + + try { + $className = $this->container->getParameterBag()->resolveValue($className); + } catch (ParameterNotFoundException $e) { + } + + $nodes[$id] = array('class' => str_replace('\\', '\\\\', $className), 'attributes' => array_merge($this->options['node.definition'], array('style' => ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope() ? 'filled' : 'dotted'))); + $container->setDefinition($id, new Definition('stdClass')); + } + + foreach ($container->getServiceIds() as $id) { + $service = $container->get($id); + + if (in_array($id, array_keys($container->getAliases()))) { + continue; + } + + if (!$container->hasDefinition($id)) { + $class = ('service_container' === $id) ? get_class($this->container) : get_class($service); + $nodes[$id] = array('class' => str_replace('\\', '\\\\', $class), 'attributes' => $this->options['node.instance']); + } + } + + return $nodes; + } + + private function cloneContainer() + { + $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->getScopes() as $scope => $parentScope) { + $container->addScope(new Scope($scope, $parentScope)); + } + foreach ($this->container->getExtensions() as $extension) { + $container->registerExtension($extension); + } + + return $container; + } + + /** + * Returns the start dot. + * + * @return string The string representation of a start dot + */ + private function startDot() + { + 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']) + ); + } + + /** + * Returns the end dot. + * + * @return string + */ + private function endDot() + { + return "}\n"; + } + + /** + * Adds attributes + * + * @param array $attributes An array of attributes + * + * @return string A comma separated list of attributes + */ + private function addAttributes($attributes) + { + $code = array(); + foreach ($attributes as $k => $v) { + $code[] = sprintf('%s="%s"', $k, $v); + } + + return $code ? ', '.implode(', ', $code) : ''; + } + + /** + * Adds options + * + * @param array $options An array of options + * + * @return string A space separated list of options + */ + private function addOptions($options) + { + $code = array(); + foreach ($options as $k => $v) { + $code[] = sprintf('%s="%s"', $k, $v); + } + + return implode(' ', $code); + } + + /** + * Dotizes an identifier. + * + * @param string $id The identifier to dotize + * + * @return string A dotized string + */ + private function dotize($id) + { + return strtolower(preg_replace('/[^\w]/i', '_', $id)); + } + + /** + * Compiles an array of aliases for a specified service id. + * + * @param string $id A service id + * + * @return array An array of aliases + */ + private function getAliases($id) + { + $aliases = array(); + foreach ($this->container->getAliases() as $alias => $origin) { + if ($id == $origin) { + $aliases[] = $alias; + } + } + + return $aliases; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php new file mode 100644 index 0000000..23dd7ce --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -0,0 +1,1429 @@ + + * + * 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\Variable; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface as ProxyDumper; +use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper; +use Symfony\Component\DependencyInjection\ExpressionLanguage; +use Symfony\Component\ExpressionLanguage\Expression; + +/** + * PhpDumper dumps a service container as a PHP class. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * + * @api + */ +class PhpDumper extends Dumper +{ + /** + * Characters that might appear in the generated variable name as first character + * @var string + */ + const FIRST_CHARS = 'abcdefghijklmnopqrstuvwxyz'; + + /** + * Characters that might appear in the generated variable name as any but the first character + * @var string + */ + const NON_FIRST_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789_'; + + private $inlinedDefinitions; + private $definitionVariables; + private $referenceVariables; + private $variableCount; + private $reservedVariables = array('instance', 'class'); + private $expressionLanguage; + private $targetDirRegex; + private $targetDirMaxMatches; + + /** + * @var \Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface + */ + private $proxyDumper; + + /** + * {@inheritdoc} + * + * @api + */ + public function __construct(ContainerBuilder $container) + { + parent::__construct($container); + + $this->inlinedDefinitions = new \SplObjectStorage(); + } + + /** + * Sets the dumper to be used when dumping proxies in the generated container. + * + * @param ProxyDumper $proxyDumper + */ + public function setProxyDumper(ProxyDumper $proxyDumper) + { + $this->proxyDumper = $proxyDumper; + } + + /** + * Dumps the service container as a PHP class. + * + * Available options: + * + * * class: The class name + * * base_class: The base class name + * * namespace: The class namespace + * + * @param array $options An array of options + * + * @return string A PHP class representing of the service container + * + * @api + */ + public function dump(array $options = array()) + { + $this->targetDirRegex = null; + $options = array_merge(array( + 'class' => 'ProjectServiceContainer', + 'base_class' => 'Container', + 'namespace' => '', + ), $options); + + if (!empty($options['file']) && is_dir($dir = dirname($options['file']))) { + // Build a regexp where the first two root dirs are mandatory, + // but every other sub-dir is optional up to the full path in $dir + + $dir = explode(DIRECTORY_SEPARATOR, realpath($dir)); + $i = count($dir); + + if (3 <= $i) { + $regex = ''; + $this->targetDirMaxMatches = $i - 3; + + while (2 < --$i) { + $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 = '#'.preg_quote($dir[0], '#').$regex.'#'; + } + } + + $code = $this->startClass($options['class'], $options['base_class'], $options['namespace']); + + if ($this->container->isFrozen()) { + $code .= $this->addFrozenConstructor(); + } else { + $code .= $this->addConstructor(); + } + + $code .= + $this->addServices(). + $this->addDefaultParametersMethod(). + $this->endClass(). + $this->addProxyClasses() + ; + $this->targetDirRegex = null; + + return $code; + } + + /** + * Retrieves the currently set proxy dumper or instantiates one. + * + * @return ProxyDumper + */ + private function getProxyDumper() + { + if (!$this->proxyDumper) { + $this->proxyDumper = new NullDumper(); + } + + return $this->proxyDumper; + } + + /** + * Generates Service local temp variables. + * + * @param string $cId + * @param string $definition + * + * @return string + */ + private function addServiceLocalTempVariables($cId, $definition) + { + static $template = " \$%s = %s;\n"; + + $localDefinitions = array_merge( + array($definition), + $this->getInlinedDefinitions($definition) + ); + + $calls = $behavior = array(); + foreach ($localDefinitions as $iDefinition) { + $this->getServiceCallsFromArguments($iDefinition->getArguments(), $calls, $behavior); + $this->getServiceCallsFromArguments($iDefinition->getMethodCalls(), $calls, $behavior); + $this->getServiceCallsFromArguments($iDefinition->getProperties(), $calls, $behavior); + $this->getServiceCallsFromArguments(array($iDefinition->getConfigurator()), $calls, $behavior); + } + + $code = ''; + foreach ($calls as $id => $callCount) { + if ('service_container' === $id || $id === $cId) { + continue; + } + + if ($callCount > 1) { + $name = $this->getNextVariableName(); + $this->referenceVariables[$id] = new Variable($name); + + if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $behavior[$id]) { + $code .= sprintf($template, $name, $this->getServiceCall($id)); + } else { + $code .= sprintf($template, $name, $this->getServiceCall($id, new Reference($id, ContainerInterface::NULL_ON_INVALID_REFERENCE))); + } + } + } + + if ('' !== $code) { + $code .= "\n"; + } + + return $code; + } + + /** + * Generates code for the proxies to be attached after the container class + * + * @return string + */ + private function addProxyClasses() + { + /* @var $definitions Definition[] */ + $definitions = array_filter( + $this->container->getDefinitions(), + array($this->getProxyDumper(), 'isProxyCandidate') + ); + $code = ''; + + foreach ($definitions as $definition) { + $code .= "\n".$this->getProxyDumper()->getProxyCode($definition); + } + + return $code; + } + + /** + * Generates the require_once statement for service includes. + * + * @param string $id The service id + * @param Definition $definition + * + * @return string + */ + private function addServiceInclude($id, $definition) + { + $template = " require_once %s;\n"; + $code = ''; + + if (null !== $file = $definition->getFile()) { + $code .= sprintf($template, $this->dumpValue($file)); + } + + foreach ($this->getInlinedDefinitions($definition) as $definition) { + if (null !== $file = $definition->getFile()) { + $code .= sprintf($template, $this->dumpValue($file)); + } + } + + if ('' !== $code) { + $code .= "\n"; + } + + return $code; + } + + /** + * Generates the inline definition of a service. + * + * @param string $id + * @param Definition $definition + * + * @return string + * + * @throws RuntimeException When the factory definition is incomplete + * @throws ServiceCircularReferenceException When a circular reference is detected + */ + private function addServiceInlinedDefinitions($id, $definition) + { + $code = ''; + $variableMap = $this->definitionVariables; + $nbOccurrences = new \SplObjectStorage(); + $processed = new \SplObjectStorage(); + $inlinedDefinitions = $this->getInlinedDefinitions($definition); + + foreach ($inlinedDefinitions as $definition) { + if (false === $nbOccurrences->contains($definition)) { + $nbOccurrences->offsetSet($definition, 1); + } else { + $i = $nbOccurrences->offsetGet($definition); + $nbOccurrences->offsetSet($definition, $i + 1); + } + } + + foreach ($inlinedDefinitions as $sDefinition) { + if ($processed->contains($sDefinition)) { + continue; + } + $processed->offsetSet($sDefinition); + + $class = $this->dumpValue($sDefinition->getClass()); + if ($nbOccurrences->offsetGet($sDefinition) > 1 || $sDefinition->getMethodCalls() || $sDefinition->getProperties() || null !== $sDefinition->getConfigurator() || false !== strpos($class, '$')) { + $name = $this->getNextVariableName(); + $variableMap->offsetSet($sDefinition, new Variable($name)); + + // a construct like: + // $a = new ServiceA(ServiceB $b); $b = new ServiceB(ServiceA $a); + // this is an indication for a wrong implementation, you can circumvent this problem + // by setting up your service structure like this: + // $b = new ServiceB(); + // $a = new ServiceA(ServiceB $b); + // $b->setServiceA(ServiceA $a); + if ($this->hasReference($id, $sDefinition->getArguments())) { + throw new ServiceCircularReferenceException($id, array($id)); + } + + $code .= $this->addNewInstance($id, $sDefinition, '$'.$name, ' = '); + + if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) { + $code .= $this->addServiceMethodCalls(null, $sDefinition, $name); + $code .= $this->addServiceProperties(null, $sDefinition, $name); + $code .= $this->addServiceConfigurator(null, $sDefinition, $name); + } + + $code .= "\n"; + } + } + + return $code; + } + + /** + * Adds the service return statement. + * + * @param string $id Service id + * @param Definition $definition + * + * @return string + */ + private function addServiceReturn($id, $definition) + { + if ($this->isSimpleInstance($id, $definition)) { + return " }\n"; + } + + return "\n return \$instance;\n }\n"; + } + + /** + * Generates the service instance. + * + * @param string $id + * @param Definition $definition + * + * @return string + * + * @throws InvalidArgumentException + * @throws RuntimeException + */ + private function addServiceInstance($id, $definition) + { + $class = $this->dumpValue($definition->getClass()); + + if (0 === strpos($class, "'") && !preg_match('/^\'[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)); + } + + $simple = $this->isSimpleInstance($id, $definition); + $isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition); + $instantiation = ''; + + if (!$isProxyCandidate && ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) { + $instantiation = "\$this->services['$id'] = ".($simple ? '' : '$instance'); + } elseif (!$isProxyCandidate && ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) { + $instantiation = "\$this->services['$id'] = \$this->scopedServices['$scope']['$id'] = ".($simple ? '' : '$instance'); + } elseif (!$simple) { + $instantiation = '$instance'; + } + + $return = ''; + if ($simple) { + $return = 'return '; + } else { + $instantiation .= ' = '; + } + + $code = $this->addNewInstance($id, $definition, $return, $instantiation); + + if (!$simple) { + $code .= "\n"; + } + + return $code; + } + + /** + * Checks if the definition is a simple instance. + * + * @param string $id + * @param Definition $definition + * + * @return bool + */ + private function isSimpleInstance($id, $definition) + { + foreach (array_merge(array($definition), $this->getInlinedDefinitions($definition)) as $sDefinition) { + if ($definition !== $sDefinition && !$this->hasReference($id, $sDefinition->getMethodCalls())) { + continue; + } + + if ($sDefinition->getMethodCalls() || $sDefinition->getProperties() || $sDefinition->getConfigurator()) { + return false; + } + } + + return true; + } + + /** + * Adds method calls to a service definition. + * + * @param string $id + * @param Definition $definition + * @param string $variableName + * + * @return string + */ + private function addServiceMethodCalls($id, $definition, $variableName = 'instance') + { + $calls = ''; + foreach ($definition->getMethodCalls() as $call) { + $arguments = array(); + foreach ($call[1] as $value) { + $arguments[] = $this->dumpValue($value); + } + + $calls .= $this->wrapServiceConditionals($call[1], sprintf(" \$%s->%s(%s);\n", $variableName, $call[0], implode(', ', $arguments))); + } + + return $calls; + } + + private function addServiceProperties($id, $definition, $variableName = 'instance') + { + $code = ''; + foreach ($definition->getProperties() as $name => $value) { + $code .= sprintf(" \$%s->%s = %s;\n", $variableName, $name, $this->dumpValue($value)); + } + + return $code; + } + + /** + * Generates the inline definition setup. + * + * @param string $id + * @param Definition $definition + * + * @return string + * + * @throws ServiceCircularReferenceException when the container contains a circular reference + */ + private function addServiceInlinedDefinitionsSetup($id, $definition) + { + $this->referenceVariables[$id] = new Variable('instance'); + + $code = ''; + $processed = new \SplObjectStorage(); + foreach ($this->getInlinedDefinitions($definition) as $iDefinition) { + if ($processed->contains($iDefinition)) { + continue; + } + $processed->offsetSet($iDefinition); + + if (!$this->hasReference($id, $iDefinition->getMethodCalls(), true) && !$this->hasReference($id, $iDefinition->getProperties(), true)) { + continue; + } + + // if the instance is simple, the return statement has already been generated + // so, the only possible way to get there is because of a circular reference + if ($this->isSimpleInstance($id, $definition)) { + throw new ServiceCircularReferenceException($id, array($id)); + } + + $name = (string) $this->definitionVariables->offsetGet($iDefinition); + $code .= $this->addServiceMethodCalls(null, $iDefinition, $name); + $code .= $this->addServiceProperties(null, $iDefinition, $name); + $code .= $this->addServiceConfigurator(null, $iDefinition, $name); + } + + if ('' !== $code) { + $code .= "\n"; + } + + return $code; + } + + /** + * Adds configurator definition + * + * @param string $id + * @param Definition $definition + * @param string $variableName + * + * @return string + */ + private function addServiceConfigurator($id, $definition, $variableName = 'instance') + { + 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 call_user_func away + if (strpos($class, "'") === 0) { + return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class), $callable[1], $variableName); + } + + return sprintf(" call_user_func(array(%s, '%s'), \$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); + } + + return sprintf(" %s(\$%s);\n", $callable, $variableName); + } + + /** + * Adds a service + * + * @param string $id + * @param Definition $definition + * + * @return string + */ + private function addService($id, $definition) + { + $this->definitionVariables = new \SplObjectStorage(); + $this->referenceVariables = array(); + $this->variableCount = 0; + + $return = array(); + + if ($definition->isSynthetic()) { + $return[] = '@throws RuntimeException always since this service is expected to be injected dynamically'; + } elseif ($class = $definition->getClass()) { + $return[] = sprintf("@return %s A %s instance.", 0 === strpos($class, '%') ? 'object' : "\\".$class, $class); + } elseif ($definition->getFactoryClass()) { + $return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(), $definition->getFactoryMethod()); + } elseif ($definition->getFactoryService()) { + $return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryService(), $definition->getFactoryMethod()); + } + + $scope = $definition->getScope(); + if (!in_array($scope, array(ContainerInterface::SCOPE_CONTAINER, ContainerInterface::SCOPE_PROTOTYPE))) { + if ($return && 0 === strpos($return[count($return) - 1], '@return')) { + $return[] = ''; + } + $return[] = sprintf("@throws InactiveScopeException when the '%s' service is requested while the '%s' scope is not active", $id, $scope); + } + + $return = implode("\n * ", $return); + + $doc = ''; + if (ContainerInterface::SCOPE_PROTOTYPE !== $scope) { + $doc .= <<isPublic()) { + $doc .= <<isLazy()) { + $lazyInitialization = '$lazyLoad = true'; + $lazyInitializationDoc = "\n * @param bool \$lazyLoad whether to try lazy-loading the service with a proxy\n *"; + } else { + $lazyInitialization = ''; + $lazyInitializationDoc = ''; + } + + // with proxies, for 5.3.3 compatibility, the getter must be public to be accessible to the initializer + $isProxyCandidate = $this->getProxyDumper()->isProxyCandidate($definition); + $visibility = $isProxyCandidate ? 'public' : 'protected'; + $code = <<camelize($id)}Service($lazyInitialization) + { + +EOF; + + $code .= $isProxyCandidate ? $this->getProxyDumper()->getProxyFactoryCode($definition, $id) : ''; + + if (!in_array($scope, array(ContainerInterface::SCOPE_CONTAINER, ContainerInterface::SCOPE_PROTOTYPE))) { + $code .= <<scopedServices['$scope'])) { + throw new InactiveScopeException('$id', '$scope'); + } + + +EOF; + } + + if ($definition->isSynthetic()) { + $code .= sprintf(" throw new RuntimeException('You have requested a synthetic service (\"%s\"). The DIC does not know how to construct this service.');\n }\n", $id); + } else { + $code .= + $this->addServiceInclude($id, $definition). + $this->addServiceLocalTempVariables($id, $definition). + $this->addServiceInlinedDefinitions($id, $definition). + $this->addServiceInstance($id, $definition). + $this->addServiceInlinedDefinitionsSetup($id, $definition). + $this->addServiceMethodCalls($id, $definition). + $this->addServiceProperties($id, $definition). + $this->addServiceConfigurator($id, $definition). + $this->addServiceReturn($id, $definition) + ; + } + + $this->definitionVariables = null; + $this->referenceVariables = null; + + return $code; + } + + /** + * Adds multiple services + * + * @return string + */ + private function addServices() + { + $publicServices = $privateServices = $synchronizers = ''; + $definitions = $this->container->getDefinitions(); + ksort($definitions); + foreach ($definitions as $id => $definition) { + if ($definition->isPublic()) { + $publicServices .= $this->addService($id, $definition); + } else { + $privateServices .= $this->addService($id, $definition); + } + + $synchronizers .= $this->addServiceSynchronizer($id, $definition); + } + + return $publicServices.$synchronizers.$privateServices; + } + + /** + * Adds synchronizer methods. + * + * @param string $id A service identifier + * @param Definition $definition A Definition instance + * + * @return string|null + */ + private function addServiceSynchronizer($id, Definition $definition) + { + if (!$definition->isSynchronized()) { + return; + } + + $code = ''; + foreach ($this->container->getDefinitions() as $definitionId => $definition) { + foreach ($definition->getMethodCalls() as $call) { + foreach ($call[1] as $argument) { + if ($argument instanceof Reference && $id == (string) $argument) { + $arguments = array(); + foreach ($call[1] as $value) { + $arguments[] = $this->dumpValue($value); + } + + $call = $this->wrapServiceConditionals($call[1], sprintf("\$this->get('%s')->%s(%s);", $definitionId, $call[0], implode(', ', $arguments))); + + $code .= <<initialized('$definitionId')) { + $call + } + +EOF; + } + } + } + } + + if (!$code) { + return; + } + + return <<camelize($id)}Service() + { +$code } + +EOF; + } + + private function addNewInstance($id, Definition $definition, $return, $instantiation) + { + $class = $this->dumpValue($definition->getClass()); + + $arguments = array(); + foreach ($definition->getArguments() as $value) { + $arguments[] = $this->dumpValue($value); + } + + if (null !== $definition->getFactoryMethod()) { + if (null !== $definition->getFactoryClass()) { + $class = $this->dumpValue($definition->getFactoryClass()); + + // If the class is a string we can optimize call_user_func away + if (strpos($class, "'") === 0) { + return sprintf(" $return{$instantiation}%s::%s(%s);\n", $this->dumpLiteralClass($class), $definition->getFactoryMethod(), $arguments ? implode(', ', $arguments) : ''); + } + + return sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($definition->getFactoryClass()), $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : ''); + } + + if (null !== $definition->getFactoryService()) { + return sprintf(" $return{$instantiation}%s->%s(%s);\n", $this->getServiceCall($definition->getFactoryService()), $definition->getFactoryMethod(), implode(', ', $arguments)); + } + + throw new RuntimeException(sprintf('Factory method requires a factory service or factory class in service definition for %s', $id)); + } + + if (false !== strpos($class, '$')) { + return sprintf(" \$class = %s;\n\n $return{$instantiation}new \$class(%s);\n", $class, implode(', ', $arguments)); + } + + return sprintf(" $return{$instantiation}new %s(%s);\n", $this->dumpLiteralClass($class), implode(', ', $arguments)); + } + + /** + * Adds the class headers. + * + * @param string $class Class name + * @param string $baseClass The name of the base class + * @param string $namespace The class namespace + * + * @return string + */ + private function startClass($class, $baseClass, $namespace) + { + $bagClass = $this->container->isFrozen() ? 'use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;' : 'use Symfony\Component\DependencyInjection\ParameterBag\\ParameterBag;'; + $namespaceLine = $namespace ? "namespace $namespace;\n" : ''; + + return <<container->getParameterBag()->all() ? 'new ParameterBag($this->getDefaultParameters())' : null; + + $code = <<container->getScopes()) > 0) { + $code .= "\n"; + $code .= " \$this->scopes = ".$this->dumpValue($scopes).";\n"; + $code .= " \$this->scopeChildren = ".$this->dumpValue($this->container->getScopeChildren()).";\n"; + } + + $code .= $this->addMethodMap(); + $code .= $this->addAliases(); + + $code .= <<container->getParameterBag()->all()) { + $code .= "\n \$this->parameters = \$this->getDefaultParameters();\n"; + } + + $code .= <<services = + \$this->scopedServices = + \$this->scopeStacks = array(); + + \$this->set('service_container', \$this); + +EOF; + + $code .= "\n"; + if (count($scopes = $this->container->getScopes()) > 0) { + $code .= " \$this->scopes = ".$this->dumpValue($scopes).";\n"; + $code .= " \$this->scopeChildren = ".$this->dumpValue($this->container->getScopeChildren()).";\n"; + } else { + $code .= " \$this->scopes = array();\n"; + $code .= " \$this->scopeChildren = array();\n"; + } + + $code .= $this->addMethodMap(); + $code .= $this->addAliases(); + + $code .= <<container->getDefinitions()) { + return ''; + } + + $code = " \$this->methodMap = array(\n"; + ksort($definitions); + foreach ($definitions as $id => $definition) { + $code .= ' '.var_export($id, true).' => '.var_export('get'.$this->camelize($id).'Service', true).",\n"; + } + + return $code." );\n"; + } + + /** + * Adds the aliases property definition + * + * @return string + */ + private function addAliases() + { + if (!$aliases = $this->container->getAliases()) { + if ($this->container->isFrozen()) { + return "\n \$this->aliases = array();\n"; + } else { + return ''; + } + } + + $code = " \$this->aliases = array(\n"; + ksort($aliases); + foreach ($aliases as $alias => $id) { + $id = (string) $id; + while (isset($aliases[$id])) { + $id = (string) $aliases[$id]; + } + $code .= ' '.var_export($alias, true).' => '.var_export($id, true).",\n"; + } + + return $code." );\n"; + } + + /** + * Adds default parameters method. + * + * @return string + */ + private function addDefaultParametersMethod() + { + if (!$this->container->getParameterBag()->all()) { + return ''; + } + + $parameters = $this->exportParameters($this->container->getParameterBag()->all()); + + $code = ''; + if ($this->container->isFrozen()) { + $code .= <<parameters[\$name]) || array_key_exists(\$name, \$this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', \$name)); + } + + return \$this->parameters[\$name]; + } + + /** + * {@inheritdoc} + */ + public function hasParameter(\$name) + { + \$name = strtolower(\$name); + + return isset(\$this->parameters[\$name]) || array_key_exists(\$name, \$this->parameters); + } + + /** + * {@inheritdoc} + */ + public function setParameter(\$name, \$value) + { + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); + } + + /** + * {@inheritdoc} + */ + public function getParameterBag() + { + if (null === \$this->parameterBag) { + \$this->parameterBag = new FrozenParameterBag(\$this->parameters); + } + + return \$this->parameterBag; + } +EOF; + } + + $code .= << $value) { + if (is_array($value)) { + $value = $this->exportParameters($value, $path.'/'.$key, $indent + 4); + } 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)); + } else { + $value = $this->export($value); + } + + $php[] = sprintf('%s%s => %s,', str_repeat(' ', $indent), var_export($key, true), $value); + } + + return sprintf("array(\n%s\n%s)", implode("\n", $php), str_repeat(' ', $indent - 4)); + } + + /** + * Ends the class definition. + * + * @return string + */ + private function endClass() + { + return <<has('%s')", $service); + } + + // re-indent the wrapped code + $code = implode("\n", array_map(function ($line) { return $line ? ' '.$line : $line; }, explode("\n", $code))); + + return sprintf(" if (%s) {\n%s }\n", implode(' && ', $conditions), $code); + } + + /** + * Builds service calls from arguments. + * + * @param array $arguments + * @param array &$calls By reference + * @param array &$behavior By reference + */ + private function getServiceCallsFromArguments(array $arguments, array &$calls, array &$behavior) + { + foreach ($arguments as $argument) { + if (is_array($argument)) { + $this->getServiceCallsFromArguments($argument, $calls, $behavior); + } elseif ($argument instanceof Reference) { + $id = (string) $argument; + + if (!isset($calls[$id])) { + $calls[$id] = 0; + } + if (!isset($behavior[$id])) { + $behavior[$id] = $argument->getInvalidBehavior(); + } elseif (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $behavior[$id]) { + $behavior[$id] = $argument->getInvalidBehavior(); + } + + $calls[$id] += 1; + } + } + } + + /** + * Returns the inline definition. + * + * @param Definition $definition + * + * @return array + */ + private function getInlinedDefinitions(Definition $definition) + { + if (false === $this->inlinedDefinitions->contains($definition)) { + $definitions = array_merge( + $this->getDefinitionsFromArguments($definition->getArguments()), + $this->getDefinitionsFromArguments($definition->getMethodCalls()), + $this->getDefinitionsFromArguments($definition->getProperties()), + $this->getDefinitionsFromArguments(array($definition->getConfigurator())) + ); + + $this->inlinedDefinitions->offsetSet($definition, $definitions); + + return $definitions; + } + + return $this->inlinedDefinitions->offsetGet($definition); + } + + /** + * Gets the definition from arguments. + * + * @param array $arguments + * + * @return array + */ + private function getDefinitionsFromArguments(array $arguments) + { + $definitions = array(); + foreach ($arguments as $argument) { + if (is_array($argument)) { + $definitions = array_merge($definitions, $this->getDefinitionsFromArguments($argument)); + } elseif ($argument instanceof Definition) { + $definitions = array_merge( + $definitions, + $this->getInlinedDefinitions($argument), + array($argument) + ); + } + } + + return $definitions; + } + + /** + * Checks if a service id has a reference. + * + * @param string $id + * @param array $arguments + * @param bool $deep + * @param array $visited + * + * @return bool + */ + private function hasReference($id, array $arguments, $deep = false, array $visited = array()) + { + foreach ($arguments as $argument) { + if (is_array($argument)) { + if ($this->hasReference($id, $argument, $deep, $visited)) { + return true; + } + } elseif ($argument instanceof Reference) { + $argumentId = (string) $argument; + if ($id === $argumentId) { + return true; + } + + if ($deep && !isset($visited[$argumentId])) { + $visited[$argumentId] = true; + + $service = $this->container->getDefinition($argumentId); + $arguments = array_merge($service->getMethodCalls(), $service->getArguments(), $service->getProperties()); + + if ($this->hasReference($id, $arguments, $deep, $visited)) { + return true; + } + } + } + } + + return false; + } + + /** + * Dumps values. + * + * @param array $value + * @param bool $interpolate + * + * @return string + * + * @throws RuntimeException + */ + private function dumpValue($value, $interpolate = true) + { + if (is_array($value)) { + $code = array(); + foreach ($value as $k => $v) { + $code[] = sprintf('%s => %s', $this->dumpValue($k, $interpolate), $this->dumpValue($v, $interpolate)); + } + + return sprintf('array(%s)', implode(', ', $code)); + } elseif ($value instanceof Definition) { + if (null !== $this->definitionVariables && $this->definitionVariables->contains($value)) { + return $this->dumpValue($this->definitionVariables->offsetGet($value), $interpolate); + } + if (count($value->getMethodCalls()) > 0) { + throw new RuntimeException('Cannot dump definitions which have method calls.'); + } + if (null !== $value->getConfigurator()) { + throw new RuntimeException('Cannot dump definitions which have a configurator.'); + } + + $arguments = array(); + foreach ($value->getArguments() as $argument) { + $arguments[] = $this->dumpValue($argument); + } + $class = $this->dumpValue($value->getClass()); + + if (false !== strpos($class, '$')) { + throw new RuntimeException('Cannot dump definitions which have a variable class name.'); + } + + if (null !== $value->getFactoryMethod()) { + if (null !== $value->getFactoryClass()) { + return sprintf("call_user_func(array(%s, '%s')%s)", $this->dumpValue($value->getFactoryClass()), $value->getFactoryMethod(), count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); + } elseif (null !== $value->getFactoryService()) { + return sprintf("%s->%s(%s)", $this->getServiceCall($value->getFactoryService()), $value->getFactoryMethod(), implode(', ', $arguments)); + } else { + throw new RuntimeException('Cannot dump definitions which have factory method without factory service or factory class.'); + } + } + + return sprintf("new \\%s(%s)", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments)); + } elseif ($value instanceof Variable) { + return '$'.$value; + } elseif ($value instanceof Reference) { + if (null !== $this->referenceVariables && isset($this->referenceVariables[$id = (string) $value])) { + return $this->dumpValue($this->referenceVariables[$id], $interpolate); + } + + return $this->getServiceCall((string) $value, $value); + } elseif ($value instanceof Expression) { + return $this->getExpressionLanguage()->compile((string) $value, array('this' => '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(strtolower($match[1])); + } else { + $that = $this; + $replaceParameters = function ($match) use ($that) { + return "'.".$that->dumpParameter(strtolower($match[2])).".'"; + }; + + $code = str_replace('%%', '%', preg_replace_callback('/(?export($value))); + + return $code; + } + } elseif (is_object($value) || is_resource($value)) { + throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); + } else { + return $this->export($value); + } + } + + /** + * Dumps a string to a literal (aka PHP Code) class value. + * + * @param string $class + * + * @return string + */ + private function dumpLiteralClass($class) + { + return '\\'.substr(str_replace('\\\\', '\\', $class), 1, -1); + } + + /** + * Dumps a parameter + * + * @param string $name + * + * @return string + */ + public function dumpParameter($name) + { + if ($this->container->isFrozen() && $this->container->hasParameter($name)) { + return $this->dumpValue($this->container->getParameter($name), false); + } + + return sprintf("\$this->getParameter('%s')", strtolower($name)); + } + + /** + * Gets a service call + * + * @param string $id + * @param Reference $reference + * + * @return string + */ + private function getServiceCall($id, Reference $reference = null) + { + if ('service_container' === $id) { + return '$this'; + } + + if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) { + return sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id); + } else { + if ($this->container->hasAlias($id)) { + $id = (string) $this->container->getAlias($id); + } + + return sprintf('$this->get(\'%s\')', $id); + } + } + + /** + * Convert a service id to a valid PHP method name. + * + * @param string $id + * + * @return string + * + * @throws InvalidArgumentException + */ + private function camelize($id) + { + $name = Container::camelize($id); + + if (!preg_match('/^[a-zA-Z0-9_\x7f-\xff]+$/', $name)) { + throw new InvalidArgumentException(sprintf('Service id "%s" cannot be converted to a valid PHP method name.', $id)); + } + + return $name; + } + + /** + * Returns the next name to use + * + * @return string + */ + private function getNextVariableName() + { + $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 = intval($i/$firstCharsLength); + } + + while ($i > 0) { + $i -= 1; + $name .= $nonFirstChars[$i%$nonFirstCharsLength]; + $i = intval($i/$nonFirstCharsLength); + } + + $this->variableCount += 1; + + // check that the name is not reserved + if (in_array($name, $this->reservedVariables, true)) { + continue; + } + + return $name; + } + } + + private function getExpressionLanguage() + { + if (null === $this->expressionLanguage) { + if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) { + throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.'); + } + $this->expressionLanguage = new ExpressionLanguage(); + } + + return $this->expressionLanguage; + } + + private function export($value) + { + if (null !== $this->targetDirRegex && is_string($value) && preg_match($this->targetDirRegex, $value, $matches, PREG_OFFSET_CAPTURE)) { + $prefix = $matches[0][1] ? var_export(substr($value, 0, $matches[0][1]), true).'.' : ''; + $suffix = $matches[0][1] + strlen($matches[0][0]); + $suffix = isset($value[$suffix]) ? '.'.var_export(substr($value, $suffix), true) : ''; + $dirname = '__DIR__'; + + for ($i = $this->targetDirMaxMatches - count($matches); 0 <= $i; --$i) { + $dirname = sprintf('dirname(%s)', $dirname); + } + + if ($prefix || $suffix) { + return sprintf('(%s%s%s)', $prefix, $dirname, $suffix); + } + + return $dirname; + } + + return var_export($value, true); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php new file mode 100644 index 0000000..e3a533e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -0,0 +1,337 @@ + + * + * 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\ContainerInterface; +use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\ExpressionLanguage\Expression; + +/** + * XmlDumper dumps a service container as an XML string. + * + * @author Fabien Potencier + * @author Martin Hasoň + * + * @api + */ +class XmlDumper extends Dumper +{ + /** + * @var \DOMDocument + */ + private $document; + + /** + * Dumps the service container as an XML string. + * + * @param array $options An array of options + * + * @return string An xml string representing of the service container + * + * @api + */ + public function dump(array $options = array()) + { + $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 http://symfony.com/schema/dic/services/services-1.0.xsd'); + + $this->addParameters($container); + $this->addServices($container); + + $this->document->appendChild($container); + $xml = $this->document->saveXML(); + $this->document = null; + + return $xml; + } + + /** + * Adds parameters. + * + * @param \DOMElement $parent + */ + private function addParameters(\DOMElement $parent) + { + $data = $this->container->getParameterBag()->all(); + if (!$data) { + return; + } + + if ($this->container->isFrozen()) { + $data = $this->escape($data); + } + + $parameters = $this->document->createElement('parameters'); + $parent->appendChild($parameters); + $this->convertParameters($data, 'parameter', $parameters); + } + + /** + * Adds method calls. + * + * @param array $methodcalls + * @param \DOMElement $parent + */ + private function addMethodCalls(array $methodcalls, \DOMElement $parent) + { + foreach ($methodcalls as $methodcall) { + $call = $this->document->createElement('call'); + $call->setAttribute('method', $methodcall[0]); + if (count($methodcall[1])) { + $this->convertParameters($methodcall[1], 'argument', $call); + } + $parent->appendChild($call); + } + } + + /** + * Adds a service. + * + * @param Definition $definition + * @param string $id + * @param \DOMElement $parent + */ + private function addService($definition, $id, \DOMElement $parent) + { + $service = $this->document->createElement('service'); + if (null !== $id) { + $service->setAttribute('id', $id); + } + if ($definition->getClass()) { + $service->setAttribute('class', $definition->getClass()); + } + if ($definition->getFactoryMethod()) { + $service->setAttribute('factory-method', $definition->getFactoryMethod()); + } + if ($definition->getFactoryClass()) { + $service->setAttribute('factory-class', $definition->getFactoryClass()); + } + if ($definition->getFactoryService()) { + $service->setAttribute('factory-service', $definition->getFactoryService()); + } + if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope()) { + $service->setAttribute('scope', $scope); + } + if (!$definition->isPublic()) { + $service->setAttribute('public', 'false'); + } + if ($definition->isSynthetic()) { + $service->setAttribute('synthetic', 'true'); + } + if ($definition->isSynchronized()) { + $service->setAttribute('synchronized', 'true'); + } + if ($definition->isLazy()) { + $service->setAttribute('lazy', 'true'); + } + if (null !== $decorated = $definition->getDecoratedService()) { + list ($decorated, $renamedId) = $decorated; + $service->setAttribute('decorates', $decorated); + if (null !== $renamedId) { + $service->setAttribute('decoration-inner-name', $renamedId); + } + } + + foreach ($definition->getTags() as $name => $tags) { + foreach ($tags as $attributes) { + $tag = $this->document->createElement('tag'); + $tag->setAttribute('name', $name); + 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->getConfigurator()) { + $configurator = $this->document->createElement('configurator'); + if (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); + } + + /** + * Adds a service alias. + * + * @param string $alias + * @param Alias $id + * @param \DOMElement $parent + */ + private function addServiceAlias($alias, Alias $id, \DOMElement $parent) + { + $service = $this->document->createElement('service'); + $service->setAttribute('id', $alias); + $service->setAttribute('alias', $id); + if (!$id->isPublic()) { + $service->setAttribute('public', 'false'); + } + $parent->appendChild($service); + } + + /** + * Adds services. + * + * @param \DOMElement $parent + */ + private function addServices(\DOMElement $parent) + { + $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); + } + + /** + * Converts parameters. + * + * @param array $parameters + * @param string $type + * @param \DOMElement $parent + * @param string $keyAttribute + */ + private function convertParameters($parameters, $type, \DOMElement $parent, $keyAttribute = 'key') + { + $withKeys = array_keys($parameters) !== range(0, count($parameters) - 1); + foreach ($parameters as $key => $value) { + $element = $this->document->createElement($type); + if ($withKeys) { + $element->setAttribute($keyAttribute, $key); + } + + if (is_array($value)) { + $element->setAttribute('type', 'collection'); + $this->convertParameters($value, $type, $element, 'key'); + } elseif ($value instanceof Reference) { + $element->setAttribute('type', 'service'); + $element->setAttribute('id', (string) $value); + $behaviour = $value->getInvalidBehavior(); + if ($behaviour == ContainerInterface::NULL_ON_INVALID_REFERENCE) { + $element->setAttribute('on-invalid', 'null'); + } elseif ($behaviour == ContainerInterface::IGNORE_ON_INVALID_REFERENCE) { + $element->setAttribute('on-invalid', 'ignore'); + } + if (!$value->isStrict()) { + $element->setAttribute('strict', 'false'); + } + } 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); + } else { + if (in_array($value, array('null', 'true', 'false'), true)) { + $element->setAttribute('type', 'string'); + } + $text = $this->document->createTextNode(self::phpToXml($value)); + $element->appendChild($text); + } + $parent->appendChild($element); + } + } + + /** + * Escapes arguments + * + * @param array $arguments + * + * @return array + */ + private function escape($arguments) + { + $args = array(); + 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. + * + * @param mixed $value Value to convert + * + * @return string + * + * @throws RuntimeException When trying to dump object or resource + */ + public static function phpToXml($value) + { + switch (true) { + case null === $value: + return 'null'; + case true === $value: + return 'true'; + case false === $value: + return 'false'; + case $value instanceof Parameter: + return '%'.$value.'%'; + case is_object($value) || is_resource($value): + throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); + default: + return (string) $value; + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php new file mode 100644 index 0000000..fb0708c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -0,0 +1,336 @@ + + * + * 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\Yaml\Dumper as YmlDumper; +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\ExpressionLanguage\Expression; + +/** + * YamlDumper dumps a service container as a YAML string. + * + * @author Fabien Potencier + * + * @api + */ +class YamlDumper extends Dumper +{ + private $dumper; + + /** + * Constructor. + * + * @param ContainerBuilder $container The service container to dump + * + * @api + */ + public function __construct(ContainerBuilder $container) + { + parent::__construct($container); + + $this->dumper = new YmlDumper(); + } + + /** + * Dumps the service container as an YAML string. + * + * @param array $options An array of options + * + * @return string A YAML string representing of the service container + * + * @api + */ + public function dump(array $options = array()) + { + return $this->addParameters()."\n".$this->addServices(); + } + + /** + * Adds a service + * + * @param string $id + * @param Definition $definition + * + * @return string + */ + private function addService($id, $definition) + { + $code = " $id:\n"; + if ($definition->getClass()) { + $code .= sprintf(" class: %s\n", $definition->getClass()); + } + + if (!$definition->isPublic()) { + $code .= " public: false\n"; + } + + $tagsCode = ''; + foreach ($definition->getTags() as $name => $tags) { + foreach ($tags as $attributes) { + $att = array(); + foreach ($attributes as $key => $value) { + $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); + } + $att = $att ? ', '.implode(' ', $att) : ''; + + $tagsCode .= sprintf(" - { name: %s%s }\n", $this->dumper->dump($name), $att); + } + } + if ($tagsCode) { + $code .= " tags:\n".$tagsCode; + } + + if ($definition->getFile()) { + $code .= sprintf(" file: %s\n", $definition->getFile()); + } + + if ($definition->isSynthetic()) { + $code .= sprintf(" synthetic: true\n"); + } + + if ($definition->isSynchronized()) { + $code .= sprintf(" synchronized: true\n"); + } + + if ($definition->getFactoryClass()) { + $code .= sprintf(" factory_class: %s\n", $definition->getFactoryClass()); + } + + if ($definition->isLazy()) { + $code .= sprintf(" lazy: true\n"); + } + + if ($definition->getFactoryMethod()) { + $code .= sprintf(" factory_method: %s\n", $definition->getFactoryMethod()); + } + + if ($definition->getFactoryService()) { + $code .= sprintf(" factory_service: %s\n", $definition->getFactoryService()); + } + + 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 (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope()) { + $code .= sprintf(" scope: %s\n", $scope); + } + + if (null !== $decorated = $definition->getDecoratedService()) { + list ($decorated, $renamedId) = $decorated; + $code .= sprintf(" decorates: %s\n", $decorated); + if (null !== $renamedId) { + $code .= sprintf(" decoration_inner_name: %s\n", $renamedId); + } + } + + if ($callable = $definition->getConfigurator()) { + if (is_array($callable)) { + if ($callable[0] instanceof Reference) { + $callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]); + } else { + $callable = array($callable[0], $callable[1]); + } + } + + $code .= sprintf(" configurator: %s\n", $this->dumper->dump($callable, 0)); + } + + return $code; + } + + /** + * Adds a service alias + * + * @param string $alias + * @param Alias $id + * + * @return string + */ + private function addServiceAlias($alias, $id) + { + if ($id->isPublic()) { + return sprintf(" %s: @%s\n", $alias, $id); + } else { + return sprintf(" %s:\n alias: %s\n public: false", $alias, $id); + } + } + + /** + * Adds services + * + * @return string + */ + private function addServices() + { + 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; + } + + /** + * Adds parameters + * + * @return string + */ + private function addParameters() + { + if (!$this->container->getParameterBag()->all()) { + return ''; + } + + $parameters = $this->prepareParameters($this->container->getParameterBag()->all(), $this->container->isFrozen()); + + return $this->dumper->dump(array('parameters' => $parameters), 2); + } + + /** + * Dumps the value to YAML format + * + * @param mixed $value + * + * @return mixed + * + * @throws RuntimeException When trying to dump object or resource + */ + private function dumpValue($value) + { + if (is_array($value)) { + $code = array(); + 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 (is_object($value) || is_resource($value)) { + throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); + } + + return $value; + } + + /** + * Gets the service call. + * + * @param string $id + * @param Reference $reference + * + * @return string + */ + private function getServiceCall($id, Reference $reference = null) + { + if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) { + return sprintf('@?%s', $id); + } + + return sprintf('@%s', $id); + } + + /** + * Gets parameter call. + * + * @param string $id + * + * @return string + */ + private function getParameterCall($id) + { + return sprintf('%%%s%%', $id); + } + + private function getExpressionCall($expression) + { + return sprintf('@=%s', $expression); + } + + /** + * Prepares parameters. + * + * @param array $parameters + * @param bool $escape + * + * @return array + */ + private function prepareParameters($parameters, $escape = true) + { + $filtered = array(); + foreach ($parameters as $key => $value) { + if (is_array($value)) { + $value = $this->prepareParameters($value, $escape); + } elseif ($value instanceof Reference || is_string($value) && 0 === strpos($value, '@')) { + $value = '@'.$value; + } + + $filtered[$key] = $value; + } + + return $escape ? $this->escape($filtered) : $filtered; + } + + /** + * Escapes arguments + * + * @param array $arguments + * + * @return array + */ + private function escape($arguments) + { + $args = array(); + 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php new file mode 100644 index 0000000..959238e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php @@ -0,0 +1,19 @@ + + * + * 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ExceptionInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ExceptionInterface.php new file mode 100644 index 0000000..f5e9099 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ExceptionInterface.php @@ -0,0 +1,22 @@ + + * + * 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 ExceptionInterface for Dependency Injection component. + * + * @author Fabien Potencier + * @author Bulat Shakirzyanov + */ +interface ExceptionInterface +{ +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php new file mode 100644 index 0000000..6b3dd3e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php @@ -0,0 +1,41 @@ + + * + * 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 you try to create a service of an inactive scope. + * + * @author Johannes M. Schmitt + */ +class InactiveScopeException extends RuntimeException +{ + private $serviceId; + private $scope; + + public function __construct($serviceId, $scope, \Exception $previous = null) + { + parent::__construct(sprintf('You cannot create a service ("%s") of an inactive scope ("%s").', $serviceId, $scope), 0, $previous); + + $this->serviceId = $serviceId; + $this->scope = $scope; + } + + public function getServiceId() + { + return $this->serviceId; + } + + public function getScope() + { + return $this->scope; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..119bb7d --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php @@ -0,0 +1,21 @@ + + * + * 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/LogicException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/LogicException.php new file mode 100644 index 0000000..17a070c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/LogicException.php @@ -0,0 +1,19 @@ + + * + * 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php new file mode 100644 index 0000000..a61f143 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php @@ -0,0 +1,19 @@ + + * + * 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php new file mode 100644 index 0000000..2915176 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php @@ -0,0 +1,34 @@ + + * + * 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 $parameters; + + public function __construct($parameters, \Exception $previous = null) + { + parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous); + + $this->parameters = $parameters; + } + + public function getParameters() + { + return $this->parameters; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php new file mode 100644 index 0000000..b529f0f --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php @@ -0,0 +1,95 @@ + + * + * 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 non-existent parameter is used. + * + * @author Fabien Potencier + */ +class ParameterNotFoundException extends InvalidArgumentException +{ + private $key; + private $sourceId; + private $sourceKey; + private $alternatives; + + /** + * Constructor. + * + * @param string $key The requested parameter key + * @param string $sourceId The service id that references the non-existent parameter + * @param string $sourceKey The parameter key that references the non-existent parameter + * @param \Exception $previous The previous exception + * @param string[] $alternatives Some parameter name alternatives + */ + public function __construct($key, $sourceId = null, $sourceKey = null, \Exception $previous = null, array $alternatives = array()) + { + $this->key = $key; + $this->sourceId = $sourceId; + $this->sourceKey = $sourceKey; + $this->alternatives = $alternatives; + + parent::__construct('', 0, $previous); + + $this->updateRepr(); + } + + 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); + } 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).'"?'; + } + } + + public function getKey() + { + return $this->key; + } + + public function getSourceId() + { + return $this->sourceId; + } + + public function getSourceKey() + { + return $this->sourceKey; + } + + public function setSourceId($sourceId) + { + $this->sourceId = $sourceId; + + $this->updateRepr(); + } + + public function setSourceKey($sourceKey) + { + $this->sourceKey = $sourceKey; + + $this->updateRepr(); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/RuntimeException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/RuntimeException.php new file mode 100644 index 0000000..5c24541 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/RuntimeException.php @@ -0,0 +1,21 @@ + + * + * 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php new file mode 100644 index 0000000..661fbab --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php @@ -0,0 +1,65 @@ + + * + * 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 the a scope crossing injection is detected. + * + * @author Johannes M. Schmitt + */ +class ScopeCrossingInjectionException extends RuntimeException +{ + private $sourceServiceId; + private $sourceScope; + private $destServiceId; + private $destScope; + + public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope, \Exception $previous = null) + { + parent::__construct(sprintf( + 'Scope Crossing Injection detected: The definition "%s" references the service "%s" which belongs to another scope hierarchy. ' + .'This service might not be available consistently. Generally, it is safer to either move the definition "%s" to scope "%s", or ' + .'declare "%s" as a child scope of "%s". If you can be sure that the other scope is always active, you can set the reference to strict=false to get rid of this error.', + $sourceServiceId, + $destServiceId, + $sourceServiceId, + $destScope, + $sourceScope, + $destScope + ), 0, $previous); + + $this->sourceServiceId = $sourceServiceId; + $this->sourceScope = $sourceScope; + $this->destServiceId = $destServiceId; + $this->destScope = $destScope; + } + + public function getSourceServiceId() + { + return $this->sourceServiceId; + } + + public function getSourceScope() + { + return $this->sourceScope; + } + + public function getDestServiceId() + { + return $this->destServiceId; + } + + public function getDestScope() + { + return $this->destScope; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php new file mode 100644 index 0000000..86a6684 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php @@ -0,0 +1,64 @@ + + * + * 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 scope widening injection is detected. + * + * @author Johannes M. Schmitt + */ +class ScopeWideningInjectionException extends RuntimeException +{ + private $sourceServiceId; + private $sourceScope; + private $destServiceId; + private $destScope; + + public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope, \Exception $previous = null) + { + parent::__construct(sprintf( + 'Scope Widening Injection detected: The definition "%s" references the service "%s" which belongs to a narrower scope. ' + .'Generally, it is safer to either move "%s" to scope "%s" or alternatively rely on the provider pattern by injecting the container itself, and requesting the service "%s" each time it is needed. ' + .'In rare, special cases however that might not be necessary, then you can set the reference to strict=false to get rid of this error.', + $sourceServiceId, + $destServiceId, + $sourceServiceId, + $destScope, + $destServiceId + ), 0, $previous); + + $this->sourceServiceId = $sourceServiceId; + $this->sourceScope = $sourceScope; + $this->destServiceId = $destServiceId; + $this->destScope = $destScope; + } + + public function getSourceServiceId() + { + return $this->sourceServiceId; + } + + public function getSourceScope() + { + return $this->sourceScope; + } + + public function getDestServiceId() + { + return $this->destServiceId; + } + + public function getDestScope() + { + return $this->destScope; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php new file mode 100644 index 0000000..26e3fb3 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php @@ -0,0 +1,41 @@ + + * + * 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 $serviceId; + private $path; + + public function __construct($serviceId, array $path, \Exception $previous = null) + { + parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous); + + $this->serviceId = $serviceId; + $this->path = $path; + } + + public function getServiceId() + { + return $this->serviceId; + } + + public function getPath() + { + return $this->path; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php new file mode 100644 index 0000000..e65da50 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php @@ -0,0 +1,56 @@ + + * + * 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 non-existent service is requested. + * + * @author Johannes M. Schmitt + */ +class ServiceNotFoundException extends InvalidArgumentException +{ + private $id; + private $sourceId; + + public function __construct($id, $sourceId = null, \Exception $previous = null, array $alternatives = array()) + { + if (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; + } + + public function getId() + { + return $this->id; + } + + public function getSourceId() + { + return $this->sourceId; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ExpressionLanguage.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ExpressionLanguage.php new file mode 100644 index 0000000..2e7edcd --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ExpressionLanguage.php @@ -0,0 +1,42 @@ + + * + * 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\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage; + +/** + * Adds some function to the default ExpressionLanguage. + * + * To get a service, use service('request'). + * To get a parameter, use parameter('kernel.debug'). + * + * @author Fabien Potencier + */ +class ExpressionLanguage extends BaseExpressionLanguage +{ + protected function registerFunctions() + { + parent::registerFunctions(); + + $this->register('service', function ($arg) { + return sprintf('$this->get(%s)', $arg); + }, function (array $variables, $value) { + return $variables['container']->get($value); + }); + + $this->register('parameter', function ($arg) { + return sprintf('$this->getParameter(%s)', $arg); + }, function (array $variables, $value) { + return $variables['container']->getParameter($value); + }); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php new file mode 100644 index 0000000..51bff08 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php @@ -0,0 +1,33 @@ + + * + * 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; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +/** + * ConfigurationExtensionInterface is the interface implemented by container extension classes. + * + * @author Kevin Bond + */ +interface ConfigurationExtensionInterface +{ + /** + * Returns extension configuration + * + * @param array $config An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @return ConfigurationInterface|null The configuration or null + */ + public function getConfiguration(array $config, ContainerBuilder $container); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/Extension.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/Extension.php new file mode 100644 index 0000000..f8e058b --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/Extension.php @@ -0,0 +1,124 @@ + + * + * 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\Container; +use Symfony\Component\DependencyInjection\Exception\BadMethodCallException; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Config\Definition\Processor; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +/** + * Provides useful features shared by many extensions. + * + * @author Fabien Potencier + */ +abstract class Extension implements ExtensionInterface, ConfigurationExtensionInterface +{ + /** + * Returns the base path for the XSD files. + * + * @return string The XSD base path + */ + public function getXsdValidationBasePath() + { + return false; + } + + /** + * Returns the namespace to be used for this extension (XML namespace). + * + * @return string The XML namespace + */ + 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. + * + * @return string The alias + * + * @throws BadMethodCallException When the extension name does not follow conventions + */ + public function getAlias() + { + $className = get_class($this); + if (substr($className, -9) != '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); + } + + /** + * {@inheritdoc} + */ + public function getConfiguration(array $config, ContainerBuilder $container) + { + $reflected = new \ReflectionClass($this); + $namespace = $reflected->getNamespaceName(); + + $class = $namespace.'\\Configuration'; + if (class_exists($class)) { + $r = new \ReflectionClass($class); + $container->addResource(new FileResource($r->getFileName())); + + if (!method_exists($class, '__construct')) { + $configuration = new $class(); + + return $configuration; + } + } + } + + final protected function processConfiguration(ConfigurationInterface $configuration, array $configs) + { + $processor = new Processor(); + + return $processor->processConfiguration($configuration, $configs); + } + + /** + * @param ContainerBuilder $container + * @param array $config + * + * @return bool Whether the configuration is enabled + * + * @throws InvalidArgumentException When the config is not enableable + */ + protected function isConfigEnabled(ContainerBuilder $container, array $config) + { + 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php new file mode 100644 index 0000000..424f020 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php @@ -0,0 +1,65 @@ + + * + * 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 + * + * @api + */ +interface ExtensionInterface +{ + /** + * Loads a specific configuration. + * + * @param array $config An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @throws \InvalidArgumentException When provided tag is not defined in this extension + * + * @api + */ + public function load(array $config, ContainerBuilder $container); + + /** + * Returns the namespace to be used for this extension (XML namespace). + * + * @return string The XML namespace + * + * @api + */ + public function getNamespace(); + + /** + * Returns the base path for the XSD files. + * + * @return string The XSD base path + * + * @api + */ + 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 The alias + * + * @api + */ + public function getAlias(); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php new file mode 100644 index 0000000..c666bdb --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/PrependExtensionInterface.php @@ -0,0 +1,24 @@ + + * + * 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. + * + * @param ContainerBuilder $container + */ + public function prepend(ContainerBuilder $container); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php new file mode 100644 index 0000000..df6f7f9 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection; + +/** + * IntrospectableContainerInterface defines additional introspection functionality + * for containers, allowing logic to be implemented based on a Container's state. + * + * @author Evan Villemez + * + */ +interface IntrospectableContainerInterface extends ContainerInterface +{ + /** + * Check for whether or not a service has been initialized. + * + * @param string $id + * + * @return bool true if the service has been initialized, false otherwise + * + */ + public function initialized($id); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE new file mode 100644 index 0000000..0b3292c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2014 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/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/InstantiatorInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/InstantiatorInterface.php new file mode 100644 index 0000000..a8dd525 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/InstantiatorInterface.php @@ -0,0 +1,37 @@ + + * + * 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 ContainerInterface $container the container from which the service is being requested + * @param Definition $definition the definition of the requested service + * @param string $id identifier of the requested service + * @param callable $realInstantiator zero-argument callback that is capable of producing the real + * service instance + * + * @return object + */ + public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php new file mode 100644 index 0000000..cad9320 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/Instantiator/RealServiceInstantiator.php @@ -0,0 +1,33 @@ + + * + * 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; + +/** + * {@inheritdoc} + * + * Noop proxy instantiator - simply produces the real service instead of a proxy instance. + * + * @author Marco Pivetta + */ +class RealServiceInstantiator implements InstantiatorInterface +{ + /** + * {@inheritdoc} + */ + public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator) + { + return call_user_func($realInstantiator); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php new file mode 100644 index 0000000..878d965 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php @@ -0,0 +1,50 @@ + + * + * 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 Definition $definition + * + * @return bool + */ + public function isProxyCandidate(Definition $definition); + + /** + * Generates the code to be used to instantiate a proxy in the dumped factory code. + * + * @param Definition $definition + * @param string $id service identifier + * + * @return string + */ + public function getProxyFactoryCode(Definition $definition, $id); + + /** + * Generates the code for the lazy proxy. + * + * @param Definition $definition + * + * @return string + */ + public function getProxyCode(Definition $definition); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php new file mode 100644 index 0000000..30911d3 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/NullDumper.php @@ -0,0 +1,46 @@ + + * + * 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 + */ +class NullDumper implements DumperInterface +{ + /** + * {@inheritdoc} + */ + public function isProxyCandidate(Definition $definition) + { + return false; + } + + /** + * {@inheritdoc} + */ + public function getProxyFactoryCode(Definition $definition, $id) + { + return ''; + } + + /** + * {@inheritdoc} + */ + public function getProxyCode(Definition $definition) + { + return ''; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php new file mode 100644 index 0000000..a5b4e5a --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php @@ -0,0 +1,53 @@ + + * + * 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\ContainerBuilder; +use Symfony\Component\Config\Loader\Loader; + +/** + * 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 $container; + + /** + * Constructor. + * + * @param ContainerBuilder $container A ContainerBuilder instance + */ + public function __construct(ContainerBuilder $container) + { + $this->container = $container; + } + + /** + * {@inheritdoc} + */ + public function load($resource, $type = null) + { + call_user_func($resource, $this->container); + } + + /** + * {@inheritdoc} + */ + public function supports($resource, $type = null) + { + return $resource instanceof \Closure; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/FileLoader.php new file mode 100644 index 0000000..d71eecf --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/FileLoader.php @@ -0,0 +1,39 @@ + + * + * 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\ContainerBuilder; +use Symfony\Component\Config\Loader\FileLoader as BaseFileLoader; +use Symfony\Component\Config\FileLocatorInterface; + +/** + * FileLoader is the abstract class used by all built-in loaders that are file based. + * + * @author Fabien Potencier + */ +abstract class FileLoader extends BaseFileLoader +{ + protected $container; + + /** + * Constructor. + * + * @param ContainerBuilder $container A ContainerBuilder instance + * @param FileLocatorInterface $locator A FileLocator instance + */ + public function __construct(ContainerBuilder $container, FileLocatorInterface $locator) + { + $this->container = $container; + + parent::__construct($locator); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php new file mode 100644 index 0000000..16ddf87 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php @@ -0,0 +1,52 @@ + + * + * 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\Resource\FileResource; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; + +/** + * IniFileLoader loads parameters from INI files. + * + * @author Fabien Potencier + */ +class IniFileLoader extends FileLoader +{ + /** + * {@inheritdoc} + */ + public function load($resource, $type = null) + { + $path = $this->locator->locate($resource); + + $this->container->addResource(new FileResource($path)); + + $result = parse_ini_file($path, true); + if (false === $result || array() === $result) { + throw new InvalidArgumentException(sprintf('The "%s" file is not valid.', $resource)); + } + + if (isset($result['parameters']) && is_array($result['parameters'])) { + foreach ($result['parameters'] as $key => $value) { + $this->container->setParameter($key, $value); + } + } + } + + /** + * {@inheritdoc} + */ + public function supports($resource, $type = null) + { + return is_string($resource) && 'ini' === pathinfo($resource, PATHINFO_EXTENSION); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php new file mode 100644 index 0000000..08c1d9a --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php @@ -0,0 +1,49 @@ + + * + * 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\Resource\FileResource; + +/** + * 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 +{ + /** + * {@inheritdoc} + */ + public function load($resource, $type = null) + { + // 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->addResource(new FileResource($path)); + + include $path; + } + + /** + * {@inheritdoc} + */ + public function supports($resource, $type = null) + { + return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php new file mode 100644 index 0000000..a8be1e2 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -0,0 +1,528 @@ + + * + * 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\Resource\FileResource; +use Symfony\Component\Config\Util\XmlUtils; +use Symfony\Component\DependencyInjection\DefinitionDecorator; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\ExpressionLanguage\Expression; + +/** + * XmlFileLoader loads XML files service definitions. + * + * @author Fabien Potencier + */ +class XmlFileLoader extends FileLoader +{ + const NS = 'http://symfony.com/schema/dic/services'; + + /** + * {@inheritdoc} + */ + public function load($resource, $type = null) + { + $path = $this->locator->locate($resource); + + $xml = $this->parseFileToDOM($path); + + $this->container->addResource(new FileResource($path)); + + // anonymous services + $this->processAnonymousServices($xml, $path); + + // imports + $this->parseImports($xml, $path); + + // parameters + $this->parseParameters($xml, $path); + + // extensions + $this->loadFromExtensions($xml); + + // services + $this->parseDefinitions($xml, $path); + } + + /** + * {@inheritdoc} + */ + public function supports($resource, $type = null) + { + return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION); + } + + /** + * Parses parameters + * + * @param \DOMDocument $xml + * @param string $file + */ + private function parseParameters(\DOMDocument $xml, $file) + { + if ($parameters = $this->getChildren($xml->documentElement, 'parameters')) { + $this->container->getParameterBag()->add($this->getArgumentsAsPhp($parameters[0], 'parameter')); + } + } + + /** + * Parses imports + * + * @param \DOMDocument $xml + * @param string $file + */ + private function parseImports(\DOMDocument $xml, $file) + { + $xpath = new \DOMXPath($xml); + $xpath->registerNamespace('container', self::NS); + + if (false === $imports = $xpath->query('//container:imports/container:import')) { + return; + } + + foreach ($imports as $import) { + $this->setCurrentDir(dirname($file)); + $this->import($import->getAttribute('resource'), null, (bool) XmlUtils::phpize($import->getAttribute('ignore-errors')), $file); + } + } + + /** + * Parses multiple definitions + * + * @param \DOMDocument $xml + * @param string $file + */ + private function parseDefinitions(\DOMDocument $xml, $file) + { + $xpath = new \DOMXPath($xml); + $xpath->registerNamespace('container', self::NS); + + if (false === $services = $xpath->query('//container:services/container:service')) { + return; + } + + foreach ($services as $service) { + $this->parseDefinition((string) $service->getAttribute('id'), $service, $file); + } + } + + /** + * Parses an individual Definition + * + * @param string $id + * @param \DOMElement $service + * @param string $file + */ + private function parseDefinition($id, \DOMElement $service, $file) + { + if ($alias = $service->getAttribute('alias')) { + $public = true; + if ($publicAttr = $service->getAttribute('public')) { + $public = XmlUtils::phpize($publicAttr); + } + $this->container->setAlias($id, new Alias($alias, $public)); + + return; + } + + if ($parent = $service->getAttribute('parent')) { + $definition = new DefinitionDecorator($parent); + } else { + $definition = new Definition(); + } + + foreach (array('class', 'scope', 'public', 'factory-class', 'factory-method', 'factory-service', 'synthetic', 'synchronized', 'lazy', 'abstract') as $key) { + if ($value = $service->getAttribute($key)) { + $method = 'set'.str_replace('-', '', $key); + $definition->$method(XmlUtils::phpize($value)); + } + } + + if ($files = $this->getChildren($service, 'file')) { + $definition->setFile($files[0]->nodeValue); + } + + $definition->setArguments($this->getArgumentsAsPhp($service, 'argument')); + $definition->setProperties($this->getArgumentsAsPhp($service, 'property')); + + 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, false); + } else { + $class = $configurator->getAttribute('class'); + } + + $definition->setConfigurator(array($class, $configurator->getAttribute('method'))); + } + } + + foreach ($this->getChildren($service, 'call') as $call) { + $definition->addMethodCall($call->getAttribute('method'), $this->getArgumentsAsPhp($call, 'argument')); + } + + foreach ($this->getChildren($service, 'tag') as $tag) { + $parameters = array(); + foreach ($tag->attributes as $name => $node) { + if ('name' === $name) { + continue; + } + + if (false !== strpos($name, '-') && false === strpos($name, '_') && !array_key_exists($normalizedName = str_replace('-', '_', $name), $parameters)) { + $parameters[$normalizedName] = XmlUtils::phpize($node->nodeValue); + } + // keep not normalized key for BC too + $parameters[$name] = XmlUtils::phpize($node->nodeValue); + } + + $definition->addTag($tag->getAttribute('name'), $parameters); + } + + if ($value = $service->getAttribute('decorates')) { + $renameId = $service->hasAttribute('decoration-inner-name') ? $service->getAttribute('decoration-inner-name') : null; + $definition->setDecoratedService($value, $renameId); + } + + $this->container->setDefinition($id, $definition); + } + + /** + * Parses a XML file to a \DOMDocument + * + * @param string $file Path to a file + * + * @return \DOMDocument + * + * @throws InvalidArgumentException When loading of XML file returns error + */ + private function parseFileToDOM($file) + { + try { + $dom = XmlUtils::loadFile($file, array($this, 'validateSchema')); + } catch (\InvalidArgumentException $e) { + throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e); + } + + $this->validateExtensions($dom, $file); + + return $dom; + } + + /** + * Processes anonymous services + * + * @param \DOMDocument $xml + * @param string $file + */ + private function processAnonymousServices(\DOMDocument $xml, $file) + { + $definitions = array(); + $count = 0; + + $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)]')) { + foreach ($nodes as $node) { + // give it a unique name + $id = sprintf('%s_%d', hash('sha256', $file), ++$count); + $node->setAttribute('id', $id); + + if ($services = $this->getChildren($node, 'service')) { + $definitions[$id] = array($services[0], $file, false); + $services[0]->setAttribute('id', $id); + } + } + } + + // anonymous services "in the wild" + if (false !== $nodes = $xpath->query('//container:services/container:service[not(@id)]')) { + foreach ($nodes as $node) { + // give it a unique name + $id = sprintf('%s_%d', hash('sha256', $file), ++$count); + $node->setAttribute('id', $id); + + if ($services = $this->getChildren($node, 'service')) { + $definitions[$id] = array($node, $file, true); + $services[0]->setAttribute('id', $id); + } + } + } + + // resolve definitions + krsort($definitions); + foreach ($definitions as $id => $def) { + list($domElement, $file, $wild) = $def; + + // anonymous services are always private + // we could not use the constant false here, because of XML parsing + $domElement->setAttribute('public', 'false'); + + $this->parseDefinition($id, $domElement, $file); + + if (true === $wild) { + $tmpDomElement = new \DOMElement('_services', null, self::NS); + $domElement->parentNode->replaceChild($tmpDomElement, $domElement); + $tmpDomElement->setAttribute('id', $id); + } else { + $domElement->parentNode->removeChild($domElement); + } + } + } + + /** + * Returns arguments as valid php types. + * + * @param \DOMElement $node + * @param string $name + * @param bool $lowercase + * + * @return mixed + */ + private function getArgumentsAsPhp(\DOMElement $node, $name, $lowercase = true) + { + $arguments = array(); + foreach ($this->getChildren($node, $name) as $arg) { + if ($arg->hasAttribute('name')) { + $arg->setAttribute('key', $arg->getAttribute('name')); + } + + if (!$arg->hasAttribute('key')) { + $key = !$arguments ? 0 : max(array_keys($arguments)) + 1; + } else { + $key = $arg->getAttribute('key'); + } + + // parameter keys are case insensitive + if ('parameter' == $name && $lowercase) { + $key = strtolower($key); + } + + // this is used by DefinitionDecorator to overwrite a specific + // argument of the parent definition + if ($arg->hasAttribute('index')) { + $key = 'index_'.$arg->getAttribute('index'); + } + + switch ($arg->getAttribute('type')) { + case 'service': + $onInvalid = $arg->getAttribute('on-invalid'); + $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; + if ('ignore' == $onInvalid) { + $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; + } elseif ('null' == $onInvalid) { + $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; + } + + if ($strict = $arg->getAttribute('strict')) { + $strict = XmlUtils::phpize($strict); + } else { + $strict = true; + } + + $arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior, $strict); + break; + case 'expression': + $arguments[$key] = new Expression($arg->nodeValue); + break; + case 'collection': + $arguments[$key] = $this->getArgumentsAsPhp($arg, $name, false); + break; + case 'string': + $arguments[$key] = $arg->nodeValue; + break; + case 'constant': + $arguments[$key] = constant($arg->nodeValue); + break; + default: + $arguments[$key] = XmlUtils::phpize($arg->nodeValue); + } + } + + return $arguments; + } + + /** + * Get child elements by name + * + * @param \DOMNode $node + * @param mixed $name + * + * @return array + */ + private function getChildren(\DOMNode $node, $name) + { + $children = array(); + foreach ($node->childNodes as $child) { + if ($child instanceof \DOMElement && $child->localName === $name && $child->namespaceURI === self::NS) { + $children[] = $child; + } + } + + return $children; + } + + /** + * Validates a documents XML schema. + * + * @param \DOMDocument $dom + * + * @return bool + * + * @throws RuntimeException When extension references a non-existent XSD file + */ + public function validateSchema(\DOMDocument $dom) + { + $schemaLocations = array('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()) { + $path = str_replace($extension->getNamespace(), 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_class($extension), $path)); + } + + $schemaLocations[$items[$i]] = $path; + } + } + } + + $tmpfiles = array(); + $imports = ''; + foreach ($schemaLocations as $namespace => $location) { + $parts = explode('/', $location); + if (0 === stripos($location, 'phar://')) { + $tmpfile = tempnam(sys_get_temp_dir(), 'sf2'); + if ($tmpfile) { + copy($location, $tmpfile); + $tmpfiles[] = $tmpfile; + $parts = explode('/', str_replace('\\', '/', $tmpfile)); + } + } + $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; + $location = 'file:///'.$drive.implode('/', array_map('rawurlencode', $parts)); + + $imports .= sprintf(' '."\n", $namespace, $location); + } + + $source = << + + + +$imports + +EOF + ; + + $valid = @$dom->schemaValidateSource($source); + + foreach ($tmpfiles as $tmpfile) { + @unlink($tmpfile); + } + + return $valid; + } + + /** + * Validates an extension. + * + * @param \DOMDocument $dom + * @param string $file + * + * @throws InvalidArgumentException When no extension is found corresponding to a tag + */ + private function validateExtensions(\DOMDocument $dom, $file) + { + 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(function ($ext) { return $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 ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none' + )); + } + } + } + + /** + * Loads from an extension. + * + * @param \DOMDocument $xml + */ + private function loadFromExtensions(\DOMDocument $xml) + { + foreach ($xml->documentElement->childNodes as $node) { + if (!$node instanceof \DOMElement || $node->namespaceURI === self::NS) { + continue; + } + + $values = static::convertDomElementToArray($node); + if (!is_array($values)) { + $values = array(); + } + + $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 + * + * @return array A PHP array + */ + public static function convertDomElementToArray(\DomElement $element) + { + return XmlUtils::convertDomElementToArray($element); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php new file mode 100644 index 0000000..029a58b --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -0,0 +1,392 @@ + + * + * 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\DefinitionDecorator; +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Yaml\Parser as YamlParser; +use Symfony\Component\ExpressionLanguage\Expression; + +/** + * YamlFileLoader loads YAML files service definitions. + * + * The YAML format does not support anonymous services (cf. the XML loader). + * + * @author Fabien Potencier + */ +class YamlFileLoader extends FileLoader +{ + private $yamlParser; + + /** + * {@inheritdoc} + */ + public function load($resource, $type = null) + { + $path = $this->locator->locate($resource); + + $content = $this->loadFile($path); + + $this->container->addResource(new FileResource($path)); + + // empty file + if (null === $content) { + return; + } + + // 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.', $resource)); + } + + foreach ($content['parameters'] as $key => $value) { + $this->container->setParameter($key, $this->resolveServices($value)); + } + } + + // extensions + $this->loadFromExtensions($content); + + // services + $this->parseDefinitions($content, $resource); + } + + /** + * {@inheritdoc} + */ + public function supports($resource, $type = null) + { + return is_string($resource) && 'yml' === pathinfo($resource, PATHINFO_EXTENSION); + } + + /** + * Parses all imports + * + * @param array $content + * @param string $file + */ + private function parseImports($content, $file) + { + 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)); + } + + foreach ($content['imports'] as $import) { + if (!is_array($import)) { + throw new InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file)); + } + + $this->setCurrentDir(dirname($file)); + $this->import($import['resource'], null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false, $file); + } + } + + /** + * Parses definitions + * + * @param array $content + * @param string $file + */ + private function parseDefinitions($content, $file) + { + 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)); + } + + foreach ($content['services'] as $id => $service) { + $this->parseDefinition($id, $service, $file); + } + } + + /** + * Parses a definition. + * + * @param string $id + * @param array $service + * @param string $file + * + * @throws InvalidArgumentException When tags are invalid + */ + private function parseDefinition($id, $service, $file) + { + if (is_string($service) && 0 === strpos($service, '@')) { + $this->container->setAlias($id, substr($service, 1)); + + return; + } + + 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.', gettype($service), $id, $file)); + } + + if (isset($service['alias'])) { + $public = !array_key_exists('public', $service) || (bool) $service['public']; + $this->container->setAlias($id, new Alias($service['alias'], $public)); + + return; + } + + if (isset($service['parent'])) { + $definition = new DefinitionDecorator($service['parent']); + } else { + $definition = new Definition(); + } + + if (isset($service['class'])) { + $definition->setClass($service['class']); + } + + if (isset($service['scope'])) { + $definition->setScope($service['scope']); + } + + if (isset($service['synthetic'])) { + $definition->setSynthetic($service['synthetic']); + } + + if (isset($service['synchronized'])) { + $definition->setSynchronized($service['synchronized']); + } + + if (isset($service['lazy'])) { + $definition->setLazy($service['lazy']); + } + + if (isset($service['public'])) { + $definition->setPublic($service['public']); + } + + if (isset($service['abstract'])) { + $definition->setAbstract($service['abstract']); + } + + if (isset($service['factory_class'])) { + $definition->setFactoryClass($service['factory_class']); + } + + if (isset($service['factory_method'])) { + $definition->setFactoryMethod($service['factory_method']); + } + + if (isset($service['factory_service'])) { + $definition->setFactoryService($service['factory_service']); + } + + if (isset($service['file'])) { + $definition->setFile($service['file']); + } + + if (isset($service['arguments'])) { + $definition->setArguments($this->resolveServices($service['arguments'])); + } + + if (isset($service['properties'])) { + $definition->setProperties($this->resolveServices($service['properties'])); + } + + if (isset($service['configurator'])) { + if (is_string($service['configurator'])) { + $definition->setConfigurator($service['configurator']); + } else { + $definition->setConfigurator(array($this->resolveServices($service['configurator'][0]), $service['configurator'][1])); + } + } + + 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 $call) { + $args = isset($call[1]) ? $this->resolveServices($call[1]) : array(); + $definition->addMethodCall($call[0], $args); + } + } + + if (isset($service['tags'])) { + if (!is_array($service['tags'])) { + throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file)); + } + + foreach ($service['tags'] as $tag) { + if (!is_array($tag)) { + throw new InvalidArgumentException(sprintf('A "tags" entry must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file)); + } + + 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']); + + foreach ($tag as $attribute => $value) { + if (!is_scalar($value) && null !== $value) { + throw new InvalidArgumentException(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, $attribute, $file)); + } + } + + $definition->addTag($name, $tag); + } + } + + if (isset($service['decorates'])) { + $renameId = isset($service['decoration_inner_name']) ? $service['decoration_inner_name'] : null; + $definition->setDecoratedService($service['decorates'], $renameId); + } + + $this->container->setDefinition($id, $definition); + } + + /** + * Loads a YAML file. + * + * @param string $file + * + * @return array The file content + * + * @throws InvalidArgumentException when the given file is not a local file or when it does not exist + */ + protected function loadFile($file) + { + if (!stream_is_local($file)) { + throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file)); + } + + if (!file_exists($file)) { + throw new InvalidArgumentException(sprintf('The service file "%s" is not valid.', $file)); + } + + if (null === $this->yamlParser) { + $this->yamlParser = new YamlParser(); + } + + return $this->validate($this->yamlParser->parse(file_get_contents($file)), $file); + } + + /** + * Validates a YAML file. + * + * @param mixed $content + * @param string $file + * + * @return array + * + * @throws InvalidArgumentException When service file is not valid + */ + private function validate($content, $file) + { + 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 (array_keys($content) as $namespace) { + if (in_array($namespace, array('imports', 'parameters', 'services'))) { + continue; + } + + if (!$this->container->hasExtension($namespace)) { + $extensionNamespaces = array_filter(array_map(function ($ext) { return $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; + } + + /** + * Resolves services. + * + * @param string|array $value + * + * @return array|string|Reference + */ + private function resolveServices($value) + { + if (is_array($value)) { + $value = array_map(array($this, 'resolveServices'), $value); + } elseif (is_string($value) && 0 === strpos($value, '@=')) { + return new Expression(substr($value, 2)); + } elseif (is_string($value) && 0 === strpos($value, '@')) { + if (0 === strpos($value, '@@')) { + $value = substr($value, 1); + $invalidBehavior = null; + } elseif (0 === strpos($value, '@?')) { + $value = substr($value, 2); + $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; + } else { + $value = substr($value, 1); + $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; + } + + if ('=' === substr($value, -1)) { + $value = substr($value, 0, -1); + $strict = false; + } else { + $strict = true; + } + + if (null !== $invalidBehavior) { + $value = new Reference($value, $invalidBehavior, $strict); + } + } + + return $value; + } + + /** + * Loads from Extensions + * + * @param array $content + */ + private function loadFromExtensions($content) + { + foreach ($content as $namespace => $values) { + if (in_array($namespace, array('imports', 'parameters', 'services'))) { + continue; + } + + if (!is_array($values)) { + $values = array(); + } + + $this->container->loadFromExtension($namespace, $values); + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd new file mode 100644 index 0000000..54a4544 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Parameter.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Parameter.php new file mode 100644 index 0000000..7ba8c3a --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Parameter.php @@ -0,0 +1,44 @@ + + * + * 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 + * + * @api + */ +class Parameter +{ + private $id; + + /** + * Constructor. + * + * @param string $id The parameter key + */ + public function __construct($id) + { + $this->id = $id; + } + + /** + * __toString. + * + * @return string The parameter key + */ + public function __toString() + { + return (string) $this->id; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php new file mode 100644 index 0000000..dc936a0 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php @@ -0,0 +1,72 @@ + + * + * 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 + * + * @api + */ +class FrozenParameterBag extends ParameterBag +{ + /** + * Constructor. + * + * For performance reasons, the constructor assumes that + * all keys are already lowercased. + * + * This is always the case when used internally. + * + * @param array $parameters An array of parameters + * + * @api + */ + public function __construct(array $parameters = array()) + { + $this->parameters = $parameters; + $this->resolved = true; + } + + /** + * {@inheritdoc} + * + * @api + */ + public function clear() + { + throw new LogicException('Impossible to call clear() on a frozen ParameterBag.'); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function add(array $parameters) + { + throw new LogicException('Impossible to call add() on a frozen ParameterBag.'); + } + + /** + * {@inheritdoc} + * + * @api + */ + public function set($name, $value) + { + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php new file mode 100644 index 0000000..12cc481 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -0,0 +1,304 @@ + + * + * 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\ParameterNotFoundException; +use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; + +/** + * Holds parameters. + * + * @author Fabien Potencier + * + * @api + */ +class ParameterBag implements ParameterBagInterface +{ + protected $parameters = array(); + protected $resolved = false; + + /** + * Constructor. + * + * @param array $parameters An array of parameters + * + * @api + */ + public function __construct(array $parameters = array()) + { + $this->add($parameters); + } + + /** + * Clears all parameters. + * + * @api + */ + public function clear() + { + $this->parameters = array(); + } + + /** + * Adds parameters to the service container parameters. + * + * @param array $parameters An array of parameters + * + * @api + */ + public function add(array $parameters) + { + foreach ($parameters as $key => $value) { + $this->parameters[strtolower($key)] = $value; + } + } + + /** + * Gets the service container parameters. + * + * @return array An array of parameters + * + * @api + */ + public function all() + { + return $this->parameters; + } + + /** + * Gets a service container parameter. + * + * @param string $name The parameter name + * + * @return mixed The parameter value + * + * @throws ParameterNotFoundException if the parameter is not defined + * + * @api + */ + public function get($name) + { + $name = strtolower($name); + + if (!array_key_exists($name, $this->parameters)) { + if (!$name) { + throw new ParameterNotFoundException($name); + } + + $alternatives = array(); + foreach (array_keys($this->parameters) as $key) { + $lev = levenshtein($name, $key); + if ($lev <= strlen($name) / 3 || false !== strpos($key, $name)) { + $alternatives[] = $key; + } + } + + throw new ParameterNotFoundException($name, null, null, null, $alternatives); + } + + return $this->parameters[$name]; + } + + /** + * Sets a service container parameter. + * + * @param string $name The parameter name + * @param mixed $value The parameter value + * + * @api + */ + public function set($name, $value) + { + $this->parameters[strtolower($name)] = $value; + } + + /** + * Returns true if a parameter name is defined. + * + * @param string $name The parameter name + * + * @return bool true if the parameter name is defined, false otherwise + * + * @api + */ + public function has($name) + { + return array_key_exists(strtolower($name), $this->parameters); + } + + /** + * Removes a parameter. + * + * @param string $name The parameter name + * + * @api + */ + public function remove($name) + { + unset($this->parameters[strtolower($name)]); + } + + /** + * Replaces parameter placeholders (%name%) by their values for all parameters. + */ + public function resolve() + { + if ($this->resolved) { + return; + } + + $parameters = array(); + 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. + * + * @param mixed $value A value + * @param array $resolving An array of keys that are being resolved (used internally to detect circular references) + * + * @return mixed The resolved value + * + * @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($value, array $resolving = array()) + { + if (is_array($value)) { + $args = array(); + foreach ($value as $k => $v) { + $args[$this->resolveValue($k, $resolving)] = $this->resolveValue($v, $resolving); + } + + return $args; + } + + if (!is_string($value)) { + return $value; + } + + return $this->resolveString($value, $resolving); + } + + /** + * Resolves parameters inside a string + * + * @param string $value The string to resolve + * @param array $resolving An array of keys that are being resolved (used internally to detect circular references) + * + * @return string The resolved string + * + * @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($value, array $resolving = array()) + { + // 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 = strtolower($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); + } + + $self = $this; + + return preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($self, $resolving, $value) { + // skip %% + if (!isset($match[1])) { + return '%%'; + } + + $key = strtolower($match[1]); + if (isset($resolving[$key])) { + throw new ParameterCircularReferenceException(array_keys($resolving)); + } + + $resolved = $self->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, gettype($resolved), $value)); + } + + $resolved = (string) $resolved; + $resolving[$key] = true; + + return $self->isResolved() ? $resolved : $self->resolveString($resolved, $resolving); + }, $value); + } + + public function isResolved() + { + return $this->resolved; + } + + /** + * {@inheritdoc} + */ + public function escapeValue($value) + { + if (is_string($value)) { + return str_replace('%', '%%', $value); + } + + if (is_array($value)) { + $result = array(); + foreach ($value as $k => $v) { + $result[$k] = $this->escapeValue($v); + } + + return $result; + } + + return $value; + } + + public function unescapeValue($value) + { + if (is_string($value)) { + return str_replace('%%', '%', $value); + } + + if (is_array($value)) { + $result = array(); + foreach ($value as $k => $v) { + $result[$k] = $this->unescapeValue($v); + } + + return $result; + } + + return $value; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php new file mode 100644 index 0000000..8f17ff9 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php @@ -0,0 +1,115 @@ + + * + * 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\ParameterNotFoundException; + +/** + * ParameterBagInterface. + * + * @author Fabien Potencier + * + * @api + */ +interface ParameterBagInterface +{ + /** + * Clears all parameters. + * + * @api + */ + public function clear(); + + /** + * Adds parameters to the service container parameters. + * + * @param array $parameters An array of parameters + * + * @api + */ + public function add(array $parameters); + + /** + * Gets the service container parameters. + * + * @return array An array of parameters + * + * @api + */ + public function all(); + + /** + * Gets a service container parameter. + * + * @param string $name The parameter name + * + * @return mixed The parameter value + * + * @throws ParameterNotFoundException if the parameter is not defined + * + * @api + */ + public function get($name); + + /** + * Sets a service container parameter. + * + * @param string $name The parameter name + * @param mixed $value The parameter value + * + * @api + */ + public function set($name, $value); + + /** + * Returns true if a parameter name is defined. + * + * @param string $name The parameter name + * + * @return bool true if the parameter name is defined, false otherwise + * + * @api + */ + public function has($name); + + /** + * Replaces parameter placeholders (%name%) by their values for all parameters. + */ + public function resolve(); + + /** + * Replaces parameter placeholders (%name%) by their values. + * + * @param mixed $value A value + * + * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist + */ + public function resolveValue($value); + + /** + * Escape parameter placeholders % + * + * @param mixed $value + * + * @return mixed + */ + public function escapeValue($value); + + /** + * Unescape parameter placeholders % + * + * @param mixed $value + * + * @return mixed + */ + public function unescapeValue($value); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/README.md b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/README.md new file mode 100644 index 0000000..cd170ab --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/README.md @@ -0,0 +1,81 @@ +DependencyInjection Component +============================= + +DependencyInjection manages your services via a robust and flexible Dependency +Injection Container. + +Here is a simple example that shows how to register services and parameters: + +```php +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +$sc = new ContainerBuilder(); +$sc + ->register('foo', '%foo.class%') + ->addArgument(new Reference('bar')) +; +$sc->setParameter('foo.class', 'Foo'); + +$sc->get('foo'); +``` + +Method Calls (Setter Injection): + +```php +$sc = new ContainerBuilder(); + +$sc + ->register('bar', '%bar.class%') + ->addMethodCall('setFoo', array(new Reference('foo'))) +; +$sc->setParameter('bar.class', 'Bar'); + +$sc->get('bar'); +``` + +Factory Class: + +If your service is retrieved by calling a static method: + +```php +$sc = new ContainerBuilder(); + +$sc + ->register('bar', '%bar.class%') + ->setFactoryClass('%bar.class%') + ->setFactoryMethod('getInstance') + ->addArgument('Aarrg!!!') +; +$sc->setParameter('bar.class', 'Bar'); + +$sc->get('bar'); +``` + +File Include: + +For some services, especially those that are difficult or impossible to +autoload, you may need the container to include a file before +instantiating your class. + +```php +$sc = new ContainerBuilder(); + +$sc + ->register('bar', '%bar.class%') + ->setFile('/path/to/file') + ->addArgument('Aarrg!!!') +; +$sc->setParameter('bar.class', 'Bar'); + +$sc->get('bar'); +``` + +Resources +--------- + +You can run the unit tests with the following command: + + $ cd path/to/Symfony/Component/DependencyInjection/ + $ composer.phar install + $ phpunit diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Reference.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Reference.php new file mode 100644 index 0000000..56d5070 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Reference.php @@ -0,0 +1,72 @@ + + * + * 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 + * + * @api + */ +class Reference +{ + private $id; + private $invalidBehavior; + private $strict; + + /** + * Constructor. + * + * @param string $id The service identifier + * @param int $invalidBehavior The behavior when the service does not exist + * @param bool $strict Sets how this reference is validated + * + * @see Container + */ + public function __construct($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $strict = true) + { + $this->id = strtolower($id); + $this->invalidBehavior = $invalidBehavior; + $this->strict = $strict; + } + + /** + * __toString. + * + * @return string The service identifier + */ + public function __toString() + { + return $this->id; + } + + /** + * Returns the behavior to be used when the service does not exist. + * + * @return int + */ + public function getInvalidBehavior() + { + return $this->invalidBehavior; + } + + /** + * Returns true when this Reference is strict + * + * @return bool + */ + public function isStrict() + { + return $this->strict; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Scope.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Scope.php new file mode 100644 index 0000000..161229e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Scope.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection; + +/** + * Scope class. + * + * @author Johannes M. Schmitt + * + * @api + */ +class Scope implements ScopeInterface +{ + private $name; + private $parentName; + + /** + * @api + */ + public function __construct($name, $parentName = ContainerInterface::SCOPE_CONTAINER) + { + $this->name = $name; + $this->parentName = $parentName; + } + + /** + * @api + */ + public function getName() + { + return $this->name; + } + + /** + * @api + */ + public function getParentName() + { + return $this->parentName; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php new file mode 100644 index 0000000..81ac67c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection; + +/** + * Scope Interface. + * + * @author Johannes M. Schmitt + * + * @api + */ +interface ScopeInterface +{ + /** + * @api + */ + public function getName(); + + /** + * @api + */ + public function getParentName(); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php new file mode 100644 index 0000000..2e20b6c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php @@ -0,0 +1,114 @@ + + * + * 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\Config\Util\XmlUtils; +use Symfony\Component\ExpressionLanguage\Expression; + +/** + * SimpleXMLElement class. + * + * @author Fabien Potencier + * + * @deprecated Deprecated since version 2.5, to be removed in 3.0. + */ +class SimpleXMLElement extends \SimpleXMLElement +{ + /** + * Converts an attribute as a PHP type. + * + * @param string $name + * + * @return mixed + */ + public function getAttributeAsPhp($name) + { + return self::phpize($this[$name]); + } + + /** + * Returns arguments as valid PHP types. + * + * @param string $name + * @param bool $lowercase + * + * @return mixed + */ + public function getArgumentsAsPhp($name, $lowercase = true) + { + $arguments = array(); + foreach ($this->$name as $arg) { + if (isset($arg['name'])) { + $arg['key'] = (string) $arg['name']; + } + $key = isset($arg['key']) ? (string) $arg['key'] : (!$arguments ? 0 : max(array_keys($arguments)) + 1); + + // parameter keys are case insensitive + if ('parameter' == $name && $lowercase) { + $key = strtolower($key); + } + + // this is used by DefinitionDecorator to overwrite a specific + // argument of the parent definition + if (isset($arg['index'])) { + $key = 'index_'.$arg['index']; + } + + switch ($arg['type']) { + case 'service': + $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; + if (isset($arg['on-invalid']) && 'ignore' == $arg['on-invalid']) { + $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; + } elseif (isset($arg['on-invalid']) && 'null' == $arg['on-invalid']) { + $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; + } + + if (isset($arg['strict'])) { + $strict = self::phpize($arg['strict']); + } else { + $strict = true; + } + + $arguments[$key] = new Reference((string) $arg['id'], $invalidBehavior, $strict); + break; + case 'expression': + $arguments[$key] = new Expression((string) $arg); + break; + case 'collection': + $arguments[$key] = $arg->getArgumentsAsPhp($name, false); + break; + case 'string': + $arguments[$key] = (string) $arg; + break; + case 'constant': + $arguments[$key] = constant((string) $arg); + break; + default: + $arguments[$key] = self::phpize($arg); + } + } + + return $arguments; + } + + /** + * Converts an xml value to a PHP type. + * + * @param mixed $value + * + * @return mixed + */ + public static function phpize($value) + { + return XmlUtils::phpize($value); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php new file mode 100644 index 0000000..3b48817 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php @@ -0,0 +1,33 @@ + + * + * 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 + * + * @api + */ +interface TaggedContainerInterface extends ContainerInterface +{ + /** + * Returns service ids for a given tag. + * + * @param string $name The tag name + * + * @return array An array of tags + * + * @api + */ + public function findTaggedServiceIds($name); +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php new file mode 100644 index 0000000..e45ac93 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php @@ -0,0 +1,149 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Compiler\Compiler; +use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; +use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class AnalyzeServiceReferencesPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcess() + { + $container = new ContainerBuilder(); + + $a = $container + ->register('a') + ->addArgument($ref1 = new Reference('b')) + ; + + $b = $container + ->register('b') + ->addMethodCall('setA', array($ref2 = new Reference('a'))) + ; + + $c = $container + ->register('c') + ->addArgument($ref3 = new Reference('a')) + ->addArgument($ref4 = new Reference('b')) + ; + + $d = $container + ->register('d') + ->setProperty('foo', $ref5 = new Reference('b')) + ; + + $e = $container + ->register('e') + ->setConfigurator(array($ref6 = new Reference('b'), 'methodName')) + ; + + $graph = $this->process($container); + + $this->assertCount(4, $edges = $graph->getNode('b')->getInEdges()); + + $this->assertSame($ref1, $edges[0]->getValue()); + $this->assertSame($ref4, $edges[1]->getValue()); + $this->assertSame($ref5, $edges[2]->getValue()); + $this->assertSame($ref6, $edges[3]->getValue()); + } + + public function testProcessDetectsReferencesFromInlinedDefinitions() + { + $container = new ContainerBuilder(); + + $container + ->register('a') + ; + + $container + ->register('b') + ->addArgument(new Definition(null, array($ref = new Reference('a')))) + ; + + $graph = $this->process($container); + + $this->assertCount(1, $refs = $graph->getNode('a')->getInEdges()); + $this->assertSame($ref, $refs[0]->getValue()); + } + + public function testProcessDetectsReferencesFromInlinedFactoryDefinitions() + { + $container = new ContainerBuilder(); + + $container + ->register('a') + ; + + $factory = new Definition(); + $factory->setFactoryService('a'); + + $container + ->register('b') + ->addArgument($factory) + ; + + $graph = $this->process($container); + + $this->assertTrue($graph->hasNode('a')); + $this->assertCount(1, $refs = $graph->getNode('a')->getInEdges()); + } + + public function testProcessDoesNotSaveDuplicateReferences() + { + $container = new ContainerBuilder(); + + $container + ->register('a') + ; + $container + ->register('b') + ->addArgument(new Definition(null, array($ref1 = new Reference('a')))) + ->addArgument(new Definition(null, array($ref2 = new Reference('a')))) + ; + + $graph = $this->process($container); + + $this->assertCount(2, $graph->getNode('a')->getInEdges()); + } + + public function testProcessDetectsFactoryReferences() + { + $container = new ContainerBuilder(); + + $container + ->register('foo', 'stdClass') + ->setFactoryClass('stdClass') + ->setFactoryMethod('getInstance'); + + $container + ->register('bar', 'stdClass') + ->setFactoryService('foo') + ->setFactoryMethod('getInstance'); + + $graph = $this->process($container); + + $this->assertTrue($graph->hasNode('foo')); + $this->assertCount(1, $graph->getNode('foo')->getInEdges()); + } + + protected function process(ContainerBuilder $container) + { + $pass = new RepeatedPass(array(new AnalyzeServiceReferencesPass())); + $pass->process($container); + + return $container->getCompiler()->getServiceReferenceGraph(); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php new file mode 100644 index 0000000..8183014 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php @@ -0,0 +1,137 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Reference; + +use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass; + +use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; + +use Symfony\Component\DependencyInjection\Compiler\Compiler; + +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class CheckCircularReferencesPassTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + */ + public function testProcess() + { + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addArgument(new Reference('a')); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + */ + public function testProcessWithAliases() + { + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->setAlias('b', 'c'); + $container->setAlias('c', 'a'); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + */ + public function testProcessWithFactory() + { + $container = new ContainerBuilder(); + + $container + ->register('a', 'stdClass') + ->setFactoryService('b') + ->setFactoryMethod('getInstance'); + + $container + ->register('b', 'stdClass') + ->setFactoryService('a') + ->setFactoryMethod('getInstance'); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + */ + public function testProcessDetectsIndirectCircularReference() + { + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addArgument(new Reference('c')); + $container->register('c')->addArgument(new Reference('a')); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + */ + public function testProcessDetectsIndirectCircularReferenceWithFactory() + { + $container = new ContainerBuilder(); + + $container->register('a')->addArgument(new Reference('b')); + + $container + ->register('b', 'stdClass') + ->setFactoryService('c') + ->setFactoryMethod('getInstance'); + + $container->register('c')->addArgument(new Reference('a')); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + */ + public function testDeepCircularReference() + { + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addArgument(new Reference('c')); + $container->register('c')->addArgument(new Reference('b')); + + $this->process($container); + } + + public function testProcessIgnoresMethodCalls() + { + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->addMethodCall('setA', array(new Reference('a'))); + + $this->process($container); + } + + protected function process(ContainerBuilder $container) + { + $compiler = new Compiler(); + $passConfig = $compiler->getPassConfig(); + $passConfig->setOptimizationPasses(array( + new AnalyzeServiceReferencesPass(true), + new CheckCircularReferencesPass(), + )); + $passConfig->setRemovingPasses(array()); + + $compiler->compile($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php new file mode 100644 index 0000000..b5e4984 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php @@ -0,0 +1,91 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class CheckDefinitionValidityPassTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + */ + public function testProcessDetectsSyntheticNonPublicDefinitions() + { + $container = new ContainerBuilder(); + $container->register('a')->setSynthetic(true)->setPublic(false); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + */ + public function testProcessDetectsSyntheticPrototypeDefinitions() + { + $container = new ContainerBuilder(); + $container->register('a')->setSynthetic(true)->setScope(ContainerInterface::SCOPE_PROTOTYPE); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + */ + public function testProcessDetectsNonSyntheticNonAbstractDefinitionWithoutClass() + { + $container = new ContainerBuilder(); + $container->register('a')->setSynthetic(false)->setAbstract(false); + + $this->process($container); + } + + public function testProcess() + { + $container = new ContainerBuilder(); + $container->register('a', 'class'); + $container->register('b', 'class')->setSynthetic(true)->setPublic(true); + $container->register('c', 'class')->setAbstract(true); + $container->register('d', 'class')->setSynthetic(true); + + $this->process($container); + } + + public function testValidTags() + { + $container = new ContainerBuilder(); + $container->register('a', 'class')->addTag('foo', array('bar' => 'baz')); + $container->register('b', 'class')->addTag('foo', array('bar' => null)); + $container->register('c', 'class')->addTag('foo', array('bar' => 1)); + $container->register('d', 'class')->addTag('foo', array('bar' => 1.1)); + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + */ + public function testInvalidTags() + { + $container = new ContainerBuilder(); + $container->register('a', 'class')->addTag('foo', array('bar' => array('baz' => 'baz'))); + + $this->process($container); + } + + protected function process(ContainerBuilder $container) + { + $pass = new CheckDefinitionValidityPass(); + $pass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php new file mode 100644 index 0000000..e71835e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Definition; + +use Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class CheckExceptionOnInvalidReferenceBehaviorPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcess() + { + $container = new ContainerBuilder(); + + $container + ->register('a', '\stdClass') + ->addArgument(new Reference('b')) + ; + $container->register('b', '\stdClass'); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException + */ + public function testProcessThrowsExceptionOnInvalidReference() + { + $container = new ContainerBuilder(); + + $container + ->register('a', '\stdClass') + ->addArgument(new Reference('b')) + ; + + $this->process($container); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException + */ + public function testProcessThrowsExceptionOnInvalidReferenceFromInlinedDefinition() + { + $container = new ContainerBuilder(); + + $def = new Definition(); + $def->addArgument(new Reference('b')); + + $container + ->register('a', '\stdClass') + ->addArgument($def) + ; + + $this->process($container); + } + + private function process(ContainerBuilder $container) + { + $pass = new CheckExceptionOnInvalidReferenceBehaviorPass(); + $pass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php new file mode 100644 index 0000000..ee18e5c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Scope; + +use Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class CheckReferenceValidityPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcessIgnoresScopeWideningIfNonStrictReference() + { + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false)); + $container->register('b')->setScope('prototype'); + + $this->process($container); + } + + /** + * @expectedException \RuntimeException + */ + public function testProcessDetectsScopeWidening() + { + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b')->setScope('prototype'); + + $this->process($container); + } + + public function testProcessIgnoresCrossScopeHierarchyReferenceIfNotStrict() + { + $container = new ContainerBuilder(); + $container->addScope(new Scope('a')); + $container->addScope(new Scope('b')); + + $container->register('a')->setScope('a')->addArgument(new Reference('b', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false)); + $container->register('b')->setScope('b'); + + $this->process($container); + } + + /** + * @expectedException \RuntimeException + */ + public function testProcessDetectsCrossScopeHierarchyReference() + { + $container = new ContainerBuilder(); + $container->addScope(new Scope('a')); + $container->addScope(new Scope('b')); + + $container->register('a')->setScope('a')->addArgument(new Reference('b')); + $container->register('b')->setScope('b'); + + $this->process($container); + } + + /** + * @expectedException \RuntimeException + */ + public function testProcessDetectsReferenceToAbstractDefinition() + { + $container = new ContainerBuilder(); + + $container->register('a')->setAbstract(true); + $container->register('b')->addArgument(new Reference('a')); + + $this->process($container); + } + + public function testProcess() + { + $container = new ContainerBuilder(); + $container->register('a')->addArgument(new Reference('b')); + $container->register('b'); + + $this->process($container); + } + + protected function process(ContainerBuilder $container) + { + $pass = new CheckReferenceValidityPass(); + $pass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php new file mode 100644 index 0000000..e17961a --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/DecoratorServicePassTest.php @@ -0,0 +1,81 @@ +register('foo') + ->setPublic(false) + ; + $fooExtendedDefinition = $container + ->register('foo.extended') + ->setPublic(true) + ->setDecoratedService('foo') + ; + $barDefinition = $container + ->register('bar') + ->setPublic(true) + ; + $barExtendedDefinition = $container + ->register('bar.extended') + ->setPublic(true) + ->setDecoratedService('bar', 'bar.yoo') + ; + + $this->process($container); + + $this->assertEquals('foo.extended', $container->getAlias('foo')); + $this->assertFalse($container->getAlias('foo')->isPublic()); + + $this->assertEquals('bar.extended', $container->getAlias('bar')); + $this->assertTrue($container->getAlias('bar')->isPublic()); + + $this->assertSame($fooDefinition, $container->getDefinition('foo.extended.inner')); + $this->assertFalse($container->getDefinition('foo.extended.inner')->isPublic()); + + $this->assertSame($barDefinition, $container->getDefinition('bar.yoo')); + $this->assertFalse($container->getDefinition('bar.yoo')->isPublic()); + + $this->assertNull($fooExtendedDefinition->getDecoratedService()); + $this->assertNull($barExtendedDefinition->getDecoratedService()); + } + + public function testProcessWithAlias() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(true) + ; + $container->setAlias('foo.alias', new Alias('foo', false)); + $fooExtendedDefinition = $container + ->register('foo.extended') + ->setPublic(true) + ->setDecoratedService('foo.alias') + ; + + $this->process($container); + + $this->assertEquals('foo.extended', $container->getAlias('foo.alias')); + $this->assertFalse($container->getAlias('foo.alias')->isPublic()); + + $this->assertEquals('foo', $container->getAlias('foo.extended.inner')); + $this->assertFalse($container->getAlias('foo.extended.inner')->isPublic()); + + $this->assertNull($fooExtendedDefinition->getDecoratedService()); + } + + protected function process(ContainerBuilder $container) + { + $repeatedPass = new DecoratorServicePass(); + $repeatedPass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php new file mode 100644 index 0000000..fc40446 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php @@ -0,0 +1,245 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Scope; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; +use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; +use Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class InlineServiceDefinitionsPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcess() + { + $container = new ContainerBuilder(); + $container + ->register('inlinable.service') + ->setPublic(false) + ; + + $container + ->register('service') + ->setArguments(array(new Reference('inlinable.service'))) + ; + + $this->process($container); + + $arguments = $container->getDefinition('service')->getArguments(); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Definition', $arguments[0]); + $this->assertSame($container->getDefinition('inlinable.service'), $arguments[0]); + } + + public function testProcessDoesNotInlineWhenAliasedServiceIsNotOfPrototypeScope() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(false) + ; + $container->setAlias('moo', 'foo'); + + $container + ->register('service') + ->setArguments(array($ref = new Reference('foo'))) + ; + + $this->process($container); + + $arguments = $container->getDefinition('service')->getArguments(); + $this->assertSame($ref, $arguments[0]); + } + + public function testProcessDoesInlineServiceOfPrototypeScope() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setScope('prototype') + ; + $container + ->register('bar') + ->setPublic(false) + ->setScope('prototype') + ; + $container->setAlias('moo', 'bar'); + + $container + ->register('service') + ->setArguments(array(new Reference('foo'), $ref = new Reference('moo'), new Reference('bar'))) + ; + + $this->process($container); + + $arguments = $container->getDefinition('service')->getArguments(); + $this->assertEquals($container->getDefinition('foo'), $arguments[0]); + $this->assertNotSame($container->getDefinition('foo'), $arguments[0]); + $this->assertSame($ref, $arguments[1]); + $this->assertEquals($container->getDefinition('bar'), $arguments[2]); + $this->assertNotSame($container->getDefinition('bar'), $arguments[2]); + } + + public function testProcessInlinesIfMultipleReferencesButAllFromTheSameDefinition() + { + $container = new ContainerBuilder(); + + $a = $container->register('a')->setPublic(false); + $b = $container + ->register('b') + ->addArgument(new Reference('a')) + ->addArgument(new Definition(null, array(new Reference('a')))) + ; + + $this->process($container); + + $arguments = $b->getArguments(); + $this->assertSame($a, $arguments[0]); + + $inlinedArguments = $arguments[1]->getArguments(); + $this->assertSame($a, $inlinedArguments[0]); + } + + public function testProcessInlinesPrivateFactoryReference() + { + $container = new ContainerBuilder(); + + $container->register('a')->setPublic(false); + $b = $container + ->register('b') + ->setPublic(false) + ->setFactoryService('a') + ; + + $container + ->register('foo') + ->setArguments(array( + $ref = new Reference('b'), + )); + + $this->process($container); + + $inlinedArguments = $container->getDefinition('foo')->getArguments(); + $this->assertSame($b, $inlinedArguments[0]); + } + + public function testProcessDoesNotInlinePrivateFactoryIfReferencedMultipleTimesWithinTheSameDefinition() + { + $container = new ContainerBuilder(); + $container + ->register('a') + ; + $container + ->register('b') + ->setPublic(false) + ->setFactoryService('a') + ; + + $container + ->register('foo') + ->setArguments(array( + $ref1 = new Reference('b'), + $ref2 = new Reference('b'), + )) + ; + $this->process($container); + + $args = $container->getDefinition('foo')->getArguments(); + $this->assertSame($ref1, $args[0]); + $this->assertSame($ref2, $args[1]); + } + + public function testProcessDoesNotInlineReferenceWhenUsedByInlineFactory() + { + $container = new ContainerBuilder(); + $container + ->register('a') + ; + $container + ->register('b') + ->setPublic(false) + ->setFactoryService('a') + ; + + $inlineFactory = new Definition(); + $inlineFactory->setPublic(false); + $inlineFactory->setFactoryService('b'); + + $container + ->register('foo') + ->setArguments(array( + $ref = new Reference('b'), + $inlineFactory, + )) + ; + $this->process($container); + + $args = $container->getDefinition('foo')->getArguments(); + $this->assertSame($ref, $args[0]); + } + + public function testProcessInlinesOnlyIfSameScope() + { + $container = new ContainerBuilder(); + + $container->addScope(new Scope('foo')); + $a = $container->register('a')->setPublic(false)->setScope('foo'); + $b = $container->register('b')->addArgument(new Reference('a')); + + $this->process($container); + $arguments = $b->getArguments(); + $this->assertEquals(new Reference('a'), $arguments[0]); + $this->assertTrue($container->hasDefinition('a')); + } + + public function testProcessDoesNotInlineWhenServiceIsPrivateButLazy() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(false) + ->setLazy(true) + ; + + $container + ->register('service') + ->setArguments(array($ref = new Reference('foo'))) + ; + + $this->process($container); + + $arguments = $container->getDefinition('service')->getArguments(); + $this->assertSame($ref, $arguments[0]); + } + + public function testProcessDoesNotInlineWhenServiceReferencesItself() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(false) + ->addMethodCall('foo', array($ref = new Reference('foo'))) + ; + + $this->process($container); + + $calls = $container->getDefinition('foo')->getMethodCalls(); + $this->assertSame($ref, $calls[0][1][0]); + } + + protected function process(ContainerBuilder $container) + { + $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), new InlineServiceDefinitionsPass())); + $repeatedPass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php new file mode 100644 index 0000000..1d4ea07 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -0,0 +1,114 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * This class tests the integration of the different compiler passes + */ +class IntegrationTest extends \PHPUnit_Framework_TestCase +{ + /** + * This tests that the following dependencies are correctly processed: + * + * A is public, B/C are private + * A -> C + * B -> C + */ + public function testProcessRemovesAndInlinesRecursively() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + + $a = $container + ->register('a', '\stdClass') + ->addArgument(new Reference('c')) + ; + + $b = $container + ->register('b', '\stdClass') + ->addArgument(new Reference('c')) + ->setPublic(false) + ; + + $c = $container + ->register('c', '\stdClass') + ->setPublic(false) + ; + + $container->compile(); + + $this->assertTrue($container->hasDefinition('a')); + $arguments = $a->getArguments(); + $this->assertSame($c, $arguments[0]); + $this->assertFalse($container->hasDefinition('b')); + $this->assertFalse($container->hasDefinition('c')); + } + + public function testProcessInlinesReferencesToAliases() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + + $a = $container + ->register('a', '\stdClass') + ->addArgument(new Reference('b')) + ; + + $container->setAlias('b', new Alias('c', false)); + + $c = $container + ->register('c', '\stdClass') + ->setPublic(false) + ; + + $container->compile(); + + $this->assertTrue($container->hasDefinition('a')); + $arguments = $a->getArguments(); + $this->assertSame($c, $arguments[0]); + $this->assertFalse($container->hasAlias('b')); + $this->assertFalse($container->hasDefinition('c')); + } + + public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDefinition() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + + $container + ->register('a', '\stdClass') + ->addArgument(new Reference('b')) + ->addMethodCall('setC', array(new Reference('c'))) + ; + + $container + ->register('b', '\stdClass') + ->addArgument(new Reference('c')) + ->setPublic(false) + ; + + $container + ->register('c', '\stdClass') + ->setPublic(false) + ; + + $container->compile(); + + $this->assertTrue($container->hasDefinition('a')); + $this->assertFalse($container->hasDefinition('b')); + $this->assertFalse($container->hasDefinition('c'), 'Service C was not inlined.'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php new file mode 100644 index 0000000..b3e451c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; +use Symfony\Component\DependencyInjection\Compiler\Compiler; +use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; +use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class RemoveUnusedDefinitionsPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcess() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(false) + ; + $container + ->register('bar') + ->setPublic(false) + ; + $container + ->register('moo') + ->setArguments(array(new Reference('bar'))) + ; + + $this->process($container); + + $this->assertFalse($container->hasDefinition('foo')); + $this->assertTrue($container->hasDefinition('bar')); + $this->assertTrue($container->hasDefinition('moo')); + } + + public function testProcessRemovesUnusedDefinitionsRecursively() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(false) + ; + $container + ->register('bar') + ->setArguments(array(new Reference('foo'))) + ->setPublic(false) + ; + + $this->process($container); + + $this->assertFalse($container->hasDefinition('foo')); + $this->assertFalse($container->hasDefinition('bar')); + } + + public function testProcessWorksWithInlinedDefinitions() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(false) + ; + $container + ->register('bar') + ->setArguments(array(new Definition(null, array(new Reference('foo'))))) + ; + + $this->process($container); + + $this->assertTrue($container->hasDefinition('foo')); + $this->assertTrue($container->hasDefinition('bar')); + } + + public function testProcessWontRemovePrivateFactory() + { + $container = new ContainerBuilder(); + + $container + ->register('foo', 'stdClass') + ->setFactoryClass('stdClass') + ->setFactoryMethod('getInstance') + ->setPublic(false); + + $container + ->register('bar', 'stdClass') + ->setFactoryService('foo') + ->setFactoryMethod('getInstance') + ->setPublic(false); + + $container + ->register('foobar') + ->addArgument(new Reference('bar')); + + $this->process($container); + + $this->assertTrue($container->hasDefinition('foo')); + $this->assertTrue($container->hasDefinition('bar')); + $this->assertTrue($container->hasDefinition('foobar')); + } + + protected function process(ContainerBuilder $container) + { + $repeatedPass = new RepeatedPass(array(new AnalyzeServiceReferencesPass(), new RemoveUnusedDefinitionsPass())); + $repeatedPass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php new file mode 100644 index 0000000..e4d2240 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\ReplaceAliasByActualDefinitionPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; + +class ReplaceAliasByActualDefinitionPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcess() + { + $container = new ContainerBuilder(); + + $container->register('a', '\stdClass'); + + $bDefinition = new Definition('\stdClass'); + $bDefinition->setPublic(false); + $container->setDefinition('b', $bDefinition); + + $container->setAlias('a_alias', 'a'); + $container->setAlias('b_alias', 'b'); + + $this->process($container); + + $this->assertTrue($container->has('a'), '->process() does nothing to public definitions.'); + $this->assertTrue($container->hasAlias('a_alias')); + $this->assertFalse($container->has('b'), '->process() removes non-public definitions.'); + $this->assertTrue( + $container->has('b_alias') && !$container->hasAlias('b_alias'), + '->process() replaces alias to actual.' + ); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testProcessWithInvalidAlias() + { + $container = new ContainerBuilder(); + $container->setAlias('a_alias', 'a'); + $this->process($container); + } + + protected function process(ContainerBuilder $container) + { + $pass = new ReplaceAliasByActualDefinitionPass(); + $pass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php new file mode 100644 index 0000000..fb2bb5f --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php @@ -0,0 +1,181 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\DefinitionDecorator; +use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class ResolveDefinitionTemplatesPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcess() + { + $container = new ContainerBuilder(); + $container->register('parent', 'foo')->setArguments(array('moo', 'b'))->setProperty('foo', 'moo'); + $container->setDefinition('child', new DefinitionDecorator('parent')) + ->replaceArgument(0, 'a') + ->setProperty('foo', 'bar') + ->setClass('bar') + ; + + $this->process($container); + + $def = $container->getDefinition('child'); + $this->assertNotInstanceOf('Symfony\Component\DependencyInjection\DefinitionDecorator', $def); + $this->assertEquals('bar', $def->getClass()); + $this->assertEquals(array('a', 'b'), $def->getArguments()); + $this->assertEquals(array('foo' => 'bar'), $def->getProperties()); + } + + public function testProcessAppendsMethodCallsAlways() + { + $container = new ContainerBuilder(); + + $container + ->register('parent') + ->addMethodCall('foo', array('bar')) + ; + + $container + ->setDefinition('child', new DefinitionDecorator('parent')) + ->addMethodCall('bar', array('foo')) + ; + + $this->process($container); + + $def = $container->getDefinition('child'); + $this->assertEquals(array( + array('foo', array('bar')), + array('bar', array('foo')), + ), $def->getMethodCalls()); + } + + public function testProcessDoesNotCopyAbstract() + { + $container = new ContainerBuilder(); + + $container + ->register('parent') + ->setAbstract(true) + ; + + $container + ->setDefinition('child', new DefinitionDecorator('parent')) + ; + + $this->process($container); + + $def = $container->getDefinition('child'); + $this->assertFalse($def->isAbstract()); + } + + public function testProcessDoesNotCopyScope() + { + $container = new ContainerBuilder(); + + $container + ->register('parent') + ->setScope('foo') + ; + + $container + ->setDefinition('child', new DefinitionDecorator('parent')) + ; + + $this->process($container); + + $def = $container->getDefinition('child'); + $this->assertEquals(ContainerInterface::SCOPE_CONTAINER, $def->getScope()); + } + + public function testProcessDoesNotCopyTags() + { + $container = new ContainerBuilder(); + + $container + ->register('parent') + ->addTag('foo') + ; + + $container + ->setDefinition('child', new DefinitionDecorator('parent')) + ; + + $this->process($container); + + $def = $container->getDefinition('child'); + $this->assertEquals(array(), $def->getTags()); + } + + public function testProcessHandlesMultipleInheritance() + { + $container = new ContainerBuilder(); + + $container + ->register('parent', 'foo') + ->setArguments(array('foo', 'bar', 'c')) + ; + + $container + ->setDefinition('child2', new DefinitionDecorator('child1')) + ->replaceArgument(1, 'b') + ; + + $container + ->setDefinition('child1', new DefinitionDecorator('parent')) + ->replaceArgument(0, 'a') + ; + + $this->process($container); + + $def = $container->getDefinition('child2'); + $this->assertEquals(array('a', 'b', 'c'), $def->getArguments()); + $this->assertEquals('foo', $def->getClass()); + } + + public function testSetLazyOnServiceHasParent() + { + $container = new ContainerBuilder(); + + $container->register('parent', 'stdClass'); + + $container->setDefinition('child1', new DefinitionDecorator('parent')) + ->setLazy(true) + ; + + $this->process($container); + + $this->assertTrue($container->getDefinition('child1')->isLazy()); + } + + public function testSetLazyOnServiceIsParent() + { + $container = new ContainerBuilder(); + + $container->register('parent', 'stdClass') + ->setLazy(true) + ; + + $container->setDefinition('child1', new DefinitionDecorator('parent')); + + $this->process($container); + + $this->assertTrue($container->getDefinition('child1')->isLazy()); + } + + protected function process(ContainerBuilder $container) + { + $pass = new ResolveDefinitionTemplatesPass(); + $pass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php new file mode 100644 index 0000000..7205886 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Compiler\ResolveInvalidReferencesPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class ResolveInvalidReferencesPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcess() + { + $container = new ContainerBuilder(); + $def = $container + ->register('foo') + ->setArguments(array(new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE))) + ->addMethodCall('foo', array(new Reference('moo', ContainerInterface::IGNORE_ON_INVALID_REFERENCE))) + ; + + $this->process($container); + + $arguments = $def->getArguments(); + $this->assertNull($arguments[0]); + $this->assertCount(0, $def->getMethodCalls()); + } + + public function testProcessIgnoreNonExistentServices() + { + $container = new ContainerBuilder(); + $def = $container + ->register('foo') + ->setArguments(array(new Reference('bar'))) + ; + + $this->process($container); + + $arguments = $def->getArguments(); + $this->assertEquals('bar', (string) $arguments[0]); + } + + public function testProcessRemovesPropertiesOnInvalid() + { + $container = new ContainerBuilder(); + $def = $container + ->register('foo') + ->setProperty('foo', new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)) + ; + + $this->process($container); + + $this->assertEquals(array(), $def->getProperties()); + } + + public function testStrictFlagIsPreserved() + { + $container = new ContainerBuilder(); + $container->register('bar'); + $def = $container + ->register('foo') + ->addArgument(new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE, false)) + ; + + $this->process($container); + + $this->assertFalse($def->getArgument(0)->isStrict()); + } + + protected function process(ContainerBuilder $container) + { + $pass = new ResolveInvalidReferencesPass(); + $pass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php new file mode 100644 index 0000000..6fdc233 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php @@ -0,0 +1,67 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Compiler; + +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Compiler\ResolveReferencesToAliasesPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +class ResolveReferencesToAliasesPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcess() + { + $container = new ContainerBuilder(); + $container->setAlias('bar', 'foo'); + $def = $container + ->register('moo') + ->setArguments(array(new Reference('bar'))) + ; + + $this->process($container); + + $arguments = $def->getArguments(); + $this->assertEquals('foo', (string) $arguments[0]); + } + + public function testProcessRecursively() + { + $container = new ContainerBuilder(); + $container->setAlias('bar', 'foo'); + $container->setAlias('moo', 'bar'); + $def = $container + ->register('foobar') + ->setArguments(array(new Reference('moo'))) + ; + + $this->process($container); + + $arguments = $def->getArguments(); + $this->assertEquals('foo', (string) $arguments[0]); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + */ + public function testAliasCircularReference() + { + $container = new ContainerBuilder(); + $container->setAlias('bar', 'foo'); + $container->setAlias('foo', 'bar'); + $this->process($container); + } + + protected function process(ContainerBuilder $container) + { + $pass = new ResolveReferencesToAliasesPass(); + $pass->process($container); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php new file mode 100644 index 0000000..6c00963 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -0,0 +1,818 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests; + +require_once __DIR__.'/Fixtures/includes/classes.php'; +require_once __DIR__.'/Fixtures/includes/ProjectExtension.php'; + +use Symfony\Component\Config\Resource\ResourceInterface; +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +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\InactiveScopeException; +use Symfony\Component\DependencyInjection\Loader\ClosureLoader; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\Scope; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\ExpressionLanguage\Expression; + +class ContainerBuilderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::setDefinitions + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getDefinitions + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::setDefinition + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getDefinition + */ + public function testDefinitions() + { + $builder = new ContainerBuilder(); + $definitions = array( + 'foo' => new Definition('Bar\FooClass'), + 'bar' => new Definition('BarClass'), + ); + $builder->setDefinitions($definitions); + $this->assertEquals($definitions, $builder->getDefinitions(), '->setDefinitions() sets the service definitions'); + $this->assertTrue($builder->hasDefinition('foo'), '->hasDefinition() returns true if a service definition exists'); + $this->assertFalse($builder->hasDefinition('foobar'), '->hasDefinition() returns false if a service definition does not exist'); + + $builder->setDefinition('foobar', $foo = new Definition('FooBarClass')); + $this->assertEquals($foo, $builder->getDefinition('foobar'), '->getDefinition() returns a service definition if defined'); + $this->assertTrue($builder->setDefinition('foobar', $foo = new Definition('FooBarClass')) === $foo, '->setDefinition() implements a fluid interface by returning the service reference'); + + $builder->addDefinitions($defs = array('foobar' => new Definition('FooBarClass'))); + $this->assertEquals(array_merge($definitions, $defs), $builder->getDefinitions(), '->addDefinitions() adds the service definitions'); + + try { + $builder->getDefinition('baz'); + $this->fail('->getDefinition() throws an InvalidArgumentException if the service definition does not exist'); + } catch (\InvalidArgumentException $e) { + $this->assertEquals('The service definition "baz" does not exist.', $e->getMessage(), '->getDefinition() throws an InvalidArgumentException if the service definition does not exist'); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::register + */ + public function testRegister() + { + $builder = new ContainerBuilder(); + $builder->register('foo', 'Bar\FooClass'); + $this->assertTrue($builder->hasDefinition('foo'), '->register() registers a new service definition'); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Definition', $builder->getDefinition('foo'), '->register() returns the newly created Definition instance'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::has + */ + public function testHas() + { + $builder = new ContainerBuilder(); + $this->assertFalse($builder->has('foo'), '->has() returns false if the service does not exist'); + $builder->register('foo', 'Bar\FooClass'); + $this->assertTrue($builder->has('foo'), '->has() returns true if a service definition exists'); + $builder->set('bar', new \stdClass()); + $this->assertTrue($builder->has('bar'), '->has() returns true if a service exists'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get + */ + public function testGet() + { + $builder = new ContainerBuilder(); + try { + $builder->get('foo'); + $this->fail('->get() throws an InvalidArgumentException if the service does not exist'); + } catch (\InvalidArgumentException $e) { + $this->assertEquals('The service definition "foo" does not exist.', $e->getMessage(), '->get() throws an InvalidArgumentException if the service does not exist'); + } + + $this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service does not exist and NULL_ON_INVALID_REFERENCE is passed as a second argument'); + + $builder->register('foo', 'stdClass'); + $this->assertInternalType('object', $builder->get('foo'), '->get() returns the service definition associated with the id'); + $builder->set('bar', $bar = new \stdClass()); + $this->assertEquals($bar, $builder->get('bar'), '->get() returns the service associated with the id'); + $builder->register('bar', 'stdClass'); + $this->assertEquals($bar, $builder->get('bar'), '->get() returns the service associated with the id even if a definition has been defined'); + + $builder->register('baz', 'stdClass')->setArguments(array(new Reference('baz'))); + try { + @$builder->get('baz'); + $this->fail('->get() throws a ServiceCircularReferenceException if the service has a circular reference to itself'); + } catch (\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException $e) { + $this->assertEquals('Circular reference detected for service "baz", path: "baz".', $e->getMessage(), '->get() throws a LogicException if the service has a circular reference to itself'); + } + + $builder->register('foobar', 'stdClass')->setScope('container'); + $this->assertTrue($builder->get('bar') === $builder->get('bar'), '->get() always returns the same instance if the service is shared'); + } + + /** + * @covers \Symfony\Component\DependencyInjection\ContainerBuilder::get + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + * @expectedExceptionMessage You have requested a synthetic service ("foo"). The DIC does not know how to construct this service. + */ + public function testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException() + { + $builder = new ContainerBuilder(); + $builder->register('foo', 'stdClass')->setSynthetic(true); + + // we expect a RuntimeException here as foo is synthetic + try { + $builder->get('foo'); + } catch (RuntimeException $e) { + } + + // we must also have the same RuntimeException here + $builder->get('foo'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get + */ + public function testGetReturnsNullOnInactiveScope() + { + $builder = new ContainerBuilder(); + $builder->register('foo', 'stdClass')->setScope('request'); + + $this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::get + */ + public function testGetReturnsNullOnInactiveScopeWhenServiceIsCreatedByAMethod() + { + $builder = new ProjectContainer(); + + $this->assertNull($builder->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getServiceIds + */ + public function testGetServiceIds() + { + $builder = new ContainerBuilder(); + $builder->register('foo', 'stdClass'); + $builder->bar = $bar = new \stdClass(); + $builder->register('bar', 'stdClass'); + $this->assertEquals(array('foo', 'bar', 'service_container'), $builder->getServiceIds(), '->getServiceIds() returns all defined service ids'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::setAlias + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::hasAlias + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getAlias + */ + public function testAliases() + { + $builder = new ContainerBuilder(); + $builder->register('foo', 'stdClass'); + $builder->setAlias('bar', 'foo'); + $this->assertTrue($builder->hasAlias('bar'), '->hasAlias() returns true if the alias exists'); + $this->assertFalse($builder->hasAlias('foobar'), '->hasAlias() returns false if the alias does not exist'); + $this->assertEquals('foo', (string) $builder->getAlias('bar'), '->getAlias() returns the aliased service'); + $this->assertTrue($builder->has('bar'), '->setAlias() defines a new service'); + $this->assertTrue($builder->get('bar') === $builder->get('foo'), '->setAlias() creates a service that is an alias to another one'); + + try { + $builder->getAlias('foobar'); + $this->fail('->getAlias() throws an InvalidArgumentException if the alias does not exist'); + } catch (\InvalidArgumentException $e) { + $this->assertEquals('The service alias "foobar" does not exist.', $e->getMessage(), '->getAlias() throws an InvalidArgumentException if the alias does not exist'); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getAliases + */ + public function testGetAliases() + { + $builder = new ContainerBuilder(); + $builder->setAlias('bar', 'foo'); + $builder->setAlias('foobar', 'foo'); + $builder->setAlias('moo', new Alias('foo', false)); + + $aliases = $builder->getAliases(); + $this->assertEquals('foo', (string) $aliases['bar']); + $this->assertTrue($aliases['bar']->isPublic()); + $this->assertEquals('foo', (string) $aliases['foobar']); + $this->assertEquals('foo', (string) $aliases['moo']); + $this->assertFalse($aliases['moo']->isPublic()); + + $builder->register('bar', 'stdClass'); + $this->assertFalse($builder->hasAlias('bar')); + + $builder->set('foobar', 'stdClass'); + $builder->set('moo', 'stdClass'); + $this->assertCount(0, $builder->getAliases(), '->getAliases() does not return aliased services that have been overridden'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::setAliases + */ + public function testSetAliases() + { + $builder = new ContainerBuilder(); + $builder->setAliases(array('bar' => 'foo', 'foobar' => 'foo')); + + $aliases = $builder->getAliases(); + $this->assertTrue(isset($aliases['bar'])); + $this->assertTrue(isset($aliases['foobar'])); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addAliases + */ + public function testAddAliases() + { + $builder = new ContainerBuilder(); + $builder->setAliases(array('bar' => 'foo')); + $builder->addAliases(array('foobar' => 'foo')); + + $aliases = $builder->getAliases(); + $this->assertTrue(isset($aliases['bar'])); + $this->assertTrue(isset($aliases['foobar'])); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addCompilerPass + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getCompilerPassConfig + */ + public function testAddGetCompilerPass() + { + $builder = new ContainerBuilder(); + $builder->setResourceTracking(false); + $builderCompilerPasses = $builder->getCompiler()->getPassConfig()->getPasses(); + $builder->addCompilerPass($this->getMock('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface')); + $this->assertEquals(sizeof($builderCompilerPasses) + 1, sizeof($builder->getCompiler()->getPassConfig()->getPasses())); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + */ + public function testCreateService() + { + $builder = new ContainerBuilder(); + $builder->register('foo1', 'Bar\FooClass')->setFile(__DIR__.'/Fixtures/includes/foo.php'); + $this->assertInstanceOf('\Bar\FooClass', $builder->get('foo1'), '->createService() requires the file defined by the service definition'); + $builder->register('foo2', 'Bar\FooClass')->setFile(__DIR__.'/Fixtures/includes/%file%.php'); + $builder->setParameter('file', 'foo'); + $this->assertInstanceOf('\Bar\FooClass', $builder->get('foo2'), '->createService() replaces parameters in the file provided by the service definition'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + */ + public function testCreateProxyWithRealServiceInstantiator() + { + $builder = new ContainerBuilder(); + + $builder->register('foo1', 'Bar\FooClass')->setFile(__DIR__.'/Fixtures/includes/foo.php'); + $builder->getDefinition('foo1')->setLazy(true); + + $foo1 = $builder->get('foo1'); + + $this->assertSame($foo1, $builder->get('foo1'), 'The same proxy is retrieved on multiple subsequent calls'); + $this->assertSame('Bar\FooClass', get_class($foo1)); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + */ + public function testCreateServiceClass() + { + $builder = new ContainerBuilder(); + $builder->register('foo1', '%class%'); + $builder->setParameter('class', 'stdClass'); + $this->assertInstanceOf('\stdClass', $builder->get('foo1'), '->createService() replaces parameters in the class provided by the service definition'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + */ + public function testCreateServiceArguments() + { + $builder = new ContainerBuilder(); + $builder->register('bar', 'stdClass'); + $builder->register('foo1', 'Bar\FooClass')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'), '%%unescape_it%%')); + $builder->setParameter('value', 'bar'); + $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + */ + public function testCreateServiceFactoryMethod() + { + $builder = new ContainerBuilder(); + $builder->register('bar', 'stdClass'); + $builder->register('foo1', 'Bar\FooClass')->setFactoryClass('Bar\FooClass')->setFactoryMethod('getInstance')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'))); + $builder->setParameter('value', 'bar'); + $this->assertTrue($builder->get('foo1')->called, '->createService() calls the factory method to create the service instance'); + $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar')), $builder->get('foo1')->arguments, '->createService() passes the arguments to the factory method'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + */ + public function testCreateServiceFactoryService() + { + $builder = new ContainerBuilder(); + $builder->register('baz_service')->setFactoryService('baz_factory')->setFactoryMethod('getInstance'); + $builder->register('baz_factory', 'BazClass'); + + $this->assertInstanceOf('BazClass', $builder->get('baz_service')); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + */ + public function testCreateServiceMethodCalls() + { + $builder = new ContainerBuilder(); + $builder->register('bar', 'stdClass'); + $builder->register('foo1', 'Bar\FooClass')->addMethodCall('setBar', array(array('%value%', new Reference('bar')))); + $builder->setParameter('value', 'bar'); + $this->assertEquals(array('bar', $builder->get('bar')), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + */ + public function testCreateServiceConfigurator() + { + $builder = new ContainerBuilder(); + $builder->register('foo1', 'Bar\FooClass')->setConfigurator('sc_configure'); + $this->assertTrue($builder->get('foo1')->configured, '->createService() calls the configurator'); + + $builder->register('foo2', 'Bar\FooClass')->setConfigurator(array('%class%', 'configureStatic')); + $builder->setParameter('class', 'BazClass'); + $this->assertTrue($builder->get('foo2')->configured, '->createService() calls the configurator'); + + $builder->register('baz', 'BazClass'); + $builder->register('foo3', 'Bar\FooClass')->setConfigurator(array(new Reference('baz'), 'configure')); + $this->assertTrue($builder->get('foo3')->configured, '->createService() calls the configurator'); + + $builder->register('foo4', 'Bar\FooClass')->setConfigurator('foo'); + try { + $builder->get('foo4'); + $this->fail('->createService() throws an InvalidArgumentException if the configure callable is not a valid callable'); + } catch (\InvalidArgumentException $e) { + $this->assertEquals('The configure callable for class "Bar\FooClass" is not a callable.', $e->getMessage(), '->createService() throws an InvalidArgumentException if the configure callable is not a valid callable'); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::createService + * @expectedException \RuntimeException + */ + public function testCreateSyntheticService() + { + $builder = new ContainerBuilder(); + $builder->register('foo', 'Bar\FooClass')->setSynthetic(true); + $builder->get('foo'); + } + + public function testCreateServiceWithExpression() + { + $builder = new ContainerBuilder(); + $builder->setParameter('bar', 'bar'); + $builder->register('bar', 'BarClass'); + $builder->register('foo', 'Bar\FooClass')->addArgument(array('foo' => new Expression('service("bar").foo ~ parameter("bar")'))); + $this->assertEquals('foobar', $builder->get('foo')->arguments['foo']); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::resolveServices + */ + public function testResolveServices() + { + $builder = new ContainerBuilder(); + $builder->register('foo', 'Bar\FooClass'); + $this->assertEquals($builder->get('foo'), $builder->resolveServices(new Reference('foo')), '->resolveServices() resolves service references to service instances'); + $this->assertEquals(array('foo' => array('foo', $builder->get('foo'))), $builder->resolveServices(array('foo' => array('foo', new Reference('foo')))), '->resolveServices() resolves service references to service instances in nested arrays'); + $this->assertEquals($builder->get('foo'), $builder->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::merge + */ + public function testMerge() + { + $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container->setResourceTracking(false); + $config = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); + $container->merge($config); + $this->assertEquals(array('bar' => 'foo', 'foo' => 'bar'), $container->getParameterBag()->all(), '->merge() merges current parameters with the loaded ones'); + + $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container->setResourceTracking(false); + $config = new ContainerBuilder(new ParameterBag(array('foo' => '%bar%'))); + $container->merge($config); + $container->compile(); + $this->assertEquals(array('bar' => 'foo', 'foo' => 'foo'), $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); + + $container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo'))); + $container->setResourceTracking(false); + $config = new ContainerBuilder(new ParameterBag(array('foo' => '%bar%', 'baz' => '%foo%'))); + $container->merge($config); + $container->compile(); + $this->assertEquals(array('bar' => 'foo', 'foo' => 'foo', 'baz' => 'foo'), $container->getParameterBag()->all(), '->merge() evaluates the values of the parameters towards already defined ones'); + + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->register('foo', 'Bar\FooClass'); + $container->register('bar', 'BarClass'); + $config = new ContainerBuilder(); + $config->setDefinition('baz', new Definition('BazClass')); + $config->setAlias('alias_for_foo', 'foo'); + $container->merge($config); + $this->assertEquals(array('foo', 'bar', 'baz'), array_keys($container->getDefinitions()), '->merge() merges definitions already defined ones'); + + $aliases = $container->getAliases(); + $this->assertTrue(isset($aliases['alias_for_foo'])); + $this->assertEquals('foo', (string) $aliases['alias_for_foo']); + + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->register('foo', 'Bar\FooClass'); + $config->setDefinition('foo', new Definition('BazClass')); + $container->merge($config); + $this->assertEquals('BazClass', $container->getDefinition('foo')->getClass(), '->merge() overrides already defined services'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::merge + * @expectedException \LogicException + */ + public function testMergeLogicException() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->compile(); + $container->merge(new ContainerBuilder()); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::findTaggedServiceIds + */ + public function testfindTaggedServiceIds() + { + $builder = new ContainerBuilder(); + $builder + ->register('foo', 'Bar\FooClass') + ->addTag('foo', array('foo' => 'foo')) + ->addTag('bar', array('bar' => 'bar')) + ->addTag('foo', array('foofoo' => 'foofoo')) + ; + $this->assertEquals($builder->findTaggedServiceIds('foo'), array( + 'foo' => array( + array('foo' => 'foo'), + array('foofoo' => 'foofoo'), + ), + ), '->findTaggedServiceIds() returns an array of service ids and its tag attributes'); + $this->assertEquals(array(), $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::findDefinition + */ + public function testFindDefinition() + { + $container = new ContainerBuilder(); + $container->setDefinition('foo', $definition = new Definition('Bar\FooClass')); + $container->setAlias('bar', 'foo'); + $container->setAlias('foobar', 'bar'); + $this->assertEquals($definition, $container->findDefinition('foobar'), '->findDefinition() returns a Definition'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addObjectResource + */ + public function testAddObjectResource() + { + $container = new ContainerBuilder(); + + $container->setResourceTracking(false); + $container->addObjectResource(new \BarClass()); + + $this->assertEmpty($container->getResources(), 'No resources get registered without resource tracking'); + + $container->setResourceTracking(true); + $container->addObjectResource(new \BarClass()); + + $resources = $container->getResources(); + + $this->assertCount(1, $resources, '1 resource was registered'); + + /* @var $resource \Symfony\Component\Config\Resource\FileResource */ + $resource = end($resources); + + $this->assertInstanceOf('Symfony\Component\Config\Resource\FileResource', $resource); + $this->assertSame(realpath(__DIR__.'/Fixtures/includes/classes.php'), realpath($resource->getResource())); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addClassResource + */ + public function testAddClassResource() + { + $container = new ContainerBuilder(); + + $container->setResourceTracking(false); + $container->addClassResource(new \ReflectionClass('BarClass')); + + $this->assertEmpty($container->getResources(), 'No resources get registered without resource tracking'); + + $container->setResourceTracking(true); + $container->addClassResource(new \ReflectionClass('BarClass')); + + $resources = $container->getResources(); + + $this->assertCount(1, $resources, '1 resource was registered'); + + /* @var $resource \Symfony\Component\Config\Resource\FileResource */ + $resource = end($resources); + + $this->assertInstanceOf('Symfony\Component\Config\Resource\FileResource', $resource); + $this->assertSame(realpath(__DIR__.'/Fixtures/includes/classes.php'), realpath($resource->getResource())); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::compile + */ + public function testCompilesClassDefinitionsOfLazyServices() + { + $container = new ContainerBuilder(); + + $this->assertEmpty($container->getResources(), 'No resources get registered without resource tracking'); + + $container->register('foo', 'BarClass'); + $container->getDefinition('foo')->setLazy(true); + + $container->compile(); + + $classesPath = realpath(__DIR__.'/Fixtures/includes/classes.php'); + $matchingResources = array_filter( + $container->getResources(), + function (ResourceInterface $resource) use ($classesPath) { + return $resource instanceof FileResource && $classesPath === realpath($resource->getResource()); + } + ); + + $this->assertNotEmpty($matchingResources); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getResources + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::addResource + */ + public function testResources() + { + $container = new ContainerBuilder(); + $container->addResource($a = new FileResource(__DIR__.'/Fixtures/xml/services1.xml')); + $container->addResource($b = new FileResource(__DIR__.'/Fixtures/xml/services2.xml')); + $resources = array(); + foreach ($container->getResources() as $resource) { + if (false === strpos($resource, '.php')) { + $resources[] = $resource; + } + } + $this->assertEquals(array($a, $b), $resources, '->getResources() returns an array of resources read for the current configuration'); + $this->assertSame($container, $container->setResources(array())); + $this->assertEquals(array(), $container->getResources()); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::registerExtension + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getExtension + */ + public function testExtension() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + + $container->registerExtension($extension = new \ProjectExtension()); + $this->assertTrue($container->getExtension('project') === $extension, '->registerExtension() registers an extension'); + + $this->setExpectedException('LogicException'); + $container->getExtension('no_registered'); + } + + public function testRegisteredButNotLoadedExtension() + { + $extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface'); + $extension->expects($this->once())->method('getAlias')->will($this->returnValue('project')); + $extension->expects($this->never())->method('load'); + + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->registerExtension($extension); + $container->compile(); + } + + public function testRegisteredAndLoadedExtension() + { + $extension = $this->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface'); + $extension->expects($this->exactly(2))->method('getAlias')->will($this->returnValue('project')); + $extension->expects($this->once())->method('load')->with(array(array('foo' => 'bar'))); + + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->registerExtension($extension); + $container->loadFromExtension('project', array('foo' => 'bar')); + $container->compile(); + } + + public function testPrivateServiceUser() + { + $fooDefinition = new Definition('BarClass'); + $fooUserDefinition = new Definition('BarUserClass', array(new Reference('bar'))); + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + + $fooDefinition->setPublic(false); + + $container->addDefinitions(array( + 'bar' => $fooDefinition, + 'bar_user' => $fooUserDefinition, + )); + + $container->compile(); + $this->assertInstanceOf('BarClass', $container->get('bar_user')->bar); + } + + /** + * @expectedException \BadMethodCallException + */ + public function testThrowsExceptionWhenSetServiceOnAFrozenContainer() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->setDefinition('a', new Definition('stdClass')); + $container->compile(); + $container->set('a', new \stdClass()); + } + + /** + * @expectedException \BadMethodCallException + */ + public function testThrowsExceptionWhenAddServiceOnAFrozenContainer() + { + $container = new ContainerBuilder(); + $container->compile(); + $container->set('a', new \stdClass()); + } + + public function testNoExceptionWhenSetSyntheticServiceOnAFrozenContainer() + { + $container = new ContainerBuilder(); + $def = new Definition('stdClass'); + $def->setSynthetic(true); + $container->setDefinition('a', $def); + $container->compile(); + $container->set('a', $a = new \stdClass()); + $this->assertEquals($a, $container->get('a')); + } + + public function testSetOnSynchronizedService() + { + $container = new ContainerBuilder(); + $container->register('baz', 'BazClass') + ->setSynchronized(true) + ; + $container->register('bar', 'BarClass') + ->addMethodCall('setBaz', array(new Reference('baz'))) + ; + + $container->set('baz', $baz = new \BazClass()); + $this->assertSame($baz, $container->get('bar')->getBaz()); + + $container->set('baz', $baz = new \BazClass()); + $this->assertSame($baz, $container->get('bar')->getBaz()); + } + + public function testSynchronizedServiceWithScopes() + { + $container = new ContainerBuilder(); + $container->addScope(new Scope('foo')); + $container->register('baz', 'BazClass') + ->setSynthetic(true) + ->setSynchronized(true) + ->setScope('foo') + ; + $container->register('bar', 'BarClass') + ->addMethodCall('setBaz', array(new Reference('baz', ContainerInterface::NULL_ON_INVALID_REFERENCE, false))) + ; + $container->compile(); + + $container->enterScope('foo'); + $container->set('baz', $outerBaz = new \BazClass(), 'foo'); + $this->assertSame($outerBaz, $container->get('bar')->getBaz()); + + $container->enterScope('foo'); + $container->set('baz', $innerBaz = new \BazClass(), 'foo'); + $this->assertSame($innerBaz, $container->get('bar')->getBaz()); + $container->leaveScope('foo'); + + $this->assertNotSame($innerBaz, $container->get('bar')->getBaz()); + $this->assertSame($outerBaz, $container->get('bar')->getBaz()); + + $container->leaveScope('foo'); + } + + /** + * @expectedException \BadMethodCallException + */ + public function testThrowsExceptionWhenSetDefinitionOnAFrozenContainer() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->compile(); + $container->setDefinition('a', new Definition()); + } + + /** + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::getExtensionConfig + * @covers Symfony\Component\DependencyInjection\ContainerBuilder::prependExtensionConfig + */ + public function testExtensionConfig() + { + $container = new ContainerBuilder(); + + $configs = $container->getExtensionConfig('foo'); + $this->assertEmpty($configs); + + $first = array('foo' => 'bar'); + $container->prependExtensionConfig('foo', $first); + $configs = $container->getExtensionConfig('foo'); + $this->assertEquals(array($first), $configs); + + $second = array('ding' => 'dong'); + $container->prependExtensionConfig('foo', $second); + $configs = $container->getExtensionConfig('foo'); + $this->assertEquals(array($second, $first), $configs); + } + + public function testLazyLoadedService() + { + $loader = new ClosureLoader($container = new ContainerBuilder()); + $loader->load(function (ContainerBuilder $container) { + $container->set('a', new \BazClass()); + $definition = new Definition('BazClass'); + $definition->setLazy(true); + $container->setDefinition('a', $definition); + } + ); + + $container->setResourceTracking(true); + + $container->compile(); + + $class = new \BazClass(); + $reflectionClass = new \ReflectionClass($class); + + $r = new \ReflectionProperty($container, 'resources'); + $r->setAccessible(true); + $resources = $r->getValue($container); + + $classInList = false; + foreach ($resources as $resource) { + if ($resource->getResource() === $reflectionClass->getFileName()) { + $classInList = true; + break; + } + } + + $this->assertTrue($classInList); + } +} + +class FooClass +{ +} + +class ProjectContainer extends ContainerBuilder +{ + public function getFoobazService() + { + throw new InactiveScopeException('foo', 'request'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerTest.php new file mode 100644 index 0000000..8bc530c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -0,0 +1,597 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests; + +use Symfony\Component\DependencyInjection\Scope; +use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; + +class ContainerTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\Container::__construct + */ + public function testConstructor() + { + $sc = new Container(); + $this->assertSame($sc, $sc->get('service_container'), '__construct() automatically registers itself as a service'); + + $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '__construct() takes an array of parameters as its first argument'); + } + + /** + * @dataProvider dataForTestCamelize + */ + public function testCamelize($id, $expected) + { + $this->assertEquals($expected, Container::camelize($id), sprintf('Container::camelize("%s")', $id)); + } + + public function dataForTestCamelize() + { + return array( + array('foo_bar', 'FooBar'), + array('foo.bar', 'Foo_Bar'), + array('foo.bar_baz', 'Foo_BarBaz'), + array('foo._bar', 'Foo_Bar'), + array('foo_.bar', 'Foo_Bar'), + array('_foo', 'Foo'), + array('.foo', '_Foo'), + array('foo_', 'Foo'), + array('foo.', 'Foo_'), + array('foo\bar', 'Foo_Bar'), + ); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::compile + */ + public function testCompile() + { + $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $sc->compile(); + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag', $sc->getParameterBag(), '->compile() changes the parameter bag to a FrozenParameterBag instance'); + $this->assertEquals(array('foo' => 'bar'), $sc->getParameterBag()->all(), '->compile() copies the current parameters to the new parameter bag'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::isFrozen + */ + public function testIsFrozen() + { + $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $this->assertFalse($sc->isFrozen(), '->isFrozen() returns false if the parameters are not frozen'); + $sc->compile(); + $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::getParameterBag + */ + public function testGetParameterBag() + { + $sc = new Container(); + $this->assertEquals(array(), $sc->getParameterBag()->all(), '->getParameterBag() returns an empty array if no parameter has been defined'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::setParameter + * @covers Symfony\Component\DependencyInjection\Container::getParameter + */ + public function testGetSetParameter() + { + $sc = new Container(new ParameterBag(array('foo' => 'bar'))); + $sc->setParameter('bar', 'foo'); + $this->assertEquals('foo', $sc->getParameter('bar'), '->setParameter() sets the value of a new parameter'); + + $sc->setParameter('foo', 'baz'); + $this->assertEquals('baz', $sc->getParameter('foo'), '->setParameter() overrides previously set parameter'); + + $sc->setParameter('Foo', 'baz1'); + $this->assertEquals('baz1', $sc->getParameter('foo'), '->setParameter() converts the key to lowercase'); + $this->assertEquals('baz1', $sc->getParameter('FOO'), '->getParameter() converts the key to lowercase'); + + try { + $sc->getParameter('baba'); + $this->fail('->getParameter() thrown an \InvalidArgumentException if the key does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('\InvalidArgumentException', $e, '->getParameter() thrown an \InvalidArgumentException if the key does not exist'); + $this->assertEquals('You have requested a non-existent parameter "baba".', $e->getMessage(), '->getParameter() thrown an \InvalidArgumentException if the key does not exist'); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::getServiceIds + */ + public function testGetServiceIds() + { + $sc = new Container(); + $sc->set('foo', $obj = new \stdClass()); + $sc->set('bar', $obj = new \stdClass()); + $this->assertEquals(array('service_container', 'foo', 'bar'), $sc->getServiceIds(), '->getServiceIds() returns all defined service ids'); + + $sc = new ProjectServiceContainer(); + $this->assertEquals(array('scoped', 'scoped_foo', 'inactive', 'bar', 'foo_bar', 'foo.baz', 'circular', 'throw_exception', 'throws_exception_on_service_configuration', 'service_container'), $sc->getServiceIds(), '->getServiceIds() returns defined service ids by getXXXService() methods'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::set + */ + public function testSet() + { + $sc = new Container(); + $sc->set('foo', $foo = new \stdClass()); + $this->assertEquals($foo, $sc->get('foo'), '->set() sets a service'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::set + */ + public function testSetWithNullResetTheService() + { + $sc = new Container(); + $sc->set('foo', null); + $this->assertFalse($sc->has('foo')); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testSetDoesNotAllowPrototypeScope() + { + $c = new Container(); + $c->set('foo', new \stdClass(), 'prototype'); + } + + /** + * @expectedException \RuntimeException + */ + public function testSetDoesNotAllowInactiveScope() + { + $c = new Container(); + $c->addScope(new Scope('foo')); + $c->set('foo', new \stdClass(), 'foo'); + } + + public function testSetAlsoSetsScopedService() + { + $c = new Container(); + $c->addScope(new Scope('foo')); + $c->enterScope('foo'); + $c->set('foo', $foo = new \stdClass(), 'foo'); + + $services = $this->getField($c, 'scopedServices'); + $this->assertTrue(isset($services['foo']['foo'])); + $this->assertSame($foo, $services['foo']['foo']); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::get + */ + public function testGet() + { + $sc = new ProjectServiceContainer(); + $sc->set('foo', $foo = new \stdClass()); + $this->assertEquals($foo, $sc->get('foo'), '->get() returns the service for the given id'); + $this->assertEquals($sc->__bar, $sc->get('bar'), '->get() returns the service for the given id'); + $this->assertEquals($sc->__foo_bar, $sc->get('foo_bar'), '->get() returns the service if a get*Method() is defined'); + $this->assertEquals($sc->__foo_baz, $sc->get('foo.baz'), '->get() returns the service if a get*Method() is defined'); + $this->assertEquals($sc->__foo_baz, $sc->get('foo\\baz'), '->get() returns the service if a get*Method() is defined'); + + $sc->set('bar', $bar = new \stdClass()); + $this->assertEquals($bar, $sc->get('bar'), '->get() prefers to return a service defined with set() than one defined with a getXXXMethod()'); + + try { + $sc->get(''); + $this->fail('->get() throws a \InvalidArgumentException exception if the service is empty'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException', $e, '->get() throws a ServiceNotFoundException exception if the service is empty'); + } + $this->assertNull($sc->get('', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + } + + public function testGetThrowServiceNotFoundException() + { + $sc = new ProjectServiceContainer(); + $sc->set('foo', $foo = new \stdClass()); + $sc->set('bar', $foo = new \stdClass()); + $sc->set('baz', $foo = new \stdClass()); + + try { + $sc->get('foo1'); + $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException if the key does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException', $e, '->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException if the key does not exist'); + $this->assertEquals('You have requested a non-existent service "foo1". Did you mean this: "foo"?', $e->getMessage(), '->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException with some advices'); + } + + try { + $sc->get('bag'); + $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException if the key does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException', $e, '->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException if the key does not exist'); + $this->assertEquals('You have requested a non-existent service "bag". Did you mean one of these: "bar", "baz"?', $e->getMessage(), '->get() throws an Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException with some advices'); + } + } + + public function testGetCircularReference() + { + $sc = new ProjectServiceContainer(); + try { + $sc->get('circular'); + $this->fail('->get() throws a ServiceCircularReferenceException if it contains circular reference'); + } catch (\Exception $e) { + $this->assertInstanceOf('\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException', $e, '->get() throws a ServiceCircularReferenceException if it contains circular reference'); + $this->assertStringStartsWith('Circular reference detected for service "circular"', $e->getMessage(), '->get() throws a \LogicException if it contains circular reference'); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::get + */ + public function testGetReturnsNullOnInactiveScope() + { + $sc = new ProjectServiceContainer(); + $this->assertNull($sc->get('inactive', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::has + */ + public function testHas() + { + $sc = new ProjectServiceContainer(); + $sc->set('foo', new \stdClass()); + $this->assertFalse($sc->has('foo1'), '->has() returns false if the service does not exist'); + $this->assertTrue($sc->has('foo'), '->has() returns true if the service exists'); + $this->assertTrue($sc->has('bar'), '->has() returns true if a get*Method() is defined'); + $this->assertTrue($sc->has('foo_bar'), '->has() returns true if a get*Method() is defined'); + $this->assertTrue($sc->has('foo.baz'), '->has() returns true if a get*Method() is defined'); + $this->assertTrue($sc->has('foo\\baz'), '->has() returns true if a get*Method() is defined'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Container::initialized + */ + public function testInitialized() + { + $sc = new ProjectServiceContainer(); + $sc->set('foo', new \stdClass()); + $this->assertTrue($sc->initialized('foo'), '->initialized() returns true if service is loaded'); + $this->assertFalse($sc->initialized('foo1'), '->initialized() returns false if service is not loaded'); + $this->assertFalse($sc->initialized('bar'), '->initialized() returns false if a service is defined, but not currently loaded'); + $this->assertFalse($sc->initialized('alias'), '->initialized() returns false if an aliased service is not initialized'); + + $sc->set('bar', new \stdClass()); + $this->assertTrue($sc->initialized('alias'), '->initialized() returns true for alias if aliased service is initialized'); + } + + public function testEnterLeaveCurrentScope() + { + $container = new ProjectServiceContainer(); + $container->addScope(new Scope('foo')); + + $container->enterScope('foo'); + $scoped1 = $container->get('scoped'); + $scopedFoo1 = $container->get('scoped_foo'); + + $container->enterScope('foo'); + $scoped2 = $container->get('scoped'); + $scoped3 = $container->get('scoped'); + $scopedFoo2 = $container->get('scoped_foo'); + + $container->leaveScope('foo'); + $scoped4 = $container->get('scoped'); + $scopedFoo3 = $container->get('scoped_foo'); + + $this->assertNotSame($scoped1, $scoped2); + $this->assertSame($scoped2, $scoped3); + $this->assertSame($scoped1, $scoped4); + $this->assertNotSame($scopedFoo1, $scopedFoo2); + $this->assertSame($scopedFoo1, $scopedFoo3); + } + + public function testEnterLeaveScopeWithChildScopes() + { + $container = new Container(); + $container->addScope(new Scope('foo')); + $container->addScope(new Scope('bar', 'foo')); + + $this->assertFalse($container->isScopeActive('foo')); + + $container->enterScope('foo'); + $container->enterScope('bar'); + + $this->assertTrue($container->isScopeActive('foo')); + $this->assertFalse($container->has('a')); + + $a = new \stdClass(); + $container->set('a', $a, 'bar'); + + $services = $this->getField($container, 'scopedServices'); + $this->assertTrue(isset($services['bar']['a'])); + $this->assertSame($a, $services['bar']['a']); + + $this->assertTrue($container->has('a')); + $container->leaveScope('foo'); + + $services = $this->getField($container, 'scopedServices'); + $this->assertFalse(isset($services['bar'])); + + $this->assertFalse($container->isScopeActive('foo')); + $this->assertFalse($container->has('a')); + } + + public function testEnterScopeRecursivelyWithInactiveChildScopes() + { + $container = new Container(); + $container->addScope(new Scope('foo')); + $container->addScope(new Scope('bar', 'foo')); + + $this->assertFalse($container->isScopeActive('foo')); + + $container->enterScope('foo'); + + $this->assertTrue($container->isScopeActive('foo')); + $this->assertFalse($container->isScopeActive('bar')); + $this->assertFalse($container->has('a')); + + $a = new \stdClass(); + $container->set('a', $a, 'foo'); + + $services = $this->getField($container, 'scopedServices'); + $this->assertTrue(isset($services['foo']['a'])); + $this->assertSame($a, $services['foo']['a']); + + $this->assertTrue($container->has('a')); + $container->enterScope('foo'); + + $services = $this->getField($container, 'scopedServices'); + $this->assertFalse(isset($services['a'])); + + $this->assertTrue($container->isScopeActive('foo')); + $this->assertFalse($container->isScopeActive('bar')); + $this->assertFalse($container->has('a')); + } + + public function testLeaveScopeNotActive() + { + $container = new Container(); + $container->addScope(new Scope('foo')); + + try { + $container->leaveScope('foo'); + $this->fail('->leaveScope() throws a \LogicException if the scope is not active yet'); + } catch (\Exception $e) { + $this->assertInstanceOf('\LogicException', $e, '->leaveScope() throws a \LogicException if the scope is not active yet'); + $this->assertEquals('The scope "foo" is not active.', $e->getMessage(), '->leaveScope() throws a \LogicException if the scope is not active yet'); + } + + try { + $container->leaveScope('bar'); + $this->fail('->leaveScope() throws a \LogicException if the scope does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('\LogicException', $e, '->leaveScope() throws a \LogicException if the scope does not exist'); + $this->assertEquals('The scope "bar" is not active.', $e->getMessage(), '->leaveScope() throws a \LogicException if the scope does not exist'); + } + } + + /** + * @expectedException \InvalidArgumentException + * @dataProvider getBuiltInScopes + */ + public function testAddScopeDoesNotAllowBuiltInScopes($scope) + { + $container = new Container(); + $container->addScope(new Scope($scope)); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testAddScopeDoesNotAllowExistingScope() + { + $container = new Container(); + $container->addScope(new Scope('foo')); + $container->addScope(new Scope('foo')); + } + + /** + * @expectedException \InvalidArgumentException + * @dataProvider getInvalidParentScopes + */ + public function testAddScopeDoesNotAllowInvalidParentScope($scope) + { + $c = new Container(); + $c->addScope(new Scope('foo', $scope)); + } + + public function testAddScope() + { + $c = new Container(); + $c->addScope(new Scope('foo')); + $c->addScope(new Scope('bar', 'foo')); + + $this->assertSame(array('foo' => 'container', 'bar' => 'foo'), $this->getField($c, 'scopes')); + $this->assertSame(array('foo' => array('bar'), 'bar' => array()), $this->getField($c, 'scopeChildren')); + } + + public function testHasScope() + { + $c = new Container(); + + $this->assertFalse($c->hasScope('foo')); + $c->addScope(new Scope('foo')); + $this->assertTrue($c->hasScope('foo')); + } + + public function testIsScopeActive() + { + $c = new Container(); + + $this->assertFalse($c->isScopeActive('foo')); + $c->addScope(new Scope('foo')); + + $this->assertFalse($c->isScopeActive('foo')); + $c->enterScope('foo'); + + $this->assertTrue($c->isScopeActive('foo')); + $c->leaveScope('foo'); + + $this->assertFalse($c->isScopeActive('foo')); + } + + public function testGetThrowsException() + { + $c = new ProjectServiceContainer(); + + try { + $c->get('throw_exception'); + $this->fail(); + } catch (\Exception $e) { + $this->assertEquals('Something went terribly wrong!', $e->getMessage()); + } + + try { + $c->get('throw_exception'); + $this->fail(); + } catch (\Exception $e) { + $this->assertEquals('Something went terribly wrong!', $e->getMessage()); + } + } + + public function testGetThrowsExceptionOnServiceConfiguration() + { + $c = new ProjectServiceContainer(); + + try { + $c->get('throws_exception_on_service_configuration'); + $this->fail('The container can not contain invalid service!'); + } catch (\Exception $e) { + $this->assertEquals('Something was terribly wrong while trying to configure the service!', $e->getMessage()); + } + $this->assertFalse($c->initialized('throws_exception_on_service_configuration')); + + try { + $c->get('throws_exception_on_service_configuration'); + $this->fail('The container can not contain invalid service!'); + } catch (\Exception $e) { + $this->assertEquals('Something was terribly wrong while trying to configure the service!', $e->getMessage()); + } + $this->assertFalse($c->initialized('throws_exception_on_service_configuration')); + } + + public function getInvalidParentScopes() + { + return array( + array(ContainerInterface::SCOPE_PROTOTYPE), + array('bar'), + ); + } + + public function getBuiltInScopes() + { + return array( + array(ContainerInterface::SCOPE_CONTAINER), + array(ContainerInterface::SCOPE_PROTOTYPE), + ); + } + + protected function getField($obj, $field) + { + $reflection = new \ReflectionProperty($obj, $field); + $reflection->setAccessible(true); + + return $reflection->getValue($obj); + } + + public function testAlias() + { + $c = new ProjectServiceContainer(); + + $this->assertTrue($c->has('alias')); + $this->assertSame($c->get('alias'), $c->get('bar')); + } +} + +class ProjectServiceContainer extends Container +{ + public $__bar, $__foo_bar, $__foo_baz; + + public function __construct() + { + parent::__construct(); + + $this->__bar = new \stdClass(); + $this->__foo_bar = new \stdClass(); + $this->__foo_baz = new \stdClass(); + $this->aliases = array('alias' => 'bar'); + } + + protected function getScopedService() + { + if (!isset($this->scopedServices['foo'])) { + throw new \RuntimeException('Invalid call'); + } + + return $this->services['scoped'] = $this->scopedServices['foo']['scoped'] = new \stdClass(); + } + + protected function getScopedFooService() + { + if (!isset($this->scopedServices['foo'])) { + throw new \RuntimeException('invalid call'); + } + + return $this->services['scoped_foo'] = $this->scopedServices['foo']['scoped_foo'] = new \stdClass(); + } + + protected function getInactiveService() + { + throw new InactiveScopeException('request', 'request'); + } + + protected function getBarService() + { + return $this->__bar; + } + + protected function getFooBarService() + { + return $this->__foo_bar; + } + + protected function getFoo_BazService() + { + return $this->__foo_baz; + } + + protected function getCircularService() + { + return $this->get('circular'); + } + + protected function getThrowExceptionService() + { + throw new \Exception('Something went terribly wrong!'); + } + + protected function getThrowsExceptionOnServiceConfigurationService() + { + $this->services['throws_exception_on_service_configuration'] = $instance = new \stdClass(); + + throw new \Exception('Something was terribly wrong while trying to configure the service!'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php new file mode 100644 index 0000000..692d73d --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php @@ -0,0 +1,96 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Config\FileLocator; + +class CrossCheckTest extends \PHPUnit_Framework_TestCase +{ + protected static $fixturesPath; + + public static function setUpBeforeClass() + { + self::$fixturesPath = __DIR__.'/Fixtures/'; + + require_once self::$fixturesPath.'/includes/classes.php'; + require_once self::$fixturesPath.'/includes/foo.php'; + } + + /** + * @dataProvider crossCheckLoadersDumpers + */ + public function testCrossCheck($fixture, $type) + { + $loaderClass = 'Symfony\\Component\\DependencyInjection\\Loader\\'.ucfirst($type).'FileLoader'; + $dumperClass = 'Symfony\\Component\\DependencyInjection\\Dumper\\'.ucfirst($type).'Dumper'; + + $tmp = tempnam('sf_service_container', 'sf'); + + file_put_contents($tmp, file_get_contents(self::$fixturesPath.'/'.$type.'/'.$fixture)); + + $container1 = new ContainerBuilder(); + $loader1 = new $loaderClass($container1, new FileLocator()); + $loader1->load($tmp); + + $dumper = new $dumperClass($container1); + file_put_contents($tmp, $dumper->dump()); + + $container2 = new ContainerBuilder(); + $loader2 = new $loaderClass($container2, new FileLocator()); + $loader2->load($tmp); + + unlink($tmp); + + $this->assertEquals($container2->getAliases(), $container1->getAliases(), 'loading a dump from a previously loaded container returns the same container'); + $this->assertEquals($container2->getDefinitions(), $container1->getDefinitions(), 'loading a dump from a previously loaded container returns the same container'); + $this->assertEquals($container2->getParameterBag()->all(), $container1->getParameterBag()->all(), '->getParameterBag() returns the same value for both containers'); + + $this->assertEquals(serialize($container2), serialize($container1), 'loading a dump from a previously loaded container returns the same container'); + + $services1 = array(); + foreach ($container1 as $id => $service) { + $services1[$id] = serialize($service); + } + $services2 = array(); + foreach ($container2 as $id => $service) { + $services2[$id] = serialize($service); + } + + unset($services1['service_container'], $services2['service_container']); + + $this->assertEquals($services2, $services1, 'Iterator on the containers returns the same services'); + } + + public function crossCheckLoadersDumpers() + { + $tests = array( + array('services1.xml', 'xml'), + array('services2.xml', 'xml'), + array('services6.xml', 'xml'), + array('services8.xml', 'xml'), + array('services9.xml', 'xml'), + ); + + if (class_exists('Symfony\Component\Yaml\Yaml')) { + $tests = array_merge($tests, array( + array('services1.yml', 'yaml'), + array('services2.yml', 'yaml'), + array('services6.yml', 'yaml'), + array('services8.yml', 'yaml'), + array('services9.yml', 'yaml'), + )); + } + + return $tests; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php new file mode 100644 index 0000000..a266e9b --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php @@ -0,0 +1,120 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests; + +use Symfony\Component\DependencyInjection\DefinitionDecorator; + +class DefinitionDecoratorTest extends \PHPUnit_Framework_TestCase +{ + public function testConstructor() + { + $def = new DefinitionDecorator('foo'); + + $this->assertEquals('foo', $def->getParent()); + $this->assertEquals(array(), $def->getChanges()); + } + + /** + * @dataProvider getPropertyTests + */ + public function testSetProperty($property, $changeKey) + { + $def = new DefinitionDecorator('foo'); + + $getter = 'get'.ucfirst($property); + $setter = 'set'.ucfirst($property); + + $this->assertNull($def->$getter()); + $this->assertSame($def, $def->$setter('foo')); + $this->assertEquals('foo', $def->$getter()); + $this->assertEquals(array($changeKey => true), $def->getChanges()); + } + + public function getPropertyTests() + { + return array( + array('class', 'class'), + array('factoryClass', 'factory_class'), + array('factoryMethod', 'factory_method'), + array('factoryService', 'factory_service'), + array('configurator', 'configurator'), + array('file', 'file'), + ); + } + + public function testSetPublic() + { + $def = new DefinitionDecorator('foo'); + + $this->assertTrue($def->isPublic()); + $this->assertSame($def, $def->setPublic(false)); + $this->assertFalse($def->isPublic()); + $this->assertEquals(array('public' => true), $def->getChanges()); + } + + public function testSetLazy() + { + $def = new DefinitionDecorator('foo'); + + $this->assertFalse($def->isLazy()); + $this->assertSame($def, $def->setLazy(false)); + $this->assertFalse($def->isLazy()); + $this->assertEquals(array('lazy' => true), $def->getChanges()); + } + + public function testSetArgument() + { + $def = new DefinitionDecorator('foo'); + + $this->assertEquals(array(), $def->getArguments()); + $this->assertSame($def, $def->replaceArgument(0, 'foo')); + $this->assertEquals(array('index_0' => 'foo'), $def->getArguments()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testReplaceArgumentShouldRequireIntegerIndex() + { + $def = new DefinitionDecorator('foo'); + + $def->replaceArgument('0', 'foo'); + } + + public function testReplaceArgument() + { + $def = new DefinitionDecorator('foo'); + + $def->setArguments(array(0 => 'foo', 1 => 'bar')); + $this->assertEquals('foo', $def->getArgument(0)); + $this->assertEquals('bar', $def->getArgument(1)); + + $this->assertSame($def, $def->replaceArgument(1, 'baz')); + $this->assertEquals('foo', $def->getArgument(0)); + $this->assertEquals('baz', $def->getArgument(1)); + + $this->assertEquals(array(0 => 'foo', 1 => 'bar', 'index_1' => 'baz'), $def->getArguments()); + } + + /** + * @expectedException \OutOfBoundsException + */ + public function testGetArgumentShouldCheckBounds() + { + $def = new DefinitionDecorator('foo'); + + $def->setArguments(array(0 => 'foo')); + $def->replaceArgument(0, 'foo'); + + $def->getArgument(1); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php new file mode 100644 index 0000000..9b4cf21 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php @@ -0,0 +1,336 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests; + +use Symfony\Component\DependencyInjection\Definition; + +class DefinitionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\Definition::__construct + */ + public function testConstructor() + { + $def = new Definition('stdClass'); + $this->assertEquals('stdClass', $def->getClass(), '__construct() takes the class name as its first argument'); + + $def = new Definition('stdClass', array('foo')); + $this->assertEquals(array('foo'), $def->getArguments(), '__construct() takes an optional array of arguments as its second argument'); + } + + public function testSetGetFactoryClass() + { + $def = new Definition('stdClass'); + $this->assertNull($def->getFactoryClass()); + $this->assertSame($def, $def->setFactoryClass('stdClass2'), "->setFactoryClass() implements a fluent interface."); + $this->assertEquals('stdClass2', $def->getFactoryClass(), "->getFactoryClass() returns current class to construct this service."); + } + + public function testSetGetFactoryMethod() + { + $def = new Definition('stdClass'); + $this->assertNull($def->getFactoryMethod()); + $this->assertSame($def, $def->setFactoryMethod('foo'), '->setFactoryMethod() implements a fluent interface'); + $this->assertEquals('foo', $def->getFactoryMethod(), '->getFactoryMethod() returns the factory method name'); + } + + public function testSetGetFactoryService() + { + $def = new Definition('stdClass'); + $this->assertNull($def->getFactoryService()); + $this->assertSame($def, $def->setFactoryService('foo.bar'), "->setFactoryService() implements a fluent interface."); + $this->assertEquals('foo.bar', $def->getFactoryService(), "->getFactoryService() returns current service to construct this service."); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setClass + * @covers Symfony\Component\DependencyInjection\Definition::getClass + */ + public function testSetGetClass() + { + $def = new Definition('stdClass'); + $this->assertSame($def, $def->setClass('foo'), '->setClass() implements a fluent interface'); + $this->assertEquals('foo', $def->getClass(), '->getClass() returns the class name'); + } + + public function testSetGetDecoratedService() + { + $def = new Definition('stdClass'); + $this->assertNull($def->getDecoratedService()); + $def->setDecoratedService('foo', 'foo.renamed'); + $this->assertEquals(array('foo', 'foo.renamed'), $def->getDecoratedService()); + $def->setDecoratedService(null); + $this->assertNull($def->getDecoratedService()); + + $def = new Definition('stdClass'); + $def->setDecoratedService('foo'); + $this->assertEquals(array('foo', null), $def->getDecoratedService()); + $def->setDecoratedService(null); + $this->assertNull($def->getDecoratedService()); + + $def = new Definition('stdClass'); + $this->setExpectedException('InvalidArgumentException', 'The decorated service inner name for "foo" must be different than the service name itself.'); + $def->setDecoratedService('foo', 'foo'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setArguments + * @covers Symfony\Component\DependencyInjection\Definition::getArguments + * @covers Symfony\Component\DependencyInjection\Definition::addArgument + */ + public function testArguments() + { + $def = new Definition('stdClass'); + $this->assertSame($def, $def->setArguments(array('foo')), '->setArguments() implements a fluent interface'); + $this->assertEquals(array('foo'), $def->getArguments(), '->getArguments() returns the arguments'); + $this->assertSame($def, $def->addArgument('bar'), '->addArgument() implements a fluent interface'); + $this->assertEquals(array('foo', 'bar'), $def->getArguments(), '->addArgument() adds an argument'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setMethodCalls + * @covers Symfony\Component\DependencyInjection\Definition::addMethodCall + * @covers Symfony\Component\DependencyInjection\Definition::hasMethodCall + * @covers Symfony\Component\DependencyInjection\Definition::removeMethodCall + */ + public function testMethodCalls() + { + $def = new Definition('stdClass'); + $this->assertSame($def, $def->setMethodCalls(array(array('foo', array('foo')))), '->setMethodCalls() implements a fluent interface'); + $this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->getMethodCalls() returns the methods to call'); + $this->assertSame($def, $def->addMethodCall('bar', array('bar')), '->addMethodCall() implements a fluent interface'); + $this->assertEquals(array(array('foo', array('foo')), array('bar', array('bar'))), $def->getMethodCalls(), '->addMethodCall() adds a method to call'); + $this->assertTrue($def->hasMethodCall('bar'), '->hasMethodCall() returns true if first argument is a method to call registered'); + $this->assertFalse($def->hasMethodCall('no_registered'), '->hasMethodCall() returns false if first argument is not a method to call registered'); + $this->assertSame($def, $def->removeMethodCall('bar'), '->removeMethodCall() implements a fluent interface'); + $this->assertEquals(array(array('foo', array('foo'))), $def->getMethodCalls(), '->removeMethodCall() removes a method to call'); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException + * @expectedExceptionMessage Method name cannot be empty. + */ + public function testExceptionOnEmptyMethodCall() + { + $def = new Definition('stdClass'); + $def->addMethodCall(''); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setFile + * @covers Symfony\Component\DependencyInjection\Definition::getFile + */ + public function testSetGetFile() + { + $def = new Definition('stdClass'); + $this->assertSame($def, $def->setFile('foo'), '->setFile() implements a fluent interface'); + $this->assertEquals('foo', $def->getFile(), '->getFile() returns the file to include'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setScope + * @covers Symfony\Component\DependencyInjection\Definition::getScope + */ + public function testSetGetScope() + { + $def = new Definition('stdClass'); + $this->assertEquals('container', $def->getScope()); + $this->assertSame($def, $def->setScope('foo')); + $this->assertEquals('foo', $def->getScope()); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setPublic + * @covers Symfony\Component\DependencyInjection\Definition::isPublic + */ + public function testSetIsPublic() + { + $def = new Definition('stdClass'); + $this->assertTrue($def->isPublic(), '->isPublic() returns true by default'); + $this->assertSame($def, $def->setPublic(false), '->setPublic() implements a fluent interface'); + $this->assertFalse($def->isPublic(), '->isPublic() returns false if the instance must not be public.'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setSynthetic + * @covers Symfony\Component\DependencyInjection\Definition::isSynthetic + */ + public function testSetIsSynthetic() + { + $def = new Definition('stdClass'); + $this->assertFalse($def->isSynthetic(), '->isSynthetic() returns false by default'); + $this->assertSame($def, $def->setSynthetic(true), '->setSynthetic() implements a fluent interface'); + $this->assertTrue($def->isSynthetic(), '->isSynthetic() returns true if the service is synthetic.'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setSynchronized + * @covers Symfony\Component\DependencyInjection\Definition::isSynchronized + */ + public function testSetIsSynchronized() + { + $def = new Definition('stdClass'); + $this->assertFalse($def->isSynchronized(), '->isSynchronized() returns false by default'); + $this->assertSame($def, $def->setSynchronized(true), '->setSynchronized() implements a fluent interface'); + $this->assertTrue($def->isSynchronized(), '->isSynchronized() returns true if the service is synchronized.'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setLazy + * @covers Symfony\Component\DependencyInjection\Definition::isLazy + */ + public function testSetIsLazy() + { + $def = new Definition('stdClass'); + $this->assertFalse($def->isLazy(), '->isLazy() returns false by default'); + $this->assertSame($def, $def->setLazy(true), '->setLazy() implements a fluent interface'); + $this->assertTrue($def->isLazy(), '->isLazy() returns true if the service is lazy.'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setAbstract + * @covers Symfony\Component\DependencyInjection\Definition::isAbstract + */ + public function testSetIsAbstract() + { + $def = new Definition('stdClass'); + $this->assertFalse($def->isAbstract(), '->isAbstract() returns false by default'); + $this->assertSame($def, $def->setAbstract(true), '->setAbstract() implements a fluent interface'); + $this->assertTrue($def->isAbstract(), '->isAbstract() returns true if the instance must not be public.'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::setConfigurator + * @covers Symfony\Component\DependencyInjection\Definition::getConfigurator + */ + public function testSetGetConfigurator() + { + $def = new Definition('stdClass'); + $this->assertSame($def, $def->setConfigurator('foo'), '->setConfigurator() implements a fluent interface'); + $this->assertEquals('foo', $def->getConfigurator(), '->getConfigurator() returns the configurator'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::clearTags + */ + public function testClearTags() + { + $def = new Definition('stdClass'); + $this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface'); + $def->addTag('foo', array('foo' => 'bar')); + $def->clearTags(); + $this->assertEquals(array(), $def->getTags(), '->clearTags() removes all current tags'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::clearTags + */ + public function testClearTag() + { + $def = new Definition('stdClass'); + $this->assertSame($def, $def->clearTags(), '->clearTags() implements a fluent interface'); + $def->addTag('1foo1', array('foo1' => 'bar1')); + $def->addTag('2foo2', array('foo2' => 'bar2')); + $def->addTag('3foo3', array('foo3' => 'bar3')); + $def->clearTag('2foo2'); + $this->assertTrue($def->hasTag('1foo1')); + $this->assertFalse($def->hasTag('2foo2')); + $this->assertTrue($def->hasTag('3foo3')); + $def->clearTag('1foo1'); + $this->assertFalse($def->hasTag('1foo1')); + $this->assertTrue($def->hasTag('3foo3')); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::addTag + * @covers Symfony\Component\DependencyInjection\Definition::getTag + * @covers Symfony\Component\DependencyInjection\Definition::getTags + * @covers Symfony\Component\DependencyInjection\Definition::hasTag + */ + public function testTags() + { + $def = new Definition('stdClass'); + $this->assertEquals(array(), $def->getTag('foo'), '->getTag() returns an empty array if the tag is not defined'); + $this->assertFalse($def->hasTag('foo')); + $this->assertSame($def, $def->addTag('foo'), '->addTag() implements a fluent interface'); + $this->assertTrue($def->hasTag('foo')); + $this->assertEquals(array(array()), $def->getTag('foo'), '->getTag() returns attributes for a tag name'); + $def->addTag('foo', array('foo' => 'bar')); + $this->assertEquals(array(array(), array('foo' => 'bar')), $def->getTag('foo'), '->addTag() can adds the same tag several times'); + $def->addTag('bar', array('bar' => 'bar')); + $this->assertEquals($def->getTags(), array( + 'foo' => array(array(), array('foo' => 'bar')), + 'bar' => array(array('bar' => 'bar')), + ), '->getTags() returns all tags'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Definition::replaceArgument + */ + public function testSetArgument() + { + $def = new Definition('stdClass'); + + $def->addArgument('foo'); + $this->assertSame(array('foo'), $def->getArguments()); + + $this->assertSame($def, $def->replaceArgument(0, 'moo')); + $this->assertSame(array('moo'), $def->getArguments()); + + $def->addArgument('moo'); + $def + ->replaceArgument(0, 'foo') + ->replaceArgument(1, 'bar') + ; + $this->assertSame(array('foo', 'bar'), $def->getArguments()); + } + + /** + * @expectedException \OutOfBoundsException + */ + public function testGetArgumentShouldCheckBounds() + { + $def = new Definition('stdClass'); + + $def->addArgument('foo'); + $def->getArgument(1); + } + + /** + * @expectedException \OutOfBoundsException + */ + public function testReplaceArgumentShouldCheckBounds() + { + $def = new Definition('stdClass'); + + $def->addArgument('foo'); + $def->replaceArgument(1, 'bar'); + } + + public function testSetGetProperties() + { + $def = new Definition('stdClass'); + + $this->assertEquals(array(), $def->getProperties()); + $this->assertSame($def, $def->setProperties(array('foo' => 'bar'))); + $this->assertEquals(array('foo' => 'bar'), $def->getProperties()); + } + + public function testSetProperty() + { + $def = new Definition('stdClass'); + + $this->assertEquals(array(), $def->getProperties()); + $this->assertSame($def, $def->setProperty('foo', 'bar')); + $this->assertEquals(array('foo' => 'bar'), $def->getProperties()); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php new file mode 100644 index 0000000..79689d7 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Dumper; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper; + +class GraphvizDumperTest extends \PHPUnit_Framework_TestCase +{ + protected static $fixturesPath; + + public static function setUpBeforeClass() + { + self::$fixturesPath = __DIR__.'/../Fixtures/'; + } + + public function testDump() + { + $dumper = new GraphvizDumper($container = new ContainerBuilder()); + + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services1.dot', $dumper->dump(), '->dump() dumps an empty container as an empty dot file'); + + $container = include self::$fixturesPath.'/containers/container9.php'; + $dumper = new GraphvizDumper($container); + $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services9.dot')), $dumper->dump(), '->dump() dumps services'); + + $container = include self::$fixturesPath.'/containers/container10.php'; + $dumper = new GraphvizDumper($container); + $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services10.dot')), $dumper->dump(), '->dump() dumps services'); + + $container = include self::$fixturesPath.'/containers/container10.php'; + $dumper = new GraphvizDumper($container); + $this->assertEquals($dumper->dump(array( + 'graph' => array('ratio' => 'normal'), + 'node' => array('fontsize' => 13, 'fontname' => 'Verdana', 'shape' => 'square'), + 'edge' => array('fontsize' => 12, 'fontname' => 'Verdana', 'color' => 'white', 'arrowhead' => 'closed', 'arrowsize' => 1), + 'node.instance' => array('fillcolor' => 'green', 'style' => 'empty'), + 'node.definition' => array('fillcolor' => 'grey'), + 'node.missing' => array('fillcolor' => 'red', 'style' => 'empty'), + )), str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services10-1.dot')), '->dump() dumps services'); + } + + public function testDumpWithFrozenContainer() + { + $container = include self::$fixturesPath.'/containers/container13.php'; + $dumper = new GraphvizDumper($container); + $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services13.dot')), $dumper->dump(), '->dump() dumps services'); + } + + public function testDumpWithFrozenCustomClassContainer() + { + $container = include self::$fixturesPath.'/containers/container14.php'; + $dumper = new GraphvizDumper($container); + $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services14.dot')), $dumper->dump(), '->dump() dumps services'); + } + + public function testDumpWithUnresolvedParameter() + { + $container = include self::$fixturesPath.'/containers/container17.php'; + $dumper = new GraphvizDumper($container); + + $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services17.dot')), $dumper->dump(), '->dump() dumps services'); + } + + public function testDumpWithScopes() + { + $container = include self::$fixturesPath.'/containers/container18.php'; + $dumper = new GraphvizDumper($container); + $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services18.dot')), $dumper->dump(), '->dump() dumps services'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php new file mode 100644 index 0000000..2693cbd --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -0,0 +1,217 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Dumper; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Definition; + +class PhpDumperTest extends \PHPUnit_Framework_TestCase +{ + protected static $fixturesPath; + + public static function setUpBeforeClass() + { + self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); + } + + public function testDump() + { + $dumper = new PhpDumper($container = new ContainerBuilder()); + + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services1.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services1-1.php', $dumper->dump(array('class' => 'Container', 'base_class' => 'AbstractContainer', 'namespace' => 'Symfony\Component\DependencyInjection\Dump')), '->dump() takes a class and a base_class options'); + + $container = new ContainerBuilder(); + new PhpDumper($container); + } + + public function testDumpFrozenContainerWithNoParameter() + { + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->register('foo', 'stdClass'); + + $container->compile(); + + $dumper = new PhpDumper($container); + + $dumpedString = $dumper->dump(); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services11.php', $dumpedString, '->dump() does not add getDefaultParameters() method call if container have no parameters.'); + $this->assertNotRegexp("/function getDefaultParameters\(/", $dumpedString, '->dump() does not add getDefaultParameters() method definition.'); + } + + public function testDumpOptimizationString() + { + $definition = new Definition(); + $definition->setClass('stdClass'); + $definition->addArgument(array( + 'only dot' => '.', + 'concatenation as value' => '.\'\'.', + 'concatenation from the start value' => '\'\'.', + '.' => 'dot as a key', + '.\'\'.' => 'concatenation as a key', + '\'\'.' => 'concatenation from the start key', + 'optimize concatenation' => "string1%some_string%string2", + 'optimize concatenation with empty string' => "string1%empty_value%string2", + 'optimize concatenation from the start' => '%empty_value%start', + 'optimize concatenation at the end' => 'end%empty_value%', + )); + + $container = new ContainerBuilder(); + $container->setResourceTracking(false); + $container->setDefinition('test', $definition); + $container->setParameter('empty_value', ''); + $container->setParameter('some_string', '-'); + $container->compile(); + + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services10.php', $dumper->dump(), '->dump() dumps an empty container as an empty PHP class'); + } + + public function testDumpRelativeDir() + { + $definition = new Definition(); + $definition->setClass('stdClass'); + $definition->addArgument('%foo%'); + $definition->addArgument(array('%foo%' => '%foo%')); + + $container = new ContainerBuilder(); + $container->setDefinition('test', $definition); + $container->setParameter('foo', 'wiz'.dirname(dirname(__FILE__))); + $container->setParameter('bar', dirname(__FILE__)); + $container->setParameter('baz', '%bar%/PhpDumperTest.php'); + $container->compile(); + + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services12.php', $dumper->dump(array('file' => __FILE__)), '->dump() dumps __DIR__ relative strings'); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testExportParameters() + { + $dumper = new PhpDumper(new ContainerBuilder(new ParameterBag(array('foo' => new Reference('foo'))))); + $dumper->dump(); + } + + public function testAddParameters() + { + $container = include self::$fixturesPath.'/containers/container8.php'; + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services8.php', $dumper->dump(), '->dump() dumps parameters'); + } + + public function testAddService() + { + // without compilation + $container = include self::$fixturesPath.'/containers/container9.php'; + $dumper = new PhpDumper($container); + $this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services9.php')), $dumper->dump(), '->dump() dumps services'); + + // with compilation + $container = include self::$fixturesPath.'/containers/container9.php'; + $container->compile(); + $dumper = new PhpDumper($container); + $this->assertEquals(str_replace('%path%', str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), file_get_contents(self::$fixturesPath.'/php/services9_compiled.php')), $dumper->dump(), '->dump() dumps services'); + + $dumper = new PhpDumper($container = new ContainerBuilder()); + $container->register('foo', 'FooClass')->addArgument(new \stdClass()); + try { + $dumper->dump(); + $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + } catch (\Exception $e) { + $this->assertInstanceOf('\Symfony\Component\DependencyInjection\Exception\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + } + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Service id "bar$" cannot be converted to a valid PHP method name. + */ + public function testAddServiceInvalidServiceId() + { + $container = new ContainerBuilder(); + $container->register('bar$', 'FooClass'); + $dumper = new PhpDumper($container); + $dumper->dump(); + } + + public function testAliases() + { + $container = include self::$fixturesPath.'/containers/container9.php'; + $container->compile(); + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Aliases'))); + + $container = new \Symfony_DI_PhpDumper_Test_Aliases(); + $container->set('foo', $foo = new \stdClass()); + $this->assertSame($foo, $container->get('foo')); + $this->assertSame($foo, $container->get('alias_for_foo')); + $this->assertSame($foo, $container->get('alias_for_alias')); + } + + public function testFrozenContainerWithoutAliases() + { + $container = new ContainerBuilder(); + $container->compile(); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Frozen_No_Aliases'))); + + $container = new \Symfony_DI_PhpDumper_Test_Frozen_No_Aliases(); + $this->assertFalse($container->has('foo')); + } + + public function testOverrideServiceWhenUsingADumpedContainer() + { + require_once self::$fixturesPath.'/php/services9.php'; + require_once self::$fixturesPath.'/includes/foo.php'; + + $container = new \ProjectServiceContainer(); + $container->set('bar', $bar = new \stdClass()); + $container->setParameter('foo_bar', 'foo_bar'); + + $this->assertEquals($bar, $container->get('bar'), '->set() overrides an already defined service'); + } + + public function testOverrideServiceWhenUsingADumpedContainerAndServiceIsUsedFromAnotherOne() + { + require_once self::$fixturesPath.'/php/services9.php'; + require_once self::$fixturesPath.'/includes/foo.php'; + require_once self::$fixturesPath.'/includes/classes.php'; + + $container = new \ProjectServiceContainer(); + $container->set('bar', $bar = new \stdClass()); + + $this->assertSame($bar, $container->get('foo')->bar, '->set() overrides an already defined service'); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + */ + public function testCircularReference() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->addArgument(new Reference('bar')); + $container->register('bar', 'stdClass')->setPublic(false)->addMethodCall('setA', array(new Reference('baz'))); + $container->register('baz', 'stdClass')->addMethodCall('setA', array(new Reference('foo'))); + $container->compile(); + + $dumper = new PhpDumper($container); + $dumper->dump(); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php new file mode 100644 index 0000000..d3116b0 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Dumper; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\XmlDumper; + +class XmlDumperTest extends \PHPUnit_Framework_TestCase +{ + protected static $fixturesPath; + + public static function setUpBeforeClass() + { + self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); + } + + public function testDump() + { + $dumper = new XmlDumper($container = new ContainerBuilder()); + + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/xml/services1.xml', $dumper->dump(), '->dump() dumps an empty container as an empty XML file'); + + $container = new ContainerBuilder(); + $dumper = new XmlDumper($container); + } + + public function testExportParameters() + { + $container = include self::$fixturesPath.'//containers/container8.php'; + $dumper = new XmlDumper($container); + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/xml/services8.xml', $dumper->dump(), '->dump() dumps parameters'); + } + + public function testAddParameters() + { + $container = include self::$fixturesPath.'//containers/container8.php'; + $dumper = new XmlDumper($container); + $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/xml/services8.xml', $dumper->dump(), '->dump() dumps parameters'); + } + + public function testAddService() + { + $container = include self::$fixturesPath.'/containers/container9.php'; + $dumper = new XmlDumper($container); + $this->assertEquals(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/xml/services9.xml')), $dumper->dump(), '->dump() dumps services'); + + $dumper = new XmlDumper($container = new ContainerBuilder()); + $container->register('foo', 'FooClass')->addArgument(new \stdClass()); + try { + $dumper->dump(); + $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + } catch (\Exception $e) { + $this->assertInstanceOf('\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + } + } + + public function testDumpAnonymousServices() + { + $container = include self::$fixturesPath.'/containers/container11.php'; + $dumper = new XmlDumper($container); + $this->assertEquals(" + + + + + + + + + + + + + +", $dumper->dump()); + } + + public function testDumpEntities() + { + $container = include self::$fixturesPath.'/containers/container12.php'; + $dumper = new XmlDumper($container); + $this->assertEquals(" + + + + + foo<>&bar + + + +", $dumper->dump()); + } + + /** + * @dataProvider provideDecoratedServicesData + */ + public function testDumpDecoratedServices($expectedXmlDump, $container) + { + $dumper = new XmlDumper($container); + $this->assertEquals($expectedXmlDump, $dumper->dump()); + } + + public function provideDecoratedServicesData() + { + $fixturesPath = realpath(__DIR__.'/../Fixtures/'); + + return array( + array(" + + + + + +", include $fixturesPath.'/containers/container15.php'), + array(" + + + + + +", include $fixturesPath.'/containers/container16.php'), + ); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php new file mode 100644 index 0000000..f9747a7 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Dumper; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\YamlDumper; + +class YamlDumperTest extends \PHPUnit_Framework_TestCase +{ + protected static $fixturesPath; + + public static function setUpBeforeClass() + { + self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); + } + + public function testDump() + { + $dumper = new YamlDumper($container = new ContainerBuilder()); + + $this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services1.yml', $dumper->dump(), '->dump() dumps an empty container as an empty YAML file'); + + $container = new ContainerBuilder(); + $dumper = new YamlDumper($container); + } + + public function testAddParameters() + { + $container = include self::$fixturesPath.'/containers/container8.php'; + $dumper = new YamlDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services8.yml', $dumper->dump(), '->dump() dumps parameters'); + } + + public function testAddService() + { + $container = include self::$fixturesPath.'/containers/container9.php'; + $dumper = new YamlDumper($container); + $this->assertEquals(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services'); + + $dumper = new YamlDumper($container = new ContainerBuilder()); + $container->register('foo', 'FooClass')->addArgument(new \stdClass()); + try { + $dumper->dump(); + $this->fail('->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + } catch (\Exception $e) { + $this->assertInstanceOf('\RuntimeException', $e, '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php new file mode 100644 index 0000000..e7f19a6 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Extension/ExtensionTest.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Extension; + +class ExtensionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getResolvedEnabledFixtures + */ + public function testIsConfigEnabledReturnsTheResolvedValue($enabled) + { + $pb = $this->getMockBuilder('Symfony\Component\DependencyInjection\ParameterBag\ParameterBag') + ->setMethods(array('resolveValue')) + ->getMock() + ; + + $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') + ->setMethods(array('getParameterBag')) + ->getMock() + ; + + $pb->expects($this->once()) + ->method('resolveValue') + ->with($this->equalTo($enabled)) + ->will($this->returnValue($enabled)) + ; + + $container->expects($this->once()) + ->method('getParameterBag') + ->will($this->returnValue($pb)) + ; + + $extension = $this->getMockBuilder('Symfony\Component\DependencyInjection\Extension\Extension') + ->setMethods(array()) + ->getMockForAbstractClass() + ; + + $r = new \ReflectionMethod('Symfony\Component\DependencyInjection\Extension\Extension', 'isConfigEnabled'); + $r->setAccessible(true); + + $r->invoke($extension, $container, array('enabled' => $enabled)); + } + + public function getResolvedEnabledFixtures() + { + return array( + array(true), + array(false), + ); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException + * @expectedExceptionMessage The config array has no 'enabled' key. + */ + public function testIsConfigEnabledOnNonEnableableConfig() + { + $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder') + ->getMock() + ; + + $extension = $this->getMockBuilder('Symfony\Component\DependencyInjection\Extension\Extension') + ->setMethods(array()) + ->getMockForAbstractClass() + ; + + $r = new \ReflectionMethod('Symfony\Component\DependencyInjection\Extension\Extension', 'isConfigEnabled'); + $r->setAccessible(true); + + $r->invoke($extension, $container, array()); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container10.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container10.php new file mode 100644 index 0000000..a16ca9f --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container10.php @@ -0,0 +1,14 @@ + + register('foo', 'FooClass')-> + addArgument(new Reference('bar')) +; + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php new file mode 100644 index 0000000..3e6cafc --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php @@ -0,0 +1,12 @@ + + register('foo', 'FooClass')-> + addArgument(new Definition('BarClass', array(new Definition('BazClass')))) +; + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php new file mode 100644 index 0000000..0dc8679 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php @@ -0,0 +1,13 @@ + + register('foo', 'FooClass\\Foo')-> + addArgument('foo<>&bar')-> + addTag('foo"bar\\bar', array('foo' => 'foo"barřž€')) +; + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container13.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container13.php new file mode 100644 index 0000000..cc716c7 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container13.php @@ -0,0 +1,16 @@ + + register('foo', 'FooClass')-> + addArgument(new Reference('bar')) +; +$container-> + register('bar', 'BarClass') +; +$container->compile(); + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php new file mode 100644 index 0000000..593be9c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php @@ -0,0 +1,11 @@ +register('foo', 'FooClass\\Foo') + ->setDecoratedService('bar', 'bar.woozy') +; + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container16.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container16.php new file mode 100644 index 0000000..67b4d35 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container16.php @@ -0,0 +1,11 @@ +register('foo', 'FooClass\\Foo') + ->setDecoratedService('bar') +; + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container17.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container17.php new file mode 100644 index 0000000..d902ec2 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container17.php @@ -0,0 +1,10 @@ +register('foo', '%foo.class%') +; + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container18.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container18.php new file mode 100644 index 0000000..0248ed4 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container18.php @@ -0,0 +1,14 @@ +addScope(new Scope('request')); +$container-> + register('foo', 'FooClass')-> + setScope('request') +; +$container->compile(); + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php new file mode 100644 index 0000000..f0b4ca9 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php @@ -0,0 +1,14 @@ + '%baz%', + 'baz' => 'bar', + 'bar' => 'foo is %%foo bar', + 'escape' => '@escapeme', + 'values' => array(true, false, null, 0, 1000.3, 'true', 'false', 'null'), +))); + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php new file mode 100644 index 0000000..5565def --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php @@ -0,0 +1,107 @@ + + register('foo', 'Bar\FooClass')-> + addTag('foo', array('foo' => 'foo'))-> + addTag('foo', array('bar' => 'bar'))-> + setFactoryClass('Bar\\FooClass')-> + setFactoryMethod('getInstance')-> + setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, new Reference('service_container')))-> + setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%')))-> + addMethodCall('setBar', array(new Reference('bar')))-> + addMethodCall('initialize')-> + setConfigurator('sc_configure') +; +$container-> + register('bar', 'Bar\FooClass')-> + setArguments(array('foo', new Reference('foo.baz'), new Parameter('foo_bar')))-> + setScope('container')-> + setConfigurator(array(new Reference('foo.baz'), 'configure')) +; +$container-> + register('foo.baz', '%baz_class%')-> + setFactoryClass('%baz_class%')-> + setFactoryMethod('getInstance')-> + setConfigurator(array('%baz_class%', 'configureStatic1')) +; +$container-> + register('foo_bar', '%foo_class%')-> + setScope('prototype') +; +$container->getParameterBag()->clear(); +$container->getParameterBag()->add(array( + 'baz_class' => 'BazClass', + 'foo_class' => 'Bar\FooClass', + 'foo' => 'bar', +)); +$container->setAlias('alias_for_foo', 'foo'); +$container->setAlias('alias_for_alias', 'alias_for_foo'); +$container-> + register('method_call1', 'Bar\FooClass')-> + setFile(realpath(__DIR__.'/../includes/foo.php'))-> + addMethodCall('setBar', array(new Reference('foo')))-> + addMethodCall('setBar', array(new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE)))-> + addMethodCall('setBar', array(new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)))-> + addMethodCall('setBar', array(new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)))-> + addMethodCall('setBar', array(new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")'))) +; +$container-> + register('factory_service', 'Bar')-> + setFactoryService('foo.baz')-> + setFactoryMethod('getInstance') +; + +$container + ->register('foo_with_inline', 'Foo') + ->addMethodCall('setBar', array(new Reference('inlined'))) +; +$container + ->register('inlined', 'Bar') + ->setProperty('pub', 'pub') + ->addMethodCall('setBaz', array(new Reference('baz'))) + ->setPublic(false) +; +$container + ->register('baz', 'Baz') + ->addMethodCall('setFoo', array(new Reference('foo_with_inline'))) +; +$container + ->register('request', 'Request') + ->setSynthetic(true) + ->setSynchronized(true) +; +$container + ->register('depends_on_request', 'stdClass') + ->addMethodCall('setRequest', array(new Reference('request', ContainerInterface::NULL_ON_INVALID_REFERENCE, false))) +; +$container + ->register('configurator_service', 'ConfClass') + ->setPublic(false) + ->addMethodCall('setFoo', array(new Reference('baz'))) +; +$container + ->register('configured_service', 'stdClass') + ->setConfigurator(array(new Reference('configurator_service'), 'configureStdClass')) +; +$container + ->register('decorated', 'stdClass') +; +$container + ->register('decorator_service', 'stdClass') + ->setDecoratedService('decorated') +; +$container + ->register('decorator_service_with_name', 'stdClass') + ->setDecoratedService('decorated', 'decorated.pif-pouf') +; + +return $container; diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces1.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces1.php new file mode 100644 index 0000000..27503a3 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces1.php @@ -0,0 +1,25 @@ +setParameter('cla', 'Fo'); +$container->setParameter('ss', 'Class'); + +$definition = new Definition('%cla%o%ss%'); +$container->setDefinition('foo', $definition); + +return $container; + +if (!class_exists('FooClass')) { + class FooClass + { + public $bar; + + public function setBar($bar) + { + $this->bar = $bar; + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces2.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces2.php new file mode 100644 index 0000000..a851901 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces2.php @@ -0,0 +1,34 @@ +setDefinition('barFactory', $factoryDefinition); + +$definition = new Definition(); +$definition->setFactoryService('barFactory'); +$definition->setFactoryMethod('createBarClass'); +$container->setDefinition('bar', $definition); + +return $container; + +class BarClass +{ + public $foo; + + public function setBar($foo) + { + $this->foo = $foo; + } +} + +class BarClassFactory +{ + public function createBarClass() + { + return new BarClass(); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot new file mode 100644 index 0000000..1bb7c30 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot @@ -0,0 +1,7 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot new file mode 100644 index 0000000..0e578b1 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot @@ -0,0 +1,10 @@ +digraph sc { + ratio="normal" + node [fontsize="13" fontname="Verdana" shape="square"]; + edge [fontsize="12" fontname="Verdana" color="white" arrowhead="closed" arrowsize="1"]; + + node_foo [label="foo\nFooClass\n", shape=square, fillcolor="grey", style="filled"]; + node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=square, fillcolor="green", style="empty"]; + node_bar [label="bar\n\n", shape=square, fillcolor="red", style="empty"]; + node_foo -> node_bar [label="" style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot new file mode 100644 index 0000000..f17857f --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot @@ -0,0 +1,10 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; + node_bar [label="bar\n\n", shape=record, fillcolor="#ff9999", style="filled"]; + node_foo -> node_bar [label="" style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services13.dot b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services13.dot new file mode 100644 index 0000000..bc7f813 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services13.dot @@ -0,0 +1,10 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_bar [label="bar\nBarClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; + node_foo -> node_bar [label="" style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services14.dot b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services14.dot new file mode 100644 index 0000000..d07dc38 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services14.dot @@ -0,0 +1,7 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_service_container [label="service_container\nContainer14\\ProjectServiceContainer\n", shape=record, fillcolor="#9999ff", style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services17.dot b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services17.dot new file mode 100644 index 0000000..a6d04bf --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services17.dot @@ -0,0 +1,8 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_foo [label="foo\n%foo.class%\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services18.dot b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services18.dot new file mode 100644 index 0000000..4fbccee --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services18.dot @@ -0,0 +1,8 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_foo [label="foo\nFooClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot new file mode 100644 index 0000000..6bf53e5 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot @@ -0,0 +1,40 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_foo [label="foo (alias_for_foo)\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_bar [label="bar\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_foo_baz [label="foo.baz\nBazClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_foo_bar [label="foo_bar\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="dotted"]; + node_method_call1 [label="method_call1\nBar\\FooClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_factory_service [label="factory_service\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_foo_with_inline [label="foo_with_inline\nFoo\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_inlined [label="inlined\nBar\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_baz [label="baz\nBaz\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_request [label="request\nRequest\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_depends_on_request [label="depends_on_request\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_configurator_service [label="configurator_service\nConfClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_configured_service [label="configured_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_decorated [label="decorated\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_decorator_service [label="decorator_service\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_decorator_service_with_name [label="decorator_service_with_name\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; + node_foo2 [label="foo2\n\n", shape=record, fillcolor="#ff9999", style="filled"]; + node_foo3 [label="foo3\n\n", shape=record, fillcolor="#ff9999", style="filled"]; + node_foobaz [label="foobaz\n\n", shape=record, fillcolor="#ff9999", style="filled"]; + node_foo -> node_foo_baz [label="" style="filled"]; + node_foo -> node_service_container [label="" style="filled"]; + node_foo -> node_foo_baz [label="" style="dashed"]; + node_foo -> node_bar [label="setBar()" style="dashed"]; + node_bar -> node_foo_baz [label="" style="filled"]; + node_method_call1 -> node_foo [label="setBar()" style="dashed"]; + node_method_call1 -> node_foo2 [label="setBar()" style="dashed"]; + node_method_call1 -> node_foo3 [label="setBar()" style="dashed"]; + node_method_call1 -> node_foobaz [label="setBar()" style="dashed"]; + node_foo_with_inline -> node_inlined [label="setBar()" style="dashed"]; + node_inlined -> node_baz [label="setBaz()" style="dashed"]; + node_baz -> node_foo_with_inline [label="setFoo()" style="dashed"]; + node_depends_on_request -> node_request [label="setRequest()" style="dashed"]; + node_configurator_service -> node_baz [label="setFoo()" style="dashed"]; +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php new file mode 100644 index 0000000..c9f8010 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php @@ -0,0 +1,40 @@ +setDefinition('project.service.bar', new Definition('FooClass')); + $configuration->setParameter('project.parameter.bar', isset($config['foo']) ? $config['foo'] : 'foobar'); + + $configuration->setDefinition('project.service.foo', new Definition('FooClass')); + $configuration->setParameter('project.parameter.foo', isset($config['foo']) ? $config['foo'] : 'foobar'); + + return $configuration; + } + + public function getXsdValidationBasePath() + { + return false; + } + + public function getNamespace() + { + return 'http://www.example.com/schema/project'; + } + + public function getAlias() + { + return 'project'; + } + + public function getConfiguration(array $config, ContainerBuilder $container) + { + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php new file mode 100644 index 0000000..2ee2f12 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php @@ -0,0 +1,19 @@ +A# zLP8n`gt&9#ui!7>hB(4=l2+ZJTe0LgvcK=W=kI&2?+9NI3CC$5!Hu~GgbJU@s^j!z z{1QBM7%2ZJ8MdYhcoM|C&3kxmYtW?-L2JZy@9%c{?%jvoUc1veSTEPe&bDQq8isKN z=QW&b2F35?`4D8>SOF>Ctr^B&_NuGb-{jBPS6ubDjx+Imh?pbt+ih;y6?>WtzZDF< zJ`$&2W{kSl$1*L`3t5to3u`2xH5$%QbIC08tz{A%A{~T*M@A|46iP|PpitVUEDVNB zZ!}o~J*NEia*i)(nkqr1lB1e??E}}fOHO`|QY}ZG=o*)#c)%h^1oL2d*pjc5K+h+W zi49X0i4bfrj*28Ru_o9Gs8ztV`Kx5!4Fi^3khL&jS=^KQ&NK?iYmmC}8Wg>v1h^Mt z3F8KR(%;{_L$hwO%sLiU%{3uN;z@)4|D9;AVaBgwz;iJsx9nJsotu@)mUGnYJkI*4 zU??Wh%em0!cq{5zM1l|^;A%gX(H@Lg8mb08PO(Eq0SqZV99?2|*#b#8+S{N5CMi*G z#O&8ugrb$`=(LZ=3vfi}j>&>CrDQNj)$Du}$Fp#muz1SHl<26)aP;0nP~6S;as##x fKmGdn{Kwgc7w>OxY?QCIKL337T|f4F&2IA_UuA6u literal 0 HcmV?d00001 diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php new file mode 100644 index 0000000..70c3d27 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -0,0 +1,61 @@ +configure(); +} + +class BarClass +{ + protected $baz; + public $foo = 'foo'; + + public function setBaz(BazClass $baz) + { + $this->baz = $baz; + } + + public function getBaz() + { + return $this->baz; + } +} + +class BazClass +{ + protected $foo; + + public function setFoo(Foo $foo) + { + $this->foo = $foo; + } + + public function configure($instance) + { + $instance->configure(); + } + + public static function getInstance() + { + return new self(); + } + + public static function configureStatic($instance) + { + $instance->configure(); + } + + public static function configureStatic1() + { + } +} + +class BarUserClass +{ + public $bar; + + public function __construct(BarClass $bar) + { + $this->bar = $bar; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php new file mode 100644 index 0000000..cfe9425 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php @@ -0,0 +1,47 @@ +addFromString('ProjectWithXsdExtensionInPhar.php', <<addFromString('schema/project-1.0.xsd', << + + + + + + + + + +EOT +); +$phar->setStub(''); diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php new file mode 100644 index 0000000..55968af --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php @@ -0,0 +1,38 @@ +arguments = $arguments; + } + + public static function getInstance($arguments = array()) + { + $obj = new self($arguments); + $obj->called = true; + + return $obj; + } + + public function initialize() + { + $this->initialized = true; + } + + public function configure() + { + $this->configured = true; + } + + public function setBar($value = null) + { + $this->bar = $value; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/schema/project-1.0.xsd b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/schema/project-1.0.xsd new file mode 100644 index 0000000..282884e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/schema/project-1.0.xsd @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/nonvalid.ini b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/nonvalid.ini new file mode 100644 index 0000000..9f84a60 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/nonvalid.ini @@ -0,0 +1,2 @@ +{NOT AN INI FILE} +{JUST A PLAIN TEXT FILE} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters.ini b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters.ini new file mode 100644 index 0000000..df92f75 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters.ini @@ -0,0 +1,3 @@ +[parameters] + foo = bar + bar = %foo% diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters1.ini b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters1.ini new file mode 100644 index 0000000..e50f722 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters1.ini @@ -0,0 +1,3 @@ +[parameters] + FOO = foo + baz = baz diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters2.ini b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters2.ini new file mode 100644 index 0000000..75fbac6 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters2.ini @@ -0,0 +1,2 @@ +[parameters] + imported_from_ini = true diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php new file mode 100644 index 0000000..ca7a5c6 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php @@ -0,0 +1,27 @@ +parameters = $this->getDefaultParameters(); + + $this->services = + $this->scopedServices = + $this->scopeStacks = array(); + + $this->set('service_container', $this); + + $this->scopes = array(); + $this->scopeChildren = array(); + $this->methodMap = array( + 'test' => 'getTestService', + ); + + $this->aliases = array(); + } + + /** + * Gets the 'test' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getTestService() + { + return $this->services['test'] = new \stdClass(array('only dot' => '.', 'concatenation as value' => '.\'\'.', 'concatenation from the start value' => '\'\'.', '.' => 'dot as a key', '.\'\'.' => 'concatenation as a key', '\'\'.' => 'concatenation from the start key', 'optimize concatenation' => 'string1-string2', 'optimize concatenation with empty string' => 'string1string2', 'optimize concatenation from the start' => 'start', 'optimize concatenation at the end' => 'end')); + } + + /** + * {@inheritdoc} + */ + public function getParameter($name) + { + $name = strtolower($name); + + if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); + } + + return $this->parameters[$name]; + } + + /** + * {@inheritdoc} + */ + public function hasParameter($name) + { + $name = strtolower($name); + + return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters); + } + + /** + * {@inheritdoc} + */ + public function setParameter($name, $value) + { + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); + } + + /** + * {@inheritdoc} + */ + public function getParameterBag() + { + if (null === $this->parameterBag) { + $this->parameterBag = new FrozenParameterBag($this->parameters); + } + + return $this->parameterBag; + } + /** + * Gets the default parameters. + * + * @return array An array of the default parameters + */ + protected function getDefaultParameters() + { + return array( + 'empty_value' => '', + 'some_string' => '-', + ); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php new file mode 100644 index 0000000..361b352 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php @@ -0,0 +1,53 @@ +services = + $this->scopedServices = + $this->scopeStacks = array(); + + $this->set('service_container', $this); + + $this->scopes = array(); + $this->scopeChildren = array(); + $this->methodMap = array( + 'foo' => 'getFooService', + ); + + $this->aliases = array(); + } + + /** + * Gets the 'foo' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getFooService() + { + return $this->services['foo'] = new \stdClass(); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php new file mode 100644 index 0000000..52d2702 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php @@ -0,0 +1,110 @@ +parameters = $this->getDefaultParameters(); + + $this->services = + $this->scopedServices = + $this->scopeStacks = array(); + + $this->set('service_container', $this); + + $this->scopes = array(); + $this->scopeChildren = array(); + $this->methodMap = array( + 'test' => 'getTestService', + ); + + $this->aliases = array(); + } + + /** + * Gets the 'test' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getTestService() + { + return $this->services['test'] = new \stdClass(('wiz'.dirname(__DIR__)), array(('wiz'.dirname(__DIR__)) => ('wiz'.dirname(__DIR__)))); + } + + /** + * {@inheritdoc} + */ + public function getParameter($name) + { + $name = strtolower($name); + + if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); + } + + return $this->parameters[$name]; + } + + /** + * {@inheritdoc} + */ + public function hasParameter($name) + { + $name = strtolower($name); + + return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters); + } + + /** + * {@inheritdoc} + */ + public function setParameter($name, $value) + { + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); + } + + /** + * {@inheritdoc} + */ + public function getParameterBag() + { + if (null === $this->parameterBag) { + $this->parameterBag = new FrozenParameterBag($this->parameters); + } + + return $this->parameterBag; + } + /** + * Gets the default parameters. + * + * @return array An array of the default parameters + */ + protected function getDefaultParameters() + { + return array( + 'foo' => ('wiz'.dirname(__DIR__)), + 'bar' => __DIR__, + 'baz' => (__DIR__.'/PhpDumperTest.php'), + ); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php new file mode 100644 index 0000000..f922d20 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php @@ -0,0 +1,51 @@ +getDefaultParameters())); + } + + /** + * Gets the default parameters. + * + * @return array An array of the default parameters + */ + protected function getDefaultParameters() + { + return array( + 'foo' => '%baz%', + 'baz' => 'bar', + 'bar' => 'foo is %%foo bar', + 'escape' => '@escapeme', + 'values' => array( + 0 => true, + 1 => false, + 2 => NULL, + 3 => 0, + 4 => 1000.3, + 5 => 'true', + 6 => 'false', + 7 => 'null', + ), + ); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php new file mode 100644 index 0000000..8fe63d7 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -0,0 +1,347 @@ +getDefaultParameters())); + $this->methodMap = array( + 'bar' => 'getBarService', + 'baz' => 'getBazService', + 'configurator_service' => 'getConfiguratorServiceService', + 'configured_service' => 'getConfiguredServiceService', + 'decorated' => 'getDecoratedService', + 'decorator_service' => 'getDecoratorServiceService', + 'decorator_service_with_name' => 'getDecoratorServiceWithNameService', + 'depends_on_request' => 'getDependsOnRequestService', + 'factory_service' => 'getFactoryServiceService', + 'foo' => 'getFooService', + 'foo.baz' => 'getFoo_BazService', + 'foo_bar' => 'getFooBarService', + 'foo_with_inline' => 'getFooWithInlineService', + 'inlined' => 'getInlinedService', + 'method_call1' => 'getMethodCall1Service', + 'request' => 'getRequestService', + ); + $this->aliases = array( + 'alias_for_alias' => 'foo', + 'alias_for_foo' => 'foo', + ); + } + + /** + * Gets the 'bar' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar\FooClass A Bar\FooClass instance. + */ + protected function getBarService() + { + $a = $this->get('foo.baz'); + + $this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar')); + + $a->configure($instance); + + return $instance; + } + + /** + * Gets the 'baz' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Baz A Baz instance. + */ + protected function getBazService() + { + $this->services['baz'] = $instance = new \Baz(); + + $instance->setFoo($this->get('foo_with_inline')); + + return $instance; + } + + /** + * Gets the 'configured_service' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getConfiguredServiceService() + { + $this->services['configured_service'] = $instance = new \stdClass(); + + $this->get('configurator_service')->configureStdClass($instance); + + return $instance; + } + + /** + * Gets the 'decorated' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getDecoratedService() + { + return $this->services['decorated'] = new \stdClass(); + } + + /** + * Gets the 'decorator_service' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getDecoratorServiceService() + { + return $this->services['decorator_service'] = new \stdClass(); + } + + /** + * Gets the 'decorator_service_with_name' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getDecoratorServiceWithNameService() + { + return $this->services['decorator_service_with_name'] = new \stdClass(); + } + + /** + * Gets the 'depends_on_request' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getDependsOnRequestService() + { + $this->services['depends_on_request'] = $instance = new \stdClass(); + + $instance->setRequest($this->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + + return $instance; + } + + /** + * Gets the 'factory_service' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar A Bar instance. + */ + protected function getFactoryServiceService() + { + return $this->services['factory_service'] = $this->get('foo.baz')->getInstance(); + } + + /** + * Gets the 'foo' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar\FooClass A Bar\FooClass instance. + */ + protected function getFooService() + { + $a = $this->get('foo.baz'); + + $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this); + + $instance->setBar($this->get('bar')); + $instance->initialize(); + $instance->foo = 'bar'; + $instance->moo = $a; + $instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')); + sc_configure($instance); + + return $instance; + } + + /** + * Gets the 'foo.baz' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return object A %baz_class% instance. + */ + protected function getFoo_BazService() + { + $this->services['foo.baz'] = $instance = call_user_func(array($this->getParameter('baz_class'), 'getInstance')); + + call_user_func(array($this->getParameter('baz_class'), 'configureStatic1'), $instance); + + return $instance; + } + + /** + * Gets the 'foo_bar' service. + * + * @return object A %foo_class% instance. + */ + protected function getFooBarService() + { + $class = $this->getParameter('foo_class'); + + return new $class(); + } + + /** + * Gets the 'foo_with_inline' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Foo A Foo instance. + */ + protected function getFooWithInlineService() + { + $this->services['foo_with_inline'] = $instance = new \Foo(); + + $instance->setBar($this->get('inlined')); + + return $instance; + } + + /** + * Gets the 'method_call1' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar\FooClass A Bar\FooClass instance. + */ + protected function getMethodCall1Service() + { + require_once '%path%foo.php'; + + $this->services['method_call1'] = $instance = new \Bar\FooClass(); + + $instance->setBar($this->get('foo')); + $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + if ($this->has('foo3')) { + $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + } + if ($this->has('foobaz')) { + $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + } + $instance->setBar(($this->get("foo")->foo() . (($this->hasparameter("foo")) ? ($this->getParameter("foo")) : ("default")))); + + return $instance; + } + + /** + * Gets the 'request' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @throws RuntimeException always since this service is expected to be injected dynamically + */ + protected function getRequestService() + { + throw new RuntimeException('You have requested a synthetic service ("request"). The DIC does not know how to construct this service.'); + } + + /** + * Updates the 'request' service. + */ + protected function synchronizeRequestService() + { + if ($this->initialized('depends_on_request')) { + $this->get('depends_on_request')->setRequest($this->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + } + } + + /** + * Gets the 'configurator_service' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * This service is private. + * If you want to be able to request this service from the container directly, + * make it public, otherwise you might end up with broken code. + * + * @return \ConfClass A ConfClass instance. + */ + protected function getConfiguratorServiceService() + { + $this->services['configurator_service'] = $instance = new \ConfClass(); + + $instance->setFoo($this->get('baz')); + + return $instance; + } + + /** + * Gets the 'inlined' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * This service is private. + * If you want to be able to request this service from the container directly, + * make it public, otherwise you might end up with broken code. + * + * @return \Bar A Bar instance. + */ + protected function getInlinedService() + { + $this->services['inlined'] = $instance = new \Bar(); + + $instance->setBaz($this->get('baz')); + $instance->pub = 'pub'; + + return $instance; + } + + /** + * Gets the default parameters. + * + * @return array An array of the default parameters + */ + protected function getDefaultParameters() + { + return array( + 'baz_class' => 'BazClass', + 'foo_class' => 'Bar\\FooClass', + 'foo' => 'bar', + ); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php new file mode 100644 index 0000000..8962b26 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -0,0 +1,343 @@ +parameters = $this->getDefaultParameters(); + + $this->services = + $this->scopedServices = + $this->scopeStacks = array(); + + $this->set('service_container', $this); + + $this->scopes = array(); + $this->scopeChildren = array(); + $this->methodMap = array( + 'bar' => 'getBarService', + 'baz' => 'getBazService', + 'configured_service' => 'getConfiguredServiceService', + 'decorator_service' => 'getDecoratorServiceService', + 'decorator_service_with_name' => 'getDecoratorServiceWithNameService', + 'depends_on_request' => 'getDependsOnRequestService', + 'factory_service' => 'getFactoryServiceService', + 'foo' => 'getFooService', + 'foo.baz' => 'getFoo_BazService', + 'foo_bar' => 'getFooBarService', + 'foo_with_inline' => 'getFooWithInlineService', + 'method_call1' => 'getMethodCall1Service', + 'request' => 'getRequestService', + ); + $this->aliases = array( + 'alias_for_alias' => 'foo', + 'alias_for_foo' => 'foo', + 'decorated' => 'decorator_service_with_name', + ); + } + + /** + * Gets the 'bar' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar\FooClass A Bar\FooClass instance. + */ + protected function getBarService() + { + $a = $this->get('foo.baz'); + + $this->services['bar'] = $instance = new \Bar\FooClass('foo', $a, $this->getParameter('foo_bar')); + + $a->configure($instance); + + return $instance; + } + + /** + * Gets the 'baz' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Baz A Baz instance. + */ + protected function getBazService() + { + $this->services['baz'] = $instance = new \Baz(); + + $instance->setFoo($this->get('foo_with_inline')); + + return $instance; + } + + /** + * Gets the 'configured_service' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getConfiguredServiceService() + { + $a = new \ConfClass(); + $a->setFoo($this->get('baz')); + + $this->services['configured_service'] = $instance = new \stdClass(); + + $a->configureStdClass($instance); + + return $instance; + } + + /** + * Gets the 'decorator_service' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getDecoratorServiceService() + { + return $this->services['decorator_service'] = new \stdClass(); + } + + /** + * Gets the 'decorator_service_with_name' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getDecoratorServiceWithNameService() + { + return $this->services['decorator_service_with_name'] = new \stdClass(); + } + + /** + * Gets the 'depends_on_request' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getDependsOnRequestService() + { + $this->services['depends_on_request'] = $instance = new \stdClass(); + + $instance->setRequest($this->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + + return $instance; + } + + /** + * Gets the 'factory_service' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar A Bar instance. + */ + protected function getFactoryServiceService() + { + return $this->services['factory_service'] = $this->get('foo.baz')->getInstance(); + } + + /** + * Gets the 'foo' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar\FooClass A Bar\FooClass instance. + */ + protected function getFooService() + { + $a = $this->get('foo.baz'); + + $this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this); + + $instance->setBar($this->get('bar')); + $instance->initialize(); + $instance->foo = 'bar'; + $instance->moo = $a; + $instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar'); + sc_configure($instance); + + return $instance; + } + + /** + * Gets the 'foo.baz' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \BazClass A BazClass instance. + */ + protected function getFoo_BazService() + { + $this->services['foo.baz'] = $instance = \BazClass::getInstance(); + + \BazClass::configureStatic1($instance); + + return $instance; + } + + /** + * Gets the 'foo_bar' service. + * + * @return \Bar\FooClass A Bar\FooClass instance. + */ + protected function getFooBarService() + { + return new \Bar\FooClass(); + } + + /** + * Gets the 'foo_with_inline' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Foo A Foo instance. + */ + protected function getFooWithInlineService() + { + $a = new \Bar(); + + $this->services['foo_with_inline'] = $instance = new \Foo(); + + $a->setBaz($this->get('baz')); + $a->pub = 'pub'; + + $instance->setBar($a); + + return $instance; + } + + /** + * Gets the 'method_call1' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \Bar\FooClass A Bar\FooClass instance. + */ + protected function getMethodCall1Service() + { + require_once '%path%foo.php'; + + $this->services['method_call1'] = $instance = new \Bar\FooClass(); + + $instance->setBar($this->get('foo')); + $instance->setBar(NULL); + $instance->setBar(($this->get("foo")->foo() . (($this->hasparameter("foo")) ? ($this->getParameter("foo")) : ("default")))); + + return $instance; + } + + /** + * Gets the 'request' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @throws RuntimeException always since this service is expected to be injected dynamically + */ + protected function getRequestService() + { + throw new RuntimeException('You have requested a synthetic service ("request"). The DIC does not know how to construct this service.'); + } + + /** + * Updates the 'request' service. + */ + protected function synchronizeRequestService() + { + if ($this->initialized('depends_on_request')) { + $this->get('depends_on_request')->setRequest($this->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)); + } + } + + /** + * {@inheritdoc} + */ + public function getParameter($name) + { + $name = strtolower($name); + + if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); + } + + return $this->parameters[$name]; + } + + /** + * {@inheritdoc} + */ + public function hasParameter($name) + { + $name = strtolower($name); + + return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters); + } + + /** + * {@inheritdoc} + */ + public function setParameter($name, $value) + { + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); + } + + /** + * {@inheritdoc} + */ + public function getParameterBag() + { + if (null === $this->parameterBag) { + $this->parameterBag = new FrozenParameterBag($this->parameters); + } + + return $this->parameterBag; + } + /** + * Gets the default parameters. + * + * @return array An array of the default parameters + */ + protected function getDefaultParameters() + { + return array( + 'baz_class' => 'BazClass', + 'foo_class' => 'Bar\\FooClass', + 'foo' => 'bar', + ); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/simple.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/simple.php new file mode 100644 index 0000000..aa4df99 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/simple.php @@ -0,0 +1,3 @@ +setParameter('foo', 'foo'); diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension1/services.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension1/services.xml new file mode 100644 index 0000000..52df38d --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension1/services.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension2/services.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension2/services.xml new file mode 100644 index 0000000..21a7ef5 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension2/services.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services1.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services1.xml new file mode 100644 index 0000000..792fa07 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services1.xml @@ -0,0 +1,19 @@ + + + + + + BAR + + + + + + + + + %project.parameter.foo% + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services2.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services2.xml new file mode 100644 index 0000000..67d462b --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services2.xml @@ -0,0 +1,19 @@ + + + + + + BAR + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services3.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services3.xml new file mode 100644 index 0000000..c23f02a --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services3.xml @@ -0,0 +1,19 @@ + + + + + + BAR + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services4.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services4.xml new file mode 100644 index 0000000..2c33c3a --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services4.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services5.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services5.xml new file mode 100644 index 0000000..0eaaff2 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services5.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services6.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services6.xml new file mode 100644 index 0000000..a9c0103 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services6.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services7.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services7.xml new file mode 100644 index 0000000..e77780d --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services7.xml @@ -0,0 +1,11 @@ + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/namespaces.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/namespaces.xml new file mode 100644 index 0000000..5a05ced --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/namespaces.xml @@ -0,0 +1,17 @@ + + + + + + + + + foo + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/nonvalid.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/nonvalid.xml new file mode 100644 index 0000000..e7b5bc9 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/nonvalid.xml @@ -0,0 +1,3 @@ + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml new file mode 100644 index 0000000..6aa5732 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml @@ -0,0 +1,2 @@ + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services10.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services10.xml new file mode 100644 index 0000000..a4da1bf --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services10.xml @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services13.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services13.xml new file mode 100644 index 0000000..1ac4938 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services13.xml @@ -0,0 +1,9 @@ + + + + + true + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services14.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services14.xml new file mode 100644 index 0000000..7344621 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services14.xml @@ -0,0 +1,19 @@ + + + + + app + + + + + + app + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml new file mode 100644 index 0000000..f1ac14d --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml @@ -0,0 +1,31 @@ + + + + + a string + bar + + 0 + 4 + null + true + true + false + on + off + 1.3 + 1000.3 + a string + + foo + bar + + + + value + + PHP_EOL + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services3.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services3.xml new file mode 100644 index 0000000..87bf183 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services3.xml @@ -0,0 +1,13 @@ + + + + + foo + + true + false + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4.xml new file mode 100644 index 0000000..03ad9f8 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4_bad_import.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4_bad_import.xml new file mode 100644 index 0000000..0b7f10a --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4_bad_import.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml new file mode 100644 index 0000000..acb93e7 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml new file mode 100644 index 0000000..a6df4b1 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + %path%/foo.php + + + foo + + + true + false + + + + + + + + + + + + + + + service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default") + + + + + foo + + + true + false + + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services7.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services7.xml new file mode 100644 index 0000000..824d8b5 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services7.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml new file mode 100644 index 0000000..b17e500 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml @@ -0,0 +1,22 @@ + + + + + %baz% + bar + foo is %%foo bar + @escapeme + + true + false + null + 0 + 1000.3 + true + false + null + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml new file mode 100644 index 0000000..50c48d6 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml @@ -0,0 +1,97 @@ + + + + BazClass + Bar\FooClass + bar + + + + + + foo + + + foo is %foo% + %foo% + + true + + bar + + + foo is %foo% + %foo% + + + + + + + + + foo + + %foo_bar% + + + + + + + + %path%foo.php + + + + + + + + + + + + + + service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default") + + + + + + + + + + pub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/withdoctype.xml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/withdoctype.xml new file mode 100644 index 0000000..f217d5b --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/withdoctype.xml @@ -0,0 +1,3 @@ + + + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_calls.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_calls.yml new file mode 100644 index 0000000..3f34b07 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_calls.yml @@ -0,0 +1,4 @@ +services: + method_call1: + class: FooClass + calls: foo diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_import.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_import.yml new file mode 100644 index 0000000..0765dc8 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_import.yml @@ -0,0 +1,2 @@ +imports: + - foo.yml diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_imports.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_imports.yml new file mode 100644 index 0000000..1ce9d57 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_imports.yml @@ -0,0 +1,2 @@ +imports: + foo:bar diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_parameters.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_parameters.yml new file mode 100644 index 0000000..bbd13ac --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_parameters.yml @@ -0,0 +1,2 @@ +parameters: + foo:bar diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_service.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_service.yml new file mode 100644 index 0000000..811af3c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_service.yml @@ -0,0 +1,2 @@ +services: + foo: bar diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_services.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_services.yml new file mode 100644 index 0000000..cfbf17c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/bad_services.yml @@ -0,0 +1 @@ +services: foo diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag1.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag1.yml new file mode 100644 index 0000000..14536fd --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag1.yml @@ -0,0 +1,5 @@ +services: + foo_service: + class: FooClass + # tags is not an array + tags: string diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag2.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag2.yml new file mode 100644 index 0000000..9028814 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag2.yml @@ -0,0 +1,6 @@ +services: + foo_service: + class: FooClass + tags: + # tag is missing the name key + foo_tag: { foo: bar } diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag3.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag3.yml new file mode 100644 index 0000000..72ec4e8 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag3.yml @@ -0,0 +1,6 @@ +services: + foo_service: + class: FooClass + tags: + # tag-attribute is not a scalar + - { name: foo, bar: { foo: foo, bar: bar } } diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag4.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag4.yml new file mode 100644 index 0000000..e8e9939 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag4.yml @@ -0,0 +1,6 @@ +services: + foo_service: + class: FooClass + tags: + # tag is not an array + - foo diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid1.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid1.yml new file mode 100644 index 0000000..4eddb87 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid1.yml @@ -0,0 +1,2 @@ +foo: + bar diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid2.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid2.yml new file mode 100644 index 0000000..c508d53 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid2.yml @@ -0,0 +1 @@ +false diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml @@ -0,0 +1 @@ + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml new file mode 100644 index 0000000..f2f8d95 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml @@ -0,0 +1,9 @@ +parameters: + project.parameter.foo: BAR + +services: + project.service.foo: + class: BAR + +project: + test: %project.parameter.foo% diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services11.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services11.yml new file mode 100644 index 0000000..40126f0 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services11.yml @@ -0,0 +1 @@ +foobarfoobar: {} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services13.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services13.yml new file mode 100644 index 0000000..d52d355 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services13.yml @@ -0,0 +1,3 @@ +# used to test imports in XML +parameters: + imported_from_yaml: true diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml new file mode 100644 index 0000000..3c12746 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml @@ -0,0 +1,12 @@ +parameters: + FOO: bar + values: + - true + - false + - 0 + - 1000.3 + bar: foo + escape: @@escapeme + foo_bar: @foo_bar + MixedCase: + MixedCaseKey: value diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services3.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services3.yml new file mode 100644 index 0000000..0e92cdf --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services3.yml @@ -0,0 +1,5 @@ +parameters: + foo: foo + values: + - true + - false diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml new file mode 100644 index 0000000..8e0987f --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml @@ -0,0 +1,7 @@ +imports: + - { resource: services2.yml } + - { resource: services3.yml } + - { resource: "../php/simple.php" } + - { resource: "../ini/parameters.ini", class: Symfony\Component\DependencyInjection\Loader\IniFileLoader } + - { resource: "../ini/parameters2.ini" } + - { resource: "../xml/services13.xml" } diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4_bad_import.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4_bad_import.yml new file mode 100644 index 0000000..f7089fc --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4_bad_import.yml @@ -0,0 +1,2 @@ +imports: + - { resource: foo_fake.yml, ignore_errors: true } diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml new file mode 100644 index 0000000..7c1a62c --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml @@ -0,0 +1,37 @@ +services: + foo: { class: FooClass } + baz: { class: BazClass } + scope.container: { class: FooClass, scope: container } + scope.custom: { class: FooClass, scope: custom } + scope.prototype: { class: FooClass, scope: prototype } + constructor: { class: FooClass, factory_method: getInstance } + file: { class: FooClass, file: %path%/foo.php } + arguments: { class: FooClass, arguments: [foo, @foo, [true, false]] } + configurator1: { class: FooClass, configurator: sc_configure } + configurator2: { class: FooClass, configurator: [@baz, configure] } + configurator3: { class: FooClass, configurator: [BazClass, configureStatic] } + method_call1: + class: FooClass + calls: + - [ setBar, [] ] + - [ setBar ] + - [ setBar, ['@=service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")'] ] + method_call2: + class: FooClass + calls: + - [ setBar, [ foo, @foo, [true, false] ] ] + alias_for_foo: @foo + another_alias_for_foo: + alias: foo + public: false + factory_service: { class: BazClass, factory_method: getInstance, factory_service: baz_factory } + request: + class: Request + synthetic: true + synchronized: true + lazy: true + decorator_service: + decorates: decorated + decorator_service_with_name: + decorates: decorated + decoration_inner_name: decorated.pif-pouf diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services7.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services7.yml new file mode 100644 index 0000000..09064f2 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services7.yml @@ -0,0 +1,2 @@ +services: + foo: { class: BarClass } diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml new file mode 100644 index 0000000..a1fb590 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml @@ -0,0 +1,7 @@ +parameters: + foo: '%baz%' + baz: bar + bar: 'foo is %%foo bar' + escape: '@@escapeme' + values: [true, false, null, 0, 1000.3, 'true', 'false', 'null'] + diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml new file mode 100644 index 0000000..52bfb0d --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml @@ -0,0 +1,92 @@ +parameters: + baz_class: BazClass + foo_class: Bar\FooClass + foo: bar + +services: + foo: + class: Bar\FooClass + tags: + - { name: foo, foo: foo } + - { name: foo, bar: bar } + factory_class: Bar\FooClass + factory_method: getInstance + arguments: [foo, '@foo.baz', { '%foo%': 'foo is %foo%', foobar: '%foo%' }, true, '@service_container'] + properties: { foo: bar, moo: '@foo.baz', qux: { '%foo%': 'foo is %foo%', foobar: '%foo%' } } + calls: + - [setBar, ['@bar']] + - [initialize, { }] + + configurator: sc_configure + bar: + class: Bar\FooClass + arguments: [foo, '@foo.baz', '%foo_bar%'] + configurator: ['@foo.baz', configure] + foo.baz: + class: %baz_class% + factory_class: %baz_class% + factory_method: getInstance + configurator: ['%baz_class%', configureStatic1] + foo_bar: + class: %foo_class% + scope: prototype + method_call1: + class: Bar\FooClass + file: %path%foo.php + calls: + - [setBar, ['@foo']] + - [setBar, ['@?foo2']] + - [setBar, ['@?foo3']] + - [setBar, ['@?foobaz']] + - [setBar, ['@=service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")']] + + factory_service: + class: Bar + factory_method: getInstance + factory_service: foo.baz + foo_with_inline: + class: Foo + calls: + - [setBar, ['@inlined']] + + inlined: + class: Bar + public: false + properties: { pub: pub } + calls: + - [setBaz, ['@baz']] + + baz: + class: Baz + calls: + - [setFoo, ['@foo_with_inline']] + + request: + class: Request + synthetic: true + synchronized: true + depends_on_request: + class: stdClass + calls: + - [setRequest, ['@?request']] + + configurator_service: + class: ConfClass + public: false + calls: + - [setFoo, ['@baz']] + + configured_service: + class: stdClass + configurator: ['@configurator_service', configureStdClass] + decorated: + class: stdClass + decorator_service: + class: stdClass + decorates: decorated + decorator_service_with_name: + class: stdClass + decorates: decorated + decoration_inner_name: decorated.pif-pouf + alias_for_foo: @foo + alias_for_alias: @foo diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php new file mode 100644 index 0000000..bc0c580 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/LazyProxy/Instantiator/RealServiceInstantiatorTest.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\LazyProxy\Instantiator; + +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator; + +/** + * Tests for {@see \Symfony\Component\DependencyInjection\Instantiator\RealServiceInstantiator} + * + * @author Marco Pivetta + * + * @covers \Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator + */ +class RealServiceInstantiatorTest extends \PHPUnit_Framework_TestCase +{ + public function testInstantiateProxy() + { + $instantiator = new RealServiceInstantiator(); + $instance = new \stdClass(); + $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $callback = function () use ($instance) { + return $instance; + }; + + $this->assertSame($instance, $instantiator->instantiateProxy($container, new Definition(), 'foo', $callback)); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php new file mode 100644 index 0000000..4eb8320 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/LazyProxy/PhpDumper/NullDumperTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\LazyProxy\PhpDumper; + +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper; + +/** + * Tests for {@see \Symfony\Component\DependencyInjection\PhpDumper\NullDumper} + * + * @author Marco Pivetta + * + * @covers \Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper + */ +class NullDumperTest extends \PHPUnit_Framework_TestCase +{ + public function testNullDumper() + { + $dumper = new NullDumper(); + $definition = new Definition('stdClass'); + + $this->assertFalse($dumper->isProxyCandidate($definition)); + $this->assertSame('', $dumper->getProxyFactoryCode($definition, 'foo')); + $this->assertSame('', $dumper->getProxyCode($definition)); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php new file mode 100644 index 0000000..483e30b --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Loader; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\ClosureLoader; + +class ClosureLoaderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\Loader\ClosureLoader::supports + */ + public function testSupports() + { + $loader = new ClosureLoader(new ContainerBuilder()); + + $this->assertTrue($loader->supports(function ($container) {}), '->supports() returns true if the resource is loadable'); + $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Loader\ClosureLoader::load + */ + public function testLoad() + { + $loader = new ClosureLoader($container = new ContainerBuilder()); + + $loader->load(function ($container) { + $container->setParameter('foo', 'foo'); + }); + + $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a \Closure resource'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php new file mode 100644 index 0000000..9188018 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Loader; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\IniFileLoader; +use Symfony\Component\Config\FileLocator; + +class IniFileLoaderTest extends \PHPUnit_Framework_TestCase +{ + protected static $fixturesPath; + + protected $container; + protected $loader; + + public static function setUpBeforeClass() + { + self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); + } + + protected function setUp() + { + $this->container = new ContainerBuilder(); + $this->loader = new IniFileLoader($this->container, new FileLocator(self::$fixturesPath.'/ini')); + } + + /** + * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::__construct + * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::load + */ + public function testIniFileCanBeLoaded() + { + $this->loader->load('parameters.ini'); + $this->assertEquals(array('foo' => 'bar', 'bar' => '%foo%'), $this->container->getParameterBag()->all(), '->load() takes a single file name as its first argument'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::__construct + * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::load + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The file "foo.ini" does not exist (in: + */ + public function testExceptionIsRaisedWhenIniFileDoesNotExist() + { + $this->loader->load('foo.ini'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::__construct + * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::load + * + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage The "nonvalid.ini" file is not valid. + */ + public function testExceptionIsRaisedWhenIniFileCannotBeParsed() + { + @$this->loader->load('nonvalid.ini'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Loader\IniFileLoader::supports + */ + public function testSupports() + { + $loader = new IniFileLoader(new ContainerBuilder(), new FileLocator()); + + $this->assertTrue($loader->supports('foo.ini'), '->supports() returns true if the resource is loadable'); + $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php new file mode 100644 index 0000000..505f710 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Loader; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Config\Loader\Loader; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\Config\FileLocator; + +class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::supports + */ + public function testSupports() + { + $loader = new PhpFileLoader(new ContainerBuilder(), new FileLocator()); + + $this->assertTrue($loader->supports('foo.php'), '->supports() returns true if the resource is loadable'); + $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); + } + + /** + * @covers Symfony\Component\DependencyInjection\Loader\PhpFileLoader::load + */ + public function testLoad() + { + $loader = new PhpFileLoader($container = new ContainerBuilder(), new FileLocator()); + + $loader->load(__DIR__.'/../Fixtures/php/simple.php'); + + $this->assertEquals('foo', $container->getParameter('foo'), '->load() loads a PHP file resource'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php new file mode 100644 index 0000000..db6598e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -0,0 +1,455 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Loader; + +use Symfony\Component\DependencyInjection\ContainerInterface; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\Config\Loader\Loader; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\Loader\IniFileLoader; +use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\ExpressionLanguage\Expression; + +class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase +{ + protected static $fixturesPath; + + public static function setUpBeforeClass() + { + self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); + require_once self::$fixturesPath.'/includes/foo.php'; + require_once self::$fixturesPath.'/includes/ProjectExtension.php'; + require_once self::$fixturesPath.'/includes/ProjectWithXsdExtension.php'; + } + + public function testLoad() + { + $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/ini')); + + try { + $loader->load('foo.xml'); + $this->fail('->load() throws an InvalidArgumentException if the loaded file does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist'); + $this->assertStringStartsWith('The file "foo.xml" does not exist (in:', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist'); + } + } + + public function testParseFile() + { + $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/ini')); + $r = new \ReflectionObject($loader); + $m = $r->getMethod('parseFileToDOM'); + $m->setAccessible(true); + + try { + $m->invoke($loader, self::$fixturesPath.'/ini/parameters.ini'); + $this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'parameters.ini'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + + $e = $e->getPrevious(); + $this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + $this->assertStringStartsWith('[ERROR 4] Start tag expected, \'<\' not found (in', $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + } + + $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/xml')); + + try { + $m->invoke($loader, self::$fixturesPath.'/xml/nonvalid.xml'); + $this->fail('->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'nonvalid.xml'), $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file is not a valid XML file'); + + $e = $e->getPrevious(); + $this->assertInstanceOf('InvalidArgumentException', $e, '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); + $this->assertStringStartsWith('[ERROR 1845] Element \'nonvalid\': No matching global declaration available for the validation root. (in', $e->getMessage(), '->parseFileToDOM() throws an InvalidArgumentException if the loaded file does not validate the XSD'); + } + + $xml = $m->invoke($loader, self::$fixturesPath.'/xml/services1.xml'); + $this->assertInstanceOf('DOMDocument', $xml, '->parseFileToDOM() returns an SimpleXMLElement object'); + } + + public function testLoadParameters() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services2.xml'); + + $actual = $container->getParameterBag()->all(); + $expected = array( + 'a string', + 'foo' => 'bar', + 'values' => array( + 0, + 'integer' => 4, + 100 => null, + 'true', + true, + false, + 'on', + 'off', + 'float' => 1.3, + 1000.3, + 'a string', + array('foo', 'bar'), + ), + 'mixedcase' => array('MixedCaseKey' => 'value'), + 'constant' => PHP_EOL, + ); + + $this->assertEquals($expected, $actual, '->load() converts XML values to PHP ones'); + } + + public function testLoadImports() + { + $container = new ContainerBuilder(); + $resolver = new LoaderResolver(array( + new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')), + new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')), + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')), + )); + $loader->setResolver($resolver); + $loader->load('services4.xml'); + + $actual = $container->getParameterBag()->all(); + $expected = array( + 'a string', + 'foo' => 'bar', + 'values' => array( + 0, + 'integer' => 4, + 100 => null, + 'true', + true, + false, + 'on', + 'off', + 'float' => 1.3, + 1000.3, + 'a string', + array('foo', 'bar'), + ), + 'mixedcase' => array('MixedCaseKey' => 'value'), + 'constant' => PHP_EOL, + 'bar' => '%foo%', + 'imported_from_ini' => true, + 'imported_from_yaml' => true, + ); + + $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); + + // Bad import throws no exception due to ignore_errors value. + $loader->load('services4_bad_import.xml'); + } + + public function testLoadAnonymousServices() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services5.xml'); + $services = $container->getDefinitions(); + $this->assertCount(4, $services, '->load() attributes unique ids to anonymous services'); + + // anonymous service as an argument + $args = $services['foo']->getArguments(); + $this->assertCount(1, $args, '->load() references anonymous services as "normal" ones'); + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $args[0], '->load() converts anonymous services to references to "normal" services'); + $this->assertTrue(isset($services[(string) $args[0]]), '->load() makes a reference to the created ones'); + $inner = $services[(string) $args[0]]; + $this->assertEquals('BarClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); + + // inner anonymous services + $args = $inner->getArguments(); + $this->assertCount(1, $args, '->load() references anonymous services as "normal" ones'); + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $args[0], '->load() converts anonymous services to references to "normal" services'); + $this->assertTrue(isset($services[(string) $args[0]]), '->load() makes a reference to the created ones'); + $inner = $services[(string) $args[0]]; + $this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); + $this->assertFalse($inner->isPublic()); + + // anonymous service as a property + $properties = $services['foo']->getProperties(); + $property = $properties['p']; + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $property, '->load() converts anonymous services to references to "normal" services'); + $this->assertTrue(isset($services[(string) $property]), '->load() makes a reference to the created ones'); + $inner = $services[(string) $property]; + $this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); + } + + public function testLoadServices() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services6.xml'); + $services = $container->getDefinitions(); + $this->assertTrue(isset($services['foo']), '->load() parses elements'); + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts element to Definition instances'); + $this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute'); + $this->assertEquals('container', $services['scope.container']->getScope()); + $this->assertEquals('custom', $services['scope.custom']->getScope()); + $this->assertEquals('prototype', $services['scope.prototype']->getScope()); + $this->assertEquals('getInstance', $services['constructor']->getFactoryMethod(), '->load() parses the factory-method attribute'); + $this->assertEquals('%path%/foo.php', $services['file']->getFile(), '->load() parses the file tag'); + $this->assertEquals(array('foo', new Reference('foo'), array(true, false)), $services['arguments']->getArguments(), '->load() parses the argument tags'); + $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(array(new Reference('baz', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(array('BazClass', 'configureStatic'), $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(array(array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals(array(array('setBar', array('foo', new Reference('foo'), array(true, false)))), $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertNull($services['factory_service']->getClass()); + $this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod()); + $this->assertEquals('baz_factory', $services['factory_service']->getFactoryService()); + + $this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag'); + $this->assertTrue($services['request']->isSynchronized(), '->load() parses the synchronized flag'); + $this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag'); + + $aliases = $container->getAliases(); + $this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses elements'); + $this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases'); + $this->assertTrue($aliases['alias_for_foo']->isPublic()); + $this->assertTrue(isset($aliases['another_alias_for_foo'])); + $this->assertEquals('foo', (string) $aliases['another_alias_for_foo']); + $this->assertFalse($aliases['another_alias_for_foo']->isPublic()); + + $this->assertNull($services['request']->getDecoratedService()); + $this->assertEquals(array('decorated', null), $services['decorator_service']->getDecoratedService()); + $this->assertEquals(array('decorated', 'decorated.pif-pouf'), $services['decorator_service_with_name']->getDecoratedService()); + } + + public function testParsesTags() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services10.xml'); + + $services = $container->findTaggedServiceIds('foo_tag'); + $this->assertCount(1, $services); + + foreach ($services as $id => $tagAttributes) { + foreach ($tagAttributes as $attributes) { + $this->assertArrayHasKey('other_option', $attributes); + $this->assertEquals('lorem', $attributes['other_option']); + $this->assertArrayHasKey('other-option', $attributes, 'unnormalized tag attributes should not be removed'); + + $this->assertEquals('ciz', $attributes['some_option'], 'no overriding should be done when normalizing'); + $this->assertEquals('cat', $attributes['some-option']); + + $this->assertArrayNotHasKey('an_other_option', $attributes, 'normalization should not be done when an underscore is already found'); + } + } + } + + public function testConvertDomElementToArray() + { + $doc = new \DOMDocument("1.0"); + $doc->loadXML('bar'); + $this->assertEquals('bar', XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + + $doc = new \DOMDocument("1.0"); + $doc->loadXML(''); + $this->assertEquals(array('foo' => 'bar'), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + + $doc = new \DOMDocument("1.0"); + $doc->loadXML('bar'); + $this->assertEquals(array('foo' => 'bar'), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + + $doc = new \DOMDocument("1.0"); + $doc->loadXML('barbar'); + $this->assertEquals(array('foo' => array('value' => 'bar', 'foo' => 'bar')), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + + $doc = new \DOMDocument("1.0"); + $doc->loadXML(''); + $this->assertEquals(array('foo' => null), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + + $doc = new \DOMDocument("1.0"); + $doc->loadXML(''); + $this->assertEquals(array('foo' => null), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + + $doc = new \DOMDocument("1.0"); + $doc->loadXML(''); + $this->assertEquals(array('foo' => array(array('foo' => 'bar'), array('foo' => 'bar'))), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \DomElement to an array'); + } + + public function testExtensions() + { + $container = new ContainerBuilder(); + $container->registerExtension(new \ProjectExtension()); + $container->registerExtension(new \ProjectWithXsdExtension()); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + + // extension without an XSD + $loader->load('extensions/services1.xml'); + $container->compile(); + $services = $container->getDefinitions(); + $parameters = $container->getParameterBag()->all(); + + $this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements'); + $this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements'); + + $this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements'); + $this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements'); + + // extension with an XSD + $container = new ContainerBuilder(); + $container->registerExtension(new \ProjectExtension()); + $container->registerExtension(new \ProjectWithXsdExtension()); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('extensions/services2.xml'); + $container->compile(); + $services = $container->getDefinitions(); + $parameters = $container->getParameterBag()->all(); + + $this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements'); + $this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements'); + + $this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements'); + $this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements'); + + $container = new ContainerBuilder(); + $container->registerExtension(new \ProjectExtension()); + $container->registerExtension(new \ProjectWithXsdExtension()); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + + // extension with an XSD (does not validate) + try { + $loader->load('extensions/services3.xml'); + $this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'services3.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + + $e = $e->getPrevious(); + $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertContains('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + } + + // non-registered extension + try { + $loader->load('extensions/services4.xml'); + $this->fail('->load() throws an InvalidArgumentException if the tag is not valid'); + } catch (\Exception $e) { + $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag is not valid'); + $this->assertStringStartsWith('There is no extension able to load the configuration for "project:bar" (in', $e->getMessage(), '->load() throws an InvalidArgumentException if the tag is not valid'); + } + } + + public function testExtensionInPhar() + { + if (extension_loaded('suhosin') && false === strpos(ini_get('suhosin.executor.include.whitelist'), 'phar')) { + $this->markTestSkipped('To run this test, add "phar" to the "suhosin.executor.include.whitelist" settings in your php.ini file.'); + } + + require_once self::$fixturesPath.'/includes/ProjectWithXsdExtensionInPhar.phar'; + + // extension with an XSD in PHAR archive + $container = new ContainerBuilder(); + $container->registerExtension(new \ProjectWithXsdExtensionInPhar()); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('extensions/services6.xml'); + + // extension with an XSD in PHAR archive (does not validate) + try { + $loader->load('extensions/services7.xml'); + $this->fail('->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'services7.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + + $e = $e->getPrevious(); + $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + $this->assertContains('The attribute \'bar\' is not allowed', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration does not validate the XSD'); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\Loader\XmlFileLoader::supports + */ + public function testSupports() + { + $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator()); + + $this->assertTrue($loader->supports('foo.xml'), '->supports() returns true if the resource is loadable'); + $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); + } + + public function testNoNamingConflictsForAnonymousServices() + { + $container = new ContainerBuilder(); + + $loader1 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml/extension1')); + $loader1->load('services.xml'); + $services = $container->getDefinitions(); + $this->assertCount(2, $services, '->load() attributes unique ids to anonymous services'); + $loader2 = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml/extension2')); + $loader2->load('services.xml'); + $services = $container->getDefinitions(); + $this->assertCount(4, $services, '->load() attributes unique ids to anonymous services'); + + $services = $container->getDefinitions(); + $args1 = $services['extension1.foo']->getArguments(); + $inner1 = $services[(string) $args1[0]]; + $this->assertEquals('BarClass1', $inner1->getClass(), '->load() uses the same configuration as for the anonymous ones'); + $args2 = $services['extension2.foo']->getArguments(); + $inner2 = $services[(string) $args2[0]]; + $this->assertEquals('BarClass2', $inner2->getClass(), '->load() uses the same configuration as for the anonymous ones'); + } + + public function testDocTypeIsNotAllowed() + { + $container = new ContainerBuilder(); + + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + + // document types are not allowed. + try { + $loader->load('withdoctype.xml'); + $this->fail('->load() throws an InvalidArgumentException if the configuration contains a document type'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type'); + $this->assertRegExp(sprintf('#^Unable to parse file ".+%s".$#', 'withdoctype.xml'), $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type'); + + $e = $e->getPrevious(); + $this->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the configuration contains a document type'); + $this->assertSame('Document types are not allowed.', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type'); + } + } + + public function testXmlNamespaces() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('namespaces.xml'); + $services = $container->getDefinitions(); + + $this->assertTrue(isset($services['foo']), '->load() parses elements'); + $this->assertEquals(1, count($services['foo']->getTag('foo.tag')), '->load parses elements'); + $this->assertEquals(array(array('setBar', array('foo'))), $services['foo']->getMethodCalls(), '->load() parses the tag'); + } + + public function testLoadIndexedArguments() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services14.xml'); + + $this->assertEquals(array('index_0' => 'app'), $container->findDefinition('logger')->getArguments()); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php new file mode 100644 index 0000000..57b3087 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -0,0 +1,243 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Loader; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\Config\Loader\Loader; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\Loader\IniFileLoader; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\ExpressionLanguage\Expression; + +class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase +{ + protected static $fixturesPath; + + public static function setUpBeforeClass() + { + self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); + require_once self::$fixturesPath.'/includes/foo.php'; + require_once self::$fixturesPath.'/includes/ProjectExtension.php'; + } + + public function testLoadFile() + { + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/ini')); + $r = new \ReflectionObject($loader); + $m = $r->getMethod('loadFile'); + $m->setAccessible(true); + + try { + $m->invoke($loader, 'foo.yml'); + $this->fail('->load() throws an InvalidArgumentException if the loaded file does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist'); + $this->assertEquals('The service file "foo.yml" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist'); + } + + try { + $m->invoke($loader, 'parameters.ini'); + $this->fail('->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file'); + } catch (\Exception $e) { + $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file'); + $this->assertEquals('The service file "parameters.ini" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file is not a valid YAML file'); + } + + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml')); + + foreach (array('nonvalid1', 'nonvalid2') as $fixture) { + try { + $m->invoke($loader, $fixture.'.yml'); + $this->fail('->load() throws an InvalidArgumentException if the loaded file does not validate'); + } catch (\Exception $e) { + $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not validate'); + $this->assertStringMatchesFormat('The service file "nonvalid%d.yml" is not valid.', $e->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not validate'); + } + } + } + + /** + * @dataProvider provideInvalidFiles + * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException + */ + public function testLoadInvalidFile($file) + { + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml')); + + $loader->load($file.'.yml'); + } + + public function provideInvalidFiles() + { + return array( + array('bad_parameters'), + array('bad_imports'), + array('bad_import'), + array('bad_services'), + array('bad_service'), + array('bad_calls'), + ); + } + + public function testLoadParameters() + { + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('services2.yml'); + $this->assertEquals(array('foo' => 'bar', 'mixedcase' => array('MixedCaseKey' => 'value'), 'values' => array(true, false, 0, 1000.3), 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')), $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase'); + } + + public function testLoadImports() + { + $container = new ContainerBuilder(); + $resolver = new LoaderResolver(array( + new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')), + new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')), + new PhpFileLoader($container, new FileLocator(self::$fixturesPath.'/php')), + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')), + )); + $loader->setResolver($resolver); + $loader->load('services4.yml'); + + $actual = $container->getParameterBag()->all(); + $expected = array('foo' => 'bar', 'values' => array(true, false), 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar'), 'mixedcase' => array('MixedCaseKey' => 'value'), 'imported_from_ini' => true, 'imported_from_xml' => true); + $this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files'); + + // Bad import throws no exception due to ignore_errors value. + $loader->load('services4_bad_import.yml'); + } + + public function testLoadServices() + { + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('services6.yml'); + $services = $container->getDefinitions(); + $this->assertTrue(isset($services['foo']), '->load() parses service elements'); + $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Definition', $services['foo'], '->load() converts service element to Definition instances'); + $this->assertEquals('FooClass', $services['foo']->getClass(), '->load() parses the class attribute'); + $this->assertEquals('container', $services['scope.container']->getScope()); + $this->assertEquals('custom', $services['scope.custom']->getScope()); + $this->assertEquals('prototype', $services['scope.prototype']->getScope()); + $this->assertEquals('getInstance', $services['constructor']->getFactoryMethod(), '->load() parses the factory_method attribute'); + $this->assertEquals('%path%/foo.php', $services['file']->getFile(), '->load() parses the file tag'); + $this->assertEquals(array('foo', new Reference('foo'), array(true, false)), $services['arguments']->getArguments(), '->load() parses the argument tags'); + $this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(array(new Reference('baz'), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(array('BazClass', 'configureStatic'), $services['configurator3']->getConfigurator(), '->load() parses the configurator tag'); + $this->assertEquals(array(array('setBar', array()), array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals(array(array('setBar', array('foo', new Reference('foo'), array(true, false)))), $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag'); + $this->assertEquals('baz_factory', $services['factory_service']->getFactoryService()); + + $this->assertTrue($services['request']->isSynthetic(), '->load() parses the synthetic flag'); + $this->assertTrue($services['request']->isSynchronized(), '->load() parses the synchronized flag'); + $this->assertTrue($services['request']->isLazy(), '->load() parses the lazy flag'); + + $aliases = $container->getAliases(); + $this->assertTrue(isset($aliases['alias_for_foo']), '->load() parses aliases'); + $this->assertEquals('foo', (string) $aliases['alias_for_foo'], '->load() parses aliases'); + $this->assertTrue($aliases['alias_for_foo']->isPublic()); + $this->assertTrue(isset($aliases['another_alias_for_foo'])); + $this->assertEquals('foo', (string) $aliases['another_alias_for_foo']); + $this->assertFalse($aliases['another_alias_for_foo']->isPublic()); + + $this->assertNull($services['request']->getDecoratedService()); + $this->assertEquals(array('decorated', null), $services['decorator_service']->getDecoratedService()); + $this->assertEquals(array('decorated', 'decorated.pif-pouf'), $services['decorator_service_with_name']->getDecoratedService()); + } + + public function testExtensions() + { + $container = new ContainerBuilder(); + $container->registerExtension(new \ProjectExtension()); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('services10.yml'); + $container->compile(); + $services = $container->getDefinitions(); + $parameters = $container->getParameterBag()->all(); + + $this->assertTrue(isset($services['project.service.bar']), '->load() parses extension elements'); + $this->assertTrue(isset($parameters['project.parameter.bar']), '->load() parses extension elements'); + + $this->assertEquals('BAR', $services['project.service.foo']->getClass(), '->load() parses extension elements'); + $this->assertEquals('BAR', $parameters['project.parameter.foo'], '->load() parses extension elements'); + + try { + $loader->load('services11.yml'); + $this->fail('->load() throws an InvalidArgumentException if the tag is not valid'); + } catch (\Exception $e) { + $this->assertInstanceOf('\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tag is not valid'); + $this->assertStringStartsWith('There is no extension able to load the configuration for "foobarfoobar" (in', $e->getMessage(), '->load() throws an InvalidArgumentException if the tag is not valid'); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\Loader\YamlFileLoader::supports + */ + public function testSupports() + { + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator()); + + $this->assertTrue($loader->supports('foo.yml'), '->supports() returns true if the resource is loadable'); + $this->assertFalse($loader->supports('foo.foo'), '->supports() returns true if the resource is loadable'); + } + + public function testNonArrayTagsThrowsException() + { + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml')); + try { + $loader->load('badtag1.yml'); + $this->fail('->load() should throw an exception when the tags key of a service is not an array'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tags key is not an array'); + $this->assertStringStartsWith('Parameter "tags" must be an array for service', $e->getMessage(), '->load() throws an InvalidArgumentException if the tags key is not an array'); + } + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException + * @expectedExceptionMessage A "tags" entry must be an array for service + */ + public function testNonArrayTagThrowsException() + { + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('badtag4.yml'); + } + + public function testTagWithoutNameThrowsException() + { + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml')); + try { + $loader->load('badtag2.yml'); + $this->fail('->load() should throw an exception when a tag is missing the name key'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key'); + $this->assertStringStartsWith('A "tags" entry is missing a "name" key for service ', $e->getMessage(), '->load() throws an InvalidArgumentException if a tag is missing the name key'); + } + } + + public function testTagWithAttributeArrayThrowsException() + { + $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath.'/yaml')); + try { + $loader->load('badtag3.yml'); + $this->fail('->load() should throw an exception when a tag-attribute is not a scalar'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag-attribute is not a scalar'); + $this->assertStringStartsWith('A "tags" attribute must be of a scalar-type for service "foo_service", tag "foo", attribute "bar"', $e->getMessage(), '->load() throws an InvalidArgumentException if a tag-attribute is not a scalar'); + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php new file mode 100644 index 0000000..e6e7fea --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\ParameterBag; + +use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; + +class FrozenParameterBagTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::__construct + */ + public function testConstructor() + { + $parameters = array( + 'foo' => 'foo', + 'bar' => 'bar', + ); + $bag = new FrozenParameterBag($parameters); + $this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::clear + * @expectedException \LogicException + */ + public function testClear() + { + $bag = new FrozenParameterBag(array()); + $bag->clear(); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::set + * @expectedException \LogicException + */ + public function testSet() + { + $bag = new FrozenParameterBag(array()); + $bag->set('foo', 'bar'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::add + * @expectedException \LogicException + */ + public function testAdd() + { + $bag = new FrozenParameterBag(array()); + $bag->add(array()); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php new file mode 100644 index 0000000..e1f8169 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php @@ -0,0 +1,279 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\ParameterBag; + +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; +use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; + +class ParameterBagTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::__construct + */ + public function testConstructor() + { + $bag = new ParameterBag($parameters = array( + 'foo' => 'foo', + 'bar' => 'bar', + )); + $this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::clear + */ + public function testClear() + { + $bag = new ParameterBag($parameters = array( + 'foo' => 'foo', + 'bar' => 'bar', + )); + $bag->clear(); + $this->assertEquals(array(), $bag->all(), '->clear() removes all parameters'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::remove + */ + public function testRemove() + { + $bag = new ParameterBag(array( + 'foo' => 'foo', + 'bar' => 'bar', + )); + $bag->remove('foo'); + $this->assertEquals(array('bar' => 'bar'), $bag->all(), '->remove() removes a parameter'); + $bag->remove('BAR'); + $this->assertEquals(array(), $bag->all(), '->remove() converts key to lowercase before removing'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::get + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::set + */ + public function testGetSet() + { + $bag = new ParameterBag(array('foo' => 'bar')); + $bag->set('bar', 'foo'); + $this->assertEquals('foo', $bag->get('bar'), '->set() sets the value of a new parameter'); + + $bag->set('foo', 'baz'); + $this->assertEquals('baz', $bag->get('foo'), '->set() overrides previously set parameter'); + + $bag->set('Foo', 'baz1'); + $this->assertEquals('baz1', $bag->get('foo'), '->set() converts the key to lowercase'); + $this->assertEquals('baz1', $bag->get('FOO'), '->get() converts the key to lowercase'); + + try { + $bag->get('baba'); + $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException', $e, '->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + $this->assertEquals('You have requested a non-existent parameter "baba".', $e->getMessage(), '->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + } + } + + public function testGetThrowParameterNotFoundException() + { + $bag = new ParameterBag(array( + 'foo' => 'foo', + 'bar' => 'bar', + 'baz' => 'baz', + )); + + try { + $bag->get('foo1'); + $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException', $e, '->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + $this->assertEquals('You have requested a non-existent parameter "foo1". Did you mean this: "foo"?', $e->getMessage(), '->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException with some advices'); + } + + try { + $bag->get('bag'); + $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException', $e, '->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + $this->assertEquals('You have requested a non-existent parameter "bag". Did you mean one of these: "bar", "baz"?', $e->getMessage(), '->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException with some advices'); + } + + try { + $bag->get(''); + $this->fail('->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + } catch (\Exception $e) { + $this->assertInstanceOf('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException', $e, '->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException if the key does not exist'); + $this->assertEquals('You have requested a non-existent parameter "".', $e->getMessage(), '->get() throws an Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException with some advices'); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::has + */ + public function testHas() + { + $bag = new ParameterBag(array('foo' => 'bar')); + $this->assertTrue($bag->has('foo'), '->has() returns true if a parameter is defined'); + $this->assertTrue($bag->has('Foo'), '->has() converts the key to lowercase'); + $this->assertFalse($bag->has('bar'), '->has() returns false if a parameter is not defined'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolveValue + */ + public function testResolveValue() + { + $bag = new ParameterBag(array()); + $this->assertEquals('foo', $bag->resolveValue('foo'), '->resolveValue() returns its argument unmodified if no placeholders are found'); + + $bag = new ParameterBag(array('foo' => 'bar')); + $this->assertEquals('I\'m a bar', $bag->resolveValue('I\'m a %foo%'), '->resolveValue() replaces placeholders by their values'); + $this->assertEquals(array('bar' => 'bar'), $bag->resolveValue(array('%foo%' => '%foo%')), '->resolveValue() replaces placeholders in keys and values of arrays'); + $this->assertEquals(array('bar' => array('bar' => array('bar' => 'bar'))), $bag->resolveValue(array('%foo%' => array('%foo%' => array('%foo%' => '%foo%')))), '->resolveValue() replaces placeholders in nested arrays'); + $this->assertEquals('I\'m a %%foo%%', $bag->resolveValue('I\'m a %%foo%%'), '->resolveValue() supports % escaping by doubling it'); + $this->assertEquals('I\'m a bar %%foo bar', $bag->resolveValue('I\'m a %foo% %%foo %foo%'), '->resolveValue() supports % escaping by doubling it'); + $this->assertEquals(array('foo' => array('bar' => array('ding' => 'I\'m a bar %%foo %%bar'))), $bag->resolveValue(array('foo' => array('bar' => array('ding' => 'I\'m a bar %%foo %%bar')))), '->resolveValue() supports % escaping by doubling it'); + + $bag = new ParameterBag(array('foo' => true)); + $this->assertTrue($bag->resolveValue('%foo%'), '->resolveValue() replaces arguments that are just a placeholder by their value without casting them to strings'); + $bag = new ParameterBag(array('foo' => null)); + $this->assertNull($bag->resolveValue('%foo%'), '->resolveValue() replaces arguments that are just a placeholder by their value without casting them to strings'); + + $bag = new ParameterBag(array('foo' => 'bar', 'baz' => '%%%foo% %foo%%% %%foo%% %%%foo%%%')); + $this->assertEquals('%%bar bar%% %%foo%% %%bar%%', $bag->resolveValue('%baz%'), '->resolveValue() replaces params placed besides escaped %'); + + $bag = new ParameterBag(array('baz' => '%%s?%%s')); + $this->assertEquals('%%s?%%s', $bag->resolveValue('%baz%'), '->resolveValue() is not replacing greedily'); + + $bag = new ParameterBag(array()); + try { + $bag->resolveValue('%foobar%'); + $this->fail('->resolveValue() throws an InvalidArgumentException if a placeholder references a non-existent parameter'); + } catch (ParameterNotFoundException $e) { + $this->assertEquals('You have requested a non-existent parameter "foobar".', $e->getMessage(), '->resolveValue() throws a ParameterNotFoundException if a placeholder references a non-existent parameter'); + } + + try { + $bag->resolveValue('foo %foobar% bar'); + $this->fail('->resolveValue() throws a ParameterNotFoundException if a placeholder references a non-existent parameter'); + } catch (ParameterNotFoundException $e) { + $this->assertEquals('You have requested a non-existent parameter "foobar".', $e->getMessage(), '->resolveValue() throws a ParameterNotFoundException if a placeholder references a non-existent parameter'); + } + + $bag = new ParameterBag(array('foo' => 'a %bar%', 'bar' => array())); + try { + $bag->resolveValue('%foo%'); + $this->fail('->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter'); + } catch (RuntimeException $e) { + $this->assertEquals('A string value must be composed of strings and/or numbers, but found parameter "bar" of type array inside string value "a %bar%".', $e->getMessage(), '->resolveValue() throws a RuntimeException when a parameter embeds another non-string parameter'); + } + + $bag = new ParameterBag(array('foo' => '%bar%', 'bar' => '%foobar%', 'foobar' => '%foo%')); + try { + $bag->resolveValue('%foo%'); + $this->fail('->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); + } catch (ParameterCircularReferenceException $e) { + $this->assertEquals('Circular reference detected for parameter "foo" ("foo" > "bar" > "foobar" > "foo").', $e->getMessage(), '->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); + } + + $bag = new ParameterBag(array('foo' => 'a %bar%', 'bar' => 'a %foobar%', 'foobar' => 'a %foo%')); + try { + $bag->resolveValue('%foo%'); + $this->fail('->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); + } catch (ParameterCircularReferenceException $e) { + $this->assertEquals('Circular reference detected for parameter "foo" ("foo" > "bar" > "foobar" > "foo").', $e->getMessage(), '->resolveValue() throws a ParameterCircularReferenceException when a parameter has a circular reference'); + } + + $bag = new ParameterBag(array('host' => 'foo.bar', 'port' => 1337)); + $this->assertEquals('foo.bar:1337', $bag->resolveValue('%host%:%port%')); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve + */ + public function testResolveIndicatesWhyAParameterIsNeeded() + { + $bag = new ParameterBag(array('foo' => '%bar%')); + + try { + $bag->resolve(); + } catch (ParameterNotFoundException $e) { + $this->assertEquals('The parameter "foo" has a dependency on a non-existent parameter "bar".', $e->getMessage()); + } + + $bag = new ParameterBag(array('foo' => '%bar%')); + + try { + $bag->resolve(); + } catch (ParameterNotFoundException $e) { + $this->assertEquals('The parameter "foo" has a dependency on a non-existent parameter "bar".', $e->getMessage()); + } + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve + */ + public function testResolveUnescapesValue() + { + $bag = new ParameterBag(array( + 'foo' => array('bar' => array('ding' => 'I\'m a bar %%foo %%bar')), + 'bar' => 'I\'m a %%foo%%', + )); + + $bag->resolve(); + + $this->assertEquals('I\'m a %foo%', $bag->get('bar'), '->resolveValue() supports % escaping by doubling it'); + $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %foo %bar')), $bag->get('foo'), '->resolveValue() supports % escaping by doubling it'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::escapeValue + */ + public function testEscapeValue() + { + $bag = new ParameterBag(); + + $bag->add(array( + 'foo' => $bag->escapeValue(array('bar' => array('ding' => 'I\'m a bar %foo %bar', 'zero' => null))), + 'bar' => $bag->escapeValue('I\'m a %foo%'), + )); + + $this->assertEquals('I\'m a %%foo%%', $bag->get('bar'), '->escapeValue() escapes % by doubling it'); + $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %%foo %%bar', 'zero' => null)), $bag->get('foo'), '->escapeValue() escapes % by doubling it'); + } + + /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve + * @dataProvider stringsWithSpacesProvider + */ + public function testResolveStringWithSpacesReturnsString($expected, $test, $description) + { + $bag = new ParameterBag(array('foo' => 'bar')); + + try { + $this->assertEquals($expected, $bag->resolveString($test), $description); + } catch (ParameterNotFoundException $e) { + $this->fail(sprintf('%s - "%s"', $description, $expected)); + } + } + + public function stringsWithSpacesProvider() + { + return array( + array('bar', '%foo%', 'Parameters must be wrapped by %.'), + array('% foo %', '% foo %', 'Parameters should not have spaces.'), + array('{% set my_template = "foo" %}', '{% set my_template = "foo" %}', 'Twig-like strings are not parameters.'), + array('50% is less than 100%', '50% is less than 100%', 'Text between % signs is allowed, if there are spaces.'), + ); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterTest.php new file mode 100644 index 0000000..bed188e --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterTest.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests; + +use Symfony\Component\DependencyInjection\Parameter; + +class ParameterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\Parameter::__construct + */ + public function testConstructor() + { + $ref = new Parameter('foo'); + $this->assertEquals('foo', (string) $ref, '__construct() sets the id of the parameter, which is used for the __toString() method'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php new file mode 100644 index 0000000..f14e99f --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests; + +use Symfony\Component\DependencyInjection\Reference; + +class ReferenceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers Symfony\Component\DependencyInjection\Reference::__construct + */ + public function testConstructor() + { + $ref = new Reference('foo'); + $this->assertEquals('foo', (string) $ref, '__construct() sets the id of the reference, which is used for the __toString() method'); + } + + public function testCaseInsensitive() + { + $ref = new Reference('FooBar'); + $this->assertEquals('foobar', (string) $ref, 'the id is lowercased as the container is case insensitive'); + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Variable.php b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Variable.php new file mode 100644 index 0000000..c84b8fd --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Variable.php @@ -0,0 +1,50 @@ + + * + * 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 $name; + + /** + * Constructor + * + * @param string $name + */ + public function __construct($name) + { + $this->name = $name; + } + + /** + * Converts the object to a string + * + * @return string + */ + public function __toString() + { + return $this->name; + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/composer.json b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/composer.json new file mode 100644 index 0000000..2190101 --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/composer.json @@ -0,0 +1,41 @@ +{ + "name": "symfony/dependency-injection", + "type": "library", + "description": "Symfony DependencyInjection Component", + "keywords": [], + "homepage": "http://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/yaml": "~2.0", + "symfony/config": "~2.2", + "symfony/expression-language": "~2.4" + }, + "suggest": { + "symfony/yaml": "", + "symfony/config": "", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them" + }, + "autoload": { + "psr-0": { "Symfony\\Component\\DependencyInjection\\": "" } + }, + "target-dir": "Symfony/Component/DependencyInjection", + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + } +} diff --git a/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/phpunit.xml.dist b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/phpunit.xml.dist new file mode 100644 index 0000000..d636cde --- /dev/null +++ b/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/phpunit.xml.dist @@ -0,0 +1,25 @@ + + + + + + ./Tests/ + + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/.gitignore b/vendor/symfony/filesystem/Symfony/Component/Filesystem/.gitignore new file mode 100644 index 0000000..c49a5d8 --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/CHANGELOG.md b/vendor/symfony/filesystem/Symfony/Component/Filesystem/CHANGELOG.md new file mode 100644 index 0000000..5b5cd6a --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/CHANGELOG.md @@ -0,0 +1,23 @@ +CHANGELOG +========= + +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/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/ExceptionInterface.php b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/ExceptionInterface.php new file mode 100644 index 0000000..c212e66 --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/ExceptionInterface.php @@ -0,0 +1,23 @@ + + * + * 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 + * + * @api + */ +interface ExceptionInterface +{ +} diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/FileNotFoundException.php b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/FileNotFoundException.php new file mode 100644 index 0000000..15533db --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/FileNotFoundException.php @@ -0,0 +1,34 @@ + + * + * 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($message = null, $code = 0, \Exception $previous = null, $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/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/IOException.php b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/IOException.php new file mode 100644 index 0000000..4b551af --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/IOException.php @@ -0,0 +1,41 @@ + + * + * 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 + * + * @api + */ +class IOException extends \RuntimeException implements IOExceptionInterface +{ + private $path; + + public function __construct($message, $code = 0, \Exception $previous = null, $path = null) + { + $this->path = $path; + + parent::__construct($message, $code, $previous); + } + + /** + * {@inheritdoc} + */ + public function getPath() + { + return $this->path; + } +} diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php new file mode 100644 index 0000000..c88c763 --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Exception/IOExceptionInterface.php @@ -0,0 +1,27 @@ + + * + * 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 + * + * @return string The path. + */ + public function getPath(); +} diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/Filesystem.php b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Filesystem.php new file mode 100644 index 0000000..3ebcc74 --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Filesystem.php @@ -0,0 +1,490 @@ + + * + * 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\IOException; +use Symfony\Component\Filesystem\Exception\FileNotFoundException; + +/** + * Provides basic utility to manipulate the file system. + * + * @author Fabien Potencier + */ +class Filesystem +{ + /** + * Copies a file. + * + * This method only copies the file if the origin file is newer than the target file. + * + * By default, if the target already exists, it is not overridden. + * + * @param string $originFile The original filename + * @param string $targetFile The target filename + * @param bool $override Whether to override an existing file or not + * + * @throws FileNotFoundException When originFile doesn't exist + * @throws IOException When copy fails + */ + public function copy($originFile, $targetFile, $override = false) + { + if (stream_is_local($originFile) && !is_file($originFile)) { + throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile); + } + + $this->mkdir(dirname($targetFile)); + + if (!$override && is_file($targetFile) && null === parse_url($originFile, PHP_URL_HOST)) { + $doCopy = filemtime($originFile) > filemtime($targetFile); + } else { + $doCopy = true; + } + + if ($doCopy) { + // https://bugs.php.net/bug.php?id=64634 + $source = fopen($originFile, 'r'); + // Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default + $target = fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true)))); + 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); + } + } + } + + /** + * Creates a directory recursively. + * + * @param string|array|\Traversable $dirs The directory path + * @param int $mode The directory mode + * + * @throws IOException On any directory creation failure + */ + public function mkdir($dirs, $mode = 0777) + { + foreach ($this->toIterator($dirs) as $dir) { + if (is_dir($dir)) { + continue; + } + + if (true !== @mkdir($dir, $mode, true)) { + $error = error_get_last(); + if (!is_dir($dir)) { + // The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one + if ($error) { + throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir); + } + throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir); + } + } + } + } + + /** + * Checks the existence of files or directories. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to check + * + * @return bool true if the file exists, false otherwise + */ + public function exists($files) + { + foreach ($this->toIterator($files) as $file) { + if (!file_exists($file)) { + return false; + } + } + + return true; + } + + /** + * Sets access and modification time of file. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to create + * @param int $time The touch time as a Unix timestamp + * @param int $atime The access time as a Unix timestamp + * + * @throws IOException When touch fails + */ + public function touch($files, $time = null, $atime = null) + { + foreach ($this->toIterator($files) as $file) { + $touch = $time ? @touch($file, $time, $atime) : @touch($file); + if (true !== $touch) { + throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file); + } + } + } + + /** + * Removes files or directories. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to remove + * + * @throws IOException When removal fails + */ + public function remove($files) + { + $files = iterator_to_array($this->toIterator($files)); + $files = array_reverse($files); + foreach ($files as $file) { + if (!file_exists($file) && !is_link($file)) { + continue; + } + + if (is_dir($file) && !is_link($file)) { + $this->remove(new \FilesystemIterator($file)); + + if (true !== @rmdir($file)) { + throw new IOException(sprintf('Failed to remove directory "%s".', $file), 0, null, $file); + } + } else { + // https://bugs.php.net/bug.php?id=52176 + if (defined('PHP_WINDOWS_VERSION_MAJOR') && is_dir($file)) { + if (true !== @rmdir($file)) { + throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file); + } + } else { + if (true !== @unlink($file)) { + throw new IOException(sprintf('Failed to remove file "%s".', $file), 0, null, $file); + } + } + } + } + } + + /** + * Change mode for an array of files or directories. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to change mode + * @param int $mode The new mode (octal) + * @param int $umask The mode mask (octal) + * @param bool $recursive Whether change the mod recursively or not + * + * @throws IOException When the change fail + */ + public function chmod($files, $mode, $umask = 0000, $recursive = false) + { + foreach ($this->toIterator($files) as $file) { + if ($recursive && is_dir($file) && !is_link($file)) { + $this->chmod(new \FilesystemIterator($file), $mode, $umask, true); + } + if (true !== @chmod($file, $mode & ~$umask)) { + throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file); + } + } + } + + /** + * Change the owner of an array of files or directories + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to change owner + * @param string $user The new owner user name + * @param bool $recursive Whether change the owner recursively or not + * + * @throws IOException When the change fail + */ + public function chown($files, $user, $recursive = false) + { + foreach ($this->toIterator($files) as $file) { + if ($recursive && is_dir($file) && !is_link($file)) { + $this->chown(new \FilesystemIterator($file), $user, true); + } + if (is_link($file) && function_exists('lchown')) { + if (true !== @lchown($file, $user)) { + throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); + } + } else { + if (true !== @chown($file, $user)) { + throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); + } + } + } + } + + /** + * Change the group of an array of files or directories + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to change group + * @param string $group The group name + * @param bool $recursive Whether change the group recursively or not + * + * @throws IOException When the change fail + */ + public function chgrp($files, $group, $recursive = false) + { + foreach ($this->toIterator($files) as $file) { + if ($recursive && is_dir($file) && !is_link($file)) { + $this->chgrp(new \FilesystemIterator($file), $group, true); + } + if (is_link($file) && function_exists('lchgrp')) { + if (true !== @lchgrp($file, $group)) { + throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); + } + } else { + if (true !== @chgrp($file, $group)) { + throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); + } + } + } + } + + /** + * Renames a file or a directory. + * + * @param string $origin The origin filename or directory + * @param string $target The new filename or directory + * @param bool $overwrite Whether to overwrite the target if it already exists + * + * @throws IOException When target file or directory already exists + * @throws IOException When origin cannot be renamed + */ + public function rename($origin, $target, $overwrite = false) + { + // we check that target does not exist + if (!$overwrite && is_readable($target)) { + throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target); + } + + if (true !== @rename($origin, $target)) { + throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target); + } + } + + /** + * Creates a symbolic link or copy a directory. + * + * @param string $originDir The origin directory path + * @param string $targetDir The symbolic link name + * @param bool $copyOnWindows Whether to copy files if on Windows + * + * @throws IOException When symlink fails + */ + public function symlink($originDir, $targetDir, $copyOnWindows = false) + { + if (!function_exists('symlink') && $copyOnWindows) { + $this->mirror($originDir, $targetDir); + + return; + } + + $this->mkdir(dirname($targetDir)); + + $ok = false; + if (is_link($targetDir)) { + if (readlink($targetDir) != $originDir) { + $this->remove($targetDir); + } else { + $ok = true; + } + } + + if (!$ok) { + if (true !== @symlink($originDir, $targetDir)) { + $report = error_get_last(); + if (is_array($report)) { + if (defined('PHP_WINDOWS_VERSION_MAJOR') && false !== strpos($report['message'], 'error code(1314)')) { + throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?'); + } + } + + throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir); + } + } + } + + /** + * Given an existing path, convert it to a path relative to a given starting path + * + * @param string $endPath Absolute path of target + * @param string $startPath Absolute path where traversal begins + * + * @return string Path of target relative to starting path + */ + public function makePathRelative($endPath, $startPath) + { + // Normalize separators on Windows + if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + $endPath = strtr($endPath, '\\', '/'); + $startPath = strtr($startPath, '\\', '/'); + } + + // Split the paths into arrays + $startPathArr = explode('/', trim($startPath, '/')); + $endPathArr = explode('/', trim($endPath, '/')); + + // 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) + $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.(strlen($endPathRemainder) > 0 ? $endPathRemainder.'/' : ''); + + return (strlen($relativePath) === 0) ? './' : $relativePath; + } + + /** + * Mirrors a directory to another. + * + * @param string $originDir The origin directory + * @param string $targetDir The target directory + * @param \Traversable $iterator A Traversable instance + * @param array $options An array of boolean options + * Valid options are: + * - $options['override'] Whether to override an existing file on copy or not (see copy()) + * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink()) + * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) + * + * @throws IOException When file type is unknown + */ + public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array()) + { + $targetDir = rtrim($targetDir, '/\\'); + $originDir = rtrim($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); + } + foreach ($deleteIterator as $file) { + $origin = str_replace($targetDir, $originDir, $file->getPathname()); + if (!$this->exists($origin)) { + $this->remove($file); + } + } + } + + $copyOnWindows = false; + if (isset($options['copy_on_windows']) && !function_exists('symlink')) { + $copyOnWindows = $options['copy_on_windows']; + } + + if (null === $iterator) { + $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS; + $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST); + } + + if ($this->exists($originDir)) { + $this->mkdir($targetDir); + } + + foreach ($iterator as $file) { + $target = str_replace($originDir, $targetDir, $file->getPathname()); + + if ($copyOnWindows) { + if (is_link($file) || is_file($file)) { + $this->copy($file, $target, isset($options['override']) ? $options['override'] : false); + } elseif (is_dir($file)) { + $this->mkdir($target); + } else { + throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file); + } + } else { + if (is_link($file)) { + $this->symlink($file->getLinkTarget(), $target); + } elseif (is_dir($file)) { + $this->mkdir($target); + } elseif (is_file($file)) { + $this->copy($file, $target, isset($options['override']) ? $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. + * + * @param string $file A file path + * + * @return bool + */ + public function isAbsolutePath($file) + { + if (strspn($file, '/\\', 0, 1) + || (strlen($file) > 3 && ctype_alpha($file[0]) + && substr($file, 1, 1) === ':' + && (strspn($file, '/\\', 2, 1)) + ) + || null !== parse_url($file, PHP_URL_SCHEME) + ) { + return true; + } + + return false; + } + + /** + * Atomically dumps content into a file. + * + * @param string $filename The file to be written to. + * @param string $content The data to write into the file. + * @param null|int $mode The file mode (octal). If null, file permissions are not modified + * Deprecated since version 2.3.12, to be removed in 3.0. + * + * @throws IOException If the file cannot be written to. + */ + public function dumpFile($filename, $content, $mode = 0666) + { + $dir = dirname($filename); + + if (!is_dir($dir)) { + $this->mkdir($dir); + } elseif (!is_writable($dir)) { + throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir); + } + + $tmpFile = tempnam($dir, basename($filename)); + + if (false === @file_put_contents($tmpFile, $content)) { + throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename); + } + + $this->rename($tmpFile, $filename, true); + if (null !== $mode) { + $this->chmod($filename, $mode); + } + } + + /** + * @param mixed $files + * + * @return \Traversable + */ + private function toIterator($files) + { + if (!$files instanceof \Traversable) { + $files = new \ArrayObject(is_array($files) ? $files : array($files)); + } + + return $files; + } +} diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/LICENSE b/vendor/symfony/filesystem/Symfony/Component/Filesystem/LICENSE new file mode 100644 index 0000000..0b3292c --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2014 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/vendor/symfony/filesystem/Symfony/Component/Filesystem/README.md b/vendor/symfony/filesystem/Symfony/Component/Filesystem/README.md new file mode 100644 index 0000000..85b0f1c --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/README.md @@ -0,0 +1,47 @@ +Filesystem Component +==================== + +Filesystem provides basic utility to manipulate the file system: + +```php +copy($originFile, $targetFile, $override = false); + +$filesystem->mkdir($dirs, $mode = 0777); + +$filesystem->touch($files, $time = null, $atime = null); + +$filesystem->remove($files); + +$filesystem->exists($files); + +$filesystem->chmod($files, $mode, $umask = 0000, $recursive = false); + +$filesystem->chown($files, $user, $recursive = false); + +$filesystem->chgrp($files, $group, $recursive = false); + +$filesystem->rename($origin, $target); + +$filesystem->symlink($originDir, $targetDir, $copyOnWindows = false); + +$filesystem->makePathRelative($endPath, $startPath); + +$filesystem->mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array()); + +$filesystem->isAbsolutePath($file); +``` + +Resources +--------- + +You can run the unit tests with the following command: + + $ cd path/to/Symfony/Component/Filesystem/ + $ composer.phar install + $ phpunit diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/ExceptionTest.php b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/ExceptionTest.php new file mode 100644 index 0000000..53bd8db --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/ExceptionTest.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Filesystem\Tests; + +use Symfony\Component\Filesystem\Exception\IOException; +use Symfony\Component\Filesystem\Exception\FileNotFoundException; + +/** + * Test class for Filesystem. + */ +class ExceptionTest extends \PHPUnit_Framework_TestCase +{ + public function testGetPath() + { + $e = new IOException('', 0, null, '/foo'); + $this->assertEquals('/foo', $e->getPath(), 'The pass should be returned.'); + } + + public function testGeneratedMessage() + { + $e = new FileNotFoundException(null, 0, null, '/foo'); + $this->assertEquals('/foo', $e->getPath()); + $this->assertEquals('File "/foo" could not be found.', $e->getMessage(), 'A message should be generated.'); + } + + public function testGeneratedMessageWithoutPath() + { + $e = new FileNotFoundException(); + $this->assertEquals('File could not be found.', $e->getMessage(), 'A message should be generated.'); + } + + public function testCustomMessage() + { + $e = new FileNotFoundException('bar', 0, null, '/foo'); + $this->assertEquals('bar', $e->getMessage(), 'A custom message should be possible still.'); + } +} diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTest.php new file mode 100644 index 0000000..5be5686 --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -0,0 +1,922 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Filesystem\Tests; + +use Symfony\Component\Filesystem\Filesystem; + +/** + * Test class for Filesystem. + */ +class FilesystemTest extends FilesystemTestCase +{ + /** + * @var \Symfony\Component\Filesystem\Filesystem $filesystem + */ + private $filesystem = null; + + public function setUp() + { + parent::setUp(); + $this->filesystem = new Filesystem(); + } + + public function testCopyCreatesNewFile() + { + $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + + file_put_contents($sourceFilePath, 'SOURCE FILE'); + + $this->filesystem->copy($sourceFilePath, $targetFilePath); + + $this->assertFileExists($targetFilePath); + $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath)); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testCopyFails() + { + $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + + $this->filesystem->copy($sourceFilePath, $targetFilePath); + } + + public function testCopyOverridesExistingFileIfModified() + { + $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + + file_put_contents($sourceFilePath, 'SOURCE FILE'); + file_put_contents($targetFilePath, 'TARGET FILE'); + touch($targetFilePath, time() - 1000); + + $this->filesystem->copy($sourceFilePath, $targetFilePath); + + $this->assertFileExists($targetFilePath); + $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath)); + } + + public function testCopyDoesNotOverrideExistingFileByDefault() + { + $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + + file_put_contents($sourceFilePath, 'SOURCE FILE'); + file_put_contents($targetFilePath, 'TARGET FILE'); + + // make sure both files have the same modification time + $modificationTime = time() - 1000; + touch($sourceFilePath, $modificationTime); + touch($targetFilePath, $modificationTime); + + $this->filesystem->copy($sourceFilePath, $targetFilePath); + + $this->assertFileExists($targetFilePath); + $this->assertEquals('TARGET FILE', file_get_contents($targetFilePath)); + } + + public function testCopyOverridesExistingFileIfForced() + { + $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + + file_put_contents($sourceFilePath, 'SOURCE FILE'); + file_put_contents($targetFilePath, 'TARGET FILE'); + + // make sure both files have the same modification time + $modificationTime = time() - 1000; + touch($sourceFilePath, $modificationTime); + touch($targetFilePath, $modificationTime); + + $this->filesystem->copy($sourceFilePath, $targetFilePath, true); + + $this->assertFileExists($targetFilePath); + $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath)); + } + + public function testCopyCreatesTargetDirectoryIfItDoesNotExist() + { + $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFileDirectory = $this->workspace.DIRECTORY_SEPARATOR.'directory'; + $targetFilePath = $targetFileDirectory.DIRECTORY_SEPARATOR.'copy_target_file'; + + file_put_contents($sourceFilePath, 'SOURCE FILE'); + + $this->filesystem->copy($sourceFilePath, $targetFilePath); + + $this->assertTrue(is_dir($targetFileDirectory)); + $this->assertFileExists($targetFilePath); + $this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath)); + } + + public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToNotCopy() + { + $sourceFilePath = 'http://symfony.com/images/common/logo/logo_symfony_header.png'; + $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + + file_put_contents($targetFilePath, 'TARGET FILE'); + + $this->filesystem->copy($sourceFilePath, $targetFilePath, false); + + $this->assertFileExists($targetFilePath); + $this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath)); + } + + public function testMkdirCreatesDirectoriesRecursively() + { + $directory = $this->workspace + .DIRECTORY_SEPARATOR.'directory' + .DIRECTORY_SEPARATOR.'sub_directory'; + + $this->filesystem->mkdir($directory); + + $this->assertTrue(is_dir($directory)); + } + + public function testMkdirCreatesDirectoriesFromArray() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $directories = array( + $basePath.'1', $basePath.'2', $basePath.'3', + ); + + $this->filesystem->mkdir($directories); + + $this->assertTrue(is_dir($basePath.'1')); + $this->assertTrue(is_dir($basePath.'2')); + $this->assertTrue(is_dir($basePath.'3')); + } + + public function testMkdirCreatesDirectoriesFromTraversableObject() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $directories = new \ArrayObject(array( + $basePath.'1', $basePath.'2', $basePath.'3', + )); + + $this->filesystem->mkdir($directories); + + $this->assertTrue(is_dir($basePath.'1')); + $this->assertTrue(is_dir($basePath.'2')); + $this->assertTrue(is_dir($basePath.'3')); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testMkdirCreatesDirectoriesFails() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $dir = $basePath.'2'; + + file_put_contents($dir, ''); + + $this->filesystem->mkdir($dir); + } + + public function testTouchCreatesEmptyFile() + { + $file = $this->workspace.DIRECTORY_SEPARATOR.'1'; + + $this->filesystem->touch($file); + + $this->assertFileExists($file); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testTouchFails() + { + $file = $this->workspace.DIRECTORY_SEPARATOR.'1'.DIRECTORY_SEPARATOR.'2'; + + $this->filesystem->touch($file); + } + + public function testTouchCreatesEmptyFilesFromArray() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $files = array( + $basePath.'1', $basePath.'2', $basePath.'3', + ); + + $this->filesystem->touch($files); + + $this->assertFileExists($basePath.'1'); + $this->assertFileExists($basePath.'2'); + $this->assertFileExists($basePath.'3'); + } + + public function testTouchCreatesEmptyFilesFromTraversableObject() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $files = new \ArrayObject(array( + $basePath.'1', $basePath.'2', $basePath.'3', + )); + + $this->filesystem->touch($files); + + $this->assertFileExists($basePath.'1'); + $this->assertFileExists($basePath.'2'); + $this->assertFileExists($basePath.'3'); + } + + public function testRemoveCleansFilesAndDirectoriesIteratively() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR; + + mkdir($basePath); + mkdir($basePath.'dir'); + touch($basePath.'file'); + + $this->filesystem->remove($basePath); + + $this->assertTrue(!is_dir($basePath)); + } + + public function testRemoveCleansArrayOfFilesAndDirectories() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + + mkdir($basePath.'dir'); + touch($basePath.'file'); + + $files = array( + $basePath.'dir', $basePath.'file', + ); + + $this->filesystem->remove($files); + + $this->assertTrue(!is_dir($basePath.'dir')); + $this->assertTrue(!is_file($basePath.'file')); + } + + public function testRemoveCleansTraversableObjectOfFilesAndDirectories() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + + mkdir($basePath.'dir'); + touch($basePath.'file'); + + $files = new \ArrayObject(array( + $basePath.'dir', $basePath.'file', + )); + + $this->filesystem->remove($files); + + $this->assertTrue(!is_dir($basePath.'dir')); + $this->assertTrue(!is_file($basePath.'file')); + } + + public function testRemoveIgnoresNonExistingFiles() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + + mkdir($basePath.'dir'); + + $files = array( + $basePath.'dir', $basePath.'file', + ); + + $this->filesystem->remove($files); + + $this->assertTrue(!is_dir($basePath.'dir')); + } + + public function testRemoveCleansInvalidLinks() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR; + + mkdir($basePath); + mkdir($basePath.'dir'); + // create symlink to nonexistent file + @symlink($basePath.'file', $basePath.'link'); + + $this->filesystem->remove($basePath); + + $this->assertTrue(!is_dir($basePath)); + } + + public function testFilesExists() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR; + + mkdir($basePath); + touch($basePath.'file1'); + mkdir($basePath.'folder'); + + $this->assertTrue($this->filesystem->exists($basePath.'file1')); + $this->assertTrue($this->filesystem->exists($basePath.'folder')); + } + + public function testFilesExistsTraversableObjectOfFilesAndDirectories() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + + mkdir($basePath.'dir'); + touch($basePath.'file'); + + $files = new \ArrayObject(array( + $basePath.'dir', $basePath.'file', + )); + + $this->assertTrue($this->filesystem->exists($files)); + } + + public function testFilesNotExistsTraversableObjectOfFilesAndDirectories() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR; + + mkdir($basePath.'dir'); + touch($basePath.'file'); + touch($basePath.'file2'); + + $files = new \ArrayObject(array( + $basePath.'dir', $basePath.'file', $basePath.'file2', + )); + + unlink($basePath.'file'); + + $this->assertFalse($this->filesystem->exists($files)); + } + + public function testInvalidFileNotExists() + { + $basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR; + + $this->assertFalse($this->filesystem->exists($basePath.time())); + } + + public function testChmodChangesFileMode() + { + $this->markAsSkippedIfChmodIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + mkdir($dir); + $file = $dir.DIRECTORY_SEPARATOR.'file'; + touch($file); + + $this->filesystem->chmod($file, 0400); + $this->filesystem->chmod($dir, 0753); + + $this->assertFilePermissions(753, $dir); + $this->assertFilePermissions(400, $file); + } + + public function testChmodWrongMod() + { + $this->markAsSkippedIfChmodIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'file'; + touch($dir); + + $this->filesystem->chmod($dir, 'Wrongmode'); + } + + public function testChmodRecursive() + { + $this->markAsSkippedIfChmodIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + mkdir($dir); + $file = $dir.DIRECTORY_SEPARATOR.'file'; + touch($file); + + $this->filesystem->chmod($file, 0400, 0000, true); + $this->filesystem->chmod($dir, 0753, 0000, true); + + $this->assertFilePermissions(753, $dir); + $this->assertFilePermissions(753, $file); + } + + public function testChmodAppliesUmask() + { + $this->markAsSkippedIfChmodIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + touch($file); + + $this->filesystem->chmod($file, 0770, 0022); + $this->assertFilePermissions(750, $file); + } + + public function testChmodChangesModeOfArrayOfFiles() + { + $this->markAsSkippedIfChmodIsMissing(); + + $directory = $this->workspace.DIRECTORY_SEPARATOR.'directory'; + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $files = array($directory, $file); + + mkdir($directory); + touch($file); + + $this->filesystem->chmod($files, 0753); + + $this->assertFilePermissions(753, $file); + $this->assertFilePermissions(753, $directory); + } + + public function testChmodChangesModeOfTraversableFileObject() + { + $this->markAsSkippedIfChmodIsMissing(); + + $directory = $this->workspace.DIRECTORY_SEPARATOR.'directory'; + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $files = new \ArrayObject(array($directory, $file)); + + mkdir($directory); + touch($file); + + $this->filesystem->chmod($files, 0753); + + $this->assertFilePermissions(753, $file); + $this->assertFilePermissions(753, $directory); + } + + public function testChown() + { + $this->markAsSkippedIfPosixIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + mkdir($dir); + + $this->filesystem->chown($dir, $this->getFileOwner($dir)); + } + + public function testChownRecursive() + { + $this->markAsSkippedIfPosixIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + mkdir($dir); + $file = $dir.DIRECTORY_SEPARATOR.'file'; + touch($file); + + $this->filesystem->chown($dir, $this->getFileOwner($dir), true); + } + + public function testChownSymlink() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + + touch($file); + + $this->filesystem->symlink($file, $link); + + $this->filesystem->chown($link, $this->getFileOwner($link)); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testChownSymlinkFails() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + + touch($file); + + $this->filesystem->symlink($file, $link); + + $this->filesystem->chown($link, 'user'.time().mt_rand(1000, 9999)); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testChownFail() + { + $this->markAsSkippedIfPosixIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + mkdir($dir); + + $this->filesystem->chown($dir, 'user'.time().mt_rand(1000, 9999)); + } + + public function testChgrp() + { + $this->markAsSkippedIfPosixIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + mkdir($dir); + + $this->filesystem->chgrp($dir, $this->getFileGroup($dir)); + } + + public function testChgrpRecursive() + { + $this->markAsSkippedIfPosixIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + mkdir($dir); + $file = $dir.DIRECTORY_SEPARATOR.'file'; + touch($file); + + $this->filesystem->chgrp($dir, $this->getFileGroup($dir), true); + } + + public function testChgrpSymlink() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + + touch($file); + + $this->filesystem->symlink($file, $link); + + $this->filesystem->chgrp($link, $this->getFileGroup($link)); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testChgrpSymlinkFails() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + + touch($file); + + $this->filesystem->symlink($file, $link); + + $this->filesystem->chgrp($link, 'user'.time().mt_rand(1000, 9999)); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testChgrpFail() + { + $this->markAsSkippedIfPosixIsMissing(); + + $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + mkdir($dir); + + $this->filesystem->chgrp($dir, 'user'.time().mt_rand(1000, 9999)); + } + + public function testRename() + { + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file'; + touch($file); + + $this->filesystem->rename($file, $newPath); + + $this->assertFileNotExists($file); + $this->assertFileExists($newPath); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testRenameThrowsExceptionIfTargetAlreadyExists() + { + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file'; + + touch($file); + touch($newPath); + + $this->filesystem->rename($file, $newPath); + } + + public function testRenameOverwritesTheTargetIfItAlreadyExists() + { + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file'; + + touch($file); + touch($newPath); + + $this->filesystem->rename($file, $newPath, true); + + $this->assertFileNotExists($file); + $this->assertFileExists($newPath); + } + + /** + * @expectedException \Symfony\Component\Filesystem\Exception\IOException + */ + public function testRenameThrowsExceptionOnError() + { + $file = $this->workspace.DIRECTORY_SEPARATOR.uniqid(); + $newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file'; + + $this->filesystem->rename($file, $newPath); + } + + public function testSymlink() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + + touch($file); + + $this->filesystem->symlink($file, $link); + + $this->assertTrue(is_link($link)); + $this->assertEquals($file, readlink($link)); + } + + /** + * @depends testSymlink + */ + public function testRemoveSymlink() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + + $this->filesystem->remove($link); + + $this->assertTrue(!is_link($link)); + } + + public function testSymlinkIsOverwrittenIfPointsToDifferentTarget() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + + touch($file); + symlink($this->workspace, $link); + + $this->filesystem->symlink($file, $link); + + $this->assertTrue(is_link($link)); + $this->assertEquals($file, readlink($link)); + } + + public function testSymlinkIsNotOverwrittenIfAlreadyCreated() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + + touch($file); + symlink($file, $link); + + $this->filesystem->symlink($file, $link); + + $this->assertTrue(is_link($link)); + $this->assertEquals($file, readlink($link)); + } + + public function testSymlinkCreatesTargetDirectoryIfItDoesNotExist() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $link1 = $this->workspace.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'link'; + $link2 = $this->workspace.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'subdir'.DIRECTORY_SEPARATOR.'link'; + + touch($file); + + $this->filesystem->symlink($file, $link1); + $this->filesystem->symlink($file, $link2); + + $this->assertTrue(is_link($link1)); + $this->assertEquals($file, readlink($link1)); + $this->assertTrue(is_link($link2)); + $this->assertEquals($file, readlink($link2)); + } + + /** + * @dataProvider providePathsForMakePathRelative + */ + public function testMakePathRelative($endPath, $startPath, $expectedPath) + { + $path = $this->filesystem->makePathRelative($endPath, $startPath); + + $this->assertEquals($expectedPath, $path); + } + + /** + * @return array + */ + public function providePathsForMakePathRelative() + { + $paths = array( + array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component', '../'), + array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/src/Symfony/Component/', '../'), + array('/var/lib/symfony/src/Symfony', '/var/lib/symfony/src/Symfony/Component', '../'), + array('/var/lib/symfony/src/Symfony', '/var/lib/symfony/src/Symfony/Component/', '../'), + array('var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component', '../../../'), + array('/usr/lib/symfony/', '/var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/'), + array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/', 'src/Symfony/'), + array('/aa/bb', '/aa/bb', './'), + array('/aa/bb', '/aa/bb/', './'), + array('/aa/bb/', '/aa/bb', './'), + array('/aa/bb/', '/aa/bb/', './'), + array('/aa/bb/cc', '/aa/bb/cc/dd', '../'), + array('/aa/bb/cc', '/aa/bb/cc/dd/', '../'), + array('/aa/bb/cc/', '/aa/bb/cc/dd', '../'), + array('/aa/bb/cc/', '/aa/bb/cc/dd/', '../'), + array('/aa/bb/cc', '/aa', 'bb/cc/'), + array('/aa/bb/cc', '/aa/', 'bb/cc/'), + array('/aa/bb/cc/', '/aa', 'bb/cc/'), + array('/aa/bb/cc/', '/aa/', 'bb/cc/'), + array('/a/aab/bb', '/a/aa', '../aab/bb/'), + array('/a/aab/bb', '/a/aa/', '../aab/bb/'), + array('/a/aab/bb/', '/a/aa', '../aab/bb/'), + array('/a/aab/bb/', '/a/aa/', '../aab/bb/'), + ); + + if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + $paths[] = array('c:\var\lib/symfony/src/Symfony/', 'c:/var/lib/symfony/', 'src/Symfony/'); + } + + return $paths; + } + + public function testMirrorCopiesFilesAndDirectoriesRecursively() + { + $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + $directory = $sourcePath.'directory'.DIRECTORY_SEPARATOR; + $file1 = $directory.'file1'; + $file2 = $sourcePath.'file2'; + + mkdir($sourcePath); + mkdir($directory); + file_put_contents($file1, 'FILE1'); + file_put_contents($file2, 'FILE2'); + + $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + + $this->filesystem->mirror($sourcePath, $targetPath); + + $this->assertTrue(is_dir($targetPath)); + $this->assertTrue(is_dir($targetPath.'directory')); + $this->assertFileEquals($file1, $targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'); + $this->assertFileEquals($file2, $targetPath.'file2'); + + $this->filesystem->remove($file1); + + $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => false)); + $this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); + + $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true)); + $this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); + + file_put_contents($file1, 'FILE1'); + + $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true)); + $this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); + + $this->filesystem->remove($directory); + $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true)); + $this->assertFalse($this->filesystem->exists($targetPath.'directory')); + $this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); + } + + public function testMirrorCreatesEmptyDirectory() + { + $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + + mkdir($sourcePath); + + $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + + $this->filesystem->mirror($sourcePath, $targetPath); + + $this->assertTrue(is_dir($targetPath)); + + $this->filesystem->remove($sourcePath); + } + + public function testMirrorCopiesLinks() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + + mkdir($sourcePath); + file_put_contents($sourcePath.'file1', 'FILE1'); + symlink($sourcePath.'file1', $sourcePath.'link1'); + + $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + + $this->filesystem->mirror($sourcePath, $targetPath); + + $this->assertTrue(is_dir($targetPath)); + $this->assertFileEquals($sourcePath.'file1', $targetPath.DIRECTORY_SEPARATOR.'link1'); + $this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1')); + } + + public function testMirrorCopiesLinkedDirectoryContents() + { + $this->markAsSkippedIfSymlinkIsMissing(); + + $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + + mkdir($sourcePath.'nested/', 0777, true); + file_put_contents($sourcePath.'/nested/file1.txt', 'FILE1'); + // Note: We symlink directory, not file + symlink($sourcePath.'nested', $sourcePath.'link1'); + + $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + + $this->filesystem->mirror($sourcePath, $targetPath); + + $this->assertTrue(is_dir($targetPath)); + $this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.DIRECTORY_SEPARATOR.'link1/file1.txt'); + $this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1')); + } + + /** + * @dataProvider providePathsForIsAbsolutePath + */ + public function testIsAbsolutePath($path, $expectedResult) + { + $result = $this->filesystem->isAbsolutePath($path); + + $this->assertEquals($expectedResult, $result); + } + + /** + * @return array + */ + public function providePathsForIsAbsolutePath() + { + return array( + array('/var/lib', true), + array('c:\\\\var\\lib', true), + array('\\var\\lib', true), + array('var/lib', false), + array('../var/lib', false), + array('', false), + array(null, false), + ); + } + + public function testDumpFile() + { + $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt'; + + $this->filesystem->dumpFile($filename, 'bar', 0753); + + $this->assertFileExists($filename); + $this->assertSame('bar', file_get_contents($filename)); + + // skip mode check on Windows + if (!defined('PHP_WINDOWS_VERSION_MAJOR')) { + $this->assertFilePermissions(753, $filename); + } + } + + public function testDumpFileWithNullMode() + { + $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt'; + + $this->filesystem->dumpFile($filename, 'bar', null); + + $this->assertFileExists($filename); + $this->assertSame('bar', file_get_contents($filename)); + + // skip mode check on Windows + if (!defined('PHP_WINDOWS_VERSION_MAJOR')) { + $this->assertFilePermissions(600, $filename); + } + } + + public function testDumpFileOverwritesAnExistingFile() + { + $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo.txt'; + file_put_contents($filename, 'FOO BAR'); + + $this->filesystem->dumpFile($filename, 'bar'); + + $this->assertFileExists($filename); + $this->assertSame('bar', file_get_contents($filename)); + } +} diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php new file mode 100644 index 0000000..106c13f --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php @@ -0,0 +1,127 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Filesystem\Tests; + +class FilesystemTestCase extends \PHPUnit_Framework_TestCase +{ + /** + * @var string $workspace + */ + protected $workspace = null; + + protected static $symlinkOnWindows = null; + + public static function setUpBeforeClass() + { + if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + static::$symlinkOnWindows = true; + $originDir = tempnam(sys_get_temp_dir(), 'sl'); + $targetDir = tempnam(sys_get_temp_dir(), 'sl'); + if (true !== @symlink($originDir, $targetDir)) { + $report = error_get_last(); + if (is_array($report) && false !== strpos($report['message'], 'error code(1314)')) { + static::$symlinkOnWindows = false; + } + } + } + } + + public function setUp() + { + $this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().rand(0, 1000); + mkdir($this->workspace, 0777, true); + $this->workspace = realpath($this->workspace); + } + + public function tearDown() + { + $this->clean($this->workspace); + } + + /** + * @param string $file + */ + protected function clean($file) + { + if (is_dir($file) && !is_link($file)) { + $dir = new \FilesystemIterator($file); + foreach ($dir as $childFile) { + $this->clean($childFile); + } + + rmdir($file); + } else { + unlink($file); + } + } + + /** + * @param int $expectedFilePerms expected file permissions as three digits (i.e. 755) + * @param string $filePath + */ + protected function assertFilePermissions($expectedFilePerms, $filePath) + { + $actualFilePerms = (int) substr(sprintf('%o', fileperms($filePath)), -3); + $this->assertEquals( + $expectedFilePerms, + $actualFilePerms, + sprintf('File permissions for %s must be %s. Actual %s', $filePath, $expectedFilePerms, $actualFilePerms) + ); + } + + protected function getFileOwner($filepath) + { + $this->markAsSkippedIfPosixIsMissing(); + + $infos = stat($filepath); + if ($datas = posix_getpwuid($infos['uid'])) { + return $datas['name']; + } + } + + protected function getFileGroup($filepath) + { + $this->markAsSkippedIfPosixIsMissing(); + + $infos = stat($filepath); + if ($datas = posix_getgrgid($infos['gid'])) { + return $datas['name']; + } + + $this->markTestSkipped('Unable to retrieve file group name'); + } + + protected function markAsSkippedIfSymlinkIsMissing() + { + if (!function_exists('symlink')) { + $this->markTestSkipped('symlink is not supported'); + } + + if (defined('PHP_WINDOWS_VERSION_MAJOR') && false === static::$symlinkOnWindows) { + $this->markTestSkipped('symlink requires "Create symbolic links" privilege on windows'); + } + } + + protected function markAsSkippedIfChmodIsMissing() + { + if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + $this->markTestSkipped('chmod is not supported on windows'); + } + } + + protected function markAsSkippedIfPosixIsMissing() + { + if (defined('PHP_WINDOWS_VERSION_MAJOR') || !function_exists('posix_isatty')) { + $this->markTestSkipped('Posix is not supported'); + } + } +} diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/composer.json b/vendor/symfony/filesystem/Symfony/Component/Filesystem/composer.json new file mode 100644 index 0000000..dfa633c --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/composer.json @@ -0,0 +1,31 @@ +{ + "name": "symfony/filesystem", + "type": "library", + "description": "Symfony Filesystem Component", + "keywords": [], + "homepage": "http://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.3" + }, + "autoload": { + "psr-0": { "Symfony\\Component\\Filesystem\\": "" } + }, + "target-dir": "Symfony/Component/Filesystem", + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + } +} diff --git a/vendor/symfony/filesystem/Symfony/Component/Filesystem/phpunit.xml.dist b/vendor/symfony/filesystem/Symfony/Component/Filesystem/phpunit.xml.dist new file mode 100644 index 0000000..7902835 --- /dev/null +++ b/vendor/symfony/filesystem/Symfony/Component/Filesystem/phpunit.xml.dist @@ -0,0 +1,23 @@ + + + + + + ./Tests/ + + + + + + ./ + + ./Tests + + + +