Issue #2234277 by cilefen, hussainweb, Xano, netlooker, martin107: Composer update (includes security fixes).
parent
7189de5dba
commit
90863aeeb1
|
@ -15,7 +15,7 @@
|
|||
"symfony/routing": "2.5.*",
|
||||
"symfony/serializer": "2.5.*",
|
||||
"symfony/validator": "2.5.*",
|
||||
"symfony/yaml": "dev-master#089129be9f9828f41f0f345e09ff322ecf92cfb2",
|
||||
"symfony/yaml": "dev-master#499f7d7aa96747ad97940089bd7a1fb24ad8182a",
|
||||
"twig/twig": "1.15.*",
|
||||
"doctrine/common": "dev-master#a45d110f71c323e29f41eb0696fa230e3fa1b1b5",
|
||||
"doctrine/annotations": "1.2.*",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -200,171 +200,174 @@ return array(
|
|||
'PHP_CodeCoverage_Util' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Util.php',
|
||||
'PHP_CodeCoverage_Util_InvalidArgumentHelper' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Util/InvalidArgumentHelper.php',
|
||||
'PHP_Timer' => $vendorDir . '/phpunit/php-timer/PHP/Timer.php',
|
||||
'PHP_Token' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ABSTRACT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_AMPERSAND' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_AND_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_BOOLEAN_OR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_BOOL_CAST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_BREAK' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CALLABLE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CARET' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CASE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CATCH' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CLASS' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CLASS_C' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CLASS_NAME_CONSTANT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CLONE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CLOSE_BRACKET' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CONTINUE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_CURLY_OPEN' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DEC' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DECLARE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DEFAULT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DIR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DIV' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DIV_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DNUMBER' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DO' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DOC_COMMENT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DOLLAR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DOT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DOUBLE_ARROW' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DOUBLE_CAST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DOUBLE_COLON' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_DOUBLE_QUOTES' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ECHO' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ELSE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ELSEIF' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_EMPTY' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ENCAPSED_AND_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ENDDECLARE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ENDFOR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ENDFOREACH' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ENDIF' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_EXTENDS' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_FILE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_FINAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_FINALLY' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_FOR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_FOREACH' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_FUNC_C' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_GLOBAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_GOTO' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_GT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_HALT_COMPILER' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_IF' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_IMPLEMENTS' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_INC' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_INCLUDE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_INCLUDE_ONCE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_INLINE_HTML' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_INSTANCEOF' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_INSTEADOF' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_INTERFACE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_INT_CAST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_ISSET' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_IS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_IS_GREATER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_IS_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_IS_NOT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_IS_NOT_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_IS_SMALLER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_Includes' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_LINE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_LIST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_LNUMBER' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_LOGICAL_AND' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_LOGICAL_OR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_LOGICAL_XOR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_LT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_METHOD_C' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_MINUS' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_MINUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_MOD_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_MULT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_MUL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_NAMESPACE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_NEW' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_NS_C' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_NS_SEPARATOR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_OPEN_TAG' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_OPEN_TAG_WITH_ECHO' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PERCENT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PIPE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PLUS' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PLUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PRINT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PRIVATE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PROTECTED' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_PUBLIC' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_QUESTION_MARK' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_REQUIRE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_REQUIRE_ONCE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_RETURN' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_SEMICOLON' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_STATIC' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_STRING' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_STRING_CAST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_STRING_VARNAME' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_SWITCH' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_Stream' => $vendorDir . '/phpunit/php-token-stream/PHP/Token/Stream.php',
|
||||
'PHP_Token_Stream_CachingFactory' => $vendorDir . '/phpunit/php-token-stream/PHP/Token/Stream/CachingFactory.php',
|
||||
'PHP_Token_THROW' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_TILDE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_TRAIT' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_TRAIT_C' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_TRY' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_UNSET' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_UNSET_CAST' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/PHP/Token.php',
|
||||
'PHP_Token' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ABSTRACT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_AMPERSAND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_AND_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ARRAY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ARRAY_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_AS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_AT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_BACKTICK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_BAD_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_BOOLEAN_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_BOOLEAN_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_BOOL_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_BREAK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CALLABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CARET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CASE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CATCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CHARACTER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CLASS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CLASS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CLASS_NAME_CONSTANT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CLONE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CLOSE_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CLOSE_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CLOSE_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CLOSE_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_COMMA' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CONCAT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CONST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CONSTANT_ENCAPSED_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CONTINUE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_CURLY_OPEN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DEC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DEFAULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DIR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DIV' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DIV_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DOC_COMMENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DOLLAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DOLLAR_OPEN_CURLY_BRACES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DOT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DOUBLE_ARROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DOUBLE_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DOUBLE_COLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_DOUBLE_QUOTES' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ELLIPSIS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ELSE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ELSEIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_EMPTY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ENCAPSED_AND_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ENDDECLARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ENDFOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ENDFOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ENDIF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ENDSWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ENDWHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_END_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_EVAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_EXCLAMATION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_EXIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_EXTENDS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_FILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_FINAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_FINALLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_FOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_FOREACH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_FUNCTION' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_FUNC_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_GLOBAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_GOTO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_GT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_HALT_COMPILER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_IF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_IMPLEMENTS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_INC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_INCLUDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_INCLUDE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_INLINE_HTML' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_INSTANCEOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_INSTEADOF' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_INTERFACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_INT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_ISSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_IS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_IS_GREATER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_IS_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_IS_NOT_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_IS_NOT_IDENTICAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_IS_SMALLER_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_Includes' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_LINE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_LIST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_LNUMBER' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_LOGICAL_AND' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_LOGICAL_OR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_LOGICAL_XOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_LT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_METHOD_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_MINUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_MINUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_MOD_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_MULT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_MUL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_NAMESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_NEW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_NS_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_NS_SEPARATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_NUM_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_OBJECT_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_OBJECT_OPERATOR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_OPEN_BRACKET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_OPEN_CURLY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_OPEN_SQUARE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_OPEN_TAG' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_OPEN_TAG_WITH_ECHO' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_OR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PAAMAYIM_NEKUDOTAYIM' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PERCENT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PIPE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PLUS' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PLUS_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_POW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_POW_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PRINT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PRIVATE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PROTECTED' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_PUBLIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_QUESTION_MARK' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_REQUIRE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_REQUIRE_ONCE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_RETURN' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_SEMICOLON' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_SL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_SL_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_SR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_SR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_START_HEREDOC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_STATIC' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_STRING' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_STRING_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_STRING_VARNAME' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_SWITCH' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_Stream' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream.php',
|
||||
'PHP_Token_Stream_CachingFactory' => $vendorDir . '/phpunit/php-token-stream/src/Token/Stream/CachingFactory.php',
|
||||
'PHP_Token_THROW' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_TILDE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_TRAIT' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_TRAIT_C' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_TRY' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_UNSET' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_UNSET_CAST' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_USE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_VAR' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_VARIABLE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_WHILE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_WHITESPACE' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_XOR_EQUAL' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'PHP_Token_YIELD' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
|
||||
'SebastianBergmann\\Comparator\\ArrayComparator' => $vendorDir . '/sebastian/comparator/src/ArrayComparator.php',
|
||||
'SebastianBergmann\\Comparator\\Comparator' => $vendorDir . '/sebastian/comparator/src/Comparator.php',
|
||||
'SebastianBergmann\\Comparator\\ComparisonFailure' => $vendorDir . '/sebastian/comparator/src/ComparisonFailure.php',
|
||||
|
@ -383,8 +386,12 @@ return array(
|
|||
'SebastianBergmann\\Diff\\Chunk' => $vendorDir . '/sebastian/diff/src/Chunk.php',
|
||||
'SebastianBergmann\\Diff\\Diff' => $vendorDir . '/sebastian/diff/src/Diff.php',
|
||||
'SebastianBergmann\\Diff\\Differ' => $vendorDir . '/sebastian/diff/src/Differ.php',
|
||||
'SebastianBergmann\\Diff\\LCS\\LongestCommonSubsequence' => $vendorDir . '/sebastian/diff/src/LCS/LongestCommonSubsequence.php',
|
||||
'SebastianBergmann\\Diff\\LCS\\MemoryEfficientImplementation' => $vendorDir . '/sebastian/diff/src/LCS/MemoryEfficientLongestCommonSubsequenceImplementation.php',
|
||||
'SebastianBergmann\\Diff\\LCS\\TimeEfficientImplementation' => $vendorDir . '/sebastian/diff/src/LCS/TimeEfficientLongestCommonSubsequenceImplementation.php',
|
||||
'SebastianBergmann\\Diff\\Line' => $vendorDir . '/sebastian/diff/src/Line.php',
|
||||
'SebastianBergmann\\Diff\\Parser' => $vendorDir . '/sebastian/diff/src/Parser.php',
|
||||
'SebastianBergmann\\Environment\\Console' => $vendorDir . '/sebastian/environment/src/Console.php',
|
||||
'SebastianBergmann\\Environment\\Runtime' => $vendorDir . '/sebastian/environment/src/Runtime.php',
|
||||
'SebastianBergmann\\Exporter\\Context' => $vendorDir . '/sebastian/exporter/src/Context.php',
|
||||
'SebastianBergmann\\Exporter\\Exception' => $vendorDir . '/sebastian/exporter/src/Exception.php',
|
||||
|
|
|
@ -7,7 +7,7 @@ $baseDir = dirname(dirname($vendorDir));
|
|||
|
||||
return array(
|
||||
$vendorDir . '/guzzlehttp/streams/src/functions.php',
|
||||
$vendorDir . '/kriswallsmith/assetic/src/functions.php',
|
||||
$vendorDir . '/guzzlehttp/guzzle/src/functions.php',
|
||||
$vendorDir . '/kriswallsmith/assetic/src/functions.php',
|
||||
$baseDir . '/core/lib/Drupal.php',
|
||||
);
|
||||
|
|
|
@ -30,6 +30,7 @@ return array(
|
|||
'Gliph' => array($vendorDir . '/sdboyer/gliph/src'),
|
||||
'Egulias\\' => array($vendorDir . '/egulias/email-validator/src'),
|
||||
'EasyRdf_' => array($vendorDir . '/easyrdf/easyrdf/lib'),
|
||||
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src'),
|
||||
'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'),
|
||||
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
|
||||
'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/lib'),
|
||||
|
|
|
@ -8,10 +8,8 @@ $baseDir = dirname(dirname($vendorDir));
|
|||
return array(
|
||||
$vendorDir . '/phpunit/php-text-template',
|
||||
$vendorDir . '/phpunit/php-timer',
|
||||
$vendorDir . '/phpunit/php-token-stream',
|
||||
$vendorDir . '/phpunit/php-file-iterator',
|
||||
$vendorDir . '/phpunit/php-code-coverage',
|
||||
$vendorDir . '/phpunit/phpunit',
|
||||
$vendorDir . '/symfony/yaml',
|
||||
$vendorDir . '/phpunit/phpunit-mock-objects',
|
||||
);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -184,4 +184,14 @@ class AnnotationException extends \Exception
|
|||
"You have to enable opcache.save_comments=1 or zend_optimizerplus.save_comments=1."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AnnotationException
|
||||
*/
|
||||
public static function optimizerPlusLoadComments()
|
||||
{
|
||||
return new self(
|
||||
"You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,6 +162,15 @@ class AnnotationReader implements Reader
|
|||
throw AnnotationException::optimizerPlusSaveComments();
|
||||
}
|
||||
|
||||
|
||||
if (extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.load_comments') === "0" || ini_get('opcache.load_comments') === "0")) {
|
||||
throw AnnotationException::optimizerPlusLoadComments();
|
||||
}
|
||||
|
||||
if (extension_loaded('Zend OPcache') && ini_get('opcache.load_comments') == 0) {
|
||||
throw AnnotationException::optimizerPlusLoadComments();
|
||||
}
|
||||
|
||||
AnnotationRegistry::registerFile(__DIR__ . '/Annotation/IgnoreAnnotation.php');
|
||||
|
||||
$this->parser = new DocParser;
|
||||
|
|
|
@ -354,6 +354,8 @@ final class DocParser
|
|||
|
||||
$pos++;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -843,16 +845,7 @@ final class DocParser
|
|||
*/
|
||||
private function Values()
|
||||
{
|
||||
$values = array();
|
||||
|
||||
// Handle the case of a single array as value, i.e. @Foo({....})
|
||||
if ($this->lexer->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) {
|
||||
$values['value'] = $this->Value();
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
$values[] = $this->Value();
|
||||
$values = array($this->Value());
|
||||
|
||||
while ($this->lexer->isNextToken(DocLexer::T_COMMA)) {
|
||||
$this->match(DocLexer::T_COMMA);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Doctrine\Tests\Common\Annotations;
|
||||
|
||||
use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
|
||||
use Doctrine\Common\Annotations\DocParser;
|
||||
use Doctrine\Common\Annotations\AnnotationRegistry;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
|
@ -98,6 +97,28 @@ DOCBLOCK;
|
|||
$this->assertNull($annot->value);
|
||||
}
|
||||
|
||||
public function testDefaultValueAnnotations()
|
||||
{
|
||||
$parser = $this->createTestParser();
|
||||
|
||||
// Array as first value
|
||||
$result = $parser->parse('@Name({"key1"="value1"})');
|
||||
$annot = $result[0];
|
||||
|
||||
$this->assertTrue($annot instanceof Name);
|
||||
$this->assertTrue(is_array($annot->value));
|
||||
$this->assertEquals('value1', $annot->value['key1']);
|
||||
|
||||
// Array as first value and additional values
|
||||
$result = $parser->parse('@Name({"key1"="value1"}, foo="bar")');
|
||||
$annot = $result[0];
|
||||
|
||||
$this->assertTrue($annot instanceof Name);
|
||||
$this->assertTrue(is_array($annot->value));
|
||||
$this->assertEquals('value1', $annot->value['key1']);
|
||||
$this->assertEquals('bar', $annot->foo);
|
||||
}
|
||||
|
||||
public function testNamespacedAnnotations()
|
||||
{
|
||||
$parser = new DocParser;
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Doctrine\Tests\Common\Annotations\Fixtures;
|
|||
use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetClass;
|
||||
use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetAll;
|
||||
use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetPropertyMethod;
|
||||
use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationTargetNestedAnnotation;
|
||||
|
||||
/**
|
||||
* @AnnotationTargetClass("Some data")
|
||||
|
@ -38,4 +37,4 @@ class ClassWithValidAnnotationTarget
|
|||
*/
|
||||
public $nested;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,4 +9,4 @@ namespace Doctrine\Tests\Common\Annotations\Fixtures;
|
|||
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Route;
|
||||
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Template;
|
||||
|
||||
class EqualNamespacesPerFileWithClassAsLast {}
|
||||
class EqualNamespacesPerFileWithClassAsLast {}
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
|
||||
namespace Doctrine\Tests\Common\Annotations\Fixtures;
|
||||
|
||||
use ReflectionClass, ReflectionProperty, ReflectionMethod;
|
||||
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Secure;
|
||||
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Route;
|
||||
|
||||
class NamespacedSingleClassLOC1000
|
||||
{
|
||||
const TEST1 = 1234567890;
|
||||
|
@ -1006,4 +1002,4 @@ class NamespacedSingleClassLOC1000
|
|||
|
||||
return $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
|
||||
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Secure;
|
||||
use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Route;
|
||||
|
||||
class SingleClassLOC1000
|
||||
{
|
||||
const TEST1 = 1234567890;
|
||||
|
@ -1003,4 +1000,4 @@ class SingleClassLOC1000
|
|||
|
||||
return $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
/*
|
||||
* This file bootstraps the test environment.
|
||||
*/
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
// register silently failing autoloader
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# for php-coveralls
|
||||
service_name: travis-ci
|
||||
src_dir: lib
|
||||
coverage_clover: build/logs/clover.xml
|
|
@ -0,0 +1,4 @@
|
|||
vendor/
|
||||
build/
|
||||
phpunit.xml
|
||||
composer.lock
|
|
@ -3,6 +3,29 @@ language: php
|
|||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
|
||||
services:
|
||||
- riak
|
||||
- mongodb
|
||||
- memcached
|
||||
- redis-server
|
||||
|
||||
before_script:
|
||||
- sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ]; then pecl install riak-beta; fi"
|
||||
- sh -c "if [[ $TRAVIS_PHP_VERSION != 'hhvm' && `php-config --vernum` -ge 50500 ]] ; then pecl config-set preferred_state beta; printf "yes\n" | pecl install apcu ; else echo 'extension="apc.so"' >> ./tests/travis/php.ini ;fi"
|
||||
- composer self-update
|
||||
- composer --prefer-source --dev install
|
||||
- sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ]; then phpenv config-add ./tests/travis/php.ini; fi"
|
||||
|
||||
script:
|
||||
- ./vendor/bin/phpunit -c ./tests/travis/phpunit.travis.xml -v
|
||||
|
||||
after_script:
|
||||
- php vendor/bin/coveralls -v
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
# Doctrine Cache
|
||||
|
||||
Master: [](http://travis-ci.org/doctrine/cache) [](https://coveralls.io/r/doctrine/cache?branch=master)
|
||||
|
||||
[](https://packagist.org/packages/doctrine/cache) [](https://packagist.org/packages/doctrine/cache)
|
||||
|
||||
Cache component extracted from the Doctrine Common project.
|
||||
|
||||
## Changelog
|
||||
|
||||
### v1.2
|
||||
|
||||
* Added support for MongoDB as Cache Provider
|
||||
* Fix namespace version reset
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Version class and file
|
||||
project.version_class = Doctrine\\Common\\Cache\\Version
|
||||
project.version_file = lib/Doctrine/Common/Cache/Version.php
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0"?>
|
||||
<project name="DoctrineCommonCache" default="build" basedir=".">
|
||||
<property file="build.properties" />
|
||||
|
||||
<target name="php">
|
||||
<exec executable="which" outputproperty="php_executable">
|
||||
<arg value="php" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="prepare">
|
||||
<mkdir dir="build" />
|
||||
</target>
|
||||
|
||||
<target name="build" depends="check-git-checkout-clean,prepare,php,composer">
|
||||
<exec executable="${php_executable}">
|
||||
<arg value="build/composer.phar" />
|
||||
<arg value="archive" />
|
||||
<arg value="--dir=build" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="composer" depends="php,composer-check,composer-download">
|
||||
<exec executable="${php_executable}">
|
||||
<arg value="build/composer.phar" />
|
||||
<arg value="install" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="composer-check" depends="prepare">
|
||||
<available file="build/composer.phar" property="composer.present"/>
|
||||
</target>
|
||||
|
||||
<target name="composer-download" unless="composer.present">
|
||||
<exec executable="wget">
|
||||
<arg value="-Obuild/composer.phar" />
|
||||
<arg value="http://getcomposer.org/composer.phar" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="make-release" depends="check-git-checkout-clean,prepare,php">
|
||||
<replace file="${project.version_file}" token="-DEV" value="" failOnNoReplacements="true" />
|
||||
<exec executable="git" failonerror="true" outputproperty="current_git_branch">
|
||||
<arg value="rev-parse" />
|
||||
<arg value="--abbrev-ref" />
|
||||
<arg value="HEAD" />
|
||||
</exec>
|
||||
<exec executable="${php_executable}" outputproperty="doctrine.current_version" failonerror="true">
|
||||
<arg value="-r" />
|
||||
<arg value="require_once '${project.version_file}';echo ${project.version_class}::VERSION;" />
|
||||
</exec>
|
||||
<exec executable="${php_executable}" outputproperty="doctrine.next_version" failonerror="true">
|
||||
<arg value="-r" />
|
||||
<arg value="$parts = explode('.', str_ireplace(array('-DEV', '-ALPHA', '-BETA'), '', '${doctrine.current_version}'));
|
||||
if (count($parts) != 3) {
|
||||
throw new \InvalidArgumentException('Version is assumed in format x.y.z, ${doctrine.current_version} given');
|
||||
}
|
||||
if ('${current_git_branch}' === 'master') {
|
||||
$parts[1]++;
|
||||
} else {
|
||||
$parts[2]++;
|
||||
}
|
||||
echo implode('.', $parts);
|
||||
" />
|
||||
</exec>
|
||||
|
||||
<git-commit file="${project.version_file}" message="Release ${doctrine.current_version}" />
|
||||
<git-tag version="${doctrine.current_version}" />
|
||||
<replace file="${project.version_file}" token="${doctrine.current_version}" value="${doctrine.next_version}-DEV" />
|
||||
<git-commit file="${project.version_file}" message="Bump version to ${doctrine.next_version}" />
|
||||
</target>
|
||||
|
||||
<target name="check-git-checkout-clean">
|
||||
<exec executable="git" failonerror="true">
|
||||
<arg value="diff-index" />
|
||||
<arg value="--quiet" />
|
||||
<arg value="HEAD" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<macrodef name="git-commit">
|
||||
<attribute name="file" default="NOT SET"/>
|
||||
<attribute name="message" default="NOT SET"/>
|
||||
|
||||
<sequential>
|
||||
<exec executable="git">
|
||||
<arg value="add" />
|
||||
<arg value="@{file}" />
|
||||
</exec>
|
||||
<exec executable="git">
|
||||
<arg value="commit" />
|
||||
<arg value="-m" />
|
||||
<arg value="@{message}" />
|
||||
</exec>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="git-tag">
|
||||
<attribute name="version" default="NOT SET" />
|
||||
|
||||
<sequential>
|
||||
<exec executable="git">
|
||||
<arg value="tag" />
|
||||
<arg value="-m" />
|
||||
<arg value="v@{version}" />
|
||||
<arg value="v@{version}" />
|
||||
</exec>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</project>
|
|
@ -15,7 +15,19 @@
|
|||
"require": {
|
||||
"php": ">=5.3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": ">=3.7",
|
||||
"satooshi/php-coveralls": "~0.6"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/common": ">2.2,<2.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Doctrine\\Common\\Cache\\": "lib/" }
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -23,14 +22,13 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* APC cache provider.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class ApcCache extends CacheProvider
|
||||
{
|
||||
|
@ -82,12 +80,19 @@ class ApcCache extends CacheProvider
|
|||
$info = apc_cache_info();
|
||||
$sma = apc_sma_info();
|
||||
|
||||
// @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42
|
||||
if (PHP_VERSION_ID >= 50500) {
|
||||
$info['num_hits'] = isset($info['num_hits']) ? $info['num_hits'] : $info['nhits'];
|
||||
$info['num_misses'] = isset($info['num_misses']) ? $info['num_misses'] : $info['nmisses'];
|
||||
$info['start_time'] = isset($info['start_time']) ? $info['start_time'] : $info['stime'];
|
||||
}
|
||||
|
||||
return array(
|
||||
Cache::STATS_HITS => $info['num_hits'],
|
||||
Cache::STATS_MISSES => $info['num_misses'],
|
||||
Cache::STATS_UPTIME => $info['start_time'],
|
||||
Cache::STATS_MEMORY_USAGE => $info['mem_size'],
|
||||
Cache::STATS_MEMORY_AVAILIABLE => $sma['avail_mem'],
|
||||
Cache::STATS_HITS => $info['num_hits'],
|
||||
Cache::STATS_MISSES => $info['num_misses'],
|
||||
Cache::STATS_UPTIME => $info['start_time'],
|
||||
Cache::STATS_MEMORY_USAGE => $info['mem_size'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $sma['avail_mem'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* 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
|
||||
|
@ -24,14 +22,13 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* Array cache driver.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class ArrayCache extends CacheProvider
|
||||
{
|
||||
|
@ -45,7 +42,7 @@ class ArrayCache extends CacheProvider
|
|||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
return (isset($this->data[$id])) ? $this->data[$id] : false;
|
||||
return $this->doContains($id) ? $this->data[$id] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +50,7 @@ class ArrayCache extends CacheProvider
|
|||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
return isset($this->data[$id]);
|
||||
return isset($this->data[$id]) || array_key_exists($id, $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* 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
|
||||
|
@ -24,35 +22,42 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* Interface for cache drivers.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
interface Cache
|
||||
{
|
||||
const STATS_HITS = 'hits';
|
||||
const STATS_MISSES = 'misses';
|
||||
const STATS_UPTIME = 'uptime';
|
||||
const STATS_MEMORY_USAGE = 'memory_usage';
|
||||
const STATS_MEMORY_AVAILIABLE = 'memory_available';
|
||||
const STATS_HITS = 'hits';
|
||||
const STATS_MISSES = 'misses';
|
||||
const STATS_UPTIME = 'uptime';
|
||||
const STATS_MEMORY_USAGE = 'memory_usage';
|
||||
const STATS_MEMORY_AVAILABLE = 'memory_available';
|
||||
/**
|
||||
* Only for backward compatibility (may be removed in next major release)
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
const STATS_MEMORY_AVAILIABLE = 'memory_available';
|
||||
|
||||
/**
|
||||
* Fetches an entry from the cache.
|
||||
*
|
||||
* @param string $id cache id The id of the cache entry to fetch.
|
||||
* @param string $id The id of the cache entry to fetch.
|
||||
*
|
||||
* @return mixed The cached data or FALSE, if no cache entry exists for the given id.
|
||||
*/
|
||||
function fetch($id);
|
||||
|
||||
/**
|
||||
* Test if an entry exists in the cache.
|
||||
* Tests if an entry exists in the cache.
|
||||
*
|
||||
* @param string $id The cache id of the entry to check for.
|
||||
*
|
||||
* @param string $id cache id The cache id of the entry to check for.
|
||||
* @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.
|
||||
*/
|
||||
function contains($id);
|
||||
|
@ -60,9 +65,11 @@ interface Cache
|
|||
/**
|
||||
* Puts data into the cache.
|
||||
*
|
||||
* @param string $id The cache id.
|
||||
* @param mixed $data The cache entry/data.
|
||||
* @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).
|
||||
* @param string $id The cache id.
|
||||
* @param mixed $data The cache entry/data.
|
||||
* @param int $lifeTime The cache lifetime.
|
||||
* If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).
|
||||
*
|
||||
* @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.
|
||||
*/
|
||||
function save($id, $data, $lifeTime = 0);
|
||||
|
@ -70,13 +77,14 @@ interface Cache
|
|||
/**
|
||||
* Deletes a cache entry.
|
||||
*
|
||||
* @param string $id cache id
|
||||
* @param string $id The cache id.
|
||||
*
|
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
|
||||
*/
|
||||
function delete($id);
|
||||
|
||||
/**
|
||||
* Retrieves cached information from data store
|
||||
* Retrieves cached information from the data store.
|
||||
*
|
||||
* The server's statistics array has the following values:
|
||||
*
|
||||
|
@ -95,8 +103,9 @@ interface Cache
|
|||
* - <b>memory_available</b>
|
||||
* Memory allowed to use for storage.
|
||||
*
|
||||
* @since 2.2
|
||||
* @return array Associative array with server's statistics if available, NULL otherwise.
|
||||
* @since 2.2
|
||||
*
|
||||
* @return array|null An associative array with server's statistics if available, NULL otherwise.
|
||||
*/
|
||||
function getStats();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -23,40 +22,46 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* Base class for cache provider implementations.
|
||||
*
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
abstract class CacheProvider implements Cache
|
||||
{
|
||||
const DOCTRINE_NAMESPACE_CACHEKEY = 'DoctrineNamespaceCacheKey[%s]';
|
||||
|
||||
/**
|
||||
* @var string The namespace to prefix all cache ids with
|
||||
* The namespace to prefix all cache ids with.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $namespace = '';
|
||||
|
||||
/**
|
||||
* @var string The namespace version
|
||||
* The namespace version.
|
||||
*
|
||||
* @var integer|null
|
||||
*/
|
||||
private $namespaceVersion;
|
||||
|
||||
/**
|
||||
* Set the namespace to prefix all cache ids with.
|
||||
* Sets the namespace to prefix all cache ids with.
|
||||
*
|
||||
* @param string $namespace
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNamespace($namespace)
|
||||
{
|
||||
$this->namespace = (string) $namespace;
|
||||
$this->namespace = (string) $namespace;
|
||||
$this->namespaceVersion = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the namespace that prefixes all cache ids.
|
||||
* Retrieves the namespace that prefixes all cache ids.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -106,7 +111,7 @@ abstract class CacheProvider implements Cache
|
|||
}
|
||||
|
||||
/**
|
||||
* Deletes all cache entries.
|
||||
* Flushes all cache entries.
|
||||
*
|
||||
* @return boolean TRUE if the cache entries were successfully flushed, FALSE otherwise.
|
||||
*/
|
||||
|
@ -116,7 +121,7 @@ abstract class CacheProvider implements Cache
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete all cache entries.
|
||||
* Deletes all cache entries.
|
||||
*
|
||||
* @return boolean TRUE if the cache entries were successfully deleted, FALSE otherwise.
|
||||
*/
|
||||
|
@ -131,10 +136,11 @@ abstract class CacheProvider implements Cache
|
|||
}
|
||||
|
||||
/**
|
||||
* Prefix the passed id with the configured namespace value
|
||||
* Prefixes the passed id with the configured namespace value.
|
||||
*
|
||||
* @param string $id The id to namespace
|
||||
* @return string $id The namespaced id
|
||||
* @param string $id The id to namespace.
|
||||
*
|
||||
* @return string The namespaced id.
|
||||
*/
|
||||
private function getNamespacedId($id)
|
||||
{
|
||||
|
@ -144,9 +150,9 @@ abstract class CacheProvider implements Cache
|
|||
}
|
||||
|
||||
/**
|
||||
* Namespace cache key
|
||||
* Returns the namespace cache key.
|
||||
*
|
||||
* @return string $namespaceCacheKey
|
||||
* @return string
|
||||
*/
|
||||
private function getNamespaceCacheKey()
|
||||
{
|
||||
|
@ -154,9 +160,9 @@ abstract class CacheProvider implements Cache
|
|||
}
|
||||
|
||||
/**
|
||||
* Namespace version
|
||||
* Returns the namespace version.
|
||||
*
|
||||
* @return string $namespaceVersion
|
||||
* @return integer
|
||||
*/
|
||||
private function getNamespaceVersion()
|
||||
{
|
||||
|
@ -181,15 +187,17 @@ abstract class CacheProvider implements Cache
|
|||
/**
|
||||
* Fetches an entry from the cache.
|
||||
*
|
||||
* @param string $id cache id The id of the cache entry to fetch.
|
||||
* @return string The cached data or FALSE, if no cache entry exists for the given id.
|
||||
* @param string $id The id of the cache entry to fetch.
|
||||
*
|
||||
* @return string|boolean The cached data or FALSE, if no cache entry exists for the given id.
|
||||
*/
|
||||
abstract protected function doFetch($id);
|
||||
|
||||
/**
|
||||
* Test if an entry exists in the cache.
|
||||
* Tests if an entry exists in the cache.
|
||||
*
|
||||
* @param string $id The cache id of the entry to check for.
|
||||
*
|
||||
* @param string $id cache id The cache id of the entry to check for.
|
||||
* @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.
|
||||
*/
|
||||
abstract protected function doContains($id);
|
||||
|
@ -197,35 +205,37 @@ abstract class CacheProvider implements Cache
|
|||
/**
|
||||
* Puts data into the cache.
|
||||
*
|
||||
* @param string $id The cache id.
|
||||
* @param string $data The cache entry/data.
|
||||
* @param bool|int $lifeTime The lifetime. If != false, sets a specific lifetime for this
|
||||
* cache entry (null => infinite lifeTime).
|
||||
* @param string $id The cache id.
|
||||
* @param string $data The cache entry/data.
|
||||
* @param int $lifeTime The lifetime. If != 0, sets a specific lifetime for this
|
||||
* cache entry (0 => infinite lifeTime).
|
||||
*
|
||||
* @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.
|
||||
*/
|
||||
abstract protected function doSave($id, $data, $lifeTime = false);
|
||||
abstract protected function doSave($id, $data, $lifeTime = 0);
|
||||
|
||||
/**
|
||||
* Deletes a cache entry.
|
||||
*
|
||||
* @param string $id cache id
|
||||
* @param string $id The cache id.
|
||||
*
|
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
|
||||
*/
|
||||
abstract protected function doDelete($id);
|
||||
|
||||
/**
|
||||
* Deletes all cache entries.
|
||||
* Flushes all cache entries.
|
||||
*
|
||||
* @return boolean TRUE if the cache entry was successfully deleted, FALSE otherwise.
|
||||
*/
|
||||
abstract protected function doFlush();
|
||||
|
||||
/**
|
||||
* Retrieves cached information from data store
|
||||
/**
|
||||
* Retrieves cached information from the data store.
|
||||
*
|
||||
* @since 2.2
|
||||
* @return array An associative array with server's statistics if available, NULL otherwise.
|
||||
* @since 2.2
|
||||
*
|
||||
* @return array|null An associative array with server's statistics if available, NULL otherwise.
|
||||
*/
|
||||
abstract protected function doGetStats();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -25,16 +24,14 @@ use \Couchbase;
|
|||
/**
|
||||
* Couchbase cache provider.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.4
|
||||
* @author Michael Nitschinger <michael@nitschinger.at>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.4
|
||||
* @author Michael Nitschinger <michael@nitschinger.at>
|
||||
*/
|
||||
class CouchbaseCache extends CacheProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Couchbase
|
||||
* @var Couchbase|null
|
||||
*/
|
||||
private $couchbase;
|
||||
|
||||
|
@ -42,6 +39,8 @@ class CouchbaseCache extends CacheProvider
|
|||
* Sets the Couchbase instance to use.
|
||||
*
|
||||
* @param Couchbase $couchbase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCouchbase(Couchbase $couchbase)
|
||||
{
|
||||
|
@ -51,7 +50,7 @@ class CouchbaseCache extends CacheProvider
|
|||
/**
|
||||
* Gets the Couchbase instance used by the cache.
|
||||
*
|
||||
* @return Couchbase
|
||||
* @return Couchbase|null
|
||||
*/
|
||||
public function getCouchbase()
|
||||
{
|
||||
|
@ -115,9 +114,8 @@ class CouchbaseCache extends CacheProvider
|
|||
Cache::STATS_HITS => $stats['get_hits'],
|
||||
Cache::STATS_MISSES => $stats['get_misses'],
|
||||
Cache::STATS_UPTIME => $stats['uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -23,26 +22,30 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* Base file cache driver.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
abstract class FileCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var string Cache directory.
|
||||
* The cache directory.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $directory;
|
||||
|
||||
/**
|
||||
* @var string Cache file extension.
|
||||
* The cache file extension.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $extension;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $directory Cache directory.
|
||||
* @param string $directory Cache file extension.
|
||||
* @param string $directory The cache directory.
|
||||
* @param string|null $extension The cache file extension.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
|
@ -68,7 +71,7 @@ abstract class FileCache extends CacheProvider
|
|||
|
||||
/**
|
||||
* Gets the cache directory.
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDirectory()
|
||||
|
@ -78,8 +81,8 @@ abstract class FileCache extends CacheProvider
|
|||
|
||||
/**
|
||||
* Gets the cache file extension.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getExtension()
|
||||
{
|
||||
|
@ -87,12 +90,16 @@ abstract class FileCache extends CacheProvider
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getFilename($id)
|
||||
{
|
||||
$path = implode(str_split(md5($id), 12), DIRECTORY_SEPARATOR);
|
||||
$hash = hash('sha256', $id);
|
||||
$path = implode(str_split($hash, 16), DIRECTORY_SEPARATOR);
|
||||
$path = $this->directory . DIRECTORY_SEPARATOR . $path;
|
||||
$id = preg_replace('@[\\\/:"*?<>|]+@', '', $id);
|
||||
|
||||
return $path . DIRECTORY_SEPARATOR . $id . $this->extension;
|
||||
}
|
||||
|
@ -110,12 +117,7 @@ abstract class FileCache extends CacheProvider
|
|||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
$pattern = '/^.+\\' . $this->extension . '$/i';
|
||||
$iterator = new \RecursiveDirectoryIterator($this->directory);
|
||||
$iterator = new \RecursiveIteratorIterator($iterator);
|
||||
$iterator = new \RegexIterator($iterator, $pattern);
|
||||
|
||||
foreach ($iterator as $name => $file) {
|
||||
foreach ($this->getIterator() as $name => $file) {
|
||||
@unlink($name);
|
||||
}
|
||||
|
||||
|
@ -127,6 +129,30 @@ abstract class FileCache extends CacheProvider
|
|||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
return null;
|
||||
$usage = 0;
|
||||
foreach ($this->getIterator() as $file) {
|
||||
$usage += $file->getSize();
|
||||
}
|
||||
|
||||
$free = disk_free_space($this->directory);
|
||||
|
||||
return array(
|
||||
Cache::STATS_HITS => null,
|
||||
Cache::STATS_MISSES => null,
|
||||
Cache::STATS_UPTIME => null,
|
||||
Cache::STATS_MEMORY_USAGE => $usage,
|
||||
Cache::STATS_MEMORY_AVAILABLE => $free,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Iterator
|
||||
*/
|
||||
private function getIterator()
|
||||
{
|
||||
$pattern = '/^.+\\' . $this->extension . '$/i';
|
||||
$iterator = new \RecursiveDirectoryIterator($this->directory);
|
||||
$iterator = new \RecursiveIteratorIterator($iterator);
|
||||
return new \RegexIterator($iterator, $pattern);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -23,8 +22,8 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* Filesystem cache driver.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class FilesystemCache extends FileCache
|
||||
{
|
||||
|
@ -106,9 +105,21 @@ class FilesystemCache extends FileCache
|
|||
$filepath = pathinfo($filename, PATHINFO_DIRNAME);
|
||||
|
||||
if ( ! is_dir($filepath)) {
|
||||
mkdir($filepath, 0777, true);
|
||||
if (false === @mkdir($filepath, 0777, true) && !is_dir($filepath)) {
|
||||
return false;
|
||||
}
|
||||
} elseif ( ! is_writable($filepath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return file_put_contents($filename, $lifeTime . PHP_EOL . $data);
|
||||
$tmpFile = tempnam($filepath, basename($filename));
|
||||
|
||||
if ((file_put_contents($tmpFile, $lifeTime . PHP_EOL . $data) !== false) && @rename($tmpFile, $filename)) {
|
||||
@chmod($filename, 0666 & ~umask());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -25,19 +24,18 @@ use \Memcache;
|
|||
/**
|
||||
* Memcache cache provider.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class MemcacheCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var Memcache
|
||||
* @var Memcache|null
|
||||
*/
|
||||
private $memcache;
|
||||
|
||||
|
@ -45,6 +43,8 @@ class MemcacheCache extends CacheProvider
|
|||
* Sets the memcache instance to use.
|
||||
*
|
||||
* @param Memcache $memcache
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMemcache(Memcache $memcache)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ class MemcacheCache extends CacheProvider
|
|||
/**
|
||||
* Gets the memcache instance used by the cache.
|
||||
*
|
||||
* @return Memcache
|
||||
* @return Memcache|null
|
||||
*/
|
||||
public function getMemcache()
|
||||
{
|
||||
|
@ -114,8 +114,8 @@ class MemcacheCache extends CacheProvider
|
|||
Cache::STATS_HITS => $stats['get_hits'],
|
||||
Cache::STATS_MISSES => $stats['get_misses'],
|
||||
Cache::STATS_UPTIME => $stats['uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -25,19 +24,18 @@ use \Memcached;
|
|||
/**
|
||||
* Memcached cache provider.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class MemcachedCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var Memcached
|
||||
* @var Memcached|null
|
||||
*/
|
||||
private $memcached;
|
||||
|
||||
|
@ -45,6 +43,8 @@ class MemcachedCache extends CacheProvider
|
|||
* Sets the memcache instance to use.
|
||||
*
|
||||
* @param Memcached $memcached
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMemcached(Memcached $memcached)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ class MemcachedCache extends CacheProvider
|
|||
/**
|
||||
* Gets the memcached instance used by the cache.
|
||||
*
|
||||
* @return Memcached
|
||||
* @return Memcached|null
|
||||
*/
|
||||
public function getMemcached()
|
||||
{
|
||||
|
@ -117,8 +117,8 @@ class MemcachedCache extends CacheProvider
|
|||
Cache::STATS_HITS => $stats['get_hits'],
|
||||
Cache::STATS_MISSES => $stats['get_misses'],
|
||||
Cache::STATS_UPTIME => $stats['uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'],
|
||||
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
use MongoBinData;
|
||||
use MongoCollection;
|
||||
use MongoDate;
|
||||
|
||||
/**
|
||||
* MongoDB cache provider.
|
||||
*
|
||||
* @since 1.1
|
||||
* @author Jeremy Mikola <jmikola@gmail.com>
|
||||
*/
|
||||
class MongoDBCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* The data field will store the serialized PHP value.
|
||||
*/
|
||||
const DATA_FIELD = 'd';
|
||||
|
||||
/**
|
||||
* The expiration field will store a MongoDate value indicating when the
|
||||
* cache entry should expire.
|
||||
*
|
||||
* With MongoDB 2.2+, entries can be automatically deleted by MongoDB by
|
||||
* indexing this field wit the "expireAfterSeconds" option equal to zero.
|
||||
* This will direct MongoDB to regularly query for and delete any entries
|
||||
* whose date is older than the current time. Entries without a date value
|
||||
* in this field will be ignored.
|
||||
*
|
||||
* The cache provider will also check dates on its own, in case expired
|
||||
* entries are fetched before MongoDB's TTLMonitor pass can expire them.
|
||||
*
|
||||
* @see http://docs.mongodb.org/manual/tutorial/expire-data/
|
||||
*/
|
||||
const EXPIRATION_FIELD = 'e';
|
||||
|
||||
/**
|
||||
* @var MongoCollection
|
||||
*/
|
||||
private $collection;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* This provider will default to the write concern and read preference
|
||||
* options set on the MongoCollection instance (or inherited from MongoDB or
|
||||
* MongoClient). Using an unacknowledged write concern (< 1) may make the
|
||||
* return values of delete() and save() unreliable. Reading from secondaries
|
||||
* may make contain() and fetch() unreliable.
|
||||
*
|
||||
* @see http://www.php.net/manual/en/mongo.readpreferences.php
|
||||
* @see http://www.php.net/manual/en/mongo.writeconcerns.php
|
||||
* @param MongoCollection $collection
|
||||
*/
|
||||
public function __construct(MongoCollection $collection)
|
||||
{
|
||||
$this->collection = $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
$document = $this->collection->findOne(array('_id' => $id), array(self::DATA_FIELD, self::EXPIRATION_FIELD));
|
||||
|
||||
if ($document === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isExpired($document)) {
|
||||
$this->doDelete($id);
|
||||
return false;
|
||||
}
|
||||
|
||||
return unserialize($document[self::DATA_FIELD]->bin);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
$document = $this->collection->findOne(array('_id' => $id), array(self::EXPIRATION_FIELD));
|
||||
|
||||
if ($document === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->isExpired($document)) {
|
||||
$this->doDelete($id);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
$result = $this->collection->update(
|
||||
array('_id' => $id),
|
||||
array('$set' => array(
|
||||
self::EXPIRATION_FIELD => ($lifeTime > 0 ? new MongoDate(time() + $lifeTime) : null),
|
||||
self::DATA_FIELD => new MongoBinData(serialize($data), MongoBinData::BYTE_ARRAY),
|
||||
)),
|
||||
array('upsert' => true, 'multiple' => false)
|
||||
);
|
||||
|
||||
return isset($result['ok']) ? $result['ok'] == 1 : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
$result = $this->collection->remove(array('_id' => $id));
|
||||
|
||||
return isset($result['n']) ? $result['n'] == 1 : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
// Use remove() in lieu of drop() to maintain any collection indexes
|
||||
$result = $this->collection->remove();
|
||||
|
||||
return isset($result['ok']) ? $result['ok'] == 1 : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
$serverStatus = $this->collection->db->command(array(
|
||||
'serverStatus' => 1,
|
||||
'locks' => 0,
|
||||
'metrics' => 0,
|
||||
'recordStats' => 0,
|
||||
'repl' => 0,
|
||||
));
|
||||
|
||||
$collStats = $this->collection->db->command(array('collStats' => 1));
|
||||
|
||||
return array(
|
||||
Cache::STATS_HITS => null,
|
||||
Cache::STATS_MISSES => null,
|
||||
Cache::STATS_UPTIME => (isset($serverStatus['uptime']) ? (integer) $serverStatus['uptime'] : null),
|
||||
Cache::STATS_MEMORY_USAGE => (isset($collStats['size']) ? (integer) $collStats['size'] : null),
|
||||
Cache::STATS_MEMORY_AVAILABLE => null,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the document is expired.
|
||||
*
|
||||
* @param array $document
|
||||
* @return boolean
|
||||
*/
|
||||
private function isExpired(array $document)
|
||||
{
|
||||
return isset($document[self::EXPIRATION_FIELD]) &&
|
||||
$document[self::EXPIRATION_FIELD] instanceof MongoDate &&
|
||||
$document[self::EXPIRATION_FIELD]->sec < time();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -23,8 +22,8 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* Php file cache driver.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
* @since 2.3
|
||||
* @author Fabio B. Silva <fabio.bat.silva@gmail.com>
|
||||
*/
|
||||
class PhpFileCache extends FileCache
|
||||
{
|
||||
|
@ -103,6 +102,6 @@ class PhpFileCache extends FileCache
|
|||
$value = var_export($value, true);
|
||||
$code = sprintf('<?php return %s;', $value);
|
||||
|
||||
return file_put_contents($filename, $code);
|
||||
return file_put_contents($filename, $code) !== false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -25,15 +24,14 @@ use Redis;
|
|||
/**
|
||||
* Redis cache provider.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Osman Ungur <osmanungur@gmail.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Osman Ungur <osmanungur@gmail.com>
|
||||
*/
|
||||
class RedisCache extends CacheProvider
|
||||
{
|
||||
/**
|
||||
* @var Redis
|
||||
* @var Redis|null
|
||||
*/
|
||||
private $redis;
|
||||
|
||||
|
@ -41,17 +39,19 @@ class RedisCache extends CacheProvider
|
|||
* Sets the redis instance to use.
|
||||
*
|
||||
* @param Redis $redis
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRedis(Redis $redis)
|
||||
{
|
||||
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);
|
||||
$redis->setOption(Redis::OPT_SERIALIZER, $this->getSerializerValue());
|
||||
$this->redis = $redis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the redis instance used by the cache.
|
||||
*
|
||||
* @return Redis
|
||||
* @return Redis|null
|
||||
*/
|
||||
public function getRedis()
|
||||
{
|
||||
|
@ -79,11 +79,11 @@ class RedisCache extends CacheProvider
|
|||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
$result = $this->redis->set($id, $data);
|
||||
if ($lifeTime > 0) {
|
||||
$this->redis->expire($id, $lifeTime);
|
||||
return $this->redis->setex($id, $lifeTime, $data);
|
||||
}
|
||||
return $result;
|
||||
|
||||
return $this->redis->set($id, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ class RedisCache extends CacheProvider
|
|||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
return $this->redis->delete($id);
|
||||
return $this->redis->delete($id) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,8 +112,20 @@ class RedisCache extends CacheProvider
|
|||
Cache::STATS_HITS => false,
|
||||
Cache::STATS_MISSES => false,
|
||||
Cache::STATS_UPTIME => $info['uptime_in_seconds'],
|
||||
Cache::STATS_MEMORY_USAGE => $info['used_memory'],
|
||||
Cache::STATS_MEMORY_AVAILIABLE => false
|
||||
Cache::STATS_MEMORY_USAGE => $info['used_memory'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the serializer constant to use. If Redis is compiled with
|
||||
* igbinary support, that is used. Otherwise the default PHP serializer is
|
||||
* used.
|
||||
*
|
||||
* @return integer One of the Redis::SERIALIZER_* constants
|
||||
*/
|
||||
protected function getSerializerValue()
|
||||
{
|
||||
return defined('Redis::SERIALIZER_IGBINARY') ? Redis::SERIALIZER_IGBINARY : Redis::SERIALIZER_PHP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,250 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
use Riak\Bucket;
|
||||
use Riak\Connection;
|
||||
use Riak\Input;
|
||||
use Riak\Exception;
|
||||
use Riak\Object;
|
||||
|
||||
/**
|
||||
* Riak cache provider.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 1.1
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
*/
|
||||
class RiakCache extends CacheProvider
|
||||
{
|
||||
const EXPIRES_HEADER = 'X-Riak-Meta-Expires';
|
||||
|
||||
/**
|
||||
* @var \Riak\Bucket
|
||||
*/
|
||||
private $bucket;
|
||||
|
||||
/**
|
||||
* Sets the riak bucket instance to use.
|
||||
*
|
||||
* @param \Riak\Bucket $bucket
|
||||
*/
|
||||
public function __construct(Bucket $bucket)
|
||||
{
|
||||
$this->bucket = $bucket;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFetch($id)
|
||||
{
|
||||
try {
|
||||
$response = $this->bucket->get($id);
|
||||
|
||||
// No objects found
|
||||
if ( ! $response->hasObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for attempted siblings
|
||||
$object = ($response->hasSiblings())
|
||||
? $this->resolveConflict($id, $response->getVClock(), $response->getObjectList())
|
||||
: $response->getFirstObject();
|
||||
|
||||
// Check for expired object
|
||||
if ($this->isExpired($object)) {
|
||||
$this->bucket->delete($object);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return unserialize($object->getContent());
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Covers:
|
||||
// - Riak\ConnectionException
|
||||
// - Riak\CommunicationException
|
||||
// - Riak\UnexpectedResponseException
|
||||
// - Riak\NotFoundException
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doContains($id)
|
||||
{
|
||||
try {
|
||||
// We only need the HEAD, not the entire object
|
||||
$input = new Input\GetInput();
|
||||
|
||||
$input->setReturnHead(true);
|
||||
|
||||
$response = $this->bucket->get($id, $input);
|
||||
|
||||
// No objects found
|
||||
if ( ! $response->hasObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$object = $response->getFirstObject();
|
||||
|
||||
// Check for expired object
|
||||
if ($this->isExpired($object)) {
|
||||
$this->bucket->delete($object);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doSave($id, $data, $lifeTime = 0)
|
||||
{
|
||||
try {
|
||||
$object = new Object($id);
|
||||
|
||||
$object->setContent(serialize($data));
|
||||
|
||||
if ($lifeTime > 0) {
|
||||
$object->addMetadata(self::EXPIRES_HEADER, (string) (time() + $lifeTime));
|
||||
}
|
||||
|
||||
$this->bucket->put($object);
|
||||
|
||||
return true;
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDelete($id)
|
||||
{
|
||||
try {
|
||||
$this->bucket->delete($id);
|
||||
|
||||
return true;
|
||||
} catch (Exception\BadArgumentsException $e) {
|
||||
// Key did not exist on cluster already
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Covers:
|
||||
// - Riak\Exception\ConnectionException
|
||||
// - Riak\Exception\CommunicationException
|
||||
// - Riak\Exception\UnexpectedResponseException
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doFlush()
|
||||
{
|
||||
try {
|
||||
$keyList = $this->bucket->getKeyList();
|
||||
|
||||
foreach ($keyList as $key) {
|
||||
$this->bucket->delete($key);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception\RiakException $e) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doGetStats()
|
||||
{
|
||||
// Only exposed through HTTP stats API, not Protocol Buffers API
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given Riak Object have expired.
|
||||
*
|
||||
* @param \Riak\Object $object
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function isExpired(Object $object)
|
||||
{
|
||||
$metadataMap = $object->getMetadataMap();
|
||||
|
||||
return isset($metadataMap[self::EXPIRES_HEADER])
|
||||
&& $metadataMap[self::EXPIRES_HEADER] < time();
|
||||
}
|
||||
|
||||
/**
|
||||
* On-read conflict resolution. Applied approach here is last write wins.
|
||||
* Specific needs may override this method to apply alternate conflict resolutions.
|
||||
*
|
||||
* {@internal Riak does not attempt to resolve a write conflict, and store
|
||||
* it as sibling of conflicted one. By following this approach, it is up to
|
||||
* the next read to resolve the conflict. When this happens, your fetched
|
||||
* object will have a list of siblings (read as a list of objects).
|
||||
* In our specific case, we do not care about the intermediate ones since
|
||||
* they are all the same read from storage, and we do apply a last sibling
|
||||
* (last write) wins logic.
|
||||
* If by any means our resolution generates another conflict, it'll up to
|
||||
* next read to properly solve it.}
|
||||
*
|
||||
* @param string $id
|
||||
* @param string $vClock
|
||||
* @param array $objectList
|
||||
*
|
||||
* @return \Riak\Object
|
||||
*/
|
||||
protected function resolveConflict($id, $vClock, array $objectList)
|
||||
{
|
||||
// Our approach here is last-write wins
|
||||
$winner = $objectList[count($objectList)];
|
||||
|
||||
$putInput = new Input\PutInput();
|
||||
$putInput->setVClock($vClock);
|
||||
|
||||
$mergedObject = new Object($id);
|
||||
$mergedObject->setContent($winner->getContent());
|
||||
|
||||
$this->bucket->put($mergedObject, $putInput);
|
||||
|
||||
return $mergedObject;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Cache;
|
||||
|
||||
class Version
|
||||
{
|
||||
const VERSION = '1.4.0-DEV';
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -23,14 +22,13 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* WinCache cache provider.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class WinCacheCache extends CacheProvider
|
||||
{
|
||||
|
@ -83,11 +81,11 @@ class WinCacheCache extends CacheProvider
|
|||
$meminfo = wincache_ucache_meminfo();
|
||||
|
||||
return array(
|
||||
Cache::STATS_HITS => $info['total_hit_count'],
|
||||
Cache::STATS_MISSES => $info['total_miss_count'],
|
||||
Cache::STATS_UPTIME => $info['total_cache_uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'],
|
||||
Cache::STATS_MEMORY_AVAILIABLE => $meminfo['memory_free'],
|
||||
Cache::STATS_HITS => $info['total_hit_count'],
|
||||
Cache::STATS_MISSES => $info['total_miss_count'],
|
||||
Cache::STATS_UPTIME => $info['total_cache_uptime'],
|
||||
Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $meminfo['memory_free'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
|
@ -23,14 +22,13 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* Xcache cache driver.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author David Abdemoulaie <dave@hobodave.com>
|
||||
*/
|
||||
class XcacheCache extends CacheProvider
|
||||
{
|
||||
|
@ -79,10 +77,11 @@ class XcacheCache extends CacheProvider
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks that xcache.admin.enable_auth is Off
|
||||
* Checks that xcache.admin.enable_auth is Off.
|
||||
*
|
||||
* @throws \BadMethodCallException When xcache.admin.enable_auth is On
|
||||
* @return void
|
||||
*
|
||||
* @throws \BadMethodCallException When xcache.admin.enable_auth is On.
|
||||
*/
|
||||
protected function checkAuthorization()
|
||||
{
|
||||
|
@ -103,8 +102,8 @@ class XcacheCache extends CacheProvider
|
|||
Cache::STATS_HITS => $info['hits'],
|
||||
Cache::STATS_MISSES => $info['misses'],
|
||||
Cache::STATS_UPTIME => null,
|
||||
Cache::STATS_MEMORY_USAGE => $info['size'],
|
||||
Cache::STATS_MEMORY_AVAILIABLE => $info['avail'],
|
||||
Cache::STATS_MEMORY_USAGE => $info['size'],
|
||||
Cache::STATS_MEMORY_AVAILABLE => $info['avail'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,10 @@ namespace Doctrine\Common\Cache;
|
|||
/**
|
||||
* Zend Data Cache cache driver.
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Ralph Schindler <ralph.schindler@zend.com>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Ralph Schindler <ralph.schindler@zend.com>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
*/
|
||||
class ZendDataCache extends CacheProvider
|
||||
{
|
||||
|
|
|
@ -22,10 +22,4 @@
|
|||
<directory>./lib/Doctrine/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>performance</group>
|
||||
</exclude>
|
||||
</groups>
|
||||
</phpunit>
|
||||
|
|
|
@ -18,4 +18,9 @@ class ArrayCacheTest extends CacheTest
|
|||
|
||||
$this->assertNull($stats);
|
||||
}
|
||||
|
||||
protected function isSharedStorage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
40
core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php
vendored
Normal file
40
core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/BaseFileCacheTest.php
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
|
||||
abstract class BaseFileCacheTest extends CacheTest
|
||||
{
|
||||
protected $directory;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
do {
|
||||
$this->directory = sys_get_temp_dir() . '/doctrine_cache_'. uniqid();
|
||||
} while (file_exists($this->directory));
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if ( ! is_dir($this->directory)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$iterator = new RecursiveDirectoryIterator($this->directory);
|
||||
|
||||
foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) {
|
||||
if ($file->isFile()) {
|
||||
@unlink($file->getRealPath());
|
||||
} elseif ($file->isDir()) {
|
||||
@rmdir($file->getRealPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function isSharedStorage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -3,72 +3,198 @@
|
|||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
use ArrayObject;
|
||||
|
||||
abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase
|
||||
{
|
||||
public function testBasics()
|
||||
/**
|
||||
* @dataProvider provideCrudValues
|
||||
*/
|
||||
public function testBasicCrudOperations($value)
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
|
||||
// Test save
|
||||
$cache->save('test_key', 'testing this out');
|
||||
// Test saving a value, checking if it exists, and fetching it back
|
||||
$this->assertTrue($cache->save('key', 'value'));
|
||||
$this->assertTrue($cache->contains('key'));
|
||||
$this->assertEquals('value', $cache->fetch('key'));
|
||||
|
||||
// Test contains to test that save() worked
|
||||
$this->assertTrue($cache->contains('test_key'));
|
||||
// Test updating the value of a cache entry
|
||||
$this->assertTrue($cache->save('key', 'value-changed'));
|
||||
$this->assertTrue($cache->contains('key'));
|
||||
$this->assertEquals('value-changed', $cache->fetch('key'));
|
||||
|
||||
// Test fetch
|
||||
$this->assertEquals('testing this out', $cache->fetch('test_key'));
|
||||
|
||||
// Test delete
|
||||
$cache->save('test_key2', 'test2');
|
||||
$cache->delete('test_key2');
|
||||
$this->assertFalse($cache->contains('test_key2'));
|
||||
// Test deleting a value
|
||||
$this->assertTrue($cache->delete('key'));
|
||||
$this->assertFalse($cache->contains('key'));
|
||||
}
|
||||
|
||||
public function testObjects()
|
||||
public function provideCrudValues()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
|
||||
// Fetch/save test with objects (Is cache driver serializes/unserializes objects correctly ?)
|
||||
$cache->save('test_object_key', new \ArrayObject());
|
||||
$this->assertTrue($cache->fetch('test_object_key') instanceof \ArrayObject);
|
||||
return array(
|
||||
'array' => array(array('one', 2, 3.0)),
|
||||
'string' => array('value'),
|
||||
'integer' => array(1),
|
||||
'float' => array(1.5),
|
||||
'object' => array(new ArrayObject()),
|
||||
'null' => array(null),
|
||||
);
|
||||
}
|
||||
|
||||
public function testDeleteAll()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$cache->save('test_key1', '1');
|
||||
$cache->save('test_key2', '2');
|
||||
$cache->deleteAll();
|
||||
|
||||
$this->assertFalse($cache->contains('test_key1'));
|
||||
$this->assertFalse($cache->contains('test_key2'));
|
||||
$this->assertTrue($cache->save('key1', 1));
|
||||
$this->assertTrue($cache->save('key2', 2));
|
||||
$this->assertTrue($cache->deleteAll());
|
||||
$this->assertFalse($cache->contains('key1'));
|
||||
$this->assertFalse($cache->contains('key2'));
|
||||
}
|
||||
|
||||
public function testDeleteAllAndNamespaceVersioningBetweenCaches()
|
||||
{
|
||||
if ( ! $this->isSharedStorage()) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' does not use shared storage');
|
||||
}
|
||||
|
||||
$cache1 = $this->_getCacheDriver();
|
||||
$cache2 = $this->_getCacheDriver();
|
||||
|
||||
$this->assertTrue($cache1->save('key1', 1));
|
||||
$this->assertTrue($cache2->save('key2', 2));
|
||||
|
||||
/* Both providers are initialized with the same namespace version, so
|
||||
* they can see entries set by each other.
|
||||
*/
|
||||
$this->assertTrue($cache1->contains('key1'));
|
||||
$this->assertTrue($cache1->contains('key2'));
|
||||
$this->assertTrue($cache2->contains('key1'));
|
||||
$this->assertTrue($cache2->contains('key2'));
|
||||
|
||||
/* Deleting all entries through one provider will only increment the
|
||||
* namespace version on that object (and in the cache itself, which new
|
||||
* instances will use to initialize). The second provider will retain
|
||||
* its original version and still see stale data.
|
||||
*/
|
||||
$this->assertTrue($cache1->deleteAll());
|
||||
$this->assertFalse($cache1->contains('key1'));
|
||||
$this->assertFalse($cache1->contains('key2'));
|
||||
$this->assertTrue($cache2->contains('key1'));
|
||||
$this->assertTrue($cache2->contains('key2'));
|
||||
|
||||
/* A new cache provider should not see the deleted entries, since its
|
||||
* namespace version will be initialized.
|
||||
*/
|
||||
$cache3 = $this->_getCacheDriver();
|
||||
$this->assertFalse($cache3->contains('key1'));
|
||||
$this->assertFalse($cache3->contains('key2'));
|
||||
}
|
||||
|
||||
public function testFlushAll()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$cache->save('test_key1', '1');
|
||||
$cache->save('test_key2', '2');
|
||||
$cache->flushAll();
|
||||
|
||||
$this->assertFalse($cache->contains('test_key1'));
|
||||
$this->assertFalse($cache->contains('test_key2'));
|
||||
$this->assertTrue($cache->save('key1', 1));
|
||||
$this->assertTrue($cache->save('key2', 2));
|
||||
$this->assertTrue($cache->flushAll());
|
||||
$this->assertFalse($cache->contains('key1'));
|
||||
$this->assertFalse($cache->contains('key2'));
|
||||
}
|
||||
|
||||
public function testFlushAllAndNamespaceVersioningBetweenCaches()
|
||||
{
|
||||
if ( ! $this->isSharedStorage()) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' does not use shared storage');
|
||||
}
|
||||
|
||||
$cache1 = $this->_getCacheDriver();
|
||||
$cache2 = $this->_getCacheDriver();
|
||||
|
||||
/* Deleting all elements from the first provider should increment its
|
||||
* namespace version before saving the first entry.
|
||||
*/
|
||||
$cache1->deleteAll();
|
||||
$this->assertTrue($cache1->save('key1', 1));
|
||||
|
||||
/* The second provider will be initialized with the same namespace
|
||||
* version upon its first save operation.
|
||||
*/
|
||||
$this->assertTrue($cache2->save('key2', 2));
|
||||
|
||||
/* Both providers have the same namespace version and can see entires
|
||||
* set by each other.
|
||||
*/
|
||||
$this->assertTrue($cache1->contains('key1'));
|
||||
$this->assertTrue($cache1->contains('key2'));
|
||||
$this->assertTrue($cache2->contains('key1'));
|
||||
$this->assertTrue($cache2->contains('key2'));
|
||||
|
||||
/* Flushing all entries through one cache will remove all entries from
|
||||
* the cache but leave their namespace version as-is.
|
||||
*/
|
||||
$this->assertTrue($cache1->flushAll());
|
||||
$this->assertFalse($cache1->contains('key1'));
|
||||
$this->assertFalse($cache1->contains('key2'));
|
||||
$this->assertFalse($cache2->contains('key1'));
|
||||
$this->assertFalse($cache2->contains('key2'));
|
||||
|
||||
/* Inserting a new entry will use the same, incremented namespace
|
||||
* version, and it will be visible to both providers.
|
||||
*/
|
||||
$this->assertTrue($cache1->save('key1', 1));
|
||||
$this->assertTrue($cache1->contains('key1'));
|
||||
$this->assertTrue($cache2->contains('key1'));
|
||||
|
||||
/* A new cache provider will be initialized with the original namespace
|
||||
* version and not share any visibility with the first two providers.
|
||||
*/
|
||||
$cache3 = $this->_getCacheDriver();
|
||||
$this->assertFalse($cache3->contains('key1'));
|
||||
$this->assertFalse($cache3->contains('key2'));
|
||||
$this->assertTrue($cache3->save('key3', 3));
|
||||
$this->assertTrue($cache3->contains('key3'));
|
||||
}
|
||||
|
||||
public function testNamespace()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$cache->setNamespace('test_');
|
||||
$cache->save('key1', 'test');
|
||||
|
||||
$cache->setNamespace('ns1_');
|
||||
|
||||
$this->assertTrue($cache->save('key1', 1));
|
||||
$this->assertTrue($cache->contains('key1'));
|
||||
|
||||
$cache->setNamespace('test2_');
|
||||
$cache->setNamespace('ns2_');
|
||||
|
||||
$this->assertFalse($cache->contains('key1'));
|
||||
}
|
||||
|
||||
public function testDeleteAllNamespace()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
|
||||
$cache->setNamespace('ns1');
|
||||
$this->assertFalse($cache->contains('key1'));
|
||||
$cache->save('key1', 'test');
|
||||
$this->assertTrue($cache->contains('key1'));
|
||||
|
||||
$cache->setNamespace('ns2');
|
||||
$this->assertFalse($cache->contains('key1'));
|
||||
$cache->save('key1', 'test');
|
||||
$this->assertTrue($cache->contains('key1'));
|
||||
|
||||
$cache->setNamespace('ns1');
|
||||
$this->assertTrue($cache->contains('key1'));
|
||||
$cache->deleteAll();
|
||||
$this->assertFalse($cache->contains('key1'));
|
||||
|
||||
$cache->setNamespace('ns2');
|
||||
$this->assertTrue($cache->contains('key1'));
|
||||
$cache->deleteAll();
|
||||
$this->assertFalse($cache->contains('key1'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DCOM-43
|
||||
*/
|
||||
|
@ -77,23 +203,36 @@ abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase
|
|||
$cache = $this->_getCacheDriver();
|
||||
$stats = $cache->getStats();
|
||||
|
||||
$this->assertArrayHasKey(Cache::STATS_HITS, $stats);
|
||||
$this->assertArrayHasKey(Cache::STATS_HITS, $stats);
|
||||
$this->assertArrayHasKey(Cache::STATS_MISSES, $stats);
|
||||
$this->assertArrayHasKey(Cache::STATS_UPTIME, $stats);
|
||||
$this->assertArrayHasKey(Cache::STATS_MEMORY_USAGE, $stats);
|
||||
$this->assertArrayHasKey(Cache::STATS_MEMORY_AVAILIABLE, $stats);
|
||||
$this->assertArrayHasKey(Cache::STATS_MEMORY_AVAILABLE, $stats);
|
||||
}
|
||||
|
||||
public function testFetchMissShouldReturnFalse()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
|
||||
/* Ensure that caches return boolean false instead of null on a fetch
|
||||
* miss to be compatible with ORM integration.
|
||||
*/
|
||||
$result = $cache->fetch('nonexistent_key');
|
||||
|
||||
$this->assertFalse($result);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure that all supported caches return "false" instead of "null" to be compatible
|
||||
* with ORM integration.
|
||||
* Return whether multiple cache providers share the same storage.
|
||||
*
|
||||
* This is used for skipping certain tests for shared storage behavior.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testFalseOnFailedFetch()
|
||||
protected function isSharedStorage()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$result = $cache->fetch('nonexistent_key');
|
||||
$this->assertFalse($result);
|
||||
$this->assertNotNull($result);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
107
core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php
vendored
Normal file
107
core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FileCacheTest.php
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
/**
|
||||
* @group DCOM-101
|
||||
*/
|
||||
class FileCacheTest extends \Doctrine\Tests\DoctrineTestCase
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\Common\Cache\FileCache
|
||||
*/
|
||||
private $driver;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->driver = $this->getMock(
|
||||
'Doctrine\Common\Cache\FileCache',
|
||||
array('doFetch', 'doContains', 'doSave'),
|
||||
array(), '', false
|
||||
);
|
||||
}
|
||||
|
||||
public function getProviderFileName()
|
||||
{
|
||||
return array(
|
||||
//The characters :\/<>"*?| are not valid in Windows filenames.
|
||||
array('key:1', 'key1'),
|
||||
array('key\2', 'key2'),
|
||||
array('key/3', 'key3'),
|
||||
array('key<4', 'key4'),
|
||||
array('key>5', 'key5'),
|
||||
array('key"6', 'key6'),
|
||||
array('key*7', 'key7'),
|
||||
array('key?8', 'key8'),
|
||||
array('key|9', 'key9'),
|
||||
array('key[0]','key[0]'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getProviderFileName
|
||||
*/
|
||||
public function testInvalidFilename($key, $expected)
|
||||
{
|
||||
$cache = $this->driver;
|
||||
$method = new \ReflectionMethod($cache, 'getFilename');
|
||||
|
||||
$method->setAccessible(true);
|
||||
|
||||
$value = $method->invoke($cache, $key);
|
||||
$actual = pathinfo($value, PATHINFO_FILENAME);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testFilenameCollision()
|
||||
{
|
||||
$data['key:0'] = 'key0';
|
||||
$data['key\0'] = 'key0';
|
||||
$data['key/0'] = 'key0';
|
||||
$data['key<0'] = 'key0';
|
||||
$data['key>0'] = 'key0';
|
||||
$data['key"0'] = 'key0';
|
||||
$data['key*0'] = 'key0';
|
||||
$data['key?0'] = 'key0';
|
||||
$data['key|0'] = 'key0';
|
||||
|
||||
$paths = array();
|
||||
$cache = $this->driver;
|
||||
$method = new \ReflectionMethod($cache, 'getFilename');
|
||||
|
||||
$method->setAccessible(true);
|
||||
|
||||
foreach ($data as $key => $expected) {
|
||||
$path = $method->invoke($cache, $key);
|
||||
$actual = pathinfo($path, PATHINFO_FILENAME);
|
||||
|
||||
$this->assertNotContains($path, $paths);
|
||||
$this->assertEquals($expected, $actual);
|
||||
|
||||
$paths[] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
public function testFilenameShouldCreateThePathWithFourSubDirectories()
|
||||
{
|
||||
$cache = $this->driver;
|
||||
$method = new \ReflectionMethod($cache, 'getFilename');
|
||||
$key = 'item-key';
|
||||
$expectedDir[] = '84e0e2e893febb73';
|
||||
$expectedDir[] = '7a0fee0c89d53f4b';
|
||||
$expectedDir[] = 'b7fcb44c57cdf3d3';
|
||||
$expectedDir[] = '2ce7363f5d597760';
|
||||
$expectedDir = implode(DIRECTORY_SEPARATOR, $expectedDir);
|
||||
|
||||
$method->setAccessible(true);
|
||||
|
||||
$path = $method->invoke($cache, $key);
|
||||
$filename = pathinfo($path, PATHINFO_FILENAME);
|
||||
$dirname = pathinfo($path, PATHINFO_DIRNAME);
|
||||
|
||||
$this->assertEquals('item-key', $filename);
|
||||
$this->assertEquals(DIRECTORY_SEPARATOR . $expectedDir, $dirname);
|
||||
$this->assertEquals(DIRECTORY_SEPARATOR . $expectedDir . DIRECTORY_SEPARATOR . $key, $path);
|
||||
}
|
||||
}
|
|
@ -2,29 +2,14 @@
|
|||
|
||||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
use Doctrine\Common\Cache\FilesystemCache;
|
||||
|
||||
/**
|
||||
* @group DCOM-101
|
||||
*/
|
||||
class FilesystemCacheTest extends CacheTest
|
||||
class FilesystemCacheTest extends BaseFileCacheTest
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\Common\Cache\FilesystemCache
|
||||
*/
|
||||
private $driver;
|
||||
|
||||
protected function _getCacheDriver()
|
||||
{
|
||||
$dir = sys_get_temp_dir() . "/doctrine_cache_". uniqid();
|
||||
$this->assertFalse(is_dir($dir));
|
||||
|
||||
$this->driver = new FilesystemCache($dir);
|
||||
$this->assertTrue(is_dir($dir));
|
||||
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
public function testLifetime()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
|
@ -76,22 +61,15 @@ class FilesystemCacheTest extends CacheTest
|
|||
$cache = $this->_getCacheDriver();
|
||||
$stats = $cache->getStats();
|
||||
|
||||
$this->assertNull($stats);
|
||||
$this->assertNull($stats[Cache::STATS_HITS]);
|
||||
$this->assertNull($stats[Cache::STATS_MISSES]);
|
||||
$this->assertNull($stats[Cache::STATS_UPTIME]);
|
||||
$this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]);
|
||||
$this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function _getCacheDriver()
|
||||
{
|
||||
$dir = $this->driver->getDirectory();
|
||||
$ext = $this->driver->getExtension();
|
||||
$iterator = new \RecursiveDirectoryIterator($dir);
|
||||
|
||||
foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
|
||||
if ($file->isFile()) {
|
||||
@unlink($file->getRealPath());
|
||||
} else {
|
||||
@rmdir($file->getRealPath());
|
||||
}
|
||||
}
|
||||
return new FilesystemCache($this->directory);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,25 +3,35 @@
|
|||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\MemcacheCache;
|
||||
use Memcache;
|
||||
|
||||
class MemcacheCacheTest extends CacheTest
|
||||
{
|
||||
private $_memcache;
|
||||
private $memcache;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if (extension_loaded('memcache')) {
|
||||
$this->_memcache = new \Memcache;
|
||||
$ok = @$this->_memcache->connect('localhost', 11211);
|
||||
if (!$ok) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
|
||||
}
|
||||
} else {
|
||||
if ( ! extension_loaded('memcache')) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
|
||||
}
|
||||
|
||||
$this->memcache = new Memcache();
|
||||
|
||||
if (@$this->memcache->connect('localhost', 11211) === false) {
|
||||
unset($this->memcache);
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' cannot connect to memcache');
|
||||
}
|
||||
}
|
||||
|
||||
public function testNoExpire() {
|
||||
public function tearDown()
|
||||
{
|
||||
if ($this->memcache instanceof Memcache) {
|
||||
$this->memcache->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function testNoExpire()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$cache->save('noexpire', 'value', 0);
|
||||
sleep(1);
|
||||
|
@ -38,8 +48,7 @@ class MemcacheCacheTest extends CacheTest
|
|||
protected function _getCacheDriver()
|
||||
{
|
||||
$driver = new MemcacheCache();
|
||||
$driver->setMemcache($this->_memcache);
|
||||
$driver->setMemcache($this->memcache);
|
||||
return $driver;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\MemcachedCache;
|
||||
use Memcached;
|
||||
|
||||
class MemcachedCacheTest extends CacheTest
|
||||
{
|
||||
|
@ -10,21 +11,29 @@ class MemcachedCacheTest extends CacheTest
|
|||
|
||||
public function setUp()
|
||||
{
|
||||
if (extension_loaded('memcached')) {
|
||||
$this->memcached = new \Memcached();
|
||||
$this->memcached->setOption(\Memcached::OPT_COMPRESSION, false);
|
||||
$this->memcached->addServer('127.0.0.1', 11211);
|
||||
if ( ! extension_loaded('memcached')) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcached');
|
||||
}
|
||||
|
||||
$fh = @fsockopen('127.0.0.1', 11211);
|
||||
if (!$fh) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
|
||||
}
|
||||
} else {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of memcache');
|
||||
$this->memcached = new Memcached();
|
||||
$this->memcached->setOption(Memcached::OPT_COMPRESSION, false);
|
||||
$this->memcached->addServer('127.0.0.1', 11211);
|
||||
|
||||
if (@fsockopen('127.0.0.1', 11211) === false) {
|
||||
unset($this->memcached);
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' cannot connect to memcache');
|
||||
}
|
||||
}
|
||||
|
||||
public function testNoExpire() {
|
||||
public function tearDown()
|
||||
{
|
||||
if ($this->memcached instanceof Memcached) {
|
||||
$this->memcached->flush();
|
||||
}
|
||||
}
|
||||
|
||||
public function testNoExpire()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$cache->save('noexpire', 'value', 0);
|
||||
sleep(1);
|
||||
|
@ -35,8 +44,7 @@ class MemcachedCacheTest extends CacheTest
|
|||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$cache->save('key', 'value', 30 * 24 * 3600 + 1);
|
||||
|
||||
$this->assertTrue($cache->contains('key'), 'Memcached provider should support TTL > 30 days');
|
||||
$this->assertTrue($cache->contains('key'), 'Memcache provider should support TTL > 30 days');
|
||||
}
|
||||
|
||||
protected function _getCacheDriver()
|
||||
|
|
61
core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php
vendored
Normal file
61
core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MongoDBCacheTest.php
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
use Doctrine\Common\Cache\MongoDBCache;
|
||||
use MongoClient;
|
||||
use MongoCollection;
|
||||
|
||||
class MongoDBCacheTest extends CacheTest
|
||||
{
|
||||
/**
|
||||
* @var MongoCollection
|
||||
*/
|
||||
private $collection;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
if ( ! version_compare(phpversion('mongo'), '1.3.0', '>=')) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of mongo >= 1.3.0');
|
||||
}
|
||||
|
||||
$mongo = new MongoClient();
|
||||
$this->collection = $mongo->selectCollection('doctrine_common_cache', 'test');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
if ($this->collection instanceof MongoCollection) {
|
||||
$this->collection->drop();
|
||||
}
|
||||
}
|
||||
|
||||
public function testSaveWithNonUtf8String()
|
||||
{
|
||||
// Invalid 2-octet sequence
|
||||
$data = "\xc3\x28";
|
||||
|
||||
$cache = $this->_getCacheDriver();
|
||||
|
||||
$this->assertTrue($cache->save('key', $data));
|
||||
$this->assertEquals($data, $cache->fetch('key'));
|
||||
}
|
||||
|
||||
public function testGetStats()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$stats = $cache->getStats();
|
||||
|
||||
$this->assertNull($stats[Cache::STATS_HITS]);
|
||||
$this->assertNull($stats[Cache::STATS_MISSES]);
|
||||
$this->assertGreaterThan(0, $stats[Cache::STATS_UPTIME]);
|
||||
$this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]);
|
||||
$this->assertNull($stats[Cache::STATS_MEMORY_AVAILABLE]);
|
||||
}
|
||||
|
||||
protected function _getCacheDriver()
|
||||
{
|
||||
return new MongoDBCache($this->collection);
|
||||
}
|
||||
}
|
|
@ -2,34 +2,14 @@
|
|||
|
||||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
use Doctrine\Common\Cache\PhpFileCache;
|
||||
|
||||
/**
|
||||
* @group DCOM-101
|
||||
*/
|
||||
class PhpFileCacheTest extends CacheTest
|
||||
class PhpFileCacheTest extends BaseFileCacheTest
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\Common\Cache\PhpFileCache
|
||||
*/
|
||||
private $driver;
|
||||
|
||||
protected function _getCacheDriver()
|
||||
{
|
||||
$dir = sys_get_temp_dir() . "/doctrine_cache_". uniqid();
|
||||
$this->assertFalse(is_dir($dir));
|
||||
|
||||
$this->driver = new PhpFileCache($dir);
|
||||
$this->assertTrue(is_dir($dir));
|
||||
|
||||
return $this->driver;
|
||||
}
|
||||
|
||||
public function testObjects()
|
||||
{
|
||||
$this->markTestSkipped('PhpFileCache does not support saving objects that dont implement __set_state()');
|
||||
}
|
||||
|
||||
public function testLifetime()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
|
@ -98,28 +78,17 @@ class PhpFileCacheTest extends CacheTest
|
|||
$cache = $this->_getCacheDriver();
|
||||
$stats = $cache->getStats();
|
||||
|
||||
$this->assertNull($stats);
|
||||
$this->assertNull($stats[Cache::STATS_HITS]);
|
||||
$this->assertNull($stats[Cache::STATS_MISSES]);
|
||||
$this->assertNull($stats[Cache::STATS_UPTIME]);
|
||||
$this->assertEquals(0, $stats[Cache::STATS_MEMORY_USAGE]);
|
||||
$this->assertGreaterThan(0, $stats[Cache::STATS_MEMORY_AVAILABLE]);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function _getCacheDriver()
|
||||
{
|
||||
if (!$this->driver) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dir = $this->driver->getDirectory();
|
||||
$ext = $this->driver->getExtension();
|
||||
$iterator = new \RecursiveDirectoryIterator($dir);
|
||||
|
||||
foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
|
||||
if ($file->isFile()) {
|
||||
@unlink($file->getRealPath());
|
||||
} else {
|
||||
@rmdir($file->getRealPath());
|
||||
}
|
||||
}
|
||||
return new PhpFileCache($this->directory);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class NotSetStateClass
|
||||
|
|
64
core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RiakCacheTest.php
vendored
Normal file
64
core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RiakCacheTest.php
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Cache;
|
||||
|
||||
use Riak\Bucket;
|
||||
use Riak\Connection;
|
||||
use Riak\Exception;
|
||||
use Doctrine\Common\Cache\RiakCache;
|
||||
|
||||
/**
|
||||
* RiakCache test
|
||||
*
|
||||
* @group Riak
|
||||
*/
|
||||
class RiakCacheTest extends CacheTest
|
||||
{
|
||||
/**
|
||||
* @var \Riak\Connection
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @var \Riak\Bucket
|
||||
*/
|
||||
private $bucket;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
if ( ! extension_loaded('riak')) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of Riak');
|
||||
}
|
||||
|
||||
try {
|
||||
$this->connection = new Connection('127.0.0.1', 8087);
|
||||
$this->bucket = new Bucket($this->connection, 'test');
|
||||
} catch (Exception\RiakException $e) {
|
||||
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of Riak');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function testGetStats()
|
||||
{
|
||||
$cache = $this->_getCacheDriver();
|
||||
$stats = $cache->getStats();
|
||||
|
||||
$this->assertNull($stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve RiakCache instance.
|
||||
*
|
||||
* @return \Doctrine\Common\Cache\RiakCache
|
||||
*/
|
||||
protected function _getCacheDriver()
|
||||
{
|
||||
return new RiakCache($this->bucket);
|
||||
}
|
||||
}
|
|
@ -2,22 +2,18 @@
|
|||
/*
|
||||
* This file bootstraps the test environment.
|
||||
*/
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
// register silently failing autoloader
|
||||
spl_autoload_register(function($class)
|
||||
{
|
||||
if (0 === strpos($class, 'Doctrine\Tests\\')) {
|
||||
$path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php';
|
||||
if (is_file($path) && is_readable($path)) {
|
||||
require_once $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require_once __DIR__ . "/../../../vendor/autoload.php";
|
||||
if (file_exists(__DIR__ . '/../../../vendor/autoload.php')) {
|
||||
// dependencies were installed via composer - this is the main project
|
||||
$classLoader = require __DIR__ . '/../../../vendor/autoload.php';
|
||||
} elseif (file_exists(__DIR__ . '/../../../../../autoload.php')) {
|
||||
// installed as a dependency in `vendor`
|
||||
$classLoader = require __DIR__ . '/../../../../../autoload.php';
|
||||
} else {
|
||||
throw new Exception('Can\'t find autoload.php. Did you install dependencies via Composer?');
|
||||
}
|
||||
|
||||
/* @var $classLoader \Composer\Autoload\ClassLoader */
|
||||
$classLoader->add('Doctrine\\Tests\\', __DIR__ . '/../../');
|
||||
unset($classLoader);
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
extension="mongo.so"
|
||||
extension="memcache.so"
|
||||
extension="memcached.so"
|
||||
|
||||
apc.enabled=1
|
||||
apc.enable_cli=1
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit bootstrap="../Doctrine/Tests/TestInit.php"
|
||||
convertWarningsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertErrorsToExceptions="true"
|
||||
backupStaticAttributes="false"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
backupGlobals="false"
|
||||
syntaxCheck="false"
|
||||
colors="true">
|
||||
|
||||
<logging>
|
||||
<log type="coverage-clover" target="../../build/logs/clover.xml"/>
|
||||
</logging>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Doctrine Cache Test Suite">
|
||||
<directory>../Doctrine/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>../../lib/Doctrine/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
|
||||
<groups>
|
||||
<exclude>
|
||||
<group>performance</group>
|
||||
</exclude>
|
||||
</groups>
|
||||
</phpunit>
|
|
@ -0,0 +1 @@
|
|||
vendor/
|
|
@ -4,6 +4,7 @@ php:
|
|||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- hhvm
|
||||
|
||||
before_script:
|
||||
- composer --prefer-source --dev install
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2006-2013 Doctrine Project
|
||||
|
||||
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.
|
|
@ -1,3 +1,17 @@
|
|||
# Doctrine Collections
|
||||
|
||||
Collections Abstraction library
|
||||
|
||||
## Changelog
|
||||
|
||||
### v1.2
|
||||
|
||||
* Add a new ``AbstractLazyCollection``
|
||||
|
||||
### v1.1
|
||||
|
||||
* Deprecated ``Comparison::IS``, because it's only there for SQL semantics.
|
||||
These are fixed in the ORM instead.
|
||||
* Add ``Comparison::CONTAINS`` to perform partial string matches:
|
||||
|
||||
$criteria->andWhere($criteria->expr()->contains('property', 'Foo'));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
"dev-master": "1.2.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
343
core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/AbstractLazyCollection.php
vendored
Normal file
343
core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/AbstractLazyCollection.php
vendored
Normal file
|
@ -0,0 +1,343 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Common\Collections;
|
||||
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* Lazy collection that is backed by a concrete collection
|
||||
*
|
||||
* @author Michaël Gallego <mic.gallego@gmail.com>
|
||||
* @since 1.2
|
||||
*/
|
||||
abstract class AbstractLazyCollection implements Collection
|
||||
{
|
||||
/**
|
||||
* The backed collection to use
|
||||
*
|
||||
* @var Collection
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $initialized = false;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function add($element)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->add($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->initialize();
|
||||
$this->collection->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function contains($element)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->contains($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function remove($key)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->remove($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function removeElement($element)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->removeElement($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function containsKey($key)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->containsKey($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get($key)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getKeys()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->getKeys();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->getValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function set($key, $value)
|
||||
{
|
||||
$this->initialize();
|
||||
$this->collection->set($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function first()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function last()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->last();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->key();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->current();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->next();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function exists(Closure $p)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->exists($p);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function filter(Closure $p)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->filter($p);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function forAll(Closure $p)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->forAll($p);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function map(Closure $func)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->map($func);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function partition(Closure $p)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->partition($p);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function indexOf($element)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->indexOf($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function slice($offset, $length = null)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->slice($offset, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->getIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->offsetExists($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
$this->initialize();
|
||||
return $this->collection->offsetGet($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->initialize();
|
||||
$this->collection->offsetSet($offset, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
$this->initialize();
|
||||
$this->collection->offsetUnset($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the lazy collection already initialized?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isInitialized()
|
||||
{
|
||||
return $this->initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the collection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
if (!$this->initialized) {
|
||||
$this->doInitialize();
|
||||
$this->initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the initialization logic
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract protected function doInitialize();
|
||||
}
|
|
@ -203,9 +203,8 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess
|
|||
function filter(Closure $p);
|
||||
|
||||
/**
|
||||
* Applies the given predicate p to all elements of this collection,
|
||||
* returning true, if the predicate yields true for all elements.
|
||||
*
|
||||
* Tests whether the given predicate p holds for all elements of this collection.
|
||||
*
|
||||
* @param Closure $p The predicate.
|
||||
*
|
||||
* @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
|
||||
|
|
|
@ -42,6 +42,10 @@ class ClosureExpressionVisitor extends ExpressionVisitor
|
|||
*/
|
||||
public static function getObjectFieldValue($object, $field)
|
||||
{
|
||||
if (is_array($object)) {
|
||||
return $object[$field];
|
||||
}
|
||||
|
||||
$accessors = array('get', 'is');
|
||||
|
||||
foreach ($accessors as $accessor) {
|
||||
|
@ -61,7 +65,7 @@ class ClosureExpressionVisitor extends ExpressionVisitor
|
|||
return $object->$accessor();
|
||||
}
|
||||
|
||||
if ($object instanceof \ArrayAccess || is_array($object)) {
|
||||
if ($object instanceof \ArrayAccess) {
|
||||
return $object[$field];
|
||||
}
|
||||
|
||||
|
@ -107,7 +111,6 @@ class ClosureExpressionVisitor extends ExpressionVisitor
|
|||
|
||||
switch ($comparison->getOperator()) {
|
||||
case Comparison::EQ:
|
||||
case Comparison::IS:
|
||||
return function ($object) use ($field, $value) {
|
||||
return ClosureExpressionVisitor::getObjectFieldValue($object, $field) === $value;
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ class Comparison implements Expression
|
|||
const LTE = '<=';
|
||||
const GT = '>';
|
||||
const GTE = '>=';
|
||||
const IS = 'IS';
|
||||
const IS = '='; // no difference with EQ
|
||||
const IN = 'IN';
|
||||
const NIN = 'NIN';
|
||||
const CONTAINS = 'CONTAINS';
|
||||
|
|
|
@ -26,6 +26,10 @@ use Doctrine\Common\Collections\Expr\Value;
|
|||
/**
|
||||
* Builder for Expressions in the {@link Selectable} interface.
|
||||
*
|
||||
* Important Notice for interoperable code: You have to use scalar
|
||||
* values only for comparisons, otherwise the behavior of the comparision
|
||||
* may be different between implementations (Array vs ORM vs ODM).
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @since 2.3
|
||||
*/
|
||||
|
@ -124,7 +128,7 @@ class ExpressionBuilder
|
|||
*/
|
||||
public function isNull($field)
|
||||
{
|
||||
return new Comparison($field, Comparison::IS, new Value(null));
|
||||
return new Comparison($field, Comparison::EQ, new Value(null));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\Common\Collections;
|
||||
|
||||
use Doctrine\Tests\LazyArrayCollection;
|
||||
|
||||
class AbstractLazyCollectionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testLazyCollection()
|
||||
{
|
||||
$collection = new LazyArrayCollection();
|
||||
|
||||
$this->assertFalse($collection->isInitialized());
|
||||
$this->assertCount(3, $collection);
|
||||
|
||||
$collection->add('bar');
|
||||
$this->assertTrue($collection->isInitialized());
|
||||
$this->assertCount(4, $collection);
|
||||
}
|
||||
}
|
|
@ -108,7 +108,7 @@ class ExpressionBuilderTest extends \PHPUnit_Framework_TestCase
|
|||
$expr = $this->builder->isNull("a");
|
||||
|
||||
$this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr);
|
||||
$this->assertEquals(Comparison::IS, $expr->getOperator());
|
||||
$this->assertEquals(Comparison::EQ, $expr->getOperator());
|
||||
}
|
||||
|
||||
public function testContains()
|
||||
|
|
22
core/vendor/doctrine/collections/tests/Doctrine/Tests/LazyArrayCollection.php
vendored
Normal file
22
core/vendor/doctrine/collections/tests/Doctrine/Tests/LazyArrayCollection.php
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests;
|
||||
|
||||
use Doctrine\Common\Collections\AbstractLazyCollection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* Simple lazy collection that used an ArrayCollection as backed collection
|
||||
*/
|
||||
class LazyArrayCollection extends AbstractLazyCollection
|
||||
{
|
||||
/**
|
||||
* Do the initialization logic
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function doInitialize()
|
||||
{
|
||||
$this->collection = new ArrayCollection(array('a', 'b', 'c'));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
phpunit.xml
|
||||
composer.lock
|
||||
build
|
||||
vendor
|
||||
coverage.clover
|
|
@ -0,0 +1,46 @@
|
|||
before_commands:
|
||||
- "composer install --prefer-source"
|
||||
|
||||
tools:
|
||||
external_code_coverage:
|
||||
timeout: 600
|
||||
php_code_coverage:
|
||||
enabled: true
|
||||
test_command: ./vendor/bin/phpunit
|
||||
php_code_sniffer:
|
||||
enabled: true
|
||||
config:
|
||||
standard: PSR2
|
||||
filter:
|
||||
paths: ["src/*", "tests/*"]
|
||||
php_cpd:
|
||||
enabled: true
|
||||
excluded_dirs: ["build/*", "tests", "vendor"]
|
||||
php_cs_fixer:
|
||||
enabled: true
|
||||
config:
|
||||
level: all
|
||||
filter:
|
||||
paths: ["src/*", "tests/*"]
|
||||
php_loc:
|
||||
enabled: true
|
||||
excluded_dirs: ["build", "tests", "vendor"]
|
||||
php_mess_detector:
|
||||
enabled: true
|
||||
config:
|
||||
ruleset: phpmd.xml.dist
|
||||
design_rules: { eval_expression: false }
|
||||
filter:
|
||||
paths: ["src/*"]
|
||||
php_pdepend:
|
||||
enabled: true
|
||||
excluded_dirs: ["build", "tests", "vendor"]
|
||||
php_analyzer:
|
||||
enabled: true
|
||||
filter:
|
||||
paths: ["src/*", "tests/*"]
|
||||
php_hhvm:
|
||||
enabled: true
|
||||
filter:
|
||||
paths: ["src/*", "tests/*"]
|
||||
sensiolabs_security_checker: true
|
|
@ -0,0 +1,13 @@
|
|||
set -x
|
||||
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] || [ "$TRAVIS_PHP_VERSION" = 'hhvm-nightly' ] ; then
|
||||
curl -sS https://getcomposer.org/installer > composer-installer.php
|
||||
hhvm composer-installer.php
|
||||
hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 composer.phar update --prefer-source
|
||||
elif [ "$TRAVIS_PHP_VERSION" = '5.3.3' ] ; then
|
||||
composer self-update
|
||||
composer update --prefer-source --no-dev
|
||||
composer dump-autoload
|
||||
else
|
||||
composer self-update
|
||||
composer update --prefer-source
|
||||
fi
|
|
@ -0,0 +1,26 @@
|
|||
language: php
|
||||
|
||||
php:
|
||||
- 5.3.3
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
- hhvm-nightly
|
||||
|
||||
before_script:
|
||||
- ./.travis.install.sh
|
||||
|
||||
script:
|
||||
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3.3' ]; then phpunit; fi"
|
||||
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then ./vendor/bin/phpunit; fi"
|
||||
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/; fi"
|
||||
- sh -c "if [[ '$TRAVIS_PHP_VERSION' != '5.3.3' && '$TRAVIS_PHP_VERSION' != '5.4.29' && '$TRAVIS_PHP_VERSION' != '5.5.13' ]]; then php -n ./vendor/bin/athletic -p ./tests/DoctrineTest/InstantiatorPerformance/ -f GroupedFormatter; fi"
|
||||
|
||||
after_script:
|
||||
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi"
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm-nightly
|
|
@ -0,0 +1,35 @@
|
|||
# Contributing
|
||||
|
||||
* Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
|
||||
* The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php)
|
||||
* Any contribution must provide tests for additional introduced conditions
|
||||
* Any un-confirmed issue needs a failing test case before being accepted
|
||||
* Pull requests must be sent from a new hotfix/feature branch, not from `master`.
|
||||
|
||||
## Installation
|
||||
|
||||
To install the project and run the tests, you need to clone it first:
|
||||
|
||||
```sh
|
||||
$ git clone git://github.com/doctrine/instantiator.git
|
||||
```
|
||||
|
||||
You will then need to run a composer installation:
|
||||
|
||||
```sh
|
||||
$ cd Instantiator
|
||||
$ curl -s https://getcomposer.org/installer | php
|
||||
$ php composer.phar update
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
The PHPUnit version to be used is the one installed as a dev- dependency via composer:
|
||||
|
||||
```sh
|
||||
$ ./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement
|
||||
won't be merged.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2014 Doctrine Project
|
||||
|
||||
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.
|
|
@ -0,0 +1,40 @@
|
|||
# Instantiator
|
||||
|
||||
This library provides a way of avoiding usage of constructors when instantiating PHP classes.
|
||||
|
||||
[](https://travis-ci.org/doctrine/instantiator)
|
||||
[](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master)
|
||||
[](https://www.versioneye.com/package/php--doctrine--instantiator)
|
||||
[](http://hhvm.h4cc.de/package/doctrine/instantiator)
|
||||
|
||||
[](https://packagist.org/packages/doctrine/instantiator)
|
||||
[](https://packagist.org/packages/doctrine/instantiator)
|
||||
|
||||
## Installation
|
||||
|
||||
The suggested installation method is via [composer](https://getcomposer.org/):
|
||||
|
||||
```sh
|
||||
php composer.phar require "doctrine/instantiator:~1.0.3"
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The instantiator is able to create new instances of any class without using the constructor or any API of the class
|
||||
itself:
|
||||
|
||||
```php
|
||||
$instantiator = new \Doctrine\Instantiator\Instantiator();
|
||||
|
||||
$instance = $instantiator->instantiate('My\\ClassName\\Here');
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please read the [CONTRIBUTING.md](CONTRIBUTING.md) contents if you wish to help out!
|
||||
|
||||
## Credits
|
||||
|
||||
This library was migrated from [ocramius/instantiator](https://github.com/Ocramius/Instantiator), which
|
||||
has been donated to the doctrine organization, and which is now deprecated in favour of this package.
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "doctrine/instantiator",
|
||||
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/doctrine/instantiator",
|
||||
"keywords": [
|
||||
"instantiate",
|
||||
"constructor"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com",
|
||||
"homepage": "http://ocramius.github.com/"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3,<8.0-DEV"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-phar": "*",
|
||||
"ext-pdo": "*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"squizlabs/php_codesniffer": "2.0.*@ALPHA",
|
||||
"athletic/athletic": "~0.1.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Doctrine\\Instantiator\\": "src"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-0": {
|
||||
"DoctrineTest\\InstantiatorPerformance\\": "tests",
|
||||
"DoctrineTest\\InstantiatorTest\\": "tests",
|
||||
"DoctrineTest\\InstantiatorTestAsset\\": "tests"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<ruleset
|
||||
name="Instantiator rules"
|
||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
>
|
||||
<rule ref="rulesets/cleancode.xml">
|
||||
<!-- static access is used for caching purposes -->
|
||||
<exclude name="StaticAccess"/>
|
||||
</rule>
|
||||
<rule ref="rulesets/codesize.xml"/>
|
||||
<rule ref="rulesets/controversial.xml"/>
|
||||
<rule ref="rulesets/design.xml"/>
|
||||
<rule ref="rulesets/naming.xml"/>
|
||||
<rule ref="rulesets/unusedcode.xml"/>
|
||||
<rule
|
||||
name="NPathComplexity"
|
||||
message="The {0} {1}() has an NPath complexity of {2}. The configured NPath complexity threshold is {3}."
|
||||
class="PHP_PMD_Rule_Design_NpathComplexity"
|
||||
>
|
||||
<properties>
|
||||
<property name="minimum" description="The npath reporting threshold" value="10"/>
|
||||
</properties>
|
||||
</rule>
|
||||
</ruleset>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0"?>
|
||||
<phpunit
|
||||
bootstrap="./vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
verbose="true"
|
||||
stopOnFailure="false"
|
||||
processIsolation="false"
|
||||
backupGlobals="false"
|
||||
syntaxCheck="true"
|
||||
>
|
||||
<testsuite name="Doctrine\Instantiator tests">
|
||||
<directory>./tests/DoctrineTest/InstantiatorTest</directory>
|
||||
</testsuite>
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<logging>
|
||||
<log type="coverage-clover" target="./coverage.clover"/>
|
||||
</logging>
|
||||
</phpunit>
|
29
core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php
vendored
Normal file
29
core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Exception/ExceptionInterface.php
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Instantiator\Exception;
|
||||
|
||||
/**
|
||||
* Base exception marker interface for the instantiator component
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
interface ExceptionInterface
|
||||
{
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Instantiator\Exception;
|
||||
|
||||
use InvalidArgumentException as BaseInvalidArgumentException;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* Exception for invalid arguments provided to the instantiator
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromNonExistingClass($className)
|
||||
{
|
||||
if (interface_exists($className)) {
|
||||
return new self(sprintf('The provided type "%s" is an interface, and can not be instantiated', $className));
|
||||
}
|
||||
|
||||
if (PHP_VERSION_ID >= 50400 && trait_exists($className)) {
|
||||
return new self(sprintf('The provided type "%s" is a trait, and can not be instantiated', $className));
|
||||
}
|
||||
|
||||
return new self(sprintf('The provided class "%s" does not exist', $className));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionClass $reflectionClass
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromAbstractClass(ReflectionClass $reflectionClass)
|
||||
{
|
||||
return new self(sprintf(
|
||||
'The provided class "%s" is abstract, and can not be instantiated',
|
||||
$reflectionClass->getName()
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Instantiator\Exception;
|
||||
|
||||
use Exception;
|
||||
use ReflectionClass;
|
||||
use UnexpectedValueException as BaseUnexpectedValueException;
|
||||
|
||||
/**
|
||||
* Exception for given parameters causing invalid/unexpected state on instantiation
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class UnexpectedValueException extends BaseUnexpectedValueException implements ExceptionInterface
|
||||
{
|
||||
/**
|
||||
* @param ReflectionClass $reflectionClass
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromSerializationTriggeredException(ReflectionClass $reflectionClass, Exception $exception)
|
||||
{
|
||||
return new self(
|
||||
sprintf(
|
||||
'An exception was raised while trying to instantiate an instance of "%s" via un-serialization',
|
||||
$reflectionClass->getName()
|
||||
),
|
||||
0,
|
||||
$exception
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionClass $reflectionClass
|
||||
* @param string $errorString
|
||||
* @param int $errorCode
|
||||
* @param string $errorFile
|
||||
* @param int $errorLine
|
||||
*
|
||||
* @return UnexpectedValueException
|
||||
*/
|
||||
public static function fromUncleanUnSerialization(
|
||||
ReflectionClass $reflectionClass,
|
||||
$errorString,
|
||||
$errorCode,
|
||||
$errorFile,
|
||||
$errorLine
|
||||
) {
|
||||
return new self(
|
||||
sprintf(
|
||||
'Could not produce an instance of "%s" via un-serialization, since an error was triggered '
|
||||
. 'in file "%s" at line "%d"',
|
||||
$reflectionClass->getName(),
|
||||
$errorFile,
|
||||
$errorLine
|
||||
),
|
||||
0,
|
||||
new Exception($errorString, $errorCode)
|
||||
);
|
||||
}
|
||||
}
|
254
core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php
vendored
Normal file
254
core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php
vendored
Normal file
|
@ -0,0 +1,254 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Instantiator;
|
||||
|
||||
use Closure;
|
||||
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
||||
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
||||
use Exception;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
final class Instantiator implements InstantiatorInterface
|
||||
{
|
||||
/**
|
||||
* Markers used internally by PHP to define whether {@see \unserialize} should invoke
|
||||
* the method {@see \Serializable::unserialize()} when dealing with classes implementing
|
||||
* the {@see \Serializable} interface.
|
||||
*/
|
||||
const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
|
||||
const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O';
|
||||
|
||||
/**
|
||||
* @var \Closure[] of {@see \Closure} instances used to instantiate specific classes
|
||||
*/
|
||||
private static $cachedInstantiators = array();
|
||||
|
||||
/**
|
||||
* @var object[] of objects that can directly be cloned
|
||||
*/
|
||||
private static $cachedCloneables = array();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function instantiate($className)
|
||||
{
|
||||
if (isset(self::$cachedCloneables[$className])) {
|
||||
return clone self::$cachedCloneables[$className];
|
||||
}
|
||||
|
||||
if (isset(self::$cachedInstantiators[$className])) {
|
||||
$factory = self::$cachedInstantiators[$className];
|
||||
|
||||
return $factory();
|
||||
}
|
||||
|
||||
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
|
||||
$instance = $factory();
|
||||
$reflection = new ReflectionClass($instance);
|
||||
|
||||
if ($this->isSafeToClone($reflection)) {
|
||||
self::$cachedCloneables[$className] = clone $instance;
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @private
|
||||
*
|
||||
* Builds a {@see \Closure} capable of instantiating the given $className without
|
||||
* invoking its constructor.
|
||||
* This method is only exposed as public because of PHP 5.3 compatibility. Do not
|
||||
* use this method in your own code
|
||||
*
|
||||
* @param string $className
|
||||
*
|
||||
* @return Closure
|
||||
*/
|
||||
public function buildFactory($className)
|
||||
{
|
||||
$reflectionClass = $this->getReflectionClass($className);
|
||||
|
||||
if ($this->isInstantiableViaReflection($reflectionClass)) {
|
||||
return function () use ($reflectionClass) {
|
||||
return $reflectionClass->newInstanceWithoutConstructor();
|
||||
};
|
||||
}
|
||||
|
||||
$serializedString = sprintf(
|
||||
'%s:%d:"%s":0:{}',
|
||||
$this->getSerializationFormat($reflectionClass),
|
||||
strlen($className),
|
||||
$className
|
||||
);
|
||||
|
||||
$this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString);
|
||||
|
||||
return function () use ($serializedString) {
|
||||
return unserialize($serializedString);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return ReflectionClass
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
private function getReflectionClass($className)
|
||||
{
|
||||
if (! class_exists($className)) {
|
||||
throw InvalidArgumentException::fromNonExistingClass($className);
|
||||
}
|
||||
|
||||
$reflection = new ReflectionClass($className);
|
||||
|
||||
if ($reflection->isAbstract()) {
|
||||
throw InvalidArgumentException::fromAbstractClass($reflection);
|
||||
}
|
||||
|
||||
return $reflection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionClass $reflectionClass
|
||||
* @param string $serializedString
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString)
|
||||
{
|
||||
set_error_handler(function ($code, $message, $file, $line) use ($reflectionClass, & $error) {
|
||||
$error = UnexpectedValueException::fromUncleanUnSerialization(
|
||||
$reflectionClass,
|
||||
$message,
|
||||
$code,
|
||||
$file,
|
||||
$line
|
||||
);
|
||||
});
|
||||
|
||||
try {
|
||||
unserialize($serializedString);
|
||||
} catch (Exception $exception) {
|
||||
restore_error_handler();
|
||||
|
||||
throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception);
|
||||
}
|
||||
|
||||
restore_error_handler();
|
||||
|
||||
if ($error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReflectionClass $reflectionClass
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isInstantiableViaReflection(ReflectionClass $reflectionClass)
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 50600) {
|
||||
return ! ($reflectionClass->isInternal() && $reflectionClass->isFinal());
|
||||
}
|
||||
|
||||
return \PHP_VERSION_ID >= 50400 && ! $this->hasInternalAncestors($reflectionClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies whether the given class is to be considered internal
|
||||
*
|
||||
* @param ReflectionClass $reflectionClass
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function hasInternalAncestors(ReflectionClass $reflectionClass)
|
||||
{
|
||||
do {
|
||||
if ($reflectionClass->isInternal()) {
|
||||
return true;
|
||||
}
|
||||
} while ($reflectionClass = $reflectionClass->getParentClass());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies if the given PHP version implements the `Serializable` interface serialization
|
||||
* with an incompatible serialization format. If that's the case, use serialization marker
|
||||
* "C" instead of "O".
|
||||
*
|
||||
* @link http://news.php.net/php.internals/74654
|
||||
*
|
||||
* @param ReflectionClass $reflectionClass
|
||||
*
|
||||
* @return string the serialization format marker, either self::SERIALIZATION_FORMAT_USE_UNSERIALIZER
|
||||
* or self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER
|
||||
*/
|
||||
private function getSerializationFormat(ReflectionClass $reflectionClass)
|
||||
{
|
||||
if ($this->isPhpVersionWithBrokenSerializationFormat()
|
||||
&& $reflectionClass->implementsInterface('Serializable')
|
||||
) {
|
||||
return self::SERIALIZATION_FORMAT_USE_UNSERIALIZER;
|
||||
}
|
||||
|
||||
return self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the current PHP runtime uses an incompatible serialization format
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isPhpVersionWithBrokenSerializationFormat()
|
||||
{
|
||||
return PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a class is cloneable
|
||||
*
|
||||
* @param ReflectionClass $reflection
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isSafeToClone(ReflectionClass $reflection)
|
||||
{
|
||||
if (method_exists($reflection, 'isCloneable') && ! $reflection->isCloneable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// not cloneable if it implements `__clone`, as we want to avoid calling it
|
||||
return ! $reflection->hasMethod('__clone');
|
||||
}
|
||||
}
|
37
core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php
vendored
Normal file
37
core/vendor/doctrine/instantiator/src/Doctrine/Instantiator/InstantiatorInterface.php
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\Instantiator;
|
||||
|
||||
/**
|
||||
* Instantiator provides utility methods to build objects without invoking their constructors
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
interface InstantiatorInterface
|
||||
{
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @throws \Doctrine\Instantiator\Exception\ExceptionInterface
|
||||
*/
|
||||
public function instantiate($className);
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorPerformance;
|
||||
|
||||
use Athletic\AthleticEvent;
|
||||
use Doctrine\Instantiator\Instantiator;
|
||||
|
||||
/**
|
||||
* Performance tests for {@see \Doctrine\Instantiator\Instantiator}
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class InstantiatorPerformanceEvent extends AthleticEvent
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\Instantiator\Instantiator
|
||||
*/
|
||||
private $instantiator;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->instantiator = new Instantiator();
|
||||
|
||||
$this->instantiator->instantiate(__CLASS__);
|
||||
$this->instantiator->instantiate('ArrayObject');
|
||||
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
|
||||
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
|
||||
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
|
||||
}
|
||||
|
||||
/**
|
||||
* @iterations 20000
|
||||
* @baseline
|
||||
* @group instantiation
|
||||
*/
|
||||
public function testInstantiateSelf()
|
||||
{
|
||||
$this->instantiator->instantiate(__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
* @iterations 20000
|
||||
* @group instantiation
|
||||
*/
|
||||
public function testInstantiateInternalClass()
|
||||
{
|
||||
$this->instantiator->instantiate('ArrayObject');
|
||||
}
|
||||
|
||||
/**
|
||||
* @iterations 20000
|
||||
* @group instantiation
|
||||
*/
|
||||
public function testInstantiateSimpleSerializableAssetClass()
|
||||
{
|
||||
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
|
||||
}
|
||||
|
||||
/**
|
||||
* @iterations 20000
|
||||
* @group instantiation
|
||||
*/
|
||||
public function testInstantiateSerializableArrayObjectAsset()
|
||||
{
|
||||
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
|
||||
}
|
||||
|
||||
/**
|
||||
* @iterations 20000
|
||||
* @group instantiation
|
||||
*/
|
||||
public function testInstantiateUnCloneableAsset()
|
||||
{
|
||||
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTest\Exception;
|
||||
|
||||
use Doctrine\Instantiator\Exception\InvalidArgumentException;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* Tests for {@see \Doctrine\Instantiator\Exception\InvalidArgumentException}
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*
|
||||
* @covers \Doctrine\Instantiator\Exception\InvalidArgumentException
|
||||
*/
|
||||
class InvalidArgumentExceptionTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testFromNonExistingTypeWithNonExistingClass()
|
||||
{
|
||||
$className = __CLASS__ . uniqid();
|
||||
$exception = InvalidArgumentException::fromNonExistingClass($className);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\InvalidArgumentException', $exception);
|
||||
$this->assertSame('The provided class "' . $className . '" does not exist', $exception->getMessage());
|
||||
}
|
||||
|
||||
public function testFromNonExistingTypeWithTrait()
|
||||
{
|
||||
if (PHP_VERSION_ID < 50400) {
|
||||
$this->markTestSkipped('Need at least PHP 5.4.0, as this test requires traits support to run');
|
||||
}
|
||||
|
||||
$exception = InvalidArgumentException::fromNonExistingClass(
|
||||
'DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset'
|
||||
);
|
||||
|
||||
$this->assertSame(
|
||||
'The provided type "DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset" is a trait, '
|
||||
. 'and can not be instantiated',
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testFromNonExistingTypeWithInterface()
|
||||
{
|
||||
$exception = InvalidArgumentException::fromNonExistingClass('Doctrine\\Instantiator\\InstantiatorInterface');
|
||||
|
||||
$this->assertSame(
|
||||
'The provided type "Doctrine\\Instantiator\\InstantiatorInterface" is an interface, '
|
||||
. 'and can not be instantiated',
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testFromAbstractClass()
|
||||
{
|
||||
$reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
|
||||
$exception = InvalidArgumentException::fromAbstractClass($reflection);
|
||||
|
||||
$this->assertSame(
|
||||
'The provided class "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" is abstract, '
|
||||
. 'and can not be instantiated',
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTest\Exception;
|
||||
|
||||
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
||||
use Exception;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* Tests for {@see \Doctrine\Instantiator\Exception\UnexpectedValueException}
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*
|
||||
* @covers \Doctrine\Instantiator\Exception\UnexpectedValueException
|
||||
*/
|
||||
class UnexpectedValueExceptionTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testFromSerializationTriggeredException()
|
||||
{
|
||||
$reflectionClass = new ReflectionClass($this);
|
||||
$previous = new Exception();
|
||||
$exception = UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $previous);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception);
|
||||
$this->assertSame($previous, $exception->getPrevious());
|
||||
$this->assertSame(
|
||||
'An exception was raised while trying to instantiate an instance of "'
|
||||
. __CLASS__ . '" via un-serialization',
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
public function testFromUncleanUnSerialization()
|
||||
{
|
||||
$reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
|
||||
$exception = UnexpectedValueException::fromUncleanUnSerialization($reflection, 'foo', 123, 'bar', 456);
|
||||
|
||||
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception);
|
||||
$this->assertSame(
|
||||
'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" '
|
||||
. 'via un-serialization, since an error was triggered in file "bar" at line "456"',
|
||||
$exception->getMessage()
|
||||
);
|
||||
|
||||
$previous = $exception->getPrevious();
|
||||
|
||||
$this->assertInstanceOf('Exception', $previous);
|
||||
$this->assertSame('foo', $previous->getMessage());
|
||||
$this->assertSame(123, $previous->getCode());
|
||||
}
|
||||
}
|
216
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php
vendored
Normal file
216
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php
vendored
Normal file
|
@ -0,0 +1,216 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTest;
|
||||
|
||||
use Doctrine\Instantiator\Exception\UnexpectedValueException;
|
||||
use Doctrine\Instantiator\Instantiator;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
* Tests for {@see \Doctrine\Instantiator\Instantiator}
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*
|
||||
* @covers \Doctrine\Instantiator\Instantiator
|
||||
*/
|
||||
class InstantiatorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var Instantiator
|
||||
*/
|
||||
private $instantiator;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->instantiator = new Instantiator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @dataProvider getInstantiableClasses
|
||||
*/
|
||||
public function testCanInstantiate($className)
|
||||
{
|
||||
$this->assertInstanceOf($className, $this->instantiator->instantiate($className));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
*
|
||||
* @dataProvider getInstantiableClasses
|
||||
*/
|
||||
public function testInstantiatesSeparateInstances($className)
|
||||
{
|
||||
$instance1 = $this->instantiator->instantiate($className);
|
||||
$instance2 = $this->instantiator->instantiate($className);
|
||||
|
||||
$this->assertEquals($instance1, $instance2);
|
||||
$this->assertNotSame($instance1, $instance2);
|
||||
}
|
||||
|
||||
public function testExceptionOnUnSerializationException()
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped(
|
||||
'As of facebook/hhvm#3432, HHVM has no PDORow, and therefore '
|
||||
. ' no internal final classes that cannot be instantiated'
|
||||
);
|
||||
}
|
||||
|
||||
$className = 'DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset';
|
||||
|
||||
if (\PHP_VERSION_ID >= 50600) {
|
||||
$className = 'PDORow';
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) {
|
||||
$className = 'DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset';
|
||||
}
|
||||
|
||||
$this->setExpectedException('Doctrine\\Instantiator\\Exception\\UnexpectedValueException');
|
||||
|
||||
$this->instantiator->instantiate($className);
|
||||
}
|
||||
|
||||
public function testNoticeOnUnSerializationException()
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 50600) {
|
||||
$this->markTestSkipped(
|
||||
'PHP 5.6 supports `ReflectionClass#newInstanceWithoutConstructor()` for some internal classes'
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
||||
|
||||
$this->fail('No exception was raised');
|
||||
} catch (UnexpectedValueException $exception) {
|
||||
$wakeUpNoticesReflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
||||
$previous = $exception->getPrevious();
|
||||
|
||||
$this->assertInstanceOf('Exception', $previous);
|
||||
|
||||
// in PHP 5.4.29 and PHP 5.5.13, this case is not a notice, but an exception being thrown
|
||||
if (! (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513)) {
|
||||
$this->assertSame(
|
||||
'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\WakeUpNoticesAsset" '
|
||||
. 'via un-serialization, since an error was triggered in file "'
|
||||
. $wakeUpNoticesReflection->getFileName() . '" at line "36"',
|
||||
$exception->getMessage()
|
||||
);
|
||||
|
||||
$this->assertSame('Something went bananas while un-serializing this instance', $previous->getMessage());
|
||||
$this->assertSame(\E_USER_NOTICE, $previous->getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $invalidClassName
|
||||
*
|
||||
* @dataProvider getInvalidClassNames
|
||||
*/
|
||||
public function testInstantiationFromNonExistingClass($invalidClassName)
|
||||
{
|
||||
$this->setExpectedException('Doctrine\\Instantiator\\Exception\\InvalidArgumentException');
|
||||
|
||||
$this->instantiator->instantiate($invalidClassName);
|
||||
}
|
||||
|
||||
public function testInstancesAreNotCloned()
|
||||
{
|
||||
$className = 'TemporaryClass' . uniqid();
|
||||
|
||||
eval('namespace ' . __NAMESPACE__ . '; class ' . $className . '{}');
|
||||
|
||||
$instance = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);
|
||||
|
||||
$instance->foo = 'bar';
|
||||
|
||||
$instance2 = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);
|
||||
|
||||
$this->assertObjectNotHasAttribute('foo', $instance2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a list of instantiable classes (existing)
|
||||
*
|
||||
* @return string[][]
|
||||
*/
|
||||
public function getInstantiableClasses()
|
||||
{
|
||||
$classes = array(
|
||||
array('stdClass'),
|
||||
array(__CLASS__),
|
||||
array('Doctrine\\Instantiator\\Instantiator'),
|
||||
array('PharException'),
|
||||
array('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset'),
|
||||
array('DoctrineTest\\InstantiatorTestAsset\\PharExceptionAsset'),
|
||||
array('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset'),
|
||||
array('DoctrineTest\\InstantiatorTestAsset\\XMLReaderAsset'),
|
||||
);
|
||||
|
||||
if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) {
|
||||
return $classes;
|
||||
}
|
||||
|
||||
$classes = array_merge(
|
||||
$classes,
|
||||
array(
|
||||
array('PharException'),
|
||||
array('ArrayObject'),
|
||||
array('DoctrineTest\\InstantiatorTestAsset\\ArrayObjectAsset'),
|
||||
array('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset'),
|
||||
)
|
||||
);
|
||||
|
||||
if (\PHP_VERSION_ID >= 50600) {
|
||||
$classes[] = array('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
|
||||
$classes[] = array('DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset');
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a list of instantiable classes (existing)
|
||||
*
|
||||
* @return string[][]
|
||||
*/
|
||||
public function getInvalidClassNames()
|
||||
{
|
||||
$classNames = array(
|
||||
array(__CLASS__ . uniqid()),
|
||||
array('Doctrine\\Instantiator\\InstantiatorInterface'),
|
||||
array('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset'),
|
||||
);
|
||||
|
||||
if (\PHP_VERSION_ID >= 50400) {
|
||||
$classNames[] = array('DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset');
|
||||
}
|
||||
|
||||
return $classNames;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
/**
|
||||
* A simple asset for an abstract class
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
abstract class AbstractClassAsset
|
||||
{
|
||||
}
|
41
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ArrayObjectAsset.php
vendored
Normal file
41
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/ArrayObjectAsset.php
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use ArrayObject;
|
||||
use BadMethodCallException;
|
||||
|
||||
/**
|
||||
* Test asset that extends an internal PHP class
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class ArrayObjectAsset extends ArrayObject
|
||||
{
|
||||
/**
|
||||
* Constructor - should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
}
|
41
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharAsset.php
vendored
Normal file
41
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/PharAsset.php
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Phar;
|
||||
|
||||
/**
|
||||
* Test asset that extends an internal PHP class
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class PharAsset extends Phar
|
||||
{
|
||||
/**
|
||||
* Constructor - should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use BadMethodCallException;
|
||||
use PharException;
|
||||
|
||||
/**
|
||||
* Test asset that extends an internal PHP class
|
||||
* This class should be serializable without problems
|
||||
* and without getting the "Erroneous data format for unserializing"
|
||||
* error
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class PharExceptionAsset extends PharException
|
||||
{
|
||||
/**
|
||||
* Constructor - should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use ArrayObject;
|
||||
use BadMethodCallException;
|
||||
use Serializable;
|
||||
|
||||
/**
|
||||
* Serializable test asset that also extends an internal class
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class SerializableArrayObjectAsset extends ArrayObject implements Serializable
|
||||
{
|
||||
/**
|
||||
* Constructor - should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Serializable;
|
||||
|
||||
/**
|
||||
* Base serializable test asset
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class SimpleSerializableAsset implements Serializable
|
||||
{
|
||||
/**
|
||||
* Constructor - should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
}
|
29
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleTraitAsset.php
vendored
Normal file
29
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/SimpleTraitAsset.php
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
/**
|
||||
* A simple trait with no attached logic
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
trait SimpleTraitAsset
|
||||
{
|
||||
}
|
50
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnCloneableAsset.php
vendored
Normal file
50
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/UnCloneableAsset.php
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use BadMethodCallException;
|
||||
|
||||
/**
|
||||
* Base un-cloneable asset
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class UnCloneableAsset
|
||||
{
|
||||
/**
|
||||
* Constructor - should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic `__clone` - should not be invoked
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use ArrayObject;
|
||||
use BadMethodCallException;
|
||||
|
||||
/**
|
||||
* A simple asset for an abstract class
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class UnserializeExceptionArrayObjectAsset extends ArrayObject
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
throw new BadMethodCallException();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use ArrayObject;
|
||||
|
||||
/**
|
||||
* A simple asset for an abstract class
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
*/
|
||||
class WakeUpNoticesAsset extends ArrayObject
|
||||
{
|
||||
/**
|
||||
* Wakeup method called after un-serialization
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
trigger_error('Something went bananas while un-serializing this instance');
|
||||
}
|
||||
}
|
41
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/XMLReaderAsset.php
vendored
Normal file
41
core/vendor/doctrine/instantiator/tests/DoctrineTest/InstantiatorTestAsset/XMLReaderAsset.php
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace DoctrineTest\InstantiatorTestAsset;
|
||||
|
||||
use BadMethodCallException;
|
||||
use XMLReader;
|
||||
|
||||
/**
|
||||
* Test asset that extends an internal PHP class
|
||||
*
|
||||
* @author Dave Marshall <dave@atst.io>
|
||||
*/
|
||||
class XMLReaderAsset extends XMLReader
|
||||
{
|
||||
/**
|
||||
* Constructor - should not be called
|
||||
*
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
throw new BadMethodCallException('Not supposed to be called!');
|
||||
}
|
||||
}
|
|
@ -1,6 +1,18 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
4.1.8 (2014-08-14)
|
||||
------------------
|
||||
|
||||
* Fixed an issue in the CurlFactory that caused setting the `stream=false`
|
||||
request option to throw an exception.
|
||||
See: https://github.com/guzzle/guzzle/issues/769
|
||||
* TransactionIterator now calls rewind on the inner iterator.
|
||||
See: https://github.com/guzzle/guzzle/pull/765
|
||||
* You can now set the `Content-Type` header to `multipart/form-data`
|
||||
when creating POST requests to force multipart bodies.
|
||||
See https://github.com/guzzle/guzzle/issues/768
|
||||
|
||||
4.1.7 (2014-08-07)
|
||||
------------------
|
||||
|
||||
|
|
|
@ -278,8 +278,16 @@ class CurlFactory
|
|||
$options[CURLOPT_SSLKEY] = $value;
|
||||
}
|
||||
|
||||
private function add_stream()
|
||||
{
|
||||
private function add_stream(
|
||||
RequestInterface $request,
|
||||
RequestMediator $mediator,
|
||||
&$options,
|
||||
$value
|
||||
) {
|
||||
if ($value === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new AdapterException('cURL adapters do not support the "stream"'
|
||||
. ' request option. This error is typically encountered when trying'
|
||||
. ' to send requests with the "stream" option set to true in '
|
||||
|
|
|
@ -69,5 +69,10 @@ class TransactionIterator implements \Iterator
|
|||
return $this->source->valid();
|
||||
}
|
||||
|
||||
public function rewind() {}
|
||||
public function rewind()
|
||||
{
|
||||
if (!($this->source instanceof \Generator)) {
|
||||
$this->source->rewind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue